Example #1
0
	public function DeleteDir($dir, $Recursive=false)
	{
		if (is_dir($this->GetDir() . $dir)) {
			if($Recursive === true) {
				$tmp = new FileClass;
				$tmp->SetLoadDir($this->GetDir() . $dir);

				while(($f = $tmp->NextFile()) !== false) {
					$tmp->DeleteFile($f);
				}

				$tmp->ResetHandle();

				while(($d = $tmp->NextDir()) !== false) {

					$tmp->DeleteDir($d, $Recursive);
				}

				$tmp->CloseDirHandle();
				unset($tmp);
			}

			if(rmdir($this->GetDir() . $dir)) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}
Example #2
0
	public function _GetTemplateList()
	{
		GetLib('class.file');

		// Get a list of templates and return them as a sorted array
		$dir = ISC_BASE_PATH . "/templates";
		$arrTemplates = array();

		if (is_dir($dir)) {
			$fileHandle = new FileClass;
			if ($fileHandle->SetLoadDir($dir)) {
				while (($file = $fileHandle->NextFolder()) !== false) {
					if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn" && $file != 'blank.dat' && $file{0} != '_') {
						// These are the template categories. We will create
						// an array for each of them
						$arrTemplates[] = $file;
						sort($arrTemplates);
					}
				}
				$fileHandle->CloseHandle();
			}

		}
		ksort($arrTemplates);
		return $arrTemplates;
	}