function add()
 {
     if (Upload::isUploadSuccessful("my_file")) {
         $peer = new ImmaginiPeer();
         $do = $peer->new_do();
         $peer->setupByParams($do);
         $d = new Dir("/immagini/user/" . Session::get("/session/username") . Params::get("folder"));
         if (!$d->exists()) {
             $d->touch();
         }
         $do->save_folder = $d->getPath();
         $do->real_name = Upload::getRealFilename("my_file");
         $do->folder = Params::get("folder");
         $tokens = explode(".", Upload::getRealFilename("my_file"));
         $extension = $tokens[count($tokens) - 1];
         $do->hash_name = md5(uniqid()) . "." . strtolower($extension);
         Upload::saveTo("my_file", $do->save_folder, $do->hash_name);
         $peer->save($do);
         if (is_html()) {
             Flash::ok("Immagine aggiunta con successo.");
             return Redirect::success();
         } else {
             return ActiveRecordUtils::toArray($do);
         }
     } else {
         Flash::error(Upload::getUploadError("my_file"));
         return Redirect::failure();
     }
 }
 public function getAllExpression($flush = false)
 {
     $cache_id = '_model_expression';
     if (($res = F($cache_id)) === false || $flush === true) {
         global $ts;
         $pkg = $ts['site']['expression'];
         $filepath = SITE_PATH . '/public/themes/' . $ts['site']['site_theme'] . '/images/expression/' . $pkg;
         require_once ADDON_PATH . '/libs/Io/Dir.class.php';
         $expression = new Dir($filepath);
         $expression_pkg = $expression->toArray();
         $res = array();
         foreach ($expression_pkg as $value) {
             if (!is_utf8($value['filename'])) {
                 $value['filename'] = auto_charset($value['filename'], 'GBK', 'UTF8');
             }
             list($file) = explode(".", $value['filename']);
             $temp['title'] = $file;
             $temp['emotion'] = '[' . $file . ']';
             $temp['filename'] = $value['filename'];
             $temp['type'] = $pkg;
             $res[$temp['emotion']] = $temp;
         }
         F($cache_id, $res);
     }
     return $res;
 }
Example #3
0
 /**
  *	Return possible template names that can be used by the nodes
  *	for rendering by listing all files from the node view directory
  *	
  * 	@return array(string)
  */
 public function templateNames()
 {
     $templateNames = new IndexedArray();
     // get correct template directory from appcontroller’s theme
     $r = get_class_vars('AppController');
     if (empty($r['theme'])) {
         $templateDir = VIEW_DIR . 'node/';
     } else {
         $templateDir = VIEW_DIR . 'theme/' . $r['theme'] . '/node/';
     }
     // list files
     $dir = new Dir($templateDir);
     foreach ($dir->read('@\\.php$@') as $file) {
         if (!$file->isFile()) {
             continue;
         }
         // ignore directories
         if (in_array($file->basename(false), array())) {
             continue;
         }
         // ignore files?
         $templateNames[$file->basename(false)] = $file->basename(false);
     }
     return $templateNames->toArray();
 }
 function add()
 {
     ini_set('upload_max_filesize', 8388608 * 4);
     if (Upload::isUploadSuccessful("my_file")) {
         $peer = new DocumentiPeer();
         $do = $peer->new_do();
         $peer->setupByParams($do);
         $d = new Dir("/documenti/user/" . Session::get("/session/username") . "/contenuti/");
         if (!$d->exists()) {
             $d->touch();
         }
         $do->save_folder = $d->getPath();
         $do->real_name = Upload::getRealFilename("my_file");
         $do->folder = Params::get("folder");
         $tokens = explode(".", Upload::getRealFilename("my_file"));
         $extension = $tokens[count($tokens) - 1];
         $do->hash_name = md5(uniqid()) . "." . strtolower($extension);
         Upload::saveTo("my_file", $do->save_folder, $do->hash_name);
         $peer->save($do);
         Flash::ok("Documento aggiunto con successo.");
         return Redirect::success();
     } else {
         return Redirect::failure(Upload::getUploadError("my_file"));
     }
 }
Example #5
0
 static function randomFromFolder($path, $autocache = true, $include_sub_dirs = false)
 {
     $dir = new Dir($path);
     if (!$dir->exists()) {
         Log::error("FileUtils::randomFromFolder", "La cartella {$path} non esiste!!");
     }
     if (!$dir->isDir()) {
         Log::error("FileUtils::randomFromFolder", "Il percorso {$path} non rappresenta una cartella!!");
     }
     $results = $dir->listFiles();
     $valid_results = array();
     foreach ($results as $dir_elem) {
         if ($dir_elem->isDir() && $include_sub_dirs) {
             $valid_results[] = $dir_elem;
         }
         if ($dir_elem->isFile()) {
             $valid_results[] = $dir_elem;
         }
     }
     if (count($valid_results) == 0) {
         Log::error("FileUtils::randomFromFolder", "Non sono stati trovati risultati validi!!");
     }
     $selected = $valid_results[rand(0, count($valid_results) - 1)];
     $final_result = $selected->getPath();
     if ($autocache) {
         $final_result .= "?mtime=" . $selected->getModificationTime();
     }
     return $final_result;
 }
Example #6
0
 function testProps()
 {
     $storage_test_root = "/" . FRAMEWORK_CORE_PATH . "tests/io/storage_dir/";
     Storage::set_storage_root($storage_test_root);
     $test_file = new File("/" . FRAMEWORK_CORE_PATH . "tests/io/file_props_test.php");
     $this->assertFalse($test_file->hasStoredProps(), "Il file ha delle proprieta' con lo storage vuoto!!");
     $storage = $test_file->getStoredProps();
     $storage->add("test", array("hello" => 1, "world" => "good"));
     $this->assertTrue($test_file->hasStoredProps(), "Il file storage delle proprieta' non e' stato creato!!");
     $file_path = $test_file->getPath();
     $sum = md5($file_path);
     $store_subdir = "_" . substr($sum, 0, 1);
     $storage_test_root_dir = new Dir($storage_test_root);
     $real_store_dir = $storage_test_root_dir->getSingleSubdir();
     $all_dirs = $real_store_dir->listFiles();
     $props_file_dir = $all_dirs[0];
     $this->assertEqual($props_file_dir->getName(), $store_subdir, "La directory creata non corrisponde!!");
     $final_stored_path = new File($real_store_dir->getPath() . $props_file_dir->getName() . DS . $sum . ".ini");
     $this->assertTrue($final_stored_path->exists(), "Il file finale delle props non e' stato trovato!!");
     $test_file->deleteStoredProps();
     $this->assertFalse($test_file->hasStoredProps(), "Il file delle proprieta' non e' stato eliminato!!");
     $all_files = $real_store_dir->listFiles();
     foreach ($all_files as $f) {
         $f->delete(true);
     }
     Storage::set_storage_root(Storage::get_default_storage_root());
 }
Example #7
0
 public function cache()
 {
     if (isset($_GET['type'])) {
         $Dir = new \Dir();
         $cache = D('Common/Cache');
         $type = I('get.type');
         switch ($type) {
             case "template":
                 //删除缓存目录下的文件
                 $Dir->del(RUNTIME_PATH);
                 $Dir->delDir(RUNTIME_PATH . "Cache/");
                 $Dir->delDir(RUNTIME_PATH . "Temp/");
                 //更新开启其他方式的缓存
                 \Think\Cache::getInstance()->clear();
                 $this->success("模板缓存清理成功!", U('Index/cache'));
                 break;
             case "logs":
                 $Dir->delDir(RUNTIME_PATH . "Logs/");
                 $this->success("站点日志清理成功!", U('Index/cache'));
                 break;
             default:
                 $this->error("请选择清楚缓存类型!");
                 break;
         }
     } else {
         $this->display();
     }
 }
 public function add()
 {
     $dao = D("App");
     import('ORG.Io.Dir');
     if ($_REQUEST['appname']) {
         // 添加内容的页面
         $strAppname = h($_GET['appname']);
         $result = $dao->where("url='{$strAppname}'")->count();
         if ($result) {
             $this->error('此应用已安装过');
             exit;
         } else {
             $appConfig = (require SITE_PATH . '/apps/' . $strAppname . '/appinfo/config.php');
         }
         $this->assign('appConfig', $appConfig);
         $this->assign('selected', 'true');
     } else {
         $pDir = new Dir(SITE_PATH . '/apps/');
         $arrDirs = $pDir->toArray();
         $applist = $dao->findall();
         foreach ($applist as $value) {
             $apps[] = $value['enname'];
         }
         foreach ($arrDirs as $value) {
             if (!in_array($value['filename'], $apps) && is_file($value['pathname'] . '/appinfo/config.php')) {
                 $config = (include $value['pathname'] . '/appinfo/config.php');
                 $config['icon'] = str_replace('http://{APP_URL}', SITE_URL . '/apps/' . $value['filename'], $config['icon']);
                 $appList[$value['filename']] = $config;
             }
         }
         $this->assign('appList', $appList);
     }
     $this->display();
 }
Example #9
0
 function getTemplates($path = false)
 {
     if (!$path) {
         $path = 'inc/html/' . conf('Server', 'default_template_set');
     }
     $templates = array('' => 'Inherit', 'default' => 'Default');
     loader_import('saf.File.Directory');
     $dir = new Dir();
     if (!$dir->open($path)) {
         return $templates;
     }
     foreach ($dir->read_all() as $file) {
         if (strpos($file, '.') === 0 || @is_dir($path . '/' . $file)) {
             continue;
         }
         if (preg_match('/^html.([^\\.]+)\\.tpl$/', $file, $regs)) {
             if ($regs[1] == 'default') {
                 continue;
             }
             $templates[$regs[1]] = ucfirst($regs[1]);
         }
     }
     asort($templates);
     return $templates;
 }
Example #10
0
 /**
  * 获取当前所有的表情
  * @param boolean $flush 是否更新缓存,默认为false
  * @return array 返回表情数据
  */
 public function getAllExpression($flush = false)
 {
     $cache_id = '_model_expression';
     if (($res = S($cache_id)) === false || $flush === true) {
         global $ts;
         // $pkg = $ts['site']['expression'];
         $pkg = 'miniblog';
         //TODO 临时写死
         $filepath = THEME_PUBLIC_PATH . '/image/expression/' . $pkg;
         require_once ADDON_PATH . '/library/io/Dir.class.php';
         $expression = new Dir($filepath);
         $expression_pkg = $expression->toArray();
         $res = array();
         foreach ($expression_pkg as $value) {
             /*				
                             if(!is_utf8($value['filename'])){
             					$value['filename'] = auto_charset($value['filename'],'GBK','UTF8');
             				}*/
             list($file) = explode(".", $value['filename']);
             $temp['title'] = $file;
             $temp['emotion'] = '[' . $file . ']';
             $temp['filename'] = $value['filename'];
             $temp['type'] = $pkg;
             $res[$temp['emotion']] = $temp;
         }
         S($cache_id, $res);
     }
     return $res;
 }
Example #11
0
 public function index()
 {
     $config_file = CONF_PATH . 'index/config.php';
     $config = (include $config_file);
     if ($dirname = $this->_get('dirname', 'trim')) {
         $config['DEFAULT_THEME'] = $dirname;
         file_put_contents($config_file, "<?php \nreturn " . var_export($config, true) . ";", LOCK_EX);
         $obj_dir = new Dir();
         is_dir(CACHE_PATH . 'index/') && $obj_dir->delDir(CACHE_PATH . 'index/');
         @unlink(RUNTIME_FILE);
     }
     $tpl_dir = TMPL_PATH . 'index/';
     $opdir = dir($tpl_dir);
     $template_list = array();
     while (false !== ($entry = $opdir->read())) {
         if ($entry[0] == '.') {
             continue;
         }
         if (!is_file($tpl_dir . $entry . '/info.php')) {
             continue;
         }
         $info = (include_once $tpl_dir . $entry . '/info.php');
         $info['preview'] = TMPL_PATH . 'index/' . $entry . '/preview.gif';
         $info['dirname'] = $entry;
         $template_list[$entry] = $info;
     }
     $this->assign('template_list', $template_list);
     $this->assign('def_tpl', $config['DEFAULT_THEME']);
     $this->display();
 }
Example #12
0
 public function show()
 {
     $dirpath = $this->dirpath();
     $dirup = $this->dirup();
     import("ORG.Io.Dir");
     $dir = new Dir($dirpath);
     $dirlist = $dir->toArray();
     if (strpos($dirup, 'Template') > 0) {
         $this->assign('dirup', $dirup);
     }
     if (empty($dirlist)) {
         $this->error('该文件夹下面没有任何文件!');
     }
     if ($_GET['mytpl']) {
         foreach ($dirlist as $key => $value) {
             if (strpos($value['filename'], 'my_') === false) {
                 unset($dirlist[$key]);
             }
         }
     }
     $_SESSION['tpl_reurl'] = C('cms_admin') . '?s=Admin/Tpl/Show/id/' . str_replace('/', '*', $dirpath);
     if ($dirup && $dirup != '.') {
         $this->assign('dirup', $dirup);
     }
     $this->assign('mytpl', $_GET['mytpl']);
     $this->assign('dir', list_sort_by($dirlist, 'mtime', 'desc'));
     $this->assign('dirpath', $dirpath);
     $this->display('./views/admin/tpl_show.html');
 }
Example #13
0
/**
 * Walks through the boxes or forms folders and recursively builds a $list of found actions.
 *
 * @param string
 * @param string
 * @param string
 * @param array
 * @return boolean
 *
 */
function help_walker($appname, $type = 'boxes', $directory, &$list)
{
    $dir = new Dir($directory);
    if (!$dir->handle) {
        return false;
    }
    foreach ($dir->read_all() as $file) {
        if (strpos($file, '.') === 0 || $file == 'CVS') {
            continue;
        } elseif (@is_dir($directory . '/' . $file)) {
            $name = str_replace(getcwd() . '/inc/app/' . $appname . '/' . $type . '/', '', $directory . '/' . $file);
            $box = array('name' => $name, 'alt' => ucfirst(basename($name)), $type => array(), 'is_dir' => false);
            if (!@file_exists($directory . '/' . $file . '/index.php')) {
                $box['is_dir'] = true;
            } else {
                if ($type == 'boxes' && @file_exists($directory . '/' . $file . '/settings.php')) {
                    $settings = ini_parse($directory . '/' . $file . '/settings.php');
                    $box['alt'] = $settings['Meta']['name'];
                }
            }
            $list[$name] = $box;
            help_walker($appname, $type, $directory . '/' . $file, $list[$name][$type]);
        }
    }
    return true;
}
Example #14
0
 function testCompressUncompress()
 {
     $f = new File("/" . FRAMEWORK_CORE_PATH . "tests/utils/compress/test.ffa");
     $f->delete();
     FFArchive::compress($f, new Dir("/" . FRAMEWORK_CORE_PATH . "tests/utils/compress/data/"));
     $ext_dir = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/utils/extract/");
     $ext_dir->touch();
     $f = new File("/" . FRAMEWORK_CORE_PATH . "tests/utils/compress/test.ffa");
     $this->assertTrue($f->exists(), "Il file da decomprimere non esiste!!");
     FFArchive::extract($f, $ext_dir);
     $f1 = new File("/" . FRAMEWORK_CORE_PATH . "tests/utils/extract/cartella.png");
     $this->assertTrue($f1->exists(), "Il file cartella.png non e' stato estratto!!");
     $this->assertEqual($f1->getSize(), 441, "La dimensione di cartella.png non corrisponde!!");
     $f2 = new File("/" . FRAMEWORK_CORE_PATH . "tests/utils/extract/file1.txt");
     $this->assertTrue($f2->exists(), "Il file file1.txt non e' stato estratto!!");
     $f3 = new File("/" . FRAMEWORK_CORE_PATH . "tests/utils/extract/file2.dat");
     $this->assertTrue($f3->exists(), "Il file file2.dat non e' stato estratto!!");
     $d1 = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/utils/extract/empty_folder");
     $this->assertTrue($d1->exists(), "La cartella vuota non e' stata estratta!!");
     $d2 = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/utils/extract/folder");
     $this->assertTrue($d2->exists(), "La cartella folder non e' stata estratta!!");
     $f4 = new File("/" . FRAMEWORK_CORE_PATH . "tests/utils/extract/folder/sub/yep.txt");
     $this->assertTrue($f4->exists(), "Il file yep.txt non e' stato estratto!!");
     $this->assertEqual($f4->getSize(), 10, "La dimensione di yep.txt non corrisponde!!");
     $this->assertTrue($ext_dir->delete(true), "La directory coi file estratti non e' stata elimintata!!");
     $this->assertFalse($f1->exists(), "Il file cartella.png esiste ancora!!");
 }
Example #15
0
 function getThemes($path = false)
 {
     if (!$path) {
         $path = site_docroot() . '/inc/app/sitepresenter/themes';
     }
     $themes = array();
     //'' => 'Default');
     loader_import('saf.File.Directory');
     $dir = new Dir();
     if (!$dir->open($path)) {
         return $themes;
     }
     foreach ($dir->read_all() as $file) {
         if (strpos($file, '.') === 0 || !@is_dir($path . '/' . $file)) {
             continue;
         }
         //if (preg_match ('/^html.([^\.]+)\.tpl$/', $file, $regs)) {
         //if ($regs[1] == 'default') {
         //	continue;
         //}
         $themes[$file] = ucfirst($file);
         //}
     }
     return $themes;
 }
Example #16
0
 function execute()
 {
     $file_or_folder = $this->file_or_folder;
     if (self::$dummy_mode) {
         echo "Adding : " . $file_or_folder . "<br />";
         return;
     }
     $root_dir_path = self::$root_dir->getPath();
     $file_or_folder = str_replace("\\", "/", $file_or_folder);
     $file_list = array();
     //se finisce con lo slash è una directory
     if (substr($file_or_folder, strlen($file_or_folder) - 1, 1) == "/") {
         //creo la cartella
         $target_dir = new Dir(DS . $root_dir_path . $file_or_folder);
         $target_dir->touch();
         $source_dir = new Dir($this->module_dir->getPath() . $file_or_folder);
         foreach ($source_dir->listFiles() as $elem) {
             if ($elem->isDir()) {
                 $file_list = array_merge($file_list, $this->add($file_or_folder . $elem->getName() . DS));
             } else {
                 $file_list = array_merge($file_list, $this->add($file_or_folder . $elem->getFilename()));
             }
         }
     } else {
         $source_file = new File($this->module_dir->getPath() . $file_or_folder);
         $target_file = new File($root_dir_path . $file_or_folder);
         $target_dir = $target_file->getDirectory();
         $target_dir->touch();
         $source_file->copy($target_dir);
         $file_list[] = $target_dir->newFile($source_file->getFilename())->getPath();
     }
     return $file_list;
 }
Example #17
0
/**
 * 清空缓存
 */
function sp_clear_cache()
{
    import("ORG.Util.Dir");
    $dirs = array();
    // runtime/
    $rootdirs = scandir(RUNTIME_PATH);
    //$noneed_clear=array(".","..","Data");
    $noneed_clear = array(".", "..");
    $rootdirs = array_diff($rootdirs, $noneed_clear);
    foreach ($rootdirs as $dir) {
        if ($dir != "." && $dir != "..") {
            $dir = RUNTIME_PATH . $dir;
            if (is_dir($dir)) {
                array_push($dirs, $dir);
                $tmprootdirs = scandir($dir);
                foreach ($tmprootdirs as $tdir) {
                    if ($tdir != "." && $tdir != "..") {
                        $tdir = $dir . '/' . $tdir;
                        if (is_dir($tdir)) {
                            array_push($dirs, $tdir);
                        }
                    }
                }
            } else {
                @unlink($dir);
            }
        }
    }
    $dirtool = new Dir("");
    foreach ($dirs as $dir) {
        $dirtool->del($dir);
    }
    if (defined('IS_SAE') && IS_SAE) {
        $global_mc = @memcache_init();
        if ($global_mc) {
            $global_mc->flush();
        }
        $no_need_delete = array("THINKCMF_DYNAMIC_CONFIG");
        $kv = new SaeKV();
        // 初始化KVClient对象
        $ret = $kv->init();
        // 循环获取所有key-values
        $ret = $kv->pkrget('', 100);
        while (true) {
            foreach ($ret as $key => $value) {
                if (!in_array($key, $no_need_delete)) {
                    $kv->delete($key);
                }
            }
            end($ret);
            $start_key = key($ret);
            $i = count($ret);
            if ($i < 100) {
                break;
            }
            $ret = $kv->pkrget('', 100, $start_key);
        }
    }
}
Example #18
0
 /**
  * 
  * @param string absolute path to config file
  */
 function __construct(Dir $path)
 {
     if (!$path->exists()) {
         throw new RepositoryListException('Given path(' . $path . ') not exists.');
     }
     $this->path = $path;
     $this->list = $path->getFile('list.txt');
     $this->createContext();
 }
Example #19
0
 public function siteopt()
 {
     $site_opt = model('Xdata')->lget('siteopt');
     $this->assign($site_opt);
     require_once ADDON_PATH . '/libs/Io/Dir.class.php';
     $theme_list = new Dir(SITE_PATH . '/public/themes/');
     $this->assign('theme_list', $theme_list->toArray());
     $this->display();
 }
Example #20
0
 static function set_modules_path($new_modules_path)
 {
     $dir = new Dir(DS . $new_modules_path);
     if (!$dir->exists()) {
         Log::error("ModuleUtils::set_modules_path", "Error : modules root directory must exist -> " . $new_modules_path);
     } else {
         self::$modules_path = $new_modules_path;
     }
 }
Example #21
0
 static function extract_from_archive($filename)
 {
     $modules_archive_dir = new Dir(self::MODULES_ARCHIVE_DIR);
     $modules_archive_dir->touch();
     $module_archive = $modules_archive_dir->newFile($filename);
     $properties = FFArchive::getArchiveProperties($module_archive);
     $module_dir = new Dir(ModuleUtils::get_modules_path() . "/" . $properties["category_name"] . "/" . $properties["module_name"]);
     return FFArchive::extract($module_archive, $module_dir);
 }
 function execute()
 {
     $dir = $this->dir;
     if (self::$dummy_mode) {
         echo "Mkdir : " . self::$root_dir->getPath() . $dir . "<br />";
         return;
     }
     $d = new Dir(self::$root_dir->getPath() . $dir);
     $d->touch();
 }
Example #23
0
 function deleteCache()
 {
     import('ORG.Io.Dir');
     $cacheDir = new Dir(APP_NAME . '/Runtime');
     if ($cacheDir->delDir(APP_NAME . '/Runtime')) {
         $this->success('清除缓存成功!');
     } else {
         $this->error('清除缓存失败!请联系管理员!');
     }
 }
Example #24
0
 function clearCache()
 {
     import("ORG.Io.Dir");
     $dir = new Dir();
     if (is_dir(CACHE_PATH)) {
         $dir->del(CACHE_PATH);
     }
     if (is_dir(TEMP_PATH)) {
         $dir->del(TEMP_PATH);
     }
     if (is_dir(LOG_PATH)) {
         $dir->del(LOG_PATH);
     }
     if (is_dir(DATA_PATH . '_fields/')) {
         $dir->del(DATA_PATH . '_fields/');
     }
     if (is_dir("./index/Runtime/Cache/")) {
         $dir->del("./index/Runtime/Cache/");
     }
     if (is_dir("./index/Runtime/Temp/")) {
         $dir->del("./index/Runtime/Temp/");
     }
     if (is_dir("./index/Runtime/Logs/")) {
         $dir->del("./index/Runtime/Logs/");
     }
     if (is_dir("./index/Runtime/Data/_fields/")) {
         $dir->del("./index/Runtime/Data/_fields/");
     }
     $this->display('index');
 }
Example #25
0
 static function list_files($plugin_path)
 {
     $plugin_dir = new Dir(self::DEFAULT_DIR . $plugin_path);
     $final_result = array();
     if ($plugin_dir->exists()) {
         $all_files = $plugin_dir->findFilesEndingWith(self::DEFAULT_EXTENSION);
         foreach ($all_files as $f) {
             $final_result[] = $f->getIncludePath();
         }
     }
     return $final_result;
 }
Example #26
0
 function testRmdir()
 {
     $dir = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/module_plug_root/prova/");
     $module_plug_test_root = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/module_plug_root/");
     $target_dir = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/module_plug_root/");
     $plug = new DirBridge($target_dir, new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/fakeroot/modules/ecommerce/cart/"));
     $this->assertFalse($dir->exists(), "La directory c'e' gia'!!");
     $dir->touch();
     $this->assertTrue($dir->exists(), "La directory non e' stata creata!!");
     $plug->rmdir("prova");
     $this->assertFalse($dir->exists(), "La directory non e' stata eliminata!!");
 }
Example #27
0
 public static function get_available_configurations()
 {
     $d = new Dir(self::CONFIG_DIR);
     $folders = $d->listFolders();
     $result = array();
     foreach ($folders as $fold) {
         if ($fold->getName() != self::COMMON_CONFIG) {
             $result[] = $fold->getName();
         }
     }
     return $result;
 }
 function execute()
 {
     $dir = $this->dir;
     $force = $this->force;
     if (self::$dummy_mode) {
         echo "Rmdir : " . self::$root_dir->getPath() . $dir . "<br />";
         return;
     }
     $d = new Dir(self::$root_dir->getPath() . $dir);
     if (!$d->isEmpty() && $force || $d->isEmpty()) {
         $d->delete(true);
     }
 }
 function execute()
 {
     $attributes = $this->attributes;
     $name = $attributes->name;
     $location = $attributes->location;
     $do_file_name = $name . "DO.class.php";
     $peer_file_name = $name . "Peer.class.php";
     $d = new Dir($location);
     $do_file = $d->newFile($do_file_name);
     $do_file->delete();
     $peer_file = $d->newFile($peer_file_name);
     $peer_file->delete();
     $d->delete();
 }
 public function index()
 {
     $smiletype = D('Smile')->getSmileType();
     $this->assign('smilelist', $smiletype);
     $opt = D("Option")->getOpts4Edit();
     import('ORG.Io.Dir');
     $pDir = new Dir(SITE_PATH . '/public/themes/');
     $this->assign('themelist', $pDir->toArray());
     $this->assign("verify", unserialize($opt["verify"]));
     $this->assign("newuser_time", $opt["newuser_time"]);
     $this->assign("newuser_fri_num", $opt["newuser_fri_num"]);
     $this->assign("opt", $opt);
     $this->display();
 }