Changeset 10


Ignore:
Timestamp:
Apr 1, 2007, 6:37:18 PM (11 years ago)
Author:
julian
Message:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/DB.class.php

    r6 r10  
    5454    }
    5555
    56     public function Raw2Array() {
     56    public function raw2Array() {
    5757        $temp = array();
    5858        while($curRow = $this->curResult->fetch_array())
     
    6262    }
    6363
    64     public function Raw2FVArray() {
     64    public function raw2FVArray() {
    6565        $temp = array();
    6666
  • trunk/modules/PrivateMessages.class.php

    r8 r10  
    2828        $this->modules['PageParts']->setInPrivateMessages(TRUE);
    2929        $this->modules['Language']->addFile('PrivateMessages');
    30         $this->modules['Navbar']->addElement($this->modules['Language']->getString('Private_messages'),INDEXFILE.'?Action=PrivateMessages&'.MYSID);
     30        $this->modules['Navbar']->addElement($this->modules['Language']->getString('Private_messages'),INDEXFILE.'?action=PrivateMessages&'.MYSID);
    3131
    3232        $inboxFolderData = array('folderID'=>0,'folderName'=>$this->modules['Language']->getString('Inbox'));
     
    9090                }
    9191
     92                $this->modules['DB']->query("SELECT * FROM ".TBLPFX."pms_folders WHERE userID='".USERID."' ORDER BY folderName ASC");
     93                $foldersData = array_merge(array($inboxFolderData,$outboxFolderData),$this->modules['DB']->raw2Array());
     94
     95                while(list($curKey) = each($foldersData))
     96                    $foldersData[$curKey]['_moveText'] = sprintf($this->modules['Language']->getString('Move_messages_to'),$foldersData[$curKey]['folderName']);
     97
    9298                $this->modules['Navbar']->addElement(Functions::HTMLSpecialChars($folderData['folderName']),INDEXFILE.'?action=PrivateMessages&folderID='.$folderID.'&'.MYSID);
    9399
     
    96102                    'pmsData'=>$pmsData,
    97103                    'folderID'=>$folderID,
    98                     'page'=>$page
     104                    'page'=>$page,
     105                    'foldersData'=>$foldersData
    99106                ));
    100107
     
    103110
    104111            case 'NewPM':
    105                 $this->modules['Navbar']->addElement($this->modules['Language']->getString('New_private_message'),INDEXFILE.'?Action=PrivateMessages&Mode=NewPM&'.MYSID);
    106 
    107                 $p = Functions::getSGValues($_POST['p'],array('Recipients','PMSubject','PMMessageText'),'');
     112                $this->modules['Navbar']->addElement($this->modules['Language']->getString('New_private_message'),INDEXFILE.'?action=PrivateMessages&Mode=NewPM&'.MYSID);
     113
     114                $p = Functions::getSGValues($_POST['p'],array('recipients','pmSubject','pmMessageText'),'');
    108115
    109116                $c = array();
    110                 $c['EnableSmilies'] = $c['EnableBBCode'] = $c['ShowSignature'] = $c['SaveOutbox'] = 1;
    111                 $c['EnableHtmlCode'] = $c['RequestReadReceipt'] = 0;
     117                $c['enableSmilies'] = $c['enableBBCode'] = $c['showSignature'] = $c['saveOutbox'] = 1;
     118                $c['enableHtmlCode'] = $c['requestReadReceipt'] = 0;
    112119
    113120                $error = '';
    114121
    115                 if(isset($_GET['Doit'])) {
    116                     $c['EnableSmilies'] = (isset($_POST['c']['EnableSmilies']) && $this->modules['Config']->getValue('allow_pms_smilies') == 1) ? 1 : 0;
    117                     $c['ShowSignature'] = (isset($_POST['c']['ShowSignature']) && $this->modules['Config']->getValue('enable_sig') == 1) ? 1 : 0;
    118                     $c['EnableBBCode'] = (isset($_POST['c']['EnableBBCode']) && $this->modules['Config']->getValue('allow_pms_bbcode') == 1) ? 1 : 0;
    119                     $c['SaveOutbox'] = (isset($_POST['c']['SaveOutbox']) && $this->modules['Config']->getValue('enable_outbox') == 1) ? 1 : 0;
    120                     $c['RequestReadReceipt'] = (isset($_POST['c']['RequestReadReceipt']) && $this->modules['Config']->getValue('allow_pms_rconfirmation') == 1) ? 1 : 0;
    121 
    122                     $recipients = explode(',',$p['Recipients']);
     122                if(isset($_GET['doit'])) {
     123                    $c['enableSmilies'] = (isset($_POST['c']['enableSmilies']) && $this->modules['Config']->getValue('allow_pms_smilies') == 1) ? 1 : 0;
     124                    $c['showSignature'] = (isset($_POST['c']['showSignature']) && $this->modules['Config']->getValue('enable_sig') == 1) ? 1 : 0;
     125                    $c['enableBBCode'] = (isset($_POST['c']['enableBBCode']) && $this->modules['Config']->getValue('allow_pms_bbcode') == 1) ? 1 : 0;
     126                    $c['saveOutbox'] = (isset($_POST['c']['saveOutbox']) && $this->modules['Config']->getValue('enable_outbox') == 1) ? 1 : 0;
     127                    $c['requestReadReceipt'] = (isset($_POST['c']['requestReadReceipt']) && $this->modules['Config']->getValue('allow_pms_rconfirmation') == 1) ? 1 : 0;
     128
     129                    $recipients = explode(',',$p['recipients']);
    123130                    while(list($curKey) = each($recipients)) {
    124131                        $recipients[$curKey] = trim($recipients[$curKey]);
     
    128135
    129136                    if(count($recipients) == 0) $error = $this->modules['Language']->getString('error_no_recipient');
    130                     elseif(trim($p['PMSubject']) == '') $error = $this->modules['Language']->getString('error_no_subject');
    131                     elseif(trim($p['PMMessageText']) == '') $error = $this->modules['Language']->getString('error_no_message');
     137                    elseif(trim($p['pmSubject']) == '') $error = $this->modules['Language']->getString('error_no_subject');
     138                    elseif(trim($p['pmMessageText']) == '') $error = $this->modules['Language']->getString('error_no_message');
    132139                    else {
    133140                        foreach($recipients AS $curRecipient) {
    134                             $this->modules['DB']->query("INSERT INTO ".TBLPFX."pms SET
    135                                 FolderID='0',
    136                                 PMFromID='".USERID."',
    137                                 PMToID='".$curRecipient."',
    138                                 PMIsRead='0',
    139                                 PMType='0',
    140                                 PMSubject='".$p['PMSubject']."',
    141                                 PMMessageText='".$p['PMMessageText']."',
    142                                 PMSendTimestamp='".time()."',
    143                                 PMEnableBBCode='".$c['EnableBBCode']."',
    144                                 PMEnableSmilies='".$c['EnableSmilies']."',
    145                                 PMEnableHtmlCode='".$c['EnableHtmlCode']."',
    146                                 PMShowSignature='".$c['ShowSignature']."',
    147                                 PMRequestReadReceipt='".$c['RequestReadReceipt']."'
     141                            $this->modules['DB']->query("
     142                                INSERT INTO
     143                                    ".TBLPFX."pms
     144                                SET
     145                                    folderID='0',
     146                                    pmFromID='".USERID."',
     147                                    pmToID='".$curRecipient."',
     148                                    pmIsRead='0',
     149                                    pmType='0',
     150                                    pmSubject='".$p['pmSubject']."',
     151                                    pmMessageText='".$p['pmMessageText']."',
     152                                    pmSendTimestamp='".time()."',
     153                                    pmEnableBBCode='".$c['enableBBCode']."',
     154                                    pmEnableSmilies='".$c['enableSmilies']."',
     155                                    pmEnableHtmlCode='".$c['enableHtmlCode']."',
     156                                    pmShowSignature='".$c['showSignature']."',
     157                                    pmRequestReadReceipt='".$c['requestReadReceipt']."'
    148158                            ");
    149159
    150                             if($c['SaveOutbox'] == 1) {
    151                                 $this->modules['DB']->query("INSERT INTO ".TBLPFX."pms SET
    152                                     FolderID='1',
    153                                     PMFromID='".$curRecipient."',
    154                                     PMToID='".USERID."',
    155                                     PMIsRead='1',
    156                                     PMType='1',
    157                                     PMSubject='".$p['PMSubject']."',
    158                                     PMMessageText='".$p['PMMessageText']."',
    159                                     PMSendTimestamp='".time()."',
    160                                     PMEnableBBCode='".$c['EnableBBCode']."',
    161                                     PMEnableSmilies='".$c['EnableSmilies']."',
    162                                     PMEnableHtmlCode='".$c['EnableHtmlCode']."',
    163                                     PMShowSignature='".$c['ShowSignature']."',
    164                                     PMRequestReadReceipt='".$c['RequestReadReceipt']."'
     160                            if($c['saveOutbox'] == 1) {
     161                                $this->modules['DB']->query("
     162                                    INSERT INTO
     163                                        ".TBLPFX."pms
     164                                    SET
     165                                        folderID='1',
     166                                        pmFromID='".$curRecipient."',
     167                                        pmToID='".USERID."',
     168                                        pmIsRead='1',
     169                                        pmType='1',
     170                                        pmSubject='".$p['pmSubject']."',
     171                                        pmMessageText='".$p['pmMessageText']."',
     172                                        pmSendTimestamp='".time()."',
     173                                        pmEnableBBCode='".$c['enableBBCode']."',
     174                                        pmEnableSmilies='".$c['enableSmilies']."',
     175                                        pmEnableHtmlCode='".$c['enableHtmlCode']."',
     176                                        pmShowSignature='".$c['showSignature']."',
     177                                        pmRequestReadReceipt='".$c['requestReadReceipt']."'
    165178                                ");
    166179                            }
    167180                        }
    168                         Functions::myHeader(INDEXFILE."?Action=PrivateMessages&".MYSID);
     181                        Functions::myHeader(INDEXFILE."?action=PrivateMessages&".MYSID);
    169182                    }
    170183                }
    171184
    172185                $show = array();
    173                 $show['EnableSmilies'] = $this->modules['Config']->getValue('allow_pms_smilies') == 1;
    174                 $show['ShowSignature'] = $this->modules['Config']->getValue('enable_sig') == 1 && $this->modules['Config']->getValue('allow_pms_signature') == 1;
    175                 $show['EnableBBCode'] = $this->modules['Config']->getValue('allow_pms_bbcode') == 1;
    176                 $show['EnableHtmlCode'] = $this->modules['Config']->getValue('allow_pms_htmlcode') == 1;
    177                 $show['SaveOutbox'] = $this->modules['Config']->getValue('enable_outbox') == 1;
    178                 $show['RequestReadReceipt'] = $this->modules['Config']->getValue('allow_pms_rconfirmation') == 1;
     186                $show['enableSmilies'] = $this->modules['Config']->getValue('allow_pms_smilies') == 1;
     187                $show['showSignature'] = $this->modules['Config']->getValue('enable_sig') == 1 && $this->modules['Config']->getValue('allow_pms_signature') == 1;
     188                $show['enableBBCode'] = $this->modules['Config']->getValue('allow_pms_bbcode') == 1;
     189                $show['enableHtmlCode'] = $this->modules['Config']->getValue('allow_pms_htmlcode') == 1;
     190                $show['saveOutbox'] = $this->modules['Config']->getValue('enable_outbox') == 1;
     191                $show['requestReadReceipt'] = $this->modules['Config']->getValue('allow_pms_rconfirmation') == 1;
    179192
    180193                $smilies = array(); $smiliesBox = '';
    181                 if($show['EnableSmilies']) {
     194                if($show['enableSmilies']) {
    182195                    $smilies = $this->modules['Cache']->getSmiliesData('write');
    183196                    $smiliesBox = Functions::getSmiliesBox();
    184197                }
    185                 $pPicsBox = Functions :: getPPicsBox();
    186 
    187                 $this->modules['Template']->assign(array(
    188                     'Show'=>$show,
    189                     'Error'=>$error,
    190                     'SmiliesBox'=>$smiliesBox,
     198                $topicPicsBox = Functions :: getTopicPicsBox();
     199
     200                $this->modules['Template']->assign(array(
     201                    'show'=>$show,
     202                    'error'=>$error,
     203                    'smiliesBox'=>$smiliesBox,
     204                    'topicPicsBox'=>$topicPicsBox,
    191205                    'p'=>$p,
    192206                    'c'=>$c
     
    196210            break;
    197211
    198             case 'newpmreceived':
    199                 $pms_tpl = new Template($tEMPLATE_PATH.'/'.$tCONFIG['templates']['pms_newpmreceived']);
    200 
     212            case 'popNewPMReceived':
     213                // TODO: Alles
    201214                include_once('pop_pheader.php');
    202215                $pms_tpl->parseCode(TRUE);
     
    204217            break;
    205218
    206             case 'markread':
    207                 $pm_ids = isset($_POST['pm_ids']) ? $_POST['pm_ids'] : array();
    208 
    209                 $return_z = isset($_GET['return_z']) ? $_GET['return_z'] : 1; // Die Seite, zu der zurueckgekehrt werden soll
    210                 $return_f = isset($_GET['return_f']) ? $_GET['return_f'] : 0; // Der Ordner, in den zurueckgekehrt werden soll
    211 
    212                 if(count($pm_ids) != 0) {
    213                     $pm_ids = implode("','",$pm_ids);
    214                     $this->modules['DB']->query("UPDATE ".TBLPFX."pms SET pm_read_status='1' WHERE pm_id IN ('$pm_ids') AND pm_to_id='$uSER_ID' AND pm_request_rconfirmation<>'1'");
    215                 }
    216 
    217                 header("Location: index.php?action=pms&mode=viewfolder&folder_id=$return_f&z=$return_z&$mYSID"); exit;
     219            case 'MarkPMsRead':
     220                $pmIDs = (isset($_POST['pmIDs']) && is_array($_POST['pmIDs'])) ? $_POST['pmIDs'] : array();
     221
     222                $returnFolderID = isset($_GET['returnFolderID']) ? intval($_GET['returnFolderID']) : 0;
     223                $returnPage = isset($_GET['returnPage']) ? intval($_GET['returnPage']) : 1;
     224
     225                if(count($pmIDs) != 0) {
     226                    $pmIDs = implode("','",$pmIDs);
     227                    $this->modules['DB']->query("UPDATE ".TBLPFX."pms SET pmIsRead='1' WHERE pmID IN ('$pmIDs') AND pmToID='".USERID."' AND pmRequestReadReceipt<>'1'");
     228                }
     229
     230                Functions::myHeader(INDEXFILE."?action=PrivateMessages&mode=ViewFolder&folderID=$returnFolderID&page=$returnPage&".MYSID);
    218231            break;
    219232
    220             case 'deletepms':
    221                 $pm_id = isset($_GET['pm_id']) ? $_GET['pm_id'] : 0;
    222                 $pm_ids = isset($_POST['pm_ids']) ? $_POST['pm_ids'] : array();
    223 
    224                 $return_z = isset($_GET['return_z']) ? $_GET['return_z'] : 1; // Die Seite, zu der zurueckgekehrt werden soll
    225                 $return_f = isset($_GET['return_f']) ? $_GET['return_f'] : 0; // Der Ordner, in den zurueckgekehrt werden soll
    226 
    227                 if($pm_id != 0)
    228                     $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms WHERE pm_id='$pm_id' AND pm_to_id='$uSER_ID'");
    229 
    230                 if(count($pm_ids) != 0) {
    231                     $pm_ids = implode("','",$pm_ids);
    232                     $this->modules['DB']->query("SELECT pm_id FROM ".TBLPFX."pms WHERE pm_id IN ('$pm_ids') AND pm_to_id='$uSER_ID'");
    233 
    234                     $pm_ids = array();
    235                     while(list($akt_pm_id) = $this->modules['DB']->fetch_array())
    236                         $pm_ids[] = $akt_pm_id;
    237 
    238                     $pm_ids = implode("','",$pm_ids);
    239                     $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms WHERE pm_id IN ('$pm_ids')");
    240                 }
    241 
    242                 header("Location: index.php?action=pms&mode=viewfolder&folder_id=$return_f&z=$return_z&$mYSID"); exit;
     233            case 'DeletePMs':
     234                $pmID = isset($_GET['pmID']) ? intval($_GET['pmID']) : 0;
     235                $pmIDs = (isset($_POST['pmIDs']) && is_array($_POST['pmIDs'])) ? $_POST['pmIDs'] : array();
     236
     237                $returnFolderID = isset($_GET['returnFolderID']) ? intval($_GET['returnFolderID']) : 0;
     238                $returnPage = isset($_GET['returnPage']) ? intval($_GET['returnPage']) : 1;
     239
     240                if($pmID != 0)
     241                    $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms WHERE pmID='$pmID' AND pmToID='".USERID."'");
     242
     243                if(count($pmIDs) != 0) {
     244                    $pmIDs = implode("','",$pmIDs);
     245                    $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms WHERE pmID IN ('$pmIDs') AND pmToID='".USERID."'");
     246                }
     247
     248                Functions::myHeader(INDEXFILE."?action=PrivateMessages&mode=ViewFolder&folderID=$returnFolderID&page=$returnPage&".MYSID);
    243249            break;
    244250
     
    270276                $pmData = $this->modules['DB']->fetchArray();
    271277
    272                 // Ueberpruefen ob...
    273278                if($pmData['pmToID'] != USERID) die('Kein Zugriff auf diese Nachricht!'); // ...User Zugriff auf PM hat...
    274279                if($pmData['pmIsRead'] != 1) {  // ...die PM schon gelesen ist...
    275280                    $this->modules['DB']->query("UPDATE ".TBLPFX."pms SET pmIsRead='1' WHERE pmID='$pmID'");
    276281                    if($pmData['pmRequestReadReceipt'] == 1 && $this->modules['Config']->getValue('allow_pms_rconfirmation') == 1 && $pmData['pmFromID'] != 0) // ...und eine Lesebestaetigung angefordert wurde
    277                         // TODO: MySQL-Abfrage
     282                        // TODO: Betreff und Nachricht in der Sprache des Empfaengers
    278283                        $this->modules['DB']->query("
    279                             INSERT INTO ".TBLPFX."pms SET
    280                                 (folder_id,pm_from_id,pm_to_id,pm_read_status,pm_type,pm_subject,pm_send_time,pm_enable_bbcode,pm_enable_smilies,pm_enable_htmlcode,pm_show_sig,pm_request_rconfirmation,pm_text) VALUES ('0','$uSER_ID','".$pm_data['pm_from_id']."','0','0','".$lNG['read_confirmation_subject']."','".time()."','0','0','0','0','0','".mysql_escape_string(sprintf($lNG['read_confirmation_message'],$pm_data['pm_from_nick'],$pm_data['pm_subject']))."')
     284                            INSERT INTO
     285                                ".TBLPFX."pms
     286                            SET
     287                                folderID='0',
     288                                pmFromID='".USERID."',
     289                                pmToID='".$pmData['pmFromID']."',
     290                                pmIsRead='0',
     291                                pmType='0',
     292                                pmSubject='".Functions::addSlashes($this->modules['Language']->getString('read_confirmation_subject'))."',
     293                                pmSendTimestamp='".time()."',
     294                                pmEnableBBcode='0',
     295                                pmEnableSmilies='0',
     296                                pmEnableHtmlCode='0',
     297                                pmShowSignature='0',
     298                                pmRequestReadReceipt='0',
     299                                pmMessageText='".Functions::addSlashes(sprintf($this->modules['Language']->getString('read_confirmation_message',$pmData['pmFromNick'],$pmData['pmSubject'])))."'
    281300                        ");
    282301                }
     
    295314
    296315                if(isset($_GET['doit']) && $pmData['pmType'] == 0 && $pmData['pmFromID'] != 0) {
    297                     /*/$c['EnableSmilies'] = (isset($_POST['c']['EnableSmilies']) && $this->modules['Config']->getValue('allow_pms_smilies') == 1) ? 1 : 0;
    298                     $c['ShowSignature'] = (isset($_POST['c']['ShowSignature']) && $this->modules['Config']->getValue('enable_sig') == 1) ? 1 : 0;
    299                     $c['EnableBBCode'] = (isset($_POST['c']['EnableBBCode']) && $this->modules['Config']->getValue('allow_pms_bbcode') == 1) ? 1 : 0;
    300                     $c['SaveOutbox'] = (isset($_POST['c']['SaveOutbox']) && $this->modules['Config']->getValue('enable_outbox') == 1) ? 1 : 0;
    301                     $c['RequestReadReceipt'] = (isset($_POST['c']['RequestReadReceipt']) && $this->modules['Config']->getValue('allow_pms_rconfirmation') == 1) ? 1 : 0;
    302                     /**/
    303                     /*/$recipients = explode(',',$p['Recipients']);
    304                     while(list($curKey) = each($recipients)) {
    305                         $recipients[$curKey] = trim($recipients[$curKey]);
    306                         if(!$recipients[$curKey] = Functions::getUserID($recipients[$curKey])) unset($recipients[$curKey]);
    307                     }
    308                     reset($recipients);/**/
    309 
    310                     //if(count($recipients) == 0) $error = $this->modules['Language']->getString('error_no_recipient');
    311                     if(trim($p['PMSubject']) == '') $error = $this->modules['Language']->getString('error_no_subject');
    312                     elseif(trim($p['PMMessageText']) == '') $error = $this->modules['Language']->getString('error_no_message');
     316                    $c['enableSmilies'] = (isset($_POST['c']['EnableSmilies']) && $this->modules['Config']->getValue('allow_pms_smilies') == 1) ? 1 : 0;
     317                    $c['showSignature'] = (isset($_POST['c']['ShowSignature']) && $this->modules['Config']->getValue('enable_sig') == 1) ? 1 : 0;
     318                    $c['enableBBCode'] = (isset($_POST['c']['EnableBBCode']) && $this->modules['Config']->getValue('allow_pms_bbcode') == 1) ? 1 : 0;
     319                    $c['saveOutbox'] = (isset($_POST['c']['SaveOutbox']) && $this->modules['Config']->getValue('enable_outbox') == 1) ? 1 : 0;
     320                    $c['requestReadReceipt'] = (isset($_POST['c']['RequestReadReceipt']) && $this->modules['Config']->getValue('allow_pms_rconfirmation') == 1) ? 1 : 0;
     321
     322                    if(trim($p['pmSubject']) == '') $error = $this->modules['Language']->getString('error_no_subject');
     323                    elseif(trim($p['pmMessageText']) == '') $error = $this->modules['Language']->getString('error_no_message');
    313324                    else {
    314325                        $this->modules['DB']->query("INSERT INTO ".TBLPFX."pms SET
     
    328339                        ");
    329340
    330                         if($c['SaveOutbox'] == 1) {
     341                        if($c['saveOutbox'] == 1) {
    331342                            $this->modules['DB']->query("INSERT INTO ".TBLPFX."pms SET
    332343                                folderID='1',
     
    346357                        }
    347358
    348                         if($pmData['PMIsReplied'] != 1)
     359                        if($pmData['pmIsReplied'] != 1)
    349360                            $this->modules['DB']->query("UPDATE ".TBLPFX."pms SET pmIsReplied='1' WHERE pmID='$pmID'");
    350361
     
    368379                        $smiliesBox = Functions::getSmiliesBox();
    369380                    }
    370                     $pPicsBox = Functions :: getPPicsBox();
     381                    $topicPicsBox = Functions :: getTopicPicsBox();
    371382
    372383                    $this->modules['Template']->assign(array(
     
    413424
    414425            case 'AddFolder':
    415                 $p = Functions::getSGValues($_POST['p'],array('FolderName'),'');
     426                $p = Functions::getSGValues($_POST['p'],array('folderName'),'');
    416427
    417428                $error = '';
    418429
    419                 if(isset($_GET['Doit'])) {
    420                     if($p['FolderName'] == '') $error = $this->modules['Language']->getString('error_invalid_folder_name');
     430                if(isset($_GET['doit'])) {
     431                    if($p['folderName'] == '') $error = $this->modules['Language']->getString('error_invalid_folder_name');
    421432                    else {
    422                         $this->modules['DB']->query("SELECT MAX(FolderID) AS MaxFolderID FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."'");
     433                        $this->modules['DB']->query("SELECT MAX(folderID) AS maxFolderID FROM ".TBLPFX."pms_folders WHERE userID='".USERID."'");
    423434                        list($maxFolderID) = $this->modules['DB']->fetchArray();
    424435
     
    429440                                ".TBLPFX."pms_folders
    430441                            SET
    431                                 FolderID='".($maxFolderID+1)."',
    432                                 UserID='".USERID."',
    433                                 FolderName='".$p['FolderName']."'
     442                                folderID='".($maxFolderID+1)."',
     443                                userID='".USERID."',
     444                                folderName='".$p['folderName']."'
    434445                        ");
    435446
    436                         Functions::myHeader(INDEXFILE."?Action=PrivateMessages&Mode=ManageFolders&".MYSID);
     447                        Functions::myHeader(INDEXFILE."?action=PrivateMessages&mode=ManageFolders&".MYSID);
    437448                    }
    438449                }
     
    440451                $this->modules['Template']->assign(array(
    441452                    'p'=>$p,
    442                     'Error'=>$error
     453                    'error'=>$error
    443454                ));
    444455
     
    447458
    448459            case 'EditFolder':
    449                 $folderID = isset($_GET['FolderID']) ? intval($_GET['FolderID']) : 0;
    450 
    451                 $this->modules['DB']->query("SELECT * FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."' AND FolderID='".$folderID."'");
     460                $folderID = isset($_GET['folderID']) ? intval($_GET['folderID']) : 0;
     461
     462                $this->modules['DB']->query("SELECT * FROM ".TBLPFX."pms_folders WHERE userID='".USERID."' AND folderID='".$folderID."'");
    452463                ($this->modules['DB']->getAffectedRows() != 1) ? die('Kann Daten nich laden: PM-Ordner') : $folderData = $this->modules['DB']->fetchArray();
    453464
    454                 $p = Functions::getSGValues($_POST['p'],array('FolderName'),'',$folderData);
     465                $p = Functions::getSGValues($_POST['p'],array('folderName'),'',Functions::addSlashes($folderData));
    455466
    456467                $error = '';
    457468
    458                 if(isset($_GET['Doit'])) {
    459                     if($p['FolderName'] == '') $error = $this->modules['Language']->getString('error_invalid_folder_name');
     469                if(isset($_GET['doit'])) {
     470                    if($p['folderName'] == '') $error = $this->modules['Language']->getString('error_invalid_folder_name');
    460471                    else {
    461                         $this->modules['DB']->query("SELECT MAX(FolderID) AS MaxFolderID FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."'");
    462                         list($maxFolderID) = $this->modules['DB']->fetchArray();
    463 
    464                         if($maxFolderID < 1) $maxFolderID = 1;
    465 
    466472                        $this->modules['DB']->query("
    467473                            UPDATE
    468474                                ".TBLPFX."pms_folders
    469475                            SET
    470                                 FolderName='".$p['FolderName']."'
     476                                FolderName='".$p['folderName']."'
    471477                            WHERE
    472478                                UserID='".USERID."'
     
    474480                        ");
    475481
    476                         Functions::myHeader(INDEXFILE."?Action=PrivateMessages&Mode=ManageFolders&".MYSID);
    477                     }
    478                 }
    479 
    480                 $this->modules['Template']->assign(array(
    481                     'FolderID'=>$folderID,
     482                        Functions::myHeader(INDEXFILE."?action=PrivateMessages&mode=ManageFolders&".MYSID);
     483                    }
     484                }
     485
     486                $this->modules['Template']->assign(array(
     487                    'folderID'=>$folderID,
    482488                    'p'=>$p,
    483                     'Error'=>$error
     489                    'error'=>$error
    484490                ));
    485491
     
    488494
    489495            case 'DeleteFolder':
    490                 $folderID = isset($_GET['FolderID']) ? intval($_GET['FolderID']) : 0;
    491                 $moveFolderID = isset($_POST['MoveFolderID']) ? intval($_POST['MoveFolderID']) : -1;
    492 
    493                 $this->modules['DB']->query("SELECT * FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."' AND FolderID='".$folderID."'");
     496                $folderID = isset($_GET['folderID']) ? intval($_GET['folderID']) : 0;
     497                $moveFolderID = isset($_POST['moveFolderID']) ? intval($_POST['moveFolderID']) : -1;
     498
     499                $this->modules['DB']->query("SELECT * FROM ".TBLPFX."pms_folders WHERE userID='".USERID."' AND folderID='".$folderID."'");
    494500                ($this->modules['DB']->getAffectedRows() != 1) ? die('Kann Daten nich laden: PM-Ordner') : $folderData = $this->modules['DB']->fetchArray();
    495501
    496                 $this->modules['DB']->query("SELECT COUNT(*) AS FolderPMsCounter FROM ".TBLPFX."pms WHERE PMToID='".USERID."' AND FolderID='$folderID'");
     502                $this->modules['DB']->query("SELECT COUNT(*) AS folderPMsCounter FROM ".TBLPFX."pms WHERE pmToID='".USERID."' AND folderID='$folderID'");
    497503                list($folderPMsCounter) = $this->modules['DB']->fetchArray();
    498504
    499505                $foldersData = array($inboxFolderData,$outboxFolderData);
    500                 $this->modules['DB']->query("SELECT * FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."' AND FolderID<>'".$folderID."' ORDER BY FolderName ASC");
     506                $this->modules['DB']->query("SELECT * FROM ".TBLPFX."pms_folders WHERE userID='".USERID."' AND folderID<>'".$folderID."' ORDER BY folderName ASC");
    501507                $foldersData = array_merge($foldersData,$this->modules['DB']->raw2Array());
    502508
    503509                $error = '';
    504510
    505                 if(isset($_GET['Doit']) || $folderPMsCounter == 0) {
     511                if(isset($_GET['doit']) || $folderPMsCounter == 0) {
    506512                    $validFolder = FALSE;
    507513                    foreach($foldersData AS $curFolder) {
    508                         if($curFolder['FolderID'] == $moveFolderID) {
     514                        if($curFolder['folderID'] == $moveFolderID) {
    509515                            $validFolder = TRUE;
    510516                            break;
     
    514520                    if($moveFolderID != -1 && !$validFolder) $error = $this->modules['Language']->getString('Invalid_selection');
    515521                    else {
    516                         if($moveFolderID == -1) $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms WHERE PMToID='".USERID."' AND FolderID='".$folderID."'");
    517                         else $this->modules['DB']->query("UPDATE ".TBLPFX."pms SET FolderID='".$moveFolderID."' WHERE PMToID='".USERID."' AND FolderID='".$folderID."'");
    518 
    519                         $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms_folders WHERE UserID='".USERID."' AND FolderID='".$folderID."'");
     522                        if($moveFolderID == -1) $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms WHERE pmToID='".USERID."' AND folderID='".$folderID."'");
     523                        else $this->modules['DB']->query("UPDATE ".TBLPFX."pms SET folderID='".$moveFolderID."' WHERE pmToID='".USERID."' AND folderID='".$folderID."'");
     524
     525                        $this->modules['DB']->query("DELETE FROM ".TBLPFX."pms_folders WHERE userID='".USERID."' AND folderID='".$folderID."'");
    520526
    521527                        // TODO: Richtige Meldung ausgeben
    522                         Functions::myHeader(INDEXFILE."?Action=PrivateMessages&Mode=ManageFolders&".MYSID);
     528                        Functions::myHeader(INDEXFILE."?action=PrivateMessages&mode=ManageFolders&".MYSID);
    523529                    }
    524530                }
    525531
    526532                while(list($curKey) = each($foldersData))
    527                     $foldersData[$curKey]['_MoveText'] = sprintf($this->modules['Language']->getString('Move_messages_to'),$foldersData[$curKey]['FolderName']);
    528 
    529                 $this->modules['Template']->assign(array(
    530                     'FoldersData'=>$foldersData,
    531                     'FolderID'=>$folderID
     533                    $foldersData[$curKey]['_moveText'] = sprintf($this->modules['Language']->getString('Move_messages_to'),$foldersData[$curKey]['folderName']);
     534
     535                $this->modules['Template']->assign(array(
     536                    'foldersData'=>$foldersData,
     537                    'folderID'=>$folderID
    532538                ));
    533539
    534540                $this->modules['PageParts']->printPage('PrivateMessagesDeleteFolder.tpl');
     541                break;
     542
     543            case 'MovePMs':
     544                // TODO: Alles
    535545                break;
    536546        }
  • trunk/templates/std/templates/PrivateMessagesAddFolder.tpl

    r6 r10  
    1 <form method="post" action="{$indexFile}?action=PrivateMessages&amp;mode=AddFolder&amp;Doit=1&amp;{$mySID}">
     1<form method="post" action="{$indexFile}?action=PrivateMessages&amp;mode=AddFolder&amp;doit=1&amp;{$mySID}">
    22<table class="TableStd" width="100%">
    33<colgroup>
     
    99<tr>
    1010 <td class="CellStd"><span class="FontNorm">{$modules.Language->getString('Folder_name')}:</span></td>
    11  <td class="CellAlt"><input class="FormText" name="p[FolderName]" value="{$p.FolderName}" size="40" maxlength="255"/></td>
     11 <td class="CellAlt"><input class="FormText" name="p[folderName]" value="{$p.folderName}" size="40" maxlength="255"/></td>
    1212</tr>
    1313<tr><td class="CellButtons" colspan="2" align="center"><input class="FormBButton" type="submit" value="{$modules.Language->getString('Add_folder')}"/></td></tr>
  • trunk/templates/std/templates/PrivateMessagesEditFolder.tpl

    r6 r10  
    1 <form method="post" action="{$indexFile}?action=PrivateMessages&amp;mode=EditFolder&amp;FolderID={$folderID}&amp;Doit=1&amp;{$mySID}">
     1<form method="post" action="{$indexFile}?action=PrivateMessages&amp;mode=EditFolder&amp;folderID={$folderID}&amp;doit=1&amp;{$mySID}">
    22<table class="TableStd" width="100%">
    33<colgroup>
     
    99<tr>
    1010 <td class="CellStd"><span class="FontNorm">{$modules.Language->getString('Folder_name')}:</span></td>
    11  <td class="CellAlt"><input class="FormText" name="p[FolderName]" value="{$p.FolderName}" size="40" maxlength="255"/></td>
     11 <td class="CellAlt"><input class="FormText" name="p[folderName]" value="{$p.folderName}" size="40" maxlength="255"/></td>
    1212</tr>
    1313<tr><td class="CellButtons" colspan="2" align="center"><input class="FormBButton" type="submit" value="{$modules.Language->getString('Edit_folder')}"/></td></tr>
  • trunk/templates/std/templates/PrivateMessagesNewPM.tpl

    r6 r10  
    1 <form method="post" action="{$indexFile}?action=PrivateMessages&amp;mode=NewPM&amp;Doit=1&amp;{$mySID}" name="tbb_form">
     1<form method="post" action="{$indexFile}?action=PrivateMessages&amp;mode=NewPM&amp;doit=1&amp;{$mySID}" name="myForm">
    22<table class="TableStd" border="0" cellpadding="3" cellspacing="0" width="100%">
    33<colgroup>
     
    99<tr>
    1010 <td class="CellStd"><span class="FontNorm">{$modules.Language->getString('Recipient')}:</span><br/><span class="FontSmall">{$modules.Language->getString('recipient_info')}</span></td>
    11  <td class="CellAlt" valign="top"><input size=25" class="FormText" type="text" name="p[Recipients]" value="{$p.Recipients}"/></td>
     11 <td class="CellAlt" valign="top"><input size=25" class="FormText" type="text" name="p[recipients]" value="{$p.recipients}"/></td>
    1212</tr>
    1313<tr>
    1414 <td class="CellStd"><span class="FontNorm">{$modules.Language->getString('Subject')}:</span></td>
    15  <td class="CellAlt"><input size="60" class="FormText" type="text" name="p[PMSubject]" value="{$p.PMSubject}" maxlength="255"/></td>
     15 <td class="CellAlt"><input size="60" class="FormText" type="text" name="p[pmSubject]" value="{$p.pmSubject}" maxlength="255"/></td>
    1616</tr>
    17 <template:bbcoderow>
     17<!--
    1818 <tr>
    1919  <td class="CellStd" valign="top"></td>
    2020  <td class="CellAlt">{$bbcode_box}</td>
    2121 </tr>
    22 </template>
     22-->
    2323<tr>
    2424 <td class="CellStd" valign="top"><span class="FontNorm">{$modules.Language->getString('Message')}:</span></td>
    25  <td class="CellAlt"><textarea class="FormTextArea" rows="14" cols="80" name="p[PMMessageText]" onselect="storecaret();" onclick="storecaret();" onkeyup="storecaret();">{$p.PMMessageText}</textarea></td>
     25 <td class="CellAlt"><textarea class="FormTextArea" rows="14" cols="80" name="p[pmMessageText]" onselect="storecaret();" onclick="storecaret();" onkeyup="storecaret();">{$p.pmMessageText}</textarea></td>
    2626</tr>
    2727<tr>
    2828 <td class="CellStd" valign="top"><span class="FontNorm">{$modules.Language->getString('Options')}:</span></td>
    2929 <td class="CellAlt"><span class="FontNorm">
    30   {if $show.EnableSmilies}<input type="checkbox" name="c[EnableSmilies]" value="1"{if $c.EnableSmilies == 1} checked="checked"{/if} id="iEnableSmilies"/><label for="iEnableSmilies">&nbsp;{$modules.Language->getString('Enable_smilies')}</label><br/>{/if}
    31   {if $show.ShowSignature}<input type="checkbox" name="c[ShowSignature]" value="1"{if $c.ShowSignature == 1} checked="checked"{/if} id="iShowSignature"/><label for="iShowSignature">&nbsp;{$modules.Language->getString('Show_signature')}</label><br/>{/if}
    32   {if $show.EnableBBCode}<input type="checkbox" name="c[EnableBBCode]" value="1"{if $c.EnableBBCode == 1} checked="checked"{/if} id="iEnableBBCode"/><label for="iEnableBBCode">&nbsp;{$modules.Language->getString('Enable_bbcode')}</label><br/>{/if}
    33   {if $show.EnableHtmlCode}<input type="checkbox" name="c[EnableHtmlCode]" value="1"{if $c.EnableHtmlCode == 1} checked="checked"{/if} id="iEnableHtmlCode"/><label for="iEnableHtmlCode">&nbsp;{$modules.Language->getString('Enable_html_code')}</label><br/>{/if}
    34   {if $show.SaveOutbox}<input type="checkbox" name="c[SaveOutbox]" value="1"{if $c.SaveOutbox == 1} checked="checked"{/if} id="iSaveOutbox"/><label for="iSaveOutbox">&nbsp;{$modules.Language->getString('Save_pm_outbox')}</label><br/>{/if}
    35   {if $show.RequestReadReceipt}<input type="checkbox" name="c[RequestReadReceipt]" value="1"{if $c.RequestReadReceipt == 1} checked="checked"{/if} id="iRequestReadReceipt"/><label for="iRequestReadReceipt">&nbsp;{$modules.Language->getString('Request_read_confirmation')}</label><br/>{/if}
     30  {if $show.enableSmilies}<label><input type="checkbox" name="c[enableSmilies]" value="1"{if $c.enableSmilies == 1} checked="checked"{/if}/>&nbsp;{$modules.Language->getString('Enable_smilies')}</label><br/>{/if}
     31  {if $show.showSignature}<label><input type="checkbox" name="c[showSignature]" value="1"{if $c.showSignature == 1} checked="checked"{/if}/>&nbsp;{$modules.Language->getString('Show_signature')}</label><br/>{/if}
     32  {if $show.enableBBCode}<label><input type="checkbox" name="c[enableBBCode]" value="1"{if $c.enableBBCode == 1} checked="checked"{/if}/>&nbsp;{$modules.Language->getString('Enable_bbcode')}</label><br/>{/if}
     33  {if $show.enableHtmlCode}<label><input type="checkbox" name="c[enableHtmlCode]" value="1"{if $c.enableHtmlCode == 1} checked="checked"{/if}/>&nbsp;{$modules.Language->getString('Enable_html_code')}</label><br/>{/if}
     34  {if $show.saveOutbox}<label><input type="checkbox" name="c[saveOutbox]" value="1"{if $c.saveOutbox == 1} checked="checked"{/if}/>&nbsp;{$modules.Language->getString('Save_pm_outbox')}</label><br/>{/if}
     35  {if $show.requestReadReceipt}<label><input type="checkbox" name="c[requestReadReceipt]" value="1"{if $c.requestReadReceipt == 1} checked="checked"{/if}/>&nbsp;{$modules.Language->getString('Request_read_confirmation')}</label><br/>{/if}
    3636 </span></td>
    3737</tr>
  • trunk/templates/std/templates/PrivateMessagesViewFolder.tpl

    r8 r10  
    11<script type="text/javascript">
    22{literal}
    3     function submit_form() {
    4         if(document.forms.TBBForm.elements.p_action.options[document.forms.TBBForm.elements.p_action.selectedIndex].value != '') {
    5             document.forms.TBBForm.action = document.forms.TBBForm.elements.p_action.options[document.forms.TBBForm.elements.p_action.selectedIndex].value;
    6             document.forms.TBBForm.submit();
     3    function submitMyForm() {
     4        if(document.forms.myForm.elements.selectAction.options[document.forms.myForm.elements.selectAction.selectedIndex].value != '') {
     5            document.forms.myForm.action = document.forms.myForm.elements.selectAction.options[document.forms.myForm.elements.selectAction.selectedIndex].value;
     6            document.forms.myForm.submit();
    77        }
    88    }
    99
    10     function switch_all(status) {
    11         for(i = 0; i < document.TBBForm.length; i++) {
    12             if(document.TBBForm.elements[i].name == 'pmIDs[]') document.TBBForm.elements[i].checked = status;
     10    function switchAllCheckboxes(status) {
     11        for(i = 0; i < document.myForm.length; i++) {
     12            if(document.myForm.elements[i].name == 'pmIDs[]') document.myForm.elements[i].checked = status;
    1313        }
    1414    }
    1515{/literal}
    1616</script>
    17 <form method="post" action="{$indexFile}?action=PrivateMessages&amp;folderID={$folderID}&amp;page={$page}&amp;{$mySID}" name="TBBForm">
     17<form method="post" action="{$indexFile}?action=PrivateMessages&amp;folderID={$folderID}&amp;page={$page}&amp;{$mySID}" name="myForm">
    1818<table class="TableStd" border="0" cellpadding="3" cellspacing="0" width="100%">
    1919<tr>
     
    3232  <td class="CellAlt"><span class="FontSmall">{$curPM._pmSender}</span></td>
    3333  <td class="CellStd" align="center"><span class="FontSmall">{$curPM._pmSendDateTime}</span></td>
    34   <td class="CellAlt" align="right"><span class="FontSmall"><a href="{$indexFile}?action=PrivateMessages&amp;mode=DeletePMs&amp;pmID={$curPM.pmID}&amp;{$mySID}"><img src="{$modules.Template->getTemplateDir()}/images/icons/PrivateMessageDelete.png" class="ImageIcon" alt="{$modules.Language->getString('delete')}" border="0"/></a>{if $curPM.pmType == 0 && $curPM.pmFromID != 0}<a href="{$indexFile}?action=PrivateMessages&amp;mode=ViewPM&amp;pmID={$curPM.pmID}&amp;{$mySID}#Reply"><img src="{$modules.Template->getTemplateDir()}/images/icons/PrivateMessageReadReplied.png" class="ImageIcon" alt="" border="0"/></a>{/if}</span></td>
     34  <td class="CellAlt" align="right"><span class="FontSmall"><a href="{$indexFile}?action=PrivateMessages&amp;mode=DeletePMs&amp;pmID={$curPM.pmID}&amp;returnFolderID={$folderID}&amp;returnPage={$page}&amp;{$mySID}"><img src="{$modules.Template->getTemplateDir()}/images/icons/PrivateMessageDelete.png" class="ImageIcon" alt="{$modules.Language->getString('delete')}" border="0"/></a>{if $curPM.pmType == 0 && $curPM.pmFromID != 0}<a href="{$indexFile}?action=PrivateMessages&amp;mode=ViewPM&amp;pmID={$curPM.pmID}&amp;{$mySID}#Reply"><img src="{$modules.Template->getTemplateDir()}/images/icons/PrivateMessageReadReplied.png" class="ImageIcon" alt="" border="0"/></a>{/if}</span></td>
    3535 </tr>
    3636{foreachelse}
    3737 <tr><td class="CellStd" colspan="6" align="center"><span class="FontNorm">-- {$modules.Language->getString('No_messages_in_this_folder')} --</span></td></tr>
    3838{/foreach}
    39 <tr><td class="CellButtons" colspan="6"><select class="FormSelect" name="p_action" onchange="submit_form();"><option value=''>-- {$modules.Language->getString('Select_action')} --</option><option value=''></option><option value="{$indexFile}?action=PrivateMessages&amp;mode=markread&amp;returnFolderID{$folderID}&amp;returnPage={$page}&amp;{$mySID}">{$modules.Language->getString('Mark_as_read')}</option><option value="{$indexFile}?action=PrivateMessages&amp;mode=deletepms&amp;returnFolderID{$folderID}&amp;returnPage={$page}&amp;{$mySID}">{$modules.Language->getString('delete')}</option></select></td></tr>
     39<tr><td class="CellButtons" colspan="6">
     40 <select class="FormSelect" name="selectAction" onchange="submitMyForm();">
     41  <option value="">-- {$modules.Language->getString('Select_action')} --</option>
     42  <option value=""></option>
     43  <option value="{$indexFile}?action=PrivateMessages&amp;mode=MarkPMsRead&amp;returnFolderID={$folderID}&amp;returnPage={$page}&amp;{$mySID}">{$modules.Language->getString('Mark_as_read')}</option>
     44  <option value="{$indexFile}?action=PrivateMessages&amp;mode=DeletePMs&amp;returnFolderID={$folderID}&amp;returnPage={$page}&amp;{$mySID}">{$modules.Language->getString('delete')}</option>
     45  <option value=""></option>
     46  {foreach from=$foldersData item=curFolder}
     47   {if $curFolder.folderID != $folderID}
     48    <option value="{$indexFile}?action=PrivateMessages&amp;mode=MovePMs&amp;returnFolderID={$folderID}&amp;returnPage={$page}&amp;targetFolderID={$curFolder.folderID}&amp;{$mySID}">{$curFolder._moveText}</option>
     49   {/if}
     50  {/foreach}
     51 </select>
     52</td></tr>
    4053</table>
    4154</form>
Note: See TracChangeset for help on using the changeset viewer.