Add Article
Article Details
Article Title:
Article Image:
User Details
Authors Name:
Authors ID:
Actions:
ErrorCould not upload image ".$_FILES['add_file']['name']." Please make sure you have permission to upload to images/articles (CHMOD 777)"; break; } } else { $file_url = $_FILES['add_file']['name']; } //----------------------------------------------------------------- // Take care of a few things //----------------------------------------------------------------- $add_name = jcm_linebreaks(trim(jcm_stripslashes($add_name))); $add_author_name = jcm_linebreaks(trim(jcm_stripslashes($add_author_name))); $add_author_id = jcm_linebreaks(trim(jcm_stripslashes($add_author_id))); $sendmessage = jcm_linebreaks(trim(jcm_stripslashes($sendmessage))); //----------------------------------------------------------------- // Write in DB //----------------------------------------------------------------- $cKy['article_name'] = $add_name; $cKy['article_url'] = "images/articles/$file_url"; $cKy['author_id'] = $add_author_id; $cKy['author_name'] = $add_author_name; $cKy['description'] = $sendmessage; $db->insertRow("articles",$cKy); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/articles&i=article_added"); break; //----------------------------------------------------------------- // Confirm Delete Form //----------------------------------------------------------------- case 3: //----------------------------------------------------------------- // Restrict guests/users/moderators //----------------------------------------------------------------- if(isset($is_guest) || isset($is_user) || isset($is_moderator)) header("location: $PHP_SELF?i=2"); //----------------------------------------------------------------- // Get the Generator information //----------------------------------------------------------------- $Generator = $db->getLine("SELECT * FROM articles",$d); //----------------------------------------------------------------- // View Delete Form //----------------------------------------------------------------- ?>
Delete article ?
Are you sure you want to delete '' ?
'">
getLine("SELECT * FROM articles",$d); @unlink($article['article_url']); //----------------------------------------------------------------- // Delete from DB //----------------------------------------------------------------- $db->deleteRow("articles","id = '$d'"); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/articles&i=article_deleted"); break; //----------------------------------------------------------------- // View Edit article Form //----------------------------------------------------------------- case 5: //----------------------------------------------------------------- // Restrict guests/users/moderators //----------------------------------------------------------------- if(isset($is_guest) || isset($is_user) || isset($is_moderator)) header("location: $PHP_SELF?i=2"); //----------------------------------------------------------------- // Get The article //----------------------------------------------------------------- $article = $db->getLine("SELECT * FROM articles",$d); //----------------------------------------------------------------- // Start the Form //----------------------------------------------------------------- ?>
' enctype='multipart/form-data'>
Edit Article
File Details
Article Title: '>
Rename Image: '>
User Details
Authors Name: '>
Authors ID: '>
Actions:
getLine("SELECT * FROM articles",$d); //----------------------------------------------------------------- // Do Rename //----------------------------------------------------------------- @rename("{$article['article_url']}", "$add_file"); //----------------------------------------------------------------- // Take care of a few things //----------------------------------------------------------------- $add_name = jcm_linebreaks(trim(jcm_stripslashes($add_name))); $add_author_name = jcm_linebreaks(trim(jcm_stripslashes($add_author_name))); $add_author_id = jcm_linebreaks(trim(jcm_stripslashes($add_author_id))); $sendmessage = jcm_linebreaks(trim(jcm_stripslashes($sendmessage))); //----------------------------------------------------------------- // Write in DB //----------------------------------------------------------------- $cKy['article_name'] = $add_name; $cKy['article_url'] = $add_file; $cKy['author_id'] = $add_author_id; $cKy['author_name'] = $add_author_name; $cKy['description'] = $sendmessage; $db->updateRow("articles",$cKy,"id = '$d'"); //----------------------------------------------------------------- // Redirect when finished //----------------------------------------------------------------- header("location: $PHP_SELF?n=modules/articles&i=article_edited"); break; //----------------------------------------------------------------- // Do count //----------------------------------------------------------------- case 7: //----------------------------------------------------------------- // Get The article count and update it //----------------------------------------------------------------- $article = $db->getLine("SELECT * FROM articles",$d); $cKy['hit_count'] = $article['hit_count'] + 1; $db->updateRow("articles",$cKy,"id = '$d'"); $find_jpg = strpos($article['article_url'], ".jpg"); $find_gif = strpos($article['article_url'], ".gif"); $find_png = strpos($article['article_url'], ".png"); if($find_jpg || $find_gif || $find_png){ $article_image = ""; } else { $article_image = ""; } //----------------------------------------------------------------- // Redirect to file //----------------------------------------------------------------- ?>
Reads

getInfo_countRows("articles"); $lastpage = ceil($numrows/$rows_per_page); $p = (int)$p; if ($p < 1) $p = 1; elseif ($p > $lastpage) $p = $lastpage; $limit = 'LIMIT ' .($p - 1) * $rows_per_page .',' .$rows_per_page; //----------------------------------------------------------------- // Get table //----------------------------------------------------------------- $articles_nav = $db->getTable("SELECT * FROM articles ORDER BY id $limit"); //----------------------------------------------------------------- // Start foreach //----------------------------------------------------------------- if($articles_nav != FALSE) { foreach($articles_nav as $idx=>$article) { //----------------------------------------------------------------- // Does Author have URL or ID //----------------------------------------------------------------- if($article['author_id'] == "") $id_not = "{$article['author_name']}"; elseif(is_numeric($article['author_id'])) $id_not = "{$article['author_name']}"; else $id_not = "{$article['author_name']}"; //----------------------------------------------------------------- // Count for ID //----------------------------------------------------------------- $idx_count = $idx + (($p - 1) * $rows_per_page + 1); //----------------------------------------------------------------- // Show admin delete/edit buttons //----------------------------------------------------------------- if(isset($is_administrator) || isset($is_webmaster)) $_delete_button = "Edit| Delete"; else $_delete_button = NULL; //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- if($id_not){ $show_author = " by " . $id_not; } else { $show_author = ""; } $layout .= "
{$article['article_name']}$show_author {$article['hit_count']} Reads
$_delete_button
"; //----------------------------------------------------------------- // Start from 1 //----------------------------------------------------------------- $idx++; } } else { //----------------------------------------------------------------- // Reset to 0 //----------------------------------------------------------------- $idx = 0; //----------------------------------------------------------------- // Make Layout //----------------------------------------------------------------- $layout .= "No articles."; } //----------------------------------------------------------------- // Navigation Code //----------------------------------------------------------------- if ($p == 1) $nav_prev = " "; else { $prevpage = $p-1; $nav_prev = "« Previous"; } $nav_nr = '[ '.paginate($lastpage, $p, $PHP_SELF.$script_location).' ]'; if($idx == $numrows) $nav_nr = NULL; if ($p == $lastpage) $nav_next = " "; else { $nextcode = $numrows - $idx * $p; if($nextcode > $idx) $how_next = $idx; else $how_next = $nextcode; $nextpage = $p+1; $nav_next = "Next $how_next »"; } if($idx == $numrows) { $nav_head = "class='con1'"; $nav = NULL; } else { $nav_head = "class='head'"; $nav = ''.$nav_prev.''.$nav_next.''; } //----------------------------------------------------------------- // Make Structure //----------------------------------------------------------------- echo "
Articles"; if(isset($is_administrator) || isset($is_webmaster)) { echo " [ Add article ]"; } echo "

"; echo" $layout
Article List
"; ?>
>
Showing articles from a total of