Exemplo n.º 1
0
 public static function drop($key_id)
 {
     $key = new Key($key_id);
     return $key->delete();
 }
Exemplo n.º 2
0
 public function kill()
 {
     $this->clearPins();
     $db = new PHPWS_DB('block');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
     }
     $key = new Key($this->key_id);
     $result = $key->delete();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
     }
 }
Exemplo n.º 3
0
 function kill()
 {
     if (!Current_User::authorized('wiki', 'delete_page')) {
         Current_User::disallow(dgettext('wiki', 'User attempted access to wiki page delete.'));
         return;
     }
     if (isset($_REQUEST['yes'])) {
         $db = new PHPWS_DB('wiki_pages');
         $db->addWhere('id', $this->getId());
         if (PHPWS_Error::logIfError($db->delete())) {
             WikiManager::sendMessage(dgettext('wiki', 'Page could not be deleted.'), array('page' => $this->getTitle(FALSE)), FALSE);
         }
         PHPWS_Core::initModClass('version', 'Version.php');
         Version::flush('wiki_pages', $this->getId());
         $key = new Key($this->key_id);
         PHPWS_Error::logIfError($key->delete());
         WikiManager::sendMessage(sprintf(dgettext('wiki', '%s deleted!'), $this->getTitle()), array(), FALSE);
     } else {
         if (isset($_REQUEST['no'])) {
             WikiManager::sendMessage(sprintf(dgettext('wiki', '%s was not deleted!'), $this->getTitle()), array('page' => $this->getTitle(FALSE)), FALSE);
         } else {
             $tags = array();
             $tags['MESSAGE'] = dgettext('wiki', 'Are you sure you want to delete this wiki page?');
             $tags['YES'] = PHPWS_Text::secureLink(dgettext('wiki', 'Yes'), 'wiki', array('page_op' => 'delete', 'yes' => 1, 'page' => $this->getTitle(FALSE)));
             $tags['NO'] = PHPWS_Text::secureLink(dgettext('wiki', 'No'), 'wiki', array('page_op' => 'delete', 'no' => 1, 'page' => $this->getTitle(FALSE)));
             $tags['WIKIPAGE'] = $this->view();
             return PHPWS_Template::process($tags, 'wiki', 'confirm.tpl');
         }
     }
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
0
 public function delete()
 {
     $all_is_well = true;
     $db = new PHPWS_DB('blog_entries');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         $all_is_well = false;
     }
     $key = new Key($this->key_id);
     $key->delete();
     return $all_is_well;
 }