function doctype() { parent::doctype(); if (QA_FINAL_EXTERNAL_USERS) { return; } // check if logged in $handle = qa_get_logged_in_handle(); if (isset($handle)) { if (qa_request() == '' && count($_GET) > 0) { // Check if we need to associate another provider $this->process_login(); } // see if the account pages are accessed $tmpl = array('account', 'favorites'); $user_pages = array('user', 'user-wall', 'user-activity', 'user-questions', 'user-answers'); $logins_page = qa_request() == 'logins' && !qa_get('confirm'); $urlhandle = qa_request_part(1); if (in_array($this->template, $tmpl) || $logins_page || in_array($this->template, $user_pages) && $handle == $urlhandle) { // add a navigation item $this->content['navigation']['sub']['logins'] = array('label' => qa_lang_html('plugin_open/my_logins_nav'), 'url' => qa_path_html('logins'), 'selected' => $logins_page); return; } } else { $title = qa_lang_html('plugin_open/login_title'); $descr = qa_lang_html('plugin_open/login_description'); // hide login/register links from navigation on any page if (qa_opt('open_login_hideform') == '1') { unset($this->content['navigation']['user']['login']); unset($this->content['navigation']['user']['register']); } // then check if login/register pages are accessed $tmpl = array('register', 'login'); if (!in_array($this->template, $tmpl)) { return; } // hide regular login/register form on those pages only if (qa_opt('open_login_hideform') == '1') { $this->content['title'] = $title; $this->content['form'] = null; } // add some custom text if (!empty($this->content['custom'])) { $content = str_ireplace('<BR>', '', $this->content['custom']); $this->content['custom'] = "<div><p>{$descr}</p>{$content}</div>"; if ($this->content['form'] != null) { $this->content['custom'] = "<br /><br /><h1>{$title}</h1>{$this->content['custom']}"; } } } }
function qa_user_permit_error($permitoption = null, $limitaction = null, $userlevel = null, $checkblocks = true) { global $wiki_enable; $permit_error = qa_user_permit_error_base($permitoption, $limitaction, $userlevel, $checkblocks); if ($permitoption == 'permit_edit_q' && $permit_error == 'level' && qa_is_logged_in()) { if (!isset($wiki_enable)) { $result = qa_db_query_sub('SELECT * FROM ^postmeta WHERE meta_key=$ AND post_id=#', 'is_community', qa_request_part(0)); $wiki_enable = $result->num_rows > 0; } if ($wiki_enable) { return false; } } return $permit_error; }
function nav($navtype, $level = null) { if (qa_opt(self::ENABLE) && qa_opt(self::REQUEST) != '') { if ($navtype == 'sub') { $request = strtolower(qa_request_part(0)); if ($request == 'account' || $request == 'favorites' || $request == qa_opt(self::REQUEST)) { //$this->content['suggest_next']=qa_lang_html_sub('misc/suggest_favorites_add', '<SPAN CLASS="qa-favorite-image"> </SPAN>'); if (!QA_FINAL_EXTERNAL_USERS) { $this->content['navigation']['sub'] = qa_account_sub_navigation(); $this->content['navigation']['sub'][qa_opt(self::REQUEST)] = array('label' => qa_lang_html(self::PLUGIN . '/' . self::PAGE_NAVI), 'url' => qa_path_html(qa_opt(self::REQUEST))); } } } } qa_html_theme_base::nav($navtype, $level = null); }
function logged_in() { if (qa_get_logged_in_userid()) { if ($this->template == "question") { $qnum = qa_request_part("0"); qa_db_query_sub("UPDATE ^userevents SET lastview = NOW() WHERE questionid = {$qnum} AND userid = " . qa_get_logged_in_userid()); } $questions = qa_db_read_all_assoc(qa_db_query_sub("SELECT DISTINCT(questionid), lastpostid FROM ^userevents WHERE lastview < updated OR lastview IS NULL")); $count = count($questions); $notifyclass = "qa-notification-none"; if ($count > 0) { $notifyclass = "qa-notification-new"; } $this->output(' <span class="qa-notification-counter ' . $notifyclass . '">' . $count . '</span> '); $this->output('<div class="qa-notification-dialog">'); foreach ($questions as $question) { $q = qa_post_get_full($question["questionid"]); $post = qa_post_get_full($question["lastpostid"]); $type = ""; if ($post["type"] == "A") { $type = "answer"; } else { if ($post["type"] == "C") { $type = "comment"; } } if ($post["userid"] == NULL) { $user = "******"; } else { $user = qa_userids_to_handles(array($post["userid"])); $user = $user[$post["userid"]]; } $this->output('<div class="qa-notification-dialog-entry">', '<a href="' . qa_q_path($question["questionid"], $q["title"]) . '">' . $q["title"] . '</a>', '<div>New ' . $type . ' by ' . $user . ': "' . substr($post["content"], 0, 100) . '"</div>', '</div>'); } $this->output('</div>'); } qa_html_theme_base::logged_in(); }
/** * save category meta data if category is updated */ function init_page() { if (qa_clicked('dosavecategory') && !qa_clicked('docancel')) { require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $categoryid = qa_post_text('edit'); if (!empty($categoryid)) { // update admin/category form to save form's category meta data $et_category['et_cat_title'] = qa_post_text('et_category_link_title'); if (!isset($et_category['et_cat_title'])) { $et_category['et_cat_title'] = ''; } $et_category['et_cat_desc'] = qa_post_text('et_category_description'); if (!isset($et_category['et_cat_desc'])) { $et_category['et_cat_desc'] = ''; } $et_category['et_cat_icon48'] = qa_post_text('et_category_icon_48'); if (!isset($et_category['et_cat_icon48'])) { $et_category['et_cat_icon48'] = ''; } $et_category['et_cat_icon64'] = qa_post_text('et_category_icon_64'); if (!isset($et_category['et_cat_icon64'])) { $et_category['et_cat_icon64'] = ''; } qa_db_categorymeta_set($categoryid, 'et_category', json_encode($et_category)); } } // when loading question page after edit if category is updated, Q2A will attempt to Re-Update question category based on "q_category_X" field. // this happens when category already exists, and we attempt to change it while editing question. // here we will set category id to "q_category_1" field, so it wont change it to null after question is updated $questionid = qa_request_part(0); $num_questionid = (int) $questionid; if (qa_clicked('q_dosave') && $questionid == $num_questionid) { $result = qa_db_read_one_assoc(qa_db_query_sub('SELECT categoryid FROM ^posts WHERE postid=$', $num_questionid), true); $_POST['q_category_1'] = $result['categoryid']; } }
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-limits.php'; $handle = qa_request_part(1); $loginuserid = qa_get_logged_in_userid(); // Check we have a handle, we're not using Q2A's single-sign on integration and that we're logged in if (QA_FINAL_EXTERNAL_USERS) { qa_fatal_error('User accounts are handled by external code'); } if (!strlen($handle)) { qa_redirect('users'); } if (!isset($loginuserid)) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_insert_login_links(qa_lang_html('misc/message_must_login'), qa_request()); return $qa_content; } // Find the user profile and questions and answers for this handle list($toaccount, $torecent, $fromrecent) = qa_db_select_with_pending(qa_db_user_account_selectspec($handle, false), qa_db_recent_messages_selectspec($loginuserid, true, $handle, false), qa_db_recent_messages_selectspec($handle, false, $loginuserid, true));
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; $ip = qa_request_part(1); // picked up from qa-page.php if (long2ip(ip2long($ip)) !== $ip) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } // Find recently (hidden, queued or not) questions, answers, comments and edits for this IP $userid = qa_get_logged_in_userid(); list($qs, $qs_queued, $qs_hidden, $a_qs, $a_queued_qs, $a_hidden_qs, $c_qs, $c_queued_qs, $c_hidden_qs, $edit_qs) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, $ip, false), qa_db_qs_selectspec($userid, 'created', 0, null, $ip, 'Q_QUEUED'), qa_db_qs_selectspec($userid, 'created', 0, null, $ip, 'Q_HIDDEN', true), qa_db_recent_a_qs_selectspec($userid, 0, null, $ip, false), qa_db_recent_a_qs_selectspec($userid, 0, null, $ip, 'A_QUEUED'), qa_db_recent_a_qs_selectspec($userid, 0, null, $ip, 'A_HIDDEN', true), qa_db_recent_c_qs_selectspec($userid, 0, null, $ip, false), qa_db_recent_c_qs_selectspec($userid, 0, null, $ip, 'C_QUEUED'), qa_db_recent_c_qs_selectspec($userid, 0, null, $ip, 'C_HIDDEN', true), qa_db_recent_edit_qs_selectspec($userid, 0, null, $ip, false)); // Check we have permission to view this page, and whether we can block or unblock IPs if (qa_user_maximum_permit_error('permit_anon_view_ips')) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_lang_html('users/no_permission'); return $qa_content; } $blockable = qa_user_level_maximum() >= QA_USER_LEVEL_MODERATOR; // allow moderator in one category to block across all categories
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-db-admin.php'; require_once QA_INCLUDE_DIR . 'qa-db-maxima.php'; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-options.php'; require_once QA_INCLUDE_DIR . 'qa-app-admin.php'; $adminsection = strtolower(qa_request_part(1)); // Get list of categories and all options $categories = qa_db_select_with_pending(qa_db_category_nav_selectspec(null, true)); // See if we need to redirect if (empty($adminsection)) { $subnav = qa_admin_sub_navigation(); if (isset($subnav[@$_COOKIE['qa_admin_last']])) { qa_redirect($_COOKIE['qa_admin_last']); } elseif (count($subnav)) { reset($subnav); qa_redirect(key($subnav)); } } // Check admin privileges (do late to allow one DB query) if (!qa_admin_check_privileges($qa_content)) { return $qa_content;
/** * Dynamic <code>CSS</code> based on options and other interaction with Q2A. * * @since Snow 1.4 * @version 1.0 * @return string The CSS code */ private function head_inline_css() { $css = array('<style>'); if (!qa_is_logged_in()) { $css[] = '.qa-nav-user { margin: 0 !important; }'; } if (qa_request_part(1) !== qa_get_logged_in_handle()) { $css[] = '@media (max-width: 979px) {'; $css[] = ' body.qa-template-user.fixed, body[class*="qa-template-user-"].fixed { padding-top: 118px !important; }'; $css[] = ' body.qa-template-users.fixed { padding-top: 95px !important; }'; $css[] = '}'; $css[] = '@media (min-width: 980px) {'; $css[] = ' body.qa-template-users.fixed { padding-top: 105px !important;}'; $css[] = '}'; } $css[] = '</style>'; $this->output_array($css); }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-updates.php'; $tag = qa_request_part(1); // picked up from qa-page.php $start = qa_get_start(); $userid = qa_get_logged_in_userid(); // Find the questions with this tag if (!strlen($tag)) { qa_redirect('tags'); } list($questions, $tagword) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec($userid, $tag, $start, false, qa_opt_if_loaded('page_size_tag_qs')), qa_db_tag_word_selectspec($tag)); $pagesize = qa_opt('page_size_tag_qs'); $questions = array_slice($questions, 0, $pagesize); $usershtml = qa_userids_handles_html($questions); // Prepare content for theme $qa_content = qa_content_prepare(true); $qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)); if (isset($userid) && isset($tagword)) {
/** * Dynamic <code>CSS</code> based on options and other interaction with Q2A. * * @since Snow 1.4 * @version 1.0 * @return string The CSS code */ private function head_inline_css() { $css = array('<style>'); if (!qa_is_logged_in()) { $css[] = '.qa-nav-user { margin: 0 !important; }'; } if (qa_request_part(1) !== qa_get_logged_in_handle()) { $css[] = '@media (max-width: 979px) {'; $css[] = ' body.qa-template-user.fixed, body[class*="qa-template-user-"].fixed { padding-top: 118px !important; }'; $css[] = ' body.qa-template-users.fixed { padding-top: 95px !important; }'; $css[] = '}'; $css[] = '@media (min-width: 980px) {'; $css[] = ' body.qa-template-users.fixed { padding-top: 105px !important;}'; $css[] = '}'; } // sidebar styles for desktop (must use server-side UA detection, not media queries) if (!qa_is_mobile_probably()) { $css[] = '.qa-sidepanel { width: 25%; padding: 0px; float: right; overflow: hidden; *zoom: 1; }'; } $css[] = '</style>'; $this->output_array($css); }
More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'app/cookies.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'util/sort.php'; require_once QA_INCLUDE_DIR . 'util/string.php'; require_once QA_INCLUDE_DIR . 'app/captcha.php'; require_once QA_INCLUDE_DIR . 'pages/question-view.php'; require_once QA_INCLUDE_DIR . 'app/updates.php'; $questionid = qa_request_part(0); $userid = qa_get_logged_in_userid(); $cookieid = qa_cookie_get(); // Get information about this question list($question, $childposts, $achildposts, $parentquestion, $closepost, $extravalue, $categories, $favorite) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid), qa_db_full_a_child_posts_selectspec($userid, $questionid), qa_db_post_parent_q_selectspec($questionid), qa_db_post_close_post_selectspec($questionid), qa_db_post_meta_selectspec($questionid, 'qa_q_extra'), qa_db_category_nav_selectspec($questionid, true, true, true), isset($userid) ? qa_db_is_favorite_selectspec($userid, QA_ENTITY_QUESTION, $questionid) : null); if ($question['basetype'] != 'Q') { // don't allow direct viewing of other types of post $question = null; } if (isset($question)) { $question['extra'] = $extravalue; $answers = qa_page_q_load_as($question, $childposts); $commentsfollows = qa_page_q_load_c_follows($question, $childposts, $achildposts); $question = $question + qa_page_q_post_rules($question, null, null, $childposts); // array union if ($question['selchildid'] && @$answers[$question['selchildid']]['type'] != 'A') {
function doctype() { if (strpos($this->request, 'user/') !== false && strpos($this->request, 'articles') !== false) { $this->request = 'user-articles'; } /* ADAPT USER PAGES AND SUBPAGES */ if ($this->template == 'user' || $this->template == 'user-wall' || $this->template == 'user-activity' || $this->template == 'user-questions' || $this->template == 'user-answers' || $this->request == 'user-articles') { $handle = qa_request_part(1); if (!strlen($handle)) { $handle = qa_get_logged_in_handle(); qa_redirect(isset($handle) ? 'user/' . $handle : 'users'); } $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle; list($useraccount, $userprofile, $userfields, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(), QA_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')), qa_db_user_points_selectspec($identifier), qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true), qa_db_category_nav_selectspec(null, true), qa_db_user_rank_selectspec($identifier)); $userid = $useraccount['userid']; $loginuserid = qa_get_logged_in_userid(); if ($this->template == 'user') { // ADAPT FORM CONTENTS /*$this->content['form_activity']['fields']['activity'] = array('type'=>'static', 'label'=>'Recent Activity', 'value'=>'<a href="'.$handle.'/activity">show</a>');*/ // ADD PRIVATE MESSAGE LINK AFTER MEMBERSHIP DURATION if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) { $this->content['form_profile']['fields']['duration']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<a href="' . qa_path_html('message/' . $handle) . '">', '^2' => '</a>')); } } $site_url = qa_opt('site_url'); // RENEW THE SUB-NAVIGATION unset($this->content['navigation']['sub']); $this->content['navigation']['sub']['account'] = array('label' => 'User ' . $handle, 'url' => $site_url . '/user/' . $handle, 'selected' => $this->template == 'user' ? 1 : 0); $this->content['navigation']['sub']['wall'] = array('label' => $handle . '\'s Wall', 'url' => $site_url . '/user/' . $handle . '/wall', 'selected' => $this->template == 'user-wall' ? 1 : 0); $this->content['navigation']['sub']['activity'] = array('label' => qa_lang('qa_blog_lang/nav_activity'), 'url' => $site_url . '/user/' . $handle . '/activity', 'selected' => $this->template == 'user-activity' ? 1 : 0); $this->content['navigation']['sub']['questions'] = array('label' => qa_lang('qa_blog_lang/nav_questions'), 'url' => $site_url . '/user/' . $handle . '/questions', 'selected' => $this->template == 'user-questions' ? 1 : 0); $this->content['navigation']['sub']['answers'] = array('label' => qa_lang('qa_blog_lang/nav_answers'), 'url' => $site_url . '/user/' . $handle . '/answers', 'selected' => $this->template == 'user-answers' ? 1 : 0); $this->content['navigation']['sub']['articles'] = array('label' => qa_lang('qa_blog_lang/nav_articles'), 'url' => $site_url . '/user/' . $handle . '/articles', 'selected' => $this->request == 'user-articles' ? 1 : 0); $this->content['navigation']['sub']['newarticles'] = array('label' => qa_lang('qa_blog_lang/new_articles'), 'url' => $site_url . '/articles', 'selected' => $this->request == 'articles' ? 1 : 0); if ($this->request == 'user-articles') { unset($this->content['title']); $this->content['title'] = qa_lang('qa_blog_lang/title_recent') . " {$handle}"; unset($this->content['suggest_next']); unset($this->content['error']); if ($this->request == 'user-articles') { $qa_content['custom'] = ""; $html = ""; $result = qa_db_query_sub("SELECT * FROM ^blog_posts WHERE userid = '{$userid}' ORDER BY posted DESC"); $i = 0; while ($article = mysqli_fetch_array($result)) { $i++; $html .= article_item($article['title'], $site_url . '/blog/' . $article['postid'] . '/' . seoUrl2($article['title']) . '/', $article['posted'], $article['views']); } if ($i == 0) { $html = "<h3>" . qa_lang('qa_blog_lang/oops') . " {$handle} " . qa_lang('qa_blog_lang/no_post') . "</h3>"; } $this->content['custom'] = $html; } } } else { if ($this->template == 'account' || $this->template == 'favorites' || $this->template == 'updates' || $this->request == 'gallery' || $this->request == 'articles') { // ADAPT FORM FOR DETAILS SUBPAGE // RENEW THE SUB-NAVIGATION unset($this->content['navigation']['sub']); $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => $this->template == 'account' ? 1 : 0); $this->content['navigation']['sub']['favorites'] = array('label' => 'My Favorites', 'url' => './favorites', 'selected' => $this->template == 'favorites' ? 1 : 0); $this->content['navigation']['sub']['updates'] = array('label' => 'My Updates', 'url' => './updates', 'selected' => $this->template == 'updates' ? 1 : 0); $this->content['navigation']['sub']['articles'] = array('label' => 'My Articles', 'url' => './articles', 'selected' => $this->request == 'articles' ? 1 : 0); } else { if ($this->template == 'users') { require_once QA_INCLUDE_DIR . 'qa-db-users.php'; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; $start = qa_get_start(); $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users'))); $usercount = qa_opt('cache_userpointscount'); $pagesize = qa_opt('page_size_users'); $users = array_slice($users, 0, $pagesize); $usershtml = qa_userids_handles_html($users); // CHANGE TITLE $this->content['title'] = 'Users'; $this->content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users'); if (count($users)) { foreach ($users as $userid => $user) { $this->content['ranking']['items'][] = array('label' => (QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true)) . ' ' . $usershtml[$user['userid']], 'score' => qa_html(number_format($user['points']))); } } else { $this->content['title'] = qa_lang_html('main/no_active_users'); } $this->content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next')); // EMPTY SUB-NAVIGATION $this->content['navigation']['sub'] = null; } } } if ($this->template == 'questions') { unset($this->content['navigation']['sub']); $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => 0); //print_r ($this->content['navigation']); } if ($this->request == 'login') { $this->content['form']['fields']['password']['note'] = '<a href="/forgot">I forgot my password</a> - <a href="/register">Register</a>'; } qa_html_theme_base::doctype(); }
public function navigation($themeclass) { $link = array('label' => qa_lang_html('notification/notf_settings_user_nav'), 'url' => qa_path_html('notification-settings'), 'icon' => 'icon-cog'); if (qa_is_logged_in()) { $themeclass['navigation']['user']['notification-settings'] = $link; if (qa_request_part(0) == 'notification-settings') { $themeclass['navigation']['user']['notification-settings']['selected'] = true; } } $handle = qa_request_part(1); if (qa_is_logged_in() && ($handle === qa_get_logged_in_handle() || qa_request_part(0) == 'notification-settings')) { $themeclass['navigation']['sub']['notification-settings'] = $link; if (qa_request_part(0) == 'notification-settings') { $themeclass['navigation']['sub']['notification-settings']['selected'] = true; } } return $themeclass; }
function main() { $content = $this->content; $class = 'main'; if ($this->template == 'admin' && qa_opt('cs_nav_position') == 'top') { $this->nav('sub'); } $this->output('<div class="clearfix qa-main' . (@$this->content['hidden'] ? ' qa-main-hidden' : '') . '">'); $col_width = $this->cs_position_active('Right') && $this->template != 'question'; $this->output('<div class="col-sm-' . ($col_width ? '8' : '12') . ' list-c">'); if ($this->template != 'user-answers' && $this->template != 'user-questions' && $this->template != 'user-activity' && $this->template != 'user-wall' && $this->template != 'question' && $this->template != 'user' && !strlen(qa_request(1)) == 0 && !empty($this->content['title'])) { $this->output('<h1 class="page-title">', $this->content['title']); $this->feed(); $this->favorite(); $this->output('</h1>'); } if ($this->cs_position_active('Header')) { $this->output('<div class="header-position-c clearfix">'); $this->output('<h1 class="intro-title"> ' . qa_lang_html('cleanstrap/got_questions') . '</h1>'); if ($this->cs_position_active('Header Left')) { $this->output('<div class="col-md-' . $class . '">'); $this->cs_position('Header Left'); $this->output('</div>'); } if ($this->cs_position_active('Header')) { $this->output('<div class="col-md-' . (12 - @$class) . '">'); $this->cs_position('Header'); $this->output('</div>'); } if ($this->cs_position_active('Header Right')) { $this->output('<div class="col-md-' . $class . '">'); $this->cs_position('Header Right'); $this->output('</div>'); } $this->output('</div>'); } if ($this->template != 'question') { $this->cs_position('Content Top'); } if (isset($this->content['error'])) { $this->error(@$this->content['error']); } if ($this->template == 'user' && !(isset($_REQUEST['state']) && $_REQUEST['state'] == 'edit')) { $this->profile_page(); } elseif (strlen(qa_request(1)) == 0) { $this->home($content); } elseif ($this->template == 'question') { $this->question_view($content); } elseif ($this->template == 'user-wall') { $handle = qa_request_part(1); $this->output('<section id="content" class="content-sidebar user-cols">'); $this->cs_user_nav($handle); $this->output('<div class="messages">'); $this->message_list_and_form($this->content['message_list']); $this->output('</div></section>'); } elseif ($this->template == 'user' && (isset($_REQUEST['state']) && $_REQUEST['state'] == 'edit')) { $handle = qa_request_part(1); if (!strlen($handle)) { $handle = qa_get_logged_in_handle(); } $this->output('<section id="content" class="content-sidebar user-cols">'); $this->cs_user_nav($handle); $this->main_parts($content); $this->output('</section>'); } elseif ($this->template == 'account' || $this->template == 'favorites' || $this->template == 'user-activity' || $this->template == 'user-questions' || $this->template == 'user-answers') { $handle = qa_request_part(1); if (!strlen($handle)) { $handle = qa_get_logged_in_handle(); } $this->output('<section id="content" class="content-sidebar user-cols">'); $this->cs_user_nav($handle); $this->main_parts($content); $this->output('</section>'); } else { if ($this->template != 'admin') { $this->nav('sub'); } $this->main_parts($content); if ($this->template != 'question') { $this->page_links(); } $this->suggest_next(); } $this->cs_position('Content Bottom'); $this->output('</div>'); if ($col_width) { $this->sidepanel(); } $this->output('</div>'); $this->cs_position('Bottom'); $this->footer(); }
More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/users.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; require_once QA_INCLUDE_DIR . 'app/limits.php'; $loginUserId = qa_get_logged_in_userid(); $loginUserHandle = qa_get_logged_in_handle(); // Check which box we're showing (inbox/sent), we're not using Q2A's single-sign on integration and that we're logged in $req = qa_request_part(1); if ($req === null) { $showOutbox = false; } elseif ($req === 'sent') { $showOutbox = true; } else { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } if (QA_FINAL_EXTERNAL_USERS) { qa_fatal_error('User accounts are handled by external code'); } if (!isset($loginUserId)) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_insert_login_links(qa_lang_html('misc/message_must_login'), qa_request()); return $qa_content; }
public function process_request($request) { $qa_content = qa_content_prepare(); $category_1 = qa_opt('qa_blog_cat_1'); $category_2 = qa_opt('qa_blog_cat_2'); $category_3 = qa_opt('qa_blog_cat_3'); $category_4 = qa_opt('qa_blog_cat_4'); $category_5 = qa_opt('qa_blog_cat_5'); $html = ""; $postid = qa_request_part(1); if (isset($postid)) { $result = qa_db_query_sub('SELECT * FROM ^blog_posts WHERE `postid` LIKE #', $postid); if ($row = mysqli_fetch_array($result)) { $userid = $row['userid']; $author = handleLinkForID($row['userid']); $editor = qa_get_logged_in_userid(); if ($userid >= $editor) { if (qa_clicked('doedit')) { $in = array(); qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']); $in['title'] = qa_post_text('title'); $in['category'] = qa_post_text('category'); if (strlen($in['title']) < 10 || strlen($in['content']) < 50 || $in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') { if (strlen($in['title']) < 10) { $errors['title'] = qa_lang('qa_blog_lang/error_title'); } if (strlen($in['content']) < 50) { $errors['content'] = qa_lang('qa_blog_lang/error_content'); } if ($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') { $errors['type'] = 'Invalid category'; } } else { $type = 0; if ($in['category'] === 'cat_1') { $type = 1; } else { if ($in['category'] === 'cat_2') { $type = 2; } else { if ($in['category'] === 'cat_3') { $type = 3; } else { if ($in['category'] === 'cat_4') { $type = 4; } else { if ($in['category'] === 'cat_5') { $type = 5; } } } } } $result = qa_db_query_sub('UPDATE ^blog_posts SET updated=NOW(), title=$, content=$, type=#, format=$ WHERE postid=#', $in['title'], $in['content'], $type, 'markdown', $postid); header('location:' . qa_path_to_root() . '/blog/' . $postid); } } else { if (qa_clicked('doresetoptions')) { $in = array(); qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']); $in['title'] = qa_post_text('title'); $in['category'] = qa_post_text('category'); if (strlen($in['title']) < 10 || strlen($in['content']) < 50 || $in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') { if (strlen($in['title']) < 10) { $errors['title'] = qa_lang('qa_blog_lang/error_title'); } if (strlen($in['content']) < 50) { $errors['content'] = qa_lang('qa_blog_lang/error_content'); } if ($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') { $errors['type'] = 'Invalid category'; } } else { $type = 0; if ($in['category'] === 'cat_1') { $type = 1; } else { if ($in['category'] === 'cat_2') { $type = 2; } else { if ($in['category'] === 'cat_3') { $type = 3; } else { if ($in['category'] === 'cat_4') { $type = 4; } else { if ($in['category'] === 'cat_5') { $type = 5; } } } } } $result = qa_db_query_sub('UPDATE ^blog_posts SET updated=NOW(), title=$, content=$, type=#, format=$ WHERE postid=#', $in['title'], $in['content'], $type, 'draft', $postid); header('location:' . qa_path_to_root() . '/blog/' . $postid); } } else { if (qa_clicked('dogoback')) { qa_redirect('blog'); } else { if (qa_clicked('dosaveoptions')) { qa_redirect('blog'); } else { if (qa_clicked('docancel')) { qa_redirect('blog'); } } } } } } $qa_content['title'] = 'Editing: ' . $row['title']; $userpostslink = '/user/' . qa_get_logged_in_handle() . '/articles'; $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_qs'); $editor = qa_load_editor(@$in['content'], @$in['format'], $editorname); $field = qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'content', 12, false); $typeoptions = array('cat_1' => $category_1, 'cat_2' => $category_2, 'cat_3' => $category_3, 'cat_4' => $category_4, 'cat_5' => $category_5); $qa_content['form'] = array('tags' => 'name="edit" method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('title' => array('label' => qa_lang('qa_blog_lang/post_title'), 'tags' => 'name="title" id="title" autocomplete="off"', 'value' => $row['title'], 'rows' => 2, 'error' => qa_html(@$errors['title'])), 'category' => array('label' => qa_lang('qa_blog_lang/post_cat'), 'type' => 'select', 'tags' => 'name="category"', 'options' => $typeoptions, 'error' => qa_html(@$errors['type'])), 'similar' => array('type' => 'custom', 'html' => '<span id="similar"></span>'), 'content' => array('value' => $row['content'], 'tags' => 'name="content"', 'error' => qa_html(@$errors['content']), 'rows' => 4)), 'buttons' => array('edit' => array('tags' => 'onclick="qa_show_waiting_after(this, false); ' . (method_exists($editor, 'update_script') ? $editor->update_script('content') : '') . '"', 'label' => qa_lang('qa_blog_lang/update_button')), 'save' => array('tags' => 'name="doresetoptions"', 'label' => qa_lang('qa_blog_lang/draft_button')), 'hide' => array('tags' => 'name="dosaveoptions"', 'label' => qa_lang('qa_blog_lang/hide_button')), 'goback' => array('tags' => 'name="dogoback"', 'label' => qa_lang('qa_blog_lang/cancel_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang('qa_blog_lang/delete_button'))), 'hidden' => array('editor' => qa_html($editorname), 'code' => qa_get_form_security_code('article'), 'doedit' => '1')); $html = "<h2>" . qa_lang('qa_blog_lang/past_post') . "</h2>"; $userid = qa_get_logged_in_userid(); $result = qa_db_query_sub("SELECT * FROM ^blog_posts WHERE userid = '{$userid}' ORDER BY posted DESC"); $i = 0; while ($blob = mysqli_fetch_array($result)) { $i++; $html .= '<ul><li><h3><a href="blog/' . $blob['postid'] . '/' . seoUrl3($blob['title']) . '">' . $blob['title'] . '</a><h3></li></ul>'; } if ($i == 0) { $html .= qa_lang('qa_blog_lang/post_null'); } $html .= ''; $qa_content['custom2'] = $html; } else { $site_url = qa_opt('site_url'); $qa_content['title'] = qa_lang('qa_blog_lang/title_error'); $qa_content['error'] = qa_lang('qa_blog_lang/edit_error') . '<a href=' . $site_url . '/blog/> ' . qa_lang('qa_blog_lang/edit_error1') . '</a>'; $qa_content['custom2'] = qa_lang('qa_blog_lang/edit_note'); } return $qa_content; } }
// don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; require_once QA_INCLUDE_DIR . 'app/favorites.php'; // Data for functions to run $favswitch = array('questions' => array('page_opt' => 'page_size_qs', 'fn_spec' => 'qa_db_user_favorite_qs_selectspec', 'fn_view' => 'qa_favorite_q_list_view', 'key' => 'q_list'), 'users' => array('page_opt' => 'page_size_users', 'fn_spec' => 'qa_db_user_favorite_users_selectspec', 'fn_view' => 'qa_favorite_users_view', 'key' => 'ranking_users'), 'tags' => array('page_opt' => 'page_size_tags', 'fn_spec' => 'qa_db_user_favorite_tags_selectspec', 'fn_view' => 'qa_favorite_tags_view', 'key' => 'ranking_tags')); // Check that we're logged in $userid = qa_get_logged_in_userid(); if (!isset($userid)) { qa_redirect('login'); } // Get lists of favorites of this type $favtype = qa_request_part(1); $start = qa_get_start(); if (!array_key_exists($favtype, $favswitch) || $favtype === 'users' && QA_FINAL_EXTERNAL_USERS) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } extract($favswitch[$favtype]); // get switch variables $pagesize = qa_opt($page_opt); list($totalItems, $items) = qa_db_select_with_pending(qa_db_selectspec_count($fn_spec($userid)), $fn_spec($userid, $pagesize, $start)); $count = $totalItems['count']; $usershtml = qa_userids_handles_html($items); // Prepare and return content for theme $qa_content = qa_content_prepare(true); $qa_content['title'] = qa_lang_html('misc/my_favorites_title'); $qa_content[$key] = $fn_view($items, $usershtml); // Sub navigation for account pages and suggestion
/** * Checks if the user is allowed to be shown cache. * Only non-registered users see the cached version. * @return boolean */ public function now_caching() { if (!QA_CACHING_STATUS) { return false; } if (qa_get_logged_in_userid()) { return false; } if (qa_request_part(0) == 'admin') { return false; } $requests = QA_CACHING_EXCLUDED_REQUESTS; if (!empty($requests)) { $requests = explode(',', str_replace(array("\r\n", "\r", "\n"), '', $requests)); } else { $requests = array(); } if (in_array(qa_request(), $requests)) { return false; } return true; }
public function process_request($request) { $category_1 = qa_opt('qa_blog_cat_1'); $category_2 = qa_opt('qa_blog_cat_2'); $category_3 = qa_opt('qa_blog_cat_3'); $category_4 = qa_opt('qa_blog_cat_4'); $category_5 = qa_opt('qa_blog_cat_5'); $qa_content = qa_content_prepare(); $cat = -1; if (isset($_GET['category'])) { $cat = $_GET['category']; } $qa_content['navigation']['sub'] = array(); $qa_content['navigation']['sub']['all'] = array('label' => qa_lang('qa_blog_lang/nav_all'), 'url' => qa_path_to_root() . '/blog', 'selected' => isset($_GET['category']) ? 0 : 1); $qa_content['navigation']['sub']['cat1'] = array('label' => $category_1, 'url' => qa_path_to_root() . '/blog?category=1', 'selected' => $cat == 1 ? 1 : 0); $qa_content['navigation']['sub']['cat2'] = array('label' => $category_2, 'url' => qa_path_to_root() . '/blog?category=2', 'selected' => $cat == 2 ? 1 : 0); $qa_content['navigation']['sub']['cat3'] = array('label' => $category_3, 'url' => qa_path_to_root() . '/blog?category=3', 'selected' => $cat == 3 ? 1 : 0); $qa_content['navigation']['sub']['cat4'] = array('label' => $category_4, 'url' => qa_path_to_root() . '/blog?category=4', 'selected' => $cat == 4 ? 1 : 0); $qa_content['navigation']['sub']['cat5'] = array('label' => $category_5, 'url' => qa_path_to_root() . '/blog?category=5', 'selected' => $cat == 5 ? 1 : 0); $qa_content['navigation']['sub']['post'] = array('label' => qa_lang('qa_blog_lang/nav_post'), 'url' => qa_path_to_root() . '/articles'); $qa_content['title'] = qa_opt('qa_blog_title'); $postid = qa_request_part(1); if (isset($postid)) { $result = qa_db_query_sub('SELECT * FROM ^blog_posts WHERE `postid` LIKE #', $postid); if ($row = mysqli_fetch_array($result)) { qa_db_query_sub('UPDATE ^blog_posts SET Views = Views + 1 WHERE `postid` LIKE #', $postid); $qa_content['title'] = $row['title']; $qa_content['custom'] = ""; $html = qa_viewer_html($row['content'], $row['format'], array('showurllinks' => 1)); $strviews = qa_lang('qa_blog_lang/post_views'); $views = $row['views']; if ($row['views'] == 1) { $strviews = qa_lang('qa_blog_lang/post_views'); } $author = handleLinkForID($row['userid']); if ($row['userid'] == 0) { $author = qa_lang('qa_blog_lang/userid_null'); } $user = $row['userid']; $date = $row['posted']; $date = new DateTime($date); $on = $date->format('Y.m.d'); $at = $date->format('H:i'); $parentid = $postid; $result = qa_db_query_sub("SELECT COUNT(*) as total FROM ^blog_comments WHERE `parentid` LIKE #", $parentid); $countdata = mysqli_fetch_assoc($result); $count = $countdata['total']; $delete = "<a href='" . qa_path_to_root() . "/edit/" . $postid . "'/>\n\t\t\t<img src='" . qa_opt('site_url') . "qa-plugin/blog-post/images/delete.png'> Delete </a>"; $edit = "<a href='" . qa_path_to_root() . "/edit/" . $postid . "'/>\n\t\t\t<img src='" . qa_opt('site_url') . "qa-plugin/blog-post/images/edit.png'> Edit </a>"; $flag = "<a href='#'/>\n\t\t\t<img src='" . qa_opt('site_url') . "qa-plugin/blog-post/images/edit.png'> Flag </a>"; $comments = qa_lang('qa_blog_lang/post_comments'); $queryName = qa_db_read_one_assoc(qa_db_query_sub('SELECT content FROM `^userprofile` WHERE `userid`=' . $user . ' AND title="name" LIMIT 0,#;', $user), true); $name = isset($queryName['content']) && trim($queryName['content']) != '' ? $queryName['content'] : $author; $result = qa_db_query_sub('SELECT * FROM ^users WHERE userid=#', $user); if ($row = mysqli_fetch_array($result)) { $fullname = '<a href="/user/' . $row['handle'] . '">' . $name . '</a>'; } if (qa_is_logged_in()) { $html .= "<hr>\n\t\t\t\t\t<span style='float:left;padding-left:10px'>\n\t\t\t\t\t" . qa_lang('qa_blog_lang/posted_by') . " " . $fullname . " " . qa_lang('qa_blog_lang/on') . "\n\t\t\t\t\t" . $on . " " . qa_lang('qa_blog_lang/at') . " " . $at . "</span>\n\t\t\t\t\t<span style='float:right;padding-right:10px;'>\n\t\t\t\t\t" . $edit . " . " . $delete . " |\n\t\t\t\t\t<img src='" . qa_path_to_root() . "/qa-plugin/blog-post/images/comment.png'>" . $count . " " . $comments . "\n\t\t\t\t\t<img src='" . qa_path_to_root() . "/qa-plugin/blog-post/images/hits.jpg'>" . $views . " " . $strviews . "</span>\n\t\t\t\t\t<br>"; } else { $html .= "<hr>\n\t\t\t\t\t<span style='float:left;padding-left:10px'>\n\t\t\t\t\t" . qa_lang('qa_blog_lang/posted_by') . " " . $fullname . " " . qa_lang('qa_blog_lang/on') . "\n\t\t\t\t\t" . $on . " " . qa_lang('qa_blog_lang/at') . " " . $at . "</span>\n\t\t\t\t\t<span style='float:right;padding-right:10px;'>" . $count . " " . $comments . " | " . $row['views'] . " " . $strviews . "</span>\n\t\t\t\t\t<br>"; } # $html .= "<h2>Comments features is not available in free version</h2>"; $parentid = qa_request_part(1); $result = qa_db_query_sub("SELECT * FROM ^blog_comments WHERE parentid = '{$parentid}' "); $i = 0; while ($blob = mysqli_fetch_array($result)) { $i++; $html .= "<p> " . $blob['comment'] . "</span><br>" . qa_lang('qa_blog_lang/comment') . "\n\t\t\t\t\t" . $author . " " . qa_lang('qa_blog_lang/on') . " " . $on . " " . qa_lang('qa_blog_lang/at') . "\n\t\t\t\t\t" . $at . "</p>"; } if ($i == 0) { $html .= '<h3>No Comments yet</h3>'; } } else { $html = qa_lang('qa_blog_lang/post_null'); } } else { $cat = -1; if (isset($_GET['category'])) { $cat = $_GET['category']; } $qa_content['navigation']['sub'] = array(); $qa_content['navigation']['sub']['all'] = array('label' => qa_lang('qa_blog_lang/nav_all'), 'url' => './blog', 'selected' => isset($_GET['category']) ? 0 : 1); $qa_content['navigation']['sub']['cat1'] = array('label' => $category_1, 'url' => './blog?category=1', 'selected' => $cat == 1 ? 1 : 0); $qa_content['navigation']['sub']['cat2'] = array('label' => $category_2, 'url' => './blog?category=2', 'selected' => $cat == 2 ? 1 : 0); $qa_content['navigation']['sub']['cat3'] = array('label' => $category_3, 'url' => './blog?category=3', 'selected' => $cat == 3 ? 1 : 0); $qa_content['navigation']['sub']['cat4'] = array('label' => $category_4, 'url' => './blog?category=4', 'selected' => $cat == 4 ? 1 : 0); $qa_content['navigation']['sub']['cat5'] = array('label' => $category_5, 'url' => './blog?category=5', 'selected' => $cat == 5 ? 1 : 0); $qa_content['navigation']['sub']['post'] = array('label' => qa_lang('qa_blog_lang/nav_post'), 'url' => './articles'); $html = qa_opt('qa_blog_tagline') . '<hr>'; $page = 1; if (isset($_GET['page'])) { $page = $_GET['page']; } $limit = 10; if (isset($_GET['category'])) { $result = qa_db_query_sub("SELECT * FROM ^blog_posts WHERE type=# and format='markdown'\n\t\tORDER BY posted DESC LIMIT #,#", $cat, ($page - 1) * $limit, $limit); } else { $result = qa_db_query_sub("SELECT * FROM ^blog_posts WHERE format='markdown' ORDER BY posted DESC LIMIT #,#", ($page - 1) * $limit, $limit); } $i = 0; while ($article = mysqli_fetch_array($result)) { $i++; $author = $article['userid']; if ($article['userid'] == 0) { $author = qa_lang('qa_blog_lang/userid_null'); } $html .= article_item_with_author($article['title'], '' . qa_path_to_root() . '/blog/' . $article['postid'] . '/' . seoUrl($article['title']) . '/', $article['content'], $author, $article['posted'], $article['views'], $article['type'], $article['postid']); } if ($i == 0) { $html = "<h4>" . qa_lang('qa_blog_lang/posts_null') . "</h4>"; } else { if (isset($_GET['category'])) { $result = qa_db_query_sub("SELECT COUNT(*) as total FROM ^blog_posts WHERE type=#", $cat); } else { $result = qa_db_query_sub("SELECT COUNT(*) as total FROM ^blog_posts"); } $countdata = mysqli_fetch_assoc($result); $count = $countdata['total']; if ($count / $limit > 1) { $html .= '<br><br><div class="qa-page-links"> <span class="qa-page-links-label">Page: </span><ul class="qa-page-links-list">'; if ($page > 1) { $html .= '<li class="qa-page-links-item"> <a href="./questions?page=' . ($page - 1) . '" class="qa-page-prev">« prev</a> </li>'; } for ($i = 0; $i < $count / $limit; $i++) { if ($page - 1 == $i) { $html .= '<li class="qa-page-links-item"><span class="qa-page-selected">' . ($i + 1) . '</span></li>'; } else { $html .= '<li class="qa-page-links-item"><a href="./blog?page=' . ($i + 1) . '" class="qa-page-link">' . ($i + 1) . '</a></li>'; } } if ($page < $count / $limit) { $html .= '<li class="qa-page-links-item"> <a href="./blog?page=' . ($page + 1) . '" class="qa-page-next">next »</a> </li></ul></div>'; } else { $html .= '</ul></div>'; } } } $this->content['custom'] = $html; } $qa_content['custom'] = $html; //print_r($qa_content['site_title']); return $qa_content; }
/** * Clear cache. */ private function should_clear_caching() { if ($this->is_logged_in) { if (qa_request_part(0) == 'admin') { if ($_SERVER["REQUEST_METHOD"] == 'POST' || $_SERVER["REQUEST_METHOD"] == 'PUT') { return true; } } } return false; }
$handle = qa_get_logged_in_handle(); qa_redirect(isset($handle) ? 'user/' . $handle : 'users'); } // Get the HTML to display for the handle, and if we're using external users, determine the userid if (QA_FINAL_EXTERNAL_USERS) { $userid = qa_handle_to_userid($handle); if (!isset($userid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $usershtml = qa_get_users_html(array($userid), false, qa_path_to_root(), true); $userhtml = @$usershtml[$userid]; } else { $userhtml = qa_html($handle); } // Display the appropriate page based on the request switch (qa_request_part(2)) { case 'wall': qa_set_template('user-wall'); $qa_content = (include QA_INCLUDE_DIR . 'pages/user-wall.php'); break; case 'activity': qa_set_template('user-activity'); $qa_content = (include QA_INCLUDE_DIR . 'pages/user-activity.php'); break; case 'questions': qa_set_template('user-questions'); $qa_content = (include QA_INCLUDE_DIR . 'pages/user-questions.php'); break; case 'answers': qa_set_template('user-answers'); $qa_content = (include QA_INCLUDE_DIR . 'pages/user-answers.php');