function indexAction($id = null) { $p = Tools::getValue('page', 1); if (!empty($id)) { $sql = "select ID, Name, MetaKeywords, MetaRobots, Description from ArticleCategories where (ID = {$id}) and (IsDeleted = 0);"; $category = GetMainConnection()->query($sql)->fetch(); if (empty($category['ID'])) { return AddAlertMessage('danger', 'Категории статей не существует.', '/'); } $CategoryName = $category['Name']; $sql = "SELECT count(*) as RecordCount " . "FROM Articles a " . "WHERE a.CategoryID = {$id} " . "AND a.isActive = 1 " . "AND a.IsDeleted = 0"; $rec = GetMainConnection()->query($sql)->fetch(); $total = ceil($rec['RecordCount'] / ARTICLES_PER_PAGE); $sql = "SELECT a.ID, a.CategoryID, a.Name, a.ShortDescription, a.count_likes, a.CountComments, MainImageExt " . "FROM Articles a " . "WHERE a.CategoryID = {$id} " . "AND a.isActive = 1 " . "AND a.IsDeleted = 0 " . "ORDER BY a.CreateDate DESC, a.ID DESC " . "LIMIT " . ($p > 0 ? $p - 1 : 0) * ARTICLES_PER_PAGE . ", " . ARTICLES_PER_PAGE; $articles = GetMainConnection()->query($sql)->fetchAll(); } else { $category = null; $CategoryName = 'Все статьи'; $article = new Articles($this->context); $total = ceil($article->getArticles($p, null, true) / ARTICLES_PER_PAGE); $articles = $article->getArticles($p); } $this->view->setVars(array('CategoryName' => $CategoryName, 'articles' => $articles, 'pagination' => array('total_pages' => $total, 'current' => $p))); $this->view->breadcrumbs = array(array('url' => '/category', 'title' => 'Все статьи')); if (isset($category)) { $this->view->breadcrumbs[] = array('url' => '/articles/c-' . $id, 'title' => $CategoryName); $this->view->meta = array('meta_title' => $CategoryName, 'meta_description' => $category['Description'], 'meta_keywords' => $category['MetaKeywords']); } else { $this->view->meta = array('meta_title' => $CategoryName, 'meta_description' => $CategoryName, 'meta_keywords' => $CategoryName); } $this->view->generate(); }
function indexAction() { $p = Tools::getValue('page', 1); $q = Tools::getValue('q', ''); $AuthorID = Tools::getValue('author', null); $articles = new Articles($this->context); if ($AuthorID != null) { $sql = "SELECT ID, Name FROM Authors WHERE ID = {$AuthorID};"; $author = GetMainConnection()->query($sql)->fetch(); if (empty($author['ID'])) { return AddAlertMessage('danger', 'Такого автора не существует.', '/'); } $AuthorName = $author['Name']; $total = ceil($articles->getArticles($p, 'AuthorID = ' . $AuthorID, true) / ARTICLES_PER_PAGE); $articles = $total > 0 ? $articles->getArticles($p, 'AuthorID = ' . $AuthorID) : null; } else { $AuthorName = ''; $AddWhere = empty($q) ? '' : '(Name LIKE "%' . $q . '%" OR Description LIKE "%' . $q . '%")'; $total = ceil($articles->getArticles($p, $AddWhere, true) / ARTICLES_PER_PAGE); $articles = $total > 0 ? $articles->getArticles($p, $AddWhere) : null; } $this->view->setVars(array('q' => $q, 'AuthorName' => $AuthorName, 'articles' => $articles, 'pagination' => array('total_pages' => $total, 'current' => $p))); $this->view->breadcrumbs = array(array('url' => '/search', 'title' => 'Поиск')); $this->view->generate(); }
public function __construct($Acontext, $id = null) { $context = $Acontext; $this->db = $context->db; if ($id !== null) { $query = 'SELECT a.ID, a.CategoryID, a.Name, a.ShortDescription, a.count_likes, a.CountComments, a.CountViews, a.IsActive, a.AuthorID, a.MetaKeywords, a.Description, a.CreateDate, a.MainImageExt FROM Articles as a WHERE '; $query .= preg_match('/\\=/', $id) ? $id : 'a.ID = ' . (int) $id; $data = $this->db->query($query)->fetch(); if (!isset($data['ID'])) { return AddAlertMessage('danger', 'Статьи не существует.', '/'); } $query = "select Photo, Comment from ArticleImages where (ArticleID = " . $data['ID'] . ") and (Type = 1) and (coalesce(Comment, '') <> '');"; $photos = $this->db->query($query)->fetchAll(); foreach ($photos as $key => $val) { $URLPos = strpos($data['Description'], $val['Photo']); if ($URLPos !== FALSE) { $ImgStartPos = strrpos($data['Description'], "<img ", -(strlen($data['Description']) - $URLPos)); $ImgEndPos = stripos($data['Description'], "/>", $URLPos); $ImgStr = substr($data['Description'], $ImgStartPos, $ImgEndPos - $ImgStartPos + 2); $ImgBox = '<div id="ImageAndCommentBox"> ' . $ImgStr . '<div class="CommentForImageBox"> ' . $val['Comment'] . '</div> ' . '</div>'; $data['Description'] = str_replace($ImgStr, $ImgBox, $data['Description']); } } if ($data !== false) { foreach ($data as $k => $p) { $this->{$k} = $p; } } } }
public function indexAction($id = null) { if (empty($id)) { return AddAlertMessage('danger', 'Статьи не существует.', '/'); } $vUserID = GetUserID(); $UnknownUserGUID = GetUnknownUserGUID(); $IsNotifyRecipientActive = false; if ($vUserID != 0) { $vAddWhere = "((UserID = {$vUserID}) or (UnknownUserGUID = '{$UnknownUserGUID}'))"; $UnknownUserGUIDForViewed = ""; $IsNotifyRecipientActive = Emails_IsNotifyRecipientActive(1, $id, $_SESSION['auth']['email']); } else { $vAddWhere = "(UnknownUserGUID = '{$UnknownUserGUID}')"; $UnknownUserGUIDForViewed = $UnknownUserGUID; } // Регистрация просмотра статьи пользователем $sql = "insert into ArticleViewed(ArticleID, UnknownUserGUID, UserID, LastView) " . "values({$id}, '{$UnknownUserGUIDForViewed}', {$vUserID}, '" . GetLocalDateTimeAsSQLStr() . "') " . "on duplicate key update " . "LastView = '" . GetLocalDateTimeAsSQLStr() . "';"; $this->db->exec($sql); $article = new Articles($this->context, 'ID = "' . $id . '"'); if (!isset($article->ID) || $article->ID == null) { return AddAlertMessage('danger', 'Статьи не существует.', '/'); } if ($article->IsActive != '1' && !Tools::getValue('preview')) { return AddAlertMessage('danger', 'Статья в черновике.', '/'); } $article->PhotoL = URL . DIR_DBIMAGES . 'articles/' . $id . '/l_1.' . $article->MainImageExt; $sql = "select Name from ArticleCategories where ID = " . (int) $article->CategoryID; $category = GetMainConnection()->query($sql)->fetch(); $vArticleLike = $this->db->query("select ID from ArticleLikes where (ArticleID = {$id}) and {$vAddWhere} limit 1;")->fetch(); $vAlreadyLiked = !empty($vArticleLike['ID']); $sql = "select CommentDate, UserID, UserName, Comment " . "from ArticleComments " . "where (ArticleID = {$id}) " . "and (IsDeleted = 0) " . "order by CommentDate desc;"; $ArticleComments = $this->db->query($sql)->fetchAll(); if (!isset($article->AuthorID) || $article->AuthorID == null) { $ArticleAuthor['Name'] = ''; $ArticleAuthor['ShortDescription'] = ''; $ArticleAuthor['Photo'] = ''; } else { $sql = 'SELECT Name, ShortDescription, Photo FROM Authors WHERE ID=' . (int) $article->AuthorID; $ArticleAuthor = $this->db->query($sql)->fetch(); } $this->view->setVars(array('id' => $id, 'article' => $article, 'similar' => $article->getSimilar($id), 'discused' => $article->getMostDiscussed(), 'alreadyLiked' => $vAlreadyLiked, 'ArticleAuthor' => $ArticleAuthor, 'ArticleDocuments' => $article->getArticleDocuments($id), 'ArticleComments' => $ArticleComments, 'ArticleCategory' => $category['Name'], 'IsNotifyRecipientActive' => $IsNotifyRecipientActive)); $this->view->breadcrumbs = array(array('url' => '/category', 'title' => 'Все статьи'), array('url' => '/articles/c-' . $article->CategoryID, 'title' => $category['Name']), array('url' => '/articles/c-' . $article->CategoryID . '/a-' . $article->ID, 'title' => $article->Name)); $this->view->meta = array('meta_title' => $article->Name, 'meta_description' => $article->ShortDescription, 'meta_keywords' => $article->MetaKeywords); SetTokenForPreventDoubleSubmit(); $this->view->generate(); }
public function unsubscribeAction($AData = null) { if (empty($AData)) { Redirect('/'); } // только залогинившиеся пользователи могут отписаться от рассылки if (!isset($_SESSION['auth']) || empty($_SESSION['auth']['email'])) { $_SESSION['login_redirect'] = '/email/unsubscribe/' . $AData; Redirect('/auth/login'); } $params = explode('||', Decrypt_Blowfish($AData, EMAIL_BLOWFISHGUID)); try { if (Emails_IsNotifyRecipientActive($params[0], $params[1], $_SESSION['auth']['email'])) { Emails_DeleteNotifyRecipient($params[0], $params[1], $_SESSION['auth']['email']); return AddAlertMessage('success', 'Подписка на рассылку уведомлений была отменена!', '/'); } else { return AddAlertMessage('info', 'Вы уже не подписаны на данную рассылку!', '/'); } } catch (Exception $exc) { return AddAlertMessage('danger', 'Ошибка при отмене подписки на рассылку уведомлений!', '/'); } }
$sql = "insert into Users(UniversalType, UniversalID, AccessToken, UserName, Email, EmailConfirmed, RememberMe) " . "values(2, '{$vUniversalID}', '{$accessTokenStr}', '{$userEmail}', '{$userEmail}', 1, 1) " . "on duplicate key update " . "UniversalID = '{$vUniversalID}';"; GetMainConnection()->exec($sql); $UserID = GetMainConnection()->lastInsertId(); $sql = "insert into UserData(UserID, FirstName, LastName) " . "values({$UserID}, '" . $user->getField('first_name') . "', '" . $user->getField('last_name') . "') " . "on duplicate key update " . "UserID = {$UserID};"; GetMainConnection()->exec($sql); } catch (Facebook\Exceptions\FacebookResponseException $e) { /*echo 'Graph returned an error: ' . $e->getMessage(); exit;*/ return AddAlertMessage('danger', 'Ошибка при регистрации! (3)', '/'); } catch (Facebook\Exceptions\FacebookSDKException $e) { /*echo 'Facebook SDK returned an error: ' . $e->getMessage(); exit;*/ return AddAlertMessage('danger', 'Ошибка при регистрации! (4)', '/'); } } // Если дошли без ошибок, то делаем попытку входа с использованием данных из нашей бд. if (LoginUsingUniversalID($vUniversalID)) { if (empty($_SESSION['login_redirect'])) { return AddAlertMessage('success', 'Добро пожаловать!', '/'); } else { $vRedirect = $_SESSION['login_redirect']; unset($_SESSION['login_redirect']); Redirect($vRedirect); } } else { return AddAlertMessage('danger', 'Ошибка при регистрации! (5)', '/'); } } catch (Facebook\Exceptions\FacebookResponseException $e) { // When Graph returns an error //echo 'Graph returned an error: ' . $e->getMessage(); return AddAlertMessage('danger', 'Ошибка при регистрации! (6)', '/');
public function cardtovargiftAction($id) { if (empty($id)) { return AddAlertMessage('danger', 'Товара не существует.', '/'); } $cat = new Market($this->context); $cat_item = $cat->getFullTovarGift($id); $sid = $cat_item[0]['id_podcat']; $cat_name = $cat->getCat($sid); $tovar = new Komments($this->context); $this->view->setVar('text', $tovar->addKomm()); //проба $this->view->breadcrumbs = array(array('url' => '/', 'title' => 'Главная'), array('url' => '/market/', 'title' => 'Маркет'), array('url' => '../gift_product/', 'title' => 'Дарю/Меняю'), array('url' => '../gift_product/cat-' . $cat_name['id_p'], 'title' => $cat_name['name_cat']), array('url' => '../gift_product/cat-' . $cat_name['id_p'] . '/cardtovargift-' . $cat_item[0]['id'], 'title' => $cat_item[0]['name_tovar'])); $this->view->setVar('block_cat_comission', $cat->getCategoriesChangeTreeHTML()); $this->view->setVar('block_full_tovar', $cat->getFullTovarGiftHTML($id)); $this->view->generate(); }
public function contactusAction() { $email = Tools::getValue('email'); $name = Tools::getValue('name'); $subject = Tools::getValue('subject'); $question = Tools::getValue('question'); if (empty($name)) { $name = $email; } if (Tools::isPost()) { if (isset($_SESSION['auth'])) { $vUserID = $_SESSION['auth']['id']; $vUnknownUserGUID = "null"; } else { $vUserID = "null"; $vUnknownUserGUID = "'" . (string) GetUnknownUserGUID() . "'"; } $RecordID = DBInsertRecord($this->db, "ContactUs"); $sql = "update ContactUs " . "set StateID = 1, " . "UserID = {$vUserID}, " . "UnknownUserGUID = {$vUnknownUserGUID}, " . "CreateDate = '" . GetLocalDateTimeAsSQLStr() . "', " . "UserName = '******', " . "UserEmail = '{$email}', " . "MessageSubject = '{$subject}', " . "MessageText = '{$question}' " . "where (ID = {$RecordID});"; $this->db->exec($sql); $content = array('title' => $subject, 'template' => 'contactus', 'data' => array('[year]' => date("Y", time()), '[name]' => $name, '[email]' => $email, '[question]' => $question, '[ticketlink]' => URL . "admincp/index.php?mod=ContactUsItem&id=" . $RecordID)); //$vSendResult = Mailer::send('*****@*****.**', $content, $subject, null, $email); $vSendResult = SendEmailSMTP($email, $name, '*****@*****.**', $content, null, SMTP_CC); if ($vSendResult !== true) { return AddAlertMessage('danger', 'Ошибка при отправке письма!', '/'); } else { return AddAlertMessage('success', 'Ваше сообщение было отправлено!', '/'); } } $this->view->breadcrumbs = array(array('url' => '/auth/contactus', 'title' => 'Свяжитесь с нами')); $this->view->meta = array('meta_title' => 'Свяжитесь с нами', 'meta_description' => 'Свяжитесь с нами', 'meta_keywords' => ''); $this->view->generate(); }
GetMainConnection()->exec($sql); } else { return AddAlertMessage('danger', 'Ошибка получения данных, необходимых для регистации пользователя.', '/auth/login'); } } // Если дошли без ошибок, то делаем попытку входа с использованием данных из нашей бд. if (LoginUsingUniversalID($vUniversalID)) { if (empty($_SESSION['login_redirect'])) { return AddAlertMessage('success', 'Добро пожаловать!', '/'); } else { $vRedirect = $_SESSION['login_redirect']; unset($_SESSION['login_redirect']); Redirect($vRedirect); } } else { return AddAlertMessage('danger', 'Ошибка при регистрации!', '/'); } } else { return AddAlertMessage('danger', 'Ошибка при регистации.', '/auth/login'); } /*var_dump($userInfo); if ($result) { echo "Социальный ID пользователя: " . $userInfo['uid'] . '<br />'; echo "Имя пользователя: " . $userInfo['first_name'] . '<br />'; echo "Ссылка на профиль пользователя: " . $userInfo['screen_name'] . '<br />'; echo "Пол пользователя: " . $userInfo['sex'] . '<br />'; echo "День Рождения: " . $userInfo['bdate'] . '<br />'; echo "День Рождения: " . $userInfo['email'] . '<br />'; echo '<img src="' . $userInfo['photo_big'] . '" />'; echo "<br />"; }*/ }
public function itemAction($id = null) { if (empty($id)) { return AddAlertMessage('danger', 'Организации не существует.', '/'); } $CanSubmit = CanSubmit_CheckTokenForPreventDoubleSubmit(); $ActiveTab = "uslugi"; /*if (($CanSubmit == true) && (filter_input(INPUT_POST, 'AddCommentBtn') !== NULL)) { $ActiveTab = "comments"; $MsgUserName = POSTStrAsSQLStr('MsgUserName'); $MsgText = POSTStrAsSQLStr('MsgText'); unset($_POST['AddCommentBtn']); unset($_POST['MsgUserName']); unset($_POST['MsgText']); if (!empty($MsgUserName) && !empty($MsgText)) { if (isset($_SESSION['auth'])) { $vUserID = $_SESSION['auth']['id']; $vUnknownUserGUID = "null"; } else { $vUserID = "null"; $vUnknownUserGUID = "'".(string)GetUnknownUserGUID()."'"; } $sql = "insert into CatalogComments(CatalogItemID, UserID, UnknownUserGUID, CreateDate, UserName, Text) ". "values($id, $vUserID, $vUnknownUserGUID, '".GetLocalDateTimeAsSQLStr()."', '$MsgUserName', '$MsgText');"; $this->db->exec($sql); } }*/ if ($CanSubmit == true && filter_input(INPUT_POST, 'AddRaitingBtn') !== NULL) { $ActiveTab = "raiting"; $Rating1 = POSTStrAsSQLStr('uslovjEdt'); $Rating2 = POSTStrAsSQLStr('personalEdt'); $Rating3 = POSTStrAsSQLStr('uvagaEdt'); unset($_POST['AddRaitingBtn']); unset($_POST['uslovjEdt']); unset($_POST['personalEdt']); unset($_POST['uvagaEdt']); if (isset($_SESSION['auth'])) { $vUserIDForIns = $_SESSION['auth']['id']; $vUnknownUserGUIDForIns = "null"; $vUserID = "=" . $_SESSION['auth']['id']; $vUnknownUserGUID = "is null"; } else { $vUserIDForIns = "null"; $vUnknownUserGUIDForIns = "'" . (string) GetUnknownUserGUID() . "'"; $vUserID = "is null"; $vUnknownUserGUID = "='" . (string) GetUnknownUserGUID() . "'"; } $sql = "insert into CatalogRatings(CatalogItemID, UserID, UnknownUserGUID, Rating1, Rating2, Rating3) " . "select * from (select {$id} as C1, {$vUserIDForIns} as C2, {$vUnknownUserGUIDForIns} as C3, {$Rating1} as C4, {$Rating2} as C5, {$Rating3} as C6) AS tmp " . "where not exists ( " . "select ID " . "from CatalogRatings " . "where (CatalogItemID = {$id}) " . "and (UserID {$vUserID}) " . "and (UnknownUserGUID {$vUnknownUserGUID}) " . ") limit 1;"; $this->db->exec($sql); } $sql = "select CI.ID, CI.id_pod_cat, CI.name, L.ShortName as LocalityName, CONCAT_WS(', ', L.Name, CI.adress) as FullAddress, CI.adress, CI.foto, CI.kont_tell, " . "CI.site_url, CP.name as SubCategoryName, CI.MetaKeywords, (CI.Rating1+CI.Rating2+CI.Rating3)/3 as TotalRating, " . "CI.Rating1, CI.Rating2, CI.Rating3, CI.CountRatings, CI.uslugi, CI.MapX, CI.MapY, L.RegionName, L.LocalityName as OriginalLocalityName " . "from Catalog_item as CI " . "left outer join view_LocalitiesWithRegion as L on ((CI.LocalityID = L.ID) and (CI.RegionID = L.RegionID)) " . "left outer join Catalog_pod as CP on (CI.id_pod_cat = CP.ID) " . "where CI.ID = {$id} " . "and CI.IsDeleted = 0"; $item = $this->db->query($sql)->fetch(); $sql = "select PI.foto, CONCAT_WS(' ', PI.famil, PI.name, PI.othestvo) as Name, PP.Name as JobTitleName, PI.tell_kont, PI.rabot_graf " . "from Personal_item as PI " . "left outer join Personal_pod as PP on (PI.id_pod_cat = PP.ID) " . "where (PI.CatalogItemID = {$id}) " . "and (PI.IsDeleted = 0) " . "order by PI.famil, PI.name, PI.othestvo;"; $personal = $this->db->query($sql)->fetchAll(); $sql = "select Photo " . "from Catalog_item_images " . "where (CatalogItemID = {$id}) " . "order by ID;"; $photos = $this->db->query($sql)->fetchAll(); $sql = "select CreateDate, UserID, UserName, Text " . "from CatalogComments " . "where (CatalogItemID = {$id}) " . "and (IsDeleted = 0) " . "order by CreateDate desc;"; $comments = $this->db->query($sql)->fetchAll(); if (isset($_SESSION['auth'])) { $vUserID = "=" . $_SESSION['auth']['id']; $vUnknownUserGUID = "is null"; } else { $vUserID = "is null"; $vUnknownUserGUID = "='" . (string) GetUnknownUserGUID() . "'"; } $sql = "select ID " . "from CatalogRatings " . "where (CatalogItemID = {$id}) " . "and (UserID {$vUserID}) " . "and (UnknownUserGUID {$vUnknownUserGUID}) " . "limit 1;"; $rec = $this->db->query($sql)->fetch(); $RaitingID = $rec['ID']; $this->view->setVars(array('id' => $id, 'item' => $item, 'personal' => $personal, 'photos' => $photos, 'comments' => $comments, 'ActiveTab' => $ActiveTab, 'RaitingID' => $RaitingID)); $this->view->breadcrumbs = array(array('url' => '/catalog/', 'title' => 'Каталог организаций'), array('url' => '/catalog/p-' . $item['id_pod_cat'], 'title' => $item['SubCategoryName']), array('url' => '/catalog/i-' . $id, 'title' => $item['name'])); $this->view->meta = array('meta_title' => 'Организация: ' . $item['name'], 'meta_description' => 'Организация: ' . $item['name'], 'meta_keywords' => $item['MetaKeywords']); SetTokenForPreventDoubleSubmit(); $this->view->generate(); }
public function QpageAction($id) { $qpage = new Consult($this->context); $qdate = new ConsQue($this->context, 'id = "' . $id . '"'); $cat = new ConsultUser($this->context, 'uid = "' . $_SESSION['auth']['id'] . '"'); if (!empty($_SESSION['auth']['id'])) { if ($qdate->uid == 0 && $qdate->cid == $cat->cid) { $this->db->prepare('update consult_questions set uid =' . $_SESSION['auth']['id'] . ' where id =' . $id)->execute(); return AddAlertMessage('success', 'Вопрос стал личным.', '/consult/q-' . $qdate->id); } if (!empty($_POST)) { $ans_wer = Tools::getValue('body'); $time = date("Y-m-d H:i:s", time()); $email = $qdate->email; $uri = $qdate->pid == 0 ? $uri = 'http://dev.karapuz/consult/ask/?cn=' . $qdate->cid . '&ex=' . $qdate->uid . '&q=' . $qdate->id : ($uri = 'http://dev.karapuz/consult/ask/?cn=' . $qdate->cid . '&ex=' . $qdate->uid . '&q=' . $qdate->pid); $content = array('title' => 'Вы получили ответ', 'template' => 'expert_answer', 'data' => array('year' => date("Y,M,D", time()), 'name' => $qdate->name, 'answer' => $ans_wer, 'uri' => $uri)); $this->db->prepare('update consult_questions set answer = "' . $ans_wer . '", isAnswer = 0, answerdate = "' . $time . '" where id =' . $id)->execute(); //$sendAnswer = SendEmailSMTP('', '', $email, $content); //if ($sendAnswer !== true) return AddAlertMessage('danger', 'Ошибка при отправке письма!', '/'); return AddAlertMessage('success', 'Ответ был успешно добавлен.', '/consult/cn-' . $qdate->cid . '/ex-' . $qdate->uid); } } $qdate->pid != 0 ? $pid = $qdate->pid : ($pid = $qdate->id); $qdate->uid > 0 ? $qpuid = $qdate->uid : ($qpuid = 1); $disquz = $this->db->query(' select CQ.id, CQ.title, CQ.body, CQ.name, CQ.answer, CQ.isAnswer, CQ.pid pid, CQ.questiondate, CQ.answerdate, CQ.uid, CQ.cid, UD.FirstName, UD.LastName, CC.name cname from consult_questions CQ, userdata UD, consult_category CC where CQ.isActive = 1 and CQ.pid=' . $pid . ' and UD.UserID = ' . $qpuid . ' and CQ.cid=CC.id order by CQ.id ASC ')->fetchall(); $disquzz = $this->db->query(' select CQ.id, CQ.title, CQ.body, CQ.name, CQ.answer, CQ.isAnswer, CQ.pid pid, CQ.questiondate, CQ.answerdate, CQ.uid, CQ.cid, UD.FirstName, UD.LastName, CC.name cname from consult_questions CQ, userdata UD, consult_category CC where CQ.isActive = 1 and CQ.id=' . $pid . ' and UD.UserID = ' . $qpuid . ' and CQ.cid=CC.id order by CQ.id ASC ')->fetch(); $qpage->getPOST(); $category = $this->db->query('select id, name, alt_name, small_img from consult_category')->fetchall(); $questions = $this->db->query('select id, title, body, answer from consult_questions where isActive = 1 ORDER BY id DESC ')->fetchall(); $expert = $this->db->query(' SELECT cc.id, cc.name, cc.alt_name, ud.FirstName, ud.LastName, ud.UserID FROM UserData as ud, consult_category as cc, consult_user_category as cu WHERE ud.UserID=cu.uid and cc.id=cu.cid ')->fetchall(); $this->view->breadcrumbs = array(array('url' => '/', 'title' => 'Главная'), array('url' => '/consult/', 'title' => 'Консультации'), array('url' => '../consult/q-' . $id, 'title' => $qdate->title)); $this->view->setVars(array('category' => $category, 'expert' => $expert, 'questions' => $questions, 'qdate' => $qdate, 'disquz' => $disquz, 'disquzz' => $disquzz)); $this->view->generate(); }