예제 #1
0
파일: DateStr.php 프로젝트: techart/tao
 protected function get_lang_file($data)
 {
     $lang_file = false;
     $lang_file = $data['lang_file'];
     $lang = $this->get_lang($data);
     $path = "jquery/lang/{$lang}.js";
     if ($data['lang_file']) {
         $lang_file = $data['lang_file'];
     } elseif (IO_FS::exists('scripts/' . $path)) {
         $lang_file = $path;
     } elseif (IO_FS::exists(CMS::stdfile('scripts/' . $path))) {
         $lang_file = CMS::stdfile_url('scripts/' . $path);
     }
     return $lang_file;
 }
예제 #2
0
파일: Admin.php 프로젝트: techart/tao
 /**
  * @param string       $title
  * @param string       $uri
  * @param string|false $icon
  * @param array|false  $submenu
  */
 static function menu_process($title, $item, $p1 = false, $p2 = false)
 {
     $sub = false;
     $icon = 'default';
     if (is_array($p1)) {
         $sub = $p1;
     }
     if (is_array($p2)) {
         $sub = $p2;
     }
     if (is_string($p1)) {
         $icon = $p1;
     }
     if (is_string($p2)) {
         $icon = $p2;
     }
     self::$admin_menu[$title] = $item;
     if (!Core_Regexps::match('{\\.([a-z]+)$}', $icon)) {
         $icon .= '.gif';
     }
     if (IO_FS::exists("./image/admin/components/{$icon}")) {
         $icon = "/image/admin/components/{$icon}";
     } else {
         if (IO_FS::exists(CMS::stdfile("images/components/{$icon}"))) {
             $icon = CMS::stdfile_url("images/components/{$icon}");
         } else {
             $icon = CMS::stdfile_url('images/components/default.gif');
         }
     }
     self::$menu[] = array('t' => $title, 'u' => $item, 's' => $sub, 'i' => $icon);
 }
예제 #3
0
파일: Redactor.php 프로젝트: techart/tao
 /**
  * Список файлов для подключения в формате Templates_HTML::use_file
  *
  * @see    Templates_HTML::use_file
  * @return [type] [description]
  */
 public function include_files()
 {
     return array_merge(array(array('name' => '/' . CMS::stdfile('scripts/tao/editor.js'), 'type' => 'lib')), $this->libraries_files(), $this->application_files());
 }
예제 #4
0
파일: Handlers.php 프로젝트: techart/tao
 /**
  * @param WebKit_Environment   $env
  * @param WebKit_HTTP_Response $response
  *
  * @return Iterator
  */
 public function run(WS_Environment $env)
 {
     $response = $env->response;
     $uri = $env->request->urn;
     /**
      * @event cms.actions.dispatch
      *
      * Вызывается перед началом диспетчеризации запроса.
      * Здесь можно подменить что-нибудь в запросе, обратившись к WS::env()->request, выполнить какие-либо действия,
      * а также вернуть объект Net_HTTP_Response - в этом случае диспетчеризация даже не начнется,
      * а будет использован возвращенный отклик.
      *
      * @arg $uri REQUEST_URI
      */
     $rs = Events::call('cms.actions.dispatch', $uri);
     if (!is_null($rs)) {
         return $rs;
     }
     if ($m = Core_Regexps::match_with_results('{^/cms-actions/(.+)}', $uri)) {
         $action = preg_replace('{\\?.+$}', '', $m[1]);
         if ($m = Core_Regexps::match_with_results('{^files/(.+)/(\\d+)/$}', $action)) {
             $file = CMS::stdfile(trim($m[1]));
             if (!IO_FS::exists($file)) {
                 return $response->status(Net_HTTP::NOT_FOUND);
             }
             return Net_HTTP::Download($file);
         }
         if ($m = Core_Regexps::match_with_results('{^subsite/(.+)}', $action)) {
             $site = $m[1];
             CMS_Admin::set_site($site);
             $path = CMS::$admin;
             header("location: /{$path}/");
             die;
         }
         if ($m = Core_Regexps::match_with_results('{^help/([^/]+)/([^/]+)/(.+)/$}', $action)) {
             $stddir = CMS::$taopath . '/views/help';
             $file = "{$stddir}/en/_notfound";
             if ($m[1] == '_app') {
                 $dir = trim($m[2]);
                 $f = trim($m[3]);
                 $f = CMS::app_path("help/{$dir}/{$f}");
                 if (file_exists($f)) {
                     $file = $f;
                 }
             } else {
                 $lang = trim($m[1]);
                 $component = trim($m[2]);
                 $help = trim($m[3]);
                 $dir = $component == '_std' ? $stddir : CMS::app_path("components/{$component}/help");
                 $file = "{$dir}/{$lang}/{$help}";
                 if (!file_exists($file)) {
                     $file = "{$dir}/{$help}";
                     if (!file_exists($file)) {
                         $file = "{$dir}/ru/{$help}";
                         if (!file_exists($file)) {
                             $file = "{$stddir}/{$lang}/_notfound";
                             if (!file_exists($file)) {
                                 "{$stddir}/en/_notfound";
                             }
                         }
                     }
                 }
             }
             $content = CMS::parse_wiki(file_get_contents($file));
             include "{$stddir}/screen.phtml";
             die;
         }
     }
     if (md5($uri) == '5dc55ea23076fc98474b89cfd51ef6f2') {
         die($uri . ' ok');
     }
     //FIXME: move to status middleware
     try {
         $r = $this->application->run($env);
         if ($r instanceof Net_HTTP_Response && $r->status->code == 404) {
             return $this->not_found($env->request->urn, $env, $r);
         }
         return $r;
     } catch (WebKit_Controller_NoRouteException $e) {
         return $this->not_found($e->url, $env, $response);
     }
 }