コード例 #1
0
 function admin_form(&$qa_content)
 {
     //	Process form input
     $ok = null;
     if (qa_clicked('prevnav_save_button')) {
         qa_opt('prevnav_plugin_css', qa_post_text('prevnav_plugin_css'));
         qa_opt('prevnav_plugin_widget_only', (bool) qa_post_text('prevnav_plugin_widget_only'));
         qa_opt('prevnav_plugin_widget_title', qa_post_text('prevnav_plugin_widget_title'));
         $ok = qa_lang('admin/options_saved');
     } else {
         if (qa_clicked('prevnav_reset_button')) {
             foreach ($_POST as $i => $v) {
                 $def = $this->option_default($i);
                 if ($def !== null) {
                     qa_opt($i, $def);
                 }
             }
             $ok = qa_lang('admin/options_reset');
         }
     }
     //	Create the form for display
     $fields = array();
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'PrevNav buttons custom css', 'tags' => 'NAME="prevnav_plugin_css"', 'value' => qa_opt('prevnav_plugin_css'), 'type' => 'textarea', 'rows' => 20);
     $fields[] = array('label' => 'Widget Title', 'tags' => 'NAME="prevnav_plugin_widget_title"', 'value' => qa_opt('prevnav_plugin_widget_title'));
     $fields[] = array('type' => 'blank');
     $fields[] = array('type' => 'blank');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="prevnav_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="prevnav_reset_button"')));
 }
コード例 #2
0
 function admin_form(&$qa_content)
 {
     $ok = null;
     if (qa_clicked('short_url_save_button')) {
         qa_opt('short_url_content_on', (bool) qa_post_text('short_url_content_on'));
         qa_opt('short_url_bitly_username', (string) qa_post_text('short_url_bitly_username'));
         qa_opt('short_url_bitly_api_key', (string) qa_post_text('short_url_bitly_api_key'));
         $ok = qa_lang('admin/options_saved');
     } else {
         if (qa_clicked('short_url_reset_button')) {
             foreach ($_POST as $i => $v) {
                 $def = $this->option_default($i);
                 if ($def !== null) {
                     qa_opt($i, $def);
                 }
             }
             $ok = qa_lang('admin/options_reset');
         }
     }
     $fields = array();
     $ready = strlen(qa_opt('short_url_bitly_username')) && strlen(qa_opt('short_url_bitly_api_key'));
     if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
         $fields[] = array('label' => 'You cannot enable when in localhost', 'tags' => 'NAME="short_url_content_on"', 'value' => qa_opt('short_url_content_on'), 'type' => 'checkbox', 'disabled' => 'disabled');
     } else {
         $fields[] = array('label' => 'Enable Short Url', 'tags' => 'NAME="short_url_content_on"', 'value' => qa_opt('short_url_content_on'), 'type' => 'checkbox');
     }
     $fields[] = array('label' => 'Your Bitly username', 'tags' => 'NAME="short_url_bitly_username"', 'value' => qa_opt('short_url_bitly_username'), 'type' => 'string');
     $fields[] = array('label' => 'Your Bitly api key', 'tags' => 'NAME="short_url_bitly_api_key"', 'value' => qa_opt('short_url_bitly_api_key'), 'type' => 'string', 'error' => $ready ? null : 'You can find your api key <a href="https://bitly.com/a/your_api_key">here</a>');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="short_url_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="short_url_reset_button"')));
 }
コード例 #3
0
ファイル: qa-tag-cloud.php プロジェクト: architbakliwal/Q2A
 public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'db/selects.php';
     $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
     $maxcount = reset($populartags);
     // $themeobject->output(sprintf('<h2 style="margin-top: 0; padding-top: 0;">%s</h2>', qa_lang_html('main/popular_tags')));
     // $themeobject->output('<div style="font-size: 10px;">');
     $themeobject->output(sprintf('<div class="panel panel-primary" style="padding: 0;"><div class="panel-heading"><h3 class="panel-title">%s</h3></div>', qa_lang_html('main/popular_tags')));
     $themeobject->output('<div class="panel-body">');
     $maxsize = qa_opt('tag_cloud_font_size');
     $minsize = qa_opt('tag_cloud_minimal_font_size');
     $scale = qa_opt('tag_cloud_size_popular');
     $blockwordspreg = qa_get_block_words_preg();
     foreach ($populartags as $tag => $count) {
         $matches = qa_block_words_match_all($tag, $blockwordspreg);
         if (empty($matches)) {
             if ($scale) {
                 $size = number_format($maxsize * $count / $maxcount, 1);
                 if ($size < $minsize) {
                     $size = $minsize;
                 }
             } else {
                 $size = $maxsize;
             }
             $themeobject->output(sprintf('<a href="%s" style="font-size: %dpx; vertical-align: baseline;">%s</a>', qa_path_html('tag/' . $tag), $size, qa_html($tag)));
         }
     }
     // $themeobject->output('</div>');
     $themeobject->output('</div></div>');
 }
コード例 #4
0
 function admin_form(&$qa_content)
 {
     $ok = null;
     if (qa_clicked('obvious_save_button')) {
         qa_opt('obvious_content_on', (bool) qa_post_text('obvious_content_on'));
         qa_opt('obvious_content_color', (string) qa_post_text('obvious_content_color'));
         qa_opt('obvious_max_tags', (int) qa_post_text('obvious_max_tags'));
         qa_opt('obvious_content_category_on', (bool) qa_post_text('obvious_content_category_on'));
         qa_opt('obvious_content_category_color', (string) qa_post_text('obvious_content_category_color'));
         $ok = qa_lang('admin/options_saved');
     } else {
         if (qa_clicked('obvious_reset_button')) {
             foreach ($_POST as $i => $v) {
                 $def = $this->option_default($i);
                 if ($def !== null) {
                     qa_opt($i, $def);
                 }
             }
             $ok = qa_lang('admin/options_reset');
         }
     }
     $fields = array();
     $fields[] = array('label' => 'Enable Obvious Favorite Tags', 'tags' => 'NAME="obvious_content_on"', 'value' => qa_opt('obvious_content_on'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Your color in Hex', 'tags' => 'NAME="obvious_content_color"', 'value' => qa_opt('obvious_content_color'), 'type' => 'string');
     $fields[] = array('label' => 'Enable Obvious Favorite Category', 'tags' => 'NAME="obvious_content_category_on"', 'value' => qa_opt('obvious_content_category_on'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Your color in Hex', 'tags' => 'NAME="obvious_content_category_color"', 'value' => qa_opt('obvious_content_category_color'), 'type' => 'string');
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'Maximum tags for the Widget', 'tags' => 'NAME="obvious_max_tags"', 'value' => qa_opt('obvious_max_tags'), 'type' => 'int');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="obvious_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="obvious_reset_button"')));
 }
コード例 #5
0
ファイル: qa-adchat-admin.php プロジェクト: arjunsuresh/chat
 function admin_form(&$qa_content)
 {
     //	Process form input
     $ok = null;
     if (qa_clicked('adchat_save_button')) {
         qa_opt('adchat_plugin_css', qa_post_text('adchat_plugin_css'));
         if (qa_post_text('adchat-expand-categories') == 1) {
             qa_opt('adchat-expand-categories', "1");
         } else {
             qa_opt('adchat-expand-categories', "0");
         }
         $ok = qa_lang('admin/options_saved');
     } else {
         if (qa_clicked('adchat_reset_button')) {
             foreach ($_POST as $i => $v) {
                 $def = $this->option_default($i);
                 if ($def !== null) {
                     qa_opt($i, $def);
                 }
             }
             $ok = qa_lang('admin/options_reset');
         }
     }
     //	Create the form for display
     $fields = array();
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'Adchat custom css', 'tags' => 'NAME="adchat_plugin_css"', 'value' => qa_opt('adchat_plugin_css'), 'type' => 'textarea', 'rows' => 20);
     $fields[] = array('label' => 'Make all categories into chat room', 'note' => 'Otherwise only top level categories are made to chat room', 'tags' => 'NAME="adchat-expand-categories"', 'value' => qa_opt('adchat-expand-categories'), 'type' => 'checkbox');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="adchat_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="adchat_reset_button"')));
 }
コード例 #6
0
 /**
  * Function that is called at the end of page rendering
  * @param type $reason
  * @return type
  */
 function shutdown($reason = false)
 {
     if ($this->do_caching() && !$this->is_logged_in) {
         if (!$this->check_cache()) {
             if (QA_CACHING_COMPRESS && $this->is_html()) {
                 $this->content = $this->compress_content(ob_get_contents());
             } else {
                 $this->content = ob_get_contents();
             }
             $this->content = trim($this->content);
             if (empty($this->content)) {
                 // if empty page
                 return;
             }
             if (strpos($this->content, qa_lang_html('main/page_not_found')) !== false) {
                 // if 404 page
                 return;
             }
             if (QA_DEBUG_PERFORMANCE && $this->is_html()) {
                 $endtag = '</html>';
                 $rpos = strrpos($this->content, $endtag);
                 if ($rpos !== false) {
                     $this->content = substr($this->content, 0, $rpos + strlen($endtag));
                 }
             }
             $total_time = number_format(microtime(true) - $this->timer, 4, ".", "");
             $this->debug .= "\n<!-- ++++++++++++CACHED VERSION++++++++++++++++++\n";
             $this->debug .= "Created on " . date('Y-m-d H:i:s') . "\n";
             $this->debug .= "Generated in " . $total_time . " seconds\n";
             $this->debug .= "++++++++++++CACHED VERSION++++++++++++++++++ -->\n";
             $this->write_cache();
         }
     }
     return;
 }
コード例 #7
0
    function admin_form(&$qa_content)
    {
        // Process form input
        $ok = null;
        if (qa_clicked('cp_save')) {
            // Save
            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');
            qa_opt('cp_enable', (bool) qa_post_text('cp_enable'));
            $ok = qa_lang('admin/options_saved');
        } else {
            if (qa_clicked('cp_reset')) {
                // Reset
                foreach ($_POST as $i => $v) {
                    $def = $this->option_default($i);
                    if ($def !== null) {
                        qa_opt($i, $def);
                    }
                }
                qa_opt('cp_enable', true);
                $ok = qa_lang('admin/options_reset');
            }
        }
        // Create the form for display
        $fields = array();
        $fields[] = array('label' => qa_lang('cp/enable_community_posts'), 'tags' => 'NAME="cp_enable"', 'value' => qa_opt('cp_enable'), 'type' => 'checkbox');
        return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="cp_save"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="cp_reset"')));
    }
コード例 #8
0
 function logout_html($tourl)
 {
     require_once QA_INCLUDE_DIR . "qa-base.php";
     $_SESSION['logout_url'] = $tourl;
     $logout_url = qa_path('auth/logout', null, qa_path_to_root());
     echo '<a href="' . $logout_url . '">' . qa_lang_html('main/nav_logout') . '</a>';
 }
コード例 #9
0
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     /*
     $requestparts=qa_request_parts();
     $requestlower=strtolower(qa_request());
     $firstlower=strtolower($requestparts[0]);
     $routing=qa_page_routing();
     // unanswered & questions pages may contain categories.
     unset($routing['activity/']);
     unset($routing['unanswered/']);
     unset($routing['questions/']);
     if ( (isset($routing[$requestlower])) or (isset($routing[$firstlower.'/'])) or (is_numeric($requestparts[0])) )
     	return;
     	
     $explicitqa=(strtolower($requestparts[0])=='qa' or strtolower($requestparts[0])=='unanswered' or strtolower($requestparts[0])=='questions' or strtolower($requestparts[0])=='activity');
     
     if ($explicitqa)
     	$slugs=array_slice($requestparts, 1);
     elseif (strlen($requestparts[0]))
     	$slugs=$requestparts;
     else
     	$slugs=array();
     */
     $slugs = useo_get_current_category_slug();
     $countslugs = count($slugs);
     list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null);
     if ($countslugs && isset($categoryid)) {
         /*
         $categoryid is current categories ID
         $backpath = implode('/', array_reverse($slugs));
         echo "countslugs: <pre>"; var_dump($countslugs); echo "</pre>";
         $fullcategory=qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true));
         echo "fullcategory: <pre>"; var_dump($fullcategory); echo "</pre>";
         
         echo "categoryid: <pre>"; var_dump($categoryid); echo "</pre>";
         echo "slugs: <pre>"; var_dump($slugs); echo "</pre>";
         echo "template: <pre>"; var_dump($template); echo "</pre>";
         echo "request: <pre>"; var_dump($request); echo "</pre>";
         */
         require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
         $description = qa_db_categorymeta_get($categoryid, 'useo_cat_description');
         if (!qa_opt('useo_cat_desc_format')) {
             $description = qa_html($description);
         }
         $editurlhtml = qa_path_html('category-edit/' . $categoryid);
         $allowediting = !qa_user_permit_error('useo_cat_desc_permit_edit');
         if (strlen($description)) {
             echo '<SPAN CLASS="entry-content qa-category-description">';
             echo $description;
             echo '</SPAN>';
             if ($allowediting) {
                 echo ' - <A HREF="' . $editurlhtml . '">edit</A>';
             }
         } elseif ($allowediting) {
             echo '<A HREF="' . $editurlhtml . '">' . qa_lang_html('useo/create_desc_link') . '</A>';
         }
     }
 }
コード例 #10
0
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     $widget_opt = $themeobject->current_widget['param']['options'];
     if (@$themeobject->current_widget['param']['locations']['show_title']) {
         $themeobject->output('<h3 class="widget-title">' . qa_lang_html('cleanstrap/askbox_placeholder') . '</h3>');
     }
     $themeobject->output('<div class="ra-tags-widget">');
     $themeobject->output($this->cs_top_users((int) @$widget_opt['cs_tc_count'], (int) @$widget_opt['cs_tc_avatar']));
     $themeobject->output('</div>');
 }
コード例 #11
0
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang_html('example_page/page_title');
     $qa_content['error'] = 'An example error';
     $qa_content['custom'] = 'Some <b>custom html</b>';
     $qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'name="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'name="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
     $qa_content['custom_2'] = '<p><br>More <i>custom html</i></p>';
     return $qa_content;
 }
コード例 #12
0
ファイル: qa-example-page.php プロジェクト: ramo01/1kapp
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang_html('example_page/page_title');
     $qa_content['error'] = 'An example error';
     $qa_content['custom'] = 'Some <B>custom html</B>';
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
     $qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>';
     return $qa_content;
 }
コード例 #13
0
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;
}
コード例 #14
0
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     $widget_opt = @$themeobject->current_widget['param']['options'];
     $type = @$widget_opt['type'];
     if (@$themeobject->current_widget['param']['locations']['show_title']) {
         $themeobject->output('<h3 class="widget-title">' . qa_lang_html('cleanstrap/site_status') . '</h3>');
     }
     $themeobject->output('<div class="ra-site-status-widget">');
     $themeobject->output($this->cs_stats_chart($type));
     $themeobject->output('</div>');
 }
コード例 #15
0
 public function nav_user_search()
 {
     if (!qa_is_logged_in()) {
         if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) {
             $login = $this->content['navigation']['user']['login'];
             $this->output('<form class="qam-login-form" action="' . $login['url'] . '" method="post">', '<input type="text" class="qam-login-text" name="emailhandle" dir="auto" placeholder="' . trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':') . '"/>', '<input type="password" class="qam-login-text" name="password" dir="auto" placeholder="' . trim(qa_lang_html('users/password_label'), ':') . '"/>', '<div class="qam-rememberbox"><input type="checkbox" name="remember" id="qam-rememberme" value="1"/>', '<label for="qam-rememberme" class="qam-remember">' . qa_lang_html('users/remember') . '</label></div>', '<input type="hidden" name="code" value="' . qa_html(qa_get_form_security_code('login')) . '"/>', '<input type="submit" value="' . qa_lang_html('users/login_button') . '" class="qa-form-tall-button qa-form-tall-button-login" name="dologin"/>', '</form>');
             // remove regular navigation link to log in page
             unset($this->content['navigation']['user']['login']);
         }
     }
     qa_html_theme_base::nav_user_search();
 }
コード例 #16
0
function qa_set_up_captcha_field(&$qa_content, &$fields, $errors, $note = null)
{
    if (qa_captcha_possible()) {
        $fields['captcha'] = array('type' => 'custom', 'label' => qa_lang_html('misc/captcha_label'), 'html' => qa_captcha_html(@$errors['captcha']), 'error' => isset($errors['captcha']) ? qa_lang_html('misc/captcha_error') : null, 'note' => $note);
        $language = qa_opt('site_language');
        if (strpos('|en|nl|fr|de|pt|ru|es|tr|', '|' . $language . '|') === false) {
            // supported as of 3/2010
            $language = 'en';
        }
        $qa_content['script_lines'][] = array("var RecaptchaOptions = {", "\ttheme:'white',", "\tlang:" . qa_js($language), "}");
    }
}
コード例 #17
0
 function nav_user_search()
 {
     if (!qa_is_logged_in()) {
         $login = @$this->content['navigation']['user']['login'];
         if (isset($login) && !QA_FINAL_EXTERNAL_USERS) {
             $this->output('<!--[Begin: login form]-->', '<form id="qa-loginform" action="' . $login['url'] . '" method="post">', '<input type="text" id="qa-userid" name="emailhandle" placeholder="' . trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':') . '" />', '<input type="password" id="qa-password" name="password" placeholder="' . trim(qa_lang_html('users/password_label'), ':') . '" />', '<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>', '<label for="qa-rememberme" id="qa-remember">' . qa_lang_html('users/remember') . '</label></div>', '<input type="hidden" name="code" value="' . qa_html(qa_get_form_security_code('login')) . '"/>', '<input type="submit" value="' . $login['label'] . '" id="qa-login" name="dologin" />', '</form>', '<!--[End: login form]-->');
             unset($this->content['navigation']['user']['login']);
             // removes regular navigation link to log in page
         }
     }
     qa_html_theme_base::nav_user_search();
 }
コード例 #18
0
ファイル: q-list.php プロジェクト: kosmoluna/question2answer
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/format.php';
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $defaults['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
            if (!empty($fields['raw']['closedbyid'])) {
                $fields['closed'] = array('state' => qa_lang_html('main/closed'));
            }
            $qa_content['q_list']['qs'][] = $fields;
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($userid) && isset($categoryid)) {
        $favoritemap = qa_get_favorite_non_qs_map();
        $categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
        $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
コード例 #19
0
    function qw_notification_btn()
    {
        //if (true){ // check options
        $userid = qa_get_logged_in_userid();
        if (isset($userid)) {
            $handle = qa_get_logged_in_handle();
            $this->output('
					<div class="user-actions pull-right">
						<div class="activity-bar">
							<div class="button dropdown">
								<a href="' . qa_path_html('user/' . $handle . '/activity') . '" class=" icon-bullhorn dropdown-toggle activitylist" data-toggle="dropdown" id="activitylist"></a>
								<div class="dropdown-menu activity-dropdown-list pull-right" id="activity-dropdown-list">
									<div class="bar">
										<span>' . qa_lang_html('dude/notifications') . '</span>
										<a class="mark-activity" href="#" data-id="' . qa_get_logged_in_userid() . '">' . qa_lang('dude/mark_all_as_read') . '</a>
									</div>
									<div class="append">
										<div class="ajax-list"></div>
										<span class="loading"></span>
										<div class="no-activity icon-chart-bar">' . qa_lang('dude/no-activity') . '</div>
									</div>
									
									<a class="event-footer" href="' . qa_path_html('notifications', null, QW_BASE_URL) . '">' . qa_lang('dude/see_all') . '</a>
									
								</div>
							</div>
						</div>
						
						<div class="message-bar">
							<div class="button dropdown">
								<a href="' . qa_path_html('user/' . $handle . '/message') . '" class=" icon-envelope-alt dropdown-toggle messagelist" data-toggle="dropdown" id="messagelist"></a>
								<div class="dropdown-menu message-dropdown-list pull-right" id="message-dropdown-list">
									<div class="bar">
										<span>' . qa_lang_html('dude/messages') . '</span>
										<a class="mark-messages" href="#">' . qa_lang('dude/mark_all_as_read') . '</a>
									</div>
									<div class="append">
										<div class="ajax-list"></div>
										<span class="loading"></span>
										<div class="no-activity icon-chart-bar">' . qa_lang('dude/no-activity') . '</div>
									</div>
									
									<a class="event-footer" href="' . qa_path_html('user/' . $handle . '/wall', null, QW_BASE_URL) . '">' . qa_lang('dude/see_all') . '</a>
									
								</div>
							</div>
						</div>
					</div>
				');
        }
        //}
    }
コード例 #20
0
ファイル: qa-rpc-admin.php プロジェクト: swuit/swuit-q2a
 function admin_form(&$qa_content)
 {
     // Process form input
     $ok = null;
     if (qa_clicked('xml_rpc_save')) {
         qa_opt('xml_rpc_bool_active', (bool) @$_POST['xml_rpc_bool_active']);
         $ok = qa_lang('admin/options_saved');
     }
     // Create the form for display
     $fields = array();
     $fields[] = array('label' => 'Enable XML-RPC server', 'tags' => 'NAME="xml_rpc_bool_active"', 'value' => qa_opt('xml_rpc_bool_active'), 'type' => 'checkbox');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="xml_rpc_save"')));
 }
コード例 #21
0
 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']}";
             }
         }
     }
 }
コード例 #22
0
 function process_request($request)
 {
     //	Get list of unanswered open questions
     $userid = qa_get_logged_in_userid();
     $start = qa_get_start();
     $questions_selectspec = $this->qa_db_open_qs_selectspec($userid, $start);
     $questions = qa_db_select_with_pending($questions_selectspec);
     //	Prepare and return the content for the theme
     $questions_found_title = qa_lang_html('open_questions/questions_found_title');
     $no_questions_title = qa_lang_html('open_questions/no_questions_title');
     $count = qa_opt('cache_unaqcount');
     $qa_content = qa_q_list_page_content($questions, qa_opt('page_size_una_qs'), $start, @$count, $questions_found_title, $no_questions_title, null, null, false, null, null, qa_html_suggest_qs_tags(qa_using_tags()), null, null);
     return $qa_content;
 }
コード例 #23
0
 function admin_form()
 {
     require_once QA_INCLUDE_DIR . 'qa-util-sort.php';
     $saved = false;
     if (qa_clicked('SAVE_BUTTON')) {
         //qa_opt('hw_imgur_token', (int)qa_post_text('show_online_user_list_field'));
         qa_opt('hw_imgur_album', qa_post_text('hw_imgur_album_field') == '' ? 'bld18' : qa_post_text('hw_imgur_album_field'));
         //save album id
         qa_opt('hw_imgur_show_image_id', (int) qa_post_text('hw_imgur_show_image_id_field'));
         qa_opt('hw_enable_iflychat', (int) qa_post_text('hw_enable_iflychat_field'));
         $saved = true;
     }
     $form = array('ok' => $saved ? qa_lang_html('hw_lang/change_ok') : null, 'fields' => array('question1' => array('label' => qa_lang_html('hw_lang/imgur_album_id'), 'type' => 'text', 'value' => qa_html(qa_opt('hw_imgur_album')), 'tags' => 'name="hw_imgur_album_field"'), 'question2' => array('label' => qa_lang_html('hw_lang/imgur_show_image_id'), 'type' => 'checkbox', 'value' => (int) qa_opt('hw_imgur_show_image_id'), 'tags' => 'name="hw_imgur_show_image_id_field"'), 'question3' => array('label' => qa_lang_html('hw_lang/enable_iflychat'), 'type' => 'checkbox', 'value' => (int) qa_opt('hw_enable_iflychat'), 'tags' => 'name="hw_enable_iflychat_field"')), 'buttons' => array(array('label' => qa_lang_html('hw_lang/save_button'), 'tags' => 'name="SAVE_BUTTON"')));
     return $form;
 }
コード例 #24
0
 function admin_form(&$qa_content)
 {
     // Process form input
     $ok = null;
     if (qa_clicked('random_question_save')) {
         qa_opt('random_question_number', qa_post_text('random_question_number'));
         qa_opt('random_question_title', qa_post_text('random_question_title'));
         $ok = qa_lang_html('admin/options_saved');
     }
     // Create the form for display
     $fields = array();
     $fields[] = array('label' => 'Number of questions to show', 'tags' => 'NAME="random_question_number"', 'value' => qa_opt('random_question_number'), 'type' => 'number');
     $fields[] = array('label' => 'Widget title', 'tags' => 'NAME="random_question_title"', 'value' => qa_opt('random_question_title'), 'type' => 'text');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save', 'tags' => 'NAME="random_question_save"')));
 }
コード例 #25
0
 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">&nbsp;</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);
 }
コード例 #26
0
ファイル: widget_ask.php プロジェクト: microbye/CleanStrap
    function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
    {
        if (isset($qa_content['categoryids'])) {
            $params = array('cat' => end($qa_content['categoryids']));
        } else {
            $params = null;
        }
        $themeobject->output('<div class="ra-ask-widget">');
        $themeobject->output('<form action="' . qa_path_html('ask', $params) . '" method="post">', '<div class="input-group">
						  <input type="text"  name="title" class="form-control" id="ra-ask-search" placeholder="' . qa_lang_html('cleanstrap/askbox_placeholder') . '">
						  <span class="input-group-btn">
							<button class="icon-question btn" type="submit">' . qa_lang_html('cleanstrap/askbox_ask') . '</button>
						  </span>
					</div>', '<input type="hidden" value="1" name="doask1">', '</form>');
        $themeobject->output('</div>');
    }
コード例 #27
0
 function process_request($request)
 {
     @ini_set('display_errors', 0);
     // we don't want to show PHP errors inside XML
     $titlehtml = qa_html(qa_opt('site_title'));
     $template = str_replace('_searchTerms_placeholder_', '{searchTerms}', qa_path('search', array('q' => '_searchTerms_placeholder_'), qa_opt('site_url')));
     header('Content-type: text/xml; charset=utf-8');
     echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">' . "\n";
     echo "\t<ShortName>" . $titlehtml . "</ShortName>\n";
     echo "\t<Description>" . qa_lang_html('main/search_button') . ' ' . $titlehtml . "</Description>\n";
     echo "\t" . '<Url type="text/html" method="get" template="' . qa_html($template) . '"/>' . "\n";
     echo "\t<InputEncoding>UTF-8</InputEncoding>\n";
     echo '</OpenSearchDescription>' . "\n";
     return null;
 }
コード例 #28
0
ファイル: qa-embed-admin.php プロジェクト: JoZ3/q2a-embed
 function admin_form(&$qa_content)
 {
     // Process form input
     $ok = null;
     if (qa_clicked('embed_save')) {
         qa_opt('embed_enable', (bool) qa_post_text('embed_enable'));
         qa_opt('embed_video_width', qa_post_text('embed_video_width'));
         qa_opt('embed_video_height', qa_post_text('embed_video_height'));
         qa_opt('embed_enable_img', (bool) qa_post_text('embed_enable_img'));
         qa_opt('embed_image_width', qa_post_text('embed_image_width'));
         qa_opt('embed_image_height', qa_post_text('embed_image_height'));
         qa_opt('embed_enable_thickbox', (bool) qa_post_text('embed_enable_thickbox'));
         qa_opt('embed_enable_mp3', (bool) qa_post_text('embed_enable_mp3'));
         qa_opt('embed_enable_gmap', (bool) qa_post_text('embed_enable_gmap'));
         qa_opt('embed_mp3_player_code', qa_post_text('embed_mp3_player_code'));
         $ok = qa_lang('admin/options_saved');
     } else {
         if (qa_clicked('embed_reset')) {
             foreach ($_POST as $i => $v) {
                 $def = $this->option_default($i);
                 if ($def !== null) {
                     qa_opt($i, $def);
                 }
             }
             $ok = qa_lang('admin/options_reset');
         }
     }
     qa_set_display_rules($qa_content, array('embed_video_height' => 'embed_enable', 'embed_video_width' => 'embed_enable'));
     // Create the form for display
     $fields = array();
     $fields[] = array('label' => 'Enable video embedding', 'tags' => 'NAME="embed_enable"', 'value' => qa_opt('embed_enable'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Embeded video width', 'type' => 'number', 'value' => qa_opt('embed_video_width'), 'tags' => 'NAME="embed_video_width"');
     $fields[] = array('label' => 'Embeded video height', 'type' => 'number', 'value' => qa_opt('embed_video_height'), 'tags' => 'NAME="embed_video_height"');
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'Enable image embedding', 'tags' => 'NAME="embed_enable_img"', 'value' => qa_opt('embed_enable_img'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Image width', 'type' => 'number', 'value' => qa_opt('embed_image_width'), 'tags' => 'NAME="embed_image_width"');
     $fields[] = array('label' => 'Image height', 'type' => 'number', 'value' => qa_opt('embed_image_height'), 'tags' => 'NAME="embed_image_height"');
     $fields[] = array('label' => 'Enable thickbox image effect', 'tags' => 'NAME="embed_enable_thickbox"', 'value' => qa_opt('embed_enable_thickbox'), 'type' => 'checkbox');
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'Enable mp3 embedding', 'tags' => 'NAME="embed_enable_mp3"', 'value' => qa_opt('embed_enable_mp3'), 'type' => 'checkbox');
     $fields[] = array('label' => 'mp3 flash player code', 'tags' => 'NAME="embed_mp3_player_code"', 'value' => qa_opt('embed_mp3_player_code'), 'type' => 'textarea', 'rows' => '5');
     $fields[] = array('type' => 'blank');
     $fields[] = array('label' => 'Enable Google maps embedding', 'tags' => 'NAME="embed_enable_gmap"', 'value' => qa_opt('embed_enable_gmap'), 'type' => 'checkbox');
     $fields[] = array('label' => 'Map width', 'type' => 'number', 'value' => qa_opt('embed_gmap_width'), 'tags' => 'NAME="embed_gmap_width"');
     $fields[] = array('label' => 'Map height', 'type' => 'number', 'value' => qa_opt('embed_gmap_height'), 'tags' => 'NAME="embed_gmap_height"');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="embed_save"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="embed_reset"')));
 }
コード例 #29
0
function qa_set_up_captcha_field(&$qa_content, &$fields, $errors, $note = null)
{
    if (qa_captcha_available()) {
        $captcha = qa_load_module('captcha', qa_opt('captcha_module'));
        $count = @++$qa_content['qa_captcha_count'];
        // work around fact that reCAPTCHA can only display per page
        if ($count > 1) {
            $html = '[captcha placeholder]';
        } else {
            $qa_content['script_var']['qa_captcha_in'] = 'qa_captcha_div_1';
            $html = $captcha->form_html($qa_content, @$errors['captcha']);
        }
        $fields['captcha'] = array('type' => 'custom', 'label' => qa_lang_html('misc/captcha_label'), 'html' => '<div id="qa_captcha_div_' . $count . '">' . $html . '</div>', 'error' => @array_key_exists('captcha', $errors) ? qa_lang_html('misc/captcha_error') : null, 'note' => $note);
        return "if (qa_captcha_in!='qa_captcha_div_" . $count . "') { document.getElementById('qa_captcha_div_" . $count . "').innerHTML=document.getElementById(qa_captcha_in).innerHTML; document.getElementById(qa_captcha_in).innerHTML=''; qa_captcha_in='qa_captcha_div_" . $count . "'; }";
    }
    return '';
}
コード例 #30
0
 function doctype()
 {
     qa_html_theme_base::doctype();
     if (qa_opt('cp_enable') && ($this->template == 'ask' || isset($this->content['q_list']) || isset($this->content['q_view']))) {
         global $qa_request;
         global $wiki_enable;
         if ($this->template == 'ask' && !qa_user_permit_error('permit_post_q') && !qa_opt('site_maintenance') && qa_permit_check('permit_create_cp')) {
             $this->content['form']['tags'] .= ' onSubmit="pollSubmit(event)"';
             $this->content['form']['fields'][] = array('label' => qa_lang('cp/checkbox_text'), 'tags' => 'NAME="cp_community" ID="cp_community"', 'type' => 'checkbox', 'value' => qa_post_text('cp_community') ? 1 : 0);
         }
         if (isset($this->content['q_view'])) {
             $qid = $this->content['q_view']['raw']['postid'];
             $author = $this->content['q_view']['raw']['userid'];
             if (!isset($wiki_enable)) {
                 $result = qa_db_query_sub('SELECT * FROM ^postmeta WHERE meta_key=$ AND post_id=#', 'is_community', $qid);
                 $wiki_enable = $result->num_rows > 0;
             }
             if ($wiki_enable) {
                 // is a community post
                 $this->content['title'] .= ' ' . qa_lang('cp/question_title');
                 // $this->content['q_view']['content'] = @$this->content['q_view']['content'].'<div id="qa-wiki-div">'.$this->getPollDiv($qid,qa_get_logged_in_userid()).'</div>';
                 $this->content['q_view']['main_form_tags'] = @$this->content['q_view']['main_form_tags'] . ' class="qa-community-posts"';
                 // print_r($this->content['q_view']['form']['buttons']);
                 if (isset($this->content['q_view']['form']['buttons']['edit'])) {
                     $this->content['q_view']['form']['buttons']['edit']['label'] = qa_lang_html('cp/contribute');
                     $this->content['q_view']['form']['buttons']['edit']['popup'] = qa_lang_html('cp/contribute_description');
                 }
                 unset($this->content['q_view']['form']['buttons']['answer']);
                 unset($this->content['q_view']['form']['buttons']['comment']);
                 unset($this->content['a_form']);
                 unset($this->content['c_form']);
             }
         }
         if (isset($this->content['q_list'])) {
             $wiki_array = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^postmeta WHERE meta_key=$', 'is_community'));
             foreach ($wiki_array as $q) {
                 $wiki[(int) $q['post_id']] = $q['meta_value'];
             }
             foreach ($this->content['q_list']['qs'] as $idx => $question) {
                 if (isset($wiki[$question['raw']['postid']])) {
                     $this->content['q_list']['qs'][$idx]['title'] .= ' ' . qa_lang('cp/question_title');
                 }
             }
         }
     }
 }