Example #1
0
	function ModuleAdmin($row){
		Module::Module($row);
		
		if(User::is_root()){
			if(Url::check(array('cmd'=>'delete_cache'))){
				EClass::update_all_page();
				require_once ROOT_PATH.'includes/enbac/dir.php';
				empty_all_dir(PAGE_CACHE_DIR,true);
				Url::redirect_current();
			}
			else
			if(Url::check(array('cmd'=>'scan'))){
				require_once 'forms/scan.php';
				$this->add_form(new ScanModuleForm());
			}
			else
			{
				require_once 'forms/list.php';
				$this->add_form(new ListModuleAdminForm());
			}
		}
		else{
			Url::access_denied();
		}
	}
Example #2
0
 static function Run()
 {
     EClassApi::CheckDir(PAGE_CACHE_DIR);
     if (isset($_REQUEST['page']) && $_REQUEST['page'] != '') {
         if ($_REQUEST['page'] == "home") {
             Url::redirect_url(WEB_DIR, 301);
         }
         $page_name = strtolower($_REQUEST['page']);
     } else {
         //echo $_COOKIE['lang'];die();
         $page_name = 'home';
     }
     EClass::$page_cache_file = PAGE_CACHE_DIR . $page_name . '.php';
     if (Url::get('refresh_page') == 1) {
         self::del_page_cache($page_name);
     }
     if (Url::get('refresh_page') != 1 && PAGE_CACHE_ON && file_exists(EClass::$page_cache_file)) {
         require_once EClass::$page_cache_file;
     } else {
         $re = DB::query('SELECT id, name, title, layout  FROM page WHERE name="' . addslashes($page_name) . '"', __LINE__ . __FILE__);
         if ($re) {
             EClass::$page = mysql_fetch_assoc($re);
         }
         if (!EClass::$page) {
             Url::redirect_url(WEB_DIR, 301);
         }
         require_once ROOT_PATH . 'core/EClassGen.php';
         EClassGen::PageGenerate();
     }
 }
Example #3
0
 function PageAdmin($row)
 {
     Module::Module($row);
     if (User::is_root()) {
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case 'delete_all_cache':
                 EClass::update_all_page();
                 require_once ROOT_PATH . 'includes/enbac/dir.php';
                 empty_all_dir(PAGE_CACHE_DIR, true);
                 Url::redirect_current();
                 break;
             case 'refresh':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     EClass::update_page($id);
                     if (Url::check('href')) {
                         Url::redirect_url($_REQUEST['href']);
                     } else {
                         Url::redirect_current();
                     }
                 }
                 Url::redirect_current();
                 break;
             case 'delete':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     DB::delete('block', 'page_id=' . $id);
                     DB::delete_id('page', $id);
                     require_once ROOT_PATH . 'includes/enbac/dir.php';
                     empty_all_dir(DIR_CACHE . 'pages', true);
                     empty_all_dir(DIR_CACHE . 'modules', true);
                 }
                 Url::redirect_current();
                 break;
             case 'edit':
             case 'add':
             case 'copy':
                 require_once 'forms/edit.php';
                 $this->add_form(new EditPageAdminForm());
                 break;
             case 'export_xml':
                 require_once 'forms/export_xml.php';
                 $this->add_form(new ExportXmlPageAdminForm());
                 break;
             case 'import_xml':
                 require_once 'forms/import_xml.php';
                 $this->add_form(new ImportXmlPageAdminForm());
                 break;
             default:
                 require_once 'forms/list.php';
                 $this->add_form(new ListPageAdminForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #4
0
File: list.php Project: hqd276/bigs
 function on_submit()
 {
     if (Url::get('cmd') == 'delete_items') {
         $selected_ids = Url::get('selected_ids');
         if ($selected_ids) {
             $ids = implode(',', $selected_ids);
             if ($ids) {
                 EClass::update_page($ids);
                 DB::delete('block', 'page_id IN(' . $ids . ')');
                 DB::delete('page', 'id IN(' . $ids . ')');
                 require_once ROOT_PATH . 'includes/enbac/dir.php';
                 empty_all_dir(PAGE_CACHE_DIR, true);
             }
         }
         Url::redirect_current();
     }
 }
Example #5
0
File: edit.php Project: hqd276/bigs
 function on_submit()
 {
     $name = trim(Url::get('name'));
     $title = trim(Url::get('title'));
     $layout = trim(Url::get('layout'));
     $description = trim(Url::get('description'));
     $this->checkFormInput('Tên page', 'name', $name, 'uname', true, '', 1, 255);
     if (!$layout) {
         $this->setFormError('layout', 'Bạn chưa chọn Layout!');
     } elseif (!file_exists(ROOT_PATH . $layout)) {
         $this->setFormError('layout', 'Layout không tồn tại!');
     }
     $this->checkFormInput('Tiêu đề', 'title', $title, 'str', false, '', 0, 255);
     $this->checkFormInput('Mô tả', 'description', $description, 'str', false, '', 0, 255);
     if (!$this->errNum) {
         $new_row = array('name' => $name, 'title' => $title, 'layout' => $layout, 'description' => $description);
         if (Url::get('cmd') == 'copy') {
             if ($name == $this->page['name'] || DB::select('page', 'name="' . $name . '"')) {
                 $this->setFormError('name', 'Tên trang "' . $name . '" đã tồn tại, hãy chọn tên khác!');
                 return;
             }
             $id = DB::insert('page', $new_row);
             if ($id) {
                 $re = DB::query('SELECT id, module_id, page_id, region, position FROM block WHERE page_id=' . $this->page['id']);
                 if ($re) {
                     while ($row = mysql_fetch_assoc($re)) {
                         unset($row['id']);
                         $row['page_id'] = $id;
                         DB::insert('block', $row);
                     }
                 }
             }
         } elseif (Url::get('cmd') == 'edit') {
             DB::update('page', $new_row, 'id=' . $this->page['id']);
             EClass::update_page($this->page['id']);
         } else {
             $id = DB::insert('page', $new_row);
         }
         Url::redirect_current();
     }
 }
Example #6
0
<?
EClass::$page = array ( 'id' => '7271', 'name' => 'signin', 'title' => 'Đăng nhập', 'layout' => 'layouts/default.html',);
$blocks = array(48798=>array('id'=>'48798','module_id'=>'5557','region'=>'header','module'=>array('id'=>'5557','name'=>'Header',),),48582=>array('id'=>'48582','module_id'=>'5524','region'=>'footer','module'=>array('id'=>'5524','name'=>'Footer',),),49974=>array('id'=>'49974','module_id'=>'1704','region'=>'center','module'=>array('id'=>'1704','name'=>'SignIn',),),);
foreach($blocks as &$block){
	if(file_exists(DIR_MODULE.$block['module']['name'].'/class.php')){
		require_once DIR_MODULE.$block['module']['name'].'/class.php';
		$block['object'] = new $block['module']['name']($block);
		
		if(isset($_POST['form_block_id']) && $_POST['form_block_id'] == $block['id']){
			$block['object']->submit();
		}
	}
}
require_once ROOT_PATH."core/PageBegin.php" ?>
<? if(isset($blocks[48798]['object'])) $blocks[48798]['object']->on_draw();?>
<!--end: #header -->
<div class="site-body">

<? if(isset($blocks[49974]['object'])) $blocks[49974]['object']->on_draw();?>
<!--end: main body-->
</div>

<? if(isset($blocks[48582]['object'])) $blocks[48582]['object']->on_draw();?>
<!--end: mod-footer-->

<? require_once ROOT_PATH.'core/PageEnd.php' ?>
Example #7
0
<?
EClass::$page = array ( 'id' => '150', 'name' => 'sign_out', 'title' => 'Kết thúc phiên làm việc', 'layout' => 'layouts/blank.html',);
$blocks = array(49026=>array('id'=>'49026','module_id'=>'148','region'=>'center','module'=>array('id'=>'148','name'=>'SignOut',),),);
foreach($blocks as &$block){
	if(file_exists(DIR_MODULE.$block['module']['name'].'/class.php')){
		require_once DIR_MODULE.$block['module']['name'].'/class.php';
		$block['object'] = new $block['module']['name']($block);
		
		if(isset($_POST['form_block_id']) && $_POST['form_block_id'] == $block['id']){
			$block['object']->submit();
		}
	}
}
require_once ROOT_PATH."core/PageBegin.php" ?>
<? if(isset($blocks[49026]['object'])) $blocks[49026]['object']->on_draw();?>
<? require_once ROOT_PATH.'core/PageEnd.php' ?>
Example #8
0
<?
EClass::$page = array ( 'id' => '6957', 'name' => 'register', 'title' => '', 'layout' => 'layouts/default.html',);
$blocks = array(50108=>array('id'=>'50108','module_id'=>'5557','region'=>'header','module'=>array('id'=>'5557','name'=>'Header',),),49867=>array('id'=>'49867','module_id'=>'45','region'=>'center','module'=>array('id'=>'45','name'=>'Register',),),50150=>array('id'=>'50150','module_id'=>'5524','region'=>'footer','module'=>array('id'=>'5524','name'=>'Footer',),),);
foreach($blocks as &$block){
	if(file_exists(DIR_MODULE.$block['module']['name'].'/class.php')){
		require_once DIR_MODULE.$block['module']['name'].'/class.php';
		$block['object'] = new $block['module']['name']($block);
		
		if(isset($_POST['form_block_id']) && $_POST['form_block_id'] == $block['id']){
			$block['object']->submit();
		}
	}
}
require_once ROOT_PATH."core/PageBegin.php" ?>
<? if(isset($blocks[50108]['object'])) $blocks[50108]['object']->on_draw();?>
<!--end: #header -->
<div class="site-body">

<? if(isset($blocks[49867]['object'])) $blocks[49867]['object']->on_draw();?>
<!--end: main body-->
</div>

<? if(isset($blocks[50150]['object'])) $blocks[50150]['object']->on_draw();?>
<!--end: mod-footer-->

<? require_once ROOT_PATH.'core/PageEnd.php' ?>
Example #9
0
<?php

$rtime = microtime();
$rtime = explode(" ", $rtime);
$rtime = $rtime[1] + $rtime[0];
$start_rb = $rtime;
require_once 'core/Debug.php';
//System Debug...
require_once 'core/config.php';
//System Config...
require_once 'core/Init.php';
//System Init...
tbug('Load core files');
EClass::Run();
//System process & output...
//require_once('my_tracker.php');  //tracker location
tbug('End of Page');
exit;
Example #10
0
<?
EClass::$page = array ( 'id' => '7764', 'name' => 'personal', 'title' => 'Trang cá nhân', 'layout' => 'layouts/default.html',);
$blocks = array(50148=>array('id'=>'50148','module_id'=>'5524','region'=>'footer','module'=>array('id'=>'5524','name'=>'Footer',),),50147=>array('id'=>'50147','module_id'=>'5557','region'=>'header','module'=>array('id'=>'5557','name'=>'Header',),),50149=>array('id'=>'50149','module_id'=>'5743','region'=>'center','module'=>array('id'=>'5743','name'=>'Personal',),),);
foreach($blocks as &$block){
	if(file_exists(DIR_MODULE.$block['module']['name'].'/class.php')){
		require_once DIR_MODULE.$block['module']['name'].'/class.php';
		$block['object'] = new $block['module']['name']($block);
		
		if(isset($_POST['form_block_id']) && $_POST['form_block_id'] == $block['id']){
			$block['object']->submit();
		}
	}
}
require_once ROOT_PATH."core/PageBegin.php" ?>
<? if(isset($blocks[50147]['object'])) $blocks[50147]['object']->on_draw();?>
<!--end: #header -->
<div class="site-body">

<? if(isset($blocks[50149]['object'])) $blocks[50149]['object']->on_draw();?>
<!--end: main body-->
</div>

<? if(isset($blocks[50148]['object'])) $blocks[50148]['object']->on_draw();?>
<!--end: mod-footer-->

<? require_once ROOT_PATH.'core/PageEnd.php' ?>
Example #11
0
File: Init.php Project: hqd276/bigs
<?php

if (REWRITE_ON) {
    ob_start();
    //start buffering//@ob_start('ob_gzhandler');
}
require_once ROOT_PATH . 'core/AutoLoader.php';
if (MEMCACHE_ON) {
    CGlobal::$memcache_server = $memcache_server;
}
unset($memcache_server, $server_list, $img_server, $img_ftp_server);
if (isset($_REQUEST['trigger']) && (int) $_REQUEST['trigger'] == 1) {
    EBArrCache::del_cache();
    ECCache::auto_delete();
    StaticCache::delCache();
    EClass::del_page_cache();
    exit;
}
if (isset($_GET['page']) && $_GET['page'] == 'error') {
    define('ERROR_PAGE', 1);
} else {
    define('ERROR_PAGE', 0);
}
if (!EClassApi::is_search_engine() && !defined('NO_SESSION') && !ERROR_PAGE) {
    if (SESSION_TYPE == 'db') {
        require_once ROOT_PATH . 'includes/session.class.php';
        //Session db store
    } elseif (SESSION_TYPE == 'memcache') {
        require_once ROOT_PATH . "includes/memcache.session.php";
        //Session memcache store
    } else {
Example #12
0
File: home.php Project: hqd276/bigs
<?
EClass::$page = array ( 'id' => '3009', 'name' => 'home', 'title' => 'Trang chủ', 'layout' => 'layouts/default.html',);
$blocks = array(50125=>array('id'=>'50125','module_id'=>'5524','region'=>'footer','module'=>array('id'=>'5524','name'=>'Footer',),),50146=>array('id'=>'50146','module_id'=>'5735','region'=>'center','module'=>array('id'=>'5735','name'=>'Home',),),48878=>array('id'=>'48878','module_id'=>'5557','region'=>'header','module'=>array('id'=>'5557','name'=>'Header',),),);
foreach($blocks as &$block){
	if(file_exists(DIR_MODULE.$block['module']['name'].'/class.php')){
		require_once DIR_MODULE.$block['module']['name'].'/class.php';
		$block['object'] = new $block['module']['name']($block);
		
		if(isset($_POST['form_block_id']) && $_POST['form_block_id'] == $block['id']){
			$block['object']->submit();
		}
	}
}
require_once ROOT_PATH."core/PageBegin.php" ?>
<? if(isset($blocks[48878]['object'])) $blocks[48878]['object']->on_draw();?>
<!--end: #header -->
<div class="site-body">

<? if(isset($blocks[50146]['object'])) $blocks[50146]['object']->on_draw();?>
<!--end: main body-->
</div>

<? if(isset($blocks[50125]['object'])) $blocks[50125]['object']->on_draw();?>
<!--end: mod-footer-->

<? require_once ROOT_PATH.'core/PageEnd.php' ?>
Example #13
0
    function EditPage($row)
    {
        Module::Module($row);
        if (User::is_root()) {
            $cmd = Url::get('cmd');
            switch ($cmd) {
                case 'change_layout':
                    $id = (int) Url::get('id', 0);
                    $new_layout = Url::get('new_layout');
                    if ($id && $new_layout && file_exists(ROOT_PATH . $new_layout)) {
                        DB::update('page', array('layout' => $new_layout), 'id=' . $id);
                    }
                    EClass::update_page(Url::get('id'));
                    if (Url::check('href') && Url::get('href')) {
                        Url::redirect_url(Url::get('href'));
                    } else {
                        Url::redirect_current(array('id' => Url::get('id')));
                    }
                    break;
                case 'delete_block':
                    $id = (int) Url::get('id', 0);
                    $block_id = (int) Url::get('block_id', 0);
                    if ($block_id) {
                        DB::delete('block', "id={$block_id}");
                        EClass::update_page($id);
                    }
                    if (Url::check('href') && Url::get('href')) {
                        Url::redirect_url(Url::get('href'));
                    } else {
                        Url::redirect_current(array('id' => $id));
                    }
                    break;
                case 'move_bottom':
                case 'move_top':
                    $id = (int) Url::get('id', 0);
                    $block_id = (int) Url::get('block_id', 0);
                    if ($block_id && $id) {
                        $page = DB::select('page', 'id=' . $id);
                        $block = DB::select('block', 'id=' . $block_id);
                        if ($block && $page) {
                            $region = $block['region'];
                            if ($cmd == 'move_bottom') {
                                $position = DB::fetch('SELECT MAX(position) AS amax FROM block WHERE region="' . $region . '" AND page_id="' . $id . '"', 'amax', 0);
                                if ($position) {
                                    $position++;
                                } else {
                                    $position = 1;
                                }
                            } else {
                                $position = DB::fetch('SELECT MIN(position) AS amin FROM block WHERE region="' . $region . '" AND page_id="' . $id . '"', 'amax', 0);
                                if ($position) {
                                    $position--;
                                } else {
                                    $position = 1;
                                }
                            }
                            DB::update('block', array('region' => $region, 'position' => $position), 'id="' . $block_id . '"');
                            EClass::update_page($id);
                        }
                    }
                    if (Url::check('href') && Url::get('href')) {
                        Url::redirect_url(Url::get('href'));
                    } else {
                        Url::redirect_current(array('id' => $id));
                    }
                    break;
                case 'move':
                    $id = (int) Url::get('id', 0);
                    $block_id = (int) Url::get('block_id', 0);
                    $dir = Url::get('move');
                    if ($id && $block_id && $dir) {
                        $block = DB::select('block', $block_id);
                        if ($block) {
                            if ($dir == 'up') {
                                $move[0] = '<';
                                $move[1] = 'DESC';
                            } else {
                                $move[0] = '>';
                                $move[1] = 'ASC';
                            }
                            if (DB::query('SELECT * FROM block WHERE region="' . DB::escape($block['region']) . '" AND page_id="' . $block['page_id'] . '"
									AND position' . $move[0] . $block['position'] . ' ORDER BY position ' . $move[1])) {
                                if ($row = DB::fetch()) {
                                    DB::update('block', array('position' => $block['position']), '`id`=' . $row['id']);
                                    DB::update('block', array('position' => $row['position']), '`id`=' . $block['id']);
                                }
                            }
                            EClass::update_page($id);
                        }
                    }
                    if (Url::check('href') && Url::get('href')) {
                        Url::redirect_url(Url::get('href'));
                    } else {
                        Url::redirect_current(array('id' => $id));
                    }
                    break;
                default:
                    $id = (int) Url::get('id', 0);
                    $module_id = (int) Url::get('module_id', 0);
                    $region = Url::get('region');
                    if (!$id) {
                        Url::redirect('page');
                    }
                    if ($module_id && $region) {
                        $position = DB::fetch('SELECT MAX(position) AS amax FROM block WHERE region="' . $region . '" AND page_id="' . $id . '"', 'amax', 0);
                        if ($position) {
                            $position++;
                        }
                        if ($position <= 0) {
                            $position = 1;
                        }
                        DB::insert('block', array('region' => $region, 'position' => $position, 'page_id' => $id, 'module_id' => $module_id));
                        EClass::update_page($id);
                        if (Url::check('href') && Url::get('href')) {
                            Url::redirect_url(Url::get('href'));
                        } else {
                            Url::redirect_current(array('id' => $id));
                        }
                    } else {
                        //Cấu hình page:
                        require_once 'forms/page_content.php';
                        $this->add_form(new PageContentForm());
                        break;
                    }
                    break;
            }
        } else {
            Url::access_denied();
        }
    }