public function delete()
 {
     $this->login_user();
     try {
         $package = Package::find($_GET['id']);
         $version = Version::find($_GET['version']);
     } catch (NimbleRecordNotFound $e) {
         $this->redirect_to('/');
     }
     if ($version->package_id == $package->id && $package->user_id == $this->user->id) {
         $file = $package->file_path($version->version);
         @unlink($file);
         Nimble::flash('notice', "Version: {$version->version} was deleted");
         Version::delete($version->id);
         $this->redirect_to(url_for('PackageController', 'show', $version->package_id));
     } else {
         $this->redirect_to('/');
     }
 }
Esempio n. 2
0
<?php

require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$nav = 'applications';
$v = new Version($_GET['id']);
if (!$v->ok()) {
    redirect('index.php');
}
$app = new Application($v->app_id);
if (!$app->ok()) {
    redirect('index.php');
}
if (isset($_POST['btnDelete'])) {
    $v->delete();
    redirect('versions.php?id=' . $app->id);
}
$version_number = $v->version_number;
$human_version = $v->human_version;
$release_notes = $v->release_notes;
$url = $v->url;
$signature = $v->signature;
$filesize = $v->filesize;
include 'inc/header.inc.php';
?>

        <div id="bd">
            <div id="yui-main">
                <div class="yui-b"><div class="yui-g">

                    <div class="block tabs spaces">
Esempio n. 3
0
 public function destroy_version()
 {
     if (!isset($_POST['version_id'])) {
         error(__("Error"), __("No version ID specified.", "extend"));
     }
     $version = new Version($_POST['version_id']);
     if ($version->no_results) {
         error(__("Error"), __("Invalid version ID specified.", "extend"));
     }
     if (!$version->deletable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to delete this version.", "extend"));
     }
     Version::delete($version->id);
     Flash::notice(__("Version deleted.", "extend"), $version->extension->url());
 }
Esempio n. 4
0
 function remove()
 {
     if (!(Current_User::authorized('wiki', 'delete_page') && $this->getAllowEdit() && !$this->getVrCurrent())) {
         Current_User::disallow(dgettext('wiki', 'User attempted to remove previous page version.'));
         return;
     }
     PHPWS_Core::initModClass('version', 'Version.php');
     $version = new Version('wiki_pages', $this->getId());
     $version->delete(FALSE);
     WikiManager::sendMessage(dgettext('wiki', 'Old revision removed'), array('page' => $this->getTitle(FALSE)), FALSE);
 }
Esempio n. 5
0
 /**
  * Function: delete
  * Deletes the given extension, including its notes. Calls the "delete_extension" trigger and passes the <Extension> as an argument.
  *
  * Parameters:
  *     $id - The extension to delete.
  */
 static function delete($id)
 {
     $extension = new self($id);
     foreach ($extension->versions as $version) {
         Version::delete($version->id);
     }
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }