本文整理汇总了PHP中functions::request_var方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::request_var方法的具体用法?PHP functions::request_var怎么用?PHP functions::request_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::request_var方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_system
function action_system()
{
$this->collection->toggle_system($this->params->id, 'true' == functions::request_var('to', 'false'));
if ($this->in_ajax()) {
$this->_ajax_answer(true, i18n::T('Status changed'));
}
}
示例2: run
function run()
{
$q = $this->get_param('query');
if (empty($q)) {
$q = functions::request_var('keyword');
}
if (loader::in_ajax()) {
$keyword = trim($q);
} else {
$keyword = trim(urldecode($q));
}
$this->renderer->set_return('keyword', $keyword);
$this->renderer->set_main_title('search');
if (empty($q)) {
return;
}
if (strings::strlen($keyword) < 3) {
$this->renderer->set_message('sat.search_too_short', array('result' => false));
$this->renderer->set_ajax_message('sat.search_too_short');
return false;
}
// make search and redirect to it
$id = $this->make_search($keyword);
// redirect to search results
$url = $this->_controller->get_context()->get_router()->make_url('/search/' . $id . '/');
if (loader::in_ajax()) {
$this->_controller->set_null_template();
$this->renderer->set_ajax_message($this->_found ? sprintf('По вашему запросу найдено %d записей', $this->_found) : 'Подходящих записей не найдено')->set_ajax_result($this->_found)->set_ajax_redirect($url);
} else {
functions::redirect($url);
core::get_instance()->halt();
}
}
示例3: run
/**
* Remember!
* Assign current item in controller for comment linking!
*/
function run()
{
if (loader::in_ajax() !== true) {
throw new controller_exception('Cant touch this ' . __METHOD__);
return false;
}
core::dprint('run comment modify');
$pctl = core::modules()->get_router()->get_controller();
$user = core::lib('auth')->get_user();
/**
* Parent item, must be assigned thru @see module_controller::set_current_item()
* @var abs_collection_item
*/
$post = $pctl->get_current_item();
// var_dump(get_class($post), core::get_modules()->get_router()->get_name());
if (!$post) {
throw new controller_exception('No item assigned');
}
if (!$post->has_behavior('sat.commentable')) {
throw new controller_exception('Not commentable');
}
$comments = $post->behavior('sat.commentable')->get_attach_model();
//get_comments();
$request = core::lib('request');
$renderer = core::lib('renderer');
$user_id = core::lib('auth')->get_user()->id;
$pid = (int) $request->post('pid', 0);
$limit = core::selfie()->cfg('comment_interval', 60);
$auth = core::lib('auth');
/** @var aregistry $sd */
$sd = $auth->get_current_session()->get_storage();
$time = $sd->comments_last_time;
//$time = $comments->get_last_time($pid, $user_id);
// disallow by interval
if ($time && $time + $limit > time()) {
$pctl->set_null_template();
$renderer->set_ajax_answer(array('status' => false, 'id' => 0, 'message' => vsprintf(i18n::T('sat\\comment_interval_restriction'), $time + $limit - time())))->ajax_flush();
// else core::get_instance()->set_message(array('content', 'comment_interval_restriction'));
return;
// exit
}
$sd->comments_last_time = time();
$username = functions::request_var('username', '');
$text = functions::request_var('text', '');
$api = functions::request_var('api');
$id = $comments->modify(array('user_ip' => core::lib('auth')->get_user_ip(true), 'user_id' => $user_id, 'ctype_id' => $post->get_ctype_id(), 'username' => $username, 'pid' => $pid, 'text' => $text, 'type' => functions::request_var('type', 0), 'tpid' => functions::request_var('tpid', 0), 'api' => $api));
$comment = $comments->get_item_by_id($id);
if (!$comment) {
throw new controller_exception('[ajax] Comment create failed');
}
$comment->load_secondary();
$renderer->set_data('comment', $comment->render())->set_ajax_answer(array('status' => true, 'id' => $id))->set_ajax_message(i18n::T('sat\\comment_posted'));
//->set_main_template('content/comment/view');
$renderer->ajax_flush('shared/comments/comment');
// alright, update counter
return $id;
}
示例4: run
function run()
{
$name = functions::request_var('template', '');
$name = $name ? $name : 'default';
if (empty($name) || !preg_match('@^[a-z\\d]+$@i', $name)) {
throw new controller_exception('Bad id');
}
$domain = preg_replace('@^www\\.@', '', $_SERVER['HTTP_HOST']);
$vars = $this->request->post();
$to = $vars['email'];
/** @var tf_mailer */
$mailer = core::lib('mailer');
$result = $mailer->email_template($name, $to, $vars, true);
$this->renderer->set_ajax_result($result)->set_ajax_message('ok')->ajax_flush();
return;
}
示例5: action_edit_after
function action_edit_after($_item)
{
if ($this->params->do == 'change_title') {
$_item->title = functions::request_var('title');
$_item->update_fields('title');
if ($this->in_ajax()) {
$this->ajax_answer(true);
}
}
if ($this->params->do == 'change_url') {
$_item->title = functions::request_var('url');
$_item->update_fields('url');
if ($this->in_ajax()) {
$this->ajax_answer(true);
}
}
}
示例6: ini_set
* /modules/users/money/sms_vip.php?user_id=71111111111&num=1121&msg=admin
* &skey=807140ca5ba73a2455029e952beae13a&operator_id=299&date=2008-10-23+17%3A01%3A50&smsid=1379554447&msg_trans=admin&operator=operator&test=1
*/
require '../../../modules/core/loader.php';
ini_set('dispaly_errors', 'off');
$core = core::get_instance();
$core->lib('logger')->log('SMS Payment', print_r($_GET, 1));
$smskey = $core->get_cfg_var('sms_seckey', '');
core::lib('renderer')->set_content_type('text/plain');
$smsid = functions::request_var('smsid', '');
$num = functions::request_var('num', '');
$operator = functions::request_var('operator', '');
$userid = functions::request_var('user_id', '');
$cost = functions::request_var('cost', '');
$msg = functions::request_var('msg', '');
$skey = functions::request_var('skey', '');
list($prefix, $msg) = explode(' ', $msg);
if ($skey != md5($smskey)) {
header("HTTP/1.0 404 Not Found");
echo "Error! invalid sek key";
die;
}
$user = trim($msg);
$user = core::module('users')->get_user($user, 'login');
if ($user->is_anonymous()) {
header("HTTP/1.0 404 Not Found");
echo "Error! invalid login";
die;
}
echo "smsid:{$smsid}\n";
echo "status:reply\n";
示例7: die
if (!defined('IN_MAIN')) {
die('hax0rs alert!');
}
// Узнаем глобальные параметры
$cmd_op = core::get_params()->op;
$cmd_id = core::get_params()->id;
require "_req.php";
// был сабмит
$is_submited = isset($_POST["item_submit"]);
// Заголовок станицы
core::lib('renderer')->set_page_title('pages');
// class name (handler)
$cdata = $this->class_register('mw_' . basename(__FILE__, loader::DOT_PHP), array('no_preload' => true), true);
// toggle delete
if ($cmd_op == 'active') {
$cdata->toggle_active($cmd_id, 'true' == functions::request_var('to', 'false'));
if (loader::in_ajax()) {
return;
}
}
// single item load hack
if ($cmd_op == 'edit' || $cmd_op == 'drop' || $cmd_op == 'update' || $is_submited) {
/*
// simple loading (without extra data) if we continue with listing
if ($is_submited)
$cdata->set_cfg_var('simple', true);
*/
if (!empty($cmd_id)) {
$cdata->set_cfg_var('load_only_id', $cmd_id);
}
// load data
示例8: ini_set
/**
* Uploads checker
*/
// header("X-LIGHTTPD-send-file: " . $_GET['id']);
// header("X-Sendfile: " . $_GET['id']);
// header("X-Sendfile: /home/thumb/lexiclips.com/public_html/uploads/videos/original/48.mp4");
require "../modules/core/loader.php";
core::set_debug(666);
ini_set('display_errors', 'on');
error_reporting(E_ALL);
$core = core::get_instance();
if (($user = core::lib('auth')->get_user()) && !$user->payd_user) {
die('Restricted');
} else {
// Send file
$id = functions::request_var('id', '');
$file = loader::get_root() . substr($id, 1);
if (strpos($id, '/uploads/videos') !== false && ($file = loader::get_root() . substr($id, 1)) && file_exists($file) && is_readable($file)) {
$mime_type = 'video/mp4';
// 'video/H264';
if (false !== strpos($id, 'videos/original')) {
$mime_type = "application/force-download";
}
//header('Content-disposition: attachment;filename="' . (basename($file)) . '";');
header('Content-type: ' . $mime_type);
header('Content-length: ' . filesize($file));
header("X-LIGHTTPD-send-file: " . $file);
die;
// readfile($file);
} else {
header(' ', true, 403);
示例9: array
$cdata = $this->class_register(basename(__FILE__, loader::DOT_PHP), array('no_preload' => true), true);
// single item load hack
if ($cmd_op == 'edit' || $cmd_op == 'drop' || $is_submited) {
/*
// simple loading (without extra data) if we continue with listing
if ($is_submited)
$cdata->set_cfg_var('simple', true);
*/
if (!empty($cmd_id)) {
$cdata->set_cfg_var('load_only_id', $cmd_id);
}
// load data
$cdata->load();
if ($cmd_do == 'change_value') {
$_item = $cdata->get_item_by_id($cmd_id);
$_item->value = functions::request_var('value');
$_item->update_fields(array('value'));
if (loader::in_ajax()) {
$this->core->shutdown(true);
}
}
} else {
// simple loading (without extra data)
$cdata->set_cfg_var('simple', true);
}
/* Удаление позиции [ajax]
*/
if ($cmd_op == 'drop') {
$cdata->remove($cmd_id);
// ajax
if (loader::in_ajax()) {
示例10: isset
// был сабмит
$is_submited = isset($_POST["item_submit"]);
// Заголовок станицы
core::lib('renderer')->set_page_title('pages');
// class name (handler)
$cdata = $this->class_register('mw_' . basename(__FILE__, loader::DOT_PHP), array('no_preload' => true), true);
// toggle delete
if ($cmd_op == 'active') {
$cdata->toggle_active($cmd_id, 'true' == functions::request_var('to', 'false'));
if (loader::in_ajax()) {
return;
}
}
// flip positions
if ('flip' == $cmd_op) {
$cdata->flip_positions(functions::request_var('src', 0), functions::request_var('dst', 0), functions::request_var('ids', array(0)), functions::request_var('positions', array(0)));
if (loader::in_ajax()) {
die;
}
}
// single item load hack
if ($cmd_op == 'edit' || $cmd_op == 'drop' || $cmd_op == 'update' || $is_submited) {
/*
// simple loading (without extra data) if we continue with listing
if ($is_submited)
$cdata->set_cfg_var('simple', true);
*/
if (!empty($cmd_id)) {
$cdata->set_cfg_var('load_only_id', $cmd_id);
}
// load data
示例11: _toggle_flag
function _toggle_flag($flag)
{
$this->collection->toggle_flag($flag, $this->params->id, 'true' == functions::request_var('to', 'false'));
if ($this->in_ajax()) {
$this->_ajax_answer(true, i18n::T('Status changed'));
}
$this->_update_tree($this->params->pid);
}
示例12: action_active
function action_active()
{
if (is_callable(array($this, 'action_active_before'))) {
$this->action_active_before();
}
$this->collection->toggle_active($this->params->id, 'true' == functions::request_var('to', 'false'));
if (is_callable(array($this, 'action_active_after'))) {
$this->action_active_after();
}
if ($this->in_ajax()) {
$this->_ajax_answer(true, i18n::T('Status changed'));
}
}
示例13: register
/**
* Register
*/
public function register($r)
{
$this->set_template('user_register');
$data = $_POST;
$error = false;
$op = functions::request_var('op');
// valid only thru ajax
if (!loader::in_ajax()) {
return;
}
// register new
if ($op == 'register') {
try {
$uid = $this->get_context()->get_users_handle()->register_new_user($data);
} catch (validator_exception $e) {
$error = $e->getMessage();
$error = $this->get_context()->translate($error);
}
// core::var_dump();
if (false === $error) {
// log me in!
$login = functions::request_var('login', '');
$password = functions::request_var('password', '');
if (!empty($login) && !empty($password)) {
$result = $this->_auth->login($login, $password);
}
}
// log user in!
if (loader::in_ajax()) {
$this->set_null_template();
core::lib('renderer')->set_ajax_answer(array('status' => $error === false, 'message' => $error, 'url' => $this->get_context()->get_router()->make_url('users/register_success/')));
}
}
}
示例14: __construct
/**
* constructor
* @throws exception
*/
function __construct()
{
$cfg_file = loader::get_docs() . 'engine.cfg';
if (fs::file_exists($cfg_file)) {
// echo('[error] Configuration file not found');
$this->init_config(parse_ini_file($cfg_file, true));
}
if (fs::file_exists($libs_file = loader::get_docs() . 'libs.cfg')) {
self::$system_libs = parse_ini_file($libs_file);
}
self::$libs = new registry();
$duagent = $this->get_cfg_var('debugger_agent', 'iamdebugger');
// compare only lside of agent, cause firephp or something adds its stuff to end
if (!isset($_SERVER['HTTP_USER_AGENT']) || substr($_SERVER['HTTP_USER_AGENT'], 0, strlen($duagent)) != $duagent) {
if (!loader::in_shell()) {
self::$_debug_level = false;
ini_set('display_errors', 'off');
} else {
// enable debug messages in shell
self::set_debug($this->get_cfg_var('shell_debug_level', self::E_INFO));
}
} else {
// disable console when
if ((self::$_debug_level = $this->get_cfg_var('debug')) && !$this->get_cfg_var('no_console') && !loader::in_ajax()) {
self::register_lib('console', new Debug_HackerConsole_Main(!loader::in_shell()));
}
}
// Init cacher
if (self::lib_enabled('cache')) {
$cache = $this->lib('cache');
$cache->set_rate((int) $this->get_cfg_var('cache_rate', 1));
}
/*
@TODO get rid of them, compatibility only?
ident vars
using globals $cmd_{xxx} is depricated
do the $core->get_ident_var('{xxx}') instead;
*/
// @todo use self::TAG_ ..
self::$ident_vars = new registry(array('id' => 0 >= ($tmp = functions::request_var('id', -1)) ? false : $tmp, 'pid' => 0 >= ($tmp = functions::request_var('pid', -1)) ? false : $tmp, 'c' => functions::request_var('c', ''), 'op' => functions::request_var('op', ''), 'do' => functions::request_var('do', ''), 'type' => functions::request_var('type', ''), 'embed' => functions::request_var('embed', ''), 'start' => functions::request_var('start', 0), '2print' => functions::request_var('2print', ''), 'module' => preg_replace('/[^\\w\\d]/', '', functions::request_var('m', ''))));
// construct module
parent::__construct(loader::get_root() . loader::DIR_MODULES . __CLASS__ . '/');
}