assign('odl_images', get_bloginfo('wpurl')."/wp-content/plugins/odlinks"); //$odl_search_link= get_bloginfo('url')."&odlinksaction=searchlink"; //$odl_advanced=odlinkscreate_link("searchlink", array("name"=>'Advanced')); //$tpl->assign('odl_advanced', $odl_advanced); $odl_search_link=odlinkscreate_link("searchform", array()); $tpl->assign('odl_search_link', $odl_search_link); $odl_main_link=odlinkscreate_link("index", array("name"=>"Main")); $odl_top_link=odlinkscreate_link("index", array("name"=>$odlinkssettings['page_link_title'])); $tpl->assign('odl_top_link', $odl_top_link); $tpl->assign('odl_main_link', $odl_main_link); $tpl->assign('odl_wpurl', get_bloginfo('url')); $url=$_POST['odlinksdata']['url']; $email=$_POST['odlinksdata']['email']; $title=$_POST['odlinksdata']['title']; $category=$_POST['odlinksdata']['category']; $description=$_POST['odlinksdata']['description']; if ($_POST['odlinkspost_topic']=='yes'){ $makepost=true; if (str_replace(" ", "", $email)==''){ $msg ="You need to enter email address!"; $makepost=false; } if (str_replace(" ", "", $url)==''){ $msg ="You must provide an url!"; $makepost=false; } else { $sql="SELECT c_domain FROM {$table_prefix}odbanned"; $results=$wpdb->get_results($sql); for($i=0; $ic_domain,$url)){ $msg = "This address that is banned from our directory, please contact administration to resolve this issue: " .get_option('admin_email'); $makepost=false; } } } if (str_replace(" ", "", $title)==''){ $msg ="You must to enter a title!"; $makepost=false; } if (!$category || str_replace(" ", "", $category)==''){ $msg ="You need to select at least one category!"; $makepost=false; } if (str_replace(" ", "", $description)==''){ $msg ="You must provide a description!"; $makepost=false; } if($odlinkssettings['confirmation_code']=='y'){ if (! _odl_captcha::Validate($_POST['odlinksdata']['odl_captcha'])) { $msg="The confirmation code didn't matched."; $makepost=false; } } if($url && !eregi("http://",$url)){ $url='http://'.$url; } if ($makepost==true){ $sql="SELECT * FROM {$table_prefix}odnew_links"; $results=$wpdb->get_results($sql); if (!empty($results)) foreach ($results as $result) { if($result->n_url == $url){ $msg="This URL was already submitted. We will check it as soon as possible."; $makepost=false; } } $sql="SELECT * FROM {$table_prefix}odlinks"; $results=$wpdb->get_results($sql); if (!empty($results)) { // check Double Post foreach ($results as $result) { if($result->l_url == $url){ $msg="This URL is already listed in our directory."; $makepost=false; } } } if ($makepost==true){ mysql_query("INSERT INTO {$table_prefix}odnew_links (n_url, n_title, n_description, n_email, n_category) VALUES ('$url', '$title', '$description', '$email', $category)"); $msg="Your URL was sucessfully submitted for editor review!

Feel free to submit another URL.

 

"; $out=_odl_email_notifications($url, $title, $description, $email, $category); $displayform=false; } else { $displayform=true; } } } if ($displayform==true){ $space=""; if($odlinkssettings['confirmation_code']=='y'){ $aFonts=array(ABSPATH."wp-content/plugins/odlinks/includes/fonts/arial.ttf"); $oVisualCaptcha=new _odl_captcha($aFonts); $captcha=rand(1, 50).".png"; $oVisualCaptcha->create(ABSPATH."wp-content/plugins/odlinks/includes/Smarty/cache/".$captcha); $confirm='Confirm: ConfirmCode'; $confirm .= ''; $tpl->assign('confirm',$confirm); } for ($x=0; $x < $lev; $x++) { $space .= "     "; } $sql="SELECT * FROM {$table_prefix}odcategories WHERE c_parent='$parent' ORDER BY c_title ASC"; $categories=$wpdb->get_results($sql); for ($i=0; $ic_id."'"; $result=$wpdb->get_row($sql, ARRAY_A); $links_num=$result['count']; $id=intval($row->c_id); $title=$row->c_title; $option .= "\n"; } $tpl->assign('categories',$option); $tpl->assign('error',''.$msg.''); $tpl->assign('url',$url); $tpl->assign('title',$title); $tpl->assign('description',$description); $tpl->assign('email',$email); } else { odlinksdisplay_index($msg); } if ($odlinkssettings[odlinksshow_credits] == 'y') { $credit='Open Directory Links Powered By 4gani Version '.$odlinksversion; $tpl->assign('odl_credit_line', $credit); } list($gAd, $top, $btn)=get_odl_GADlink(); if ($gAd) { $code='
'.$gAd.'
'; $tpl->assign('googletop',$top); $tpl->assign('googlebtn',$btn); $tpl->assign('googleAd',$code); } odlinks_footer($tpl); $tpl->display('addurl.tpl'); } //odlinkspost_link function odlinkssend_link(){ global $_GET, $_POST, $table_prefix, $wpdb; $odlinkssettings=get_option('odlinksdata'); $id=$_GET['id']; $sql="SELECT * FROM {$table_prefix}odlinks WHERE l_id=".$id; $results=$wpdb->get_results($sql); if (!empty($results)) { foreach ($results as $result) { $description=$result->l_description; $name=$result->l_name; $title=$result->l_title; $url=$result->l_url; } } $displayform=true; $tpl=new ODLTemplate(); $tpl->assign('title', $title); $tpl->assign('description', $description); $tpl->assign('odl_images', get_bloginfo('wpurl')."/wp-content/plugins/odlinks"); //$odl_advanced=odlinkscreate_link("searchlink", array("name"=>'Advanced')); //$tpl->assign('odl_advanced', $odl_advanced); $odl_search_link=odlinkscreate_link("searchform", array()); $tpl->assign('odl_search_link', $odl_search_link); $odl_main_link=odlinkscreate_link("index", array("name"=>"Main")); $odl_top_link=odlinkscreate_link("index", array("name"=>$odlinkssettings['page_link_title'])); $tpl->assign('odl_top_link', $odl_top_link); $tpl->assign('odl_main_link', $odl_main_link); $tpl->assign('odl_wpurl', get_bloginfo('url')); if ($_POST['odlinks_send_link']=='yes'){ $sendAd=true; $yourname=$_POST['odlinksdata'][yourname]; $mailfrom=$_POST['odlinksdata'][mailfrom]; $mailto=$_POST['odlinksdata'][mailto]; if (!eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}$", $_POST['odlinksdata'][mailto])){ $msg='_INVALIDEMAIL2'; $sendAd=false; } if($odlinkssettings['confirmation_code']=='y'){ if (! _odl_captcha::Validate($_POST['odlinksdata']['odl_captcha'])) { $msg="The confirmation code didn't matched."; $sendAd=false; } } if ($sendAd == true) { $displayform=false; $message="Dear ".$_POST['odlinksdata'][fname]."
"; $message .= "Your friend ".$yourname." send you this interesting website about ".$title."

"; $message .= 'links detail: '.$description."
"; $message .= 'link: '.$url; $message .= '


Link Directory Sites '.get_bloginfo('wpurl')."/?page_id=".$pageinfo["ID"].' and Service'; $txt=odl_html2text($message); $from="From: ".$yourname."<" .$mailfrom.">"; $from .= "Content-Type: text/html"; $sub="your friend ".$yourname." sent you an interesting website ;-)"; $email_status=_odl_send_email($mailto, $sub, $txt, $from); //, $from if ($email_status[0] == false) { $msg=$email_status[1]; $sendAd=false; } else { odlinksdisplay_index($email_status[1]); } } } else { $displayform=true; } if ($displayform==true){ if($odlinkssettings['confirmation_code']=='y'){ $aFonts=array(ABSPATH."wp-content/plugins/odlinks/includes/fonts/arial.ttf"); $oVisualCaptcha=new _odl_captcha($aFonts); $captcha=rand(1, 50).".png"; $oVisualCaptcha->create(ABSPATH."wp-content/plugins/odlinks/includes/Smarty/cache/".$captcha); $confirm='Confirm: ConfirmCode'; $confirm .= ''; $tpl->assign('confirm',$confirm); } $tpl->assign('error',''.$msg.''); $tpl->assign('yourname',$yourname); $tpl->assign('mailfrom',$mailfrom); $tpl->assign('mailto',$mailto); $tpl->assign('fname',$fname); } else { odlinksdisplay_index($msg); } if ($odlinkssettings[odlinksshow_credits] == 'y') { $credit='Open Directory Links Powered By 4gani Version '.$odlinksversion; $tpl->assign('odl_credit_line', $credit); } list($gAd, $top, $btn)=get_odl_GADlink(); if ($gAd) { $code='
'.$gAd.'
'; $tpl->assign('googletop',$top); $tpl->assign('googlebtn',$btn); $tpl->assign('googleAd',$code); } odlinks_footer($tpl); $tpl->display('sendurl.tpl'); } # EMAIL ROUTINE function _odl_send_email($mailto, $mailsubject, $mailtext, $from) { global $lang; $email_status=array(); $email=wp_mail($mailto, $mailsubject, $mailtext, $from); if ($email == false) { $email_status[0]=false; $email_status[1]="The email could not be sent!"; } else { $email_status[0]=true; $email_status[1]="The email sent successfully!"; } return $email_status; } # NOTIFICATION EMAILS function _odl_email_notifications($url, $title, $description, $email, $category){ global $lang, $PHP_SELF; $odlinkssettings=get_option('odlinksdata'); $out=''; $eol="\r\n"; # notify admin? $msg=''; $msg.= sprintf(__('New Post, '.date("j-M-Y, l").' and is waiting for your Approval on your site %s:'), get_option('blogname')).$eol; $msg.= " Please visit the admin panel"; $msg .= $eol."WebSite: ".$url; $msg .= $eol."Title: ".$title; $msg .= $eol."Description: ".$description; $msg .= $eol."Email: ".$email; $msg .= $eol."Category: ".$category.$eol; # admin message $url = admin_url("admin.php?page=odlinks&odlinks_admin_page_arg=odlinksposts&odlinks_admin_action=approvelinks"); $msg .= $eol."Approve or delete it: ".$url.$eol; //$msg.= $lang['_FROM'].': '.$subject.$eol; $adminStruct=get_userdata($ADMINID); $email_status=_odl_send_email(get_option('admin_email'), get_bloginfo('name').': '.'A new (ODL)post is waiting for your Approval', $msg, ''); return $email_status; } ?>