コード例 #1
0
ファイル: db_update.php プロジェクト: simplyianm/clububer
     $new_ver = "1.7.10";
     $set_tbl = DB_PREFIX . "pdp_settings";
     //
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_downloads" . " ADD KEY (cat_id)";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_downloads" . " ADD KEY (user_id)";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_downloads" . " ADD KEY (license_id)";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_comments" . " ADD KEY (download_id)";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_files" . " ADD KEY (download_id)";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_log" . " ADD KEY (download_id)";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_images" . " ADD KEY (download_id)";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_notify" . " ADD KEY (user_id, download_id)";
     // count comments
     $query_id = dbquery("SELECT dl_id FROM " . DB_PREFIX . "pdp_downloads");
     while ($data = dbarray($query_id)) {
         $comm_count = ff_db_count("(*)", "pdp_comments", "(dl_id='" . $data['dl_id'] . "')");
         $avg = pdp_calc_avg_vote($data['dl_id']);
         $mysql[] = "UPDATE " . DB_PREFIX . "pdp_downloads" . " SET" . " count_comments='" . $comm_count . "'" . " WHERE dl_id='" . $data['dl_id'] . "'";
     }
     break;
 case '1.7.10':
     $new_ver = '1.8.0';
     $set_tbl = DB_PREFIX . "pdp_settings";
     //
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_cats\n\t\tADD COLUMN cat_download_access tinyint(3) unsigned NOT NULL default '0'";
     $mysql[] = "UPDATE " . DB_PREFIX . "pdp_cats\n\t\tSET\n\t\tcat_download_access=cat_access";
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_settings\n\t\tADD COLUMN download_restricted text NOT NULL";
     $mysql[] = "UPDATE " . DB_PREFIX . "pdp_settings\n\t\tSET\n\t\tdownload_restricted='" . stripinput($locale['PDP407']) . "'";
     /*!!!NO BREAK!!!*/
 /*!!!NO BREAK!!!*/
 case '1.8.0':
     $new_ver = '1.8.1';
コード例 #2
0
    $href .= "#comm" . $comment_id;
} elseif (isset($_POST['delete_comments']) && iPDP_MOD) {
    $do_calc_comments = true;
    if (!isset($_POST['comment'])) {
        fallback(FUSION_SELF . "?did=" . $download->id);
    }
    $errors = 0;
    foreach ($_POST['comment'] as $id => $val) {
        if (!dbquery("DELETE FROM " . DB_PDP_COMMENTS . " WHERE comment_id='" . $id . "'" . " AND download_id='" . $download->id . "'")) {
            ++$errors;
        }
    }
} elseif (isset($_GET['subscibe']) && $pdp->settings['allow_notify'] && iMEMBER) {
    $do_calc_subscribers = true;
    if ($_GET['subscibe'] == "1") {
        $ok = dbquery("INSERT INTO " . DB_PDP_NOTIFY . "" . " SET" . " user_id='" . $userdata['user_id'] . "'," . " download_id='" . $download->id . "'," . " visited='yes'," . " details='0'");
    } else {
        $ok = dbquery("DELETE FROM " . DB_PDP_NOTIFY . "" . " WHERE user_id='" . $userdata['user_id'] . "'" . " AND download_id='" . $download->id . "'");
    }
    $download->log_event(PDP_EV_SUBSCRIBE, 0);
}
if ($do_calc_avg) {
    $ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tavg_vote='" . pdp_calc_avg_vote($download->id) . "',\n\t\tcount_votes='" . ff_db_count("(*)", DB_PDP_VOTES, "(download_id='" . $download->id . "')") . "'\n\t\tWHERE download_id='" . $download->id . "'");
} elseif ($do_calc_comments) {
    $ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tcount_comments='" . ff_db_count("(*)", DB_PDP_COMMENTS, "(download_id='" . $download->id . "')") . "'\n\t\tWHERE download_id='" . $download->id . "'");
} elseif ($do_calc_subscribers) {
    $ok = dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tcount_subscribers='" . ff_db_count("(*)", DB_PDP_NOTIFY, "(download_id='" . $download->id . "')") . "'\n\t\tWHERE download_id='" . $download->id . "'");
}
if ($errors == 0) {
    fallback($href);
}
コード例 #3
0
 /*!!!NO BREAK!!!*/
 case '1.8.2':
     $new_ver = '1.8.3';
     $set_tbl = DB_PDP_SETTINGS;
     //
     $mysql[] = "ALTER TABLE " . DB_PDP_SETTINGS . "\n\t\tDROP COLUMN use_utf8_locales";
     /*!!!NO BREAK!!!*/
 /*!!!NO BREAK!!!*/
 case '1.8.3':
     $new_ver = '1.8.4';
     $set_tbl = DB_PDP_SETTINGS;
     //
     $mysql[] = "ALTER TABLE " . DB_PDP_DOWNLOADS . "\n\t\tADD COLUMN dir_files varchar(255) NOT NULL default ''";
     $query_id = dbquery("SELECT download_id\n\t\tFROM " . DB_PREFIX . "pdp_downloads");
     while ($row = dbarray($query_id)) {
         $avg = pdp_calc_avg_vote($row['download_id']);
         $mysql[] = "UPDATE " . DB_PREFIX . "pdp_downloads\n\t\t\tSET\n\t\t\tavg_vote='{$avg}'\n\t\t\tWHERE download_id=" . $row['download_id'];
     }
     break;
 case '1.8.4':
     $new_ver = '1.8.5';
     $set_tbl = DB_PDP_SETTINGS;
     //
     $mysql[] = "ALTER TABLE " . DB_PREFIX . "pdp_settings\n\t\tADD COLUMN profile_access tinyint(3) unsigned default '101'";
     break;
 case '1.8.5':
     unset($new_ver);
     break;
 default:
     opentable($locale['PDP780']);
     echo $locale['PDP789'] . ': <strong>1.4.6</strong>';