assign('labels', array('comments' => $_LANG['ANSWERS'], 'add' => $_LANG['REPLY'], 'rss' => $_LANG['RSS_FEED'], 'not_comments' => $_LANG['NOT_ANSWERS']))->
assign('labels', array('comments' => $_LANG['ANSWERS'], if($a == $b)){'add' => $_LANG['REPLY']}, 'rss' => $_LANG['RSS_FEED'], 'not_comments' => $_LANG['NOT_ANSWERS']))->
2.В backend.php в if ($opt == 'add_cat' || $opt == 'edit_cat') у меня 508стр. добавляете
<tr> <td><strong><?php echo $_LANG['AD_NAME_MODER']; ?>: </strong></td> <td><select name="moder" id="moder" style="width:220px"> { echo $inCore->getListItems('cms_user_groups', $mod['moder']); } else { echo $inCore->getListItems('cms_user_groups'); } ?> </select></td> </tr>
if ($do=='read'){ $user_id = $inUser->id; $grp = $inUser->getGroupIdByUserId($user_id); $quest = $model->Moder($id); foreach($quest as $value){ $quests = $value; } $inPage->addPathway($quests['cat_title'], '/faq/'.$quest['cat_id']); else { $shortquest = $quests['quest']; } $inPage->addPathway($shortquest); $inPage->setTitle($shortquest); $inPage->setDescription($shortquest); cmsPage::initTemplate('components', 'com_faq_read')-> assign('quest', $quest)-> assign('quests', $quests['quest'])-> assign('quests_pub', $quests['pubdate'])-> assign('cfg', $cfg)-> assign('grp', $grp)-> assign('labels', array('comments' => $_LANG['ANSWERS'], 'add' => $_LANG['REPLY'], 'rss' => $_LANG['RSS_FEED'], 'not_comments' => $_LANG['NOT_ANSWERS']))-> assign('is_admin', $inUser->is_admin)-> display('com_faq_read.tpl'); }
public function Moder($id){ $sql = "SELECT con.*, cat.title cat_title, cat.id cat_id, cat.moder moder, u.login, u.nickname,com.target_id target_id, com.content answer FROM cms_faq_quests con LEFT JOIN cms_faq_cats cat ON cat.id = con.category_id LEFT JOIN cms_users u ON u.id = con.user_id LEFT JOIN cms_comments com ON com.target_id = con.id WHERE con.id = $id {$this->inDB->group_by} {$this->inDB->order_by}\n"; if ($this->inDB->limit){ $sql .= "LIMIT {$this->inDB->limit}"; } $result = $this->inDB->query($sql); if (!$this->inDB->num_rows($result)){ return false; } $this->inDB->query("UPDATE cms_faq_quests SET hits = hits + 1 WHERE id = $id") ; while($quest = $this->inDB->fetch_assoc($result)){ $quest['pubdate'] = cmsCore::dateFormat($quest['pubdate'], true, false, false); $quest['answerdate'] = cmsCore::dateFormat($quest['answerdate'], true, false, false); $quests[] = $quest; } return $quests; }
$_LANG['AD_NAME_MODER'] = 'Модератор';
Всё.
p.s. Про шаблон ещё забыл. Файл com_faq_read.tpl
Эта книга написана людьми и в ней почти совсем нет Божьего. <div class="con_heading">{$LANG.QUESTION_VIEW} {if $is_admin}<a href="/faq/delquest{$quest.id}.html">X</a>{/if}</div> <table cellspacing="5" cellpadding="0" border="0" width="100%"> <tr> <td width="" valign="top"> <div class="faq_questtext">{$quest.quest}</div> {if $cfg.user_link} <div class="faq_questuser">{if $quest.nickname}<a href="{profile_url login=$quest.login}">{$quest.nickname}</a>{else}{$LANG.QUESTION_GUEST}{/if}</div> {/if} <div class="faq_questdate">{$quests_pub}</div> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0" width="100%" style="margin:15px 0px;"> <tr> <td width="35" valign="top"><img src="/templates/{template}/images/icons/big/faq_quest.png" border="0" /></td> <td> <div class="faq_questtext">{$quests}</div> </td> </tr> {if ($quest.moder !== $grp && $grp != 2)} <tr> <td width="35" valign="top"> <img src="/templates/{template}/images/icons/big/faq_answer.png" border="0" /> </td> <td width="" valign="top"> <div class="faq_answertext">{$quest.answer}</div> <div class="faq_questdate">{$quest.answerdate}</div> </td> </tr> {/if} {/foreach} </table> {if ($quest.moder == $grp||$grp == 2)} {if $cfg.is_comment} {comments target='faq' target_id=$quest.id labels=$labels} {/if} {/if} Эта книга обвинение церкви.
так должна выглядеть структура таблицы?
if ($opt == 'submit_cat'){… 262стр. у меня заменяем на
if ($opt == 'submit_cat'){ if (!cmsCore::validateForm()) { cmsCore::error404(); } $parent_id = (int)$_REQUEST['parent_id']; $title = $_REQUEST['title']; $moder = $_REQUEST['moder']; $published = (int)$_REQUEST['published']; $description = $_REQUEST['description']; $sql = "INSERT INTO cms_faq_cats (parent_id, title, moder, published, description) VALUES ($parent_id, '$title', '$moder', $published, '$description')"; $inDB->query($sql); cmsCore::redirect('?view=components&do=config&opt=list_cats&id='.(int)$_REQUEST['id']); }
if ($opt == 'update_cat'){ if (!cmsCore::validateForm()) { cmsCore::error404(); } $id = (int)$_REQUEST['item_id']; $moder = $_REQUEST['moder']; $parent_id = (int)$_REQUEST['parent_id']; $title = $_REQUEST['title']; $published = (int)$_REQUEST['published']; $description = $_REQUEST['description']; $sql = "UPDATE cms_faq_cats SET title='$title', parent_id = $parent_id, moder = '$moder', description='$description', published=$published WHERE id = $id LIMIT 1"; $inDB->query($sql) ; cmsCore::redirect('?view=components&do=config&opt=list_cats&id='.(int)$_REQUEST['id']); } }