Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Fugaziman

Pages: [1]
1
Chit Chat / Hosting
« on: May 28, 2003, 09:17:54 PM »
Hello all,

I know that from time to time people have asked about hosting companies and recommending good ones. Well over the past 2 weeks I've gone through a nightmare of 2 different hosting companies only to find out they could not deliver what they promised once I uploaded my site (probably why I've been quite in this forum  :D   ).

All I wanted was...
Support for MySql
Support for PHP
Support for GD 2.0
1Gig Space
a good amount of bandwidth
and A GOOD PRICE (VERY IMPORTANT)

Well I'm glad to say I've finally found one and their support rocks.
Usually within 1 hour of me sending them an Email (any time of day) I would get a reply either solving my problem or telling me what they were going to do to help.

They have an online support app (I didn't use that though).

They even installed GD 2.0 for me so that I could use the Annotation mod.

I'm not going to advertise them here mainly because I don't agree with it on forums but if you what to know more just send me a PM or Email.

Oh and by the way I don't get paid commision or any rewards for recommending them  :D

Just thought I'd let you know.
Hope you don't mind
Fugaziman

2
V.2. Thanks to V@no (were have I heard that before   :?:   :lol: ) and his performance tuning and 4images knowledge I have updated the part of this mod that changes the page_header.php file.

If you have already installed this mod don't worry just change the bit you added in the page_header.php file with the new code.

I'm afraid I can take no credit of this re-write at all. All must go to V@no.
I think for now on we should all come up with the ideas and V@no writes them up for us  :lol:  


This Mod creates a table that displays the number of new images in each category (that has new images)
and provides links to the search page that will only display new images for that specific category.
It will only show categories that the user has access to.

To see this in action just look at the left side column of my site under the Random Image
http://www.newman.d2g.com/

Time to add Mod:
15-20 minutes

Files Changed
- includes/page_header.php
- Search.php
- templates/your_template/home.html

Note: As usual - BACKUP all of these files before changing them.


 :arrow: Edit includes/page_header.php

At the end of the page before:
Code: [Select]
?>
Add:

Code: [Select]
//-----------------------------------------------------
//---Show New Image count in category------------------
//-----------------------------------------------------

$new_image_category = "<table border=1 cellpadding=3 cellspacing=1 width=\"100%\">";

foreach ($new_image_cache as $key => $val) {
     if ($val && check_permission("auth_viewcat", $key)) {
     $category_link = "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_new_images=1&cat_id=".$key."&sub_cat=no")."\">".$val."</a>";
     $new_image_category .= "<tr><td><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cat_cache[$key]['cat_id'])."\">".$cat_cache[$key]['cat_name']."</a></td><td><b>".$category_link."</b></td></tr>";
   }
}
  
  $new_image_category .= "</table>";
  $site_template->register_vars("new_image_cats", $new_image_category);
  unset($new_image_category);


 :arrow: Edit Search.php

Find:
Code: [Select]
if (isset($HTTP_POST_VARS['search_fields'])) {
  $search_fields = trim($HTTP_POST_VARS['search_fields']);
}
else {
  $search_fields = "all";
}

Add After:

Code: [Select]
//-----------------------------------------------------
//---Show New Image count in category Mod -------------
//-----------------------------------------------------

if (isset($HTTP_GET_VARS['sub_cat'])) {
  $sub_cat = trim($HTTP_GET_VARS['sub_cat']);
}
else
{
  $sub_cat = isset($HTTP_POST_VARS['sub_cat']) ? trim($HTTP_POST_VARS['sub_cat']) : 1;
}

if (isset($HTTP_GET_VARS['cat_id'])) {
  $search_cat = intval($HTTP_GET_VARS['cat_id']);
}
else {
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
}
//-----------------------------------------------------
//---End of Show New Image count in category Mod ------
//-----------------------------------------------------

Be careful with this bit, make shure you have all the }'s in place
Find:

Code: [Select]
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
      $cat_id_sql .= ", ".$search_id['search_cat'];
      if (!empty($sub_cat_ids[$search_id['search_cat']])) {
        foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
          if (check_permission("auth_viewcat", $val)) {
            $cat_id_sql .= ", ".$val;
          }
        }
      }
    }


Replace with:

Code: [Select]
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
      $cat_id_sql .= ", ".$search_id['search_cat'];
      if ($sub_cat != "no") { // Show New Image count in category Mod
       if (!empty($sub_cat_ids[$search_id['search_cat']])) {
         foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
           if (check_permission("auth_viewcat", $val)) {
             $cat_id_sql .= ", ".$val;
           }
         }
       }
     }   // Show New Image count in category Mod
}

 


 :arrow: In your home.html file

Add:
Code: [Select]
{new_image_cats}
where you want the "New images in Category" to appear.

That's all there is to it.
Have fun
Fugaziman 8)

3
This Mod allows you to redirect you site to a "Closed for Maintenance" page from your Admin Control panel.

Database Row value added:
Settings Table

Pages changed:
- admin/settings.php
- lang/your_language/admin.php
- Index.php

New files:
 - templates/your_template/maintenance.html

Time to complete:
15-20 minutes

 :arrow: Database update:
Download this file
http://www.1024x768wallpapers.com/Code_help_files/install_MainP.zip

UnZip it and copy it into your root directory then run it through your browser
Quote
http://www.yoursite.com/install_MainP.php
This install_MainP file just inserts another row to your settings table the name "maintenance" and a value of "0". It does not change the table in any way.

 :arrow: Edit admin/settings.php
Find
  show_setting_row("gz_compress_level");

Add after
Code: [Select]
 show_setting_row("maintenance", "radio"); //Mod of maintenance page  
 :arrow: Edit lang/your_langage/admin.php
Find:
$setting['gz_compress_level'] = "GZip level of compression<br /><span class=\"smalltext\">0-9, 0=none, 9=max</span>";

Add After
Code: [Select]
$setting['maintenance'] = "Turn maintenance page ON"; //Mod of maintenance page
 :arrow: Now you have a choice....
If you want this to work when someone first comes to your site then
Edit Index.php
Find
$user_access = get_permission();

Add After
Code: [Select]
//-----------------------------------------------------
//--- Maintenance      --------------------------------
//-----------------------------------------------------
$maintenance = $config['maintenance'];
$redirect_url = TEMPLATE_PATH."/maintenance.html";
if ($maintenance){
  header("Location: ".$site_sess->url($redirect_url, "&"));
  exit;
}

//-----------------------------------------------------
//--- End of Maintenance      -------------------------
//-----------------------------------------------------

or if you want it to work for every page then ..
Edit page_header.php
Find
Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
}
and insert the code above just below it.

 :arrow: Create new file in your templates/Your_template/maintenance.html folder.

Add this html...
Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Site closed for Maintenance</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF">

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablebgcolor">

<tr>
<td align="center">  
<!-- add your maintenance page content here -->
Sorry but the site is closed for maintenance
<!-- End of maintenance page content here   -->
</td>
</tr>
</table>
<br>

</body>
</html>
:arrow: Change the content of this HTML page to suite your sites needs.

 :arrow: Now you can test the Mod.
- Log into your Admin Panel
- Click on the "Settings" Link on the left side menu
- At the bottom of the General section you will see an extra Radio Button field "Turn maintenance page ON"
- Select Yes to turn Maintenance page on
- Try going to your home page

That's it. Nothing to fancy but it's a lot better than nothing

Fugaziman 8)

4
Mods & Plugins (Releases & Support) / [Mod] Latest News and Archive
« on: April 13, 2003, 04:37:23 AM »
Okay I was told by a friend that this original mod was getting a bit to confusing with all the additions and improvements I made over time. So with this in mind I've replaced my original post with this one.
Hopefully it will be easier to follow (and still work :wink:  )


Mod - Create Latest/Archive News feature for your home page.

History: I've been asked quite a few times about the Latest News section I had on my home page and how I did it. Well it was only two HTML pages that I had to manually edit each time to add or move to the archive page. It was also formatted to fit in my site so wasn't easy to install on other 4image sites.
So I've created this quick Mod hoping that it would be helpful to others wanting this function.

What it does: Rather than creating more new tables and pages to create a whole new comment/bulletin board I cheated. This mod actually uses the exiting Comments table and pages (without any changes) to enter in your latest news.
Okay it's not rocket science but it works and gives the results required.

NOTE: Remember each time you add a latest news comment it will add a count to your total comments.
BUT remember as this is a very private category only the administrator will see the full count as other wont have access to it.

So READ THE INSTRUCTIONS BELOW FIRST to see if it's okay for you.
Take a look at my site to see what you think. Then Install this Mod if you want to.  

As always before starting any Mod make backup copies of the files you are going to modify(Just in case).

Modified files:
./Index.php
./templates/your_template/home.html
./details.php

New Files:
./templates/your_template/news_comment_bit.html
./templates/your_template/archive.html

 :arrow: Step 1.  Create simple image to be used to as your Latest_news image as you would any other image.
You can use this one if you want http://www.newman.d2g.com/Code_help_files/Latest_News.jpg

 :arrow: Step 2  Log into your sites Admin Control Panel

 :arrow: Step 3  Create a New Category called something like "News Updates"and set all Permissions to "Private"

 :arrow: Step 4  If you want others to add news then you can update their user settings to give them permissions to this new category.

 :arrow: Step 5  Add the image you created (in step 1) to this category as you would any other image.
VERY IMPORTANT: WRITE DOWN the "image_id" value given when imported (eg 3456).    I can't stress how important this is. You will need this number several times during installation of this mod. YOU HAVE BEEN WARNED

Ok! Here's were the code changes start.

 :arrow: Step 6  In your templates directory CREATE NEW TEMPLATE FILE called news_comment_bit.html.

INSERT this code
Code: [Select]
<tr>
<td class="row2" ><div align="right"><small>(Date Posted: {news_comment_date})</small></div><b>Headline: {news_comment_headline}</b></td>
</tr>
<tr>
<td class="row1" align="left">{news_comment_text}</td>
</tr>

 :arrow: Step 7  Edit index.php

Find :
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

Just BEFORE this, INSERT:
Code: [Select]
//--------------------------------------------------------
// Latest and Archive News Mod --
// --
// User configurable variables --
// You must change the first 4 variables to meet --
// your requirements:     (see notes below) --
//     $display_by_count --
//     $latest_news_day --
//     $show_news_articles --
//     $news_image --
//--------------------------------------------------------
  $display_by_count = "0";      // values 0 or 1 ....
                                // .... change this to 0 if display by days posted
                                // .... or 1 to display fixed number of news articles as Latest
                               
  $latest_news_days = "31";     // Number of days news displays at Latest ....
                                // .... change This to the number of days news shows as Latest
                               
  $show_news_articles = "5";    // Number of news articles to show ....
                                // .... change This to fixed number of articles to display for latest news
                               
  $news_image = "*****";          // Change This to your Latest news image id
//----------------------------------------------------

$new_news = (time() - 60 * 60 * 24 * $latest_news_days);

if ($newstype == "latestnewsall"){
    $news_type = "latestnewsall";
    }
else {
    $news_type = "latestnews";
    }

  $additional_sql = "";

  if ($news_type == "latestnews") {

    if ($display_by_count) {
        $additional_sql .= "  c.image_id = '".$news_image."'";
        $additional_sql_2 .= " LIMIT ".$show_news_articles;
    }
    else {
        $additional_sql .= " c.comment_date > '".$new_news."' AND c.image_id = '".$news_image."'";
        $additional_sql_2 .= "";
    }
  }

  else {
    $additional_sql .= " c.image_id = '".$news_image."'";
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>&nbsp;/&nbsp;Archived News";
  }

  $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2 ;

  $result = $site_db->query($sql);
  $num_rows = $site_db->get_numrows($result);
  $news_comment_row = array();

  while ($row = $site_db->fetch_array($result)) {
    $news_comment_row[] = $row;
  }

  $site_db->free_result($result);
   
// This is the Paging stuff
  if ($newstype == "latestnewsall") {
       
    include(ROOT_PATH.'includes/paging.php');
    $perpage = $show_news_articles;
    $link_arg = $site_sess->url(ROOT_PATH."index.php?newstype=latestnewsall");
    $getpaging = new Paging($page, $perpage, $num_rows, $link_arg);
    $offset = $getpaging->get_offset();

    $site_template->register_vars(array(
      "paging" => $getpaging->get_paging(),
      "paging_stats" => $getpaging->get_paging_stats()
    ));
     
    $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2."  
            LIMIT $offset, $perpage";

          $result = $site_db->query($sql);
          $num_rows = $site_db->get_numrows($result);
          $news_comment_row = array();
           
      while ($row = $site_db->fetch_array($result)) {
            $news_comment_row[] = $row;
          }
  }

  if (!$num_rows) {
      $news_comments = "&nbsp;&nbsp;&nbsp;<b>No New News to report within the last ".$latest_news_days." days.</b>";
  }
  else {
      $news_comments = "";
      $bgcounter = 0;

    for ($i = 0; $i < $num_rows; $i++) {
        $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

        $site_template->register_vars(array(
            "news_comment_headline" => format_text($news_comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
            "news_comment_text" => format_text($news_comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
            "news_comment_date" => format_date($config['date_format']." ".$config['time_format'], $news_comment_row[$i]['comment_date']),
            "row_bg_number" => $row_bg_number));

        $news_comments .= $site_template->parse_template("news_comment_bit");
    }

  }
  $site_template->register_vars("news_comments", $news_comments);
  unset($news_comments);

//-----------------------------------------------------
//---End of Show Latest News   -------------------------------
//-----------------------------------------------------

 :arrow: Step 8  at bottom of page Search for
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));
 


Replace with
Code: [Select]
if ($news_type == "latestnewsall") {  
  $site_template->print_template($site_template->parse_template(archive));      
}  
else {  
  $site_template->print_template($site_template->parse_template($main_template));  
}
 
 :arrow: Step 9  In the code you just added to your Index.php you need to change the 4 variables to meet your sites requirements.

$display_by_count = "0";       Set to values 0 or 1 ....
                                Set to 0 (Zero) If you want to display by number of days posted
                                Set to 1 (One) to display a fixed number of Latest News comments.
                               
$latest_news_days = "31";       Set to the Number of days New News comments are displayed before
                                moving to archive page/link
                               
$show_news_articles = "5";      Set to a fixed number of news comments you want to display at Latest
                               
$news_image = "*****";            Change this to your Latest news image id (eg 3421) that you got in step 5

 :arrow: Step 10  Edit ./templates/your_template/home.html
Insert this code where you want the Latest News comments to display
Code: [Select]
<table width="100%" border="1" cellspacing="1" cellpadding="1">
    <tr>
        <td align="left"  class="head1" height="20" width="100%"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" /><a href="./index.php">Latest News</a></td>
    </tr>
    <tr>
        <td>
        <table width="100%" border="1" cellspacing="1" cellpadding="4">
        {news_comments}
        </table>
        </td>
    <tr>
    <tr>
        <td align="right" class="head1" height="20" width="100%"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" /><a href="./index.php?newstype=latestnewsall">News Archive</a>&nbsp;&nbsp;</td>
    </tr>
</table>

 :arrow: Step 11  By default 4images only allows 1 comment per image per ip address per given time period. This is to stop your site being spammed with loads and loads of comments. For the Private Latest News image though you may want to enter 2 or 3 news comments at once so to bypass this for just your Latest News Image do this...
         
Edit ./details.php file
Find:
Code: [Select]
$sql = "SELECT comment_ip, comment_date
            FROM ".COMMENTS_TABLE."  
            WHERE image_id = $id  
            ORDER BY comment_date DESC  
            LIMIT 1";
    $spam_row = $site_db->query_firstrow($sql);
    $spamtime = $spam_row['comment_date'] + 180;

    if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      $msg .= (($msg != "") ? "" : "").$lang['spamming'];
      $error = 1;
    }
   
Replace with
Code: [Select]
if ($id != "****"){   //added for latest news mod
    $sql = "SELECT comment_ip, comment_date
            FROM ".COMMENTS_TABLE."  
            WHERE image_id = $id  
            ORDER BY comment_date DESC  
            LIMIT 1";
    $spam_row = $site_db->query_firstrow($sql);
    $spamtime = $spam_row['comment_date'] + 180;

    if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      $msg .= (($msg != "") ? "" : "").$lang['spamming'];
      $error = 1;
    }
  }

In the code you just replaced change "****" to be your Latest_News image id that you wrote down in step 5

 :arrow: Step 12  Create a new template page in your templates directory to show your news archive page and allow paging of old news. I suggest making a copy of your home.html file, renaming it archive.html, edit it and removing all the stuff you don't want to display on your news archive page.

Edit archive.html and insert this code where you want the Archived News Comments Archive to appear
Code: [Select]
<table width="100%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td align="left"  class="head1" height="20">Archived News</td>
                <td align="right" class="head1" height="20">{paging}></td>
</tr>

<tr>
<td colspan="2">
<table width="100%" border="1" cellspacing="1" cellpadding="4">
{news_comments}
</table>
</td>
</tr>
<tr>
<td align="left"  class="head1" height="20"> <a href="./index.php">Latest News</a></td>
<td align="right" class="head1" height="20">{paging} </td>
</tr>            
</table>


That's it. Now you can test it to see if it works.
1)Log into your site as your admin account.
2)Find your new Category, remember it's something like News Updates
3)Add a comment or 3 to the Latest News image you created
3)Go back to home page and see the results.

I think thats it.
I tested this documents steps fully on a fresh install of the 4images PHP pages and Default template pages. It worked fine. So if you follow the steps carefully it should work for you first time.

Thanks to Chris for getting on my back and making me do this re-write
Good luck with your sites Everyone.

Fugaziman

5
This Mod will allow each category to have it's own Sort Order.

I created this so that some of my categories can be displayed in sequence using the image name but others I just want to display with the latest first ie. using date_order.

Two things to note:
1) It stops the default Sort order set using the Admin Panel - Settings Page.
2) The Mod in this forum for allowing users to select their own sort order will not work on the Categories page. However it will still work in the Search and New Images pages (same page really)

The Mod it quite easy to install but make sure you backup/make copy of your files first. Just in case  :D

Step 1.  :arrow:  Add 2 new fields to your categories table
sort_order  varchar(5)   Default "ASC"
sort_field    varchar(20) Default "image_name"

Thanks to V@no (Helps us unfortunate newbies all the time  :D )
Heres the link for the DB installer..
Category Sort Install
Just download the zip file, unzip it to your root directory and call it from your browser.
 
Step 2.  :arrow:  Backup ./global.php
   Edit ./global.php

4images v1.7
Search for ...
Code: [Select]
 $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
          FROM ".CATEGORIES_TABLE." c
          LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
          GROUP BY c.cat_id
          ORDER BY c.cat_order, c.cat_name ASC";

Replace with ...

Code: [Select]
 $sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, c.sort_order, c.sort_field, COUNT(i.image_id) AS new_images
          FROM ".CATEGORIES_TABLE." c
          LEFT JOIN ".IMAGES_TABLE." i ON (i.cat_id = c.cat_id AND i.image_date >= $new_cutoff AND i.image_active = 1)
          GROUP BY c.cat_id
          ORDER BY c.cat_order, c.cat_name ASC";

4images v1.7.1

Search for ...
Code: [Select]
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
Replace with ...
Code: [Select]
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, sort_order, sort_field

Step 3.  :arrow:  Backup ./categories.php
   Edit ./categories.php
Search for sql line containing ...
Code: [Select]
ORDER BY
Replace Whole Line with...
Code: [Select]
       ORDER BY ".$cat_cache[$cat_id]['sort_field']." ".$cat_cache[$cat_id]['sort_order']."
Step 4.  :arrow:  Backup ./lang/yourlang/admin.php
   Edit ./lang/yourlang/admin.php
Insert just ABOVE
Code: [Select]
?> at end of page

Code: [Select]
//--------------Images Sort-------------------------
//---Used by Category Sort Option Mod            ---
//--------------------------------------------------
$lang['image_order'] = "Sort images by";
$image_order_optionlist = array(
  "image_name"      => "Name",
  "image_date"      => "Date",
  "image_downloads" => "Downloads",
  "image_votes"     => "Votes",
  "image_rating"    => "Rating",
  "image_hits"      => "Hits"
);
$lang['image_sort'] = "Ascending/Descending";
$image_sort_optionlist = array(
  "ASC"  => "Ascending",
  "DESC" => "Descending"
);
//--------------------------------------------------
//---End of Category Sort Option Mod             ---
//--------------------------------------------------

Step 5.  :arrow: Backup ./admin/categories.php
   Edit ./admin/categories.php

Search for ...
Code: [Select]
if ($action == "savecat") {
  $error = array();
  $cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
  $cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));
  $cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']);
  $cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;
 
Immediatley After INSERT these 2 lines...
Code: [Select]
 $sort_order = trim($HTTP_POST_VARS['imagesradio']);
  $sort_field = trim($HTTP_POST_VARS['imagesorder']);

Search for ...
Code: [Select]
   $sql = "INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
            VALUES
            ('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";

Replace with ...
Code: [Select]
   $sql = "INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, sort_order, sort_field)
            VALUES
            ('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment, '$sort_order', '$sort_field')";

Search for ...
Code: [Select]
 show_textarea_row($lang['field_description_ext'], "cat_description", "", $textarea_size);  
Immediatley After, INSERT this...
Code: [Select]
 $imgsort_dropdown="\n<select name=\"imagesorder\" class=\"setperpageselect\">\n";
  foreach ($image_order_optionlist as $key => $val) {
    $imgsort_dropdown .= "<option value=\"$key\"";
    if ($config['image_order'] == $key) {
      $imgsort_dropdown .= " selected=\"selected\"";
    }
    $imgsort_dropdown .= ">".$val."</option>\n";
  }
  $imgsort_dropdown .= "</select>\n";
  
  foreach ($image_sort_optionlist as $key => $val) {
  $imgsort_radio .= "<INPUT type=\"radio\" name=\"imagesradio\" value=\"$key\"";
  if ($config['image_sort'] == $key) {
      $imgsort_radio .= " checked";
  }
  $imgsort_radio .= ">".$val."\n";
  }
  show_custom_row($lang['image_order'], $imgsort_dropdown);
  show_custom_row($lang['image_sort'], $imgsort_radio);

Search for ...
Code: [Select]
if ($action == "savecat") {
  $error = array();
  $cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
  $cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));
  $cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']);
  $cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;

Immediatley After, INSERT this...
Code: [Select]
 $sort_order = trim($HTTP_POST_VARS['imagesradio']);
  $sort_field = trim($HTTP_POST_VARS['imagesorder']);

Search for ...
Code: [Select]
if ($action == "updatecat") {
  $error = array();
  $cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
  $cat_parent_id = intval($HTTP_POST_VARS['cat_parent_id']);
  $cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
  $cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));
  $cat_hits = intval(trim($HTTP_POST_VARS['cat_hits']));
  $cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;
 
Immediatley After, INSERT this...
Code: [Select]
 $sort_order = trim($HTTP_POST_VARS['imagesradio']);
  $sort_field = trim($HTTP_POST_VARS['imagesorder']);
 
Search for ...
Code: [Select]
   $sql = "UPDATE ".CATEGORIES_TABLE."
            SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
            WHERE cat_id = $cat_id";
           
Replace with ...
Code: [Select]
   $sql = "UPDATE ".CATEGORIES_TABLE."
            SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment, sort_order = '$sort_order', sort_field = '$sort_field'
            WHERE cat_id = $cat_id";
           
Search for ...
Code: [Select]
 $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_order, cat_hits, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM ".CATEGORIES_TABLE."
          WHERE cat_id = $cat_id";
         
Replace with ...
Code: [Select]
 $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_order, cat_hits, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, sort_order, sort_field
          FROM ".CATEGORIES_TABLE."
          WHERE cat_id = $cat_id";
         
Search for ...
Code: [Select]
 show_textarea_row($lang['field_description_ext'], "cat_description", $cat_row['cat_description'], $textarea_size);
Immediatley After INSERT this ...
Code: [Select]
 $imgsort_dropdown="\n<select name=\"imagesorder\" class=\"setperpageselect\">\n";
  foreach ($image_order_optionlist as $key => $val) {
    $imgsort_dropdown .= "<option value=\"$key\"";
    if ($cat_row['sort_field'] == $key) {
      $imgsort_dropdown .= " selected=\"selected\"";
    }
    $imgsort_dropdown .= ">".$val."</option>\n";
  }
  $imgsort_dropdown .= "</select>\n";
  
  foreach ($image_sort_optionlist as $key => $val) {
  $imgsort_radio .= "<INPUT type=\"radio\" name=\"imagesradio\" value=\"$key\"";
  if ($cat_row['sort_order'] == $key) {
      $imgsort_radio .= " checked";
  }
  $imgsort_radio .= ">".$val."\n";
  }
  show_custom_row($lang['image_order'], $imgsort_dropdown);
  show_custom_row($lang['image_sort'], $imgsort_radio);
 
Search for ...
Code: [Select]
if ($action == "modifycats") {
  if ($msg != "") {
    printf("<b>%s</b>\n<p>", $msg);
  }
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC";
  $result = $site_db->query($sql);

Replace with ....
Code: [Select]
if ($action == "modifycats") {
  if ($msg != "") {
    printf("<b>%s</b>\n<p>", $msg);
  }
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, sort_order, sort_field
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC";
  $result = $site_db->query($sql);

THAT'S IT PEOPLE.
Now just go into your Admin Panel - Edit Categories and set your sort orders. If you created the 2 extra table fields above the default sort order for all existing categories will be image_name ASC.

Good luck  8)
Fugaziman

Pages: [1]