Пример #1
0
<?php

/**
 * Entry point for editor interface
 *
 * @package    TwoFace
 * @author     Golovkin Vladimir <*****@*****.**> http://www.skillz.ru
 * @copyright  SurSoft (C) 2008
 * @version    $Id: index.php,v 1.2.6.1 2008/10/24 13:19:05 j4ck Exp $
 */
define('IN_MAIN', 'I think so');
define('IN_EDITOR', 'Hell year');
require '../modules/core/loader.php';
// disable cache
functions::headers_no_cache();
if (!core::lib('auth')->logged_in() || 'admin' != core::lib('auth')->get_user()->get_level()) {
    // disable auth
    functions::redirect('/');
    exit;
}
$module = core::get_params()->module;
if (!empty($module) && 'core' != $module) {
    try {
        if ($mod = core::module($module)) {
            $mod->on_editor();
        }
    } catch (modules_exception $e) {
        // module not found
        core::get_instance()->error404('Module not found');
    }
} else {
Пример #2
0
 /**
  * CP Entry
  * /users/cp/../
  * @param array
  *   $r->option_params' => array(0=>,1=>)
  * @throws router_exception
  * @throws controller_exception
  */
 function cp($r)
 {
     // disable cache
     functions::headers_no_cache();
     // force login screen
     if (!$this->_auth->logged_in()) {
         /*
         $this->renderer->set_message($this->get_context()->T('Please login'));
         */
         $this->renderer->set_return('redirect', $_SERVER['REQUEST_URI']);
         $this->set_template('users/login');
         return;
     }
     $this->_cp_user = $this->get_context()->get_current_user();
     $this->set_section_name('cp');
     $this->set_action_name('cp');
     $this->set_template('users/cp');
     if (empty($this->req->option) && ($default_opt = $this->get_context()->get_default_cp_option())) {
         $this->req->option = $default_opt;
     }
     if (!empty($this->req->option)) {
         $cmd = 'cp_' . $this->req->option;
         if (!is_callable(array($this, $cmd))) {
             throw new router_exception('Bad action', router_exception::NOT_FOUND);
         }
         // call cp method
         call_user_func(array($this, $cmd));
         $this->get_context()->set_cp_data('option', $this->req->option);
     }
 }
Пример #3
0
 /**
  * Check last modified time and
  * do some action
  */
 function check_last_modified()
 {
     $user = $this->lib('auth')->get_user();
     $disable = $this->cfg('disable_last_modify', false);
     if (!$disable && $user->is_anonymous()) {
         if ($time = $this->last_modified()) {
             $last_modified = date('r', $time);
             @header('Last-Modified: ' . $last_modified);
             @header('Cache-Control: max-age=3600, must-revalidate');
         }
     } else {
         // dont cache user
         functions::headers_no_cache();
     }
 }
Пример #4
0
 /**
  * CP Entry
  * /users/cp/../
  * @throws router_exception
  * @throws controller_exception
  */
 function cp($r)
 {
     // disable cache
     functions::headers_no_cache();
     /*
         $r->option_params' => 
             array
               0 => 
               1 => 
     */
     if (!core::lib('auth')->logged_in()) {
         throw new controller_exception('User not logged in!');
     }
     $this->_cp_user = $this->get_context()->get_current_user();
     $this->set_section_name('cp');
     $this->set_action_name('cp');
     $this->set_template('user_cp');
     if (!empty($this->req->option)) {
         $cmd = 'cp_' . @$this->req->option;
         if (!method_exists($this, $cmd)) {
             throw new router_exception('Bad action', router_exception::NOT_FOUND);
         }
         // user cp links rendered in module::render()
         // call cp method
         call_user_func(array($this, $cmd));
         /*
         try {
             call_user_func(array($this, $cmd));
         }
         catch (system_exception $e) {
             $this->get_context()->get_core()->set_message('error_not_implemented');
             $this->get_context()->get_core()->set_message_data(false, true);                
         }
         */
         $this->get_context()->set_cp_data('option', $this->req->option);
     }
 }