Exemplo n.º 1
0
Arquivo: CMS.php Projeto: demental/m
 protected function populateCMS($action)
 {
     try {
         $content = Mreg::get('content');
     } catch (Exception $e) {
         $content = DB_DataObject::factory($this->_dbtable);
     }
     if (!$this->_forceaccessible && !empty($this->_dbaccessibleaspage)) {
         $content->{$this->_dbaccessibleaspage} = 1;
     }
     if (key_exists('alias_id', $content->table())) {
         $content->whereAdd('alias_id is null');
     }
     if (!$content->get($this->_dbstrip, $action)) {
         $this->handleNotFound($action);
         return;
     }
     if ($content->{$this->_dbisnode}) {
         $target = strtolower(str_replace('Module_', '', get_class($this))) . '/' . $content->getPlugin('tree')->getFirstChild($content)->{$this->_dbstrip};
         $this->redirect301($target);
     }
     $this->assignRef('content', $content);
     $this->_content = $content;
     try {
         Mreg::set('content', $content);
     } catch (Exception $e) {
     }
     $this->assign($this->_tpltitle, $content->{$this->_dbtitle});
 }
Exemplo n.º 2
0
Arquivo: setup.php Projeto: demental/m
 public function setup()
 {
     M_Office_Util::$mainOptions = PEAR::getStaticProperty('m_office', 'options');
     M::addPaths('module', array(APP_ROOT . 'app/_shared/modules/', APP_ROOT . 'app/' . APP_NAME . '/modules/', 'M/Office/modules/'));
     M::addPaths('template', array(OFFICE_TEMPLATES_FOLDER, APP_ROOT . 'app/_shared/templates/', APP_ROOT . 'app/' . APP_NAME . '/templates/'));
     if (Config::getPref('theme')) {
         M::addPaths('template', array(APP_ROOT . 'public/themes/' . Config::getPref('theme') . '/templates/'));
     }
     $tpl = new Mtpl(M::getPaths('template'));
     $tpl->assign('jsdir', SITE_URL . 'js/');
     Mreg::set('tpl', $tpl);
 }
Exemplo n.º 3
0
 protected function populateCMS()
 {
     $content = DB_DataObject::factory($this->_dbtable);
     $content->{$this->_dbstrip} = $this->_dataAction;
     if (!$content->find(true)) {
         //      $this->redirect('404');
         $this->_dbnotfound = 1;
         return;
     }
     $this->assignRef('content', $content);
     try {
         Mreg::set('content', $content);
     } catch (Exception $e) {
     }
     $this->assign($this->_tpltitle, $content->{$this->_dbtitle});
 }
Exemplo n.º 4
0
Arquivo: M.php Projeto: demental/m
 public static function bootstrap()
 {
     $paths[] = APP_ROOT . 'app/_shared/';
     $paths[] = APP_ROOT . 'app/' . APP_NAME . '/';
     $paths[] = APP_ROOT . 'app/';
     set_include_path(get_include_path() . ':' . implode(':', $paths));
     if (defined('E_DEPRECATED')) {
         ini_set('error_reporting', E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
     } else {
         ini_set('error_reporting', E_ALL & ~E_STRICT & ~E_NOTICE);
     }
     switch (MODE) {
         case 'development':
             ini_set('display_errors', 1);
             $caching = false;
             break;
         case 'test':
             ini_set('display_errors', 1);
             $caching = false;
             break;
         case 'production':
             ini_set('display_errors', 0);
             $caching = true;
             break;
     }
     T::setConfig(array('path' => APP_ROOT . 'app/' . APP_NAME . '/lang/', 'encoding' => 'utf8', 'saveresult' => false, 'driver' => 'reader', 'autoexpire' => MODE == 'development'));
     if (!defined('DEFAULT_LANG')) {
         define('DEFAULT_LANG', 'en');
     }
     M::addPath('lang', dirname(__FILE__) . '/lang/');
     $lang = $_REQUEST['lang'] ? $_REQUEST['lang'] : DEFAULT_LANG;
     T::setLang($lang);
     M::addPath('templates', APP_ROOT . 'app/_shared/templates/');
     M::addPath('templates', APP_ROOT . 'app/' . APP_NAME . '/templates/');
     M::addPath('modules', 'modules');
     M::addPath('plugins', realpath(dirname(__FILE__)));
     M::addPath('plugins', APP_ROOT . 'app/');
     $opt =& PEAR::getStaticProperty('Module', 'global');
     $opt['caching'] = $caching;
     $opt['cacheDir'] = APP_ROOT . 'app/' . APP_NAME . '/cache/';
     $opt['cacheTime'] = 7200;
     $dispatchopt =& PEAR::getStaticProperty('Dispatcher', 'global');
     $dispatchopt['all']['loginmodule'] = 'user';
     $dispatchopt['all']['loginaction'] = 'login';
     $dispatchopt['all']['modulepath'] = array('modules');
     require APP_ROOT . 'app/setup.php';
     $setup = new M_setup();
     spl_autoload_register('M::m_autoload_db_dataobject');
     Mreg::set('setup', $setup);
 }
Exemplo n.º 5
0
        $caching = false;
        break;
    case 'production':
        ini_set('error_reporting', E_ALL ^ E_NOTICE);
        ini_set('display_errors', 0);
        $caching = true;
        break;
}
/**
 * Translation initialization (TODO move this out of the startup file, maybe setup)
 */
T::setConfig(array('path' => APP_ROOT . 'app/' . APP_NAME . '/lang/', 'encoding' => 'utf-8', 'saveresult' => false, 'cacheDir' => APP_ROOT . 'app/' . APP_NAME . '/cache/'));
// TODO define a default lang, not french hardcoded
$opt =& PEAR::getStaticProperty('Module', 'global');
$opt['template_dir'] = array(APP_ROOT . 'app/' . APP_NAME . '/templates/');
$opt['caching'] = $caching;
$opt['cacheDir'] = APP_ROOT . 'app/' . APP_NAME . '/cache/' . $host . '/';
$opt['cacheTime'] = 7200;
$dispatchopt =& PEAR::getStaticProperty('Dispatcher', 'global');
$dispatchopt['all']['loginmodule'] = 'user';
$dispatchopt['all']['loginaction'] = 'login';
$dispatchopt['all']['modulepath'] = array('modules');
/**
* TODO config & setup : maybe we should rename them to pre-cache & post-cache config ?
**/
include APP_ROOT . 'app/config.php';
include APP_ROOT . 'app/' . APP_NAME . '/config.php';
include APP_ROOT . 'app/setup.php';
$setup = new M_setup();
Mreg::set('setup', $setup);