<?php

/**
 * This is the xwysiwyg-version of an uninstall file for boost. Edit it to
 * be used with your module.
 *
 * $Id: uninstall.php,v 1.3 2005/11/06 18:48:47 ykuendig Exp $
 */
/* Make sure the user is a deity before running this script */
if (!$_SESSION["OBJ_user"]->isDeity()) {
    header("location:index.php");
    exit;
}
/* Import the uninstall database file and dump the result into the status variable */
if ($status = $GLOBALS["core"]->sqlImport(PHPWS_SOURCE_DIR . "mod/xwysiwyg/boost/uninstall.sql", 1, 1)) {
    $content .= "All xwysiwyg tables successfully removed!<br />";
    if (is_dir("{$GLOBALS['core']->home_dir}files/xwysiwyg/")) {
        if (PHPWS_File::rmdir(PHPWS_HOME_DIR . "files/xwysiwyg")) {
            $content .= "All Files in /files/xwysiwyg removed!<br /><br />";
        } else {
            $content .= "Directory /files/xwysiwyg could NOT be deleted!<br />";
            $content .= "Please delete it manually.<br /><br />";
        }
    }
} else {
    $content .= "There was a problem accessing the database.<br /><br />";
}
$status = 1;
// instead
示例#2
0
 public function delete()
 {
     if (!$this->id) {
         throw new \Exception('Missing contact id');
     }
     $c_db = new \PHPWS_DB('prop_contacts');
     $c_db->addWhere('id', $this->id);
     $result = $c_db->delete();
     if (\PEAR::isError($result)) {
         \PHPWS_Error::log($result);
         throw new \Exception('Could not delete contact from database.');
     }
     $p_db = new \PHPWS_DB('properties');
     $p_db->addWhere('contact_id', $this->id);
     $result = $p_db->delete();
     if (\PEAR::isError($result)) {
         \PHPWS_Error::log($result);
         throw new \Exception('Could not delete contact properties from database.');
     }
     $i_db = new \PHPWS_DB('prop_photo');
     $i_db->addWhere('cid', $this->id);
     $result = $i_db->delete();
     if (\PEAR::isError($result)) {
         \PHPWS_Error::log($result);
         throw new \Exception('Could not delete contact photos from database.');
     }
     $dir = 'images/properties/c' . $this->id;
     \PHPWS_File::rmdir($dir);
     return true;
 }
示例#3
0
 public function removeDirectories($mod, &$content, $homeDir = NULL)
 {
     PHPWS_Core::initCoreClass('File.php');
     if (!isset($homeDir)) {
         $this->getHomeDir();
     }
     $imageDir = $homeDir . 'images/' . $mod->title . '/';
     if ($mod->isImageDir() && is_dir($imageDir)) {
         $content[] = sprintf(dgettext('boost', 'Removing directory %s'), $imageDir);
         $this->addLog($mod->title, sprintf(dgettext('boost', 'Removing directory %s'), $imageDir));
         if (!PHPWS_File::rmdir($imageDir)) {
             $content[] = dgettext('boost', 'Failure to remove directory.');
             $this->addLog($mod->title, sprintf(dgettext('boost', 'Unable to remove directory %s'), $imageDir));
         }
     }
     $fileDir = $homeDir . 'files/' . $mod->title . '/';
     if ($mod->isFileDir() && is_dir($fileDir)) {
         $content[] = sprintf(dgettext('boost', 'Removing directory %s'), $fileDir);
         $this->addLog($mod->title, sprintf(dgettext('boost', 'Removing directory %s'), $fileDir));
         if (!PHPWS_File::rmdir($fileDir)) {
             $content[] = dgettext('boost', 'Failure to remove directory.');
             $this->addLog($mod->title, sprintf(dgettext('boost', 'Unable to remove directory %s'), $fileDir));
         }
     }
 }
 function delFile()
 {
     if ($_SESSION["OBJ_user"]->allow_access("xwysiwyg", "settings")) {
         //Administrativ condition
         if (isset($_GET['delFile'])) {
             $filename = PHPWS_Text::parseInput($_GET['delFile']);
         } else {
             return FALSE;
         }
         if (isset($_GET['filetyp'])) {
             $filetyp = PHPWS_Text::parseInput($_GET['filetyp']);
         } else {
             return FALSE;
         }
         if ($filename) {
             if ($filetyp == "tgz") {
                 unlink(PHPWS_HOME_DIR . "files/xwysiwyg/editors/{$filename}");
             } elseif ($filetyp == "ext") {
                 PHPWS_File::rmdir(PHPWS_HOME_DIR . "files/xwysiwyg/editors/{$filename}");
                 unlink(PHPWS_HOME_DIR . "files/xwysiwyg/editors/{$filename}.conf");
                 unlink(PHPWS_HOME_DIR . "files/xwysiwyg/editors/{$filename}.php");
                 @unlink(PHPWS_HOME_DIR . "files/xwysiwyg/editors/" . $filename . "_readme.txt");
             }
         }
     } else {
         $this->content .= $_SESSION['translate']->it("Access was denied due to lack of proper permissions.");
     }
     // End of ADMINISTRATOR condition
 }
示例#5
0
 public function delete()
 {
     // deleteAssoc call occurs in commonDelete
     $result = $this->commonDelete();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $this->deleteThumbnail();
     $path = $this->getResizePath();
     if ($path) {
         PHPWS_File::rmdir($path);
     }
     return true;
 }
示例#6
0
 public function delete()
 {
     if ($this->ftype == IMAGE_FOLDER) {
         $table = 'images';
     } elseif ($this->ftype == DOCUMENT_FOLDER) {
         $table = 'documents';
     } elseif ($this->ftype == MULTIMEDIA_FOLDER) {
         $table = 'multimedia';
     } else {
         return false;
     }
     /**
      * Delete file associations inside folder
      */
     $db = new PHPWS_DB('fc_file_assoc');
     $db->addWhere($table . '.folder_id', $this->id);
     $db->addWhere($table . '.id', 'fc_file_assoc.file_id');
     PHPWS_Error::logIfError($db->delete());
     /**
      * Delete the special folder associations to this folder
      */
     $db->reset();
     $db->addWhere('file_type', FC_IMAGE_FOLDER, '=', 'or', 1);
     $db->addWhere('file_type', FC_IMAGE_LIGHTBOX, '=', 'or', 1);
     $db->addWhere('file_type', FC_IMAGE_RANDOM, '=', 'or', 1);
     $db->addWhere('file_type', FC_DOCUMENT_FOLDER, '=', 'or', 1);
     $db->addWhere('file_id', $this->id);
     PHPWS_Error::logIfError($db->delete());
     /**
      * Delete the files in the folder from the db
      */
     unset($db);
     $db = new PHPWS_DB($table);
     $db->addWhere('folder_id', $this->id);
     PHPWS_Error::logIfError($db->delete());
     /**
      * Delete the folder from the database
      */
     $db = new PHPWS_DB('folders');
     $db->addWhere('id', $this->id);
     PHPWS_Error::logIfError($db->delete());
     /**
      * Delete the key
      */
     $key = new Key($this->key_id);
     $key->delete();
     /**
      * Delete the physical directory the folder occupies
      */
     $directory = $this->getFullDirectory();
     if (is_dir($directory)) {
         PHPWS_File::rmdir($directory);
     }
     return true;
 }
示例#7
0
 public static function rmdir($dir)
 {
     PHPWS_File::appendSlash($dir);
     if (is_dir($dir)) {
         $handle = opendir($dir);
         while ($file = readdir($handle)) {
             if ($file == '.' || $file == '..') {
                 continue;
             } elseif (is_dir($dir . $file)) {
                 PHPWS_File::rmdir($dir . $file);
             } elseif (is_file($dir . $file)) {
                 $result = unlink($dir . $file);
                 if (!$result) {
                     PHPWS_Error::log(PHPWS_FILE_DELETE_DENIED, 'core', 'PHPWS_File::rmdir', $dir . $file);
                     return false;
                 }
             }
         }
         closedir($handle);
         $result = rmdir($dir);
         if (!$result) {
             PHPWS_Error::log(PHPWS_DIR_DELETE_DENIED, 'core', 'PHPWS_File::rmdir', $dir);
             return false;
         }
         return true;
     } else {
         return false;
     }
 }