コード例 #1
0
ファイル: controller.php プロジェクト: egregor-dev/SatCMS
 /**
  * Editor nav menu
  */
 function action_api_editor_menu()
 {
     /** @var tf_editor $ed */
     $ed = core::lib('editor');
     $menu = array();
     // dies on get_editor_actions
     $menu['core'] = core::get_instance()->get_editor_actions();
     foreach (core::modules() as $module) {
         $menu[$module->get_name()] = $module->get_editor_actions();
     }
     $menuNormalized = array();
     foreach ($menu as $key => $actions) {
         $submenuNormalized = array();
         if (!empty($actions)) {
             foreach ($actions as $subKey => $subMenu) {
                 if (!empty($subMenu['url'])) {
                     $subMenu['url'] = $ed->make_url($subMenu['url'], 1);
                 }
                 $submenuNormalized[] = !$subMenu ? array() : array_merge(array('id' => $subKey), $subMenu);
             }
             $menuNormalized[] = array('id' => $key, 'title' => i18n::T(array($key, '_name')), 'actions' => $submenuNormalized);
         }
     }
     $this->renderer->set_ajax_answer($menuNormalized)->ajax_flush();
 }
コード例 #2
0
ファイル: embed.php プロジェクト: egregor-dev/SatCMS
 /**
  * Activate filter
  */
 function activate()
 {
     core::dprint('Activate RSS');
     // tpl_loader::set_template('');
     core::lib('renderer')->set_page_template('root.embed');
     tf_request::set_ident('embed', 'yes');
 }
コード例 #3
0
ファイル: rss.php プロジェクト: egregor-dev/SatCMS
 /**
  * Activate filter
  */
 function activate()
 {
     core::dprint('Activate RSS');
     tpl_loader::set_template('rss');
     core::lib('renderer')->set_content_type('text/xml');
     // 'application/rss+xml'
 }
コード例 #4
0
ファイル: item.php プロジェクト: egregor-dev/SatCMS
 function notify_user($email, $text)
 {
     if (!$this->get_container()->get_notify_user()) {
         return;
     }
     core::lib('mailer')->email(array('from' => 'info@' . ($domain = core::module('sat')->get_current_site()->get_domain()), 'to' => $email, 'subject' => 'Пользователь заполнил анкету на сайте ' . $domain, 'msg' => $text, 'is_html' => true));
 }
コード例 #5
0
ファイル: module_ioc.php プロジェクト: egregor-dev/SatCMS
 /**
  * Get lib (IOC)
  * $module->renderer etc.
  * @param $key
  */
 function __get($key)
 {
     if (isset($this->dependencies[$key])) {
         return $this->resolve_dependency($key);
     }
     // fallback to libs
     return core::lib($key);
 }
コード例 #6
0
ファイル: users.php プロジェクト: egregor-dev/SatCMS
 function render_before()
 {
     if (isset($_POST['filter'])) {
         $key = core::lib('db')->escape($_POST['filter']['title']);
         $this->set_where("LCASE(p1.nick) like '%{$key}%' OR LCASE(p1.login) like '%{$key}%'");
         $this->renderer->set_data('_filter', array('title' => $key));
     }
 }
コード例 #7
0
ファイル: item.php プロジェクト: egregor-dev/SatCMS
 /**
  * Notify user about
  * @param $data
  */
 function create_after($data)
 {
     $notify_tpl = $this->container->config->get('notify_template');
     if ($notify_tpl) {
         /** @var tf_mailer */
         $mailer = core::lib('mailer');
         $mailer->email_template($notify_tpl, $data['email'] ? $data['email'] : '*****@*****.**', $data, true);
     }
 }
コード例 #8
0
ファイル: modify.php プロジェクト: egregor-dev/SatCMS
 /**
  * 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;
 }
コード例 #9
0
ファイル: feedback.php プロジェクト: egregor-dev/SatCMS
 private function send_feedback()
 {
     $template = 'feedback';
     $vars = $this->request->post();
     $to = $vars['email'];
     /** @var tf_mailer */
     $mailer = core::lib('mailer');
     $result = $mailer->email_template($template, $to, $vars, true);
     $this->set_message('Отправка сообщения', $result)->set_message_data($vars);
 }
コード例 #10
0
ファイル: collection.php プロジェクト: egregor-dev/SatCMS
 function notify_user($data, $result)
 {
     /*
     $mtpl = core::get_instance()->get_mail_tpl_handle()->get_mail_template('edu_request');
     */
     $data['test_result'] = $result ? $result->text : '';
     /** @var tf_mailer */
     $mailer = core::lib('mailer');
     $mailer->email_template('edu_request', $data['email'] ? $data['email'] : '*****@*****.**', $data, true);
 }
コード例 #11
0
ファイル: item.php プロジェクト: egregor-dev/SatCMS
 /** 
  * Parse smarty data
  */
 function parse_data()
 {
     if ($this->plain) {
         return;
     }
     $pre = 'string: ' . $this->text;
     /** @var smarty */
     $tpl = core::lib('tpl_parser');
     //tpl_loader::get_parser();
     $this->content = !empty($this->text) ? $tpl->fetch($pre) : '';
 }
コード例 #12
0
ファイル: item.php プロジェクト: egregor-dev/SatCMS
 /**
  * Doamin matched in initial_route
  */
 function set_current()
 {
     $this->_current = true;
     if (0 != $this->template) {
         $core = core::get_instance();
         $templates = $core->get_cfg_var('templates');
         if (isset($templates[$this->template])) {
             core::dprint(array('SITE_LAYOUT : %s', $templates[$this->template]), core::E_DEBUG1);
             core::lib('renderer')->set_layout($templates[$this->template]);
         }
     }
 }
コード例 #13
0
ファイル: Authorize.php プロジェクト: egregor-dev/SatCMS
/**
* Transler bridge
*/
function elFinderIsAuthed()
{
    if (!defined('ELFIINDER_AUTHED')) {
        require_once dirname(__FILE__) . '/../../../modules/core/loader.php';
        loader::bootstrap();
        /** @var users_item */
        $user = core::lib('auth')->get_user();
        $authed = $user->level >= 50;
        define('ELFIINDER_AUTHED', $authed);
    }
    return ELFIINDER_AUTHED;
}
コード例 #14
0
ファイル: suggest.php プロジェクト: egregor-dev/SatCMS
 function run()
 {
     $q = trim(urldecode($this->request->get('q')));
     $q = core::lib('db')->escape($q);
     if (strings::strlen($q) < 2) {
         $this->renderer->set_ajax_result(false)->set_ajax_message('Короткое сообщение')->ajax_flush(false);
         return;
     }
     $pmod = $this->_controller->get_context();
     $ph = $pmod->get_search_handle()->set_working_fields('keyword')->set_limit(10);
     if (!empty($q)) {
         $ph->set_where("keyword like '%{$q}%' AND c_count > 0");
     }
     $sugg = $ph->load()->render();
     core::get_instance()->ajax_answer($sugg);
 }
コード例 #15
0
ファイル: mailer.php プロジェクト: egregor-dev/SatCMS
 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;
 }
コード例 #16
0
ファイル: query.php プロジェクト: egregor-dev/SatCMS
 /**
  * Make search
  */
 public function make_search($key)
 {
     $id = false;
     $psearchs = $this->_controller->get_context()->get_search_handle();
     $psearch_results = $this->_controller->get_context()->get_search_result_handle();
     $core = core::get_instance();
     $site_id = $this->_controller->get_context()->get_current_site_id();
     // check key exists
     if ($search_item = $psearchs->get_by_key($key, $site_id)) {
         $id = $search_item->id;
         $this->_found = $search_item->c_count;
     }
     // if too old, clean search results, make it new
     if ($search_item) {
         if ($search_item->time + $this->_expire_time < time()) {
             // clear
             $search_item->remove();
             $search_item = null;
         }
     }
     if (!$search_item) {
         $this->_found = 0;
         $cdata = core::module('sat')->get_node_handle();
         $orig_key = $key;
         # remove this for non test
         # $key = strings::convert_from($key);
         $key = core::lib('db')->escape(strings::strtolower($key));
         $cdata->set_where("site_id = {$site_id} AND active AND LCASE(title) LIKE '%{$key}%'")->load();
         $result = array();
         $ctype = $core->get_ctype('sat.node')->get_id();
         $this->_found = $cdata->count();
         if (!$cdata->is_empty()) {
             foreach ($cdata as $item) {
                 $result[] = array('title' => $item->title, 'description' => strip_tags($item->description), 'time' => $item->updated_at, 'url' => $item->get_url(), 'ctype' => $ctype, 'post_id' => $item->id);
             }
         }
         // create search history item
         $id = $psearchs->create(array('uid' => $this->_controller->get_user()->id, 'keyword' => $key, 'c_count' => $this->_found, 'site_id' => $site_id));
         // fill results
         foreach ($result as $v) {
             $v['pid'] = $id;
             $psearch_results->create($v);
         }
     }
     return $id;
 }
コード例 #17
0
ファイル: controller.php プロジェクト: egregor-dev/SatCMS
 function action_form_do()
 {
     $aids = @$_COOKIE['anket'];
     $aids = explode(',', trim($aids));
     $aids = is_array($aids) ? $aids : array();
     $id = core::lib('db')->escape($this->get_param('id'));
     if (empty($id)) {
         throw new controller_exception('Bad form id');
     }
     // debug
     if (!core::is_debug() && in_array($id, $aids)) {
         $this->set_template('anket/form/already');
         return;
     }
     // load
     $form = $this->get_context()->get_form_handle()->set_where('name = "%s"', $id)->set_limit(1)->load()->get_item();
     if (!$form) {
         throw new router_exception('Form not found');
     }
     $this->get_renderer()->set_current('anket_form', $form->load_secondary()->render());
     if ($this->request->post('form_submit') == 'yes') {
         $_post = $this->request->get_post();
         /** @var anket_result_collection */
         $pres = $this->context->get_result_handle();
         $pres->set_current_form($form);
         $_post['results'] = !empty($_post['q']) ? serialize($_post['q']) : '';
         $_post['uip'] = core::lib('auth')->get_user_ip(1);
         // debug
         // if (loader::in_ajax() !== true) die('juststopped');
         $pres->create($_post);
         if (!in_array($id, $aids)) {
             $aids[] = $id;
         }
         setcookie('anket', join(',', $aids), time() + 31104000, '/');
         $result = ($item = $pres->get_last_item()) ? $item->render() : false;
         if (!loader::in_ajax()) {
             $this->set_template('anket/form/complete');
             // result.form, result.option
             $this->renderer->set_return($result);
         } else {
             $this->set_null_template();
             $this->renderer->set_ajax_message('Обработка запроса')->set_ajax_data($result)->set_ajax_result(true)->set_ajax_redirect('/anket/complete/');
         }
     }
 }
コード例 #18
0
ファイル: new.php プロジェクト: egregor-dev/SatCMS
 function run()
 {
     //if (loader::in_ajax() !== true && !core::is_debug()) die('juststopped');
     if ($this->request->post('form_submit') == 'yes') {
         $_post = $this->request->get_post();
         $pres = $this->_controller->get_context()->get_qa_question_handle();
         /** @var tf_auth */
         $auth = core::lib('auth');
         $_post['session_id'] = $auth->get_current_session()->get_id();
         $_post['site_id'] = core::module('sat')->get_current_site_id();
         $_post['active'] = false;
         if ($auth->get_user()->level >= 50) {
             $_post['active'] = true;
         }
         $aid = $pres->create($_post);
         $this->renderer->set_ajax_message('Обработка запроса')->set_ajax_result((bool) $aid)->set_ajax_data($aid ? $pres->get_last_item()->render() : false)->ajax_flush(false);
     }
 }
コード例 #19
0
ファイル: exception.php プロジェクト: rustyJ4ck/moswarBot
 function __construct($title, $err_no = 0)
 {
     if (!defined('TF_TEST_INFECTED')) {
         $this->log_id = false;
         if ($err_no == self::CRITICAL) {
             echo "<h1 style='color:darkred'>Danger! {$title} </h1>";
         } else {
             // log if logger available
             if ($this->logable && class_exists('core') && ($libs = core::get_libs()) && $libs->is_registered('logger') && ($logger = core::lib('logger'))) {
                 $this->log_id = $logger->error_log($title, $err_no, $this->getTraceAsString());
             }
         }
         // display?
     }
     // var_dump($title, $err_no, $this->getTraceAsString());
     parent::__construct($title, $err_no);
     self::$last_exception = $this;
 }
コード例 #20
0
ファイル: answer_new.php プロジェクト: egregor-dev/SatCMS
 function run()
 {
     $pid = (int) $this->request->post('pid');
     if ($this->request->post('form_submit') == 'yes') {
         $_post = $this->request->get_post();
         $parent = $this->_controller->get_context()->get_qa_question_handle()->load_only_id($pid);
         if (!$parent) {
             throw new controller_exception('Bad parent');
         }
         $pres = $this->_controller->get_context()->get_qa_answer_handle();
         /** @var tf_auth */
         $auth = core::lib('auth');
         $_post['session_id'] = $auth->get_current_session()->get_id();
         $aid = $pres->create($_post);
         $parent->sync_count();
         $this->renderer->set_ajax_message('Обработка запроса')->set_ajax_result((bool) $aid)->set_ajax_data($aid ? $pres->get_last_item()->render() : false)->ajax_flush(false);
     }
 }
コード例 #21
0
/**
 * Block entry point
 * 
 * @param array
 *     module                  // module tag
 *     action                  // block action
 *     cache                   // seconds, cache data
 *     other params
 */
function smarty_function_block($params, &$smarty)
{
    $core = core::get_instance();
    foreach ($params as $k => $v) {
        if (!isset(${$k})) {
            ${$k} = $v;
        }
    }
    $cache_this = false;
    // $core->time_check('c1', true, true);
    if (isset($cache)) {
        $cacher_factory = core::lib('cache');
        if ($cacher_factory->has_memory()) {
            $cacher = $cacher_factory->get_memory_handle();
            $cache_time = $cache;
            unset($params['cache']);
            $cache_id = 'block_' . md5(serialize($params));
            $result = $cacher->get($cache_id, false);
            if (false !== $result) {
                core::dprint('cache hit : ' . $params['action'] . ' - ' . $core->time_check('c1', true));
                return $result;
            }
            $cache_this = true;
        }
    }
    try {
        if (empty($module)) {
            $module = 'core';
        }
        if ($pmod = $core->module($module)) {
            unset($params['action'], $params['module']);
            $result = $pmod->run_block($action, $params);
            if ($cache_this) {
                $cacher->set($cache_id, $result, $cache_time);
            }
            // core::var_dump('no cache : ' . $cache_id, $core->time_check('c1', true));
            return $result;
        }
    } catch (modules_exception $e) {
        return '[block] ' . $e->getMessage();
    }
    return false;
}
コード例 #22
0
ファイル: controller.php プロジェクト: egregor-dev/SatCMS
 /**
  * Форма заявка (на обучение)
  */
 function action_form_do()
 {
     $form_do_once = $this->context->cfg('form_do_once', false);
     /* extract params from uri, trim form/do
           Array (2)
            type => "mini"
            lang => "ru" 
        */
     $uri = array_slice(explode('/', $this->get_context()->get_router()->get_uri()), 2);
     $cdata = array();
     if (!empty($uri)) {
         foreach ($uri as $k => $u) {
             if ($k > 0 && $k % 2 != 0) {
                 continue;
             } else {
                 if (isset($uri[$k + 1])) {
                     $cdata[$u] = $uri[$k + 1];
                 }
             }
         }
     }
     $aid = @$_COOKIE['request_form'];
     if ($form_do_once && !core::is_debug() && $aid) {
         $this->set_template('contacts/form/already');
         return;
     }
     $this->renderer->set_current('data', $cdata);
     if ($this->request->post('send')) {
         $post = $this->request->get_post();
         /** @var contacts_form_collection $pres */
         $pres = $this->context->get_form_handle();
         $post['uip'] = core::lib('auth')->get_user_ip(1);
         if (loader::in_ajax() !== true && !core::is_debug()) {
             die('juststopped');
         }
         $post['title'] = @$post['subject'];
         $pres->set_notify_template('feedback');
         $aid = $pres->create($post);
         setcookie('request_form', $aid, time() + 31104000, '/');
         $this->set_null_template();
         $this->renderer->set_ajax_message('Ваше сообщение отправлено')->set_ajax_result(true)->ajax_flush();
     }
 }
コード例 #23
0
ファイル: exceptions.php プロジェクト: egregor-dev/SatCMS
 function __construct($title, $err_no = 0)
 {
     if (class_exists('loader', false) && !loader::_option(loader::OPTION_TESTING)) {
         $this->log_id = false;
         if ($err_no == self::CRITICAL) {
             echo "<h1 style='color:darkred'>Danger! {$title} </h1>";
         } else {
             // override email
             if (class_exists('core', 0) && core::selfie()) {
                 $this->bugs_email = core::selfie()->cfg('email', $this->bugs_email);
             }
             // log if logger available
             if ($this->logable && class_exists('core', 0) && ($libs = core::libs()) && $libs->is_registered('logger') && ($logger = core::lib('logger'))) {
                 $this->log_id = $logger->error($title, $err_no, $this->getTraceAsString());
             }
         }
     }
     parent::__construct($title, $err_no);
     self::$last_exception = $this;
 }
コード例 #24
0
ファイル: collection.php プロジェクト: egregor-dev/SatCMS
 /**
  * Load rates
  */
 function load_rates()
 {
     $logged = core::lib('auth')->logged_in();
     $user = core::lib('auth')->get_user();
     $rates = false;
     /*   
     // disable rating
     
             if ($logged) {
                 $rates = core::module('content')->get_rates(
                     "(SELECT id FROM " . $this->get_table() . " WHERE pid = " . $post->id . ")"
                     , self::CTYPE, core::lib('auth')->get_user());
             }
             
             foreach ($this->items as $item) {
                 if (!$logged || $user->id == $item->user_id || $rates->is_rated($item->id))
                 $item->disable_rating();
             }
     */
     return $this;
 }
コード例 #25
0
ファイル: item.php プロジェクト: egregor-dev/SatCMS
 /**
  * Update profile
  * @todo draft 
  * @throws validator_exception
  */
 function update_profile($data)
 {
     // update password, if set
     // remove queue if not changed
     if ($data['nick'] == $this->nick) {
         unset($data['nick']);
     } else {
         if (!$this->container->check_unique_nick($data['nick'], $this->id)) {
             throw new validator_exception('nick_exists');
         }
     }
     if ($data['email'] == $this->email) {
         unset($data['email']);
     } else {
         if (!core::lib('validator')->is_email($data['email'])) {
             throw new validator_exception('email_bad');
         } else {
             if (!$this->container->check_unique_email($data['email'], $this->id)) {
                 throw new validator_exception('email_exists');
             }
         }
     }
     if ($data['gender'] == $this->gender) {
         unset($data['gender']);
     }
     if (!empty($data)) {
         $this->update_fields($data);
         // simulate up
         if (isset($data['gender'])) {
             $this->gender = $data['gender'];
         }
         if (isset($data['nick'])) {
             $this->nick = $data['nick'];
         }
         if (isset($data['email'])) {
             $this->email = $data['email'];
         }
     }
 }
コード例 #26
0
ファイル: mod.php プロジェクト: rustyJ4ck/moswarBot
 * @author     Golovkin Vladimir <*****@*****.**> http://www.skillz.ru
 * @copyright  SurSoft (C) 2008
 * @version    $Id: mod.php,v 1.2 2008/05/23 15:02:37 surg30n Exp $
 */
if (!defined('IN_MAIN')) {
    die;
}
$user = $this->get_user();
if ($user->level < $user->get_container()->get_level_by_name('mod')) {
    core::get_instance()->set_raw_message('restricted');
    $this->set_null_template();
    return false;
}
/*  Вывод
    Очищаем и перезагружаем!
*/
$posts_base_url = $this->get_context()->get_cp_links('post');
$this->get_context()->set_cp_data('posts_base_url', $posts_base_url['url']);
$cdata = core::module('content')->get_posts_handle();
$base_url = $this->get_context()->get_cp_links('mod');
$base_url = $base_url['url'];
$page = $this->get_context()->get_core()->pagination();
$cdata->with_comments(false);
$cdata->with_deps(false);
$cdata_filter = new collection_filter($cdata, $base_url);
//$cdata_filter->set_filter('b_approved', false);
$cdata->set_order('b_approved ASC, date_mod DESC');
$cdata_filter->set_pagination($page, 50);
$data = $cdata_filter->apply();
core::lib('renderer')->set_posts($data);
コード例 #27
0
ファイル: module.php プロジェクト: egregor-dev/SatCMS
 /**
  * Get lib (IOC)
  * $module->renderer etc.
  * @param $key
  */
 function __get($key)
 {
     if (isset($this->ioc->dependencies[$key])) {
         return $this->ioc->resolve_dependency($key);
     }
     return core::lib($key);
 }
コード例 #28
0
ファイル: sms_vip.php プロジェクト: rustyJ4ck/moswarBot
* 
* @package    TwoFace
* @author     Golovkin Vladimir <*****@*****.**> http://www.skillz.ru
* @copyright  SurSoft (C) 2008
* @version    $Id: sms_vip.php,v 1.1.2.4 2008/10/24 13:18:53 j4ck Exp $
*/
/** 
* /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');
コード例 #29
0
ファイル: enemies.php プロジェクト: rustyJ4ck/moswarBot
 * @package    content
 * @author     Golovkin Vladimir <*****@*****.**> http://www.skillz.ru
 * @copyright  SurSoft (C) 2008
 * @version    $Id: enemies.php,v 1.1.2.2 2010/03/28 19:37:40 surg30n Exp $
 */
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); 
コード例 #30
0
/**
 * CSRF Token
 */
function smarty_function_csrf_token()
{
    return '<input type="hidden" name="x_token" value="' . core::lib('auth')->token() . '" />';
}