} photoplog_maintain_postbitcounts($photoplog_start, $photoplog_perpage, $photoplog_phase, $vbphrase['photoplog_maintenance'], 'photoplog_maintain.php'); if ($_REQUEST['massmove'] == 1) { print_cp_redirect("photoplog_massmove.php?" . $vbulletin->session->vars['sessionurl'] . "do=view", 1); } else { print_cp_redirect("photoplog_maintain.php?" . $vbulletin->session->vars['sessionurl'] . "do=update", 1); } } if ($_REQUEST['do'] == 'counts') { $photoplog_start = intval($vbulletin->GPC['start']); $photoplog_perpage = intval($vbulletin->GPC['perpage']); $photoplog_phase = intval($vbulletin->GPC['phase']); if (!$photoplog_perpage) { $photoplog_perpage = 50; } photoplog_maintain_counts($photoplog_start, $photoplog_perpage, $photoplog_phase, $vbphrase['photoplog_maintenance'], 'photoplog_maintain.php'); print_cp_redirect("photoplog_maintain.php?" . $vbulletin->session->vars['sessionurl'] . "do=update", 1); } if ($_REQUEST['do'] == 'sync') { $photoplog_start = intval($vbulletin->GPC['start']); $photoplog_perpage = intval($vbulletin->GPC['perpage']); $photoplog_phase = intval($vbulletin->GPC['phase']); if (!$photoplog_perpage) { $photoplog_perpage = 25; } $photoplog_stop = intval($photoplog_start + $photoplog_perpage); print_table_start(); print_table_header($vbphrase['photoplog_maintenance'], 1); print_cells_row(array('<nobr>' . $vbphrase['photoplog_sync_files_and_albums'] . '</nobr>'), 1, '', -1); if ($photoplog_phase == 0) { $photoplog_msg = $vbphrase['photoplog_updating'] . ' photoplog_useralbums: ' . $photoplog_start . ' - ' . $photoplog_stop;
} } else { if ($photoplog_include_subcategories && $photoplog_make_subcategories && $photoplog_move_categories) { photoplog_massmove_make_subcats_as_necessary($photoplog_fileids, $photoplog_destination_list_categories, $photoplog_parent_list_categories, $photoplog_source_list_categories, $photoplog_ds_catopts); } $photoplog_destination_posted_on_dateline = $photoplog_move_action && photoplog_checkdate($photoplog_destination_posted_on) ? photoplog_get_dateline($photoplog_destination_posted_on) : -1; if ($photoplog_move_action) { // make update set strings $photoplog_update_set_fileuploads_string = photoplog_massmove_make_update_set_fileuploads($photoplog_multi_wheres, $photoplog_move_categories, $photoplog_destination_list_categories, $photoplog_destination_posted_by, $photoplog_new_username, $photoplog_destination_posted_on_dateline); $photoplog_update_set_ratecomment_string = photoplog_massmove_make_update_set_ratecomment($photoplog_multi_wheres, $photoplog_move_categories, $photoplog_destination_list_categories); // update the tables photoplog_massmove_do_move_update($photoplog_update_set_fileuploads_string, $photoplog_update_set_ratecomment_string, $photoplog_fileids, $photoplog_fileinfo, $photoplog_movefiles, $photoplog_destination_posted_by); } else { photoplog_massmove_do_delete_update($photoplog_fileids, $photoplog_fileinfo); } photoplog_maintain_counts(0, 50, 0, $photoplog_header, 'photoplog_massmove.php'); // print_cp_redirect("photoplog_massmove.php?".$vbulletin->session->vars['sessionurl']."do=view", 1); } } print_cp_footer(); // ################### PHOTOPLOG MASS MOVE FUNCTIONS ###################### function photoplog_massmove_make_select_sql($where_condition, $having_condition) { $select_sql = "SELECT " . PHOTOPLOG_PREFIX . "photoplog_fileuploads.*,\r\n\t\t\tMAX(" . PHOTOPLOG_PREFIX . "photoplog_ratecomment.dateline) AS max_ratecomment_dateline,\r\n\t\t\tCOUNT(" . PHOTOPLOG_PREFIX . "photoplog_ratecomment.commentid) AS count_ratecomment,\r\n\t\t\tSUM(IF(IFNULL(" . PHOTOPLOG_PREFIX . "photoplog_ratecomment.rating,0) > 0, 1, 0)) AS number_ratecomment_rating,\r\n\t\t\tIFNULL(AVG(NULLIF(" . PHOTOPLOG_PREFIX . "photoplog_ratecomment.rating,0)),0) AS average_ratecomment_rating\r\n\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_fileuploads LEFT JOIN " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\tON (" . PHOTOPLOG_PREFIX . "photoplog_fileuploads.fileid = " . PHOTOPLOG_PREFIX . "photoplog_ratecomment.fileid)\r\n\t\t\t{$where_condition} GROUP BY " . PHOTOPLOG_PREFIX . "photoplog_fileuploads.fileid\r\n\t\t\t{$having_condition}"; return $select_sql; } function photoplog_massmove_make_update_set_fileuploads(&$multi_wheres, $move_categories, &$cat_map, $destination_posted_by, $destination_posted_by_username, $destination_posted_on_dateline) { global $vbulletin; $update_set_array = array(); foreach ($multi_wheres as $multi_key => $multi_value) {