This MOD is for creating Articles (typed text that can be News, Opinions, Articles, Blogs, etc) and Categories for them that are SEPARATE from the Image Categories.
What it does - It allows you to create Article categories to be displayed on the front page, and from there, create/write articles (or news, etc). The thumbnails of images are not used. Rather, the first piece of the Article, AKA the "snippet", is used as a thumbnail. It's stand-alone, so it does not interfere with the Image Categories and images. It does use comments that operate just like the Image comments. Editing, creation, deleting... all of it works just like the Image and regular categories.
Important - This MOD is not a full release yet. As the title of the thread says, it is a W.I.P. (Work In Progress). Feed back is needed, as I am requesting that you experts out there can look over the script(s) and see if there is any streamlining/clean-up that can be done. It
IS fully functional as it currently is.
I also request that someone can make this Searchable.
WARNING!!!This MOD modifies your database,
so make a back-up first!!!Let's get started -I repeat: This MOD modifies your database,
so make a back-up first!!!STEP 1Unzip the attached zip file. Upload all files to your 4images ROOT directory, maintaining the folder structure.
STEP 2This file modifies your database,
so make a back-up first!!! Once articles_install.php is uploaded to the ROOT directory, point your browser to it and run the script. Again, this file modifies your database,
so make a back-up first!!!STEP 3Create these two folders in ROOT/data/
articles (CHMOD it to 777)
tmp_articles (CHMOD it to 777)
STEP 4Open admin/admin_functions.php
Find:
?>Add ABOVE:
include(ROOT_PATH.'admin/article_admin_functions.php');STEP 5Open admin/home.php
Find:
$total_images = 0;
$total_categories = 0;
foreach ($cat_cache as $val) {
$total_categories++;
if (isset($val['num_images'])) {
$total_images += $val['num_images'];
}
}Add BELOW:
// Begin Article Mod
$total_articles = 0;
$total_article_categories = 0;
foreach ($article_cat_cache as $val) {
$total_article_categories++;
if (isset($val['num_articles'])) {
$total_articles += $val['num_articles'];
}
}
// End Article ModSTEP 6Still in admin/home.php
Find:
//1
echo "<tr class=\"".get_row_bg()."\">\n";
echo "<td width=\"16%\"><b>".$lang['categories']."</b></td><td width=\"16%\">".$total_categories."</td>\n";
$size = 0;
echo "<td width=\"16%\"><b>".$lang['media_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(MEDIA_PATH))."</td>\n";
echo "</tr>";
//2
echo "<tr class=\"".get_row_bg()."\">\n";
$sql = "SELECT COUNT(*) as temp_images
FROM ".IMAGES_TEMP_TABLE;
$row = $site_db->query_firstrow($sql);
$awaiting_validation = preg_replace("/".$site_template->start."num_images".$site_template->end."/siU", $row['temp_images'], $lang['images_awaiting_validation']);
$awaiting_validation = sprintf("<a href=\"".$site_sess->url("validateimages.php?action=validateimages")."\">%s</a>", $awaiting_validation);
echo "<td width=\"16%\"><b>".$lang['images']."</b></td><td width=\"16%\">".$total_images." / ".$awaiting_validation."</td>\n";
$size = 0;
echo "<td width=\"16%\"><b>".$lang['thumb_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(THUMB_PATH))."</td>\n";
echo "</tr>";
//3
echo "<tr class=\"".get_row_bg()."\">\n";REPLACE WITH:
//1
echo "<tr class=\"".get_row_bg()."\">\n";
echo "<td width=\"16%\"><b>Image ".$lang['categories']."</b></td><td width=\"16%\">".$total_categories."</td>\n";
$size = 0;
echo "<td width=\"16%\"><b>Article ".$lang['categories']."</b></td><td width=\"16%\">".$total_article_categories."</td>\n";
echo "</tr>";
//2
echo "<tr class=\"".get_row_bg()."\">\n";
$sql = "SELECT COUNT(*) as temp_images
FROM ".IMAGES_TEMP_TABLE;
$row = $site_db->query_firstrow($sql);
$awaiting_validation = preg_replace("/".$site_template->start."num_images".$site_template->end."/siU", $row['temp_images'], $lang['images_awaiting_validation']);
$awaiting_validation = sprintf("<a href=\"".$site_sess->url("validateimages.php?action=validateimages")."\">%s</a>", $awaiting_validation);
echo "<td width=\"16%\"><b>".$lang['images']."</b></td><td width=\"16%\">".$total_images." / ".$awaiting_validation."</td>\n";
$size = 0;
$sql = "SELECT COUNT(*) as temp_articles
FROM ".ARTICLE_TEMP_TABLE;
$rowart = $site_db->query_firstrow($sql);
$awaiting_validationart = preg_replace("/".$site_template->start."num_articles".$site_template->end."/siU", $rowart['temp_articles'], $lang['articles_awaiting_validation']);
$awaiting_validationart = sprintf("<a href=\"".$site_sess->url("validatearticles.php?action=validatearticles")."\">%s</a>", $awaiting_validationart);
echo "<td width=\"16%\"><b>Articles</b></td><td width=\"16%\">".$total_articles." / ".$awaiting_validationart."</td>\n";
echo "</tr>";
//3
echo "<tr class=\"".get_row_bg()."\">\n";
echo "<td width=\"16%\"><b>".$lang['media_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(MEDIA_PATH))."</td>\n";
$size = 0;
echo "<td width=\"16%\"><b>".$lang['thumb_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(THUMB_PATH))."</td>\n";
echo "</tr>";
//4
echo "<tr class=\"".get_row_bg()."\">\n";
STEP 7Open admin/index.php
Find:
show_nav_option($lang['nav_categories_add'], "categories.php?action=addcat");Add BELOW:
// Begin Article Mod
show_nav_header($lang['nav_artcategories_main']);
show_nav_option($lang['nav_artcategories_edit'], "article_categories.php?action=modifycats");
show_nav_option($lang['nav_artcategories_add'], "article_categories.php?action=addcat");
// End Article ModSTEP 8Still in admin/index.php
Find:
show_nav_option($lang['nav_images_resizer'], "resizer.php?action=selectoptions");Add BELOW:
// Begin Article Mod
show_nav_header($lang['nav_articles_main']);
show_nav_option($lang['nav_articles_edit'], "articles.php?action=modifyarticles");
show_nav_option($lang['nav_articles_add'], "articles.php?action=addarticles");
show_nav_option($lang['nav_articles_validate'], "validatearticles.php?action=validatearticles");
// End Article ModSTEP 9Still in admin/index.php
Find:
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");Add BELOW:
show_nav_option($lang['nav_article_comments_edit'], "article_comments.php?action=modifycomments");STEP 10Still in admin/index.php
Find:
show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");Add BELOW:
show_nav_option($lang['nav_article_stats'], "article_stats.php?action=resetstats");STEP 11Open admin/settings.php
Find:
function show_cat_sort_select($setting_name, $setting_value) {
global $cat_sort_optionlist;
echo "<select name=\"setting_item[".$setting_name."]\">";
foreach ( $cat_sort_optionlist as $k => $v ) {
echo "<option value=\"".$k."\"";
if ($setting_value == $k) {
echo " selected=\"selected\"";
}
echo ">".$v."</option>\n";
}
echo "</select>\n";
}Add BELOW:
// Begin Article Mod
function show_article_cat_order_select($setting_name, $setting_value) {
global $article_cat_order_optionlist;
echo "<select name=\"setting_item[".$setting_name."]\">";
foreach ( $article_cat_order_optionlist as $k => $v ) {
echo "<option value=\"".$k."\"";
if ($setting_value == $k) {
echo " selected=\"selected\"";
}
echo ">".$v."</option>\n";
}
echo "</select>\n";
}
function show_article_cat_sort_select($setting_name, $setting_value) {
global $article_cat_sort_optionlist;
echo "<select name=\"setting_item[".$setting_name."]\">";
foreach ( $article_cat_sort_optionlist as $k => $v ) {
echo "<option value=\"".$k."\"";
if ($setting_value == $k) {
echo " selected=\"selected\"";
}
echo ">".$v."</option>\n";
}
echo "</select>\n";
}
// End Article ModSTEP 12Still in admin/settings.php
Find:
function show_image_sort_select($setting_name, $setting_value) {
global $image_sort_optionlist;
echo "<select name=\"setting_item[".$setting_name."]\">";
foreach ($image_sort_optionlist as $key => $val) {
echo "<option value=\"$key\"";
if ($setting_value == $key) {
echo " selected=\"selected\"";
}
echo ">".$val."</option>";
}
echo "</select>";
}Add BELOW:
// Begin Article Mod
function show_article_order_select($setting_name, $setting_value) {
global $article_order_optionlist;
echo "<select name=\"setting_item[".$setting_name."]\">";
foreach ($article_order_optionlist as $key => $val) {
echo "<option value=\"$key\"";
if ($setting_value == $key) {
echo " selected=\"selected\"";
}
echo ">".$val."</option>";
}
echo "</select>";
}
function show_article_sort_select($setting_name, $setting_value) {
global $article_sort_optionlist;
echo "<select name=\"setting_item[".$setting_name."]\">";
foreach ($article_sort_optionlist as $key => $val) {
echo "<option value=\"$key\"";
if ($setting_value == $key) {
echo " selected=\"selected\"";
}
echo ">".$val."</option>";
}
echo "</select>";
}
// End Article ModSTEP 13Still in admin/settings.php
Find:
show_setting_row("num_subcats");Add BELOW:
// Begin Article Mod
show_table_separator($setting_group[8], 2, "setting_group_8");
show_setting_row("article_cat_order", "show_article_cat_order_select");
show_setting_row("article_cat_sort", "show_article_cat_sort_select");
show_setting_row("article_cat_cells");
show_setting_row("article_cat_table_width");
show_setting_row("article_cat_table_cellspacing");
show_setting_row("article_cat_table_cellpadding");
show_setting_row("num_artsubcats");
// End Article ModSTEP 14Still in admin/settings.php
Find:
show_setting_row("image_table_cellpadding");Add BELOW:
// Begin Article Mod
show_table_separator($setting_group[9], 2, "setting_group_9");
show_setting_row("article_order", "show_article_order_select");
show_setting_row("article_sort", "show_article_sort_select");
show_setting_row("article_new_cutoff");
show_setting_row("article_cells");
show_setting_row("default_article_rows");
show_setting_row("custom_article_row_steps");
show_setting_row("article_table_width");
show_setting_row("article_table_cellspacing");
show_setting_row("article_table_cellpadding");
// End Article ModSTEP 15Still in admin/settings.php
Find:
show_setting_row("upload_emails");Add BELOW:
show_setting_row("article_add_notify", "radio");
show_setting_row("article_emails");STEP 16Still in admin/settings.php
Find:
show_setting_row("user_delete_comments", "radio");Add BELOW:
show_setting_row("user_edit_article", "radio");
show_setting_row("user_delete_article", "radio");
show_setting_row("user_edit_article_comments", "radio");
show_setting_row("user_delete_article_comments", "radio");STEP 17Open includes/auth.php
Find:
?>Add ABOVE:
include(ROOT_PATH.'includes/article_auth.php');STEP 18Open includes/contants.php
Find:
define('WORDMATCH_TABLE', $table_prefix.'wordmatch');Add BELOW:
// Begin Articles Mod
define('ARTICLECATS_TABLE', $table_prefix.'articlecats');
define('ARTICLE_TABLE', $table_prefix.'article');
define('ARTICLE_TEMP_TABLE', $table_prefix.'article_temp');
define('COMMENTS_ARTICLE_TABLE', $table_prefix.'comments_article');
// End Articles ModSTEP 19Still in includes/contants.php
Find:
define('URL_ID', 'id');Add BELOW:
// Begin Articles Mod
define('URL_ARTICLE_ID', 'article_id');
define('URL_ARTICLECAT_ID', 'cat_id');
define('URL_COMMENT_ARTICLE_ID', 'comment_article_id');
// End Articles ModSTEP 20Still in includes/contants.php
Find:
define('TEMPLATE_DIR', 'templates');Add BELOW:
// Begin Articles Mod
define('ARTCAT_DIR', 'data/articles');
define('ARTCAT_TEMP_DIR', 'data/tmp_articles');
// End Articles ModSTEP 21Open includes/functions.php
Find:
?>Add ABOVE:
include(ROOT_PATH.'includes/article_functions.php');STEP 22Open includes/page_header.php
Find:
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];Add BELOW:
// Begin Article Mod
$total_articles = 0;
$total_article_categories = 0;
foreach ($article_cat_cache as $val) {
$total_article_categories++;
if (isset($val['num_articles'])) {
$total_articles += $val['num_articles'];
}
}
// End Article ModSTEP 23Still in includes/page_header.php
Find:
"page_top" => false,Add BELOW:
// Begin Article Mod
"page_article_categories" => false,
"page_article" => false,
// End Article ModSTEP 24Still in includes/page_header.php
Find:
"top" => false,Add BELOW:
// Begin Article Mod
"article_categories" => false,
"article" => false
// End Article ModSTEP 25Still in includes/page_header.php
Find:
"rss_url" => "",Add ABOVE:
// Begin Article Mod
"url_article" => $site_sess->url(ROOT_PATH."article.php"),
"url_article_categories" => $site_sess->url(ROOT_PATH."article_categories.php"),
"url_addarticle" => (!empty($url_addarticle)) ? $site_sess->url($url_addarticle) : $site_sess->url(ROOT_PATH."article_editing.php?action=addarticleform"),
"article_nails" => "",
"total_article_categories" => $total_article_categories,
"total_articles" => $total_articles,
// End Article ModSTEP 26Still in includes/page_header.php
Find:
"direction" => $lang['direction'],Add BELOW:
// Begin Article Mod
"lang_image_stats" => $lang['image_stats'],
"lang_article_stats" => $lang['article_stats'],
"lang_new_articles" => $lang['new_articles'],
"lang_top_articles" => $lang['top_articles'],
"lang_articles_per_page" => $lang['articles_per_page'],
"lang_home" => $lang['home'],
"lang_articles" => $lang['articles'],
"lang_article_categories" => $lang['article_categories'],
"lang_article_site_stats" => $lang['article_site_stats'],
// End Article ModSTEP 27Still in includes/page_header.php
Find:
unset($category_dropdown_form);Add BELOW:
// Begin Article Mod
if (!$cache_enable) {
$article_category_dropdown_selfjump = get_article_category_dropdown($cat_id, 1);
} else {
$cache_id = create_cache_id(
'article_data.dropdown_selfjump',
array(
$user_info[$user_table_fields['user_id']],
$config['template_dir'],
$config['language_dir']
)
);
if (!$article_category_dropdown_selfjump = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
$old_session_mode = $site_sess->mode;
$site_sess->mode = 'get';
// Set $cat_id to 0 to ensure that no category is selected
$article_category_dropdown_selfjump = get_article_category_dropdown(0, 1);
$site_sess->mode = $old_session_mode;
save_cache_file($cache_id, $article_category_dropdown_selfjump);
}
}
$site_template->register_vars("article_category_dropdown_selfjump", $article_category_dropdown_selfjump);
unset($article_category_dropdown_selfjump);
// -------------------------------------
if (!$cache_enable) {
$article_category_dropdown_form = $site_template->parse_template("article_category_dropdown_form");
} else {
$cache_id = create_cache_id(
'article_data.dropdown_form',
array(
$user_info[$user_table_fields['user_id']],
// $cat_id, // uncomment if the current category should be selected, will increase the number of cache files
$config['template_dir'],
$config['language_dir']
)
);
if (!$article_category_dropdown_form = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
$old_session_mode = $site_sess->mode;
$site_sess->mode = 'get';
$article_category_dropdown_form = $site_template->parse_template("article_category_dropdown_form");
$site_sess->mode = $old_session_mode;
save_cache_file($cache_id, $article_category_dropdown_form);
}
}
$site_template->register_vars("article_category_dropdown_form", $article_category_dropdown_form);
unset($article_category_dropdown_form);
// End Article ModSTEP 28Still in includes/page_header.php
Find:
$msg = $lang['voting_error'];
}
}Add BELOW:
if ($action == "ratearticle" && $id) {
$rating = intval($HTTP_POST_VARS['rating']);
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? explode(" ", stripslashes((string)$HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
if ($rating && $rating <= MAX_RATING && $id) {
if (!isset($session_info['rated_arts'])) {
$session_info['rated_arts'] = $site_sess->get_session_var("rated_arts");
}
$split_list = array();
if (!empty($session_info['rated_arts'])) {
$split_list = explode(" ", $session_info['rated_arts']);
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_arts'] .= " ".$id;
$session_info['rated_arts'] = trim($session_info['rated_arts']);
$site_sess->set_session_var("rated_arts", $session_info['rated_arts']);
$cookie_rated[] = $id;
$cookie_expire = time() + 60 * 60 * 24 * 4;
setcookie($cookie_name.'rated', implode(" ", $cookie_rated), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
update_article_rating($id, $rating);
$msg = $lang['voting_success'];
}
else {
$msg = $lang['already_voted'];
}
}
else {
$msg = $lang['voting_error'];
}
}STEP 29Open global.php
Find:
$auth_cat_sql = array();Add BELOW:
// Begin Articles Mod
$article_cat_cache = array();
$article_cat_parent_cache = array();
$new_article_cache = array();
$additional_article_fields = array();
$auth_art_cat_sql = array();
// End Articles ModSTEP 30Still in global.php
Find:
$cache_page_rss = 1;Add BELOW:
// Begin Articles Mod
$cache_page_articlecats = 1;
// End Articles ModSTEP 31Still in global.php
Find:
$captcha_filter_bg = 1;Add BELOW:
// Begin Articles Mod
$captcha_enable_addarticle = 1;
// End Articles ModSTEP 32Still in global.php
Find:
$cache_page_rss = 0;Add BELOW:
// Begin Articles Mod
$cache_page_articlecats = 0;
// End Articles ModSTEP 33Still in global.php
Find:
$captcha_enable_postcards = 0;Add BELOW:
// Begin Articles Mod
$captcha_enable_addarticle = 0;
// End Articles ModSTEP 34Still in global.php
Find:
else {
$search_new_images = 0;
}Add BELOW:
// Begin Articles Mod
if (isset($HTTP_GET_VARS[URL_ARTICLECAT_ID]) || isset($HTTP_POST_VARS[URL_ARTICLECAT_ID])) {
$cat_id = (isset($HTTP_POST_VARS[URL_ARTICLECAT_ID])) ? intval($HTTP_POST_VARS[URL_ARTICLECAT_ID]) : intval($HTTP_GET_VARS[URL_ARTICLECAT_ID]);
}
else {
$cat_id = 0;
}
if (isset($HTTP_GET_VARS[URL_ARTICLE_ID]) || isset($HTTP_POST_VARS[URL_ARTICLE_ID])) {
$article_id = (isset($HTTP_POST_VARS[URL_ARTICLE_ID])) ? intval($HTTP_POST_VARS[URL_ARTICLE_ID]) : intval($HTTP_GET_VARS[URL_ARTICLE_ID]);
}
else {
$article_id = 0;
}
// End Articles ModSTEP 35Still in global.php
Find:
$self_url .= "?".URL_CAT_ID."=".$cat_id;
}Add BELOW:
// Begin Articles Mod
elseif (preg_match("/article.php/", $self_url) && !preg_match("/[?|&]".URL_ARTICLE_ID."=[^?|&]*/", $self_url) && $article_id) {
$self_url .= "?".URL_ARTICLE_ID."=".$article_id;
}
elseif (preg_match("/article_categories.php/", $self_url) && !preg_match("/[?|&]".URL_ARTICLECAT_ID."=[^?|&]*/", $self_url)) {
$self_url .= "?".URL_ARTICLECAT_ID."=".$cat_id;
}
// End Articles ModSTEP 36Still in global.php
Find:
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");Add BELOW:
// Begin Articles Mod
define('ARTCAT_PATH', ROOT_PATH.ARTCAT_DIR);
define('ARTCAT_TEMP_PATH', ROOT_PATH.ARTCAT_TEMP_DIR);
// End Articles ModSTEP 37Still in global.php
Find:
$new_cutoff = time() - (60 * 60 * 24 * $config['new_cutoff']);Add BELOW:
// Begin Articles Mod
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewarticle, auth_addarticle, auth_directaddarticle, auth_vote, auth_readcomment, auth_postcomment
FROM ".ARTICLECATS_TABLE."
ORDER BY cat_order, cat_name ASC";
$result = $site_db->query($sql);
while ($article_row = $site_db->fetch_array($result)) {
$article_cat_cache[$article_row['cat_id']] = $article_row;
$article_cat_parent_cache[$article_row['cat_parent_id']][] = $article_row['cat_id'];
}
$site_db->free_result();
// End Articles ModSTEP 38Still in global.php
Find:
} //end if GET_CACHESAdd ABOVE:
// Begin Articles Mod
$sql = "SELECT cat_id, COUNT(article_id) AS new_articles
FROM ".ARTICLE_TABLE."
WHERE article_active = 1 AND article_date >= $new_cutoff
GROUP BY cat_id";
$result = $site_db->query($sql);
while ($article_row = $site_db->fetch_array($result)) {
$new_article_cache[$article_row['cat_id']] = $article_row['new_articles'];
}
$site_db->free_result();
//--------------------------------------
$sql = "SELECT cat_id, COUNT(*) AS num_articles
FROM ".ARTICLE_TABLE."
WHERE article_active = 1
GROUP BY cat_id";
$result = $site_db->query($sql);
while ($article_row = $site_db->fetch_array($result)) {
$article_cat_cache[$article_row['cat_id']]['num_articles'] = $article_row['num_articles'];
}
$site_db->free_result();
// End Articles ModSTEP 39Open index.php
Find:
$templates_used = 'home,category_bit,Add AFTER:
article_category_bit,article_nail_bit,STEP 40Still in index.php
Find:
$user_access = get_permission();REPLACE WITH:
$user_access = get_permission() && get_permissions();STEP 41Still in index.php
Find:
unset($new_images);Add BELOW:
//-----------------------------------------------------
//--- Show Article Categories ---------------------------------
//-----------------------------------------------------
$article_categories = get_article_categories(0);
if (!$article_categories) {
$article_categories = $lang['no_categories'];
}
$site_template->register_vars("article_categories", $article_categories);
unset($article_categories);
//-----------------------------------------------------
//--- Show New Articles ---------------------------------
//-----------------------------------------------------
$arttable_width = ceil(intval($config['article_table_width']) / $config['article_cells']);
if ((substr($config['article_table_width'], -1)) == "%") {
$arttable_width .= "%";
}
$additional_artsql = "";
if (!empty($additional_article_fields)) {
foreach ($additional_article_fields as $key => $val) {
$additional_artsql .= ", a.".$key;
}
}
$num_new_articles = $config['article_cells'];
$sql = "SELECT a.article_id, a.cat_id, a.user_id, a.article_title, a.snippet, a.article_words, a.article_date, a.article_active, a.article_allow_comments, a.article_comments, a.article_votes, a.article_rating, a.article_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".ARTICLE_TABLE." a, ".ARTICLECATS_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = a.user_id)
WHERE a.article_active = 1 AND c.cat_id = a.cat_id AND a.cat_id NOT IN (".get_auth_art_cat_sql("auth_viewcat", "NOTIN").")
ORDER BY a.article_date DESC
LIMIT $num_new_articles";
$result = $site_db->query($sql);
$article_num_rows = $site_db->get_numrows($result);
if (!$article_num_rows) {
$new_articles = "<table width=\"".$config['article_table_width']."\" border=\"0\" cellpadding=\"".$config['article_table_cellpadding']."\" cellspacing=\"".$config['article_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$new_articles .= $lang['no_new_articles'];
$new_articles .= "</td></tr></table>";
}
else {
$new_articles = "<table width=\"".$config['article_table_width']."\" border=\"0\" cellpadding=\"".$config['article_table_cellpadding']."\" cellspacing=\"".$config['article_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($article_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$new_articles .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$new_articles .= "<td width=\"".$arttable_width."\" valign=\"top\">\n";
show_article($article_row);
$new_articles .= $site_template->parse_template("article_nail_bit");
$new_articles .= "\n</td>\n";
$count++;
if ($count == $config['article_cells']) {
$new_articles .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['article_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$new_articles .= "<td width=\"".$arttable_width."\">\n \n</td>\n";
}
$new_articles .= "</tr>\n";
}
}
$new_articles .= "</table>\n";
} // end else
$site_template->register_vars("new_articles", $new_articles);
unset($new_articles);STEP 42Open lang/(your language)/admin.php (sorry, no translations!)
Find:
$lang['file_not_found'] = "File not found";Add BELOW:
// Begin Articles Mod
$lang['article'] = "Article";
$lang['articles'] = "Articles";
$lang['delete_article_confirm'] = "Do you want to delete this article? All attached comments will be deleted as well.";
$lang['article_delete_success'] = "Article deleted";
$lang['article_delete_error'] = "Error deleting article";
$lang['article_perms'] = "Permission Masks";
$lang['articles_delete_success'] = "Articles deleted";
$lang['show_only_topic'] = "Show Only in Topic";
$lang['show_front_page'] = "Show on Front Page";
$lang['nav_artcategories_main'] = "Article Categories";
$lang['nav_artcategories_edit'] = "Edit Article categories";
$lang['nav_artcategories_add'] = "Add Article categories";
$lang['articles_awaiting_validation'] = "<b>{num_articles}</b> articles awaiting validation";
$lang['nav_articles_main'] = "Articles";
$lang['nav_articles_edit'] = "Edit Articles";
$lang['nav_articles_add'] = "Add Articles";
$lang['nav_article_stats'] = "Reset Article Stats";
$lang['nav_articles_validate'] = "Validate Articles";
$lang['nav_article_comments_edit'] = "Edit Article comments";
$lang['field_article_name'] = "Article Title";
$lang['field_article_title'] = "Article Title";
$lang['field_article_id_contains'] = "Article ID contains";
$lang['field_article_title_contains'] = "Article name contains";
$lang['field_snippet_contains'] = "Snippet contains";
$lang['field_article_contains'] = "Article contains";
$lang['field_snippet'] = "Snippet Text";
$lang['field_article'] = "Secondary Text";
$lang['field_article_words'] = "Secondary Text";
$lang['field_article_file_contains'] = "Image file contains";
$lang['field_article_category'] = "Article Category";
$lang['auth_viewarticle'] = "View Article";
$lang['auth_addarticle'] = "Add Article";
$lang['auth_directaddarticle'] = "Direct Article Add";
$lang['no_article_found'] = "Articles do not have image thumbs.";
// End Articles ModSTEP 43Still in lang/(your language)/admin.php (sorry, no translations!)
Find:
?>Add ABOVE:
/*-- Setting-Group 8 --*/
$setting_group[8]="Article Category settings";
$setting['article_cat_order'] = "Sort categories by";
$article_cat_order_optionlist = array(
'cat_order' => 'Default',
'cat_name' => 'Name',
'cat_id' => 'Date',
);
$setting['article_cat_sort'] = "Ascending/Descending";
$article_cat_sort_optionlist = array(
"ASC" => "Ascending",
"DESC" => "Descending"
);
$setting['article_cat_cells'] = "Number of table cells";
$setting['article_cat_table_width'] = "Table width<br /><span class=\"smalltext\">absolute width or percentage</span>";
$setting['article_cat_table_cellspacing'] = "Cellspacing";
$setting['article_cat_table_cellpadding'] = "Cellpadding";
$setting['num_artsubcats'] = "Number of subcategories";
/*-- Setting-Group 9 --*/
$setting_group[9]="Article settings";
$setting['article_order'] = "Sort articles by";
$article_order_optionlist = array(
"article_title" => "Name",
"article_date" => "Date",
"image_votes" => "Votes",
"image_rating" => "Rating",
"image_hits" => "Hits"
);
$setting['article_sort'] = "Ascending/Descending";
$article_sort_optionlist = array(
"ASC" => "Ascending",
"DESC" => "Descending"
);
$setting['article_new_cutoff'] = "Number of days each article is marked as new";
$setting['article_cells'] = "Article table cells";
$setting['default_article_rows'] = "Article table rows";
$setting['custom_article_row_steps'] = "Number of dropdown options (allowing users to choose the number of articles per page)";
$setting['article_table_width'] = "Table width<br /><span class=\"smalltext\">absolute width or percentage</span>";
$setting['article_table_cellspacing'] = "Cellspacing";
$setting['article_table_cellpadding'] = "Cellpadding";STEP 44Open lang/(your language)/main.php (sorry, no translations!)
Find:
?>Add ABOVE:
// Begin Articles Mod
$lang['articles'] = "Articles";
$lang['article_categories'] = "Article Categories";
$lang['snippet'] = "Snippet";
$lang['article_words'] = "Article Words";
$lang['field_snippet'] = "Snippet";
$lang['field_article'] = "Article";
$lang['field_article_title'] = "Article Title";
$lang['article_add_success'] = "Article added";
$lang['article_add_error'] = "Article Add Error!";
$lang['article_title_exists'] = "Title Exists!";
$lang['article_edit_success'] = "Article Edited!";
$lang['article_edit_error'] = "Article Editing Error!";
$lang['art_in_last'] = "article in last";
$lang['hours'] = "hours";
$lang['arts_in_last'] = "articles in last";
$lang['read_more'] = "read more";
$lang['mail_friend'] = "Mail to a Friend";
$lang['no_article_results'] = "No News to Display";
$lang['no_articles'] = "There are no articles in this category.";
$lang['no_article_txt'] = "There are no news stories to display. There may be no news for this topic or you do not have access to this area.";
$lang['words'] = "words";
$lang['article_delete'] = "Delete article";
$lang['article_delete_success'] = "Article deleted";
$lang['article_delete_error'] = "Error deleting article";
$lang['article_delete_confirm'] = "Do you want to delete this article?";
$lang['post_article'] = "Post Article";
$lang['article_title'] = "Article Title";
$lang['article_edit'] = "Article Edit";
$lang['article_directory'] = "Article Directory";
$lang['articles_per_page'] = "Articles Per Page:";
$lang['image_stats'] = "Images:";
$lang['article_stats'] = "Articles:";
$lang['new_articles'] = "New Articles";
$lang['article_added_by'] = "Author:";
$lang['prev_article'] = "Previous article:";
$lang['next_article'] = "Next article:";
$lang['article_allow_comments'] = "Allow comments:";
$lang['user_addarticle'] = "Add Article";
$lang['new_article_emailsubject'] = "New Article Added to {site_name}";
$lang['new_addarticle_validate_desc'] = "Your article will be validated once it has been reviewed.";
$lang['no_new_articles'] = "Currently there are no new articles.";
$lang['article_site_stats'] = "<b>{total_articles}</b> Articles in <b>{total_article_categories}</b> Article Categories.";
// End Articles ModSTEP 45Open templates/(ALL VERSIONS of templates)/home.html
Find:
<hr size="1" />Add BELOW:
{if article_categories}
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="head1" valign="top">{lang_article_categories}</td>
</tr>
<tr>
<td class="row2" valign="top">{article_categories}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
{endif article_categories}{lang_article_site_stats}
<br />
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td class="head1" valign="top">{lang_articles}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="head1">{new_articles}</td>
</tr>
</table>
<br />STEP 46Still in templates/(ALL VERSIONS of templates)/home.html
Find:
<td>{category_dropdown_form}</td>Add BELOW:
<td align="center">{article_category_dropdown_form}</td>And that's it. A nice, short,
46 step MOD (please note the humor there
) Again, feedback welcome.