Changeset 13


Ignore:
Timestamp:
Apr 4, 2007, 12:03:42 AM (12 years ago)
Author:
julian
Message:
  • PageParts::printMessage() now supports popups and page-in-page
  • Private messages can be moved to other folders now
  • Some minor fixes
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/Functions.class.php

    r12 r13  
    185185    }
    186186
    187     public static function createPageListing($EntriesCounter,$EntriesPerPage,&$Page,$Link) {
     187    public static function createPageListing($entriesCounter,$entriesPerPage,&$page,$link) {
    188188        $Language = Factory::singleton('Language');
    189189
    190         $PagesCounter = ceil($EntriesCounter/$EntriesPerPage);
    191 
    192         if($PagesCounter == 0) $Page = 1;
    193         elseif($Page == 'last' || $Page > $PagesCounter) $Page = $PagesCounter;
    194 
    195         $PageListing = array();
    196 
    197         $Pre = $Suf = '';
    198 
    199         if($PagesCounter > 0) {
    200             if($PagesCounter > 5) {
    201                 if($Page > 2 && $Page < $PagesCounter-2) $PageListing = array($Page-2,$Page-1,$Page,$Page+1,$Page+2);
    202                 elseif($Page <= 2) $PageListing = array(1,2,3,4,5);
    203                 elseif($Page >= $PagesCounter-2) $PageListing = array($PagesCounter-4,$PagesCounter-3,$PagesCounter-2,$PagesCounter-1,$PagesCounter);
     190        $pagesCounter = ceil($entriesCounter/$entriesPerPage);
     191
     192        if($pagesCounter == 0) $page = 1;
     193        elseif($page == 'last' || $page > $pagesCounter) $page = $pagesCounter;
     194
     195        $pageListing = array();
     196
     197        $pre = $suf = '';
     198
     199        if($pagesCounter > 0) {
     200            if($pagesCounter > 5) {
     201                if($page > 2 && $page < $pagesCounter-2) $pageListing = array($page-2,$page-1,$page,$page+1,$page+2);
     202                elseif($page <= 2) $pageListing = array(1,2,3,4,5);
     203                elseif($page >= $pagesCounter-2) $pageListing = array($pagesCounter-4,$pagesCounter-3,$pagesCounter-2,$pagesCounter-1,$pagesCounter);
    204204            }
    205205            else {
    206                 for($i = 1; $i < $PagesCounter+1; $i++)
    207                     $PageListing[] = $i;
     206                for($i = 1; $i < $pagesCounter+1; $i++)
     207                    $pageListing[] = $i;
    208208            }
    209209        }
    210         else $PageListing[] = 1;
    211         for($i = 0; $i < count($PageListing); $i++) {
    212             if($PageListing[$i] != $Page) $PageListing[$i] = sprintf($Link,$PageListing[$i],$PageListing[$i]);
    213         }
    214 
    215         if($Page > 1) $Pre = sprintf($Link,1,$Language->getString('First_page')).'&nbsp;'.sprintf($Link,$Page-1,$Language->getString('Previous_page')).'&nbsp;&nbsp;';
    216         if($Page < $PagesCounter) $Suf = '&nbsp;&nbsp;'.sprintf($Link,$Page+1,$Language->getString('Next_page')).'&nbsp;'.sprintf($Link,'last',$Language->getString('Last_page'));
    217 
    218         return sprintf($Language->getString('Pages'),$PagesCounter,$Pre.implode(' | ',$PageListing).$Suf);
     210        else $pageListing[] = 1;
     211        for($i = 0; $i < count($pageListing); $i++) {
     212            if($pageListing[$i] != $page) $pageListing[$i] = sprintf($link,$pageListing[$i],$pageListing[$i]);
     213        }
     214
     215        if($page > 1) $pre = sprintf($link,1,$Language->getString('First_page')).'&nbsp;'.sprintf($link,$page-1,$Language->getString('Previous_page')).'&nbsp;&nbsp;';
     216        if($page < $pagesCounter) $suf = '&nbsp;&nbsp;'.sprintf($link,$page+1,$Language->getString('Next_page')).'&nbsp;'.sprintf($link,'last',$Language->getString('Last_page'));
     217
     218        return sprintf($Language->getString('Pages'),$pagesCounter,$pre.implode(' | ',$pageListing).$suf);
    219219    }
    220220
     
    451451    //* Bestimmt alle Vaterkategorien einer Kategorie
    452452    //*
    453     static public function catsGetParentCatsData($CatID,$IncludeSelf = TRUE) {
    454         $DB = Factory::singleton('DB');
    455 
    456         if($CatID == 1) return array();
    457 
    458         $DB->query("SELECT t1.* FROM ".TBLPFX."cats AS t1, ".TBLPFX."cats AS t2 WHERE t2.CatID='$CatID' AND t1.CatID<>1 AND t2.CatL BETWEEN t1.CatL AND t1.catR ".(!$IncludeSelf ? "AND t1.CatID<>'$CatID'" : '')." ORDER BY t1.CatL");
    459 
    460         return $DB->Raw2Array();
     453    static public function catsGetParentCatsData($catID,$includeSelf = TRUE) {
     454        $DB = Factory::singleton('DB');
     455
     456        if($catID == 1) return array();
     457
     458        $DB->query("SELECT t1.* FROM ".TBLPFX."cats AS t1, ".TBLPFX."cats AS t2 WHERE t2.catID='$catID' AND t1.catID<>1 AND t2.catL BETWEEN t1.catL AND t1.catR ".(!$includeSelf ? "AND t1.catID<>'$catID'" : '')." ORDER BY t1.catL");
     459
     460        return $DB->raw2Array();
    461461    }
    462462
  • trunk/modules/EditProfile.class.php

    r9 r13  
    2828                $error = '';
    2929
    30                 if(isset($_GET['Doit'])) {
     30                if(isset($_GET['doit'])) {
    3131                    if(!Functions::verifyEmail($p['userEmail'])) $error = $this->modules['Language']->getString('error_bad_email');
    3232                    elseif(trim($p['userNewPassword']) != '' && Functions::getSaltedHash($p['userOldPassword'],$this->modules['Auth']->getValue('userPasswordSalt')) != $this->modules['Auth']->getValue('user_pw')) $error = $this->modules['Language']->getString('error_wrong_password');
     
    4343                        ");
    4444
    45                         if(trim($p['UserNewPassword']) != '') {
     45                        if(trim($p['userNewPassword']) != '') {
    4646                            $newPasswordSalt = Functions::getRandomString(10);
    47                             $newPasswordEncrypted = Functions::getSaltedHash($p['UserNewPassword'],$newPasswordSalt);
     47                            $newPasswordEncrypted = Functions::getSaltedHash($p['userNewPassword'],$newPasswordSalt);
    4848
    4949                            $this->modules['DB']->query("
     
    6060                        $this->modules['Navbar']->addElements('left',array($this->modules['Language']->getString('Profile_saved'),''));
    6161
    62                         include_once('pheader.php');
    63                         show_message($this->modules['Language']->getString('Profile_saved'),$this->modules['Language']->getString('message_profile_saved'));
    64                         include_once('ptail.php'); exit;
     62                        $this->modules['PageParts']->printMessage('profile_saved'); exit;
    6563                    }
    6664                }
  • trunk/modules/Login.class.php

    r6 r13  
    3333            elseif($userData['userStatus'] == USER_STATUS_INACTIVE) $error = sprintf($this->modules['Language']->getString('error_inactive_account'),$userData['UserNick']);
    3434            elseif(Functions::getSaltedHash($p['userPassword'],$userData['userPasswordSalt']) != $userData['userPassword'] && ($userData['userNewPassword'] == '' || Functions::getSaltedHash($p['userPassword'],$userData['userNewPasswordSalt']) != $userData['userNewPassword'])) $error = $this->modules['Language']->getString('error_wrong_password');
    35             elseif($userData['userIsLocked'] == 1 && Functions::checkLockStatus($userData['userID']) == TRUE) { // Falls der Benutzer sich nicht mehr einloggen darf
     35            elseif($userData['userIsLocked'] == 1 && Functions::checkLockStatus($userData['userID'])) { // Falls der Benutzer sich nicht mehr einloggen darf
    3636                $dB->query("SELECT lock_start_time,lock_dur_time FROM ".TBLPFX."users_locks WHERE user_id='".$p_user_data['user_id']."'");
    3737                $lock_data = $dB->fetch_array();
     
    9191                // die Forenuebersicht aufgerufen
    9292                //
    93                 //isset($_SESSION['lastPlaceUrl']) ? Functions::myHeader($_SESSION['lastPlaceUrl']) : Functions::myHeader('index.php?'.MYSID);
     93                isset($_SESSION['lastPlaceUrl']) ? Functions::myHeader($_SESSION['lastPlaceUrl']) : Functions::myHeader('index.php?'.MYSID);
    9494            }
    9595        }
  • trunk/modules/Navbar.class.php

    r6 r13  
    3131
    3232        foreach($catsData AS $curCat)
    33             $this->addElement(Functions::HTMLSpecialChars($curCat['CatName']),INDEXFILE.'?CatID='.$curCat['CatID'].'&amp;'.MYSID);
     33            $this->addElement(Functions::HTMLSpecialChars($curCat['catName']),INDEXFILE.'?catID='.$curCat['catID'].'&amp;'.MYSID);
    3434    }
    3535
  • trunk/modules/PageParts.class.php

    r8 r13  
    7474    }
    7575
    76     public function printMessage($messageCode,$additionalLinks = array()) {
     76    public function printMessage($messageCode,$additionalLinks = array(),$pageInPage = FALSE,$inPopup = FALSE) {
    7777        $this->modules['Language']->addFile('Messages');
    7878
    79         $this->printHeader();
    8079        $this->modules['Template']->assign(array(
    81             'Flags'=>$this->flags,
    82             'MessageTitle'=>$this->modules['Language']->getString('message_title_'.$messageCode),
    83             'MessageText'=>$this->modules['Language']->getString('message_text_'.$messageCode),
    84             'AdditionalLinks'=>$additionalLinks
     80            'flags'=>$this->flags,
     81            'messageTitle'=>$this->modules['Language']->getString('message_title_'.$messageCode),
     82            'messageText'=>$this->modules['Language']->getString('message_text_'.$messageCode),
     83            'additionalLinks'=>$additionalLinks,
     84            'pageInPage'=>$pageInPage
    8585        ));
    86         $this->modules['Template']->display('Message.tpl');
    87         $this->printTail();
     86
     87        if($inPopup) $this->printPopupPage('Message.tpl');
     88        else $this->printPage('Message.tpl');
    8889    }
    8990
  • trunk/modules/PrivateMessages.class.php

    r10 r13  
    542542
    543543            case 'MovePMs':
    544                 // TODO: Alles
     544                $pmIDs = (isset($_POST['pmIDs']) && is_array($_POST['pmIDs'])) ? $_POST['pmIDs'] : array();
     545                $targetFolderID = isset($_GET['targetFolderID']) ? intval($_GET['targetFolderID']) : 0;
     546                $returnFolderID = isset($_GET['returnFolderID']) ? intval($_GET['returnFolderID']) : 0;
     547                $returnPage = isset($_GET['returnPage']) ? intval($_GET['returnPage']) : 1;
     548
     549                /**
     550                 * Check if target folder is valid
     551                 */
     552                if($targetFolderID != 0 && $targetFolderID != 1) {
     553                    $this->modules['DB']->query("SELECT folderID FROM ".TBLPFX."pms_folders WHERE folderID='$targetFolderID' AND userID='".USERID."'");
     554                    if($this->modules['DB']->getAffectedRows() == 0) Functions::myHeader(INDEXFILE."?action=PrivateMessages&mode=ViewFolder&folderID=$returnFolderID&page=$returnPage&".MYSID);
     555                }
     556
     557                $this->modules['DB']->query("UPDATE ".TBLPFX."pms SET folderID='$targetFolderID' WHERE pmID IN ('".implode("','",$pmIDs)."') AND pmToID='".USERID."'");
     558
     559                Functions::myHeader(INDEXFILE."?action=PrivateMessages&mode=ViewFolder&folderID=$returnFolderID&page=$returnPage&".MYSID);
    545560                break;
    546561        }
  • trunk/modules/ViewForum.class.php

    r9 r13  
    4343         */
    4444        $topicsCounter = Functions::getTopicsCounter($forumID);
    45         $pageListing = Functions::createPageListing($topicsCounter,$this->modules['Config']->getValue('topics_per_page'),$page,"<a href=\"".INDEXFILE."?action=ViewForum&amp;forumID=$forumID&amp;Page=%1\$s&amp;".MYSID."\">%2\$s</a>");
     45        $pageListing = Functions::createPageListing($topicsCounter,$this->modules['Config']->getValue('topics_per_page'),$page,"<a href=\"".INDEXFILE."?action=ViewForum&amp;forumID=$forumID&amp;page=%1\$s&amp;".MYSID."\">%2\$s</a>");
    4646        $start = $page*$this->modules['Config']->getValue('topics_per_page')-$this->modules['Config']->getValue('topics_per_page');
    4747
     
    207207
    208208    protected function _authenticateUser(&$forumData) {
    209         $authData = Functions::getAuthData($forumData,array('AuthViewForum','AuthPostTopic','AuthIsMod'));
    210 
    211         if($authData['AuthViewForum'] != 1) {
     209        $authData = Functions::getAuthData($forumData,array('authViewForum','authPostTopic','authIsMod'));
     210
     211        if($authData['authViewForum'] != 1) {
     212            die('Kein Zugriff');
    212213            // TODO
    213214            exit;
  • trunk/modules/ViewProfile.class.php

    r12 r13  
    2020        if(!$profileData = Functions::getUserData($profileID)) die('Cannot load data: Profile');
    2121
     22        $userIsMod = Functions::checkModStatus(USERID);
     23
    2224        $this->modules['Navbar']->addElements(array($this->modules['Language']->getString('View_profile'),INDEXFILE."?action=ViewProfile&amp;profileID=$profileID&amp".MYSID));
    2325        $this->modules['Template']->assign(array(
    24             'userIsMod'=>Functions::checkModStatus(USERID),
     26            'userIsMod'=>$userIsMod,
    2527            'profileID'=>$profileID
    2628        ));
  • trunk/modules/ViewTopic.class.php

    r9 r13  
    6969        //
    7070        if(!isset($topicPostsCounter)) $topicPostsCounter = Functions::getPostsCounter($topicID); // Anzahl der Beitraege bestimmen (kann eventuell aus schon vorhandenen Daten geschehen)
    71         $pageListing = Functions::createPageListing($topicPostsCounter,$this->modules['Config']->getValue('posts_per_page'),$page,"<a href=\"".INDEXFILE."?action=ViewTopic&amp;topicID=$topicID&amp;Page=%1\$s&amp;".MYSID."\">%2\$s</a>"); // Die Seitenansicht erstellen
     71        $pageListing = Functions::createPageListing($topicPostsCounter,$this->modules['Config']->getValue('posts_per_page'),$page,"<a href=\"".INDEXFILE."?action=ViewTopic&amp;topicID=$topicID&amp;page=%1\$s&amp;".MYSID."\">%2\$s</a>"); // Die Seitenansicht erstellen
    7272        $start = $page*$this->modules['Config']->getValue('posts_per_page')-$this->modules['Config']->getValue('posts_per_page'); // Startbeitrag
    7373
     
    145145            $curEditedText = '';
    146146            if($curPost['postEditedCounter'] > 0 && $curPost['postShowEditings'] == 1)
    147                 $curEditedText = sprintf($this->modules['Language']->getString('edited_post_text'),$curPost['postEditedCounter'],$curPost['postLastEditorID']);
     147                $curEditedText = sprintf($this->modules['Language']->getString('edited_post_text'),$curPost['postEditedCounter'],$curPost['postLastEditorNick']);
    148148
    149149            $show = array(
  • trunk/templates/std/templates/Message.tpl

    r6 r13  
    11<table class="TableStd" width="100%">
    2 {if $flags.InPrivateMessages || $flags.InEditProfile}
     2{if $flags.inPrivateMessages || $flags.inEditProfile || $pageInPage}
    33 <tr><td class="CellCat"><span class="FontCat">{$messageTitle}</span></td></tr>
    44{else}
  • trunk/templates/std/templates/PrivateMessagesHeader.tpl

    r8 r13  
    1 <table class="TableStd" border="0" cellpadding="3" cellspacing="0" width="100%">
     1<table class="TableStd" width="100%">
    22<tr><td class="CellTitle"><span class="FontTitle">{$modules.Language->getString('Private_messages')}</span></td></tr>
    33<tr><td class="CellStd" style="background-color:#DCDCDC;">
     
    1010   <tr><td class="CellNavNone" style="padding:0px;"><hr style="width:90%; height:1px;"/></td></tr>
    1111   {foreach from=$headerFoldersData item=curFolder}
    12     <tr><td class="CellNav" onclick="goTo('{$indexFile}?action=PrivateMessages&amp;FolderID={$curFolder.folderID}&amp;{$mySID}');"><a class="FontNav" href="{$indexFile}?action=PrivateMessages&amp;folderID={$curFolder.folderID}&amp;{$mySID}">{$curFolder.folderName}</a></td></tr>
     12    <tr><td class="CellNav" onclick="goTo('{$indexFile}?action=PrivateMessages&amp;folderID={$curFolder.folderID}&amp;{$mySID}');"><a class="FontNav" href="{$indexFile}?action=PrivateMessages&amp;folderID={$curFolder.folderID}&amp;{$mySID}">{$curFolder.folderName}</a></td></tr>
    1313   {/foreach}
    1414   <tr><td class="CellNavNone" style="padding:0px;"><hr style="width:90%; height:1px;"/></td></tr>
  • trunk/templates/std/templates/PrivateMessagesViewFolder.tpl

    r10 r13  
    1818<table class="TableStd" border="0" cellpadding="3" cellspacing="0" width="100%">
    1919<tr>
    20  <td class="CellCat" align="center"><input type="checkbox" name="p_checkall" onclick="switch_all(this.checked);" /></td>
     20 <td class="CellCat" align="center"><input type="checkbox" name="p_checkall" onclick="switchAllCheckboxes(this.checked);" /></td>
    2121 <td class="CellCat" align="center">&nbsp;</td>
    2222 <td class="CellCat" align="center"><span class="FontTitle">{$modules.Language->getString('Subject')}</span></td>
  • trunk/templates/std/templates/styles/ts_tbb2_standard.css

    r2 r13  
    4040    font-family:verdana,arial;
    4141}
     42textarea.FormTextArea:focus {
     43    border:1px #000000 solid;
     44    padding:4px;
     45    font-size:11px;
     46    font-family:verdana,arial;
     47}
    4248
    4349input.FormText {
    4450    border:1px #000000 dotted;
     51    padding:3px;
     52    font-size:11px;
     53    font-family:verdana,arial;
     54}
     55input.FormText:focus {
     56    border:1px #000000 solid;
    4557    padding:3px;
    4658    font-size:11px;
Note: See TracChangeset for help on using the changeset viewer.