• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP validateToken函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中validateToken函数的典型用法代码示例。如果您正苦于以下问题:PHP validateToken函数的具体用法?PHP validateToken怎么用?PHP validateToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了validateToken函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     parent::run();
     $this->getInputJson();
     if (!($token = validateToken($this->input['token']))) {
         throw new \Exception("Invalid token.");
     }
     //TODO: delete global somehow
     global $user;
     $user = new \User($token['uid']);
     if (isset($this->input['remove'])) {
         if (!$user->removeFavorites($this->input['remove'])) {
             throw new \Exception("Could not remove favorites.");
         }
     }
     if (isset($this->input['add'])) {
         if (!$user->addFavorites($this->input['add'])) {
             throw new \Exception("Could not add favorites.");
         }
     }
     $favorites = array();
     $user->getFavorites();
     foreach ($user->favorites as $favorite) {
         $favorites[] = $favorite['tid'];
     }
     $this->return['favorites'] = $favorites;
 }
开发者ID:kolesar-andras,项目名称:miserend.hu,代码行数:27,代码来源:Favorites.php


示例2: ModifyHolidays

/**
 * The function that handles adding, and deleting holiday data
 */
function ModifyHolidays()
{
    global $sourcedir, $scripturl, $txt, $context;
    // Submitting something...
    if (isset($_REQUEST['delete']) && !empty($_REQUEST['holiday'])) {
        checkSession();
        validateToken('admin-mc');
        foreach ($_REQUEST['holiday'] as $id => $value) {
            $_REQUEST['holiday'][$id] = (int) $id;
        }
        // Now the IDs are "safe" do the delete...
        require_once $sourcedir . '/Subs-Calendar.php';
        removeHolidays($_REQUEST['holiday']);
    }
    createToken('admin-mc');
    $listOptions = array('id' => 'holiday_list', 'title' => $txt['current_holidays'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=managecalendar;sa=holidays', 'default_sort_col' => 'name', 'get_items' => array('file' => $sourcedir . '/Subs-Calendar.php', 'function' => 'list_getHolidays'), 'get_count' => array('file' => $sourcedir . '/Subs-Calendar.php', 'function' => 'list_getNumHolidays'), 'no_items_label' => $txt['holidays_no_entries'], 'columns' => array('name' => array('header' => array('value' => $txt['holidays_title']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=admin;area=managecalendar;sa=editholiday;holiday=%1$d">%2$s</a>', 'params' => array('id_holiday' => false, 'title' => false))), 'sort' => array('default' => 'title', 'reverse' => 'title DESC')), 'date' => array('header' => array('value' => $txt['date']), 'data' => array('function' => create_function('$rowData', '
						global $txt;

						// Recurring every year or just a single year?
						$year = $rowData[\'year\'] == \'0004\' ? sprintf(\'(%1$s)\', $txt[\'every_year\']) : $rowData[\'year\'];

						// Construct the date.
						return sprintf(\'%1$d %2$s %3$s\', $rowData[\'day\'], $txt[\'months\'][(int) $rowData[\'month\']], $year);
					')), 'sort' => array('default' => 'event_date', 'reverse' => 'event_date DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('sprintf' => array('format' => '<input type="checkbox" name="holiday[%1$d]" class="input_check" />', 'params' => array('id_holiday' => false)), 'style' => 'text-align: center'))), 'form' => array('href' => $scripturl . '?action=admin;area=managecalendar;sa=holidays', 'token' => 'admin-mc'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '

					<input type="submit" name="delete" value="' . $txt['quickmod_delete_selected'] . '" class="button_submit" />
					<a class="button_link" href="' . $scripturl . '?action=admin;area=managecalendar;sa=editholiday" style="margin: 0 1em">' . $txt['holidays_add'] . '</a>', 'style' => 'text-align: right;')));
    require_once $sourcedir . '/Subs-List.php';
    createList($listOptions);
    //loadTemplate('ManageCalendar');
    $context['page_title'] = $txt['manage_holidays'];
    // Since the list is the only thing to show, use the default list template.
    $context['default_list'] = 'holiday_list';
    $context['sub_template'] = 'show_list';
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:38,代码来源:ManageCalendar.php


示例3: action_holidays

    /**
     * The function that handles adding, and deleting holiday data
     */
    public function action_holidays()
    {
        global $scripturl, $txt, $context;
        // Submitting something...
        if (isset($_REQUEST['delete']) && !empty($_REQUEST['holiday'])) {
            checkSession();
            validateToken('admin-mc');
            $to_remove = array_map('intval', array_keys($_REQUEST['holiday']));
            // Now the IDs are "safe" do the delete...
            require_once SUBSDIR . '/Calendar.subs.php';
            removeHolidays($to_remove);
        }
        createToken('admin-mc');
        $listOptions = array('id' => 'holiday_list', 'title' => $txt['current_holidays'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=managecalendar;sa=holidays', 'default_sort_col' => 'name', 'get_items' => array('file' => SUBSDIR . '/Calendar.subs.php', 'function' => 'list_getHolidays'), 'get_count' => array('file' => SUBSDIR . '/Calendar.subs.php', 'function' => 'list_getNumHolidays'), 'no_items_label' => $txt['holidays_no_entries'], 'columns' => array('name' => array('header' => array('value' => $txt['holidays_title']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=admin;area=managecalendar;sa=editholiday;holiday=%1$d">%2$s</a>', 'params' => array('id_holiday' => false, 'title' => false))), 'sort' => array('default' => 'title', 'reverse' => 'title DESC')), 'date' => array('header' => array('value' => $txt['date']), 'data' => array('function' => create_function('$rowData', '
							global $txt;

							// Recurring every year or just a single year?
							$year = $rowData[\'year\'] == \'0004\' ? sprintf(\'(%1$s)\', $txt[\'every_year\']) : $rowData[\'year\'];

							// Construct the date.
							return sprintf(\'%1$d %2$s %3$s\', $rowData[\'day\'], $txt[\'months\'][(int) $rowData[\'month\']], $year);
						')), 'sort' => array('default' => 'event_date', 'reverse' => 'event_date DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />', 'class' => 'centertext'), 'data' => array('sprintf' => array('format' => '<input type="checkbox" name="holiday[%1$d]" class="input_check" />', 'params' => array('id_holiday' => false)), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=managecalendar;sa=holidays', 'token' => 'admin-mc'), 'additional_rows' => array(array('position' => 'below_table_data', 'class' => 'submitbutton', 'value' => '<input type="submit" name="delete" value="' . $txt['quickmod_delete_selected'] . '" class="right_submit" onclick="return confirm(\'' . $txt['holidays_delete_confirm'] . '\');" />
					<a class="linkbutton" href="' . $scripturl . '?action=admin;area=managecalendar;sa=editholiday">' . $txt['holidays_add'] . '</a>')));
        require_once SUBSDIR . '/GenericList.class.php';
        createList($listOptions);
        $context['page_title'] = $txt['manage_holidays'];
    }
开发者ID:scripple,项目名称:Elkarte,代码行数:30,代码来源:ManageCalendar.controller.php


示例4: SetCensor

/**
 * Shows an interface to set and test censored words.
 * It uses the censor_vulgar, censor_proper, censorWholeWord, and censorIgnoreCase
 * settings.
 * Requires the admin_forum permission.
 * Accessed from ?action=admin;area=postsettings;sa=censor.
 *
 * @uses the Admin template and the edit_censored sub template.
 */
function SetCensor()
{
    global $txt, $modSettings, $context, $smcFunc, $sourcedir;
    if (!empty($_POST['save_censor'])) {
        // Make sure censoring is something they can do.
        checkSession();
        validateToken('admin-censor');
        $censored_vulgar = array();
        $censored_proper = array();
        // Rip it apart, then split it into two arrays.
        if (isset($_POST['censortext'])) {
            $_POST['censortext'] = explode("\n", strtr($_POST['censortext'], array("\r" => '')));
            foreach ($_POST['censortext'] as $c) {
                list($censored_vulgar[], $censored_proper[]) = array_pad(explode('=', trim($c)), 2, '');
            }
        } elseif (isset($_POST['censor_vulgar'], $_POST['censor_proper'])) {
            if (is_array($_POST['censor_vulgar'])) {
                foreach ($_POST['censor_vulgar'] as $i => $value) {
                    if (trim(strtr($value, '*', ' ')) == '') {
                        unset($_POST['censor_vulgar'][$i], $_POST['censor_proper'][$i]);
                    }
                }
                $censored_vulgar = $_POST['censor_vulgar'];
                $censored_proper = $_POST['censor_proper'];
            } else {
                $censored_vulgar = explode("\n", strtr($_POST['censor_vulgar'], array("\r" => '')));
                $censored_proper = explode("\n", strtr($_POST['censor_proper'], array("\r" => '')));
            }
        }
        // Set the new arrays and settings in the database.
        $updates = array('censor_vulgar' => implode("\n", $censored_vulgar), 'censor_proper' => implode("\n", $censored_proper), 'censorWholeWord' => empty($_POST['censorWholeWord']) ? '0' : '1', 'censorIgnoreCase' => empty($_POST['censorIgnoreCase']) ? '0' : '1');
        call_integration_hook('integrate_save_censors', array(&$updates));
        updateSettings($updates);
    }
    if (isset($_POST['censortest'])) {
        require_once $sourcedir . '/Subs-Post.php';
        $censorText = htmlspecialchars($_POST['censortest'], ENT_QUOTES);
        preparsecode($censorText);
        $context['censor_test'] = strtr(censorText($censorText), array('"' => '&quot;'));
    }
    // Set everything up for the template to do its thang.
    $censor_vulgar = explode("\n", $modSettings['censor_vulgar']);
    $censor_proper = explode("\n", $modSettings['censor_proper']);
    $context['censored_words'] = array();
    for ($i = 0, $n = count($censor_vulgar); $i < $n; $i++) {
        if (empty($censor_vulgar[$i])) {
            continue;
        }
        // Skip it, it's either spaces or stars only.
        if (trim(strtr($censor_vulgar[$i], '*', ' ')) == '') {
            continue;
        }
        $context['censored_words'][htmlspecialchars(trim($censor_vulgar[$i]))] = isset($censor_proper[$i]) ? htmlspecialchars($censor_proper[$i]) : '';
    }
    call_integration_hook('integrate_censors');
    $context['sub_template'] = 'edit_censored';
    $context['page_title'] = $txt['admin_censored_words'];
    createToken('admin-censor');
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:68,代码来源:ManagePosts.php


示例5: validateInput

 public function validateInput()
 {
     parent::validateInput();
     if (!isset($this->input['token'])) {
         throw new \Exception("JSON input misses token.");
     }
     if (!($token = validateToken($this->input['token']))) {
         throw new \Exception("Invalid token.");
     }
 }
开发者ID:kolesar-andras,项目名称:miserend.hu,代码行数:10,代码来源:ReportByUser.php


示例6: run

 public function run()
 {
     parent::run();
     $this->getInputJson();
     if (!($token = validateToken($this->input['token']))) {
         throw new \Exception("Invalid token.");
     }
     //TODO: delete global somehow
     global $user;
     $user = new \User($token['uid']);
     $user->getFavorites();
     $data = array('username' => $user->username, 'nickname' => $user->nickname, 'name' => $user->name, 'email' => $user->email);
     foreach ($user->favorites as $favorite) {
         $data['favorites'][] = $favorite['tid'];
     }
     $this->return['user'] = $data;
 }
开发者ID:kolesar-andras,项目名称:miserend.hu,代码行数:17,代码来源:User.php


示例7: validatePrivileges

function validatePrivileges($privileges = array(), $no_error = false)
{
    return function () use($privileges, $no_error) {
        try {
            // Inicjalizacja modelu użytkownika
            $user = new \Model\User();
            // Pobranie instancji szkieletu Slim Framework
            $app = \Slim\Slim::getInstance();
            // Pobranie tokenu z pola Authorization nagłówka HTTP i jego walidacja
            $token = validateToken($app->request->headers->get('Authorization'));
            try {
                // Pobranie danych uzytkownika o zadanym tokenie
                $u = $user->getByToken($token, 'administrator');
            } catch (Exception $e) {
                throw new Exception('Użytkownik nie jest zalogowany.', 401);
            }
            // Sprawdzenie wymaganych uprawnień
            if (!in_array($u['privileges'], $privileges)) {
                throw new Exception('Brak uprawnień.', 401);
            }
            // Zapamiętanie danych potrzebnych do logowania jako zmienne globalne
            $GLOBALS['user_id'] = $u['user_id'];
            $GLOBALS['token'] = $token;
            $GLOBALS['privileges'] = $u['privileges'];
            try {
                // Jeśli różnica pomiędzy ostatnią aktywnością, a bierzącym czasem
                // wynosi 60 sekund, to odświeżamy autoryzację
                $diff = abs(strtotime(date('Y-m-d H:i:s')) - strtotime($u['last_auth']));
                if ($diff > 60) {
                    $res = $user->refreshAuth($token);
                }
            } catch (Exception $e) {
            }
        } catch (Exception $e) {
            $GLOBALS['user_id'] = -1;
            $GLOBALS['token'] = '';
            $GLOBALS['privileges'] = 'guest';
            if (!$no_error) {
                jsonError($app, $e, true);
            }
        }
    };
}
开发者ID:airwaves-pl,项目名称:WroclawskaMapaBarier,代码行数:43,代码来源:validation.php


示例8: action_modify_bounce_templates

 /**
  * Edit a 'it bounced' template.
  *
  * @uses bounce_template sub template
  */
 public function action_modify_bounce_templates()
 {
     global $context, $txt, $user_info;
     require_once SUBSDIR . '/Moderation.subs.php';
     $context['id_template'] = isset($_REQUEST['tid']) ? (int) $_REQUEST['tid'] : 0;
     $context['is_edit'] = (bool) $context['id_template'];
     // Standard template things, you know the drill
     $context['page_title'] = $context['is_edit'] ? $txt['ml_bounce_template_modify'] : $txt['ml_bounce_template_add'];
     $context['sub_template'] = 'bounce_template';
     $context[$context['admin_menu_name']]['current_subsection'] = 'templates';
     // Defaults to show
     $context['template_data'] = array('title' => '', 'body' => $txt['ml_bounce_template_body_default'], 'subject' => $txt['ml_bounce_template_subject_default'], 'personal' => false, 'can_edit_personal' => true);
     // If it's an edit load it.
     if ($context['is_edit']) {
         modLoadTemplate($context['id_template'], 'bnctpl');
     }
     // Wait, we are saving?
     if (isset($_POST['save'])) {
         checkSession('post');
         validateToken('mod-mlt');
         // To check the BBC is good...
         require_once SUBSDIR . '/Post.subs.php';
         // Bit of cleaning!
         $template_body = trim($_POST['template_body']);
         $template_title = trim($_POST['template_title']);
         // Need something in both boxes.
         if (!empty($template_body) && !empty($template_title)) {
             // Safety first.
             $template_title = Util::htmlspecialchars($template_title);
             // Clean up BBC.
             preparsecode($template_body);
             // But put line breaks back!
             $template_body = strtr($template_body, array('<br />' => "\n"));
             // Is this personal?
             $recipient_id = !empty($_POST['make_personal']) ? $user_info['id'] : 0;
             // Updating or adding ?
             if ($context['is_edit']) {
                 // Simple update...
                 modAddUpdateTemplate($recipient_id, $template_title, $template_body, $context['id_template'], true, 'bnctpl');
                 // If it wasn't visible and now is they've effectively added it.
                 if ($context['template_data']['personal'] && !$recipient_id) {
                     logAction('add_bounce_template', array('template' => $template_title));
                 } elseif (!$context['template_data']['personal'] && $recipient_id) {
                     logAction('delete_bounce_template', array('template' => $template_title));
                 } else {
                     logAction('modify_bounce_template', array('template' => $template_title));
                 }
             } else {
                 modAddUpdateTemplate($recipient_id, $template_title, $template_body, $context['id_template'], false, 'bnctpl');
                 logAction('add_bounce_template', array('template' => $template_title));
             }
             // Get out of town...
             redirectexit('action=admin;area=maillist;sa=emailtemplates');
         } else {
             $context['warning_errors'] = array();
             $context['template_data']['title'] = !empty($template_title) ? $template_title : '';
             $context['template_data']['body'] = !empty($template_body) ? $template_body : $txt['ml_bounce_template_body_default'];
             $context['template_data']['personal'] = !empty($recipient_id);
             if (empty($template_title)) {
                 $context['warning_errors'][] = $txt['ml_bounce_template_error_no_title'];
             }
             if (empty($template_body)) {
                 $context['warning_errors'][] = $txt['ml_bounce_template_error_no_body'];
             }
         }
     }
     createToken('mod-mlt');
 }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:73,代码来源:ManageMaillist.controller.php


示例9: action_contact

 /**
  * Shows the contact form for the user to fill out
  * Needs to be enabled to be used
  */
 public function action_contact()
 {
     global $context, $txt, $user_info, $modSettings;
     // Already inside, no need to use this, just send a PM
     // Disabled, you cannot enter.
     if (!$user_info['is_guest'] || empty($modSettings['enable_contactform']) || $modSettings['enable_contactform'] == 'disabled') {
         redirectexit();
     }
     loadLanguage('Login');
     loadTemplate('Register');
     if (isset($_REQUEST['send'])) {
         checkSession('post');
         validateToken('contact');
         spamProtection('contact');
         // No errors, yet.
         $context['errors'] = array();
         loadLanguage('Errors');
         // Could they get the right send topic verification code?
         require_once SUBSDIR . '/VerificationControls.class.php';
         require_once SUBSDIR . '/Members.subs.php';
         // form validation
         require_once SUBSDIR . '/DataValidator.class.php';
         $validator = new Data_Validator();
         $validator->sanitation_rules(array('emailaddress' => 'trim', 'contactmessage' => 'trim|Util::htmlspecialchars'));
         $validator->validation_rules(array('emailaddress' => 'required|valid_email', 'contactmessage' => 'required'));
         $validator->text_replacements(array('emailaddress' => $txt['error_email'], 'contactmessage' => $txt['error_message']));
         // Any form errors
         if (!$validator->validate($_POST)) {
             $context['errors'] = $validator->validation_errors();
         }
         // How about any verification errors
         $verificationOptions = array('id' => 'contactform');
         $context['require_verification'] = create_control_verification($verificationOptions, true);
         if (is_array($context['require_verification'])) {
             foreach ($context['require_verification'] as $error) {
                 $context['errors'][] = $txt['error_' . $error];
             }
         }
         // No errors, then send the PM to the admins
         if (empty($context['errors'])) {
             $admins = admins();
             if (!empty($admins)) {
                 require_once SUBSDIR . '/PersonalMessage.subs.php';
                 sendpm(array('to' => array_keys($admins), 'bcc' => array()), $txt['contact_subject'], $_REQUEST['contactmessage'], false, array('id' => 0, 'name' => $validator->emailaddress, 'username' => $validator->emailaddress));
             }
             // Send the PM
             redirectexit('action=contact;sa=done');
         } else {
             $context['emailaddress'] = $validator->emailaddress;
             $context['contactmessage'] = $validator->contactmessage;
         }
     }
     if (isset($_GET['sa']) && $_GET['sa'] == 'done') {
         $context['sub_template'] = 'contact_form_done';
     } else {
         $context['sub_template'] = 'contact_form';
         $context['page_title'] = $txt['admin_contact_form'];
         require_once SUBSDIR . '/VerificationControls.class.php';
         $verificationOptions = array('id' => 'contactform');
         $context['require_verification'] = create_control_verification($verificationOptions);
         $context['visual_verification_id'] = $verificationOptions['id'];
     }
     createToken('contact');
 }
开发者ID:Ralkage,项目名称:Elkarte,代码行数:68,代码来源:Register.controller.php


示例10: list_integration_hooks

function list_integration_hooks()
{
    global $sourcedir, $scripturl, $context, $txt, $modSettings, $settings;
    $context['filter'] = '';
    $currentHooks = get_integration_hooks();
    if (isset($_GET['filter']) && in_array($_GET['filter'], array_keys($currentHooks))) {
        $context['filter'] = ';filter=' . $_GET['filter'];
    }
    if (!empty($modSettings['handlinghooks_enabled'])) {
        if (!empty($_REQUEST['do']) && isset($_REQUEST['hook']) && isset($_REQUEST['function'])) {
            checkSession('request');
            validateToken('admin-hook', 'request');
            if ($_REQUEST['do'] == 'remove') {
                remove_integration_function($_REQUEST['hook'], urldecode($_REQUEST['function']));
            } else {
                if ($_REQUEST['do'] == 'disable') {
                    // It's a hack I know...but I'm way too lazy!!!
                    $function_remove = $_REQUEST['function'];
                    $function_add = $_REQUEST['function'] . ']';
                } else {
                    $function_remove = $_REQUEST['function'] . ']';
                    $function_add = $_REQUEST['function'];
                }
                $file = !empty($_REQUEST['includedfile']) ? urldecode($_REQUEST['includedfile']) : '';
                remove_integration_function($_REQUEST['hook'], $function_remove, $file);
                add_integration_function($_REQUEST['hook'], $function_add, $file);
                redirectexit('action=admin;area=modsettings;sa=hooks' . $context['filter']);
            }
        }
    }
    $list_options = array('id' => 'list_integration_hooks', 'title' => $txt['hooks_title_list'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=modsettings;sa=hooks' . $context['filter'] . ';' . $context['session_var'] . '=' . $context['session_id'], 'default_sort_col' => 'hook_name', 'get_items' => array('function' => 'get_integration_hooks_data'), 'get_count' => array('function' => 'get_integration_hooks_count'), 'no_items_label' => $txt['hooks_no_hooks'], 'columns' => array('hook_name' => array('header' => array('value' => $txt['hooks_field_hook_name']), 'data' => array('db' => 'hook_name'), 'sort' => array('default' => 'hook_name', 'reverse' => 'hook_name DESC')), 'function_name' => array('header' => array('value' => $txt['hooks_field_function_name']), 'data' => array('function' => create_function('$data', '
						global $txt;

						if (!empty($data[\'included_file\']))
							return $txt[\'hooks_field_function\'] . \': \' . $data[\'real_function\'] . \'<br />\' . $txt[\'hooks_field_included_file\'] . \': \' . $data[\'included_file\'];
						else
							return $data[\'real_function\'];
					')), 'sort' => array('default' => 'function_name', 'reverse' => 'function_name DESC')), 'file_name' => array('header' => array('value' => $txt['hooks_field_file_name']), 'data' => array('db' => 'file_name'), 'sort' => array('default' => 'file_name', 'reverse' => 'file_name DESC')), 'status' => array('header' => array('value' => $txt['hooks_field_hook_exists'], 'style' => 'width:3%'), 'data' => array('function' => create_function('$data', '
						global $txt, $settings, $scripturl, $context;

						$change_status = array(\'before\' => \'\', \'after\' => \'\');
						if ($data[\'can_be_disabled\'] && $data[\'status\'] != \'deny\')
						{
							$change_status[\'before\'] = \'<a href="\' . $scripturl . \'?action=admin;area=modsettings;sa=hooks;do=\' . ($data[\'enabled\'] ? \'disable\' : \'enable\') . \';hook=\' . $data[\'hook_name\'] . \';function=\' . $data[\'real_function\'] . (!empty($data[\'included_file\']) ? \';includedfile=\' . urlencode($data[\'included_file\']) : \'\') . $context[\'filter\'] . \';\' . $context[\'admin-hook_token_var\'] . \'=\' . $context[\'admin-hook_token\'] . \';\' . $context[\'session_var\'] . \'=\' . $context[\'session_id\'] . \'" onclick="return confirm(\' . javaScriptEscape($txt[\'quickmod_confirm\']) . \');">\';
							$change_status[\'after\'] = \'</a>\';
						}
						return $change_status[\'before\'] . \'<img src="\' . $settings[\'images_url\'] . \'/admin/post_moderation_\' . $data[\'status\'] . \'.png" alt="\' . $data[\'img_text\'] . \'" title="\' . $data[\'img_text\'] . \'" />\' . $change_status[\'after\'];
					'), 'class' => 'centertext'), 'sort' => array('default' => 'status', 'reverse' => 'status DESC'))), 'additional_rows' => array(array('position' => 'after_title', 'value' => $txt['hooks_disable_instructions'] . '<br />
					' . $txt['hooks_disable_legend'] . ':
									<ul style="list-style: none;">
					<li><img src="' . $settings['images_url'] . '/admin/post_moderation_allow.png" alt="' . $txt['hooks_active'] . '" title="' . $txt['hooks_active'] . '" /> ' . $txt['hooks_disable_legend_exists'] . '</li>
					<li><img src="' . $settings['images_url'] . '/admin/post_moderation_moderate.png" alt="' . $txt['hooks_disabled'] . '" title="' . $txt['hooks_disabled'] . '" /> ' . $txt['hooks_disable_legend_disabled'] . '</li>
					<li><img src="' . $settings['images_url'] . '/admin/post_moderation_deny.png" alt="' . $txt['hooks_missing'] . '" title="' . $txt['hooks_missing'] . '" /> ' . $txt['hooks_disable_legend_missing'] . '</li>
				</ul>')));
    if (!empty($modSettings['handlinghooks_enabled'])) {
        createToken('admin-hook', 'request');
        $list_options['columns']['remove'] = array('header' => array('value' => $txt['hooks_button_remove'], 'style' => 'width:3%'), 'data' => array('function' => create_function('$data', '
					global $txt, $settings, $scripturl, $context;

					if (!$data[\'hook_exists\'])
						return \'
						<a href="\' . $scripturl . \'?action=admin;area=modsettings;sa=hooks;do=remove;hook=\' . $data[\'hook_name\'] . \';function=\' . urlencode($data[\'function_name\']) . $context[\'filter\'] . \';\' . $context[\'admin-hook_token_var\'] . \'=\' . $context[\'admin-hook_token\'] . \';\' . $context[\'session_var\'] . \'=\' . $context[\'session_id\'] . \'" onclick="return confirm(\' . javaScriptEscape($txt[\'quickmod_confirm\']) . \');">
							<img src="\' . $settings[\'images_url\'] . \'/icons/quick_remove.png" alt="\' . $txt[\'hooks_button_remove\'] . \'" title="\' . $txt[\'hooks_button_remove\'] . \'" />
						</a>\';
				'), 'class' => 'centertext'));
        $list_options['form'] = array('href' => $scripturl . '?action=admin;area=modsettings;sa=hooks' . $context['filter'] . ';' . $context['session_var'] . '=' . $context['session_id'], 'name' => 'list_integration_hooks');
    }
    require_once $sourcedir . '/Subs-List.php';
    createList($list_options);
    $context['page_title'] = $txt['hooks_title_list'];
    $context['sub_template'] = 'show_list';
    $context['default_list'] = 'list_integration_hooks';
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:73,代码来源:ManageSettings.php


示例11: checkToken

function checkToken()
{
    if (isset($_POST["reg-borrower"])) {
        return true;
        // capcha support already there
        //return validateToken('reg-borrower');
    } else {
        if (isset($_POST["reg-lender"])) {
            return true;
            // capcha support already there
            //return validateToken('reg-lender');
        } else {
            if (isset($_POST['reg-partner'])) {
                return true;
                // capcha support already there
                //return validateToken('reg-partner');
            } else {
                if (isset($_POST["userlogin"])) {
                    return true;
                    //return validateToken('userlogin');
                } else {
                    if (isset($_POST['loanapplication'])) {
                        return validateToken('loanapplication');
                    } else {
                        if (isset($_POST['editloanapplication'])) {
                            return validateToken('editloanapplication');
                        } else {
                            if (isset($_POST['exrate'])) {
                                return validateToken('exrate');
                            } else {
                                if (isset($_POST['amt_entered'])) {
                                    return validateToken('amt_entered');
                                } else {
                                    if (isset($_POST['confirmApplication'])) {
                                        return validateToken('confirmApplication');
                                    } else {
                                        if (isset($_POST['lenderbid'])) {
                                            return validateToken('lenderbid');
                                        } else {
                                            if (isset($_POST['lenderbidUp'])) {
                                                return validateToken('lenderbidUp');
                                            } else {
                                                if (isset($_POST['minfundamount'])) {
                                                    return validateToken('minfundamount');
                                                } else {
                                                    if (isset($_POST['activatePartner'])) {
                                                        return validateToken('activatePartner');
                                                    } else {
                                                        if (isset($_POST['deactivatePartner'])) {
                                                            return validateToken('deactivatePartner');
                                                        } else {
                                                            if (isset($_POST['activateLender'])) {
                                                                return validateToken('activateLender');
                                                            } else {
                                                                if (isset($_POST['deactivateLender'])) {
                                                                    return validateToken('deactivateLender');
                                                                } else {
                                                                    if (isset($_POST['deactivateBorrower'])) {
                                                                        return validateToken('deactivateBorrower');
                                                                    } else {
                                                                        if (isset($_POST['deleteBorrower'])) {
                                                                            return validateToken('deleteBorrower');
                                                                        } else {
                                                                            if (isset($_POST['deletePartner'])) {
                                                                                return validateToken('deletePartner');
                                                                            } else {
                                                                                if (isset($_POST['deleteLender'])) {
                                                                                    return validateToken('deleteLender');
                                                                                } else {
                                                                                    if (isset($_POST['makeLoanExpire'])) {
                                                                                        return validateToken('makeLoanExpire');
                                                                                    } else {
                                                                                        if (isset($_POST['makeLoanActive'])) {
                                                                                            return validateToken('makeLoanActive');
                                                                                        } else {
                                                                                            if (isset($_POST['sendbulkmails'])) {
                                                                                                return validateToken('sendbulkmails');
                                                                                            } else {
                                                                                                if (isset($_POST['addpaymenttolender'])) {
                                                                                                    return validateToken('addpaymenttolender');
                                                                                                } else {
                                                                                                    if (isset($_POST['adddonationtolender'])) {
                                                                                                        return validateToken('adddonationtolender');
                                                                                                    } else {
                                                                                                        if (isset($_POST['changePassword'])) {
                                                                                                            return validateToken('changePassword');
                                                                                                        } else {
                                                                                                            if (isset($_POST['forgiveShare'])) {
                                                                                                                return validateToken('forgiveShare');
                                                                                                            } else {
                                                                                                                if (isset($_POST['assignedPartner'])) {
                                                                                                                    return true;
                                                                                                                } else {
                                                                                                                    if (isset($_POST['referral'])) {
                                                                                                                        return validateToken('referral');
                                                                                                                    } else {
                                                                                                                        if (isset($_POST['add-repayment_instruction'])) {
                                                                                                                            return validateToken('add-repayment_instruction');
                                                                                                                        }
                                                                                                                    }
//.........这里部分代码省略.........
开发者ID:mickdane,项目名称:zidisha,代码行数:101,代码来源:csrf.php


示例12: TaskLog

/**
 * Show the log of all tasks that have taken place.
 *
 * @uses ManageScheduledTasks language file
 */
function TaskLog()
{
    global $scripturl, $context, $txt, $smcFunc, $sourcedir;
    // Lets load the language just incase we are outside the Scheduled area.
    loadLanguage('ManageScheduledTasks');
    // Empty the log?
    if (!empty($_POST['removeAll'])) {
        checkSession();
        validateToken('admin-tl');
        $smcFunc['db_query']('truncate_table', '
			TRUNCATE {db_prefix}log_scheduled_tasks', array());
    }
    // Setup the list.
    $listOptions = array('id' => 'task_log', 'items_per_page' => 30, 'title' => $txt['scheduled_log'], 'no_items_label' => $txt['scheduled_log_empty'], 'base_href' => $context['admin_area'] == 'scheduledtasks' ? $scripturl . '?action=admin;area=scheduledtasks;sa=tasklog' : $scripturl . '?action=admin;area=logs;sa=tasklog', 'default_sort_col' => 'date', 'get_items' => array('function' => 'list_getTaskLogEntries'), 'get_count' => array('function' => 'list_getNumTaskLogEntries'), 'columns' => array('name' => array('header' => array('value' => $txt['scheduled_tasks_name']), 'data' => array('db' => 'name')), 'date' => array('header' => array('value' => $txt['scheduled_log_time_run']), 'data' => array('function' => create_function('$rowData', '
						return timeformat($rowData[\'time_run\'], true);
					')), 'sort' => array('default' => 'lst.id_log DESC', 'reverse' => 'lst.id_log')), 'time_taken' => array('header' => array('value' => $txt['scheduled_log_time_taken']), 'data' => array('sprintf' => array('format' => $txt['scheduled_log_time_taken_seconds'], 'params' => array('time_taken' => false))), 'sort' => array('default' => 'lst.time_taken', 'reverse' => 'lst.time_taken DESC'))), 'form' => array('href' => $context['admin_area'] == 'scheduledtasks' ? $scripturl . '?action=admin;area=scheduledtasks;sa=tasklog' : $scripturl . '?action=admin;area=logs;sa=tasklog', 'token' => 'admin-tl'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '
					<input type="submit" name="removeAll" value="' . $txt['scheduled_log_empty_log'] . '" onclick="return confirm(\'' . $txt['scheduled_log_empty_log_confirm'] . '\');" class="button_submit" />', 'style' => 'text-align: right;'), array('position' => 'after_title', 'value' => $txt['scheduled_tasks_time_offset'], 'class' => 'windowbg2')));
    createToken('admin-tl');
    require_once $sourcedir . '/Subs-List.php';
    createList($listOptions);
    $context['sub_template'] = 'show_list';
    $context['default_list'] = 'task_log';
    // Make it all look tify.
    $context[$context['admin_menu_name']]['current_subsection'] = 'tasklog';
    $context['page_title'] = $txt['scheduled_log'];
}
开发者ID:albertlast,项目名称:SMF2.1,代码行数:31,代码来源:ManageScheduledTasks.php


示例13: action_log

    /**
     * Show the log of all tasks that have taken place.
     *
     * @uses ManageScheduledTasks language file
     */
    public function action_log()
    {
        global $scripturl, $context, $txt;
        require_once SUBSDIR . '/ScheduledTasks.subs.php';
        // Lets load the language just in case we are outside the Scheduled area.
        loadLanguage('ManageScheduledTasks');
        // Empty the log?
        if (!empty($_POST['removeAll'])) {
            checkSession();
            validateToken('admin-tl');
            emptyTaskLog();
        }
        // Setup the list.
        $listOptions = array('id' => 'task_log', 'items_per_page' => 30, 'title' => $txt['scheduled_log'], 'no_items_label' => $txt['scheduled_log_empty'], 'base_href' => $context['admin_area'] == 'scheduledtasks' ? $scripturl . '?action=admin;area=scheduledtasks;sa=tasklog' : $scripturl . '?action=admin;area=logs;sa=tasklog', 'default_sort_col' => 'date', 'get_items' => array('function' => array($this, 'list_getTaskLogEntries')), 'get_count' => array('function' => array($this, 'list_getNumTaskLogEntries')), 'columns' => array('name' => array('header' => array('value' => $txt['scheduled_tasks_name']), 'data' => array('db' => 'name')), 'date' => array('header' => array('value' => $txt['scheduled_log_time_run']), 'data' => array('function' => create_function('$rowData', '
							return standardTime($rowData[\'time_run\'], true);
						')), 'sort' => array('default' => 'lst.id_log DESC', 'reverse' => 'lst.id_log')), 'time_taken' => array('header' => array('value' => $txt['scheduled_log_time_taken']), 'data' => array('sprintf' => array('format' => $txt['scheduled_log_time_taken_seconds'], 'params' => array('time_taken' => false))), 'sort' => array('default' => 'lst.time_taken', 'reverse' => 'lst.time_taken DESC')), 'task_completed' => array('header' => array('value' => $txt['scheduled_log_completed']), 'data' => array('function' => create_function('$rowData', '
							global $settings, $txt;

							return \'<img src="\' . $settings[\'images_url\'] . \'/admin/complete_\' . ($rowData[\'task_completed\'] ? \'success\' : \'fail\') . \'.png" alt="\' . sprintf($txt[$rowData[\'task_completed\'] ? \'maintain_done\' : \'maintain_fail\'], $rowData[\'name\']) . \'" />\';
						')))), 'form' => array('href' => $context['admin_area'] == 'scheduledtasks' ? $scripturl . '?action=admin;area=scheduledtasks;sa=tasklog' : $scripturl . '?action=admin;area=logs;sa=tasklog', 'token' => 'admin-tl'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '
						<input type="submit" name="removeAll" value="' . $txt['scheduled_log_empty_log'] . '" onclick="return confirm(\'' . $txt['scheduled_log_empty_log_confirm'] . '\');" class="right_submit" />'), array('position' => 'after_title', 'value' => $txt['scheduled_tasks_time_offset'], 'class' => 'windowbg2')));
        createToken('admin-tl');
        require_once SUBSDIR . '/GenericList.class.php';
        createList($listOptions);
        $context['sub_template'] = 'show_list';
        $context['default_list'] = 'task_log';
        // Make it all look tify.
        $context[$context['admin_menu_name']]['current_subsection'] = 'tasklog';
        $context['page_title'] = $txt['scheduled_log'];
    }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:35,代码来源:ManageScheduledTasks.controller.php


示例14: EditMembergroup

/**
 * Editing a membergroup.
 * Screen to edit a specific membergroup.
 * Called by ?action=admin;area=membergroups;sa=edit;group=x.
 * It requires the manage_membergroups permission.
 * Also handles the delete button of the edit form.
 * Redirects to ?action=admin;area=membergroups.
 *
 * @uses the edit_group sub template of ManageMembergroups.
 */
function EditMembergroup()
{
    global $context, $txt, $sourcedir, $modSettings, $smcFunc;
    $_REQUEST['group'] = isset($_REQUEST['group']) && $_REQUEST['group'] > 0 ? (int) $_REQUEST['group'] : 0;
    if (!empty($modSettings['deny_boards_access'])) {
        loadLanguage('ManagePermissions');
    }
    // Make sure this group is editable.
    if (!empty($_REQUEST['group'])) {
        $request = $smc 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP validateUpdation函数代码示例发布时间:2022-05-23
下一篇:
PHP validateTemplateDir函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap