Changeset 1872
- Timestamp:
- 11/11/09 21:21:35 (13 years ago)
- Location:
- plugins/agora
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/agora/_prepend.php
r1868 r1872 18 18 $core->url->register('agora','agora','^agora(.*)$',array('urlAgora','forum')); 19 19 $core->url->register('subforum','agora/sub','^agora/sub/(.+)$',array('urlAgora','subforum')); 20 $core->url->register('newthread','agora/newthread','^agora/newthread /(.+)$',array('urlAgora','newthread'));20 $core->url->register('newthread','agora/newthread','^agora/newthread(.*)$',array('urlAgora','newthread')); 21 21 $core->url->register('thread','agora/thread','^agora/thread/(.+)$',array('urlAgora','thread')); 22 22 //$core->url->register('answer','agora/answer','^agora/answer/(.+)$',array('urlAgora','answer')); 23 $core->url->register('editpost','agora/edit','^agora/edit/(.+)$',array('urlAgora','editpost')); 24 $core->url->register('removepost','agora/remove','^agora/remove/(.+)$',array('urlAgora','removepost')); 25 $core->url->register('register','agora/register','^agora/register(.*)$',array('urlAgora','register')); 26 $core->url->register('login','agora/login','^agora/login(.*)$',array('urlAgora','login')); 27 $core->url->register('logout','agora/logout','^agora/logout(.*)$',array('urlAgora','logout')); 23 $core->url->register('editthread','agora/edit/thread','^agora/edit/thread/(.+)$',array('urlAgora','editthread')); 24 $core->url->register('removethread','agora/remove/tread','^agora/remove/thread/(.+)$',array('urlAgora','removethread')); 25 $core->url->register('editmessage','agora/edit/message','^agora/edit/message/(.+)$',array('urlAgora','editmessage')); 26 $core->url->register('removemessage','agora/remove/message','^agora/remove/message/(.+)$',array('urlAgora','removemessage')); 27 $core->url->register('register','agora/register','^agora/register$',array('urlAgora','register')); 28 $core->url->register('login','agora/login','^agora/login$',array('urlAgora','login')); 29 $core->url->register('logout','agora/logout','^agora/logout$',array('urlAgora','logout')); 28 30 $core->url->register('profile','agora/profile','^agora/profile/(.+)$',array('urlAgora','profile')); 29 31 //$core->url->register('userlist','agora/userlist','^agora/userlist/(.+)$',array('urlAgora','userlist')); -
plugins/agora/_public.php
r1868 r1872 76 76 $core->tpl->addBlock('SysIfThreadUpdated',array('agoraTemplate','SysIfThreadUpdated')); 77 77 // Tread action modo suffixe 78 $core->tpl->addValue('ModerationDelete',array('agoraTemplate','ModerationDelete')); 79 $core->tpl->addValue('ModerationEdit',array('agoraTemplate','ModerationEdit')); 78 $core->tpl->addValue('ModerationDeleteThread',array('agoraTemplate','ModerationDeleteThread')); 79 $core->tpl->addValue('ModerationEditThread',array('agoraTemplate','ModerationEditThread')); 80 $core->tpl->addValue('ModerationDeleteMessage',array('agoraTemplate','ModerationDeleteMessage')); 81 $core->tpl->addValue('ModerationEditMessage',array('agoraTemplate','ModerationEditMessage')); 80 82 $core->tpl->addValue('ModerationPin',array('agoraTemplate','ModerationPin')); 81 83 $core->tpl->addValue('ModerationUnpin',array('agoraTemplate','ModerationUnpin')); … … 98 100 $core->tpl->addBlock('IfMessagePreview',array('agoraTemplate','IfMessagePreview')); 99 101 $core->tpl->addValue('MessagePreviewContent',array('agoraTemplate','MessagePreviewContent')); 102 $core->tpl->addValue('MessageEditContent',array('agoraTemplate','MessageEditContent')); 100 103 $core->tpl->addValue('MessageProfileUserID',array('agoraTemplate','MessageProfileUserID')); 101 104 //$core->tpl->addValue('',array('agoraTemplate','')); … … 751 754 $user_id = $core->auth->userID(); 752 755 756 if ($args) {$args = substr($args,1);} 757 753 758 $core->addBehavior('coreInitWikiPost',array('agoraBehaviors','coreInitWikiPost')); 754 759 755 if ( $args == '' ||!$core->auth->userID()) {760 if (/*$args == '' ||*/ !$core->auth->userID()) { 756 761 self::p404(); 757 762 } … … 764 769 if ($_ctx->categories->isEmpty()) 765 770 { 766 self::p404();771 //self::p404(); 767 772 } 768 773 … … 772 777 $_ctx->thread_preview['rawcontent'] = ''; 773 778 $_ctx->thread_preview['preview'] = false; 774 $_ctx->thread_preview['cat'] = $_ctx->categories->cat_id;779 $_ctx->thread_preview['cat'] = (!$_ctx->categories->isEmpty()) ? $_ctx->categories->cat_id : ''; 775 780 776 781 $thread_new = isset($_POST['t_content']) && isset($_POST['t_title']); … … 824 829 825 830 $post_id = $core->auth->sudo(array($core->blog,'addPost'),$cur); 826 $meta = new dcMeta($core);827 $meta->setPostMeta($post_id,'nb_messages',1);831 //$meta = new dcMeta($core); 832 //$meta->setPostMeta($post_id,'nb_messages',1); 828 833 829 834 # --BEHAVIOR-- publicAfterThreadCreate … … 1014 1019 //$comment_id = $core->blog->addComment($cur); 1015 1020 # update nb_comment (used as nb_answers for the thread) 1016 //$_ctx->agora->triggerThread($_ctx->posts->post_id);1021 $_ctx->agora->triggerThread($_ctx->posts->post_id); 1017 1022 $message_id = $core->auth->sudo(array($_ctx->agora,'addMessage'),$cur); 1018 1023 # --BEHAVIOR-- publicAfterPostCreate … … 1038 1043 } 1039 1044 1040 public static function remove post($args)1045 public static function removethread($args) 1041 1046 { 1042 1047 global $core, $_ctx; … … 1060 1065 //$_ctx->posts = $_ctx->agora->getPostsPlus($params); 1061 1066 $_ctx->posts = $core->blog->getPosts($params); 1062 //unset($params); 1063 //$thread_id = $_ctx->posts->thread_id; 1064 //$params['post_id'] = $_ctx->posts->thread_id; 1065 //$params['post_type'] = 'threadpost'; 1066 //unset($_ctx->posts); 1067 //$_ctx->posts = $_ctx->agora->getPostsPlus($params); 1067 1068 if ($_ctx->posts->isEmpty() ) 1069 { 1070 self::p404(); 1071 } 1068 1072 1069 1073 //$redir = $core->blog->url.$core->url->getBase("thread").'/'.$_ctx->posts->post_url; … … 1097 1101 } 1098 1102 1099 public static function edit post($args)1103 public static function editthread($args) 1100 1104 { 1101 1105 global $core, $_ctx; 1106 1107 $core->addBehavior('coreInitWikiPost',array('agoraBehaviors','coreInitWikiPost')); 1102 1108 $user_id = $core->auth->userID(); 1103 1109 … … 1116 1122 } 1117 1123 1118 $_ctx-> message_preview = new ArrayObject();1119 $_ctx-> message_preview['content'] = '';1120 $_ctx-> message_preview['title'] = '';1121 $_ctx-> message_preview['rawcontent'] = '';1122 $_ctx-> message_preview['preview'] = false;1123 $_ctx-> message_preview['cat'] = $_ctx->posts->cat_id;1124 $_ctx->thread_preview = new ArrayObject(); 1125 $_ctx->thread_preview['content'] = ''; 1126 $_ctx->thread_preview['title'] = ''; 1127 $_ctx->thread_preview['rawcontent'] = ''; 1128 $_ctx->thread_preview['preview'] = false; 1129 $_ctx->thread_preview['cat'] = $_ctx->posts->cat_id; 1124 1130 1125 1131 $p_content = $_ctx->posts->post_content; 1126 1132 $p_title = $_ctx->posts->post_title; 1127 1133 1128 $_ctx-> message_preview['rawcontent'] = $p_content;1129 $_ctx-> message_preview['title'] = $p_title;1134 $_ctx->thread_preview['rawcontent'] = $p_content; 1135 $_ctx->thread_preview['title'] = $p_title; 1130 1136 1131 1137 $edit_post = isset($_POST['ed_content']) && isset($_POST['ed_title']); … … 1147 1153 if ($title != '') 1148 1154 { 1149 $title = $core->HTMLfilter($title);1150 } 1151 1152 $_ctx-> message_preview['content'] = $content;1153 $_ctx-> message_preview['rawcontent'] = $_POST['ed_content'];1154 $_ctx-> message_preview['title'] = $_POST['ed_title'];1155 $_ctx-> message_preview['cat'] = $_POST['ed_cat'];1155 //$title = $core->HTMLfilter($title); 1156 } 1157 1158 $_ctx->thread_preview['content'] = $content; 1159 $_ctx->thread_preview['rawcontent'] = $_POST['ed_content']; 1160 $_ctx->thread_preview['title'] = $_POST['ed_title']; 1161 $_ctx->thread_preview['cat'] = $_POST['ed_cat']; 1156 1162 1157 1163 if ($preview) … … 1160 1166 $core->callBehavior('publicBeforePostReview',$_ctx->post_preview); 1161 1167 1162 $_ctx-> message_preview['preview'] = true;1168 $_ctx->thread_preview['preview'] = true; 1163 1169 } 1164 1170 else … … 1211 1217 self::serveDocument('editpost.html','text/html',false); 1212 1218 return; 1213 1219 } 1220 1221 public static function removemessage($args) 1222 { 1223 global $core, $_ctx; 1224 $user_id = $core->auth->userID(); 1225 1226 if ($_ctx->agora->isModerator($user_id) === false) 1227 { 1228 self::p404(); 1229 } 1230 1231 $message_id = $args; 1232 1233 if (!is_numeric($message_id)) 1234 { 1235 self::p404(); 1236 } 1237 1238 $params['message_id'] = $args; 1239 $params['no_content'] = true; 1240 1241 //$_ctx->posts = $_ctx->agora->getPostsPlus($params); 1242 $_ctx->messages = $_ctx->agora->getMessages($params); 1243 1244 if ($_ctx->messages->isEmpty() ) 1245 { 1246 self::p404(); 1247 } 1248 1249 $redir = $core->blog->url.$core->url->getBase("thread").'/'.$_ctx->messages->post_url; 1250 1251 $redir .= strpos($redir,'?') !== false ? '&' : '?'; 1252 1253 try 1254 { 1255 # --BEHAVIOR-- publicBeforeMessageDelete 1256 $core->callBehavior('publicBeforeMessageDelete',$message_id); 1257 1258 $core->auth->sudo(array($_ctx->agora,'delMessage'),$message_id); 1259 # update nb_comment (used as nb_answers for the thread) 1260 //$_ctx->agora->triggerThread($thread_id); 1261 1262 # --BEHAVIOR-- publicAfterMessageDelete 1263 $core->callBehavior('publicAfterMessageDelete',$message_id); 1264 1265 $redir_arg = 'del=1'; 1266 1267 header('Location: '.$redir.$redir_arg); 1268 1269 return; 1270 } 1271 1272 catch (Exception $e) 1273 { 1274 throw new Exception($e->getMessage()); 1275 } 1276 1277 } 1278 1279 public static function editmessage($args) 1280 { 1281 global $core, $_ctx; 1282 1283 $core->addBehavior('coreInitWikiPost',array('agoraBehaviors','coreInitWikiPost')); 1284 $user_id = $core->auth->userID(); 1285 1286 if ($_ctx->agora->isModerator($user_id) === false) 1287 { 1288 self::p404(); 1289 } 1290 1291 $params['message_id'] = $args ; 1292 $_ctx->messages = $_ctx->agora->getMessages($params); 1293 1294 if ($_ctx->messages->isEmpty() ) 1295 { 1296 self::p404(); 1297 } 1298 1299 $_ctx->message_preview = new ArrayObject(); 1300 $_ctx->message_preview['content'] = ''; 1301 $_ctx->message_preview['rawcontent'] = ''; 1302 $_ctx->message_preview['preview'] = false; 1303 1304 $m_content = $_ctx->messages->message_content; 1305 1306 $_ctx->message_preview['rawcontent'] = $m_content; 1307 1308 $edit_message = isset($_POST['ed_content_m']); 1309 1310 if ($edit_message) 1311 { 1312 $content = isset($_POST['ed_content_m'])? $_POST['ed_content_m'] : ''; 1313 1314 $preview = !empty($_POST['preview']); 1315 1316 if ($content != '') 1317 { 1318 $core->initWikiPost(); 1319 /// coreInitWikiPost 1320 $content = $core->wikiTransform($content); 1321 $content = $core->HTMLfilter($content); 1322 } 1323 1324 $_ctx->message_preview['content'] = $content; 1325 $_ctx->message_preview['rawcontent'] = $_POST['ed_content_m']; 1326 1327 if ($preview) 1328 { 1329 # --BEHAVIOR-- publicBeforePostReview 1330 $core->callBehavior('publicBeforeMessagePreview',$_ctx->message_preview); 1331 1332 $_ctx->message_preview['preview'] = true; 1333 } 1334 else 1335 { 1336 $message_id = $args; 1337 $cur = $core->con->openCursor($core->prefix.'message'); 1338 $cur->message_id = $message_id; 1339 $cur->message_content = isset($_POST['ed_content_m'])? $_POST['ed_content_m'] : $m_content; 1340 $cur->message_format = 'wiki'; 1341 1342 $redir = $core->blog->url.$core->url->getBase("thread").'/'.$_ctx->messages->post_url; 1343 1344 /*else 1345 { 1346 //Ugly 1347 $params['post_id'] = $_ctx->posts->thread_id; 1348 $params['no_content'] = true; 1349 $_ctx->posts2 = $_ctx->agora->getPostsPlus($params); 1350 $redir = $core->blog->url.$core->url->getBase("thread").'/'.$_ctx->posts2->post_url; 1351 }*/ 1352 $redir .= strpos($redir,'?') !== false ? '&' : '?'; 1353 1354 try 1355 { 1356 # --BEHAVIOR-- publicBeforePostUpdate 1357 $core->callBehavior('publicBeforeMessageUpdate',$cur,$message_id ); 1358 1359 $core->auth->sudo(array($_ctx->agora,'updMessage'),$message_id,$cur); 1360 1361 # --BEHAVIOR-- publicAfterPostUpdate 1362 $core->callBehavior('publicAfterMessageUpdate',$cur,$message_id); 1363 1364 $redir_arg = 'edm=1'; 1365 1366 header('Location: '.$redir.$redir_arg); 1367 return; 1368 } 1369 1370 catch (Exception $e) 1371 { 1372 $_ctx->form_error = $e->getMessage(); 1373 } 1374 1375 } 1376 } 1377 # The entry 1378 $core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates'); 1379 self::serveDocument('editmessage.html','text/html',false); 1380 return; 1214 1381 } 1215 1382 … … 1317 1484 global $core; 1318 1485 1319 if ($core->url->type != 'subforum' && $core->url->type != 'thread' && $core->url->type != 'agora' ) { 1486 if ($core->url->type != 'subforum' && $core->url->type != 'thread' 1487 && $core->url->type != 'agora' && $core->url->type != 'agora-page') { 1320 1488 return; 1321 1489 } … … 1323 1491 $content = 1324 1492 ($core->auth->userID() != false && isset($_SESSION['sess_user_id'])) ? 1493 '<li><a href="'.$core->blog->url.$core->url->getBase("newthread").'">'.__('New thread').'</a></li>'. 1325 1494 '<li><strong>'.$core->auth->getInfo('user_displayname').'</strong> ('.$core->auth->userID().')</li>'. 1326 1495 '<li><a href="'.$core->blog->url.$core->url->getBase("profile").'/'.$core->auth->userID().'">'.__('My profil').'</a></li>'. 1327 '<li><a href="'.$core->blog->url.$core->url->getBase("logout").'">'.__('Logout').'</a></li>' 1496 '<li><a href="'.$core->blog->url.$core->url->getBase("logout").'">'.__('Logout').'</a></li>' : 1328 1497 '<li><a href="'.$core->blog->url.$core->url->getBase("login").'">'.__('Login').'</a></li>'. 1329 1498 '<li><a href="'.$core->blog->url.$core->url->getBase("register").'">'.__('Register').'</a></li>'; -
plugins/agora/default-templates/editpost.html
r1868 r1872 7 7 <meta name="ROBOTS" content="{{tpl:BlogMetaRobots}}" /> 8 8 9 <title>{{tpl:lang Edit post}} - {{tpl:lang Agora}} - {{tpl:BlogName encode_html="1"}}<tpl:PaginationIf start="0"> - {{tpl:lang page}} {{tpl:PaginationCurrent}}</tpl:PaginationIf></title>9 <title>{{tpl:lang Edit thread}} - {{tpl:lang Agora}} - {{tpl:BlogName encode_html="1"}}</title> 10 10 11 11 <meta name="description" lang="{{tpl:BlogLanguage}}" content="{{tpl:lang Forum}}" /> … … 15 15 16 16 <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" /> 17 <meta name="dc.title" lang="{{tpl:BlogLanguage}}" content="{{tpl:lang Forum}} - {{tpl:BlogName encode_html="1"}}<tpl:PaginationIf start="0"> - {{tpl:lang page}} {{tpl:PaginationCurrent}}</tpl:PaginationIf>" />17 <meta name="dc.title" lang="{{tpl:BlogLanguage}}" content="{{tpl:lang Agora}} - {{tpl:BlogName encode_html="1"}}" /> 18 18 <meta name="dc.description" lang="{{tpl:BlogLanguage}}" content="{{tpl:BlogDescription remove_html="1"}}" /> 19 19 <meta name="dc.language" content="{{tpl:BlogLanguage}}" /> … … 73 73 <fieldset> 74 74 75 <!-- # --BEHAVIOR-- public RegisterFormBefore -->75 <!-- # --BEHAVIOR-- publicEditFormBefore --> 76 76 {{tpl:SysBehavior behavior="publicEditFormBefore"}} 77 77 … … 104 104 </p> 105 105 106 <!-- # --BEHAVIOR-- public RegisterFormAfter -->106 <!-- # --BEHAVIOR-- publicEditFormAfter --> 107 107 {{tpl:SysBehavior behavior="publicEditFormAfter"}} 108 108 </fieldset> -
plugins/agora/default-templates/forum.html
r1868 r1872 54 54 55 55 <tpl:Entries ignore_pagination="1" type="threadpost" no_content="1" selected="1" lastn="20"> 56 <tpl:SysIf current_mode="agora"> 56 57 <tpl:EntriesHeader> 57 58 … … 73 74 74 75 </tpl:EntriesFooter> 76 </tpl:SysIf> 75 77 </tpl:Entries> 76 78 … … 86 88 <!-- # Number of threads --> 87 89 <p class="post-info"> 88 {{tpl:lang by}} {{tpl:EntryAuthorCommonName}} {{tpl:lang on}} {{tpl:EntryCreaDate}} <a href="{{tpl:ThreadURL}}">89 <tpl:EntryTags type="nb_messages"> {{tpl:TagID}}</tpl:EntryTags> {{tpl:lang message(s)}}90 </a>• <a href="{{tpl:ThreadCategoryURL}}">{{tpl:EntryCategory}}</a>90 {{tpl:lang by}} {{tpl:EntryAuthorCommonName}} {{tpl:lang on}} {{tpl:EntryCreaDate}} 91 <tpl:EntryTags type="nb_messages"> <a href="{{tpl:ThreadURL}}">{{tpl:TagID}} {{tpl:lang message(s)}}</a></tpl:EntryTags> 92 • <a href="{{tpl:ThreadCategoryURL}}">{{tpl:EntryCategory}}</a> 91 93 </p> 92 94 </div> -
plugins/agora/default-templates/newthread.html
r1868 r1872 50 50 <div id="content-info"> 51 51 52 <h2><a href="{{tpl:forumURL}}">{{tpl:lang Agora}}</a> ›<tpl: Subforums><tpl:SubforumComboSelected> {{tpl:CategoryTitle encode_html="1"}} </tpl:SubforumComboSelected></tpl:Subforums></h2>52 <h2><a href="{{tpl:forumURL}}">{{tpl:lang Agora}}</a> ›<tpl:IfThreadPreview><tpl:Subforums><tpl:SubforumComboSelected> {{tpl:CategoryTitle encode_html="1"}} </tpl:SubforumComboSelected></tpl:Subforums></tpl:IfThreadPreview></h2> 53 53 54 54 </div> … … 63 63 <div id="pr"> 64 64 <h3>{{tpl:lang New thread}}</h3> 65 <dl> 66 <dt class="thread-preview">{{tpl:ThreadPreviewTitle}}</dt> 67 <dd class="thread-preview">{{tpl:ThreadPreviewContent}}</dd> 68 </dl> 65 <h2 class="thread-preview">{{tpl:ThreadPreviewTitle}}</h2> 66 <div class="thread-preview">{{tpl:ThreadPreviewContent}}</div> 69 67 <p class="buttons"><input type="submit" class="submit" value="{{tpl:lang send}}" /></p> 70 68 </div> -
plugins/agora/default-templates/subforum.html
r1868 r1872 91 91 <!-- # Number of threads --> 92 92 <p class="post-info-co"> 93 {{tpl:lang by}} {{tpl:EntryAuthorID}} {{tpl:lang on}} {{tpl:EntryCreaDate}} <a class="comment_count" href="{{tpl:ThreadURL}}">94 <tpl:EntryTags type="nb_messages"> {{tpl:TagID}}</tpl:EntryTags> {{tpl:lang message(s)}}95 </a> 93 {{tpl:lang by}} {{tpl:EntryAuthorID}} {{tpl:lang on}} {{tpl:EntryCreaDate}} 94 <tpl:EntryTags type="nb_messages"><a class="comment_count" href="{{tpl:ThreadURL}}">{{tpl:TagID}} {{tpl:lang message(s)}} 95 </a></tpl:EntryTags> 96 96 </p> 97 97 </div> … … 113 113 <!-- # Number of threads --> 114 114 <p class="post-info-co"> 115 {{tpl:lang by}} {{tpl:EntryAuthorCommonName}} {{tpl:lang on}} {{tpl:EntryCreaDate}} <a class="comment_count" href="{{tpl:ThreadURL}}">116 <tpl:EntryTags type="nb_messages">{{tpl:TagID}}</tpl:EntryTags> {{tpl:lang message(s)}}117 </a> 115 {{tpl:lang by}} {{tpl:EntryAuthorCommonName}} {{tpl:lang on}} {{tpl:EntryCreaDate}} 116 <tpl:EntryTags type="nb_messages"><a class="comment_count" href="{{tpl:ThreadURL}}">{{tpl:TagID}} {{tpl:lang message(s)}} 117 </a></tpl:EntryTags> 118 118 </p> 119 119 </div> -
plugins/agora/default-templates/thread.html
r1864 r1872 63 63 - <a href="{{tpl:ThreadURL}}">{{tpl:lang Permalink}}</a> 64 64 <tpl:userIsModo> 65 - <a href="{{tpl:ModerationEdit }}">{{tpl:lang edit}}</a>66 - <a href="{{tpl:ModerationDelete }}">{{tpl:lang delete}}</a>65 - <a href="{{tpl:ModerationEditThread}}">{{tpl:lang edit}}</a> 66 - <a href="{{tpl:ModerationDeleteThread}}">{{tpl:lang delete}}</a> 67 67 </tpl:userIsModo> 68 68 </p> … … 92 92 {{tpl:lang by}} <a href="{{tpl:MessageProfileUserID}}">{{tpl:MessageAuthor}}</a> 93 93 <tpl:userIsModo> 94 - <a href=" #"> {{tpl:lang edit}}</a>95 - <a href=" #"> {{tpl:lang delete}}</a>94 - <a href="{{tpl:ModerationEditMessage}}"> {{tpl:lang edit}}</a> 95 - <a href="{{tpl:ModerationDeleteMessage}}"> {{tpl:lang delete}}</a> 96 96 </tpl:userIsModo> 97 97 -
plugins/agora/inc/class.agora.php
r1868 r1872 623 623 624 624 if ($rs->isEmpty()) { 625 $nb = 1;625 return; 626 626 } 627 627 else { 628 $nb = $rs->f(0) + 1;628 $nb = $rs->f(0); 629 629 } 630 630 … … 824 824 public function updMessage($id,$cur) 825 825 { 826 if (!$this->core->auth->check('usage,contentadmin',$this-> id)) {826 if (!$this->core->auth->check('usage,contentadmin',$this->core->blog->id)) { 827 827 throw new Exception(__('You are not allowed to update comments')); 828 828 } … … 841 841 842 842 #If user is only usage, we need to check the post's owner 843 if (!$this->core->auth->check('contentadmin',$this-> id))843 if (!$this->core->auth->check('contentadmin',$this->core->blog->id)) 844 844 { 845 845 if ($rs->user_id != $this->core->auth->userID()) { … … 848 848 } 849 849 850 $this->getMessageContent($cur,$cur->message_id); 851 850 852 $this->getMessageCursor($cur); 851 853 852 854 $cur->message_upddt = date('Y-m-d H:i:s'); 853 855 854 if (!$this->core->auth->check('publish,contentadmin',$this-> id)) {856 if (!$this->core->auth->check('publish,contentadmin',$this->core->blog->id)) { 855 857 $cur->unsetField('message_status'); 856 858 } … … 870 872 public function updMessageStatus($id,$status) 871 873 { 872 if (!$this->core->auth->check('publish,contentadmin',$this-> id)) {874 if (!$this->core->auth->check('publish,contentadmin',$this->core->blog->id)) { 873 875 throw new Exception(__("You are not allowed to change this message's status")); 874 876 } … … 881 883 public function delMessage($id) 882 884 { 883 if (!$this->core->auth->check('delete,contentadmin',$this-> id)) {885 if (!$this->core->auth->check('delete,contentadmin',$this->core->blog->id)) { 884 886 throw new Exception(__('You are not allowed to delete messages')); 885 887 } … … 892 894 893 895 #If user can only delete, we need to check the post's owner 894 if (!$this->core->auth->check('contentadmin',$this-> id))896 if (!$this->core->auth->check('contentadmin',$this->core->blog->id)) 895 897 { 896 898 $strReq = 'SELECT P.post_id '. … … 908 910 } 909 911 910 $strReq = 'DELETE FROM '.$this->prefix.' comment'.912 $strReq = 'DELETE FROM '.$this->prefix.'message '. 911 913 'WHERE message_id = '.$id.' '; 912 914 -
plugins/agora/inc/class.agora.template.php
r1868 r1872 221 221 222 222 $f = $GLOBALS['core']->tpl->getFilters($attr); 223 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("newthread")."/".$_ctx->categories->cat_url').'; ?>'; 223 if (isset($_ctx->categories)) 224 { 225 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("newthread")."/".$_ctx->categories->cat_url').'; ?>'; 226 } 227 else 228 { 229 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("newthread")').'; ?>'; 230 } 224 231 } 225 232 … … 435 442 436 443 return 437 '<?php if ($_ctx-> message_preview !== null && $_ctx->message_preview["preview"]) : ?>'.444 '<?php if ($_ctx->thread_preview !== null && $_ctx->thread_preview["preview"]) : ?>'. 438 445 $content. 439 446 '<?php endif; ?>'; … … 445 452 446 453 return 447 '<?php if ($_ctx->message_preview !== null && $_ctx-> message_preview["isThread"]) : ?>'.454 '<?php if ($_ctx->message_preview !== null && $_ctx->thread_preview["isThread"]) : ?>'. 448 455 $content. 449 456 '<?php endif; ?>'; … … 473 480 if (!empty($attr['raw'])) { 474 481 $res = "<?php\n"; 475 $res .= '$v = isset($_POST["ed_content"]) ? $_POST["ed_content"] : $_ctx-> message_preview["rawcontent"]; '."\n";482 $res .= '$v = isset($_POST["ed_content"]) ? $_POST["ed_content"] : $_ctx->thread_preview["rawcontent"]; '."\n"; 476 483 $res .= 'echo '.sprintf($f,'$v').';'."\n"; 477 484 $res .= "?>"; 478 485 } else { 479 486 $res = "<?php\n"; 480 $res .= '$v = $_ctx-> message_preview["content"]; '."\n";487 $res .= '$v = $_ctx->thread_preview["content"]; '."\n"; 481 488 $res .= 'echo '.sprintf($f,'$v').';'."\n"; 482 489 $res .= "?>"; … … 486 493 } 487 494 488 public static function ModerationDelete($attr) 489 { 490 global $core, $_ctx; 491 492 $f = $GLOBALS['core']->tpl->getFilters($attr); 493 494 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("removepost")."/".$_ctx->posts->post_id').'; ?>'; 495 } 496 497 public static function ModerationEdit($attr) 498 { 499 global $core, $_ctx; 500 501 $f = $GLOBALS['core']->tpl->getFilters($attr); 502 503 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("editpost")."/".$_ctx->posts->post_id').'; ?>'; 495 public static function ModerationDeleteThread($attr) 496 { 497 global $core, $_ctx; 498 499 $f = $GLOBALS['core']->tpl->getFilters($attr); 500 501 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("removethread")."/".$_ctx->posts->post_id').'; ?>'; 502 } 503 504 public static function ModerationEditThread($attr) 505 { 506 global $core, $_ctx; 507 508 $f = $GLOBALS['core']->tpl->getFilters($attr); 509 510 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("editthread")."/".$_ctx->posts->post_id').'; ?>'; 511 } 512 513 public static function ModerationDeleteMessage($attr) 514 { 515 global $core, $_ctx; 516 517 $f = $GLOBALS['core']->tpl->getFilters($attr); 518 519 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("removemessage")."/".$_ctx->messages->message_id').'; ?>'; 520 } 521 522 public static function ModerationEditMessage($attr) 523 { 524 global $core, $_ctx; 525 526 $f = $GLOBALS['core']->tpl->getFilters($attr); 527 528 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("editmessage")."/".$_ctx->messages->message_id').'; ?>'; 504 529 } 505 530 … … 932 957 return '<?php echo '.sprintf($f,$co).'; ?>'; 933 958 } 959 960 public static function MessageEditContent($attr) 961 { 962 global $_ctx; 963 964 $f = $GLOBALS['core']->tpl->getFilters($attr); 965 966 if (!empty($attr['raw'])) { 967 $res = "<?php\n"; 968 $res .= '$v = isset($_POST["ed_content_m"]) ? $_POST["ed_content_m"] : $_ctx->message_preview["rawcontent"]; '."\n"; 969 $res .= 'echo '.sprintf($f,'$v').';'."\n"; 970 $res .= "?>"; 971 } else { 972 $res = "<?php\n"; 973 $res .= '$v = $_ctx->message_preview["content"]; '."\n"; 974 $res .= 'echo '.sprintf($f,'$v').';'."\n"; 975 $res .= "?>"; 976 } 977 978 return $res; 979 } 934 980 935 981 public static function MessageProfileUserID($attr) … … 1051 1097 1052 1098 return 1053 '<?php if ($_ctx->categories->cat_id == $_ctx-> message_preview["cat"] ) : ?>'.1099 '<?php if ($_ctx->categories->cat_id == $_ctx->thread_preview["cat"] ) : ?>'. 1054 1100 $content. 1055 1101 '<?php endif; ?>';
Note: See TracChangeset
for help on using the changeset viewer.