Esempio n. 1
0
 function run()
 {
     $theme = Settings::getValue('theme');
     $module = ($result = explode('/', Request::get('module'))) && sizeof($result) > 1 ? $result[sizeof($result) - 1] : Request::get('module');
     $this->template = App::getAppName() . strtoupper(substr($module, 0, 1)) . substr($module, 1) . strtoupper(substr(Request::get('action'), 0, 1)) . substr(Request::get('action'), 1);
     $this->defaultVar = array('theme_name' => $theme, 'theme_url' => App::getAppUrl() . APP_TEMPLATES_DIR . DS . 'themes' . DS . $theme . DS, 'dir_include_frontend' => APP_DIR . DS . 'connection' . DS . APP_TEMPLATES_DIR . DS . 'frontend' . DS . 'include');
     $assign = is_array($result = $this->execute()) ? $result : array();
     if ($this->exit) {
         return;
     }
     if ($this->notFound) {
         $this->setSeoPage('404');
     }
     $seo = connectionSeoModel::create()->getByLocale($this->seoPage, Language::getActiveLanguageISO());
     if (empty($this->default['page_title'])) {
         $this->default['page_title'] = $seo['title'];
     }
     if (empty($this->default['page_meta']['description'])) {
         $this->default['page_meta']['description'] = $seo['description'];
     }
     if (empty($this->default['page_meta']['keywords'])) {
         $this->default['page_meta']['keywords'] = $seo['keywords'];
     }
     if ($this->notFound) {
         $sourceAction = $this->fenom->fetch('themes/' . $theme . '/404.html', array_merge($assign, $this->defaultVar));
     } else {
         $sourceAction = $this->fenom->fetch(Request::get('module') . DS . $this->template . '.html', array_merge($assign, $this->defaultVar));
     }
     if ($this->frame) {
         $this->fenom->display('themes/' . $theme . '/index.html', array_merge(array('action' => $sourceAction), $this->default, $this->defaultVar));
     } else {
         echo $sourceAction;
     }
 }
Esempio n. 2
0
 function execute()
 {
     Load::file('Fenom.php', $this->source_dir);
     Fenom::registerAutoload();
     $templatesDir = APP_DIR . DS . App::getAppName() . DS . APP_TEMPLATES_DIR;
     $fenom = Fenom::factory($templatesDir, TEMP_DIR . DS . $this->name . DS . 'templates_c');
     $fenom->setOptions(array('auto_reload' => true));
     return $fenom;
 }
Esempio n. 3
0
 function createTable($config)
 {
     $app = App::getAppName();
     $table = $this->table;
     $exist = $this->query('SHOW TABLES LIKE "' . $table . '"')->rowCount();
     if ($exist == 0) {
         $dumpDir = APP_DIR . DS . $app . DS . APP_CONFIG_DIR . DS . 'dump' . DS;
         $dumpFile = $dumpDir . $table . '.sql';
         if (is_dir($dumpDir) && file_exists($dumpFile)) {
             $dump = file_get_contents($dumpFile);
             $this->query($dump);
         }
     }
 }
 function execute()
 {
     $page_id = Request::post('page_id');
     if (!$page_id) {
         exit;
     }
     $model = new connectionPagesModel();
     $locale = new Locales('connection');
     $list = $locale->getList();
     $this->smarty->assign('lang', $list);
     $this->smarty->assign('page', $model->getPage($page_id));
     $this->smarty->display(APP_DIR . DS . App::getAppName() . DS . APP_TEMPLATES_DIR . DS . 'backend' . DS . '/include/modal/pageEdite.html');
     exit;
 }
Esempio n. 5
0
 static function Action($app_dir, $action_name, $app = false, $module_name = false)
 {
     $m = $module_name ? $module_name : Request::get('module');
     $dir = $app_dir . APP_ACTIONS_DIR . DS . $m . DS;
     $module = ($result = explode('/', $m)) && sizeof($result) > 1 ? $result[sizeof($result) - 1] : $m;
     $controller_file = ($app ? $app : App::getAppName()) . ucfirst($module);
     $action_file = $controller_file . ucfirst($action_name);
     if (self::file($action_file . '.action.php', $dir)) {
         $work_action = $action_file . 'Action';
     } else {
         if (self::file($controller_file . '.controller.php', $dir)) {
             $work_action = $controller_file . 'Controller';
         } else {
             throw new Exception('Not found action', '404');
         }
     }
     $exec = new $work_action();
     return $exec->run();
 }
Esempio n. 6
0
 function run()
 {
     $module = ($result = explode('/', Request::get('module'))) && sizeof($result) > 1 ? $result[sizeof($result) - 1] : Request::get('module');
     $this->smarty->setTemplateDir(APP_DIR . DS . App::getAppName() . DS . APP_TEMPLATES_DIR . DS . Request::get('module') . DS);
     if (sizeof($result) > 0) {
         $this->smarty->addTemplateDir(APP_DIR . DS . App::getAppName() . DS . APP_THEMES . DS . APP_DEFAULT_THEME . DS . $result[0] . DS);
     }
     $this->smarty->addTemplateDir(APP_DIR . DS . App::getAppName() . DS . APP_THEMES . DS . APP_DEFAULT_THEME . DS . Request::get('module') . DS);
     $this->smarty->addTemplateDir(APP_DIR . DS . App::getAppName() . DS . APP_THEMES . DS . APP_DEFAULT_THEME . DS . Request::get('app_theme') . DS);
     $this->smarty->addTemplateDir(APP_DIR . DS . 'core' . DS . APP_THEMES . DS . APP_DEFAULT_THEME . DS . Request::get('app_theme') . DS);
     // Fix it: defaul Backend themes
     $this->template = App::getAppName() . strtoupper(substr($module, 0, 1)) . substr($module, 1) . strtoupper(substr(Request::get('action'), 0, 1)) . substr(Request::get('action'), 1);
     $this->smarty->assign('frame', true);
     Request::get('dataType', 'html');
     $this->execute();
     $template_extention = isset($this->extention) ? $this->extention : 'html';
     if (isset($this->frame) && !$this->frame) {
         $this->smarty->display($this->template . '.' . $template_extention);
         return true;
     }
     $this->smarty->assign('main_template', $this->template . '.' . $template_extention);
     $this->smarty->display('index.html');
     Debug::enable();
 }
Esempio n. 7
0
 function getAppLocale($lang)
 {
     $appLocale = APP_DIR . DS . App::getAppName() . DS . APP_LOCALE . DS . strtolower($lang) . DS . strtolower($lang) . '.locale.php';
     return file_exists($appLocale) ? include $appLocale : array();
 }
Esempio n. 8
0
 static function set($key, $value, $app = false, $save = true)
 {
     $app = !$app ? App::getAppName() : $app;
     $array = self::get($key, $app);
     if ($array) {
         self::$settings[$app][$key]['value'] = $value;
     } else {
         return false;
     }
     if ($save) {
         return self::save($app);
     }
     return true;
 }