本文整理匯總了PHP中qa_redirect函數的典型用法代碼示例。如果您正苦於以下問題:PHP qa_redirect函數的具體用法?PHP qa_redirect怎麽用?PHP qa_redirect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了qa_redirect函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: check_associate
function check_associate($useraccount)
{
$userid = $useraccount['userid'];
$action = null;
$key = null;
if (!empty($_REQUEST['hauth_start'])) {
$key = trim(strip_tags($_REQUEST['hauth_start']));
$action = 'process';
} else {
if (!empty($_REQUEST['hauth_done'])) {
$key = trim(strip_tags($_REQUEST['hauth_done']));
$action = 'process';
} else {
if (!empty($_GET['link'])) {
$key = trim(strip_tags($_GET['link']));
$action = 'login';
}
}
}
if ($key == null) {
return false;
}
$provider = $this->get_ha_provider($key);
$source = strtolower($provider);
if ($action == 'login') {
// handle the login
// after login come back to the same page
$loginCallback = qa_path('', array(), qa_opt('site_url'));
require_once $this->directory . 'Hybrid/Auth.php';
require_once $this->directory . 'qa-open-utils.php';
// prepare the configuration of HybridAuth
$config = $this->get_ha_config($provider, $loginCallback);
try {
// try to login
$hybridauth = new Hybrid_Auth($config);
$adapter = $hybridauth->authenticate($provider);
// if ok, create/refresh the user account
$user = $adapter->getUserProfile();
$duplicates = 0;
if (!empty($user)) {
// prepare some data
$ohandle = null;
}
$oemail = null;
if (empty($user->displayName)) {
$ohandle = $provider;
} else {
$ohandle = preg_replace('/[\\@\\+\\/]/', ' ', $user->displayName);
}
if (strlen(@$user->email) && $user->emailVerified) {
// only if email is confirmed
$oemail = $user->email;
}
$duplicate = qa_db_user_login_find_duplicate__open($source, $user->identifier);
if ($duplicate == null) {
// simply create a new login
qa_db_user_login_sync(true);
qa_db_user_login_add($userid, $source, $user->identifier);
if ($oemail) {
qa_db_user_login_set__open($source, $user->identifier, 'oemail', $oemail);
}
qa_db_user_login_set__open($source, $user->identifier, 'ohandle', $ohandle);
qa_db_user_login_sync(false);
// now that everything was added, log out to allow for multiple accounts
$adapter->logout();
// redirect to get rid of parameters
qa_redirect('logins');
} else {
if ($duplicate['userid'] == $userid) {
// trying to add the same account, just update the email/handle
qa_db_user_login_sync(true);
if ($oemail) {
qa_db_user_login_set__open($source, $user->identifier, 'oemail', $oemail);
}
qa_db_user_login_set__open($source, $user->identifier, 'ohandle', $ohandle);
qa_db_user_login_sync(false);
// log out to allow for multiple accounts
$adapter->logout();
// redirect to get rid of parameters
qa_redirect('logins');
} else {
if (qa_get('confirm') == 2) {
return $duplicate;
} else {
qa_redirect('logins', array('link' => qa_get('link'), 'confirm' => 2));
}
}
}
} catch (Exception $e) {
qa_redirect('logins', array('provider' => $provider, 'code' => $e->getCode()));
}
}
if ($action == 'process') {
require_once "Hybrid/Auth.php";
require_once "Hybrid/Endpoint.php";
Hybrid_Endpoint::process();
}
return false;
}
示例2: process_request
function process_request($request)
{
$userid = qa_get_logged_in_userid();
$categoryoptions = array();
$qa_content = qa_content_prepare();
// check if we have done a post of the page
if (qa_post_text('okthen')) {
// update the current category
$newcategory = qa_post_text('category');
if (isset($newcategory)) {
mp_set_categoryid($newcategory);
// redirect to main page
qa_redirect('');
} else {
$qa_content['error'] = 'You must select a course to continue.';
}
}
// retrieve list of categories user is associated with
// populate category options
$results = mp_get_categories_for_user($userid);
foreach ($results as $row) {
$categoryoptions[$row['categoryid']] = $row['title'];
}
$qa_content['title'] = 'Registered courses';
$qa_content['custom'] = 'The following list displays all courses your account is associated with. Select a course from the list below and click <B>Select</B> to change to the new course<br /><br />';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('courses' => array('type' => 'select-radio', 'label' => 'Courses', 'tags' => 'NAME="category"', 'options' => $categoryoptions, 'value' => mp_get_categoryid(), 'error' => qa_html(@$errors['course']))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'Select', 'value' => '1')));
return $qa_content;
}
示例3: 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;
}
示例4: qa_get_request_content
function qa_get_request_content()
{
if (qa_opt('news_plugin_active')) {
$requestlower = strtolower(qa_request());
if ($requestlower && $requestlower === 'my-profile') {
$userid = qa_get_logged_in_userid();
if (!$userid) {
qa_redirect();
}
$handles = qa_userids_to_handles(array($userid));
$handle = $handles[$userid];
qa_redirect(qa_path('user/' . $handle));
} else {
if ($requestlower && $requestlower === qa_opt('news_plugin_request')) {
// send on cron
if (qa_opt('news_plugin_send') && qa_get('cron') == qa_opt('news_plugin_cron_rand') && time() >= qa_opt('news_plugin_send_last') + 23 * 60 * 60) {
// minumum cron interval is 23 hours
qa_news_plugin_createNewsletter(true);
return false;
} else {
if (qa_get('cron') == qa_opt('news_plugin_cron_rand')) {
if (!qa_opt('news_plugin_send')) {
error_log('Q2A Newsletter Recreate Error: sending newsletter not allowed via admin/plugins');
} else {
error_log('Q2A Newsletter Recreate Error: cron request before minimum time elapsed');
}
echo "false\n";
return false;
}
}
include qa_opt('news_plugin_loc');
return false;
} else {
if (qa_opt('news_plugin_pdf') && $requestlower && $requestlower === qa_opt('news_plugin_request_pdf')) {
$pdf = file_get_contents(qa_opt('news_plugin_loc_pdf'));
header('Content-Description: File Transfer');
header('Cache-Control: public, must-revalidate, max-age=0');
// HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// force download dialog
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream', false);
header('Content-Type: application/download', false);
header('Content-Type: application/pdf', false);
// use the Content-Disposition header to supply a recommended filename
header('Content-Disposition: attachment; filename="' . basename(qa_opt('news_plugin_loc_pdf')) . '";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($pdf));
echo $pdf;
return false;
}
}
}
}
return qa_get_request_content_base();
}
示例5: match_request
function match_request($request)
{
$this->expert_user = $this->is_expert_user();
$expert = qa_opt('expert_question_page_url');
if ($request == $expert && $this->expert_user) {
return true;
}
if ($request == $expert) {
qa_redirect('ask', array(qa_opt('expert_question_page_url') => 'true'));
}
return false;
}
示例6: doctype
function doctype()
{
if (qa_post_text('merge_from') && qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
$merged = qa_merge_do_merge();
if ($merged === true) {
qa_redirect(qa_q_request(qa_post_text('merge_to'), null), array('merged' => qa_post_text('merge_from')));
} else {
$error1 = $merged[0];
$error2 = $merged[1];
$this->content['error'] = "Error merging posts.";
}
}
qa_html_theme_base::doctype();
}
示例7: process_request
function process_request($request)
{
$parts = explode('/', $request);
$tag = $parts[1];
$qa_content = qa_content_prepare();
$qa_content['title'] = 'Edit the description for Fture test ' . qa_html($tag);
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('type' => 'text', 'rows' => 4, 'tags' => 'NAME="tagdesc" ID="tagdesc"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'description')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => 'Save Description')));
if (qa_clicked('dosave')) {
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$taglc = qa_strtolower($tag);
qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
qa_redirect('tag/' . $tag);
}
$qa_content['focusid'] = 'tagdesc';
return $qa_content;
}
示例8: doctype
function doctype()
{
if (@$this->content['error'] == qa_lang_html('main/page_not_found') && preg_match('/^[0-9]+\\//', $this->request) !== false) {
$pid = preg_replace('/\\/.*/', '', $this->request);
$merged = qa_db_read_one_assoc(qa_db_query_sub("SELECT ^posts.postid as postid,^posts.title as title FROM ^postmeta, ^posts WHERE ^postmeta.meta_key='merged_with' AND ^postmeta.post_id=# AND ^posts.postid=^postmeta.meta_value", $pid), true);
if ($merged) {
qa_redirect(qa_q_request($merged['postid'], $merged['title']), array('merged' => $pid));
}
} else {
if (qa_get('merged')) {
$this->content['error'] = str_replace('^post', qa_get('merged'), qa_opt('merge_question_merged'));
}
}
if (qa_post_text('ajax_merge_get_from')) {
return;
}
qa_html_theme_base::doctype();
}
示例9: process_request
function process_request($request)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
require_once QA_INCLUDE_DIR . 'qa-db-post-create.php';
require_once QA_INCLUDE_DIR . 'mp-db-users.php';
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING']));
// create the editor and update its content
qa_get_post_content('editor', 'content', $ineditor, $incontent, $informat, $intext);
$editorname = isset($ineditor) ? $ineditor : qa_opt('editor_for_qs');
$editor = qa_load_editor(@$incontent, @$informat, $editorname);
// retrieve variable data
$innotify = qa_post_text('notify') ? true : false;
// handle creation of annoucement
if (qa_post_text('docreate')) {
//retrieve data
$title = qa_post_text('title');
$content = $incontent;
$format = $informat;
// validate data
// handle create work
// actual create process is in file mp-app-posts.php
$postid = qa_post_create('AN', null, $title, $content, $format, mp_get_categoryid(), null, qa_get_logged_in_userid(), $innotify);
// redirect page
qa_redirect('mp-announcements-page');
// our work is done here
}
$qa_content = qa_content_prepare();
// if the user is not logged in, request user to login
if (!qa_get_logged_in_userid()) {
$qa_content['error'] = qa_insert_login_links('Please ^1log in^2 or ^3register^4 first.', $request);
return $qa_content;
}
$qa_content['title'] = 'Create Announcement';
$qa_content['form_newannouncement'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('title' => array('label' => qa_lang_html('announcements/a_title_label'), 'tags' => 'NAME="title"', 'value' => qa_html(qa_post_text('title')), 'error' => qa_html(@$errors['title'])), 'content' => array_merge($editor->get_field($qa_content, @$incontent, @$informat, 'content', 12, false), array('label' => qa_lang_html('announcements/a_content_label'), 'error' => qa_html(@$errors['content']))), 'notify' => array('label' => 'Send email notification to all registered students', 'tags' => 'NAME="notify"', 'type' => 'checkbox', 'value' => qa_html($innotify))), 'buttons' => array('ok' => array('tags' => 'NAME="docreate"', 'label' => 'Create Announcement', 'value' => '1')), 'hidden' => array('hiddenfield' => '1', 'editor' => qa_html($editorname)));
// create the sub menu for navigation
$qa_content['navigation']['sub'] = mp_announcements_sub_navigation();
$qa_content['navigation']['sub']['create']['selected'] = true;
return $qa_content;
}
示例10: process_request
function process_request($request)
{
require_once QA_INCLUDE_DIR . "qa-base.php";
$expire = 14 * 24 * 60 * 60;
if (isset($_SESSION['logout_url'])) {
$tourl = $_SESSION['logout_url'];
} else {
$tourl = false;
}
if (isset($_COOKIE["qa-login_fname"])) {
setcookie("qa-login_fname", '1', time() - $expire, '/');
setcookie("qa-login_lname", '1', time() - $expire, '/');
setcookie("qa-login_email", '1', time() - $expire, '/');
}
session_destroy();
if (!$tourl) {
qa_redirect('logout');
} else {
header('Location: ' . $tourl);
}
return null;
}
示例11: admin_form
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('theme_switch_save')) {
if (!qa_post_text('theme_switch_enable')) {
qa_opt('site_theme', qa_opt('theme_switch_default'));
}
qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^usermeta (
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
user_id bigint(20) unsigned NOT NULL,
meta_key varchar(255) DEFAULT NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
UNIQUE (user_id,meta_key)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
qa_opt('theme_switch_enable', (bool) qa_post_text('theme_switch_enable'));
qa_opt('theme_switch_default', qa_post_text('theme_switch_default'));
qa_opt('theme_switch_title', qa_post_text('theme_switch_title'));
qa_opt('theme_switch_text', qa_post_text('theme_switch_text'));
qa_opt('theme_switch_enable_mobile', (bool) qa_post_text('theme_switch_enable_mobile'));
qa_opt('theme_switch_mobile', qa_post_text('theme_switch_mobile'));
global $qa_request;
qa_redirect($qa_request, array('ok' => qa_lang_html('admin/options_saved')));
}
// Create the form for display
$themes = qa_admin_theme_options();
$fields = array();
$fields[] = array('label' => 'Enable theme switching', 'tags' => 'NAME="theme_switch_enable"', 'value' => qa_opt('theme_switch_enable'), 'type' => 'checkbox');
$fields[] = array('label' => 'Default theme', 'tags' => 'NAME="theme_switch_default"', 'type' => 'select', 'options' => qa_admin_theme_options(), 'value' => @$themes[qa_opt('theme_switch_default')]);
$fields[] = array('label' => 'Theme switch title', 'type' => 'text', 'value' => qa_html(qa_opt('theme_switch_title')), 'tags' => 'NAME="theme_switch_title"');
$fields[] = array('label' => 'Theme switch text', 'type' => 'text', 'value' => qa_html(qa_opt('theme_switch_text')), 'tags' => 'NAME="theme_switch_text"');
if (!function_exists('qa_register_plugin_overrides')) {
// 1.4
$fields[] = array('label' => 'Enable mobile theme', 'tags' => 'NAME="theme_switch_enable_mobile"', 'value' => qa_opt('theme_switch_enable_mobile'), 'type' => 'checkbox');
$fields[] = array('label' => 'Mobile theme', 'tags' => 'NAME="theme_switch_mobile"', 'type' => 'select', 'options' => qa_admin_theme_options(), 'value' => @$themes[qa_opt('theme_switch_mobile')]);
}
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save', 'tags' => 'NAME="theme_switch_save"')));
}
示例12: process_request
function process_request($request)
{
$parts = explode('/', $request);
$tag = $parts[1];
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('useo/edit_desc_for_x', qa_html($tag));
if (qa_user_permit_error('useo_tag_desc_permit_edit')) {
$qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content;
}
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
if (qa_clicked('dosave')) {
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$taglc = qa_strtolower($tag);
qa_db_tagmeta_set($taglc, 'title', qa_post_text('tagtitle'));
qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
qa_db_tagmeta_set($taglc, 'icon', qa_post_text('tagicon'));
qa_redirect('tag/' . $tag);
}
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('label' => 'Title:', 'type' => 'text', 'rows' => 2, 'tags' => 'NAME="tagtitle" ID="tagtitle"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'title'))), array('label' => 'Description:', 'type' => 'text', 'rows' => 4, 'tags' => 'NAME="tagdesc" ID="tagdesc"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'description'))), array('label' => 'Icon image:', 'type' => 'text', 'rows' => 1, 'tags' => 'NAME="tagicon" ID="tagicon"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'icon')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => qa_lang_html('useo/save_desc_button'))));
$qa_content['focusid'] = 'tagdesc';
return $qa_content;
}
示例13: process_request
function process_request($request)
{
$start = qa_get_start();
$userid = qa_get_logged_in_userid();
// Prepare content for theme
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QW_CONTROL_DIR . '/addons/social-login/cs-social-login-utils.php';
if (QA_FINAL_EXTERNAL_USERS) {
qa_fatal_error('User accounts are handled by external code');
}
if (!isset($userid)) {
qa_redirect('login');
}
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('notification/my_notification_settings');
$qa_content['site_title'] = qa_opt('site_title');
if (qa_clicked('save_notf_user_settings')) {
$data_to_save = array('qw_mail_when_a_post' => !!qa_post_text('qw_mail_when_a_post'), 'qw_mail_when_related' => !!qa_post_text('qw_mail_when_related'), 'qw_mail_when_c_post' => !!qa_post_text('qw_mail_when_c_post'), 'qw_mail_when_q_reshow' => !!qa_post_text('qw_mail_when_q_reshow'), 'qw_mail_when_c_reshow' => !!qa_post_text('qw_mail_when_c_reshow'), 'qw_mail_when_a_select' => !!qa_post_text('qw_mail_when_a_select'), 'qw_mail_when_q_vote_up' => !!qa_post_text('qw_mail_when_q_vote_up'), 'qw_mail_when_q_vote_down' => !!qa_post_text('qw_mail_when_q_vote_down'), 'qw_mail_when_a_vote_up' => !!qa_post_text('qw_mail_when_a_vote_up'), 'qw_mail_when_a_vote_down' => !!qa_post_text('qw_mail_when_a_vote_down'), 'qw_mail_when_q_favorite' => !!qa_post_text('qw_mail_when_q_favorite'), 'qw_mail_when_u_favorite' => !!qa_post_text('qw_mail_when_u_favorite'), 'qw_mail_when_u_message' => !!qa_post_text('qw_mail_when_u_message'), 'qw_mail_when_u_wall_post' => !!qa_post_text('qw_mail_when_u_wall_post'), 'qw_mail_when_u_level' => !!qa_post_text('qw_mail_when_u_level'), 'qw_mail_when_q_post_user_fl' => !!qa_post_text('qw_mail_when_q_post_user_fl'), 'qw_mail_when_q_post_tag_fl' => !!qa_post_text('qw_mail_when_q_post_tag_fl'), 'qw_mail_when_q_post_cat_fl' => !!qa_post_text('qw_mail_when_q_post_cat_fl'), 'qw_mail_when_q_approve' => !!qa_post_text('qw_mail_when_q_approve'), 'qw_mail_when_q_reject' => !!qa_post_text('qw_mail_when_q_reject'), 'qw_mail_when_a_approve' => !!qa_post_text('qw_mail_when_a_approve'), 'qw_mail_when_a_reject' => !!qa_post_text('qw_mail_when_a_reject'), 'qw_mail_when_c_approve' => !!qa_post_text('qw_mail_when_c_approve'), 'qw_mail_when_c_reject' => !!qa_post_text('qw_mail_when_c_reject'));
qw_save_notification_settings(json_encode($data_to_save), $userid);
qa_redirect('notification-settings', array('state' => 'settings-saved'));
}
$disp_conf = qa_get('confirm');
$preferences = qw_get_notification_settings($userid);
// qw_log(print_r(qw_check_pref_for_event($userid , 'a_post') , true )) ;
if (!$disp_conf) {
// display some summary about the user
$qa_content['form_profile'] = array('title' => qa_lang_html('notification/my_notification_settings'), 'tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '" CLASS="social-login-settings"', 'style' => 'wide', 'buttons' => array('check_all' => array('type' => 'button', 'tags' => 'name="check_all_notf_fields" id="check_all_notf_fields" ', 'label' => qa_lang_html('notification/check_all')), 'uncheck_all' => array('type' => 'button', 'tags' => 'name="un_check_all_notf_fields" id="un_check_all_notf_fields" ', 'label' => qa_lang_html('notification/uncheck_all')), 'save' => array('tags' => 'onClick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('notification/save_settings'))), 'fields' => array('qw_mail_when_a_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_post_lable'), 'tags' => 'NAME="qw_mail_when_a_post"', 'value' => @$preferences['qw_mail_when_a_post'] ? true : false), 'qw_mail_when_related' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_related_lable'), 'tags' => 'NAME="qw_mail_when_related"', 'value' => @$preferences['qw_mail_when_related'] ? true : false), 'qw_mail_when_c_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_post_lable'), 'tags' => 'NAME="qw_mail_when_c_post"', 'value' => @$preferences['qw_mail_when_c_post'] ? true : false), 'qw_mail_when_q_reshow' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_reshow_lable'), 'tags' => 'NAME="qw_mail_when_q_reshow"', 'value' => @$preferences['qw_mail_when_q_reshow'] ? true : false), 'qw_mail_when_c_reshow' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_reshow_lable'), 'tags' => 'NAME="qw_mail_when_c_reshow"', 'value' => @$preferences['qw_mail_when_c_reshow'] ? true : false), 'qw_mail_when_a_select' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_select_lable'), 'tags' => 'NAME="qw_mail_when_a_select"', 'value' => @$preferences['qw_mail_when_a_select'] ? true : false), 'qw_mail_when_q_vote_up' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_vote_up_lable'), 'tags' => 'NAME="qw_mail_when_q_vote_up"', 'value' => @$preferences['qw_mail_when_q_vote_up'] ? true : false), 'qw_mail_when_q_vote_down' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_vote_down_lable'), 'tags' => 'NAME="qw_mail_when_q_vote_down"', 'value' => @$preferences['qw_mail_when_q_vote_down'] ? true : false), 'qw_mail_when_a_vote_up' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_vote_up_lable'), 'tags' => 'NAME="qw_mail_when_a_vote_up"', 'value' => @$preferences['qw_mail_when_a_vote_up'] ? true : false), 'qw_mail_when_a_vote_down' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_vote_down_lable'), 'tags' => 'NAME="qw_mail_when_a_vote_down"', 'value' => @$preferences['qw_mail_when_a_vote_down'] ? true : false), 'qw_mail_when_q_favorite' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_favorite_lable'), 'tags' => 'NAME="qw_mail_when_q_favorite"', 'value' => @$preferences['qw_mail_when_q_favorite'] ? true : false), 'qw_mail_when_u_favorite' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_favorite_lable'), 'tags' => 'NAME="qw_mail_when_u_favorite"', 'value' => @$preferences['qw_mail_when_u_favorite'] ? true : false), 'qw_mail_when_u_message' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_message_lable'), 'tags' => 'NAME="qw_mail_when_u_message"', 'value' => @$preferences['qw_mail_when_u_message'] ? true : false), 'qw_mail_when_u_wall_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_wall_post_lable'), 'tags' => 'NAME="qw_mail_when_u_wall_post"', 'value' => @$preferences['qw_mail_when_u_wall_post'] ? true : false), 'qw_mail_when_u_level' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_level_lable'), 'tags' => 'NAME="qw_mail_when_u_level"', 'value' => @$preferences['qw_mail_when_u_level'] ? true : false), 'qw_mail_when_q_post_user_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_user_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_user_fl"', 'value' => @$preferences['qw_mail_when_q_post_user_fl'] ? true : false), 'qw_mail_when_q_post_tag_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_tag_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_tag_fl"', 'value' => @$preferences['qw_mail_when_q_post_tag_fl'] ? true : false), 'qw_mail_when_q_post_cat_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_cat_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_cat_fl"', 'value' => @$preferences['qw_mail_when_q_post_cat_fl'] ? true : false), 'qw_mail_when_q_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_approve_lable'), 'tags' => 'NAME="qw_mail_when_q_approve"', 'value' => @$preferences['qw_mail_when_q_approve'] ? true : false), 'qw_mail_when_q_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_reject_lable'), 'tags' => 'NAME="qw_mail_when_q_reject"', 'value' => @$preferences['qw_mail_when_q_reject'] ? true : false), 'qw_mail_when_a_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_approve_lable'), 'tags' => 'NAME="qw_mail_when_a_approve"', 'value' => @$preferences['qw_mail_when_a_approve'] ? true : false), 'qw_mail_when_a_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_reject_lable'), 'tags' => 'NAME="qw_mail_when_a_reject"', 'value' => @$preferences['qw_mail_when_a_reject'] ? true : false), 'qw_mail_when_c_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_approve_lable'), 'tags' => 'NAME="qw_mail_when_c_approve"', 'value' => @$preferences['qw_mail_when_c_approve'] ? true : false), 'qw_mail_when_c_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_reject_lable'), 'tags' => 'NAME="qw_mail_when_c_reject"', 'value' => @$preferences['qw_mail_when_c_reject'] ? true : false)), 'hidden' => array('save_notf_user_settings' => '1'));
if (qa_get_state() == 'settings-saved') {
$qa_content['form_profile']['ok'] = qa_lang_html('notification/settings_saved');
}
}
$qa_content['navigation']['sub'] = qa_account_sub_navigation();
return $qa_content;
}
示例14: process_request
function process_request($request)
{
$parts = explode('/', $request);
$categoryid = $parts[1];
$fullcategory = qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true));
$slugs = explode('/', $fullcategory['backpath']);
$new_request = implode('/', array_reverse($slugs));
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('useo/edit_desc_for_x', qa_html($fullcategory['title']));
if (qa_user_permit_error('useo_cat_desc_permit_edit')) {
$qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content;
}
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
if (qa_clicked('dosave')) {
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
qa_db_categorymeta_set($categoryid, 'useo_cat_title', qa_post_text('useo_cat_title'));
qa_db_categorymeta_set($categoryid, 'useo_cat_description', qa_post_text('useo_cat_description'));
qa_redirect($new_request);
}
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('label' => 'Link Title:', 'type' => 'text', 'rows' => 2, 'tags' => 'NAME="useo_cat_title" ID="useo_cat_title"', 'value' => qa_html(qa_db_categorymeta_get($categoryid, 'useo_cat_title'))), array('label' => 'Description:', 'type' => 'text', 'rows' => 4, 'tags' => 'NAME="useo_cat_description" ID="useo_cat_description"', 'value' => qa_html(qa_db_categorymeta_get($categoryid, 'useo_cat_description')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => qa_lang_html('useo/save_desc_button'))));
$qa_content['focusid'] = 'tagtitle';
return $qa_content;
}
示例15: qa_page_q_refresh
function qa_page_q_refresh($start = 0, $state = null, $showtype = null, $showid = null)
{
$params = array();
if ($start > 0) {
$params['start'] = $start;
}
if (isset($state)) {
$params['state'] = $state;
}
if (isset($showtype) && isset($showid)) {
$anchor = qa_anchor($showtype, $showid);
$params['show'] = $showid;
} else {
$anchor = null;
}
qa_redirect(qa_request(), $params, null, null, $anchor);
}