Beispiel #1
0
 protected function runManagerAction($action)
 {
     switch ($action) {
         case 'phpinfo':
             ob_start();
             phpinfo();
             $this->content .= ob_get_clean();
             return true;
         case 'clear':
             if (is_null($dir = TIP::getGet('id', 'string'))) {
                 TIP::warning("GET not found ({$id})");
                 TIP::notifyError('noparams');
                 return false;
             }
             $dir = TIP::buildDataPath(urldecode($dir));
             TIP::removeDir($dir, false);
             TIP::notifyInfo('done');
             return true;
     }
     return null;
 }
Beispiel #2
0
 /**
  * Recursively remove a directory
  * @param string  $dir         The directory to delete
  * @param boolean $self_remove Whether to remove $dir itsself
  */
 public static function removeDir($dir, $self_remove = true)
 {
     $handle = @opendir($dir);
     if (!$handle) {
         return;
     }
     while (($file = readdir($handle)) !== false) {
         if ($file != '.' && $file != '..') {
             $file = $dir . DIRECTORY_SEPARATOR . $file;
             @unlink($file) || TIP::removeDir($file);
         }
     }
     closedir($handle);
     $self_remove && @rmdir($dir);
 }