$_SERVER['REMOTE_ADDR'], "user_agent"=> $_SERVER['HTTP_USER_AGENT'], "referrer"=> $_SERVER['HTTP_REFERER'], "blog"=> get_option('home'), "comment_author"=> rawurlencode($name), "comment_author_email"=> rawurlencode($email), "comment_author_url"=> "http://", "comment_content"=> str_replace("%20", "+", rawurlencode($subject))."+".str_replace("%20", "+", rawurlencode($post)), "comment_type"=> "", "user_ID"=> $userID ); $query_string = ''; foreach ($spamcheck as $k=>$v){ $query_string .= $k.'='.urlencode(stripslashes($v)).'&'; } // into akismet's spam protection if (function_exists('ksd_http_post')){ $response = ksd_http_post($query_string, $ksd_api_host, '/1.1/comment-check', $ksd_api_port); if ('true' == $response[1]){ return true; } } return false; } function adm_modify_process(){ global $_GET, $_POST, $table_prefix, $PHP_SELF, $wpdb; $liststatuses = array(active=>'Open',inactive=>'Closed',readonly=>'Read-Only'); $wpcSettings = get_option('wpClassified_data'); $loadpage = true; switch ($_GET['adm_action']){ case "deleteAd": $loadpage = delete_ad(); break; case "deleteImg": $loadpage = delete_img(); break; case "deleteAdSubject": $loadpage = delete_ad_subject(); break; case "activateAd": activate_ad($_GET['aid']); unset($_GET['aid']); break; case "activateAdSubject": activate_ad_subject($_GET['asid']); unset($_GET['asid']); break; case "stickyAdSubject": set_sticky_ad_subject($_GET['asid']); unset($_GET['asid']); break; case "move": _move(); $loadpage = false; break; case "moveAd": move_ad(); unset($_GET['asid']); $loadpage = true; break; case "saveAd": save_ad(); break; case "editAdSubject": edit_ad_subject(); $loadpage = false; break; case "editAd": edit_ad(); $loadpage = false; break; } if ($msg!=''){ ?>

0 && $loadpage==true){ $sql = "SELECT ADS.*, L.name as l_name, C.name as c_name, L.lists_id FROM {$table_prefix}wpClassified_ads_subjects ADS, {$table_prefix}wpClassified_lists L, {$table_prefix}wpClassified_categories C WHERE ADS.ads_subjects_list_id = L.lists_id AND C.categories_id = L.wpClassified_lists_id AND ADS.ads_subjects_id = ".$_GET['asid']; $adsInfo = $wpdb->get_row($sql, ARRAY_A); $ads = $wpdb->get_results("SELECT * FROM {$table_prefix}wpClassified_ads LEFT JOIN {$table_prefix}users ON {$table_prefix}users.ID = {$table_prefix}wpClassified_ads.author WHERE {$table_prefix}wpClassified_ads.ads_ads_subjects_id = '".($_GET['asid'])."' ORDER BY {$table_prefix}wpClassified_ads.date ASC"); ?>

back to previous page  back to main page

Viewing Ads:
In List: ()

status=='inactive')?"Activate":"De-activate"; $links = array( "ads_id."\">".__("Edit")."", "ads_id."\">".__("Delete")."", "ads_id."\">".__($act)."", "ads_id."\">".__("Move")."" ); ?>

subject);?>

on date));?>

post));?>

get_results("SELECT * FROM {$table_prefix}wpClassified_ads WHERE ads_id =". $ad->ads_id); $post = $postinfo[0]; $array = split('###', $post->image_file); if ($array[0]) { ?>

Images:

"; } ?>

ads_id."&file=".$f."\">Delete Image

back to previous page  back to main page

No Image Available!

"; } } ?> 0 && $loadpage==true){ $lists = $wpdb->get_row("SELECT * FROM {$table_prefix}wpClassified_lists LEFT JOIN {$table_prefix}wpClassified_categories ON {$table_prefix}wpClassified_categories.categories_id = {$table_prefix}wpClassified_lists.wpClassified_lists_id WHERE {$table_prefix}wpClassified_lists.lists_id = '".($_GET['lid'])."'", ARRAY_A); // list ads if (!$_GET['start']){ $_GET['start'] = 0; } $sql = "SELECT {$table_prefix}wpClassified_ads_subjects.*, {$table_prefix}wpClassified_ads.ads_id, {$table_prefix}wpClassified_ads.status as adstatus FROM {$table_prefix}wpClassified_ads_subjects LEFT JOIN {$table_prefix}users ON {$table_prefix}users.ID = {$table_prefix}wpClassified_ads_subjects.author LEFT JOIN {$table_prefix}wpClassified_ads ON {$table_prefix}wpClassified_ads.ads_ads_subjects_id = {$table_prefix}wpClassified_ads_subjects.ads_subjects_id WHERE {$table_prefix}wpClassified_ads_subjects.ads_subjects_list_id = '".($_GET['lid'])."' AND {$table_prefix}wpClassified_ads_subjects.status != 'deleted' ORDER BY {$table_prefix}wpClassified_ads_subjects.sticky ASC, {$table_prefix}wpClassified_ads_subjects.date DESC"; $ads = $wpdb->get_results($sql); $numAds = $wpdb->get_var("SELECT count(*) FROM {$table_prefix}wpClassified_ads_subjects WHERE ads_subjects_list_id = '".($_GET['lid'])."' AND status != 'deleted'"); ?>

back to previous page  back to main page

$wpcSettings['count_ads_per_page']){ echo "Pages: "; for ($i=0; $i<$numAds/$wpcSettings['count_ads_per_page']; $i++){ if ($i*$wpcSettings['count_ads_per_page']==$_GET['start']){ echo " ".($i+1)." "; } else { echo " ".($i+1)." "; } } } ?> sticky!='y')?"Sticky":"Unsticky"; $act = ($ad->adstatus=='inactive')?"De-activate":"Activate"; $links = array( "ads_subjects_id."&adm_action=editAd&aid=".$ad->ads_id."\">".__("Edit")."", "ads_subjects_id."&adm_action=stickyAd&aid=".$ad->ads_id."\">".__($slab)."", "ads_subjects_id."&adm_action=activateAd&aid=".$ad->ads_id."\">".__($act)."", "ads_subjects_id."&adm_action=deleteAd&aid=".$ad->ads_id."\">".__("Delete")."", "ads_subjects_id."&adm_action=move&aid=".$ad->ads_id."\">".__("Move").""); if ($ad->adstatus=='inactive') $color='#F5D0A9'; else $color ='#fff'; ?>
subject;?> views;?> date);?>
get_results("SELECT * FROM {$table_prefix}wpClassified_categories ORDER BY position ASC"); $tlists = $wpdb->get_results("SELECT * FROM {$table_prefix}wpClassified_lists WHERE wpClassified_lists_id IN (SELECT categories_id FROM {$table_prefix}wpClassified_categories) ORDER BY position ASC"); for ($i=0; $iwpClassified_lists_id][] = $tlists[$i]; } if (!$wpcSettings['count_last_ads']) $wpcSettings['count_last_ads'] = 5; echo "

Edit/Remove Ads

"; echo "

Last " . $wpcSettings['count_last_ads'] . " Ads posted...

"; $start = 0; // top lst 8 ads $sql ="SELECT ADS.*, A.status as adstatus, L.name as l_name, C.name as c_name FROM {$table_prefix}wpClassified_ads_subjects ADS, {$table_prefix}wpClassified_lists L, {$table_prefix}wpClassified_ads A, {$table_prefix}wpClassified_categories C WHERE ADS.ads_subjects_list_id = L.lists_id AND C.categories_id = L.wpClassified_lists_id AND ADS.ads_subjects_id=A.ads_ads_subjects_id ORDER BY ADS.ads_subjects_id DESC, ADS.date DESC LIMIT ".($start).", ".($wpcSettings['count_last_ads']); $lastAds = $wpdb->get_results($sql); foreach ($lastAds as $lastAd) { if ($lastAd->adstatus=='inactive') $color='#DF0101'; else $color ='#000'; echo "ads_subjects_id."\">".$lastAd->subject.""; echo " - ". @date($wpcSettings['date_format'],$lastAd->date).", (".$lastAd->c_name. " - ".$lastAd->l_name. ")"; if ($lastAd->adstatus=='inactive') echo " INACTIVE"; echo "
"; } echo "
"; ?>


categories_id]; for ($i=0; $i
Category/List Ads Status

name;?>

(status]; ?>) name;?> lists_id; $adsCount = $wpdb->get_var($sql); echo $adsCount; ?> status;?>
get_var("SELECT count(*) FROM {$table_prefix}wpClassified_ads WHERE ads_ads_subjects_id = '".((int)$id)."' AND status = 'active'")-1; $wpdb->query("UPDATE {$table_prefix}wpClassified_ads_subjects SET ads = '".$ads."' WHERE ads_subjects_id = '".((int)$id)."'"); } function set_sticky_ad_subject($id){ global $table_prefix, $wpdb; $cur = $wpdb->get_var("SELECT sticky FROM {$table_prefix}wpClassified_ads_subjects WHERE ads_subjects_id = '".$id."'"); $new = ($cur=='y')?"n":"y"; $wpdb->query("UPDATE {$table_prefix}wpClassified_ads_subjects SET sticky = '".$new."' WHERE ads_subjects_id = '".$id."'"); } function delete_ad(){ global $_GET, $_POST, $wpdb, $table_prefix, $PHP_SELF; $linkb = $PHP_SELF."?page=wpcModify&adm_arg=".$_GET['adm_arg']."&adm_action=deleteAd&lid=".$_GET['lid']."&aid=".$_GET['aid']; if ($_POST['deleteid']>0){ $sql = "DELETE FROM {$table_prefix}wpClassified_ads_subjects WHERE ads_subjects_id = (SELECT ads_ads_subjects_id FROM {$table_prefix}wpClassified_ads WHERE ads_id =".((int)$_POST['deleteid']).")"; $wpdb->query($sql); $wpdb->query("DELETE FROM {$table_prefix}wpClassified_ads WHERE ads_id = '".((int)$_POST['deleteid'])."'"); adm_sync_count($_GET['lid']); $wpdb->query("DELETE FROM {$table_prefix}wpClassified_read_ads WHERE read_ads_ads_subjects_id NOT IN (SELECT ads_subjects_id FROM {$table_prefix}wpClassified_ads_subjects)"); return true; } else { ?>

Confirmation to delete

Are you sure you want to delete this ad?
"> " onclick="history.go(-1);">
0){ $postinfo = $wpdb->get_results("SELECT * FROM {$table_prefix}wpClassified_ads WHERE ads_id = '".(int)$_GET['aid']."'"); $rec = $postinfo[0]; $array = split('###', $rec->image_file); foreach($array as $f) { if ($f == $_GET[file]){ } else { $txt .= $f . '###'; } } $newstring = substr($txt, 0, -3); $wpdb->query("UPDATE {$table_prefix}wpClassified_ads SET image_file ='" . $wpdb->escape(stripslashes($newstring)) . "' WHERE ads_id=" . $_GET['aid'] ); $file = ABSPATH."wp-content/plugins/wp-classified/images/" . $_GET[file]; if ($_GET[file]) unlink($file); return true; } else { ?>

Confirmation to delete

Are you sure you want to delete this Image?
"> " onclick="history.go(-1);">
get_var("SELECT status FROM {$table_prefix}wpClassified_ads WHERE ads_id = '".$id."'"); $new = ($cur=='active')?"inactive":"active"; $sql = "UPDATE {$table_prefix}wpClassified_ads SET status = '".$new."' WHERE ads_id = '".$id."'"; $wpdb->query($sql); adm_count_ads($id); } function activate_ad_subject($id){ global $table_prefix, $wpdb, $_GET; $cur = $wpdb->get_var("SELECT status FROM {$table_prefix}wpClassified_ads_subjects WHERE ads_subjects_id = '".$id."'"); $new = ($cur=='open')?"closed":"open"; $wpdb->query("UPDATE {$table_prefix}wpClassified_ads_subjects SET status = '".$new."' WHERE ads_subjects_id = '".$id."'"); adm_sync_count($_GET['lid']); } function delete_ad_subject(){ global $_GET, $_POST, $wpdb, $table_prefix, $PHP_SELF; $url = $PHP_SELF."?page=wpcModify&adm_arg=".$_GET['adm_arg']."&adm_action=deleteAd&lid=".$_GET['lid']; //adm_arg=wpcModify&lid=7&asid=47&adm_action=deleteAd&aid=47 ok //adm_arg=wpcModify&lid=&asid=60&adm_action=deleteAd&aid=63 nok if ($_POST['deleteid']>0){ $wpdb->query("UPDATE {$table_prefix}wpClassified_ads SET status = 'inactive' WHERE ads_ads_subjects_id = '".((int)$_POST['deleteid'])."'"); $wpdb->query("UPDATE {$table_prefix}wpClassified_ads_subjects SET status = 'deleted' WHERE ads_subjects_id = '".((int)$_POST['deleteid'])."'"); adm_sync_count($_GET['lid']); return true; } else { ?>

Ad Deletion Confirmation

Are you sure you want to delete this ads?
"> " onclick="history.go(-1);">
get_row("SELECT * FROM {$table_prefix}wpClassified_ads_subjects WHERE ads_subjects_id = '".($_GET['asid'])."'"); ?>

Rename Ad subject

".$rec->subject.""; ?>
"> ">  
get_results("SELECT * FROM {$table_prefix}wpClassified_ads LEFT JOIN {$table_prefix}users ON {$table_prefix}users.ID = {$table_prefix}wpClassified_ads.author WHERE ads_id = '".(int)$_GET['aid']."'"); $rec = $rec[0]; ?>

">
Original Ad () subject; ?>
post;?>
Edit
Subject:
Description:
".str_replace("<", "<", $rec->post)."" ?>

  
query("UPDATE {$table_prefix}wpClassified_ads SET post = '".$html."', subject='".$sbj."' WHERE ads_id = '".(int)$_GET['aid']."'"); $sql = "UPDATE {$table_prefix}wpClassified_ads_subjects SET subject='".$sbj."' WHERE ads_subjects_id=".$_POST['ads_subjects_id']; $wpdb->query($sql); } $msg = "Ad Saved"; return $msg; } function move_ad(){ global $_GET, $_POST, $wpdb, $table_prefix; list($olst, $ocat) = split(' -> ', $_POST['lstCatNames']); $wpdb->query("UPDATE {$table_prefix}wpClassified_ads_subjects SET ads_subjects_list_id = '".$_POST['adLid']."' WHERE ads_subjects_id = '".$_GET['asid']."'"); /* $wpdb->query("UPDATE {$table_prefix}wpClassified_ads SET ads_ads_subjects_id = '".$_POST['adLid']."' WHERE ads_ads_subjects_id = '".$_GET['asid']."'"); */ $asid = $wpdb->get_row("SELECT * FROM {$table_prefix}wpClassified_ads_subjects WHERE ads_subjects_id = '".$_GET['asid']."'"); $lids = $wpdb->get_row("SELECT * FROM {$table_prefix}wpClassified_lists WHERE wpClassified_lists_id = '".$_GET['lid']."'"); $newLids = $wpdb->get_row("SELECT * FROM {$table_prefix}wpClassified_lists WHERE wpClassified_lists_id = '".$_POST['adLid']."'"); if($lids->ads_status!='0'){ $oldStatus = $lids->ads_status-1; }else{ $oldStatus = $lids->ads_status; } $oldAd = $lids->ads-$asids->ads; $old_views_count = $lids->ads_views-$asids->views; $newLidStatus = $newLids->ads_status+1; $newAd = $newLids->ads+$asids->ads; $newadView = $newLids->ads_views+$asids->views; $wpdb->query("UPDATE {$table_prefix}wpClassified_lists SET ads_status = '".$oldStatus."', ads = '".$oldAd."', ads_views = '".$old_views_count."' WHERE wpClassified_lists_id = '".$_GET['lid']."'"); $wpdb->query("UPDATE {$table_prefix}wpClassified_lists SET ads_status = '".$newLidStatus."', ads = '".$newAd."', ads_views = '".$newadView."' WHERE wpClassified_lists_id = '".$_POST['adLid']."'"); $msg = "Ad moved to: ".$_POST['lstCatNames']; return $msg; } function _move(){ global $_GET, $_POST, $wpdb, $table_prefix, $PHP_SELF; ?>

back to previous page  back to main page

Move Ad

get_row("SELECT l.name lst, c.name cat FROM {$table_prefix}wpClassified_lists l, {$table_prefix}wpClassified_categories c WHERE l.lists_id = '".$_GET['lid']."' AND l.wpClassified_lists_id = c.categories_id"); $lst_cat = $wpdb->get_results("SELECT l.lists_id, l.name lst, c.name cat FROM {$table_prefix}wpClassified_lists l, {$table_prefix}wpClassified_categories c WHERE l.wpClassified_lists_id = c.categories_id ORDER BY lst ASC"); $asid = $wpdb->get_row("SELECT * FROM {$table_prefix}wpClassified_ads_subjects WHERE ads_subjects_id = '".$_GET['asid']."'"); echo "


Ad to move:" .$asid->subject . "
"; echo "Actual List:" . $lst_cat_org->lst ."
Category:".$lst_cat_org->cat . "
"; echo "
"; $url = $PHP_SELF."?page=wpcModify&adm_arg=".$_GET['adm_arg']."&adm_action=moveAd&aid=".$_GET['aid']."&lst=".$_GET['lid']."&asid=".$_GET['asid']; ?>
".$lst_cat_org->cat;?>" name="lstCatNames"> Select the list to move the Ad to: "; foreach($lst_cat as $adLid) { echo "