Changeset 21


Ignore:
Timestamp:
Apr 9, 2007, 8:44:16 PM (11 years ago)
Author:
julian
Message:
  • PageParts::printMessage() also adds the last navbar element now
  • Added module SubscribeTopic?
  • Added module EditTopic? (Not yet fully refactored)
  • Editing the first post of a topic also affects the topic
  • Functions::getTopicPicsBox() => Functions::getPostPicsBox() and $checkedID is recognized now
Location:
trunk
Files:
3 added
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/config/Core.config.class.php

    r11 r21  
    99            'Ajax',
    1010            'EditProfile',
     11            'EditTopic',
    1112            'ForumIndex',
    1213            'Login',
     
    1920            'Posting',
    2021            'Register',
     22            'SubscribeTopic',
    2123            'WhoIsOnline'
    2224        )
  • trunk/core/Functions.class.php

    r19 r21  
    247247    }
    248248
    249     public static function getTopicPicsBox($CheckedID = 0) {
     249    public static function getPostPicsBox($checkedID = 0) {
    250250        $Template = Factory::singleton('Template');
    251251        $Cache = Factory::singleton('Cache');
    252252
    253         $topicPicsData = $Cache->getTopicPicsData();
    254 
    255         $Template->assign('topicPicsData',$topicPicsData);
    256 
    257         return $Template->fetch('TopicPicsBox.tpl');
     253        $postPicsData = $Cache->getPostPicsData();
     254
     255        $Template->assign(array(
     256            'postPicsData'=>$postPicsData,
     257            'checkedID'=>$checkedID
     258        ));
     259
     260        return $Template->fetch('PostPicsBox.tpl');
    258261    }
    259262
     
    293296        if($DB->getAffectedRows() == 1) return $DB->fetchArray();
    294297
    295         $DB->query("SELECT GroupID FROM ".TBLPFX."groups_members WHERE MemberID='$UserID'");
     298        $DB->query("SELECT GroupID FROM ".TBLPFX."groups_members WHERE memberID='".USERID."'");
    296299        if($DB->getAffectedRows() > 0) {
    297             $GroupIDs = $DB->Raw2FVArray();
    298 
    299             $DB->query("SELECT $AuthNamesI FROM ".TBLPFX."forums_auth WHERE ForumID='".$ForumData['ForumID']."' AND AuthType='".AUTH_TYPE_GROUP."' AND AuthID IN ('".implode("','",$GroupIDs)."')");
     300            $groupIDs = $DB->raw2FVArray();
     301
     302            $DB->query("SELECT $AuthNamesI FROM ".TBLPFX."forums_auth WHERE forumID='".$forumData['forumID']."' AND authType='".AUTH_TYPE_GROUP."' AND authID IN ('".implode("','",$groupIDs)."')");
    300303            if($DB->getAffectedRows() > 0) {
    301                 $GroupsAuthData = $DB->Raw2Array();
    302                 foreach($AuthNames AS $curAuth) {
    303                     $AuthData[$curAuth] = $ForumData['Members'.$curAuth];
    304                     foreach($GroupsAuthData AS $curGroupAuth) {
    305                         if($curGroupAuth[$curAuth] == 1 - $AuthData[$curAuth]) {
    306                             $AuthData[$curAuth] = 1 - $AuthData[$curAuth];
     304                $groupsAuthData = $DB->raw2Array();
     305                foreach($authNames AS $curAuth) {
     306                    $authData[$curAuth] = $forumData['Members'.$curAuth];
     307                    foreach($groupsAuthData AS $curGroupAuth) {
     308                        if($curGroupAuth[$curAuth] == 1 - $authData[$curAuth]) {
     309                            $authData[$curAuth] = 1 - $authData[$curAuth];
    307310                            break;
    308311                        }
     
    310313                }
    311314
    312                 if($AuthData['AuthIsMod'] == 1) {
    313                     foreach($AuthNames AS $curAuth)
    314                         $AuthData[$curAuth] = 1;
     315                if($authData['authIsMod'] == 1) {
     316                    foreach($authNames AS $curAuth)
     317                        $authData[$curAuth] = 1;
    315318                }
    316319
    317                 return $AuthData;
     320                return $authData;
    318321            }
    319322        }
    320323
    321         foreach($AuthData AS $curAuth)
    322             $Auth[$curAuth] = isset($ForumData['Guests'.$curAuth]) ? $ForumData['Guests'.$curAuth] : 0;
    323 
    324         return $AuthData;
     324        foreach($authData AS $curAuth)
     325            $auth[$curAuth] = isset($forumData['Guests'.$curAuth]) ? $forumData['Guests'.$curAuth] : 0;
     326
     327        return $authData;
    325328    }
    326329
  • trunk/languages/de/Messages.language

    r15 r21  
    2323message_text_new_private_message_text_received = "In Ihrem Posteingang befindet sich mindestens eine neue private Nachricht"
    2424message_text_account_activated = "Ihr Account wurde erfolgreich aktiviert! Vielen Dank für Ihr Verständnis!"
     25
     26message_title_topic_subscription_successful = "Thema abonniert"
    2527message_text_topic_subscription_successful = "Sie haben dieses Thema erfolgreich abonniert!"
     28
     29message_title_topic_unsubscription_successful = "Thema deabonniert"
    2630message_text_topic_unsubscription_successful = "Sie haben dieses Thema erfolgreich deabonniert!"
     31
    2732message_text_closed_topic = "Diese Thema wurde geschlossen, d.h. Sie dürfen keine weiteren Antworten erstellen!"
    2833message_text_topic_moved = "Das Thema wurde erfolgreich verschoben!"
  • trunk/modules/Cache.class.php

    r9 r21  
    8484    }
    8585
    86     public function setTopicPicsData() {
    87         $toWrite = $topicPicsData = array();
    88 
    89         $this->modules['DB']->query("SELECT smileyID,smileyFileName FROM ".TBLPFX."smilies WHERE SmileyType='".SMILEY_TYPE_TPIC."'");
     86    public function setPostPicsData() {
     87        $toWrite = $postPicsData = array();
     88
     89        $this->modules['DB']->query("SELECT smileyID,smileyFileName FROM ".TBLPFX."smilies WHERE smileyType='".SMILEY_TYPE_TPIC."'");
    9090        while($curSmiley = $this->modules['DB']->fetchArray()) {
    9191            $toWrite[] = 'array(\'smileyID\'=>\''.$curSmiley['smileyID'].'\',\'smileyFileName\'=>\''.$curSmiley['smileyFileName'].'\')';
    92             $topicPicsData[] = $curSmiley;
    93         }
    94 
    95         $toWrite = '<?php $topicPicsData = array('.implode(',',$toWrite).'); ?>';
    96 
    97         Functions::FileWrite('cache/TopicPics.cache.php',$toWrite,'w');
    98 
    99         return $topicPicsData;
    100     }
    101 
    102     public function getTopicPicsData() {
    103         $topicPicsData = array();
    104 
    105         if(file_exists('cache/TopicPics.cache.php') == TRUE)
    106             include('cache/TopicPics.cache.php');
    107         else return $this->setTopicPicsData();
    108 
    109         return $topicPicsData;
     92            $postPicsData[] = $curSmiley;
     93        }
     94
     95        $toWrite = '<?php $postPicsData = array('.implode(',',$toWrite).'); ?>';
     96
     97        Functions::FileWrite('cache/PostPics.cache.php',$toWrite,'w');
     98
     99        return $postPicsData;
     100    }
     101
     102    public function getPostPicsData() {
     103        $postPicsData = array();
     104
     105        if(file_exists('cache/PostPics.cache.php'))
     106            include('cache/PostPics.cache.php');
     107        else return $this->setPostPicsData();
     108
     109        return $postPicsData;
    110110    }
    111111
  • trunk/modules/PageParts.class.php

    r15 r21  
    55        'Auth',
    66        'Config',
     7        'DB',
    78        'Language',
    8         'Template',
    9         'DB'
     9        'Navbar',
     10        'Template'
    1011    );
    1112
     
    7778        $this->modules['Language']->addFile('Messages');
    7879
     80        $this->modules['Navbar']->addElement((is_array($message) ? $message[0] : $this->modules['Language']->getString('message_title_'.$message)),'');
     81
    7982        $this->modules['Template']->assign(array(
    8083            'flags'=>$this->flags,
  • trunk/modules/Posting.class.php

    r9 r21  
    4949        $p['messageTitle'] = isset($_POST['p']['messageTitle']) ? $_POST['p']['messageTitle'] : (($mode == 'Edit') ? addslashes($postData['postTitle']) : (($mode == 'Reply') ? 'Re: '.addslashes($topicData['topicTitle']) : ''));
    5050        $p['guestNick'] = isset($_POST['p']['guestNick']) ? $_POST['p']['guestNick'] : '';
    51         $p['smileyID'] = isset($_POST['p']['smileyID']) ? intval($_POST['p']['smileyID']) : 0;
     51        $p['smileyID'] = isset($_POST['p']['smileyID']) ? intval($_POST['p']['smileyID']) : (($mode == 'Edit') ? addslashes($postData['smileyID']) : '');
    5252        $p['pollTitle'] = isset($_POST['p']['pollTitle']) ? $_POST['p']['pollTitle'] : '';
    5353        $p['pollOptions'] = (isset($_POST['p']['pollOptions']) == TRUE && is_array($_POST['p']['pollOptions']) == TRUE) ? $_POST['p']['pollOptions'] : array();
     
    105105                            postID='$postID'
    106106                    ");
    107                     Functions::myHeader(INDEXFILE."?Action=ViewTopic&PostID=$postID&".MYSID."#Post$postID"); exit;
     107
     108                    if($postID == $topicData['topicFirstPostID']) {
     109                        $this->modules['DB']->query("
     110                            UPDATE
     111                                ".TBLPFX."topics
     112                            SET
     113                                topicTitle='".$p['messageTitle']."',
     114                                smileyID='".$p['smileyID']."'
     115                            WHERE
     116                                topicID='$topicID'
     117                        ");
     118                    }
     119
     120                    Functions::myHeader(INDEXFILE."?action=ViewTopic&postID=$postID&".MYSID."#post$postID"); exit;
    108121                }
    109122                else {
     
    225238            $smiliesBox = Functions::getSmiliesBox();
    226239        }
    227         $topicPicsBox = Functions::getTopicPicsBox($p['smileyID']);
     240        $postPicsBox = Functions::getPostPicsBox($p['smileyID']);
    228241
    229242        // Die Vorschau
     
    276289            'mode'=>$mode,
    277290            'error'=>$error,
    278             'topicPicsBox'=>$topicPicsBox,
     291            'postPicsBox'=>$postPicsBox,
    279292            'smiliesBox'=>$smiliesBox
    280293        ));
  • trunk/modules/ViewTopic.class.php

    r19 r21  
    5454
    5555
    56         // Authehtifizierung
     56        // Authentifizierung
    5757        $authData = $this->_authenticateUser($forumData);
    5858
     
    259259
    260260
    261         $subscribeText = '';
    262261        if($this->modules['Auth']->isLoggedIn() == 1 && $this->modules['Config']->getValue('enable_email_functions') == 1 && $this->modules['Config']->getValue('enable_topic_subscription') == 1) {
    263262            $this->modules['DB']->query("SELECT UserID FROM ".TBLPFX."topics_subscriptions WHERE topicID='$topicID' AND UserID='".USERID."'");
    264263            $subscribeText = ($this->modules['DB']->getAffectedRows() == 0) ? $this->modules['Language']->getString('Subscribe_topic') : $this->modules['Language']->getString('Unsubscribe_topic');
    265         }
    266 
    267         // TODO Navibar
     264            $this->modules['Navbar']->setRightArea('<a href="'.INDEXFILE.'?action=SubscribeTopic&amp;topicID='.$topicID.'&amp;'.MYSID.'">'.$subscribeText.'</a>');
     265        }
     266
    268267        $this->modules['Navbar']->addCategories($forumData['catID']);
    269268        $this->modules['Navbar']->addElements(
     
    279278            'topicID'=>$topicID,
    280279            'forumID'=>$forumID,
    281             'subscribeText'=>$subscribeText,
    282280            'topicData'=>$topicData,
    283281            'pollData'=>$pollData
  • trunk/templates/std/files/PostPicsBox.tpl

    r17 r21  
    11<table border="0" cellpadding="0" cellspacing="4">
    22 <tr>
    3 {foreach from=$topicPicsData item=curTopicPic name=topicPicsLoop}
    4   <td><input type="radio" name="p[smileyID]" value="{$curTopicPic.smileyID}"/><img border="0" src="{$curTopicPic.smileyFileName}" alt=""/></td>
    5  {if $smarty.foreach.topicPicsLoop.iteration % 7 == 0 && $smarty.foreach.topicPicsLoop.iteration != $smarty.foreach.topicPicsLoop.total}</tr><tr>{/if}
     3{foreach from=$postPicsData item=curPostPic name=postPicsLoop}
     4  <td><input type="radio" name="p[smileyID]" value="{$curPostPic.smileyID}"{if $curPostPic.smileyID == $checkedID} checked="checked"{/if}/><img border="0" src="{$curPostPic.smileyFileName}" alt=""/></td>
     5 {if $smarty.foreach.postPicsLoop.iteration % 7 == 0 && $smarty.foreach.postPicsLoop.iteration != $smarty.foreach.postPicsLoop.total}</tr><tr>{/if}
    66{/foreach}
    77 </tr>
  • trunk/templates/std/files/Posting.tpl

    r17 r21  
    7272<tr>
    7373 <td class="CellStd" valign="top"><span class="FontNorm">{$modules.Language->getString('Post_pic')}:</span></td>
    74  <td class="CellAlt" valign="top">{$topicPicsBox}</td>
     74 <td class="CellAlt" valign="top">{$postPicsBox}</td>
    7575</tr>
    7676<tr>
Note: See TracChangeset for help on using the changeset viewer.