Пример #1
0
function empty_all_dir($name, $remove_sub_dir = false, $remove_self = false)
{
    if (is_dir($name)) {
        if ($dir = opendir($name)) {
            $dirs = array();
            while ($file = readdir($dir)) {
                if ($file != '..' and $file != '.') {
                    if (is_dir($name . '/' . $file)) {
                        $dirs[] = $file;
                    } else {
                        @unlink($name . '/' . $file);
                    }
                }
            }
            closedir($dir);
            foreach ($dirs as $dir_) {
                if ($remove_self || $remove_sub_dir) {
                    empty_all_dir($name . '/' . $dir_, true, true);
                } else {
                    empty_all_dir($name . '/' . $dir_, false, false);
                }
            }
            if ($remove_self) {
                @rmdir($name);
            }
        }
    }
}
Пример #2
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();
		}
	}
Пример #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();
     }
 }
Пример #4
0
 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();
     }
 }