$photoplog_categorybit = $photoplog_ds_catopts[$photoplog['catid']]['options']; $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();
$photoplog_rating_infos = $db->query_read("SELECT userid, fileid,\r\n\t\t\tSUM(IF(rating > 0, 1, 0)) AS cntr1\r\n\t\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_ratecomment\r\n\t\t\tGROUP BY userid, fileid\r\n\t\t"); $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 {