Send this post to your ContentDragon.com account as a draft.

'; } } add_action('admin_menu', array('Article_Directory_Private', 'register')); class Article_Directory_Private { var $auth_code; function menu() { global $wpdb; $auth_code = get_option("condrag_auth_code"); if ($auth_code == '') { $success = false; $error = $awb_user = $awb_pass = ""; $site = get_option("siteurl"); if (isset($_POST['signup'])) { $awb_user = $_POST['awb_user']; $awb_pass = $_POST['awb_pass']; if ($awb_user == '') $error = 'You forgot to include your ContentDragon.com username!'; else if ($awb_pass == '') $error = 'You forgot to include your ContentDragon.com password!'; else { $htmllink = "http://www.contentdragon.com/article_directory_api.php?resource=addblog&site=$site&user=$awb_user&pass=$awb_pass"; $send = file_get_contents($htmllink); preg_match_all("/(.*?)<\/error>/i", $send, $error); $error = $error[1][0]; if ($error == '') { $success = true; $auth_code = $send; // if reinstall, clear previous settings deactivate_article_directory(); // add new settings if ($article_page_id == "") condrag_insert_contentpost("Article Directory", "-- DO NOT REMOVE THIS PAGE --", ""); add_option("contentdragon_uname", $awb_user); add_option("condrag_auth_code", $auth_code); $message = htmlentities('

{author_firstname},

Are you tired of wasting hours submitting articles manually? Syndicate "{article_title}" now to over 1000 article directories. No need to retype your article. Just click here to Syndicate

What do you get?
Your article submitted to 1000 general and niche directories.
Your article will be submitted to all relevant article directories listed here
With Content Dragons unique system we can rapidly distribute your article to niche specific websites. Giving you laser precision as well as permanent advertisements. With our system you will have full control over your articles from our members control panel. You will be able to edit, update and remove an article instantly. Learn more about our system.........

'); add_option("condrag_syndication_message", $message); $page_id = get_option("article_page_id"); $htmllink = "http://www.contentdragon.com/article_directory_api.php?resource=updateblog&user=$awb_user&auth_code=$auth_code&page_id=$page_id"; $send = file_get_contents($htmllink); } } } echo '
'; if ($success) { include(dirname(__FILE__)."/install.php"); foreach ($sql_commands['tables'] as $table=>$sql){ mysql_query($sql); } foreach ($sql_commands['data'] as $table=>$sql) { if (mysql_num_rows(mysql_query("SELECT * FROM `$table`;"))==0) mysql_query($sql); } echo '

Wordpress Blog Successfully Added!

'; echo "

You have successfully registered your WordPress blog as an article directory to your ContentDragon.com account \"$awb_user\"!

Setting up your Article Directory

Before you can start to recieving or displaying syndicated articles from ContentDragon.com you must choose the article categories that you would like assigned to your article directory.

Choose Article Directory Categories Now

"; } else { if ($_GET['fix']==1) { mysql_query("DROP TABLE `condrag_articles`;"); mysql_query("CREATE TABLE IF NOT EXISTS `condrag_articles` ( `article_id` int(12) NOT NULL auto_increment, `article_state` int(11) NOT NULL default '0', `article_featured_state` int(11) NOT NULL default '0', `article_submitterid` int(12) NOT NULL default '1', `article_categoryid` int(12) NOT NULL default '0', `article_typeid` int(11) NOT NULL, `article_title` varchar(255) NOT NULL default '', `article_urltitle` varchar(255) NOT NULL default '', `article_summary` text NOT NULL, `article_keywords` text NOT NULL, `article_custom_fields` text NOT NULL, `article_text` text NOT NULL, `article_authorinfo` text NOT NULL, `article_submitteddate` datetime NOT NULL default '0000-00-00 00:00:00', `article_modifydate` datetime NOT NULL default '0000-00-00 00:00:00', `article_viewcount` int(12) NOT NULL default '0', `article_clicks` text NOT NULL, `author_firstname` varchar(255) NOT NULL, `author_lastname` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `code` varchar(60) NOT NULL, `enabled` char(1) NOT NULL default '1', PRIMARY KEY (`article_id`), UNIQUE KEY `article_urltitle` (`article_urltitle`,`article_categoryid`), KEY `article_state` (`article_state`,`article_categoryid`), FULLTEXT KEY `article_title` (`article_title`,`article_text`,`article_keywords`) ) ENGINE=MyISAM;"); } if ($error != '') echo '

'.$error.'

'; echo '

Add Wordpress Blog

To start using your article directory you need to add your Wordpress Blog to your ContentDragon.com account using the form below.

If you do not have a ContentDragon.com account yet, click here to create one now.

Blog URL '.$site.'
This associates your ContentDragon.com account with your blog.
Username
This is your ContentDragon.com username.
Password
This is your ContentDragon.com password.

Forget your ContentDragon.com password? Click here.
 
'; } echo '
'; } else { $query = mysql_query("SELECT `article_id` FROM `condrag_articles` WHERE `article_state`='1';"); $approved = (int)mysql_num_rows($query); $query = mysql_query("SELECT `do_approve` FROM `condrag_article_approval_requests` WHERE `do_approve`='1';"); $rapprove = (int)mysql_num_rows($query); $total = $approved+$rapprove; echo '
'; echo '

Article Directory (v'.CONDRAG_VERSION.') '.condrag_version_check().'

'; echo '

( Article Directory Powered by: ContentDragon.com )



» Article Directory Contains '.$total.' Total Articles, '.$rapprove.' Require Approval & '.$approved.' Are Live.

Article Approval Queue ('.$rapprove.')

Approve or deny articles submitted to your article directory.

Article Directory Settings

Choose the categories you want to display in your article directory

 

ContentDragon.com Account

Your ContentDragin.com account summary.

ContentDragon.com Projects

Check out the available projects listed on ContentDragon.com

 

Syndication Message

Personalise the syndicate your article page displayed when a user submits an article.


'; flush(); $htmllink = "http://www.contentdragon.com/article_directory_api.php?resource=announcements"; $announcements = file_get_contents($htmllink); echo $announcements; echo '
'; } } function approve() { global $wpdb; $do = $_GET['do']; $article_id = $_GET['article_id']; $status_msg = ''; if ($_POST['delete'] != "" && is_numeric($article_id)) { $row = mysql_fetch_assoc(mysql_query("SELECT * FROM `condrag_articles` WHERE `article_id`='$article_id';")); mysql_query("DELETE FROM `condrag_articles` WHERE `article_id`='$article_id';"); mysql_query("DELETE FROM `condrag_article_approval_requests` WHERE `article_id`='$article_id';"); $success = true; $do = $article_id = ""; $status_msg = "DELETED ARTICLE!"; } else if ($_POST['deny'] != "" && is_numeric($article_id)) { $deny_reason = $_POST['deny_reason']; mysql_query("UPDATE `condrag_article_approval_requests` SET `deny_reason`='$deny_reason', `do_approve`='0' WHERE `article_id`='$article_id';") or die(mysql_error()); $success = true; $do = $article_id = ""; $status_msg = "ARTICLE DENIED!"; } else if ($_POST['approve'] != "" && is_numeric($article_id)) { $row = mysql_fetch_assoc(mysql_query("SELECT * FROM `condrag_articles` WHERE `article_id`='$article_id';")); mysql_query("UPDATE `condrag_articles` SET `article_state`='1' WHERE `article_id`='$article_id';"); mysql_query("UPDATE `condrag_article_approval_requests` SET `approved`='1', `do_approve`='0' WHERE `article_id`='$article_id';"); $success = true; $do = $article_id = ""; $status_msg = "ARTICLE APPROVED!"; } echo '
'; if ($do == 'view') { $membersQuery = mysql_query("SELECT * FROM condrag_articles WHERE article_id='$article_id'"); $articles = mysql_fetch_assoc ( $membersQuery ); extract($articles); $article_title = condrag_utf8encode($article_title); $article_text = condrag_utf8encode($article_text); $article_text = html_entity_decode($article_text, ENT_QUOTES); $article_text = stripslashes($article_text); $article_text = stripslashes($article_text); $text = strip_tags($article_text); $front = substr($text, 0, 500); $end = substr($text, 500, strpos(substr($text, 500), ".")+1)." ..."; $text = $front.$end; $word_count = str_word_count(strip_tags(strtolower($article_text))); if (!eregi("
", $article_text) && !eregi("
", $article_text)) $article_text = str_replace("\n\n", "

", $article_text); $by = "By: $author_firstname $author_lastname <$email>"; $about = "

About the author:
$article_authorinfo

Article Word Count: $word_count

"; $article_body = "

".$by."

" . "

{$article_text}

" . $about; $deny_reason = ''; $query = mysql_query("SELECT * FROM `condrag_article_approval_requests` WHERE `article_id`='$article_id';"); if (mysql_num_rows($query)>0) { $row = mysql_fetch_assoc($query); $deny_reason = $row['deny_reason']; } $template = file_get_contents(dirname(__FILE__)."/approve-action.tpl"); $data = array ( 'title' => $article_title, 'body' => $article_body, 'deny_reason' => $deny_reason ); echo '

Article Approval Queue » '.$article_title.'

'; } else { $rows = ''; $topQuery = mysql_query ("SELECT * FROM condrag_article_approval_requests WHERE do_approve='1'"); while ( $row = mysql_fetch_assoc ( $topQuery ) ){ $aid = $row['article_id']; $membersQuery = mysql_query ("SELECT * FROM condrag_articles WHERE article_id='$aid'"); while ( $articles = mysql_fetch_assoc( $membersQuery ) ) { $article_title = condrag_utf8encode($articles['title']); $catinfo = condrag_is_category($articles['article_categoryid']); $category_title = $catinfo['category_title']; if ($catinfo['category_parentid'] != 0) { $subcatinfo = condrag_is_category($catinfo['category_parentid']); $category_title = $subcatinfo['category_title']; } $rows .= ' '.$articles['article_title'].' '.$category_title.' '.date("m/d/y", strtotime($articles['article_submitteddate'])).' view options... '; } } $template = file_get_contents(dirname(__FILE__)."/approve-list.tpl"); $data = array ('rows' => $rows); echo '

Article Directory » Article Approval Queue

'; if ($status_msg!='') echo '

'.$status_msg.'

'; } foreach ($data as $k=>$v) $template = str_replace('{'.$k.'}', $v, $template); echo $template; echo '
'; } function settings() { global $wpdb; echo '
'; echo "

Article Directory » Article Directory Settings

"; echo "

Category Selection

Check off the categories that you would like displayed.

"; if( $_POST['action'] == 'save' ) { foreach ($_POST['cats_def'] as $id=>$val) { $s = (isset($_POST['cats'][$id]))?1:0; mysql_query("UPDATE `condrag_categories` SET `active`='{$s}' WHERE `category_id`='$id';"); mysql_query("UPDATE `condrag_articles` SET `enabled`='$s' WHERE `article_categoryid`='$id';"); } $query = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='0' AND `active`='1' ORDER BY `category_title` ASC;"); while ($row = mysql_fetch_assoc($query)) { $query2 = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='{$row['category_id']}' ORDER BY `category_title` ASC;"); $count1 = mysql_num_rows($query2); $query2 = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='{$row['category_id']}' AND `active`='0' ORDER BY `category_title` ASC;"); $count2 = mysql_num_rows($query2); if ($count1==$count2) { mysql_query("UPDATE `condrag_categories` SET `active`='1' WHERE `category_parentid`='{$row['category_id']}';"); mysql_query("UPDATE `condrag_articles` SET `enabled`='1' WHERE `article_categoryid`='{$row['category_id']}';"); } } $query = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='0' AND `active`='0' ORDER BY `category_title` ASC;"); while ($row = mysql_fetch_assoc($query)) { mysql_query("UPDATE `condrag_categories` SET `active`='0' WHERE `category_parentid`='{$row['category_id']}';"); mysql_query("UPDATE `condrag_articles` SET `enabled`='0' WHERE `article_categoryid`='{$row['category_id']}';"); $query2 = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='{$row['category_id']}' ORDER BY `category_title` ASC;"); while ($row2 = mysql_fetch_assoc($query2)) { mysql_query("UPDATE `condrag_categories` SET `active`='0' WHERE `category_parentid`='{$row2['category_id']}';"); mysql_query("UPDATE `condrag_articles` SET `enabled`='0' WHERE `article_categoryid`='{$row2['category_id']}';"); } } $cat_ids = array(); $cat_data = array(); $query = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='0' AND `active`='1' ORDER BY `category_title` ASC;"); while ($row = mysql_fetch_assoc($query)) { $cat_ids[$row['category_id']] = $row['category_title']; $query2 = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='{$row['category_id']}' AND `active`='1' ORDER BY `category_title` ASC;"); if (mysql_num_rows($query2)>0) { $input = $row['category_title'].'[**]'; while ($row2 = mysql_fetch_assoc($query2)) { $cat_ids[$row2['category_id']] = $row2['category_title']; $cat_ids[$row2['category_id'].'topid'] = $row['category_id']; $input .= $row2['category_title'].'||'; } $input = substr($input, 0, -2); $cat_data[] = $input; } else { $cat_data[] = $row['category_title']; } } $cat_data = implode("[*]", $cat_data); $htmllink = "http://www.contentdragon.com/article_directory_api.php?resource=savecategories&auth_code=".get_option('condrag_auth_code')."&categories=".base64_encode($cat_data); $send = file_get_contents($htmllink); echo '

Settings saved.

'; } echo ' '; echo '
'; $sql = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='' ORDER BY `category_title` ASC;"); while ($row = mysql_fetch_array($sql)) { $checked = $row['active']==1?' checked':NULL; echo '
'; echo '
'; echo ' '; echo '
'; $sql2 = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='{$row['category_id']}' ORDER BY `category_title` ASC;"); if (mysql_num_rows($sql2)>0) { echo '
'; while ($row2 = mysql_fetch_array($sql2)) { $checked = $row2['active']==1?' checked':NULL; echo '
'; } echo '
'; echo '
'; } echo '
'; } echo '

'; } function syndication_page() { global $wpdb; echo '
'; echo "

Article Directory » Article Syndication Message

"; echo "

Messages

Customize your syndication message displayed to authors publishing articles.

Keywords
• \"{article_title}\" = Title of the article being published
• \"{author_firstname}\" = The publishing authors first name
• \"{author_lastname}\" = The publishing authors last name
• \"{email}\" = The publishing authors email address
• \"javascript:document.forms.synd_form.submit();\" = Link used to submit the syndicate form

"; $message = get_option("condrag_syndication_message"); if ($_POST['action'] == "message") { $message = $_POST['message']; update_option("condrag_syndication_message", $message); } $theme_name = get_current_theme(); echo '

'; echo '
'; } function account() { $htmllink = "http://www.contentdragon.com/article_directory_api.php?resource=account&auth_code=" .get_option("condrag_auth_code")."&user=".get_option("contentdragon_uname"); $contents = condrag_nolines(condrag_get_contents($htmllink, 0, NULL)); $contents = unserialize($contents); echo '
'; echo '

Article Directory » ContentDragon.com Account

'; echo '

My ContentDragon.com Account Summary

Account Balances

Balance $'.number_format($contents['balance'], 2, '.', ',').'
 
Credit Balance $'.number_format($contents['creditbalance'], 2, '.', ',').'
 
Syndication Cost $'.number_format($contents['synd_amount'], 2, '.', ',').'
 
Earned Per Sale $'.number_format($contents['synd_earn'], 2, '.', ',').'

Recent Transactions
'; $rows = $contents['transactions']; if (count($rows)==0) { echo ''; } else { foreach ($rows as $row) { echo ''; } } echo '
Amount Date Description
no transaction history available
'.$row[1].' '.$row[2].' '.$row[4].'


Glossary of terms:
Syndication Cost = Retail Price that Content Dragon Charges for a syndicated article
Earned Per Sale = Commisson Earned per Syndicated Article that comes from your Site!
'; /* echo '
 

Sign In

Username
Password
  Keep me signed in on this computer unless I sign out
 
   
  I\'ve forgotten my login details
'; */ echo '
'; } function projects() { $htmllink = "http://www.contentdragon.com/article_directory_api.php?resource=projects"; $contents = condrag_nolines(condrag_get_contents($htmllink, 0, NULL)); echo '
'; echo '

Article Directory » ContentDragon.com Projects



'; echo $contents; echo '
'; } function register() { add_menu_page("Article Directory", "Articles", 8, __FILE__, array('Article_Directory_Private', 'menu')); $auth_code = get_option("condrag_auth_code"); if ($auth_code != '') { add_submenu_page(__FILE__, 'Approve Articles', 'Approve Articles', 8, 'sub_approve', array('Article_Directory_Private', 'approve')); add_submenu_page(__FILE__, 'Content Dragon Settings', 'Settings', 8, 'sub_settings', array('Article_Directory_Private', 'settings')); add_submenu_page(__FILE__, 'Content Dragon Syndication', 'Syndication Message', 8, 'sub_syndication', array('Article_Directory_Private', 'syndication_page')); add_submenu_page(__FILE__, 'Content Dragon Account', 'Account', 8, 'sub_account', array('Article_Directory_Private', 'account')); add_submenu_page(__FILE__, 'View Content Dragon Projects', 'Projects', 8, 'sub_projects', array('Article_Directory_Private', 'projects')); } } } /** Widgets ********************************************************************************** **********************************************************************************/ add_action("widgets_init", array('Article_Directory_Widgets', 'register')); class Article_Directory_Widgets { function control() { echo 'no options available.'; } function sidebar_articles($args) { global $wpdb; extract($args); echo $before_widget; echo $before_title . 'Recently Submitted Articles' . $after_title; $query = mysql_query("SELECT * FROM `condrag_articles` WHERE `article_state`='1' AND `enabled`='1' ORDER BY `article_submitteddate` DESC LIMIT 10;"); if (mysql_num_rows($query)>0) { echo ''; } $perma = get_option("permalink_structure"); echo ''; echo $after_widget; } function sidebar_categories($args) { extract($args); echo $before_widget; echo $before_title . 'Article Categories' . $after_title; $catid = (int)$_GET['catid']; $subcatid = (int)$_GET['subcatid']; $icon = "\"\""; if ($catid > 0) { $catinfo = condrag_is_category($catid); echo '
'.$icon.' '.$catinfo['category_title'].'
'; } $cats = condrag_category_display($catid); if (is_array($cats['rows'])) { echo ''; } echo $after_widget; } function register() { if (get_option("condrag_auth_code") == '') return; register_sidebar_widget('Article Categories', array('Article_Directory_Widgets', 'sidebar_categories')); register_sidebar_widget('Recent Articles', array('Article_Directory_Widgets', 'sidebar_articles')); register_widget_control('Article Directory', array('Article_Directory_Widgets', 'control')); } } /** Browse / Syndication / Submit ********************************************************************************** **********************************************************************************/ add_action("init", array('Article_Directory_Public', 'register')); add_action('wp_head', array('Article_Directory_Public', 'head')); class Article_Directory_Public { var $auth_code; var $article_page_id; function head() { if ( defined( 'WP_PLUGIN_URL' ) ) { echo '' . "\n"; } else { echo '' . "\n"; } } function category_select($article_categoryid) { global $wpdb; $sql = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='' AND `active`='1' ORDER BY `category_title` ASC;"); $html = ""; return($html); } function type_select($article_typeid) { global $wpdb; $sql = mysql_query("SELECT * FROM `condrag_article_type` ORDER BY `title` ASC;"); $html = ""; return($html); } function submit() { global $wpdb; $showform = true; if ( isset($_GET['verify']) && isset($_GET['id']) && is_numeric($_GET['id'])) { $code = $_GET['verify']; $id = $_GET['id']; $query = mysql_query("SELECT * FROM `condrag_articles` WHERE `code`='$code' AND `article_id`='$id';"); if (mysql_num_rows($query)>0) { $showform = false; mysql_query("UPDATE `condrag_articles` SET `article_state`='0' WHERE `article_id`='$id';"); mysql_query("UPDATE `condrag_article_approval_requests` SET `do_approve`='1' WHERE `article_id`='$id';"); $out = '
'; $out .= '

E-mail address successfully verified

Thank you for verifying your email, your article will now viewed by the administrator and will decide if your article should be approved shortly, you will receieve an email if they do approve your article.

'; $out .= '
'; } } if ($showform) { $step = 1; $success_display = $error_display = ""; if ( isset ( $_POST['submit_article'] ) ) { $obj = condrag_manage_article_listing(0); $error_display = $obj['error_display']; $article_id = $obj['article_id']; $code = $obj['code']; } if (is_bool($error_display) && $error_display === true) { $step = 2; $error_display = ""; unset($error_display); if ( isset ( $_POST['save_article'] ) ) $success_display = "Your article has been successfully submitted."; else if ( isset ( $_POST['submit_article'] ) ) $success_display = "You have successfully submitted your article and it is now up for approval."; if ($success_display != '') { @mysql_close(); $web = 'http://'.$_SERVER['HTTP_HOST'].'/'.condrag_get_artlink(); if (ereg('page_id=', $web)) $web .= '&'; else $web .= '?'; $web .= 'display=submit&code='.$code.'&id='.$article_id; echo ''; //header("Location: ".condrag_get_artlink()."&display=submit&id=".$article_id.'&code='.$code); exit; } } else { $success_display = ""; } $show_form = true; if ($_GET['id']!=''&&$_GET['code']!=''&&is_numeric($_GET['id'])) { $show_form = false; $article_id = $_GET['id']; $blogname = get_bloginfo('name'); $contentdragon_uname = get_bloginfo('contentdragon_uname'); $artinfo = condrag_is_article($article_id); //echo "
{$artinfo['code']}
{$_GET['code']}
"; $code = $_GET['code']; if (substr($code,-1)=='/')$code = substr($code, 0, -1); if ($artinfo['code'] != $code) $show_form = true; else { $template = file_get_contents(dirname(__FILE__)."/submit-public-syndicate.tpl"); $type_row = mysql_fetch_assoc(mysql_query("SELECT * FROM `condrag_article_type` WHERE `id`='{$artinfo['article_typeid']}';")); $type = $type_row['title']; $catinfo = condrag_is_category($artinfo['article_categoryid']); $cat = $catinfo['category_title']; if ($catinfo['category_parentid'] != 0) { $subcatinfo = condrag_is_category($catinfo['category_parentid']); $subcat = $cat; $cat = $subcatinfo['category_title']; } else { $subcat = ""; } $condrag_syndication_message = stripslashes(html_entity_decode(get_option("condrag_syndication_message"), ENT_QUOTES)); $condrag_syndication_message = str_replace( array('{article_title}', '{author_firstname}', '{author_lastname}', '{email}'), array($artinfo['article_title'], $artinfo['author_firstname'], $artinfo['author_lastname'], $artinfo['email']), $condrag_syndication_message ); $htmllink = "http://www.contentdragon.com/article_directory_api.php?resource=synd_price"; $synd_price = condrag_nolines(condrag_get_contents($htmllink, 0, NULL)); $synd_price = '$'.number_format($synd_price, 2, '.', ','); $data = array ( 'success.msg' => $success_display, 'error.msg' => $error_display, 'blogname' => $blogname, 'auth_code' => get_option("condrag_auth_code"), 'contentdragon_uname' => $contentdragon_uname, 'article_summary' => base64_encode(addslashes($artinfo['article_summary'])), 'article_keywords' => base64_encode(addslashes($artinfo['article_keywords'])), 'article_title2' => base64_encode(addslashes($artinfo['article_title'])), 'article_title' => $artinfo['article_title'], 'article_authorinfo' => base64_encode(addslashes($artinfo['article_authorinfo'])), 'article_text' => base64_encode(addslashes($artinfo['article_text'])), 'author_firstname' => addslashes($artinfo['author_firstname']), 'author_lastname' => addslashes($artinfo['author_lastname']), 'email' => addslashes($artinfo['email']), 'type' => $type, 'synd.price' => $synd_price, 'condrag_syndication_message' => $condrag_syndication_message, 'article_category' => $cat, 'article_subcategory' => $subcat, 'code'=>$artinfo['code'], 'article_id' => $article_id, ); foreach ($data as $k=>$v) $template = str_replace('{'.$k.'}', $v, $template); $out = '
'; $out .= $template; $out .= '
'; } } if ($show_form) { if ($success_display != '') $success_display = '
'.$success_display.'
'; if ($error_display != '') $error_display = '
'.$error_display.'
'; if ($type == "private") $file = "submit"; else $file = "submit-public"; $template = file_get_contents(dirname(__FILE__)."/{$file}.tpl"); $data = array ( 'success.msg' => $success_display, 'error.msg' => $error_display, 'auth_code' => get_option('condrag_auth_code'), 'categories' => condrag_display_article_categories ( (($_GET['catid']!='')?$_GET['catid']:$_POST['article_categoryid']) ), 'type' => condrag_display_article_types ( $_POST['article_typeid'] ), 'author.firstname' => stripslashes($_POST['author_firstname']), 'author.lastname' => stripslashes($_POST['author_lastname']), 'email' => stripslashes($_POST['email']), 'd.article_title' => stripslashes($_POST['article_title']), 'd.article_keywords' => stripslashes($_POST['article_keywords']), 'd.article_summary' => stripslashes($_POST['article_summary']), 'd.article_text' => stripslashes($_POST['article_text']), 'd.article_authorinfo' => stripslashes($_POST['article_authorinfo']), 'action.value' => (($_GET['article_id']=="")?"create":"edit"), 'd.article_id' => $_GET['article_id'] ); foreach ($data as $k=>$v) $template = str_replace('{'.$k.'}', $v, $template); $out = '
'; $out .= '

'.(($type=='private')?'Article Directory » ':NULL).'Submit Article Form

'; $out .= $template; $out .= '
'; } } if ($type=="private")echo $out; else return($out); } function browse($text) { global $wpdb; $level = "top"; $pagename = $categoryname = $subcategoryname = $rss_feed_url = ""; $category_parentid = 0; $pagenumber = ($_GET['pagenumber']!=''&&is_numeric($_GET['pagenumber']))?$_GET['pagenumber']:1; $base_url = condrag_get_artlink(); $stl = $base_url; $submit_link = $base_url; $perma = get_option("permalink_structure"); $article_page_id = get_option("article_page_id"); $navigation = "
» Article Directory"; $level = "top"; if ($perma == '') { //if ($_GET['page_id']==$article_page_id) $valid = true; $catid = $_GET['catid']; $subcatid = $_GET['subcatid']; $artid = $_GET['artid']; $display = $_GET['display']; if ($catid != '' && is_numeric($catid)) { $stl .= "&catid=$catid"; $level = "category"; $catinfo = condrag_is_category($catid); if ($subcatid != '' && is_numeric($subcatid)) { $stl .= "&subcatid=$subcatid"; $level = "subcategory"; $submit_link .= "&catid=$subcatid"; $subcatinfo = condrag_is_category($subcatid); } else { $submit_link .= "&catid=$catid"; } if ($artid != '' && is_numeric($artid)) { $artinfo = condrag_is_article($artid); $stl .= "&artid=$artid"; $level = "display"; } } } else { $dir = getenv("REQUEST_URI"); $dir = split("/", $dir); //$p = get_page($article_page_id); $pages = array(); foreach ($dir as $d) { if ($d == "") continue; $pages[] = $d; } $last_page = $pages[count($pages)-1]; if (substr($last_page, 0, 4) == "page") { $pagenumber = (int)substr($last_page, 5); if ($pagenumber <= 0) $pagenumber = 1; $last_page = $pages[count($pages)-2]; } if ($last_page == "top" || $last_page == "sub" || $last_page == "display" || $last_page == "publish") { $thecatid = 0; if ($last_page == "top" || $last_page == "sub" || $last_page == "display" || $last_page == "publish") { $tp = $pages[1]; $level = "category"; $query = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_urltitle`='$tp';"); $catinfo = mysql_fetch_assoc($query); $catid = $thecatid = $catinfo['category_id']; if ($last_page == "top") $submit_link .= "?catid={$catinfo['category_id']}"; $stl .= $tp.'/'; } if ($last_page == "sub" || $last_page == "display" || $last_page == "publish") { $tp = $pages[2]; $level = "subcategory"; $query = mysql_query("SELECT * FROM `condrag_categories` WHERE `category_parentid`='$catid' AND `category_urltitle`='$tp';"); $subcatinfo = mysql_fetch_assoc($query); $subcatid = $thecatid = $subcatinfo['category_id']; if ($last_page == "sub") $submit_link .= "?catid={$subcatinfo['category_id']}"; $stl .= $tp.'/'; } if ($last_page == "display" || $last_page == "publish") { $tp = $pages[3]; $level = "display"; $query = mysql_query("SELECT * FROM `condrag_articles` WHERE `article_categoryid`='$thecatid' AND `article_urltitle`='$tp';"); $artinfo = mysql_fetch_assoc($query); $artid = $artinfo['article_id']; $stl .= $tp.'/'; if ($last_page == "publish") { $display = "publish"; $last_page = "display"; } } $stl .= $last_page.'/'; } } $artinfo['article_title'] = stripslashes(stripslashes($artinfo['article_title'])); $submit_link .= (($perma==''||strpos($submit_link,'?catid')>0)?"&display=submit":"?display=submit"); if ($level == "top") { } else if ($level == "category") { $category_parentid = $catinfo['category_id']; $categoryname = $catinfo['category_title']; $pagename = "{$catinfo['category_title']} Articles"; $navigation .= " » {$catinfo['category_title']}"; $meta_description = "Search {$catinfo['category_title']} Articles and News from ContentDragon.com {$catinfo['category_title']} writers grow their exposure by submitting quality original articles to our article directory"; $meta_keywords = "{$catinfo['category_title']}, {$catinfo['category_title']} articles, {$catinfo['category_title']} article directory, {$catinfo['category_title']} content, {$catinfo['category_title']} freelance writer, {$catinfo['category_title']} writer, {$catinfo['category_title']} publisher, {$catinfo['category_title']} article publisher"; } else if ($level == "subcategory") { $categoryname = $catinfo['category_title']; $subcategoryname = $subcatinfo['category_title']; $category_parentid = $subcatinfo['category_id']; $pagename = "{$subcatinfo['category_title']} Articles"; if ($perma == '') { $navigation .= " » {$catinfo['category_title']}"; } else { $navigation .= " » {$catinfo['category_title']}"; } $navigation .= " » {$subcatinfo['category_title']}"; $meta_description = "Search {$subcatinfo['category_title']} Articles and News from ContentDragon.com {$subcatinfo['category_title']} writers grow their exposure by submitting quality original articles to our article directory"; $meta_keywords = "{$subcatinfo['category_title']}, {$subcatinfo['category_title']} articles, {$subcatinfo['category_title']} article directory, {$subcatinfo['category_title']} content, {$subcatinfo['category_title']} freelance writer, {$subcatinfo['category_title']} writer, {$subcatinfo['category_title']} publisher, {$subcatinfo['category_title']} article publisher"; } else if ($level == "display") { $article_id = $artinfo['article_id']; $categoryname = $catinfo['category_title']; if ($subcatid != '' && is_numeric($subcatid)) { $subcategoryname = $subcatinfo['category_title']; $category_parentid = $subcatinfo['category_id']; $pagename = condrag_utf8encode($artinfo['article_title'])." in {$subcatinfo['category_title']} Articles"; if ($perma == '') { $navigation .= " » {$catinfo['category_title']}"; $navigation .= " » {$subcatinfo['category_title']}"; } else { $navigation .= " » {$catinfo['category_title']}"; $navigation .= " » {$subcatinfo['category_title']}"; } } else { $pagename = condrag_utf8encode($artinfo['article_title'])." in {$catinfo['category_title']} Articles";// on Page $pagenumber for articles"; if ($perma == '') { $navigation .= " » {$catinfo['category_title']}"; } else { $navigation .= " » {$catinfo['category_title']}"; } } if ($display == "publish") { if ($perma == '') { $navigation .= " » ".condrag_utf8encode($artinfo['article_title']).""; } else { $navigation .= " » ".condrag_utf8encode($artinfo['article_title']).""; } $display = "publish"; } } $page = $cat_list = ''; $subcatids = array($category_parentid); if ($level == "top" || $level == "category") { $cats = condrag_category_display($category_parentid); if (is_array($cats['rows'])) { foreach ($cats['rows'] as $cat) { $subcatids[] = $cat[2]; $value = "\"\" " . "{$cat[1]}"; $cat_list .= "
$value
\n"; } } } if (count($subcatids)>0) $subcatids = "AND (`article_categoryid`='".implode("' OR `article_categoryid`='", $subcatids)."')"; else $subcatids = ''; if ($level != "display") $text = 'Submit an article to this category'; else $text = 'Submit an article'; $navigation .= " » $text"; $limit = 30; $sort = "`article_id` DESC"; if ($level == "category" || $level == "subcategory") $where = "WHERE `article_state`='1' $subcatids"; //AND `article_categoryid`='$category_parentid' else if ($level == "display") $where = "WHERE `article_state`='1' AND `article_id`='$article_id'"; else if ($level == "search") $where = "WHERE `article_state`='1' AND $searchquery"; else $where = "WHERE `article_state`='1'"; $olstart = (int)($pagenumber == 1)?1:($pagenumber*$limit-$limit); $page_menu = $page_stat = ""; $sql = "SELECT * FROM `condrag_articles` $where AND `enabled`='1' ORDER BY $sort"; if ($level != "display" && $level != "top") { $pageCount = mysql_num_rows(mysql_query($sql)); if ($pageCount == 0) $offset = 0; else { $pagenumber2 = ceil($pageCount / $limit); $pagenumber = max($pagenumber, 1); $pagenumber = min($pagenumber, $pagenumber2); $offset = ($pagenumber - 1) * $limit; } $sql .= " LIMIT $offset, $limit;"; $query = mysql_query($sql); $count = mysql_num_rows($query); if ($count == 0){ $count1 = 0; $count2 = 0; }else{ $count2 = ($count+$offset); if ($pagenumber == 1){ $count1=0; }else{ $count1 = $offset; } } if ($pagenumber < $pagenumber2 && $pagenumber != $pagenumber2){ $q = $pagenumber+1; if ($perma == '') $u = $stl."&page=$q"; else $u = $stl."page-$q/"; $next = " Next ›"; } if ($pagenumber <= $pagenumber2 && $pagenumber != 1){ $w = $pagenumber-1; if ($perma == '') $u = $stl."&page=$w"; else $u = $stl."page-$w/"; $prev = "‹ Prev "; } $pages = ""; for ($i=0;$i<$pagenumber2;$i++){ $z = $i+1; if ($perma == '') $u = $stl."&page=$z"; else $u = $stl."page-$z/"; if ($pagenumber == $z){ $pages .= "Page ".$z." "; }else{ $pages .= "Page $z "; } } $first = $last = ""; if ($pagenumber > 1) $first = "« First "; if ($pagenumber < $pagenumber2) $last = " Last »"; if ($pagenumber2 == "") $pagenumber2 = 1; $catnames = $categoryname.(($subcategoryname != "")?", $subcategoryname":"")." "; $page_stat = "Displaying $count1-$count2 of $pageCount total {$catnames} related articles" . " on page $pagenumber of $pagenumber2"; $page_menu = "
{$first}{$prev}{$pages}{$next}{$last}
"; } else { $sql .= " LIMIT 30;"; $query = mysql_query($sql); } $rows = ""; $i=$olstart-1; $reset=0; $article_count = mysql_num_rows(mysql_query("SELECT * FROM `condrag_articles` WHERE `enabled`='1' LIMIT 1;")); while ($row = mysql_fetch_assoc($query)) { $i++; $reset++; extract($row); $article_title = condrag_utf8encode($article_title); $article_title = stripslashes(stripslashes($article_title)); $article_text = condrag_utf8encode($article_text); $article_text = html_entity_decode($article_text, ENT_QUOTES); $article_authorinfo = stripslashes($article_authorinfo); if (!preg_match("/<.*?>/i", $article_text)) { $article_text = nl2br($article_text); } $article_text = stripslashes($article_text); $article_authorinfo = stripslashes($article_authorinfo); /* $reg = "/(http|ftp)+(s)?:(\/\/)((\w|\.)+)(\/)?(\S+)?/i"; preg_match($reg, $article_authorinfo, $authurl); if ($authurl[0] != '') { $article_authorinfo = str_replace($authurl[0], ''.$authurl[0].'', $article_authorinfo); } */ $article_text = stripslashes(stripslashes($article_text)); $article_summary = stripslashes(stripslashes($article_summary)); $article_authorinfo = stripslashes($article_authorinfo); //$article_text = utf8_encode($article_text); $text = strip_tags($article_text); $front = substr($text, 0, 500); $end = substr($text, 500, strpos(substr($text, 500), ".")+1)." ..."; $text = $front.$end; preg_match_all("/((.*?)<\/a>)/i", $article_authorinfo, $urls); if (count($urls[0])>0) { for ($ii=0; $ii'.$href.'', $article_authorinfo); } else if (!preg_match("/target=[\'\"]_blank[\"\']/i", $all)) { $article_authorinfo = str_replace($all, str_replace("href=", "target=\"_blank\" rel=\"NOFOLLOW\" href=", $all), $article_authorinfo); } } } $catinfo = is_category($article_categoryid); if ($catinfo['category_parentid'] != 0) { $subcatinfo = is_category($catinfo['category_parentid']); } $url = condrag_get_artlink($article_id); if ($level == "top") $rows .= "
"; else if ($level != "display") $rows .= "
$article_title
$text

"; else { $full_article_url = str_replace('//', '/', "http://".$_SERVER['HTTP_HOST'].'/'.$url); $full_author_url = $full_article_url; $stumble_url = urlencode("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); if ($display != "print") { if ($perma == '') { $puburl = $stl .= '&display=publish'; } else { $puburl = str_replace('/display/', '/publish/', $stl); } $article_options_panel = "
" . "" . "\"Stumble Stumble It!" . " " . "" . "\"Print Print It!" . " " . "" . "\"Ezine Ezine Publisher" . " " . "" . "\"Add Add to favorites" . " " . "" . "\"Submit Submit an Article"; } if ($memberinfo!='') { $memberinfo = explode(":",$memberinfo); $by = $memberinfo[1]; $article_source_html = "Article Source:
\n" . "Author - {$memberinfo[0]}
\n" . "Location - $full_article_url"; $article_source_plain = "Article Source:\n" . "Author - {$memberinfo[0]} [ http://members.contentdragon.com/community/space/".$memberinfo[1]."/ ]\n" . "Location - $full_article_url"; } else { $by = "$author_firstname $author_lastname"; $article_source_html = "Article Source:
\n" . "Author - $author_firstname $author_lastname
\n" . "Location - $full_article_url"; $article_source_plain = "Article Source:\n" . "Author - $author_firstname $author_lastname \n" . "Location - $full_article_url"; } $word_count = str_word_count(strip_tags(strtolower($article_text))); if ($display == "publish") { $rows = "
$article_title
" . "

You have permission to publish this article electronically or in print, free of charge, as long as you leave the article title, author name, body and resource box in tact (means NO changes) with the links made active and you agree to our posted publisher terms of service.

Use the tools below to copy the article in plain text form, or you can copy it as HTML, ready to copy and paste directly into a web page.

"; if ($article_summary != "") $rows .= "

Article Summary

"; if (!eregi("
", $article_text) || !eregi("
", $article_text)) $source = strip_tags(str_replace("

", "\n\n", $article_text)); else $source = strip_tags(str_replace("
", "\n", str_replace("
", "\n", $article_text))); $rows .= "

Plain Text Version

" . "

HTML Version

"; if ($article_keywords != "") $rows .= "

Article Keywords
" . "

"; $rows .= "

Article URL
" . "

" . "

About the author:
$article_authorinfo

" . "

Article Word Count: $word_count

"; } else { if (!eregi("
", $article_text) && !eregi("
", $article_text)) $article_text = str_replace("\n\n", "

", $article_text); $rows = "
$article_title
" . (($article_modifydate!='0000-00-00 00:00:00')?"
Last modified on: ".$article_modifydate."
":NULL) . '
'.$article_options_panel.'
'; $rows .= "

By: $author_firstname $author_lastname

" . "

{$article_text}

" . "

About the author:
$article_authorinfo

" . "

Article Word Count: $word_count

"; } } } $page = '
'.$navigation.'
'.$cat_list.'
'; if ($article_count == 0) $page .= '
This article directory does not have any published articles.
Check back soon or Submit Your Own!
'; else { if ($level == "top" || $level == "display") $page .= $rows; else { if ($display != "print") $page .= '
'.$page_stat.'
'; $page .= $rows.$page_menu; } } $page .= '
'; // for print this article link if ($level == "display") $page = $page."\n\n\n".''; // Quick fix for encoding. if (function_exists("iconv")) $page = iconv("UTF-8","UTF-8//IGNORE",$page); //dirname(__FILE__)."/page.php" $stylesheet_url = 'http://'.$_SERVER['HTTP_HOST'].'/'.substr(dirname(__FILE__), strpos(dirname(__FILE__), 'wp-content')).'/style.css'; $page = '' . $page . '
Article Directory - Powered by Content Dragon
'; return $page; } function wp_title($text) { $title = " - Article Directory"; $perma = get_option("permalink_structure"); $article_page_id = get_option("article_page_id"); if ($perma == '') { if ($_GET['artid']!='') { $artinfo = condrag_is_article($_GET['artid']); $_title = stripslashes(stripslashes($artinfo['article_title'])); $title = ' - '.$_title.$title; } } else { $dir = getenv("REQUEST_URI"); $dir = split("/", $dir); //$p = get_page($article_page_id); $pages = array(); foreach ($dir as $d) { if ($d == "") continue; $pages[] = $d; } $last_page = $pages[count($pages)-1]; if ($last_page == "display") { $tp = $pages[3]; $level = "display"; $query = mysql_query("SELECT * FROM `condrag_articles` WHERE `article_urltitle`='$tp';"); $artinfo = mysql_fetch_assoc($query); $_title = stripslashes(stripslashes($artinfo['article_title'])); $title = ' - '.$_title.$title; } } return($title); } function replace_title($text) { //echo $text; return($text); } function limit_1_post($limit) { return 'LIMIT 1'; } function replace_template() { //include(dirname(__FILE__)."/page.php"); include(TEMPLATEPATH . "/page.php"); exit; } function posts_where($where) { $article_page_id = get_option("article_page_id"); $where = "AND (wp_posts.ID = '".$article_page_id."') AND wp_posts.post_type = 'page'"; return($where); } function register() { $auth_code = get_option("condrag_auth_code"); if ($auth_code == '') return; /* Process Syndication from ContentDragon.com * Only allow if the proper auth code is sent. *****************************************************************/ if ($_GET['syndication_update']==1&&$auth_code==$_POST['auth_code']) { condrag_syndication(); // this will be accessed by a script, no need to waste bandwidth so we kill the page // before it can send any output to the browser. mysql_close(); exit(); } /* Serve up the page *****************************************************************/ $valid = false; $perma = get_option("permalink_structure"); $article_page_id = get_option("article_page_id"); if ($perma == '') { if ($_GET['page_id']==$article_page_id) $valid = true; } else { $p = get_page($article_page_id); $dir = getenv("REQUEST_URI"); $dir = split("/", $dir); $pages = array(); foreach ($dir as $d) { if ($d == "") continue; if (preg_match('/[\?]/i', $d)) $d = substr($d, 0, strpos($d, '?')); $pages[] = $d; } //if (strpos($pages[0],$p->post_name)!=-1){ $valid = true; } if (in_array($p->post_name, $pages)){ $valid = true; } } if ($valid) { //query_posts('p='.$article_page_id); add_filter('posts_where', array('Article_Directory_Public', 'posts_where')); if ($_GET['display']=='submit') add_filter('the_content', array('Article_Directory_Public', 'submit')); else add_filter('the_content', array('Article_Directory_Public', 'browse')); add_filter('post_limits', array('Article_Directory_Public', 'limit_1_post')); add_filter('the_title', array('Article_Directory_Public', 'replace_title')); add_filter('wp_title', array('Article_Directory_Public', 'wp_title')); add_action('template_redirect', array('Article_Directory_Public', 'replace_template')); } } } ?>