예제 #1
0
 function __construct()
 {
     parent::__construct();
     if ($referer = $this->request('referer', !empty($_SERVER['HTTP_REFERER']) && rad_loader::getCurrentAlias()->alias == SITE_ALIAS ? $_SERVER['HTTP_REFERER'] : NULL)) {
         $this->setVar('referer', $referer);
     }
     if ($this->getCurrentUser() and $this->getCurrentUser()->u_id) {
         $this->setVar('user', $this->getCurrentUser());
     }
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_treestart = (int) $params->_get('treestart', $this->_treestart);
         $this->_is_facebook = (bool) $params->_get('is_facebook', $this->_is_facebook);
         //$this->_is_twitter = (boolean) $params->_get('is_twitter', $this->_is_twitter);
         $this->_fb_appkey = $params->_get('fb_appkey', $this->_fb_appkey);
         $this->_fb_secretkey = $params->_get('fb_secretkey', $this->_fb_secretkey);
         //$this->_tw_appkey = $params->_get('tw_appkey', $this->_tw_appkey);
         //$this->_tw_secretkey = $params->_get('tw_secretkey', $this->_tw_secretkey);
         $this->setVar('params', $params);
     }
     $this->setVar('hash', $this->hash());
     rad_autoload_register(array('controller_coresession_login', 'autoloadLibrary'));
     $this->makeConfig();
     switch ($this->request('action')) {
         case 'soc_login':
             $this->socialsLogin();
             break;
         case 'soc_endpoint':
             $this->socialsEndpoint();
             break;
         case 'soc_refresh':
             $this->socialsRefresh();
             break;
         default:
             if ($this->request('fromsite')) {
                 $this->loginFromSite();
             } else {
                 $this->manage();
             }
             break;
     }
 }
예제 #2
0
 /**
  * Makes the url from standart params
  * @param string $context
  * @param bool $url_aliases_enabled
  * @return string
  * @example makeURL('alias=index.html&page=2&itemsperpage=10&category=754')
  */
 public static function makeURL($context, $url_aliases_enabled = false)
 {
     static $alias_plugins = null;
     static $search = null;
     static $replace = null;
     if (!$alias_plugins) {
         $alias_plugins = rad_loader::getAliasInputClasses();
     }
     if (!$search) {
         $search = array('SITE_URL');
         $replace = array(SITE_URL);
         if (defined('SITE_ALIAS')) {
             $search[] = 'SITE_ALIAS';
             $replace[] = SITE_ALIAS;
         }
     }
     $c = str_replace($search, $replace, $context);
     if (is_link_external($c)) {
         return $c;
     }
     $r = strstr($c, '?');
     if ($r) {
         $c = substr($r, 1);
     }
     $r = explode('&', $c);
     $get = array();
     foreach ($r as $id) {
         $r1 = explode('=', $id);
         if (count($r1) >= 2) {
             $get[$r1[0]] = $r1[1];
         } else {
             $get[$r1[0]] = '';
         }
     }
     if (!isset($get['alias'])) {
         $get['alias'] = SITE_ALIAS;
     }
     if ($url_aliases_enabled && rad_config::getParam('cleanurl.on')) {
         if ($alias = rad_cleanurl::getAliasByParams($get)) {
             return SITE_URL . $alias;
         }
     }
     if (isset($alias_plugins[$get['alias']])) {
         $model = rad_instances::get($alias_plugins[$get['alias']]);
         $string = $model->makeurl($get);
     } else {
         if ((!count($get) or count($get) == 1 and isset($get['alias'])) and trim($get['alias']) == rad_config::getParam('defaultAlias')) {
             $string = SITE_URL;
         } else {
             if (rad_config::getParam('lang.location_show')) {
                 $string = SITE_URL . rad_lang::getCurrentLanguage() . '/' . $get['alias'] . '/';
             } else {
                 $string = SITE_URL . $get['alias'] . '/';
             }
             if (strlen($context)) {
                 foreach ($get as $prmname => $prmvalue) {
                     if ($prmname != 'alias') {
                         $string .= $prmname . '/' . $prmvalue . '/';
                     }
                 }
                 if (strpos($prmvalue, '.')) {
                     if ($string[strlen($string) - 1] == '/') {
                         $string = substr($string, 0, -1);
                     }
                 }
             }
         }
     }
     return $string;
 }
예제 #3
0
 protected static function parseIncludes(&$includes)
 {
     self::$_includes = array();
     foreach ($includes as $id) {
         self::$_includes[$id->inc_name] = rad_themer::getFilePath(null, 'templates', $id->m_name, $id->inc_filename);
     }
 }
예제 #4
0
 /**
  * Gets the current template path by current controller name in current alias
  * @return string
  */
 function getTemplatePath()
 {
     return rad_loader::getTemplatePathByController($this->getClassName());
 }
예제 #5
0
 /**
  * Main function to init the loader from request
  *
  */
 public static function init()
 {
     parent::init();
     self::parseTemplates();
     self::show();
 }
예제 #6
0
 /**
  * In windows from AJAX shows edit script for titles
  *
  */
 function showEditScript()
 {
     $alias_id = (int) $this->request('alias_id');
     if ($alias_id) {
         $model = rad_instances::get('model_core_aliases');
         $item = $model->getItem($alias_id);
         $this->setVar('item', $item);
         $this->setVar('alias_id', $alias_id);
         /**
          * Get the aliases and includes
          */
         $alias = rad_loader::getAliasByName($item->alias);
         $helpers = array();
         foreach ($alias->includes as $id_i => $id) {
             $controller = trim($id->controller);
             if (strlen($controller)) {
                 $bco = rad_breadcrumbs::getBCOFromClass($controller);
                 if ($bco) {
                     $helpers[$controller]['object'] = $bco;
                     $vrs = $bco->getVars();
                     if (count($vrs)) {
                         foreach ($vrs as $id_v => $varname) {
                             $helpers[$controller]['vars'][$varname] = str_replace("\"", "\\\"", $this->lang($varname . '.' . $controller . '.breadcrumbs'));
                         }
                     }
                     //foreach $bco->getVars()
                     $vrs = $bco->getVars(2);
                     if (count($vrs)) {
                         foreach ($vrs as $id_v => $varname) {
                             $helpers[$controller]['vars2'][$varname] = str_replace("\"", "\\\"", $this->lang($varname . '.' . $controller . '.breadcrumbs2'));
                         }
                     }
                 }
                 //if bco
             }
             //if controller
         }
         //foreach includes
         $this->setVar('helpers', $helpers);
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }