Example #1
0
 function edit()
 {
     events::observe('save', 'templates', 'apps', '_save');
     events::observer();
     $tmpl_file = events::get('tmpl_file');
     $app = events::get('app');
     if (events::detect('restore')) {
         self::restoreVersion($app, $tmpl_file, events::get('restore'));
     }
     admin::components('tabs', 'validator');
     f::set('app', $app);
     f::set('tmpl_file', $tmpl_file);
     s::set('app', $app);
     s::set('tmpl_file', $tmpl_file);
     $file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file;
     $code = files::get($file);
     f::set('tmpl_code', $code);
     self::getApps();
     /*
     	Load versions
     */
     db::table('templates_versions');
     db::where('app', $app);
     db::where('tmpl_file', $tmpl_file);
     db::order('version_date', 'DESC');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         $row['version_date'] = dt::date2print('%H:%i %d.%m.%Y', $row['version_date']);
         $row['version_code'] = '{non}' . htmlspecialchars($row['version_code']) . '{/non}';
         s::roll('versions', $row);
     }
 }
Example #2
0
 function isCheck($name, $index = false)
 {
     if (events::get($name, $index) === false) {
         return false;
     } else {
         return true;
     }
 }
Example #3
0
 public function listAll()
 {
     $toReturn = array();
     if ($this->data['users']->role == "admin") {
         $toReturn['events'] = events::get()->toArray();
     } else {
         $toReturn['events'] = events::where('eventFor', $this->data['users']->role)->orWhere('eventFor', 'all')->get()->toArray();
     }
     foreach ($toReturn['events'] as $key => $item) {
         $toReturn['events'][$key]['eventDescription'] = strip_tags(htmlspecialchars_decode($toReturn['events'][$key]['eventDescription'], ENT_QUOTES));
     }
     $toReturn['userRole'] = $this->data['users']->role;
     return $toReturn;
 }
Example #4
0
 function edit()
 {
     events::observe('save', 'templates', '_edit');
     events::observer();
     if (events::detect('restore')) {
         self::restoreVersion(events::get('restore'));
     }
     admin::components('tabs', 'validator', 'upload');
     appPages::getPagesSelect(ADMIN_SITE_ID);
     appTemplates::getTmpls(ADMIN_SITE_ID);
     $tmpl_id = admin::get('id');
     db::table('templates');
     db::where('tmpl_id', $tmpl_id);
     $row = db::assoc();
     f::set($row);
     $file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $row['tmpl_file'];
     f::set('tmpl_code', files::get($file));
     db::table('pages');
     db::where('tmpl_id', $tmpl_id);
     $res = db::select();
     $pages = array();
     while ($row = mysql_fetch_assoc($res)) {
         $pages[$row['page_id']] = $row['page_id'];
     }
     if ($pages) {
         f::set('allPages', 0);
         f::set('pages', $pages);
     }
     /*
     	Load versions
     */
     db::table('templates_versions');
     db::where('tmpl_id', $tmpl_id);
     db::order('version_date', 'DESC');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         $row['version_date'] = dt::date2print('%H:%i:%s %d.%m.%Y', $row['version_date']);
         $row['version_code'] = '{non}' . htmlspecialchars($row['version_code']) . '{/non}';
         s::roll('versions', $row);
     }
 }
Example #5
0
 function add()
 {
     events::observe('add', 'pages', 'addPage');
     events::observer();
     if (events::detect('add')) {
         return true;
     }
     if (events::detect('parent')) {
         $parent = events::get('parent');
         db::table('pages');
         db::where('page_id', $parent);
         db::update('page_child', '1');
         f::set('page_parent', $parent);
     }
     admin::components('tabs', 'validator', 'upload');
     if (settings::get('pages', 'redactor')) {
         admin::components('redactor');
         s::section('redactor');
     }
     appPages::getPagesSelect(ADMIN_SITE_ID);
     appPages::getParentPages(ADMIN_SITE_ID, true);
     appTemplates::getTmpls(ADMIN_SITE_ID);
     // test reserved
     db::table('admin_reserved');
     db::where('`table`', 'pages');
     db::where('user_id', ADMIN_USER_ID);
     $page_id = db::get('id');
     if (db::rows() == 0) {
         db::table('pages');
         $array = array('page_date' => 'NOW()', 'page_pub' => '2', 'page_handler' => '0', 'page_dynamic' => '0', 'page_cache' => '0', 'page_map' => '0', 'page_child' => '0', 'page_level' => 0, 'site_id' => ADMIN_SITE_ID);
         db::smartInsert($array);
         $page_id = mysql_insert_id();
         db::table('admin_reserved');
         db::insert('', 'pages', $page_id, ADMIN_USER_ID);
     }
     f::set('page_id', $page_id);
 }