Exemple #1
0
     }
 }
 if ($_GET['do'] == 'add' and !isset($errors)) {
     $result = $db->query_write("INSERT INTO " . TABLE_PREFIX . "dl_files (`name`, `description`, `author`, `_author`, `uploader`, `uploaderid`, `url`, `date`, `category`, `size`, `pin`, `purgatory`, `link`)\n\t\t\t\t\t\t\t\t\t\t\tVALUES(" . $db->sql_prepare($_POST['dname']) . ", " . $db->sql_prepare($_POST['desc']) . ", " . $db->sql_prepare($_POST['author']) . ", " . $db->sql_prepare($_author) . ", " . $db->sql_prepare($vbulletin->userinfo['username']) . ", " . $db->sql_prepare($vbulletin->userinfo['userid']) . ", " . $db->sql_prepare($newfilename) . ", " . $db->sql_prepare(TIMENOW) . ", " . $db->sql_prepare($_POST['category']) . ", " . $db->sql_prepare($size) . ", " . $db->sql_prepare($_POST['pin']) . ", " . $db->sql_prepare($_POST['purgatory']) . ", " . $db->sql_prepare($link) . ")");
 } else {
     if ($_GET['do'] == 'edit') {
         $result = $db->query_write("UPDATE " . TABLE_PREFIX . "dl_files SET `name`=" . $db->sql_prepare($_POST['dname']) . ",`description`=" . $db->sql_prepare($_POST['desc']) . ",`author`=" . $db->sql_prepare($_POST['author']) . ",`_author`=" . $db->sql_prepare($_author) . ",`url`=" . $db->sql_prepare($newfilename) . ",`category`=" . $db->sql_prepare($_POST['category']) . ",`size`=" . $db->sql_prepare($size) . ",`pin`=" . $db->sql_prepare($_POST['pin']) . ",`purgatory`=" . $db->sql_prepare($_POST['purgatory']) . ",`link`=" . $db->sql_prepare($link) . " WHERE `id`=" . $db->sql_prepare($_GET['id']));
     }
 }
 if ($_GET['do'] == 'add' and !isset($errors)) {
     $id = $db->insert_id();
     $temp = $db->query_first("SELECT COUNT(*) AS `uploads` FROM " . TABLE_PREFIX . "dl_files WHERE `uploaderid` = " . $vbulletin->userinfo['userid']);
     $db->query_write("UPDATE " . TABLE_PREFIX . "user SET `uploads`=" . $db->sql_prepare($temp['uploads']) . " WHERE `userid` = " . $vbulletin->userinfo['userid']);
     $temp = $db->query_first("SELECT COUNT(*) AS `files` FROM " . TABLE_PREFIX . "dl_files");
     $db->query_write("UPDATE " . TABLE_PREFIX . "dl_main SET `files`=" . $db->sql_prepare($temp['files']));
     $dl->modify_filecount($_POST['category'], 1);
     $dl->update_counters();
     $vbulletin->url = './downloads.php?do=file&id=' . $id;
     // hook for post-upload checks
     ($hook = vBulletinHook::fetch_hook('dl_post_upload_add')) ? eval($hook) : false;
     eval(print_standard_redirect('ecdownloads_msg_file_added', true, true));
 } else {
     if (!isset($errors)) {
         if (!isset($upload)) {
             rename($dl->url . $file['url'], $dl->url . $newfilename);
         }
         if ($file['category'] != $_POST['category']) {
             $dl->modify_filecount($_POST['category'], 1);
             $dl->modify_filecount_delete($file['category'], -1);
         }
         $dl->update_counters();
Exemple #2
0
 if ($_GET['do'] == 'add') {
     $modqueue = $permissions['downloads2permissions'] & $vbulletin->bf_ugp['downloads2permissions']['canavoidmodqueue'] ? 0 : 1;
     $db->query_write("\r\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "dl2_files\r\n\t\t\t\t\t\t(`title`, `description`, `author`, `_author`, `uploader`, `uploaderid`, `url`, `extension`, `dateadded`, `category`, `size`, `pin`, `modqueue`, `link`)\r\n\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t'" . $db->escape_string($vbulletin->GPC['title']) . "',\r\n\t\t\t\t\t\t\t'" . $db->escape_string($vbulletin->GPC['message']) . "',\r\n\t\t\t\t\t\t\t'" . $db->escape_string($vbulletin->GPC['author']) . "',\r\n\t\t\t\t\t\t\t'" . $db->escape_string($_author) . "',\r\n\t\t\t\t\t\t\t'" . $db->escape_string($vbulletin->userinfo['username']) . "',\r\n\t\t\t\t\t\t\t" . $vbulletin->userinfo['userid'] . ",\r\n\t\t\t\t\t\t\t'" . $db->escape_string($newfilename) . "',\r\n\t\t\t\t\t\t\t'" . $db->escape_string($ext) . "',\r\n\t\t\t\t\t\t\t" . TIMENOW . ",\r\n\t\t\t\t\t\t\t" . $vbulletin->GPC['category'] . ",\r\n\t\t\t\t\t\t\t" . $size . ",\r\n\t\t\t\t\t\t\t" . $vbulletin->GPC['pin'] . ",\r\n\t\t\t\t\t\t\t" . $modqueue . ",\r\n\t\t\t\t\t\t\t" . $link . "\r\n\t\t\t\t\t\t)\r\n\t\t\t\t");
 } else {
     if ($_GET['do'] == 'edit') {
         $modqueue = $file['modqueue'];
         if ($temp['username'] != '') {
             $updatequery = ", `uploader` = '" . $db->escape_string($temp['username']) . "', `uploaderid` = " . $temp['userid'];
         }
         $db->query_write("\r\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "dl2_files SET\r\n\t\t\t\t\t\t`title` = '" . $db->escape_string($vbulletin->GPC['title']) . "',\r\n\t\t\t\t\t\t`description` = '" . $db->escape_string($vbulletin->GPC['message']) . "',\r\n\t\t\t\t\t\t`author` = '" . $db->escape_string($vbulletin->GPC['author']) . "',\r\n\t\t\t\t\t\t`_author` = '" . $db->escape_string($_author) . "',\r\n\t\t\t\t\t\t`url` = '" . $db->escape_string($newfilename) . "',\r\n\t\t\t\t\t\t`extension` = '" . $db->escape_string($ext) . "',\r\n\t\t\t\t\t\t`category` = " . $vbulletin->GPC['category'] . ",\r\n\t\t\t\t\t\t`size` = " . $size . ",\r\n\t\t\t\t\t\t`pin` = " . $vbulletin->GPC['pin'] . ",\r\n\t\t\t\t\t\t`modqueue` = " . $modqueue . ",\r\n\t\t\t\t\t\t`link` = " . $link . ",\r\n\t\t\t\t\t\t`lastedit` = " . TIMENOW . ",\r\n\t\t\t\t\t\t`lasteditor` = '" . $db->escape_string($vbulletin->userinfo['username']) . "',\r\n\t\t\t\t\t\t`lasteditorid` = " . $vbulletin->userinfo['userid'] . $updatequery . "\r\n\t\t\t\t\tWHERE id = {$file['id']}\r\n\t\t\t\t");
     }
 }
 if ($_GET['do'] == 'add') {
     $id = $db->insert_id();
     $db->query_write("UPDATE " . TABLE_PREFIX . "dl2_main SET `files` = `files` + 1");
     $dl->modify_filecount($vbulletin->GPC['category'], 1);
     $dl->modify_filecount_user($vbulletin->userinfo['userid']);
     $dl->update_counters();
     $vbulletin->url = 'downloads.php?' . $vbulletin->session->vars['sessionurl'] . "do=file&id={$id}";
     // hook for post-upload checks
     ($hook = vBulletinHook::fetch_hook('dl2_post_upload_add')) ? eval($hook) : false;
     eval(print_standard_redirect('dl2_msg_file_added', true, true));
 } else {
     if ($_GET['do'] == 'edit') {
         if ($upload) {
             // New upload was successfull, so remove the old file
             @unlink($dl->url . $file['url']);
         }
         if ($file['category'] != $vbulletin->GPC['category']) {
             $dl->modify_filecount($vbulletin->GPC['category'], 1);
             $dl->modify_filecount_delete($file['category'], -1);
Exemple #3
0
 $cat = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "dl2_categories WHERE id = " . $vbulletin->GPC['delete']);
 $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl2_categories WHERE id = " . $vbulletin->GPC['delete']);
 if ($db->affected_rows() > 0) {
     if ($vbulletin->GPC['destination'] == 0) {
         $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl2_categories WHERE parent = " . $vbulletin->GPC['delete']);
     } else {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl2_categories SET parent = " . $vbulletin->GPC['destination'] . " WHERE parent = " . $vbulletin->GPC['delete']);
     }
     $dl->modify_subcount($cat['parent'], -$db->affected_rows() + $cat['subs']);
     $dl->modify_subcount($vbulletin->GPC['destination'], $db->affected_rows() + $cat['subs']);
     if ($vbulletin->GPC['destination'] == 0) {
         $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl2_files WHERE category = " . $vbulletin->GPC['delete']);
     } else {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl2_files SET category = " . $vbulletin->GPC['destination'] . " WHERE category = " . $vbulletin->GPC['delete']);
     }
     $dl->modify_filecount($cat['parent'], -$db->affected_rows() + $cat['files']);
     $dl->modify_filecount($vbulletin->GPC['destination'], $db->affected_rows() + $cat['files']);
     $dl->update_counters();
     if ($vbulletin->GPC['destination'] == 0) {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl2_main SET `files` = `files`-" . $db->sql_prepare($cat['files']));
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl2_main SET `categories` = `categories`-" . $db->sql_prepare($cat['subs'] + 1));
         define('CP_REDIRECT', 'downloads2.php?do=category');
         print_stop_message('dl2_deleted_category_successfully');
     } else {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl2_main SET `categories` = `categories`-1");
         define('CP_REDIRECT', 'downloads2.php?do=category');
         print_stop_message('dl2_deleted_category_successfully');
     }
 } else {
     print_stop_message('dl2_error_nothing_to_delete');
 }
Exemple #4
0
 $cat = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "dl_cats WHERE `id`=" . $db->sql_prepare($_POST['delete']));
 $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl_cats WHERE `id`=" . $db->sql_prepare($_POST['delete']));
 if ($db->affected_rows() > 0) {
     if ($_POST['destination'] == 0) {
         $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl_cats WHERE `parent`=" . $db->sql_prepare($_POST['delete']));
     } else {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl_cats SET `parent`=" . $db->sql_prepare($_POST['destination']) . " WHERE `parent`=" . $db->sql_prepare($_POST['delete']));
     }
     $dl->modify_subcount($cat['parent'], -$db->affected_rows() + $cat['subs']);
     $dl->modify_subcount($_POST['destination'], $db->affected_rows() + $cat['subs']);
     if ($_POST['destination'] == 0) {
         $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl_files WHERE `category`=" . $db->sql_prepare($_POST['delete']));
     } else {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl_files SET `category`=" . $db->sql_prepare($_POST['destination']) . " WHERE `category`=" . $db->sql_prepare($_POST['delete']));
     }
     $dl->modify_filecount($cat['parent'], -$db->affected_rows() + $cat['files']);
     $dl->modify_filecount($_POST['destination'], $db->affected_rows() + $cat['files']);
     $dl->update_counters();
     if ($_POST['destination'] == 0) {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl_main SET `files` = `files`-" . $db->sql_prepare($cat['files']));
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl_main SET `categories` = `categories`-" . $db->sql_prepare($cat['subs'] + 1));
         define('CP_REDIRECT', "downloadadmin.php?do=category");
         print_stop_message('ecdownloads_category_deleted');
     } else {
         $db->query_write("UPDATE " . TABLE_PREFIX . "dl_main SET `categories` = `categories`-1");
         define('CP_REDIRECT', "downloadadmin.php?do=category");
         print_stop_message('ecdownloads_category_deleted');
     }
 } else {
     print_stop_message('ecdownloads_nothing_to_delete');
 }