本文整理汇总了PHP中qa_get_logged_in_level函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_get_logged_in_level函数的具体用法?PHP qa_get_logged_in_level怎么用?PHP qa_get_logged_in_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_get_logged_in_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_request
function process_request($request)
{
// double check we are admin
if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
return;
}
if (qa_clicked('docancel')) {
qa_redirect('admin/plugins');
}
$qa_content = qa_content_prepare();
$qa_content['title'] = 'Widget Anywhere';
$qa_content['custom'] = '<p><a href="' . qa_path('admin/plugins') . '#' . qa_html($this->anchor) . '">« back to plugin options</a></p>';
$saved_msg = null;
$editid = qa_get('editid');
if (qa_post_text('dodelete')) {
$this->delete_widget();
qa_redirect('admin/plugins');
} else {
if (qa_clicked('save_button')) {
// save widget
$widget = $this->save_widget();
$saved_msg = 'Widget saved.';
} else {
if (empty($editid)) {
// display blank form
$widget = array('id' => 0, 'title' => '', 'pages' => '', 'position' => '', 'ordering' => 1, 'content' => '');
} else {
// load specified widget
$sql = 'SELECT * FROM ^' . $this->pluginkey . ' WHERE id=#';
$result = qa_db_query_sub($sql, $editid);
$widget = qa_db_read_one_assoc($result);
}
}
}
$sel_position = empty($widget['position']) ? null : @$this->positionlangs[$widget['position']];
// set up page (template) list
$widget_pages = explode(',', $widget['pages']);
$sel_pages = array();
$custom_pages = array();
foreach ($widget_pages as $page) {
if (strpos($page, 'custom:') === 0) {
$custom_pages[] = substr($page, 7);
} else {
$sel_pages[] = $page;
}
}
// $chkd = in_array('all', $sel_pages) ? 'checked' : '';
// $pages_html = '<label><input type="checkbox" name="wpages_all" ' . $chkd . '> ' . qa_lang_html('admin/widget_all_pages') . '</label><br><br>';
$pages_html = '';
foreach ($this->templatelangkeys as $tmpl => $langkey) {
$chkd = in_array($tmpl, $sel_pages) ? 'checked' : '';
$pages_html .= '<label><input type="checkbox" name="wpages_' . $tmpl . '" ' . $chkd . '> ' . qa_lang_html($langkey) . '</label><br>';
}
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'ok' => $saved_msg, 'fields' => array('title' => array('label' => 'Title', 'tags' => 'NAME="wtitle"', 'value' => qa_html($widget['title'])), 'position' => array('type' => 'select', 'label' => 'Position', 'tags' => 'NAME="wposition"', 'options' => $this->positionlangs, 'value' => $sel_position), 'all_pages' => array('type' => 'checkbox', 'id' => 'tb_pages_all', 'label' => qa_lang_html('admin/widget_all_pages'), 'tags' => 'NAME="wpages_all" ID="wpages_all"', 'value' => in_array('all', $sel_pages)), 'pages' => array('type' => 'custom', 'id' => 'tb_pages_list', 'label' => qa_lang_html('admin/widget_pages_explanation'), 'html' => $pages_html), 'show_custom_pages' => array('type' => 'checkbox', 'id' => 'tb_show_custom_pages', 'label' => 'Show on custom page(s)', 'tags' => 'NAME="cb_custom_pages" ID="cb_custom_pages"', 'value' => count($custom_pages) > 0), 'custom_pages' => array('id' => 'tb_custom_pages', 'label' => 'Page slugs', 'tags' => 'NAME="wpages_custom"', 'value' => qa_html(implode(',', $custom_pages)), 'note' => 'Separate multiple page slugs (URL fragments) with commas, e.g. <code>custom-page,other-page</code>'), 'ordering' => array('type' => 'number', 'label' => 'Order', 'tags' => 'NAME="wordering"', 'value' => qa_html($widget['ordering'])), 'content' => array('type' => 'textarea', 'label' => 'Content (HTML)', 'tags' => 'NAME="wcontent"', 'value' => qa_html($widget['content']), 'rows' => 12)), 'hidden' => array('wid' => $widget['id']), 'buttons' => array('save' => array('tags' => 'NAME="save_button"', 'label' => 'Save widget', 'value' => '1'), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'))));
if ($widget['id'] > 0) {
$qa_content['form']['fields']['delete'] = array('tags' => 'NAME="dodelete"', 'label' => 'Delete widget', 'value' => 0, 'type' => 'checkbox');
}
qa_set_display_rules($qa_content, array('tb_pages_list' => '!wpages_all', 'tb_show_custom_pages' => '!wpages_all', 'tb_custom_pages' => 'cb_custom_pages && !wpages_all'));
return $qa_content;
}
示例2: qa_permit_check
function qa_permit_check($opt)
{
if (qa_opt($opt) == QA_PERMIT_POINTS) {
return qa_get_logged_in_points() >= qa_opt($opt . '_points');
}
return !qa_permit_value_error(qa_opt($opt), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags());
}
示例3: cs_ajax_delete_widget
function cs_ajax_delete_widget()
{
if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
$id = strip_tags($_REQUEST['id']);
widget_opt_delete($id);
}
die;
}
示例4: isManager
/**
*判断是否为超级管理员
*/
function isManager()
{
if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
return true;
} else {
return false;
}
}
示例5: forbid_new_tag
function forbid_new_tag()
{
$q_edit = $this->template == 'ask' || isset($this->content['form_q_edit']);
$tag_prevent = qa_opt('tag_synonyms_prevent');
if ($q_edit && $tag_prevent) {
return qa_get_logged_in_points() < (int) qa_opt('tag_synonyms_rep') && qa_get_logged_in_level() < QA_USER_LEVEL_EXPERT;
}
return false;
}
示例6: donut_admin_sub_navigation
/**
* Adds few more links in the admin subnavigation
*
* @return array
*/
function donut_admin_sub_navigation()
{
$navigation = array();
$level = qa_get_logged_in_level();
if ($level >= QA_USER_LEVEL_ADMIN) {
$url = 'admin/donut-theme/general-settings';
$navigation[$url] = array('label' => donut_lang('donut_theme_settings'), 'url' => qa_path_html($url));
}
return $navigation;
}
示例7: head_custom
function head_custom()
{
qa_html_theme_base::head_custom();
if (!qa_opt('badge_active')) {
return;
}
if ($this->request == 'admin/plugins' && qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
$this->output("\n\t\t\t\t<script>" . (qa_opt('badge_notify_time') != '0' ? "\n\t\t\t\t\tjQuery('document').ready(function() { jQuery('.notify-container').delay(" . (int) qa_opt('badge_notify_time') * 1000 . ").slideUp('fast'); });" : "") . "\n\t\t\t\t\tfunction badgeEdit(slug,end) {\n\t\t\t\t\t\tif(end) {\n\t\t\t\t\t\t\tjQuery('#badge_'+slug+'_edit').hide();\n\t\t\t\t\t\t\tjQuery('#badge_'+slug+'_badge').show();\n\t\t\t\t\t\t\tjQuery('#badge_'+slug+'_badge').html(jQuery('#badge_'+slug+'_edit').val());\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjQuery('#badge_'+slug+'_badge').hide();\n\t\t\t\t\t\tjQuery('#badge_'+slug+'_edit').show();\n\t\t\t\t\t\tjQuery('#badge_'+slug+'_edit').focus();\n\t\t\t\t\t}\n\t\t\t\t</script>");
}
$this->output('<style>', qa_opt('badges_css'), '</style>');
}
示例8: mp_announcements_sub_navigation
function mp_announcements_sub_navigation()
{
$level = qa_get_logged_in_level();
$navigation = array();
if ($level >= QA_USER_LEVEL_EDITOR) {
$navigation = array('default' => array('url' => qa_path_html('mp-announcements-page'), 'label' => qa_lang_html('announcements/link_all')), 'create' => array('url' => qa_path_html('mp-announcements-create-page'), 'label' => qa_lang_html('announcements/link_create')));
} else {
$navigation = array('default' => array('url' => qa_path_html('mp-announcements-page'), 'label' => qa_lang_html('announcements/link_all')));
}
return $navigation;
}
示例9: q_view_clear
function q_view_clear()
{
// call default method output
qa_html_theme_base::q_view_clear();
// return if not admin!
if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
return;
}
// check if question is duplicate
$closed = @$this->content['q_view']['raw']['closedbyid'] !== null;
if ($closed) {
// check if duplicate
$duplicate = qa_db_read_one_value(qa_db_query_sub('SELECT postid FROM `^posts`
WHERE `postid` = #
AND `type` = "Q"
;', $this->content['q_view']['raw']['closedbyid']), true);
if ($duplicate) {
$this->output('<div id="mergeDup" style="margin:10px 0 0 120px;padding:5px 10px;background:#FCC;border:1px solid #AAA;"><h3>Merge Duplicate:</h3>');
// form output
$this->output('
<FORM METHOD="POST">
<TABLE>
<TR>
<TD CLASS="qa-form-tall-label">
From:
<INPUT NAME="merge_from" id="merge_from" TYPE="text" VALUE="' . $this->content['q_view']['raw']['postid'] . '" CLASS="qa-form-tall-number">
To:
<INPUT NAME="merge_to" id="merge_to" TYPE="text" VALUE="' . $this->content['q_view']['raw']['closedbyid'] . '" CLASS="qa-form-tall-number">
</TD>
</TR>
<TR>
<TD CLASS="qa-form-tall-label">
Text to show when redirecting from merged question:
</TD>
</TR>
<TR>
<TD CLASS="qa-form-tall-label">
<INPUT NAME="merge_question_merged" id="merge_question_merged" TYPE="text" VALUE="' . qa_opt('merge_question_merged') . '" CLASS="qa-form-tall-text">
</TD>
</TR>
<TR>
<TD style="text-align:right;">
<INPUT NAME="merge_question_process" VALUE="Merge" TITLE="" TYPE="submit" CLASS="qa-form-tall-button qa-form-tall-button-0">
</TD>
</TR>
</TABLE>
</FORM> ');
$this->output('</div>');
}
}
}
示例10: qa_page_q_post_rules
function qa_page_q_post_rules($post, $parentpost = null, $siblingposts = null, $childposts = null)
{
$rules = qa_page_q_post_rules_base($post, $parentpost, $siblingposts, $childposts);
qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^postmeta (
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
post_id bigint(20) unsigned NOT NULL,
meta_key varchar(255) DEFAULT \'\',
meta_value longtext,
PRIMARY KEY (meta_id),
KEY post_id (post_id),
KEY meta_key (meta_key)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
$expert = qa_db_read_one_value(qa_db_query_sub("SELECT meta_value FROM ^postmeta WHERE meta_key='is_expert_question' AND post_id=#", $post['postid']), true);
if ($expert) {
if (!qa_permit_value_error(qa_opt('expert_question_roles'), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags())) {
$is_expert = true;
}
$users = qa_opt('expert_question_users');
$users = explode("\n", $users);
$handle = qa_get_logged_in_handle();
foreach ($users as $idx => $user) {
if ($user == $handle) {
$is_expert = true;
break;
}
if (strpos($user, '=')) {
$user = explode('=', $user);
if ($user[0] == $handle) {
$catnames = explode(',', $user[1]);
$cats = qa_db_read_all_values(qa_db_query_sub('SELECT categoryid FROM ^categories WHERE title IN ($)', $catnames));
$is_expert = $cats;
}
}
}
if (isset($is_expert) && !$rules['viewable']) {
// experts that aren't allowed to change hidden questions
if (is_array($is_expert)) {
$in_cats = qa_db_read_one_value(qa_db_query_sub("SELECT COUNT(postid) FROM ^posts WHERE categoryid IN (#) AND postid=#", $is_expert, $post['postid']), true);
if ($in_cats) {
$rules['viewable'] = true;
}
} else {
$rules['viewable'] = true;
}
}
$rules['reshowable'] = false;
$rules['answerbutton'] = true;
$rules['commentbutton'] = true;
$rules['commentable'] = true;
}
return $rules;
}
示例11: head_script
function head_script()
{
// insert Javascript into the <head>
$google_UA = qa_opt('google_analytics_UA');
$is_admin = qa_get_logged_in_level() == 120 ? true : false;
if (!empty($google_UA)) {
if (!($is_admin && qa_opt('google_analytics_show_for_admin'))) {
// the loged in user is not the admin
$this->content['script'][] = '<script type="text/javascript">' . 'var _gaq = _gaq || [];' . '_gaq.push([\'_setAccount\', \'' . $google_UA . '\']);' . '_gaq.push([\'_trackPageview\']);' . '(function() {' . 'var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . 'ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . 'var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . '})();' . '</script>';
}
}
qa_html_theme_base::head_script();
}
示例12: head_script
function head_script()
{
// insert Javascript into the <head>
$google_UA = qa_opt('google_analytics_UA');
$google_domain = qa_opt('google_analytics_domain');
$is_admin = qa_get_logged_in_level() == 120 ? true : false;
if (!empty($google_UA)) {
if (!($is_admin && qa_opt('google_analytics_show_for_admin'))) {
// the loged in user is not the admin
$this->content['script'][] = $google_UA;
}
}
qa_html_theme_base::head_script();
}
示例13: qa_page_q_post_rules
function qa_page_q_post_rules($post, $parentpost = null, $siblingposts = null, $childposts = null)
{
// default function call
$rules = qa_page_q_post_rules_base($post, $parentpost, $siblingposts, $childposts);
$userid = qa_get_logged_in_userid();
$level = qa_get_logged_in_level();
// do not show answer button if spam-limit exceeded (git-suggest)
if (!qa_limits_remaining($userid, QA_LIMIT_ANSWERS)) {
$rules['answerbutton'] = false;
}
// users are never allowed to hide posts
$rules['hideable'] = false;
// normal users are not allowed to edit posts after x min
$timestamp = time();
// edit time frame: 5 min (300s) for questions/comments + 20 min (1200s) for answers
if ($post['type'] == 'A') {
$rules['editable'] = $rules['editbutton'] = $rules['isbyuser'] && $timestamp - $post['created'] < 1200;
} else {
$rules['editable'] = $rules['editbutton'] = $rules['isbyuser'] && $timestamp - $post['created'] < 300;
}
// questions cannot be reopened, only admin
$rules['reopenable'] = $rules['reopenable'] && $level >= QA_USER_LEVEL_ADMIN;
// Moderator
if ($level == QA_USER_LEVEL_EXPERT) {
// allowed to edit own answers and all questions
// time frame: allow edit after 5 min and up to 7 days (604800 sec), can edit his own answer immediately
$rules['editable'] = $rules['editbutton'] = ($rules['isbyuser'] || $post['type'] == 'Q') && !isset($post['closedbyid']) && $post['userid'] != 1;
// never allow question-posts of admin to be edited
} else {
if ($level == QA_USER_LEVEL_EDITOR) {
// can edit all posts in forum, but not admin posts
$rules['editable'] = $rules['editbutton'] = $post['userid'] != 1;
// can clear flags
$rules['clearflaggable'] = $post['flagcount'] >= (@$post['userflag'] ? 2 : 1);
}
}
// && ( ($timestamp - $post['created'] > 300) || $rules['isbyuser'] ) // can edit question just after 5 min OR his own answer immediately
// && ($timestamp - $post['created'] < 604800 || $level>=QA_USER_LEVEL_EDITOR) // do not allow edit of posts older than 7 days, Redakteur can
// admin has all rights
if ($level >= QA_USER_LEVEL_ADMIN) {
$rules['editable'] = $rules['editbutton'] = $rules['hideable'] = true;
}
// experts, moderators, admins can close questions
$rules['closeable'] = $level >= QA_USER_LEVEL_EXPERT && !$rules['closed'];
// && ($timestamp - $post['created'] < 1209600) ); // within 7 days
// do not show retag button as it does the same as edit button
$rules['retagcatbutton'] = false;
return $rules;
}
示例14: process_request
function process_request($request)
{
if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
$qa_content = qa_content_prepare();
$qa_content['error'] = "You don't have permission to access this page.";
return $qa_content;
}
$qa_content = qa_content_prepare();
$qa_content['site_title'] = "Infinity Theme";
$qa_content['title'] = "Theme Option";
$qa_content['error'] = "";
$qa_content['suggest_next'] = "";
$qa_content['custom'] = $this->page_form();
$qa_content['sidepanel'] = '';
return $qa_content;
}
示例15: qa_admin_check_privileges
function qa_admin_check_privileges(&$qa_content)
{
global $qa_login_userid, $qa_request;
if (!isset($qa_login_userid)) {
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title');
$qa_content['error'] = qa_insert_login_links(qa_lang_html('admin/not_logged_in'), $qa_request);
return false;
} elseif (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title');
$qa_content['error'] = qa_lang_html('admin/no_privileges');
return false;
}
return true;
}