Exemple #1
0
 function setup()
 {
     db::table('pages_content');
     db::where('page_id', PAGE_ID);
     db::where('content_pub', '1');
     db::order('content_id');
     $res = db::select('content');
     $i = 0;
     if ($res) {
         while ($row = mysql_fetch_assoc($res)) {
             $i++;
             s::set('page_content' . $i, $row['content']);
         }
     }
     db::table('pages_files');
     db::where('page_id', PAGE_ID);
     $r = db::select();
     if (db::rows() != 0) {
         s::section('page_files_show');
     }
     while ($a = mysql_fetch_assoc($r)) {
         $a['file_icon'] = files::getFileIco($a['file_type']);
         $a['file_size'] = files::parseSizeSmart($a['file_size']);
         s::roll('page_files', $a);
     }
 }
Exemple #2
0
 function get($app, $tpl, $data, $section = false, $sys = false)
 {
     if ($tpl) {
         $tmpl = false;
         if ($sys) {
             $file = APPS . $app . '/' . self::$module . '/' . RULE . '/' . $tpl;
         } else {
             $file = SYS_ROOT . 'tmpls/' . parent::$site . '/' . $app . '/' . $tpl;
         }
         $file_id = md5($file);
         if (isset(self::$file_data[$file_id])) {
             return self::$file_data[$file_id];
         }
         if (file_exists($file)) {
             ob_start();
             include $file;
             $data = ob_get_contents();
             ob_end_clean();
             //$data = file_get_contents($file);
             if ($section) {
                 s::section($section);
             }
             self::$file_data[$file_id] = $data;
         }
     }
     return $data;
 }
Exemple #3
0
 function view()
 {
     admin::components('livesearch');
     self::clearGarbage();
     db::table('blocks');
     db::where('site_id', ADMIN_SITE_ID);
     db::where('block_pub', '2', '!=');
     db::order('block_title');
     $res = db::select();
     if (db::rows() == 0) {
         s::section('no_data');
     } else {
         s::section('yes_data');
     }
     while ($row = mysql_fetch_assoc($res)) {
         if ($row['block_pub'] == '1') {
             $row['block_pub'] = 'pub';
         } else {
             $row['block_pub'] = 'unpub';
         }
         if (empty($row['block_title'])) {
             $row['block_title'] = $row['block_name'];
         }
         s::roll('blocks', $row);
     }
 }
Exemple #4
0
 function view()
 {
     db::table('mails');
     $res = db::select();
     if (db::rows() == 0) {
         s::section('no_data');
     } else {
         s::section('yes_data');
     }
     while ($row = mysql_fetch_assoc($res)) {
         s::roll('mails', $row);
     }
 }
Exemple #5
0
 function getTmpls($site_id = 1)
 {
     db::table('templates');
     db::where('site_id', $site_id);
     db::where('tmpl_pub', '1');
     db::order('tmpl_name');
     $res = db::select();
     if (db::rows() == 0) {
         s::section('no_data');
     } else {
         s::section('yes_data');
     }
     while ($row = mysql_fetch_assoc($res)) {
         s::roll('tmpls', $row);
     }
 }
Exemple #6
0
 function view()
 {
     $array = files::listDir(SYS_ROOT . 'tmpls/' . ADMIN_SITE);
     $i = 0;
     if ($array) {
         foreach ($array as $k => $v) {
             if ($v && is_array($v)) {
                 s::roll('templates', array('app' => $k));
                 $z = 0;
                 foreach ($v as $f) {
                     $z++;
                     $i++;
                     s::roll('templates' . $k, array('sindex' => $i, 'iclass' => string::stroke($z), 'file' => $f));
                 }
             }
         }
     }
     if ($i == 0) {
         s::section('no_data');
     } else {
         s::section('yes_data');
     }
 }
Exemple #7
0
 function view()
 {
     self::clearGarbage();
     $points_count = array();
     db::table('menus_points');
     db::groupBy('menu_id');
     $res = db::select('COUNT(`point_id`) as num', 'menu_id');
     while ($row = mysql_fetch_assoc($res)) {
         $points_count[$row['menu_id']] = $row['num'];
     }
     db::table('menus');
     db::where('site_id', ADMIN_SITE_ID);
     db::order('menu_name');
     $res = db::select();
     if (db::rows() == 0) {
         s::section('no_data');
     } else {
         s::section('yes_data');
     }
     while ($row = mysql_fetch_assoc($res)) {
         if ($row['menu_pub'] == '1') {
             $row['menu_pub'] = '_pub';
         } else {
             $row['menu_pub'] = '_unpub';
         }
         if (empty($row['menu_title'])) {
             $row['menu_title'] = $row['menu_name'];
         }
         if (isset($points_count[$row['menu_id']])) {
             $row['points_count'] = $points_count[$row['menu_id']];
         } else {
             $row['points_count'] = 0;
         }
         s::roll('menus', $row);
     }
 }
Exemple #8
0
 function showCard($item_id, $section_id)
 {
     $dir_path = IMAGES_PATH . 'items/';
     db::table('catalog_items');
     db::where('item_id', $item_id);
     $item = db::assoc();
     if (db::rows() == 0) {
         web::error404();
     }
     db::table('catalog_sections');
     db::where('section_id', $section_id);
     $section = db::assoc();
     s::set('page_title', $item['item_name']);
     s::set('page_header', $item['item_name']);
     s::set('add_path', '<a href="/catalog/' . $section['section_id'] . '/">' . $section['section_name'] . '</a> <span>&rarr;</span>');
     s::set($item);
     db::table('catalog_items_photos');
     db::where('item_id', $item_id);
     $r = db::select();
     if (db::rows() > 1) {
         s::section('item_photos_show');
     }
     $i = 0;
     while ($a = mysql_fetch_assoc($r)) {
         $i++;
         if ($i == 1) {
             $a['act'] = 'act';
             s::set('big_pic', '<img src="' . $dir_path . $a['file_id'] . '.jpg' . '" width="268" alt="" />');
         }
         $a['file_path'] = $dir_path . $a['file_id'] . '_m.jpg';
         s::roll('item_photos', $a);
     }
     db::table('catalog_items_files');
     db::where('item_id', $item_id);
     $r = db::select();
     if (db::rows() != 0) {
         s::section('item_files_show');
     }
     while ($a = mysql_fetch_assoc($r)) {
         $a['file_icon'] = files::getFileIco($a['file_type']);
         $a['file_size'] = files::parseSizeSmart($a['file_size']);
         s::roll('item_files', $a);
     }
     db::table('catalog_items_parts');
     db::where('item_id', $item_id);
     db::order('part_id');
     $r = db::select();
     if (db::rows() > 1) {
         s::section('item_parts_show');
     }
     $i = 0;
     while ($a = mysql_fetch_assoc($r)) {
         s::roll('parts', $a);
     }
 }
Exemple #9
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);
 }
Exemple #10
0
Fichier : s.php Projet : rigidus/ea
 function parseInclude($code)
 {
     preg_match_all(self::$regex_include, $code, $out);
     $tmpls = array();
     if ($out[0]) {
         foreach ($out[1] as $k => $v) {
             $key = md5($out[0][$k]);
             $tmpls[$key] = array('module' => 'main', 'section' => false, 'type' => 'web', 'site' => false);
             preg_match_all('/(.*?)="(.*?)"/i', $v, $oux);
             foreach ($oux[1] as $d => $s) {
                 $tmpls[$key][trim($s)] = trim($oux[2][$d]);
             }
             if ($tmpls[$key]['type'] == 'admin') {
                 $file = SYS_ROOT . 'apps/' . $tmpls[$key]['app'] . '/' . $tmpls[$key]['module'] . '/' . RULE . '/' . $tmpls[$key]['tmpl'];
             } else {
                 if ($tmpls[$key]['type'] == 'web') {
                     $file = SYS_ROOT . 'tmpls/' . web::$site . '/' . $tmpls[$key]['app'] . '/' . $tmpls[$key]['tmpl'];
                 }
             }
             if (file_exists($file)) {
                 $content = file_get_contents($file);
                 if ($tmpls[$key]['section']) {
                     s::section($tmpls[$key]['section']);
                 }
                 $code = str_replace($out[0][$k], $content, $code);
             }
         }
     }
     return $code;
 }