$photoplog_catoptions = convert_bits_to_array($photoplog_categorybit, $photoplog_categoryoptions); $do_comments = $photoplog_catoptions['allowcomments'] ? 1 : 0; } if (!$do_comments) { photoplog_index_bounce(); } if ($photoplog_comment_info) { if ($photoplog_comment_info['userid'] == $vbulletin->userinfo['userid'] && defined('PHOTOPLOG_USER10') || defined('PHOTOPLOG_USER12')) { $photoplog['fileid'] = $photoplog_comment_info['fileid']; $photoplog_have_comment = $photoplog_comment_info['comment'] != '' ? 1 : 0; $db->query_write("DELETE FROM " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\tWHERE commentid = " . intval($photoplog['commentid']) . "\r\n\t\t\t\t{$photoplog_catid_sql2}\r\n\t\t\t\t{$photoplog_admin_sql2}\r\n\t\t\t"); if ($photoplog_have_comment) { $db->query_write("UPDATE " . TABLE_PREFIX . "user\r\n\t\t\t\t\tSET photoplog_commentcount = photoplog_commentcount - 1\r\n\t\t\t\t\tWHERE userid = " . intval($photoplog_comment_info['userid']) . "\r\n\t\t\t\t"); } photoplog_update_fileuploads_counts($photoplog['fileid']); photoplog_update_counts_table($photoplog['catid']); ($hook = vBulletinHook::fetch_hook('photoplog_comment_dodelete_complete')) ? eval($hook) : false; $photoplog_url = $photoplog['location'] . '/index.php?' . $vbulletin->session->vars['sessionurl'] . 'n=' . $photoplog['fileid']; exec_header_redirect($photoplog_url); exit; } else { photoplog_index_bounce(); } } else { photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_tank']); } } ($hook = vBulletinHook::fetch_hook('photoplog_comment_complete')) ? eval($hook) : false; if ($_REQUEST['do'] != 'comment' && $_POST['do'] != 'docomment' && $_GET['do'] != 'edit' && $_GET['do'] != 'delete' && $_POST['do'] != 'dodelete') { photoplog_index_bounce(); }
} } if (!$photoplog_file_edit && empty($photoplog_file_title) && empty($photoplog_file_description)) { photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_text']); } $photoplog_replace_name = $photoplog_file_old; if ($photoplog_file_edit) { $photoplog_replace_name = $photoplog_file_name; } ($hook = vBulletinHook::fetch_hook('photoplog_edit_sqlreplace')) ? eval($hook) : false; if ($db->query_write("REPLACE INTO " . PHOTOPLOG_PREFIX . "photoplog_fileuploads\r\n\t\t\t(fileid, userid, username, title, description, filename, filesize, dateline, views, catid, moderate, dimensions, setid, \r\n\t\t\tfielddata, num_comments0, num_comments1, num_ratings0, num_ratings1, sum_ratings0, sum_ratings1,\r\n\t\t\tlast_comment_dateline0, last_comment_dateline1, last_comment_id0, last_comment_id1, albumids, exifinfo)\r\n\t\t\tVALUES (\r\n\t\t\t\t" . intval($photoplog_file_id) . ",\r\n\t\t\t\t" . intval($photoplog_file_userid) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_username) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_title) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_file_description) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_replace_name) . "',\r\n\t\t\t\t" . intval($photoplog_file_size) . ",\r\n\t\t\t\t" . intval($photoplog_file_dateline) . ",\r\n\t\t\t\t" . intval($photoplog_file_views) . ",\r\n\t\t\t\t" . intval($photoplog_file_catid) . ",\r\n\t\t\t\t" . intval($photoplog_file_moderate) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog['dimensions']) . "',\r\n\t\t\t\t" . intval($photoplog_file_setid) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_fielddata) . "',\r\n\t\t\t\t" . intval($photoplog_file_nc0) . ",\r\n\t\t\t\t" . intval($photoplog_file_nc1) . ",\r\n\t\t\t\t" . intval($photoplog_file_nr0) . ",\r\n\t\t\t\t" . intval($photoplog_file_nr1) . ",\r\n\t\t\t\t" . intval($photoplog_file_sr0) . ",\r\n\t\t\t\t" . intval($photoplog_file_sr1) . ",\r\n\t\t\t\t" . intval($photoplog_file_lcd0) . ",\r\n\t\t\t\t" . intval($photoplog_file_lcd1) . ",\r\n\t\t\t\t" . intval($photoplog_file_lci0) . ",\r\n\t\t\t\t" . intval($photoplog_file_lci1) . ",\r\n\t\t\t\t'" . $db->escape_string($photoplog_albumids) . "',\r\n\t\t\t\t'" . $db->escape_string($photoplog_exifinfo) . "'\r\n\t\t\t)\r\n\t\t")) { if ($photoplog_file_catid_default >= 0 && $photoplog_file_catid != $photoplog_file_catid_default) { $db->query_write("UPDATE " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\t\t\tSET catid = " . intval($photoplog_file_catid) . "\r\n\t\t\t\t\t\tWHERE fileid = " . intval($photoplog_file_id) . "\r\n\t\t\t"); photoplog_update_counts_table($photoplog_file_catid_default); } photoplog_update_counts_table($photoplog_file_catid); if ($photoplog_file_moderate == 1 && $vbulletin->options['photoplog_admin_email']) { $photoplog_subject = $photoplog_message = ''; eval(fetch_email_phrases('photoplog_mod_file', -1, '', 'photoplog_')); vbmail($vbulletin->options['webmasteremail'], $photoplog_subject, $photoplog_message, true); } if ($photoplog_file_old && $photoplog_file_edit) { @unlink($photoplog_directory_name . "/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/large/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/medium/" . $photoplog_file_old); @unlink($photoplog_directory_name . "/small/" . $photoplog_file_old); } ($hook = vBulletinHook::fetch_hook('photoplog_edit_doedit_complete')) ? eval($hook) : false; $photoplog_id = intval($photoplog_file_id); $photoplog_url = $photoplog['location'] . '/index.php?' . $vbulletin->session->vars['sessionurl'] . 'n=' . $photoplog_id; exec_header_redirect($photoplog_url);
$photoplog_rating_cntr = 0; while ($photoplog_rating_info = $db->fetch_array($photoplog_rating_infos)) { if ($photoplog_rating_info['cntr1'] > 1) { $photoplog_rating_cntr++; break; } } if ($photoplog_rating_infos && $photoplog_rating_cntr) { $db->data_seek($photoplog_rating_infos, 0); while ($photoplog_rating_info = $db->fetch_array($photoplog_rating_infos)) { if ($photoplog_rating_info['cntr1'] > 1) { $photoplog_first_comment = $db->query_first("SELECT commentid, catid\r\n\t\t\t\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\t\t\tWHERE fileid = " . intval($photoplog_rating_info['fileid']) . "\r\n\t\t\t\t\t\tAND userid = " . intval($photoplog_rating_info['userid']) . "\r\n\t\t\t\t\t\tAND rating > 0\r\n\t\t\t\t\t\tORDER BY dateline ASC\r\n\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t"); if ($photoplog_first_comment) { $db->query_write("UPDATE " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\t\t\t\t\tSET rating = 0\r\n\t\t\t\t\t\t\tWHERE fileid = " . intval($photoplog_rating_info['fileid']) . "\r\n\t\t\t\t\t\t\tAND userid = " . intval($photoplog_rating_info['userid']) . "\r\n\t\t\t\t\t\t\tAND commentid != " . intval($photoplog_first_comment['commentid']) . "\r\n\t\t\t\t\t\t"); photoplog_update_fileuploads_counts($photoplog_rating_info['fileid']); photoplog_update_counts_table($photoplog_first_comment['catid']); $photoplog_commentid = $photoplog_first_comment['commentid']; $photoplog_msg = $vbphrase['photoplog_updating'] . ' - ' . $vbphrase['photoplog_comment'] . ' ' . $vbphrase['photoplog_id'] . ' ' . $photoplog_commentid . ': ' . $vbphrase['photoplog_rating'] . ' != 0 '; print_description_row($photoplog_msg, 0, 1); @flush(); @ob_flush(); $db->free_result($photoplog_first_comment); } } } $db->free_result($photoplog_rating_infos); print_description_row('<strong>' . $vbphrase['photoplog_done'] . '</strong>', 0, 1); print_table_footer(); print_cp_redirect("photoplog_maintain.php?" . $vbulletin->session->vars['sessionurl'] . "do=update", 1); } else { print_description_row($vbphrase['photoplog_nothing_to_maintain'], 0, 1);