function delete()
 {
     global $db;
     if ($this->isLocal()) {
         // delete files from the repository
         debug("deleting: ", $this->getDir());
         sotf_Utils::erase($this->getDir());
         // delete from sql db
         // somehow foreign keys do not work in this case, so let's do it by hand:
         $db->query("DELETE FROM sotf_object_roles WHERE object_id='" . $this->id . "'");
     }
     return parent::delete();
 }
Esempio n. 2
0
    raiseError("You can only edit programmes locally!");
}
if ($prg->isVideoPrg()) {
    $video = true;
} else {
    $video = false;
}
$converting = false;
// admins or owners can change files
checkPerm($id, 'change');
// delete link
$delLink = sotf_Utils::getParameter('dellink');
$linkid = sotf_Utils::getParameter('linkid');
if ($delLink) {
    $link = new sotf_NodeObject("sotf_links", $linkid);
    $link->delete();
    $page->redirect("editFiles.php?id={$id}#links");
    exit;
}
// delete file
$delFile = sotf_Utils::getParameter('delfile');
if ($delFile) {
    $prg->deleteFile($delFile);
    $page->redirect("editFiles.php?id={$id}#mfiles");
    exit;
}
// generate output
//$smarty->assign("OKURL",$okURL);
if ($new) {
    $smarty->assign("NEW", 1);
}
Esempio n. 3
0
    $series->update();
}
if ($finish || $finish2) {
    $page->redirect("closeAndRefresh.php?anchor=series");
}
if ($save) {
    $page->redirect("editSeries.php?seriesid={$seriesid}");
}
// manage roles
$delrole = sotf_Utils::getParameter('delrole');
if ($delrole) {
    checkPerm($series->id, "change");
    $roleid = sotf_Utils::getParameter('roleid');
    $role = new sotf_NodeObject('sotf_object_roles', $roleid);
    $c = new sotf_Contact($role->get('contact_id'));
    $role->delete();
    //$msg = $page->getlocalizedWithParams("deleted_contact", $c->get('name'));
    //$page->addStatusMsg($msg, false);
    $page->redirect("editSeries.php?seriesid={$seriesid}#roles");
    exit;
}
// manage permissions
$delperm = sotf_Utils::getParameter('delperm');
if ($delperm) {
    checkPerm($series->id, "authorize");
    $username = sotf_Utils::getParameter('username');
    $userid = $user->getUserid($username);
    if (empty($userid) || !is_numeric($userid)) {
        raiseError("Invalid username: {$username}");
    }
    $permissions->delPermission($series->id, $userid);
Esempio n. 4
0
$roleid = sotf_Utils::getParameter('roleid');
if ($delrole) {
    $role = new sotf_NodeObject('sotf_object_roles', $roleid);
    $c = new sotf_Contact($role->get('contact_id'));
    $role->delete();
    $msg = $page->getlocalizedWithParams("deleted_contact", $c->get('name'));
    $page->addStatusMsg($msg, false);
    $page->redirect("editMeta.php?id={$prgId}#roles");
    exit;
}
// delete right
$delright = sotf_Utils::getParameter('delright');
$rid = sotf_Utils::getParameter('rid');
if ($delright) {
    $right = new sotf_NodeObject('sotf_rights', $rid);
    $right->delete();
    //$msg = $page->getlocalizedWithParams("deleted_", $c->get('name'));
    //$page->addStatusMsg($msg, false);
    $page->redirect("editMeta.php?id={$prgId}#rights");
    exit;
}
// manage permissions
$delperm = sotf_Utils::getParameter('delperm');
$username = sotf_Utils::getParameter('username');
if ($delperm) {
    $userid = $user->getUserid($username);
    if (empty($userid) || !is_numeric($userid)) {
        raiseError("Invalid username: {$username}");
    }
    $permissions->delPermission($prg->id, $userid);
    $msg = $page->getlocalizedWithParams("deleted_permissions_for", $username);
 function delFromTopic($id)
 {
     global $db;
     // TODO: ha mar van, akkor ne adja hozza
     $obj = new sotf_NodeObject('sotf_prog_topics', $id);
     $topicId = $obj->get('topic_id');
     $progId = $obj->get('prog_id');
     $obj->delete();
     $query = "UPDATE sotf_topics_counter SET number = number-1 WHERE topic_id = '" . $topicId . "'";
     $result = $db->query($query);
     $query = "SELECT supertopic FROM sotf_topic_tree_defs WHERE id = '" . $topicId . "'";
     $supertopic = $db->getOne($query);
     if (!$supertopic) {
         $supertopic = $topicId;
     }
     $query = "UPDATE sotf_topics_counter SET total = total-1 WHERE topic_id = '" . $supertopic . "'";
     $result = $db->query($query);
 }
 function deleteFile($fid)
 {
     global $repository;
     $table = $repository->getTable($fid);
     $file = new sotf_NodeObject($table, $fid);
     if ($table == 'sotf_media_files' && $file->get('main_content') == 't') {
         $filepath = $this->getAudioDir() . '/' . $file->get('filename');
     } else {
         $filepath = $this->getOtherFilesDir() . '/' . $file->get('filename');
     }
     $file->delete();
     if (unlink($filepath)) {
         return 0;
     } else {
         raiseError("Could not remove file {$filepath}");
     }
 }