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 - V@no

Pages: 1 2 3 4 5 [6] 7 8 9 10 ... 14
76
This is an adopted for 4images v1.7 cache feature from 4images v1.7.1


Step 1
Create a new file includes/cache_utils.php[/color]
With this code:
Code: [Select]
<?php
/************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: cache_utils.php                                      *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan at 4homepages.de                                 *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Adopted for 4images v1.7 by V@no                                    *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) fN?r weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die("Security violation");
}

function 
create_cache_id($group$params null){
  $cache_id $group;
  if (is_array($params)) {
    $cache_id .= '.' implode('.'$params);
  } elseif (is_string($params)) {
    $cache_id .= '.' $params;
  }
  return $cache_id;
}

function 
get_cache_file($cache_id$lifetime null) {
  global $cache_enable$cache_lifetime$cache_path;

  if (!$cache_enable) {
    return false;
  }

  if (!$lifetime) {
    $lifetime $cache_lifetime;
  }

  $file $cache_path '/' $cache_id;

  if (!@is_readable($file)) {
    return false;
  }

  if ($lifetime == -|| (filemtime($file) + $lifetime) > time()) {
    if (!$fp = @fopen($file'rb')) {
        return false;
    }

    $data = @fread($fpfilesize($file));
    @fclose($fp);

    if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
      echo "Cache file '$cache_id' <span style='color:green'>used</span><br>";
    }

    // Replace session ids
    global $site_sess;
    $replace $site_sess->mode == 'cookie' '' '\1\2'.SESSION_NAME.'='.$site_sess->session_id;
    $data preg_replace(
      '#([\?|&])+(amp;)?%%%SID%%%#',
      $replace,
      $data
    
);

    return $data;
  }

  if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
    echo "Cache file '$cache_id' <span style='color:purple'>expired</span><br>";
  }

  return false;
}

function 
save_cache_file($cache_id$data) {
  global $cache_enable$cache_lifetime$cache_path;

  if (!$cache_enable) {
    return false;
  }

  $file $cache_path '/' $cache_id;

  if ($fp = @fopen($file'wb')) {
    // Replace session ids
    global $site_sess;
    $data str_replace(
      SESSION_NAME.'='.$site_sess->session_id,
      '%%%SID%%%',
      $data
    
);

    @flock($fpLOCK_EX);
    @fwrite($fp$data);
    @flock($fpLOCK_UN);
    @fclose($fp);

    if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
      echo "Cache file '$cache_id' <span style='color:red'>stored</span><br>";
    }

    return true;
  }

  @fclose($fp);

  return false;
}

function 
delete_cache_file($cache_id) {
  global $cache_enable$cache_lifetime$cache_path;

  if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
    echo "Cache file '$cache_id' <span style='color:red'>deleted</span><br>";
  }

  return @unlink($cache_path '/' $cache_id);
}

function 
delete_cache_group($group) {
  global $cache_enable$cache_lifetime$cache_path;

  $handle = @opendir($cache_path); 

  while ($file = @readdir($handle)) { 
    if (is_dir($file) || $file{0} == ".") {
      continue;
    }

    if (strpos($file$group) === 0) {
      unlink($cache_path '/' $file);
    }
  }

  if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
    echo "Cache group '$group' <span style='color:red'>deleted</span><br>";
  }
}

function 
clear_cache() {
  global $cache_enable$cache_lifetime$cache_path;

  $handle opendir($cache_path);

  while ($file = @readdir($handle)) {
    if (is_dir($file) || $file{0} == ".") {
      continue;
    }

    unlink($cache_path '/' $file);
  }
}

?>



Step 2
Open global.php
Find:
Code: [Select]
@include(ROOT_PATH.'config.php');
Add above:
Code: [Select]
//-----------------------------------------------------
//--- Cache -------------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/cache_utils.php');
// Initialize cache configuration
define('PRINT_CACHE_MESSAGES', 0); //show some debug messages
$cache_enable = 1;
$cache_lifetime = 3600; // 1 hour
$cache_path = ROOT_PATH.'cache';

$cache_page_index = 1; //index.php
$cache_page_categories = 1; //categories.php
$cache_page_top = 1; //top.php
//End Initialize cache configuration



Step 3
Open index.php
Find:
Code: [Select]
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------

Add above:
Code: [Select]
$cache_id = create_cache_id(
  'cat.page.index',
  array(
    $user_info[$user_table_fields['user_id']],
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
    $config['template_dir'],
    $config['language_dir']
  )
);
if (!$cache_page_index || !$content = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_index) {
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

ob_start();


Step 3.1
Find:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));(if u have more then one instance of this line, then find the last one, close to the end of the file)

Add below:
Code: [Select]
$content = ob_get_contents();
ob_end_clean();

if ($cache_page_index) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;
  save_cache_file($cache_id, $content);
}
} // end if get_cache_file()
echo $content;



Step 4
Open categories.php
Find:
Code: [Select]
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------

Add above:
Code: [Select]
$cache_id = create_cache_id(
  'cat.page.categories',
  array(
    $user_info[$user_table_fields['user_id']],
    $cat_id,
    $page,
    $perpage,
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
    $config['template_dir'],
    $config['language_dir']
  )
);

if (!$cache_page_categories || !$content = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_categories) {
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

ob_start();


Step 4.1
Find:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));(if u have more then one instance of this line, then find the last one, close to the end of the file)

Add below:
Code: [Select]
$content = ob_get_contents();
ob_end_clean();

if ($cache_page_categories) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;

  save_cache_file($cache_id, $content);
}

} // end if get_cache_file()

echo $content;



Step 5
Open top.php
Find:
Code: [Select]
include(ROOT_PATH.'includes/page_header.php');
Add below:
Code: [Select]
$cache_id = create_cache_id(
  'top',
  array(
    $user_info[$user_table_fields['user_id']],
    $cat_id,
    $config['template_dir'],
    $config['language_dir']
  )
);

if (!$cache_page_top || !$content = get_cache_file($cache_id)) {
if ($cache_page_top) {
  // Always append session id if cache is enabled
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

ob_start();


Step 5.1
Find:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));(if u have more then one instance of this line, then find the last one, close to the end of the file)

Add below:
Code: [Select]
$content = ob_get_contents();
ob_end_clean();

if ($cache_page_top) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;

  save_cache_file($cache_id, $content);
}

} // end if get_cache_file()

echo $content;



Step 6
Create a new folder cache[/color] in your 4images root directory. Make sure its writible (CHMOD 777)


Step 7 (optional)

Create a new file admin/plugins/clear_cache.php (create plugins folder if u dont have it yet) with the folowing code inside:
 
Code: [Select]
<?php // PLUGIN_TITLE: Clear Cache 
/************************************************************************** 
 *                                                                        * 
 *    4images - A Web Based Image Gallery Management System               * 
 *    ----------------------------------------------------------------    * 
 *                                                                        * 
 *             File: clear_cache.php                                      * 
 *        Copyright: (C) 2002 Jan Sorgalla                                * 
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.1                                                * 
 *                                                                        * 
 *    Never released without support from: Nicky (http://www.nicky.net)   * 
 *                                                                        * 
 ************************************************************************** 
 *                                                                        * 
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       * 
 *    bedingungen (Lizenz.txt) f?tere Informationen.                 * 
 *    ---------------------------------------------------------------     * 
 *    This script is NOT freeware! Please read the Copyright Notice       * 
 *    (Licence.txt) for further information.                              * 
 *                                                                        * 
 *************************************************************************/ 

$nozip 1
define('IN_CP'1); 
$root_path "./../../"
define('ROOT_PATH'$root_path); 
require(
ROOT_PATH.'admin/admin_global.php'); 

if (
$config['language_dir'] == 'deutsch') { 
  $lang_clear_cache   'Cache leeren'
  $lang_clear_confirm 'Wollen Sie das Cache-Verzeichnis leeren (%s)?'
  $lang_clear_success 'Cache-Verzeichnis geleert'
} else { 
  $lang_clear_cache   'Clear Cache'
  $lang_clear_confirm 'Do you want to clear the cache directory (%s)?'
  $lang_clear_success 'Cache directory cleared'


show_admin_header(); 

if (
$action == "clearcache") { 
    @set_time_limit(0); 
    clear_cache(); 
    $msg $lang_clear_success


if (
$msg != "") { 
    printf("<b>%s</b>n"$msg); 


show_form_header($HTTP_SERVER_VARS['PHP_SELF'], "clearcache"); 
show_table_header($lang_clear_cache); 
show_description_row(sprintf($lang_clear_confirmrealpath($cache_path))); 
show_form_footer($lang['submit'], ""); 


show_admin_footer(); 
?>


78
IMHO MySQL v4.1 is not a major upgrade from v3 or even v4.0 but its major pain in the @$$..

Well, anyway, after upgrading I've noticed that database size in ACP shows n/a
After investigation I found out that some database "variables" for tables in v4.1 has been changed. One of them is "Type" parameter that used to determin what type of table is it (MyISAM, ISAM, HEAP, InnoDB, etc). As of v4.1 this "variable" was renamed to "Engine" which makes 4images ignore it and show "n/a" instead.


The fix is very simple, in includes/db_utils.php find:
Code: [Select]
        if (eregi('^(MyISAM|ISAM|HEAP|InnoDB)$', $row['Type'])) {Replace with:
Code: [Select]
        if ((isset($row['Type']) && eregi('^(MyISAM|ISAM|HEAP|InnoDB)$', $row['Type'])) || (isset($row['Engine']) && eregi('^(MyISAM|ISAM|HEAP|InnoDB)$', $row['Engine']))) {

This fix should not affect any other versions of MySQL.

P.S.
Also some people may see some error messages such as:
Quote
Notice: Undefined index: Type in /path/to/4images/includes/db_utils.php on line 184
this fix should solve it too.

79
This is complete rewrite of SLL's "[MOD] Email image validation results to the user v1". Since SLL is no longer very active on this forum :( I decided create my own mod using his idea, with many new features and most significan change from v1 is that every member will receive only one email with list of accepted/declined images instead of separate email for each image.


------------ [ Features ] -------------
  • members receive only one email with list of added/deleted images
  • admin can send an individual message (comment) for each added/deleted file
  • admin can chose not send any notification emails (per file setting)
  • quick select all files to add or delete
  • after validation return to validation page (by default it only show result of the validation on a blank page)
  • double click on a radio button will remove any sellection (usefull if quick selected all images but then u've changed your mind and decided not add or delete one or more images)
  • displays a link to image details page if an image added

The validation page:


And the email member received after validation the three images above:


------------- [ Installation ] --------------

If u've installed "[MOD] Email image validation results to the user v1" by SLL, you'll need to uninstall it before installing this mod...

Step 1
Open admin/validateimages.php
Find:
Code: [Select]
  $image_list = (isset($HTTP_POST_VARS['image_list'])) ? $HTTP_POST_VARS['image_list'] : "";Insert below:
Code: [Select]
/*
  MOD VALIDATION RESULT V2
  START INSERT
*/
  $msg_list = (isset($HTTP_POST_VARS['msg_list'])) ? $HTTP_POST_VARS['msg_list'] : "";
  $email_cache = array();
  $action = "validateimages";
/*
  MOD VALIDATION RESULT V2
  END INSERT
*/


Step 1.1
Find:
Code: [Select]
            echo $lang['image_add_success'].": <b>".stripslashes($image_name)."</b> (".$image_media_file.")<br />";Replace it with:
Code: [Select]
/*
  MOD VALIDATION RESULT V2
  START ORIGINAL CODE

            echo $lang['image_add_success'].": <b>".stripslashes($image_name)."</b> (".$image_media_file.")<br />";

  MOD VALIDATION RESULT V2
  END ORIGINAL CODE
*/
/*
  MOD VALIDATION RESULT V2
  START REPLACE
*/
            echo $lang['image_add_success'].": <b><a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id)."\" target=\"_blank\">".stripslashes($image_name)."</a></b> (".$image_media_file.")<br />";
            $email_cache[$user_id][] = array(
              "status" => 1,
              "send" => (isset($HTTP_POST_VARS['send'][$key]) && $HTTP_POST_VARS['send'][$key] == 2) ? 1 : 0,
              "image_id" => $image_id,
              "date" => $image_date,
              "image_media_file" => $image_media_file,
              "msg" => $msg_list[$key]
            );
/*
  MOD VALIDATION RESULT V2
  END REPLACE
*/


Step 1.2
Find:
Code: [Select]
        echo $lang['image_delete_success'].": <b>".stripslashes($image_name)."</b> (".$image_media_file.")<br />";Insert below:
Code: [Select]
/*
  MOD VALIDATION RESULT V2
  START INSERT
*/
        $email_cache[$user_id][] = array(
          "status" => 0,
          "send" => (isset($HTTP_POST_VARS['send'][$key]) && $HTTP_POST_VARS['send'][$key] == 2) ? 1 : 0,
          "image_id" => 0,
          "date" => $image_date,
          "image_media_file" => $image_media_file,
          "msg" => $msg_list[$key]
        );
/*
  MOD VALIDATION RESULT V2
  END INSERT
*/


Step 1.3
Find:
Code: [Select]
}
  else {
    echo "<b>Just relaxing because you give me nothing to do!</b>";
Insert above (make sure insert it above the closing bracket "}" above the else !!!!:
Code: [Select]
/*
  MOD VALIDATION RESULT V2
  START INSERT
*/
    if (!empty($email_cache))
    {
      if (!class_exists('Email')) include(ROOT_PATH.'includes/email.php');
      $user_ids = implode(",", array_keys($email_cache));
      $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_allowemails")."
              FROM ".USERS_TABLE."
              WHERE ".get_user_table_field("", "user_id")." IN (".$user_ids.") AND ".get_user_table_field("", "user_level")." > ".GUEST;
      $result = $site_db->query($sql);
      $email_template = new Template(ROOT_PATH."lang/".$config['language_dir']."/email");
      while($row = $site_db->fetch_array($result))
      {
        if (!$row['user_allowemails']) continue; //comment this line out to disregard member's setting not to receive emails from administrators
        $list = "";
        $file_list = array();
        $site_url = $script_url;
        $site_url = preg_replace("#/?admin#", "", $site_url);
//        $site_url = "http://yoursite.com/4images"; // uncomment this line and update to the correct domain if your have problem with url in the email message
        $email_template->register_vars(array(
          "lang_upload_date" => $lang['validate_date'],
          "lang_file" => $lang['validate_file'],
          "lang_msg" => $lang['validate_msg'],
          "lang_status" => $lang['validate_status'],
        ));
        foreach ($email_cache[$row['user_id']] as $info)
        {
          if (!$info['send']) continue;
          $file_list[] = $info['image_media_file'];
//          $image_url = ($info['image_id']) ? "( ".$site_sess->url($site_url."/details.php?".URL_IMAGE_ID."=".$info['image_id'], "&")." )" : "";
          $image_url = ($info['image_id']) ? "( ".$site_url."/details.php?".URL_IMAGE_ID."=".$info['image_id']." )" : "";
          $email_template->register_vars(array(
            "status" => ($info['status']) ? $lang['validate_yes'] : $lang['validate_no'],
            "image_url" => $image_url,
            "image_id" => $info['image_id'],
            "date" => format_date($config['date_format']." ".$config['time_format'], $info['date']),
            "file" => $info['image_media_file'],
            "msg" => stripslashes($info['msg'])
          ));
          $list .= $email_template->parse_template("validation_email_bit");
        }
        if (empty($list)) continue;
        $site_email = new Email();
        $site_email->set_to($row['user_email']);
//        $site_email->set_from($config['site_email'], $config['site_name']);
        $site_email->set_subject($lang['valdiate_title']);
        $site_email->register_vars(array(
          "recipient_name" => $row['user_name'],
          "list" => $site_email->prepare_text($list),
          "file_list" => implode(", ", $file_list),
          "site_url" => $site_sess->url($site_url, "&"),
          "date" => format_date($config['date_format']." ".$config['time_format'], time()),
          "site_name" => $config['site_name']
        ));
        $site_email->set_body("validation_email", $config['language_dir']);
        $site_email->send_email();
      }
    }
    echo "<br />";
/*
  MOD VALIDATION RESULT V2
  END INSERT
*/
(make sure that between this block of code and the code u've inserted in previous step are only two (2) closing brackets ( } )!


Step 1.4
Find:
Code: [Select]
    echo "<td class=\"tableseparator\">".$lang['validate']."</td>\n<td class=\"tableseparator\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";Replace it with:
Code: [Select]
/*
  MOD VALIDATION RESULT V2
  START ORIGINAL CODE

    echo "<td class=\"tableseparator\">".$lang['validate']."</td>\n<td class=\"tableseparator\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";

  MOD VALIDATION RESULT V2
  END ORIGINAL CODE
*/

/*
  MOD VALIDATION RESULT V2
  START REPLACE
*/
    show_hidden_input("cat_id", $cat_id);
    show_hidden_input("limitnumber", $limitnumber);
    echo "<script>
    var yes = false;
    var no = false;
    var send = true;
    var rc = new Array();
    function CheckAllradio(num, checked) {
      for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if (e.type=='radio' && e.value == num) {
          e.checked = checked;
        }
      }
    }
    </script>";
    echo "<td class=\"tableseparator\">".$lang['validate_msg']."</td>\n<td class=\"tableseparator\" onClick=\"if(send){send=false;CheckAllradio(2, false);CheckAllradio(3, true);}else{send=true;CheckAllradio(2, true); CheckAllradio(3, false);}\">Send</td>\n<td class=\"tableseparator\" onClick=\"if(yes){yes=false;no=false}else{yes=true;no=false;}CheckAllradio(1, yes)\">".$lang['validate']."</td>\n<td class=\"tableseparator\" onClick=\"if(no){no=false;yes=false}else{no=true;yes=false;}CheckAllradio(0, no)\">".$lang['delete']."</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">".$lang['field_image_name']."</td>\n<td class=\"tableseparator\">".$lang['field_category']."</td>\n<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_date']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
/*
  MOD VALIDATION RESULT V2
  END REPLACE
*/


Step 1.5
Find:
Code: [Select]
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\"></td>";
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\"></td>";
Replace it with:
Code: [Select]
/*
  MOD VALIDATION RESULT V2
  START ORIGINAL CODE

      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\"></td>";
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\"></td>";

  MOD VALIDATION RESULT V2
  END ORIGINAL CODE
*/
/*
  MOD VALIDATION RESULT V2
  START REPLACE
*/
      echo "<td>".(($image_row['user_id'] != GUEST) ? "<textarea name=\"msg_list[".$image_row['image_id']."]\" rows=\"3\" cols=\"40\">".((isset($HTTP_POST_VARS['msg_list'][$image_row['image_id']])) ? stripslashes($HTTP_POST_VARS['msg_list'][$image_row['image_id']]) : "")."</textarea>" : "")."</td>";
      echo "<td>".(($image_row['user_id'] != GUEST) ? "<input type=\"radio\" name=\"send[".$image_row['image_id']."]\" value=\"2\"".(((isset($HTTP_POST_VARS['send'][$image_row['image_id']]) && $HTTP_POST_VARS['send'][$image_row['image_id']] == 2) || !isset($HTTP_POST_VARS['send'][$image_row['image_id']])) ? " checked" : "").">yes&nbsp;<input type=\"radio\" name=\"send[".$image_row['image_id']."]\" value=\"3\"".(((isset($HTTP_POST_VARS['send'][$image_row['image_id']]) && $HTTP_POST_VARS['send'][$image_row['image_id']] == 3)) ? " checked" : "").">no" : "&nbsp;")."</td>";
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"1\" onDblclick=\"this.checked=false;\"></td>";
      echo "<td><input type=\"radio\" name=\"image_list[".$image_row['image_id']."]\" value=\"0\" onDblclick=\"this.checked=false;\"></td>";
/*
  MOD VALIDATION RESULT V2
  END REPLACE
*/


Step 2
Open lang/<your language>/admin.php
At the end, just above closing ?> insert this:
Code: [Select]
/*
  MOD VALIDATION RESULT V2
  START INSERT
*/
$lang['valdiate_title'] = "Image Validation Results";
$lang['validate_yes'] = "added";
$lang['validate_no'] = "deleted";
$lang['validate_msg'] = "Message";
$lang['validate_file'] = "File";
$lang['validate_date'] = "Uploaded";
$lang['validate_status'] = "Status";
/*
  MOD VALIDATION RESULT V2
  END INSERT
*/


Step 3
Create a new template: lang/<your language>/email/validation_email.html
with the following code inside:
Code: [Select]
Dear {recipient_name},

You've uploaded to the "{site_name}" the following file(s):
{file_list}

The validation result is the following:
___________________________________________________
{list}--
Best regards, {site_name}
{site_url}


Step 4
Create a new template: lang/<your language>/email/validation_email_bit.html
with the following code inside:
Code: [Select]

{lang_file}: {file}
{lang_upload_date}: {date}
{lang_status}: {status} {image_url}
{lang_msg}: {msg}
___________________________________________________





------------- [ Appendix ] ----------------

The following tags are allowed to be used in validation_email.html template (Step 3):
{recipient_name} - will show name of the member to whom the email will be sent
{list} - a list of all validated files (parsed validation_email_bit.html template)
{file_list} - a comma separated list of validated files
{site_name} - site name from the settings
{site_url} - url to your site
{date} - date of validation

The following tags are allowed to be used in validation_email_bit.html template (Step 4):
{lang_upload_date} - text "Uploaded"
{lang_file} - text "File"
{lang_msg} - text "Message"
{lang_status} - text "Status"
{status} - "added" or "deleted"
{image_url} - a url to the image details (empty if image deleted)
{image_id} - image id
{date} - the date when file was uploaded
{file} - filename of the uploaded file
{msg} - a custom message from admin


--------------- [ FAQ ] ----------------

Q: When someone receive an email the url to the site is broken. Why?
A: This might happend on some sertain systems, to fix that, try uncomment this line in admin/validateimages.php
//        $site_url = "http://yoursite.com/4images"; // uncomment this line and update to the correct domain if your have problem with url in the email message
and change yoursite.com/4images to the correct path to your gallery

Q: Why some members dont receive any emails even though I selected "send" during validation?
A: If a member set in their profile "Do not receive emails from administrators" they will not receive validation results either.
But you can force email to be sent by commenting out this line:
        if (!$row['user_allowemails']) continue; //comment this line out to disregard member's setting not to receive emails from administrators

Q: When members receive email, the validation results list is showed in one line, without line breaks. Why?
A: When I was writing this mod I've experienced it myself, it turned out that 4images template engine (atleast in v1.7.1) removes line breaks if a template tag placed at the end of line.
To fix that, simply add one space after each last template tag on each line

Q: What exactly "Send" column does?
A: In some cases (dont ask me what) you might not want the member know if a sertain image was added or deleted, so, by selecting "no" in the "Send" column the file will not be added in the list in the email (if only one file validated and "Send" selected to "no", then no email will be sent at all to that member)

Q: What can I do if I selected a file to be added or deleted and then changed my mind and dont want do any actions to that sertain file? Is page refresh the only way?
A: Page refresh is one way, but not the only way. By double click on the "Add" or "Delete" radio button on the specific image it should "unselect" it.
Another way is click on the column name on top ("Validate" or "Delete"), ones it selected all files, click that column name again, it will unselect everything.

80
The original author of this topic is effemmess but after the hack this topic was lost. I'm just republishing it.

Update for better understanding ;) (same code as before) (14.12.2003)

Hallo allerseits!
Hello to all!

Nach langer Testerei ist es mir gelungen, die Zufallsbildfunktion zu optimieren und damit entscheidend zu beschleunigen. :)
Zeitmessungen auf meinem Produktionsserver haben eine 3-4-fache Beschleunigung dieser Funktion ergeben.
------------------------------------------------------------------------
Hello all,
after a long test-time, I?ve succeded to increase the speed for the random-image-function. It is now 3-4 times faster than before.

========================================

Mindestvoraussetzungen / minimal configuration:
- 4images 1.7
- in .../includes/constants.php:
define('SHOW_RANDOM_IMAGE', 1);
define('SHOW_RANDOM_CAT_IMAGE', 1);
- MySQL 3.23.xx oder neuer/ or newer

Was ist also zu tun / what to do:
1. f?e nachfolgenden Varianten ersetze in .../includes/functions.php dies
for all following variants replace this in .../includes/functions.php
Code: [Select]
function get_random_image_cache() {
  global $site_db, $cat_cache, $total_images;

  $random_image_cache = array();
  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

  if (SHOW_RANDOM_CAT_IMAGE) {
    $sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY RAND()";
    $result = $site_db->query($sql);
    while ($row = $site_db->fetch_array($result)) {
      $random_image_cache[$row['cat_id']] = $row;
    }
  }
  else {
    if (empty($total_images)) {
      $sql = "SELECT COUNT(*) as total_images
              FROM ".IMAGES_TABLE."
              WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql)";
      $row = $site_db->query_firstrow($sql);
      $total_images = $row['total_images'];
    }
    if (empty($total_images)) {
      return $random_image_cache;
    }
    mt_srand((double)microtime() * 1000000);
    $number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            LIMIT $number, 1";
    $random_image_cache[0] = $site_db->query_firstrow($sql);
  }
  return $random_image_cache;
}


mit einer der folgenden Varianten:
with one of the following variants:
a) optimierter Code
optimized code
Code: [Select]
function get_random_image_cache() {
  global $site_db, $cat_cache, $total_images, $session_info;


  $random_image_cache = array();
  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
  mt_srand((double)microtime() * 1000000);
  if (SHOW_RANDOM_CAT_IMAGE) {
    $temptab = (!empty($session_info['session_id'])) ? "tab_".$session_info['session_id'] : "tab_".mt_rand(0,1000000);
    $sql = "
      CREATE TEMPORARY TABLE ".$temptab." TYPE  =  HEAP
      SELECT image_id, cat_id
      FROM ".IMAGES_TABLE."
      WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql)
      ORDER  BY RAND()";
    $result = $site_db->query($sql);
    $sql = "
      SELECT DISTINCT t.image_id, t.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
      FROM ".$temptab." AS t

      LEFT JOIN ".CATEGORIES_TABLE." AS c ON t.cat_id=c.cat_id
      LEFT JOIN ".IMAGES_TABLE." AS i ON t.image_id=i.image_id
      LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
      GROUP BY t.cat_id";
    $result = $site_db->query($sql);
    while ($row = $site_db->fetch_array($result)) {
      $random_image_cache[$row['cat_id']] = $row;
    }
    $sql = "
      DROP TABLE ".$temptab;
    $result = $site_db->query($sql);
  }
  else {
    if (empty($total_images)) {
      $sql = "SELECT COUNT(*) as total_images
              FROM ".IMAGES_TABLE."
              WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql)";
      $row = $site_db->query_firstrow($sql);
      $total_images = $row['total_images'];
    }
    if (empty($total_images)) {
      return $random_image_cache;
    }
    $number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            LIMIT $number, 1";
    $random_image_cache[0] = $site_db->query_firstrow($sql);
  }
  return $random_image_cache;
}


b) optimierter Code mit Zeitmessung f?ins
optimized code for measuring times for admins
Code: [Select]
function get_random_image_cache() {
  global $site_db, $cat_cache, $total_images, $session_info, $user_info;

  $random_image_cache = array();
  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
  if ($user_info['user_level'] >=ADMIN){
    $time1 = getmicrotime();
  }
  mt_srand((double)microtime() * 1000000);
  if (SHOW_RANDOM_CAT_IMAGE) {
    $temptab = (!empty($session_info['session_id'])) ? "tab_".$session_info['session_id'] : "tab_".mt_rand(0,1000000);
    $sql = "
      CREATE TEMPORARY TABLE ".$temptab." TYPE  =  HEAP
      SELECT image_id, cat_id
      FROM ".IMAGES_TABLE."
      WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql)
      ORDER  BY RAND()";
    $result = $site_db->query($sql);
    $sql = "
      SELECT DISTINCT t.image_id, t.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
      FROM ".$temptab." AS t

      LEFT JOIN ".CATEGORIES_TABLE." AS c ON t.cat_id=c.cat_id
      LEFT JOIN ".IMAGES_TABLE." AS i ON t.image_id=i.image_id
      LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
      GROUP BY t.cat_id";
    $result = $site_db->query($sql);
    while ($row = $site_db->fetch_array($result)) {
      $random_image_cache[$row['cat_id']] = $row;
    }
    $sql = "
      DROP TABLE ".$temptab;
    $result = $site_db->query($sql);
  }
  else {
    if (empty($total_images)) {
      $sql = "SELECT COUNT(*) as total_images
              FROM ".IMAGES_TABLE."
              WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql)";
      $row = $site_db->query_firstrow($sql);
      $total_images = $row['total_images'];
    }
    if (empty($total_images)) {
      return $random_image_cache;
    }
    $number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            LIMIT $number, 1";
    $random_image_cache[0] = $site_db->query_firstrow($sql);
  }
  if ($user_info['user_level'] >=ADMIN){
    $time2 = getmicrotime();
    $timex    = $time2 - $time1;
    print($timex);
  }
  return $random_image_cache;
}


c) alter Code mit Zeitmessung
old code for measuring times for admins
Code: [Select]
function get_random_image_cache() {
  global $site_db, $cat_cache, $total_images, $session_info, $user_info;

  $random_image_cache = array();
  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
  if ($user_info['user_level'] >=ADMIN){
    $time1 = getmicrotime();
  }
  mt_srand((double)microtime() * 1000000);
  if (SHOW_RANDOM_CAT_IMAGE) {
    $sql = "SELECT DISTINCT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY RAND()";
    $result = $site_db->query($sql);
    while ($row = $site_db->fetch_array($result)) {
      $random_image_cache[$row['cat_id']] = $row;
    }
  }
  else {
    if (empty($total_images)) {
      $sql = "SELECT COUNT(*) as total_images
              FROM ".IMAGES_TABLE."
              WHERE image_active = 1 AND cat_id NOT IN ($cat_id_sql)";
      $row = $site_db->query_firstrow($sql);
      $total_images = $row['total_images'];
    }
    if (empty($total_images)) {
      return $random_image_cache;
    }
    $number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

    $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
            LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
            WHERE i.image_active = 1 AND i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id
            LIMIT $number, 1";
    $random_image_cache[0] = $site_db->query_firstrow($sql);
  }
  if ($user_info['user_level'] >=ADMIN){
    $time2 = getmicrotime();
    $timex    = $time2 - $time1;
    print($timex);
  }
  return $random_image_cache;
}


F? Varianten mit Zeitmessung b) und c) muߠnoch folgende Funktion in die functions.php eingef?rden (falls sie nicht schon hier existiert:
For the variants with measuring times b) and c) the following function (if not yet exists) must be added to functions.php:
Code: [Select]
function getmicrotime(){
    list($usec, $sec) = explode(" ",microtime());
    return ((float)$usec + (float)$sec);
}



Das wars schon...
Wer also mal die Zeit (nur f?se Funktion) messen will, kann das gerne mal tun und seine Ergebnisse hier kund tun.
-----------------------------------------------------------------------------------
Thats alll...
If you measured the times you may publish the result in this thread.
Meine Zeitmessung / my speed comaprison:
Server: AMD XP 1,8 GHz, 256 MB RAM, 120 GB HDD
ca. 12000 Bilder, 205 Kategorien, 2760 registrierte User
Code: [Select]
                     alt/old                 neu/new
1  User                             
2  User            1,855-1,980            0,585-0,600
3  User
5  User                                   0,605-0,611
10 User                                   0,6-1,05
20 User
30 User

bye
effemmess

PS: tomorrow also in english available...
and now the doc is also in english available... ;)

81
Mods & Plugins (Releases & Support) / [MOD] Last comments v1.2.0
« on: May 09, 2005, 07:38:44 AM »
This mod will show last comments.
I've split this mod on two parts:
  • Part 1 - last comments on home page (or any other pages)
  • Part 2 - A separate page with list of all comments, with paging
Works with 4images v1.7/1.7.1


-------- [ Part 1 ] --------

---------- [ Changed files ] ----------

index.php
lang/<your language>/main.php
templates/<your template>/home.html



---------- [ New file ] ----------

templates/<your template>/last_comment_bit.html

---------- [ Installation ] ----------

Step 1
Open index.php
Find:
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

Insert above:/*
  MOD LAST COMMENTS
  START INSERT
*/
//Settings
$num 7//how many comments to show
$thumb_size 48//max dim of thumbnails in pixels
$text_len 200//max lenght of the text to show (bbcode and html are counted too)
//End settings

$last_comments "";
$additional_sql "";
if (!empty(
$additional_image_fields))
{
  foreach (
$additional_image_fields as $key => $val)
  {
    
$additional_sql .= ", i.".$key;
  }
}
if (!empty(
$additional_user_fields))
{
  foreach (
$additional_user_fields as $key => $val)
  {
    
$additional_sql .= ", s.".$key." as comment_".$key.", u.".$key." as image_user_".$key;
  }
}
$sql "SELECT c.image_id, c.comment_id, c.user_id as comment_user_id, c.user_name as guest_user_name, c.comment_headline, c.comment_text, c.comment_date, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file".get_user_table_field(", u.""user_name")." as user_name".get_user_table_field(", s.""user_name")." as comment_user_name $additional_sql
        FROM "
.COMMENTS_TABLE." c
        LEFT JOIN "
.IMAGES_TABLE." i ON i.image_id = c.image_id
        LEFT JOIN "
.USERS_TABLE." u ON ".get_user_table_field("u.""user_id")." = i.user_id
        LEFT JOIN "
.USERS_TABLE." s ON ".get_user_table_field("s.""user_id")." = c.user_id
        WHERE i.image_active = 1 AND i.image_allow_comments = 1 AND i.cat_id NOT IN ("
.get_auth_cat_sql('auth_readcomment''NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewcat''NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewimage''NOTIN').")
        ORDER BY c.comment_date DESC
        LIMIT "
.$num;
$result $site_db->query($sql);
$bgcounter 1;
while (
$row $site_db->fetch_array($result))
{
  
$row_bg_number = ($bgcounter++ % == 0) ? 2;
  if (empty(
$row['image_thumb_file']))
  {
    
$thumb_file ICON_PATH."/".get_file_extension($row['image_media_file']).".gif";
  }
  else
  {
    
$thumb_file = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$row['cat_id']."/".$row['image_thumb_file'];
  }
  
$thumb_info = @getimagesize($thumb_file);
  
$width = ($thumb_info[0]) ? $thumb_info[0] : $thumb_size;
  
$height = ($thumb_info[1]) ? $thumb_info[1] : $thumb_size;
  if (
$width $thumb_size && $height $thumb_size)
  {
    
$ratio $width $height;
    if (
$ratio 1) {
      
$new_width $thumb_size;
      
$new_height round(($thumb_size/$width) * $height);
    }else {
      
$new_width round(($thumb_size/$height) * $width);
      
$new_height $thumb_size;
    }
  }
  else
  {
    
$new_width $width;
    
$new_height $height;
  }
  
$view_image true;
  
$thumb "<img src=\"".$thumb_file."\" border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
/*
  $view_image = check_permission('auth_viewcat', $row['cat_id']);
  $thumb = "<img src=\"".$thumb_file."\"".(($view_image) ? "" : " onClick=\"alert('".(($lang['auth_alert'][$cat_id]) ? $lang['auth_alert'][$cat_id] : $lang['auth_alert']['default'])."');\"")." border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
*/
  
$image_user_name = ($row['user_id'] != GUEST) ? $row['user_name'] : $lang['userlevel_guest'];
  
$image_user_url = ($row['user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['user_id']) : "";
  
$comment_user_name = ($row['comment_user_id'] == GUEST) ? ((empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : $row['guest_user_name']) : $row['comment_user_name'];
  
$comment_user_url = ($row['comment_user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['comment_user_id']) : "";
  
$text $row['comment_text'];
  if (
strlen($text) > $text_len)
  {
    
$text substr($text0$text_len)." ...";
  }
  
$site_template->register_vars(array(
    
"last_comments_more" => "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showcomments""&")."\">".$lang['last_comments_more']."</a>",
    
"comment_image" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\">".$thumb."</a>" $thumb,
    
"comment_guest" => ($row['comment_user_id'] == GUEST && !empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : "",
    
"comment_image_name" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\">".stripslashes($row['image_name'])."</a>" stripslashes($row['image_name']),
    
"image_cat_name" => (check_permission('auth_viewcat'$row['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id'])."\">".$cat_cache[$row['cat_id']]['cat_name']."</a>" $cat_cache[$row['cat_id']]['cat_name'],
    
"image_user_name" =>   ($image_user_url) ? "<a href=\"".$image_user_url."\">".$image_user_name."</a>" $image_user_name,
    
"image_user_url" => $image_user_url,
    
"image_user_id" => $row['user_id'],
    
"comment_user_name" => ($comment_user_url) ? "<a href=\"".$comment_user_url."\">".$comment_user_name."</a>" $comment_user_name,
    
"comment_user_url" => $comment_user_url,
    
"comment_user_id" => $row['comment_user_id'],
    
"comment_headline" => format_text($row['comment_headline'], 0$config['wordwrap_comments'], 00),
    
"comment_text" => format_text($text$config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
    
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $row['comment_date']),
    
"comment_image_openwindow" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\"  onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>" $thumb,
    
"comment_image_name_openwindow" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\"  onclick=\"opendetailwindow()\" target=\"detailwindow\">".stripslashes($row['image_name'])."</a>" stripslashes($row['image_name']),
    
"row_bg_number" => $row_bg_number
  
));
  
$additional_field_array = array();
  if (!empty(
$additional_image_fields))
  {
    foreach (
$additional_image_fields as $key => $val)
    {
      
$additional_field_array[$key] = (!empty($row[$key])) ? format_text($row[$key], 1) : REPLACE_EMPTY;
      
$additional_field_array['lang_'.$key] = $val[0];
    }
  }
  if (!empty(
$additional_user_fields))
  {
    foreach (
$additional_user_fields as $key => $val)
    {
      
$additional_field_array["comment_".$key] = (!empty($row["comment_".$key])) ? format_text($row["comment_".$key], 1) : REPLACE_EMPTY;
      
$additional_field_array["image_user_".$key] = (!empty($row["image_user_".$key])) ? format_text($row["image_user_".$key], 1) : REPLACE_EMPTY;
      
$additional_field_array['lang_user_'.$key] = $val[0];
    }
  }
  if (!empty(
$additional_field_array))
  {
    
$site_template->register_vars($additional_field_array);
  }
  
$last_comments .= $site_template->parse_template("last_comment_bit");
}
/*
if (empty($last_comments))
{
  $last_comments = $lang['no_comments'];
}
*/
$site_template->register_vars(array(
  
"lang_last_comments" => $lang['last_comments'],
  
"last_comments" => $last_comments
));
/*
  MOD LAST COMMENTS
  START INSERT
*/
(edit settings on top of the inserted code)


Step 2
Open lang/<your language>/main.php
At the end, above closing ?> insert:$lang['last_comments'] = "Last comments";
$lang['last_comments_more'] = "More comments";



Step 3
Open templates/<your template>/home.html
Insert in the place where you want to show last comments:
Code: (template) [Select]
{if last_comments}
                  <table width="450" 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" colspan="5">{lang_last_comments}</td>
                          </tr>
                          {last_comments}
                        </table>
                      </td>
                    </tr>
                  </table>
                  <br />
{endif last_comments}
(this is just an example based on default template)


Step 4
Create a new template templates/<your template>/last_comment_bit.html with the folowing code:
Code: (template) [Select]
              <TR class="row{row_bg_number}">
                <TD width="50" height="50" align="center" rowspan="2">
                  {comment_image}
                </TD>
                <TD rowspan="2" >{comment_image_name}</TD>
                <TD rowspan="2" >[{image_cat_name}]</TD>
                 <td rowspan="2" nowrap>
                  By: {comment_user_name}{if comment_guest} ({comment_guest}){endif comment_guest}<br />
                  {comment_date}
                </td>
               <TD>{comment_headline}</TD>
              </tr>
              <tr class="row{row_bg_number}">
                <TD>{comment_text}</TD>
              </TR>
(this is just an example based on default template)



----------- [ Customization ] ------------

The following new tags are avalable to use in templates/<your template>/home.html template:

{lang_last_comments} - text "Last comments"
{last_comments} - list of last comments
{last_comments_more} - link "More comments" (required Part 2)


The following tags are avalable to use in templates/<your template>/last_comment_bit.html template:

{comment_image} - thumbnail of the image
{comment_guest} - text "Guest" if comment by a guest with entered name
{comment_image_name} - name of the image
{image_cat_name} - name of the category where the image is
{image_user_name} - username of the image
{comment_user_name} - username who posted the comment
{comment_user_id} - userid who posted the comment
{comment_headline} - headline of the comment
{comment_text} - the comment text
{comment_date} - the date when comment was posted
{row_bg_number} - number 1 or 2, needed for comment class style

New since v1.1.0:

{comment_user_url} - address to user profile for comment user
{image_user_url} - address to user profile for image user
{image_user_id} - image user ID
{lang_additionalImageFieldName} - text for additional image field
{additionalImageFieldName} - text for additional image field
{lang_user_additionalUserFieldName} - text for additional user field
{comment_additionalUserFieldName} - additional user field for comment user
{image_user_additionaUserFieldName} - additional user field for image user

New since v1.2.0:

{comment_image_openwindow} - thumbnail of the image with a link opens in new window
{comment_image_name_openwindow} - name of the image with a link opens in new window.

82
As many of you know 4images has a build-in categories dropdown form on upload page if u access it without specifying a category id (http://example.com/4images/member.php?action=uploadform)
Its all good, but if u have different upload permissions for the categories, visitor might get upset if they select a category, select a file, hit upload button and see error messages that sais "you dont have permission to upload in that category"... In other words, the build-in dropdown form does not show which category is allowed for uploading.

This mod will fix that issue, it will show in different colors the categories with upload permissions and without:




--------- [ Changed files ] -----------

member.php
includes/functions.php
templates/<your template>/style.css
templates/<your template>/member_uploadform.html
(optional)



----------- [ Installation ] -------------

Step 1
Open member.php
Find:
Code: [Select]
    "cat_name" => ($cat_id != 0) ? htmlspecialchars($cat_cache[$cat_id]['cat_name']) : get_category_dropdown($cat_id),Replace it with:
Code: [Select]
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  ORIGINAL LINE:
    "cat_name" => ($cat_id != 0) ? htmlspecialchars($cat_cache[$cat_id]['cat_name']) : get_category_dropdown($cat_id),
*/
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  BEGIN REPLACE
*/
//    "cat_name" => get_category_dropdown_upload($cat_id),
    "cat_name" => ($cat_id != 0 && (!isset($HTTP_POST_VARS['showdropdown']))) ? htmlspecialchars($cat_cache[$cat_id]['cat_name']) : get_category_dropdown_upload($cat_id)."<input type=\"hidden\" name=\"showdropdown\" value=\"1\">",
    "cat_name_required" => addslashes(preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['category']), $lang['field_required'])),
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  END REPLACE
*/



Step 2
Open includes/functions.php
At the end, above closing ?> insert:
Code: [Select]
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  BEGIN INSERT
*/
function get_category_dropdown_upload_bits($cat_id = 0, $cid = 0, $depth = 1)
{
  global $site_db, $drop_down_cat_cache, $cat_cache, $config;

  if (!isset($drop_down_cat_cache[$cid]))
  {
    return "";
  }
  $category_list = "";
  foreach ($drop_down_cat_cache[$cid] as $key => $category_id)
  {
    if (check_permission("auth_viewcat", $category_id))
    {
      if (check_permission("auth_upload", $category_id))
      {
        $disable = 0;
      }
      else
      {
        $disable = 1;
      }
      $category_list .= "<option value=\"".(($disable) ? 0 : $category_id)."\"";
      if ($cat_id == $category_id)
      {
        $category_list .= " selected=\"selected\"";
      }
      if ($disable)
      {
        if (($cat_cache[$category_id]['cat_parent_id'] == 0))
        {
          $category_list .= " class=\"dropdowndisable\""; //upload not avalable and this is a main category
        }
        else
        {
          $category_list .= " class=\"dropdowndisable\""; //upload not avalable
        }
      }
      else
      {
        if (($cat_cache[$category_id]['cat_parent_id'] == 0))
        {
//          $category_list .= " class=\"dropdownmarker\""; //upload avalable and this is a main category
        }
        else
        {
//        $category_list .= " class=\"dropdownok\""; //upload avalable
        }
      }

//      $category_list .= ">".(($disable) ? "- " : "+ ");
      $category_list .= ">";
      if ($depth > 1)
      {
        $category_list .= str_repeat("--", $depth - 1)." ";
      }
      $category_list .= $cat_cache[$category_id]['cat_name']."</option>\n";
      $category_list .= get_category_dropdown_upload_bits($cat_id, $category_id, $depth + 1);
    }
  }
  unset($drop_down_cat_cache[$cid]);
  return $category_list;
}
function get_category_dropdown_upload($cat_id = 0)
{
  global $lang, $drop_down_cat_cache, $cat_parent_cache;
  $category = "\n<select name=\"cat_id\" class=\"categoryselect\">\n";
  $category .= "<option value=\"0\">".$lang['select_category']."</option>\n";
  $category .= "<option value=\"0\">---------------------------------------------------------</option>\n";
  $drop_down_cat_cache = array();
  $drop_down_cat_cache = $cat_parent_cache;
  $category .= get_category_dropdown_upload_bits($cat_id);
  $category .= "</select>\n";
  return $category;
}
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  END INSERT
*/



Step 3
Open templates/<your template>/style.css
Add this block:
Code: [Select]
/* parent category, not allowed upload */
.dropdownmarkerdisable {
  font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
  background-color: #EEEEEE;
  color: #A7A7A7;
  font-size: 11px;
}

/* child category, not allowed upload */
.dropdowndisable {
  font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
  color: #BEBEBE;
  font-size: 11px;
}

/* child category, allowed upload */
.dropdownok {
  font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
  color: #136c99;
  font-size: 11px;
}
(the style is based on default template)



Step 4
This is an optional step. It will show an alert message if visitor selected a category where they are not allowed upload in to.
Open templates/<your template>/member_uploadform.html
Insert inside <form> this:
Code: [Select]
onsubmit="if(cat_id.value==0){alert('{cat_name_required}');return false;}"In the default template the result would be the following:
Quote
<form method="post" action="{url_member}" enctype="multipart/form-data" onsubmit="if(cat_id.value==0){alert('{cat_name_required}');return false;} uploadbutton.disabled=true;">



--------- [ Tweaks ] ----------

  • If you would like to see categories dropdown even if a category id specifyed (http://example.com/4images/member.php?action=uploadform&cat_id=123) then in Step 1 replace
    Code: [Select]
    //    "cat_name" => get_category_dropdown_upload($cat_id),
        "cat_name" => ($cat_id != 0 && (!isset($HTTP_POST_VARS['showdropdown']))) ? htmlspecialchars($cat_cache[$cat_id]['cat_name']) : get_category_dropdown_upload($cat_id)."<input type=\"hidden\" name=\"showdropdown\" value=\"1\">",
    With this:
    Code: [Select]
        "cat_name" => get_category_dropdown_upload($cat_id),
    //    "cat_name" => ($cat_id != 0 && (!isset($HTTP_POST_VARS['showdropdown']))) ? htmlspecialchars($cat_cache[$cat_id]['cat_name']) : get_category_dropdown_upload($cat_id)."<input type=\"hidden\" name=\"showdropdown\" value=\"1\">",


  • If you would like see different styles for allowed upload parent categories and allowed upload child categories (subcategories), uncomment commented lines in Step 2 (read the comments for more info which line uses when)


NOTE:
Opera users will see dropdown with one color, because Opera does not support style for individual items in the dropdown.

83
Mods & Plugins (Releases & Support) / [MOD] Download limit v1.0.1
« on: April 30, 2005, 07:03:23 PM »
Before the hack we had "Download limit" mod, I belive it was made by rproctor :?: At that time I didnt need such mod, so I didnt install it, and now its lost after the hack...

Here is my version of that mod. With this mod admin can set download limit per XX hours. The XX time begin count after first image download.

Tested on 4images v1.7 - v1.7.6


----------- [ Changed files ] -------------

details.php
download.php
admin/settings.php
includes/db_field_definitions.php
includes/page_header.php
includes/sessions.php
lang/<your language>/admin.php
lang/<your language>/main.php
templates/<your template>/details.html
(or any other template)


------------- [ Installation ] --------------

NOTE: if you see a 4images version number next to a step, it means, that particular step meant for that 4images version only and if you have different version, you should skip this step and see if next step is for your version.

Step 1
Open details.php
Find:
Code: [Select]
show_image($image_row, $mode, 0, 1);Insert ↑ABOVE↑:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
if ($msg_error = $site_sess->get_session_var("msg_error"))
{
  $msg .= ((empty($msg)) ? "" : "<br />").stripslashes($msg_error);
  $site_sess->drop_session_var("msg_error");
}
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


Step 2
Open download.php
Find:
Code: [Select]
$user_access = get_permission();Insert ↓BELOW↓:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
$dl = 0;
function check_dl_limit($dl)
{
  global $user_info, $config;
  if ($user_info['user_level'] != ADMIN && $user_info['user_dl_limit'] != -1 && $user_info['user_dl_limit'] && time() - $user_info['user_dl_time'] <= 60*60*$config['user_dl_time'] && $user_info['user_dl_count'] + $dl >= $user_info['user_dl_limit'])
  {
    return false;
  }
  elseif ($user_info['user_level'] != ADMIN && $user_info['user_dl_limit'] != -1 && $user_info['user_dl_limit'] && time() - $user_info['user_dl_time'] > 60*60*$config['user_dl_time'] && $dl >= $user_info['user_dl_limit'])
  {
    return false;
  }
  return true;
}
function update_dl_limit($dl)
{
  global $user_info, $site_db, $site_sess, $config;
  if ($user_info['user_level'] == ADMIN) return;
  $time = time();
  if (!$user_info['user_dl_time'] || $time - $user_info['user_dl_time'] > 60*60*$config['user_dl_time'])
  {
    $time_sql = ", user_dl_time = ".$time;
    $user_info['user_dl_count'] = $dl;
    $user_info['user_dl_time'] = $time;
  }
  else
  {
    $time_sql = "";
    $user_info['user_dl_count'] += $dl;
  }
  if ($user_info['user_level'] > GUEST)
  {
    $sql = "UPDATE ".USERS_TABLE."
            SET user_dl_count = ".$user_info['user_dl_count'].$time_sql."
            WHERE user_id = ".$user_info['user_id'];
    $site_db->query($sql);
  }
  $site_sess->set_cookie_data('data', base64_encode($user_info['user_dl_count']." ".$user_info['user_dl_time']), 1, 60*60*$config['user_dl_time']);
}
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


Step 2.1
Find:
Code: [Select]
    while ($image_row = $site_db->fetch_array($result)) {Insert ↓BELOW↓:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
      if (!check_dl_limit($dl)) break;
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


Step 2.2
Find:
Code: [Select]
        $file_added = 1;Insert ↑ABOVE↑:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
        $dl++;
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


Step 2.3 (v1.7/v1.7.1)
Find:
Code: [Select]
      $file['file_size'] = strlen($file['file_data']);
    }
    else {
      header("Location: ".$site_sess->url($url, "&"));
Replace it with:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  END ORIGINAL CODE BLOCK
*/

/*
  MOD DOWNLOAD LIMIT
  BEGIN REPLACE
*/
      $file['file_size'] = strlen($file['file_data']);
    }
    else {
      if (!check_dl_limit(0))
      {
        $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
      }
      header("Location: ".$site_sess->url($url, "&"));
/*
  MOD DOWNLOAD LIMIT
  END REPLACE
*/


Step 2.3 (v1.7.2)
Find:
Code: [Select]
      $file['file_data'] = $zipfile->send(time().".zip");
      exit;
    }
    else {
      redirect($url);
Replace with:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN REPLACE
*/
      $file['file_data'] = $zipfile->send(time().".zip");
      exit;
    }
    else {
      if (!check_dl_limit(0))
      {
        $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
      }
      redirect($url);
/*
  MOD DOWNLOAD LIMIT
  END REPLACE
*/


Step 2.3 (v1.7.6)
Find:
Code: [Select]
      redirect("lightbox.php?empty=1");Insert ↑ABOVE↑:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT ABOVE
*/
      if (!check_dl_limit(0))
      {
        $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
      }
/*
  MOD DOWNLOAD LIMIT
  END INSERT ABOVE
*/


Step 2.4 (v1.7/v1.7.1)
Find:
Code: [Select]
  $remote_url = 0;Insert ↑ABOVE↑:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
  if (!check_dl_limit(0))
  {
    $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/


Step 2.4 (v1.7.2 - v1.7.x)
Find:
Code: [Select]
  $remote_url = 0;Insert ↑ABOVE↑:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
  if (!check_dl_limit(0))
  {
    $site_sess->set_session_var("msg_error", addslashes($lang['dl_limit_reached']));
    redirect($url);
    exit;
  }
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/


Step 2.5 (v1.7/v1.7.1)
Find:
Code: [Select]
  if (!empty($file['file_path'])) {Insert ↓BELOW↓:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
  $dl++;
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


Step 2.5 (v1.7.2 - v1.7.x)
Find:
Code: [Select]
  if (!empty($file['file_path'])) {Insert ↓BELOW↓:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
  $dl++;
  update_dl_limit($dl);
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/


Step 2.6 (v1.7/v1.7.1)
Find:
Code: [Select]
    if ($remote_url) {Insert ↓BELOW↓:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  START INSERT
*/
      update_dl_limit($dl);
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/


Step 2.7 (v1.7/v1.7.1)
Find:
Code: [Select]
if (!empty($file['file_data'])) {Insert ↓BELOW↓:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  START INSERT
*/
   update_dl_limit($dl);
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/


Step 2.8
Find:
Code: [Select]
    if ($file_added) {Insert below::
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
      update_dl_limit($dl);
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/



Step 3
Open admin/settings.php
Find:
Code: [Select]
  show_form_footer($lang['save_changes'], "", 2);Insert ↑ABOVE↑:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
  show_table_separator($setting_group[XX], 2, "#setting_group_XX");
  show_setting_row("user_dl_limit");
  show_setting_row("user_dl_time");
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/
Replace XX with 8 if u havent install any mods that changed this file, othwise look up the number in the the last section that starts with   show_table_separator($setting_group[ and add one to that number.
Write down that number, you will needed it in another step!



Step 4
Open includes/db_field_definitions.php
At the end, ↑ABOVE↑ closing ?> insert:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
$additional_user_fields['user_dl_limit'] = array(&$lang['user_dl_limit'], "text", 0);
$additional_user_fields['user_dl_time'] = array($lang['user_dl_time'], "text", 0);
$additional_user_fields['user_dl_count'] = array($lang['user_dl_count'], "text", 0);
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/



Step 5
Open includes/page_header.php
Find first entry of:
Code: [Select]
$site_template->register_vars(array(Insert ↑ABOVE↑:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
$left = "";
if ($user_info['user_level'] == ADMIN || $user_info['user_dl_limit'] == -1)
{
  $dl_limit = $lang['user_dl_limit_unlimited'];
}
else
{
  $t = ($config['user_dl_time']*60*60) - (time() - $user_info['user_dl_time']);
  if ($t > 0)
  {
    $years = floor($t/31536000);
    $days = floor(($t %= 31536000)/86400);
    $hours = floor(($t %= 86400)/3600);
    $minutes = floor(($t %= 3600)/60);
    $seconds = $t %= 60;
    $t = array($years, $days, $hours, $minutes, $seconds);
    $s = 0;
    for ($i = 0; $i < 5; $i++) {
      if ($t[$i]) {
        $left .= $t[$i]." ".$lang['dates_short'][($t[$i] != 1)][$i];
        $s++;
        $c = 0;
        for ($j = $i + 1; $j < 5; $j++) {
          if ($t[$j]) $c++;
        }
        $left .= " ";
      }
    }
    $left = trim ($left, " ");
  }
  if ($user_info['user_dl_limit'] > $user_info['user_dl_count'] || !$left)
  {
    $dl_limit = preg_replace("/".$site_template->start."dlcount".$site_template->end."/siU", $user_info['user_dl_count'], preg_replace("/".$site_template->start."dltottal".$site_template->end."/siU", $user_info['user_dl_limit'], preg_replace("/".$site_template->start."dltime".$site_template->end."/siU", $left, $lang['user_dl_limit_status'])));
  }
  else
  {
    $dl_limit = preg_replace("/".$site_template->start."dltime".$site_template->end."/siU", $left, $lang['user_dl_limit_reached']);
  }
}
$site_template->register_vars(array(
  "user_dl_count" => ($user_info['user_dl_limit'] == -1) ? 0 : $user_info['user_dl_count'],
  "user_dl_time" => $left,
  "user_dl_limit" => $dl_limit
));
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/



Step 6
Open includes/sessions.php
Find:
Code: [Select]
        $this->delete_old_sessions();
      }
    }
Insert ↓BELOW↓:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
    global $config;
    if ($this->user_info['user_level'] > GUEST)
    {
      if (!$this->user_info['user_dl_limit'] && $this->user_info['user_dl_limit'] != -1)
      {
        $this->user_info['user_dl_limit'] = $config['user_dl_limit'];
      }
      if (!$this->user_info['user_dl_time'])
      {
        $this->user_info['user_dl_time'] = 0;
      }
    }
 
    if ($dl = $this->read_cookie_data('data'))
    {
      $dl = explode(" ", base64_decode($dl));
      if (isset($dl[1]) && $dl[1] && $config['user_dl_time']*60*60 > (time() - $dl[1]))
      {
        $this->user_info['user_dl_time'] = $dl[1];
        $this->user_info['user_dl_count'] = (isset($dl[0]) && $dl[0]) ? $dl[0] : 0;
      }
      else
      {
        $this->user_info['user_dl_time'] = 0;
        $this->user_info['user_dl_count'] = 0;
      }
    }
    elseif ($this->user_info['user_level'] == GUEST)
    {
      $this->user_info['user_dl_count'] = 0;
      $this->user_info['user_dl_time'] = 0;
    }
    if ($this->user_info['user_level'] == GUEST)
    {
      $this->user_info['user_dl_limit'] = $config['user_dl_limit'];
    }
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/
Make sure you inserted the code below two closing brackets and one last (third) bracket must be at the end of the inserted code!



Step 7
Open lang/<your language>/admin.php
At the end, ↑ABOVE↑ closing ?> insert:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
/*-- Setting-Group XX --*/
$setting_group[XX]="User download limit";
$setting['user_dl_limit'] = "Download limit<span class=\"smalltext\"><br />set to <font color=red><b>0</b></font> for unlimited</span>";
$setting['user_dl_time'] = "Reset time<span class=\"smalltext\"><br />(in hours)</span>";
$lang['user_dl_limit'] = "Download limit<span class=\"smalltext\"><br />set to <font color=red><b>0</b></font> to use global settings<br>or <font color=red><b>-1</b></font> for unlimited</span>";
$lang['user_dl_time'] = "Start time";
$lang['user_dl_count'] = "Download count";
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/
Replace XX with the number from Step 3



Step 8
Open lang/<your language>/main.php
At the end, ↑ABOVE↑ closing ?> insert:
Code: [Select]
/*
  MOD DOWNLOAD LIMIT
  BEGIN INSERT
*/
$lang['user_dl_limit'] = "Download limit";
$lang['user_dl_time'] = "Start time";
$lang['user_dl_count'] = "Downloads count";
$lang['user_dl_limit_reached'] = "Your download quota per ".$config['user_dl_time']." hours has been reached. You won't be able download for next {dltime}";
$lang['user_dl_limit_unlimited'] = "Your download quota is unlimited";
$lang['user_dl_limit_status'] = "You have downloaded {dlcount} of {dltottal} files, allowed per ".$config['user_dl_time']." hours";
$lang['dl_limit_reached'] = "Sorry, you've reached the download limit per ".$config['user_dl_time']." hours";
$lang['dates_short'] = array(
  array("yr", "day", "hr", "min", "sec"),
  array("yrs", "days", "hrs", "min", "sec")
);
/*
  MOD DOWNLOAD LIMIT
  END INSERT
*/



Step 9
Open templates/<your template>/details.html (or any other template, i.e. user_loginform.html/user_logininfo.html)
Insert {user_dl_limit} tag in the place you want to display to the visitors the information about their download limit status. (design is your job :P)



Step 10
Download this installer.
Unpack it and upload dl_limit_install.php file into your 4images root dir.
Execute the installer by typing in your browser's address bar: http://yoursiteaddress/path/to/4images/dl_limit_install.php (make sure you've logged in as admin, otherwise it will not work)

NOTE: during the database installation u might see some "warning" messages on top of the page, that is normal and they should go away after the database updated.

84
With this mod you will be able apply category permissions including it's sub-categories.

----------- [ Installation ] ---------------
Step 1
Open admin/categories.php
Find:
Code: [Select]
  $auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];Insert below:
Code: [Select]
/*
  MOD SUBCAT PERM FROM PARENT
  BEGIN INSERT
*/
  $subcats = (isset($HTTP_POST_VARS['subcats']) && $HTTP_POST_VARS['subcats']) ? 1 : 0;
/*
  MOD SUBCAT PERM FROM PARENT
  END INSERT
*/


Step 1.1
Find:
Code: [Select]
    $msg = ($result) ? $lang['cat_edit_success'] : $lang['cat_edit_error'];Insert above:
(for 4images v1.7/1.7.1 only!)
Code: [Select]
/*
  MOD SUBCAT PERM FROM PARENT
  BEGIN INSERT
*/
    if ($subcats)
    {
      function get_subcategories_id($cat_id = 0)
      {
        global $subcat_ids, $cat_parent_cache;
     
        if (!isset($cat_parent_cache[$cat_id]))
        {
          return false;
        }
        foreach ($cat_parent_cache[$cat_id] as $key => $val)
        {
          $subcat_ids[] = $val;
          get_subcategories_id($val);
        }
        return $subcat_ids;
      }
      $subcat_ids = array();
      $subcat_ids = get_subcategories_id($cat_id);
      if (!empty($subcat_ids))
      {
        $sql = "UPDATE ".CATEGORIES_TABLE."
                SET 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 IN (".implode($subcat_ids, ",").")";
        $result = $site_db->query($sql);
      }
    }
/*
  MOD SUBCAT PERM FROM PARENT
  END INSERT
*/

(for 4images v1.7.2 and newer)
Code: [Select]
/*
  MOD SUBCAT PERM FROM PARENT
  BEGIN INSERT
*/
    if ($subcats)
    {
      $subcat_ids = array();
      $subcat_ids = get_subcategories_id($cat_id);
      if (!empty($subcat_ids))
      {
        $sql = "UPDATE ".CATEGORIES_TABLE."
                SET 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 IN (".implode($subcat_ids, ",").")";
        $result = $site_db->query($sql);
      }
    }
/*
  MOD SUBCAT PERM FROM PARENT
  END INSERT
*/

Step 1.2
Find:
Code: [Select]
  show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']);Insert above:
Code: [Select]
/*
  MOD SUBCAT PERM FROM PARENT
  BEGIN INSERT
*/
  show_radio_row("Apply to all subcategories", "subcats", $subcats);
/*
  MOD SUBCAT PERM FROM PARENT
  END INSERT
*/



That's all.
Now when you edit category permissions, you should see a new option Apply to all subcategories

85
Since v1.7.1 introduced new, optimized template engine, a little bug was created which would not allow use conditional tags inside other conditional tags:
Quote
{if blah}{if blah2}...{endif blah2}{endif blah}
the {if blah2}{endif blah2} would be ignored.
Also, in this fix I added new feature {ifno blah}{endifno blah} type of conditional tags. That condition is opposite of {if blah} meaning that code between these tags will be showed only if {blah} tag is empty.



Open includes/templates.php
Find:
Code: [Select]
    // Compile condition tags
    $template = preg_replace_callback(
        '='.preg_quote($this->start).'if\s+([A-Z0-9_]+)'.preg_quote($this->end).'(.*)'.preg_quote($this->start).'endif\s+(\\1+)'.preg_quote($this->end).'=Usi',
        array(&$this, '_compile_condition'),
        $template
    );
Replace it with:
Code: [Select]
    // Compile condition tags
    $template = preg_replace_callback(
        '='.preg_quote($this->start).'if\s+([A-Z0-9_]+)'.preg_quote($this->end).'=Usi',
        array(&$this, '_compile_condition_start'),
        $template
    );
    $template = preg_replace_callback(
        '='.preg_quote($this->start).'endif\s+([A-Z0-9_]+)'.preg_quote($this->end).'=Usi',
        array(&$this, '_compile_condition_end'),
        $template
    );
    $template = preg_replace_callback(
        '='.preg_quote($this->start).'ifno\s+([A-Z0-9_]+)'.preg_quote($this->end).'=Usi',
        array(&$this, '_compile_condition_no_start'),
        $template
    );
    $template = preg_replace_callback(
        '='.preg_quote($this->start).'endifno\s+([A-Z0-9_]+)'.preg_quote($this->end).'=Usi',
        array(&$this, '_compile_condition_no_end'),
        $template
    );

Then find:
Code: [Select]
  function _compile_condition(&$matches) {
    return '<?php if (!empty($' . trim($matches[1]) . ') && $' . trim($matches[1]) . ' != REPLACE_EMPTY): ?>' . $matches[2] . '<?php endif; ?>';
  }
Replace it with:
Code: [Select]
  function _compile_condition_start(&$matches) {
    return '<?php if (!empty($' . trim($matches[1]) . ') && $' . trim($matches[1]) . ' != REPLACE_EMPTY){ ?>';
  }
  function _compile_condition_end(&$matches) {
    return '<?php ?>';
  }
  function _compile_condition_no_start(&$matches) {
    return '<?php if (empty($' . trim($matches[1]) . ') || $' . trim($matches[1]) . ' == REPLACE_EMPTY){ ?>';
  }
  function _compile_condition_no_end(&$matches) {
    return '<?php ?>';
  }

P.S. if u dont need {ifno ..} feature, then I think it wouldn't be too dificult to figure out what needed to be removed ;)

86
This mod was created by chlee but was lost after the hack. I'm just recovering it.



I did a quick hack to list group members from usergroups.php. It is simple and need only 3 files to be modified.

Open your admin/usergroups.php and find
Code: [Select]

echo "<tr class=\"".get_row_bg()."\"><td><p><b>".$row['group_name']."</b></p></td><td><p>";
    show_text_link($lang['edit'], "usergroups.php?action=editgroup&group_id=".$row['group_id']);
    show_text_link($lang['delete'], "usergroups.php?action=removegroup&group_id=".$row['group_id']);


Add after it with this:
Code: [Select]

show_text_link($lang['list_members'], "users.php?action=findusers&user_level=-1&group_id=".$row['group_id']);


Open your lang/yourlang/admin.php and add this line to the bottom of usergroups block (or anywhere you like)
Code: [Select]

$lang['list_members'] = "list members";


Open your admin/users.php and find these:
Code: [Select]
  $user_level = intval($HTTP_POST_VARS['user_level']);

and replace those with:
Code: [Select]
  $array = array("user_level", "user_name", "user_email", "dateafter", "datebefore", "lastactionafter", "lastactionbefore", "orderby");
  foreach($array as $val)
  {
    if (!isset($HTTP_POST_VARS[$val]))
    {
      $HTTP_POST_VARS[$val] = (isset($HTTP_GET_VARS[$val])) ? $HTTP_GET_VARS[$val] : "";
    }
  }
  $group_id = trim($HTTP_GET_VARS['group_id']);
  $group_sql = "";
  if ($group_id !="") {
     $now_timestamp = time();
     $condition .= " AND group_id = $group_id AND groupmatch_startdate < $now_timestamp".
                  " AND (groupmatch_enddate > $now_timestamp OR groupmatch_enddate = 0)";
     $group_sql = " INNER JOIN ".GROUP_MATCH_TABLE." ON ".USERS_TABLE.".user_id=".GROUP_MATCH_TABLE.".user_id ";
  }
  $user_level = intval($HTTP_POST_VARS['user_level']);
  if ($user_level == 0) {
     $user_level = intval($HTTP_GET_VARS['user_level']);
  }



Find next:
Code: [Select]
  $sql = "SELECT COUNT(*) AS users
          FROM ".USERS_TABLE."
          WHERE $condition AND ".get_user_table_field("", "user_id")." <> ".GUEST;

Replace it with:
Code: [Select]
  $sql = "SELECT COUNT(*) AS users
          FROM ".USERS_TABLE.$group_sql."
          WHERE $condition AND ".USERS_TABLE.".".get_user_table_field("", "user_id")." <> ".GUEST;


Find next:
Code: [Select]
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_lastaction")."
            FROM ".USERS_TABLE."
            WHERE $condition AND ".get_user_table_field("", "user_id")." <> ".GUEST."

Replace it with:
Code: [Select]
    $sql = "SELECT ".USERS_TABLE.".".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_lastaction")."
            FROM ".USERS_TABLE.$group_sql."
            WHERE $condition AND ".USERS_TABLE.".".get_user_table_field("", "user_id")." <> ".GUEST."


Done!

87
This mod will add a minimum width/height and size requirements for new uploaded images.

----------- [ Changed files ] -------------

admin/settings.php
includes/upload.php
lang/<yourlangauge>/admin.php
lang/<yourlangauge>/main.php




----------- [ Installataion ] -------------

Step 1
Open admin/settings.php
Find:
Code: [Select]
 show_setting_row("max_thumb_width");
  show_setting_row("max_thumb_height");
  show_setting_row("max_thumb_size");
  show_setting_row("max_image_width");
  show_setting_row("max_image_height");
  show_setting_row("max_media_size");


Replace with:
Code: [Select]
 show_setting_row("max_thumb_width");
  show_setting_row("max_thumb_height");
  show_setting_row("max_thumb_size");
  show_setting_row("min_thumb_width");
  show_setting_row("min_thumb_height");
  show_setting_row("min_thumb_size");
  show_setting_row("max_image_width");
  show_setting_row("max_image_height");
  show_setting_row("max_media_size");
  show_setting_row("min_image_width");
  show_setting_row("min_image_height");
  show_setting_row("min_media_size");




Step 2
Open includes/upload.php
Find:
Code: [Select]
 var $max_size = array();

Insert below:
Code: [Select]
 var $min_width = array();
  var $min_height = array();
  var $min_size = array();



Step 2.1
Find:
Code: [Select]
   $this->max_size['media'] = $config['max_media_size'] * 1024;

Insert below:
Code: [Select]
   $this->min_width['thumb'] = $config['min_thumb_width'];
    $this->min_width['media'] = $config['min_image_width'];
    $this->min_height['thumb'] = $config['min_thumb_height'];
    $this->min_height['media'] = $config['min_image_height'];

    $this->min_size['thumb'] = $config['min_thumb_size'] * 1024;
    $this->min_size['media'] = $config['min_media_size'] * 1024;



Step 2.2
Find:
Code: [Select]
   $this->image_size = @getimagesize($this->upload_file);
    $ok = 1;


Insert below:
Code: [Select]
   if ($this->image_size[0] < $this->min_width[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_width_min']);
    }

    if ($this->image_size[1] < $this->min_height[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_height_min']);
    }



Step 2.3
Find:
Code: [Select]
 function save_file() {

Insert above:
Code: [Select]
 function check_min_filesize() {
    if ($this->HTTP_POST_FILES[$this->field_name]['size'] < $this->min_size[$this->image_type]) {
      return false;
    }
    else {
      return true;
    }
  }



Step 2.4
Find:
Code: [Select]
     if (eregi("image", $this->HTTP_POST_FILES[$this->field_name]['type'])) {

Insert above:
Code: [Select]
     if (!$this->check_min_filesize()) {
        $this->set_error($this->lang['invalid_file_size_min']);
        $ok = 0;
      }




Step 3
Open lang/<yourlangauge>/admin.php
Find:
Code: [Select]
$auto_thumbnail_resize_type_optionlist = array(

Insert above:
Code: [Select]
$setting['min_thumb_width'] = "Min. width of thumbnail in pixel";
$setting['min_thumb_height'] = "Min. heigth of thumbnail in pixel";
$setting['min_thumb_size'] = "Min. thumbnail size in KB";
$setting['min_image_width'] = "Min. image width in pixel";
$setting['min_image_height'] = "Min. image heigth in pixel";
$setting['min_media_size'] = "Min. image size in KB";




Step 4
Open lang/<yourlangauge>/main.php
At the end, above closing ?> insert this:
Code: [Select]
$lang['min_filesize'] = "Min. File Size: ";
$lang['min_imagewidth'] = "Min. Image Width: ";
$lang['min_imageheight'] = "Min. Image Height: ";
$lang['invalid_image_width_min'] = "Image width invalid";
$lang['invalid_image_height_min'] = "Image heigth invalid";
$lang['invalid_file_size_min'] = "Image size invalid";




Step 5
Download this database updater
Unpack it and upload to your 4images root diretory.
Execute it by typing in your browser http://<yoursiteaddress>/install_min_upload.php and follow the instructions.

After all this done, u should see new settings under "Upload settings" section in ACP->Settings.

P.S. your 4images administrator will not be affected by any of the upload restrictions! Test it as a regular member or as a guest.

88
This little "MOD" will log and show Most Ever Users Online 
In Version 2 added logging most members and guest online separately as well as their total number.

If u have intstalled the first version, u'll need to uninstall it first.
Please look in the next reply for the uninstall instructions.


There are only 3 files to modify:
includes/sessions.php
lang/<yourlanguage>/main.php
templates/<yourtemlplate>/whos_online.html
(I chosed this temlplate, but u can add the changes to any template(s) u wish.)


--------------- [ Installation ] ----------------


Step 1
Open includes/sessions.php
Find:
Code: [Select]
  $whos_online = $site_template->parse_template("whos_online");

Insert above:
Code: [Select]
//-----------------------------
//---Most ever users online----
//-----------------------------
  $most = explode("|", $config['most_users']);
  $most_total = explode(",", $most[0]);
  $most_registered = explode(",", $most[1]);
  $most_guests = explode(",", $most[2]);
  $update = 0;
  if ($num_total_online > $most_total[0])
  {
    $most_total[0] = $num_total_online;
    $most_total[1] = time();
    $most[0] = $most_total[0].",".$most_total[1];
    $update = 1;
  }
  if ($num_registered_online > $most_registered[0])
  {
    $most_registered[0] = $num_registered_online;
    $most_registered[1] = time();
    $most[1] = $most_registered[0].",".$most_registered[1];
    $update = 1;
  }
  if ($num_guests_online > $most_guests[0])
  {
    $most_guests[0] = $num_guests_online;
    $most_guests[1] = time();
    $most[2] = $most_guests[0].",".$most_guests[1];
    $update = 1;
  }
  if ($update) {
    $config['most_users'] = implode("|", $most);
    $sql = "UPDATE ".SETTINGS_TABLE."
            SET setting_value = '".$config['most_users']."'
            WHERE setting_name = 'most_users'";
    $site_db->query($sql);
  }
  $site_template->register_vars(array(
    "mueo" => $most_total[0],
    "mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]),
    "mueo_registered" => $most_registered[0],
    "mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]),
    "mueo_guests" => $most_guests[0],
    "mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]),
    "lang_mueo" => $lang['mueo'],
    "lang_mueo_total" => $lang['mueo_total'],
    "lang_mueo_date" => $lang['mueo_date'],
    "lang_mueo_registered" => $lang['mueo_registered'],
    "lang_mueo_guests" => $lang['mueo_guests'],
  ));
//End Most Ever Online




Step 2
Open lang/<yourlanguage>/main.php
At the very end, above closing ?> insert this:
Code: [Select]
$lang['mueo'] = "Most users ever online was";
$lang['mueo_date'] = "on";
$lang['mueo_total'] = "Total";
$lang['mueo_registered'] = "Members";
$lang['mueo_guests'] = "Guests";




Step 3
Open temlates/<yourtemplate>/whos_online.html
Insert this:
Code: [Select]
{lang_mueo}:<br />
{lang_mueo_total}: <B>{mueo}</B> {lang_mueo_date} {mueo_date}<br />
{lang_mueo_registered}: <B>{mueo_registered}</B> {lang_mueo_date} {mueo_registered_date}<br />
{lang_mueo_guests}: <B>{mueo_guests}</B> {lang_mueo_date} {mueo_guests_date}<br />
(design is your task ;))



Step 4
Download "MEUO Install v2" file
Extract it into root of your 4images directory. And run the install_mueo.php (http://yoursite/install_mueo.php)

Upload all modified files.

NOTE: first time u open any page, u might get some error messages, but after refresh everything should be fine.

89
FAQ, Tips / How can I add more allowed file extensions?
« on: April 07, 2005, 05:12:14 AM »
[UPDATE]
We have a plugin that can help: [Plugin] Valid file extensions manager
[/UPDATE]
[NOTICE]
If you are using 4images v1.7.8 make sure you applied this patch first: [1.7.8] Can't upload images with capital letters in extension(.JPG, .Png, etc)
[/NOTICE]

1) add your new file extensions in the settings Valid file extensions
2) try upload a file with your new extension.
    If no error message showed and file uploaded - you are all done :D

    If it gives you an error message, write down the mime type from the error message.
    For example possible error message when uploading .mp3 file:
Quote
Error uploading image file: example.mp3
example.mp3: Invalid file type (mp3, audio/mpg)
   In red (audio/mpg) is the mime type of the file.
    
    So, now you have the mime type. Open includes/upload_definitions.php search for $mime_type_match['ext'] where ext is your new extension (in our example the line would look like this):
Quote
$mime_type_match['mp3'] = array("audio/mpeg", "audio/x-mpeg", "audio/mp3");

    If you've found a line with your extension, then add the mime type from the error message, after a comma (dont forget use quotas)
    in our example the end result would look like this:
Quote
$mime_type_match['mp3'] = array("audio/mpeg", "audio/x-mpeg", "audio/mp3", "audio/mpg");

    If no line with your extension is present, then insert a new line at the end, above closing ?> with your extension and mime type:
Quote
$mime_type_match['mp3'] = array("audio/mpg");

3) Open templates/<your templates>/media/ folder. Make sure you have a template with name of your new extension. (in our example there should be mp3.html template)
    If there is none, then create one. I can not tell you what should be inside that template, because every extension must be handled differently, but you can look in other templates and see how they done it.

Upload definition mime_type list :

Code: [Select]
$mime_type_match['123'] = array("application/vnd.lotus-1-2-3", "application/lotus");
$mime_type_match['3dmf'] = array("x-world/x-3dmf");
$mime_type_match['3dml'] = array("text/vnd.in3d.3dml", "model/vnd.flatland.3dml", "text/vnd.in3d.3dml");
$mime_type_match['3gp'] = array("video/3gpp", "audio/3gpp");
$mime_type_match['a'] = array("application/octet-stream");
$mime_type_match['aab'] = array("application/x-authorware-bin");
$mime_type_match['aam'] = array("application/x-authorware-map");
$mime_type_match['aas'] = array("application/x-authorware-seg");
$mime_type_match['abc'] = array("text/vnd.abc");
$mime_type_match['acc'] = array("chemical/x-synopsys-accord");
$mime_type_match['acgi'] = array("text/html");
$mime_type_match['acu'] = array("application/vnd.acucobol");
$mime_type_match['aep'] = array("application/vnd.audiograph");
$mime_type_match['afl'] = array("video/animaflex");
$mime_type_match['afp'] = array("application/vnd.ibm.modcap");
$mime_type_match['ai'] = array("application/postscript");
$mime_type_match['aif'] = array("audio/aiff", "audio/x-aiff");
$mime_type_match['aifc'] = array("audio/x-aiff", "audio/aiff");
$mime_type_match['aiff'] = array("audio/x-aiff", "audio/aiff");
$mime_type_match['aim'] = array("application/x-aim");
$mime_type_match['aip'] = array("text/x-audiosoft-intra");
$mime_type_match['ani'] = array("application/x-navi-animation");
$mime_type_match['ano'] = array("application/x-annotator");
$mime_type_match['aos'] = array("application/x-nokia-9000-communicator-add-on-software");
$mime_type_match['apm'] = array("application/studiom");
$mime_type_match['apr'] = array("application/vnd.lotus-approach");
$mime_type_match['aps'] = array("application/mime");
$mime_type_match['arc'] = array("application/octet-stream");
$mime_type_match['arj'] = array("application/arj", "application/octet-stream");
$mime_type_match['art'] = array("image/x-jg");
$mime_type_match['asc'] = array("text/plain");
$mime_type_match['asd'] = array("application/astound");
$mime_type_match['asf'] = array("application/vnd.ms-asf", "video/x-ms-asf");
$mime_type_match['asm'] = array("text/x-asm");
$mime_type_match['asn'] = array("application/astound");
$mime_type_match['aso'] = array("application/vnd.accpac.simply.aso");
$mime_type_match['asp'] = array("application/x-asap", "text/asp");
$mime_type_match['asx'] = array("application/x-mplayer2", "video/x-ms-asf", "video/x-ms-asf-plugin");
$mime_type_match['au'] = array("audio/basic", "audio/x-au");
$mime_type_match['avb'] = array("application/octet-stream");
$mime_type_match['avi'] = array("video/quicktime", "application/x-troff-msvideo", "video/avi", "video/msvideo", "video/x-msvideo");
$mime_type_match['avs'] = array("video/avs-video");
$mime_type_match['avx'] = array("video/x-rad-screenplay");
$mime_type_match['bcpio'] = array("application/x-bcpio");
$mime_type_match['bh2'] = array("application/vnd.fujitsu.oasysprs");
$mime_type_match['bin'] = array("application/mac-binary", "application/macbinary", "application/octet-stream", "application/x-binary", "application/x-macbinary");
$mime_type_match['bld'] = array("application/bld");
$mime_type_match['bld2'] = array("application/bld2");
$mime_type_match['bm'] = array("image/bmp");
$mime_type_match['bmi'] = array("application/vnd.bmi");
$mime_type_match['bmp'] = array("image/bitmap", "image/bmp", "image/x-bmp", "image/x-windows-bmp");
$mime_type_match['boo'] = array("application/book");
$mime_type_match['book'] = array("application/book");
$mime_type_match['box'] = array("application/vnd.previewsystems.box");
$mime_type_match['boz'] = array("application/x-bzip2");
$mime_type_match['bpk'] = array("application/octet-stream");
$mime_type_match['bsh'] = array("application/x-bsh");
$mime_type_match['btf'] = array("image/prs.btif");
$mime_type_match['btif'] = array("image/prs.btif");
$mime_type_match['bz'] = array("application/x-bzip");
$mime_type_match['bz2'] = array("application/x-bzip2");
$mime_type_match['c'] = array("text/x-c", "text/plain");
$mime_type_match['c++'] = array("text/plain");
$mime_type_match['cal'] = array("image/x-cals");
$mime_type_match['cat'] = array("application/vnd.ms-pki.seccat");
$mime_type_match['cc'] = array("text/plain", "text/x-c");
$mime_type_match['ccad'] = array("application/clariscad");
$mime_type_match['ccn'] = array("application/x-cnc");
$mime_type_match['cco'] = array("application/x-cocoa");
$mime_type_match['cdf'] = array("application/cdf", "application/x-netcdf", "application/x-cdf");
$mime_type_match['cdkey'] = array("application/vnd.mediastation.cdkey");
$mime_type_match['cdx'] = array("chemical/x-cdx", "chemical/x-chem3d");
$mime_type_match['cer'] = array("application/pkix-cert", "application/x-x509-ca-cert");
$mime_type_match['cgi'] = array("magnus-internal/cgi");
$mime_type_match['cgm'] = array("image/cgm");
$mime_type_match['cha'] = array("application/x-chat");
$mime_type_match['chat'] = array("application/x-chat");
$mime_type_match['chm'] = array("chemical/x-chemdraw", "chemical/x-cs-chemdraw");
$mime_type_match['cif'] = array("chemical/x-cif");
$mime_type_match['cii'] = array("application/vnd.anser-web-certificate-issue-initiation");
$mime_type_match['cla'] = array("application/vnd.claymore");
$mime_type_match['class'] = array("application/java", "application/java-byte-code", "application/octet-stream", "application/x-java-class", "application/x-java.vm");
$mime_type_match['clp'] = array("application/x-msclip");
$mime_type_match['cmc'] = array("application/vnd.cosmocaller");
$mime_type_match['cmdf'] = array("chemical/x-cmdf");
$mime_type_match['cml'] = array("chemical/x-cml");
$mime_type_match['cmp'] = array("application/vnd.yellowriver-custom-menu");
$mime_type_match['cmx'] = array("application/x-cmx", "image/x-cmx");
$mime_type_match['cod'] = array("image/cis-cod");
$mime_type_match['com'] = array("text/plain", "application/octet-stream");
$mime_type_match['conf'] = array("text/plain");
$mime_type_match['config'] = array("application/x-ns-proxy-autoconfig");
$mime_type_match['cpio'] = array("application/x-cpio");
$mime_type_match['cpp'] = array("text/x-c");
$mime_type_match['cpt'] = array("application/mac-compactpro", "application/x-compactpro", "application/x-cpt");
$mime_type_match['crd'] = array("application/x-mscardfile");
$mime_type_match['crl'] = array("application/pkix-crl", "application/pkcs-crl");
$mime_type_match['crt'] = array("application/pkix-cert", "application/x-x509-ca-cert", "application/x-x509-user-cert");
$mime_type_match['csh'] = array("application/x-csh", "text/x-script.csh");
$mime_type_match['csm'] = array("chemical/x-csml");
$mime_type_match['csml'] = array("chemical/x-csml");
$mime_type_match['csp'] = array("application/vnd.commonspace");
$mime_type_match['css'] = array("text/css", "application/x-pointplus");
$mime_type_match['cst'] = array("application/vnd.commonspace");
$mime_type_match['cub'] = array("chemical/x-gaussian-cube");
$mime_type_match['curl'] = array("text/vnd.curl");
$mime_type_match['cw'] = array("application/prs.cww");
$mime_type_match['cww'] = array("application/prs.cww");
$mime_type_match['cxx'] = array("text/plain");
$mime_type_match['daf'] = array("application/vnd.Mobius.DAF");
$mime_type_match['dcm'] = array("x-lml/x-evm");
$mime_type_match['dcr'] = array("application/x-director");
$mime_type_match['dcx'] = array("image/x-dcx");
$mime_type_match['ddd'] = array("application/vnd.fujixerox.ddd");
$mime_type_match['deepv'] = array("application/x-deepv");
$mime_type_match['def'] = array("text/plain");
$mime_type_match['der'] = array("application/pkix-cert", "application/x-x509-ca-cert");
$mime_type_match['dib'] = array("image/bmp");
$mime_type_match['dic'] = array("text/plain");
$mime_type_match['dif'] = array("video/x-dv");
$mime_type_match['dir'] = array("application/x-director");
$mime_type_match['dis'] = array("application/vnd.Mobius.DIS");
$mime_type_match['dl'] = array("video/dl", "video/x-dl");
$mime_type_match['dll'] = array("application/x-msdownload");
$mime_type_match['dms'] = array("application/octet-stream");
$mime_type_match['dna'] = array("application/vnd.dna");
$mime_type_match['doc'] = array("application/msword");
$mime_type_match['dor'] = array("model/vnd.gdl", "model/vnd.gs.gdl");
$mime_type_match['dot'] = array("application/msword", "application/x-dot");
$mime_type_match['dp'] = array("application/commonground");
$mime_type_match['dpg'] = array("application/vnd.dpgraph");
$mime_type_match['dpgraph'] = array("application/vnd.dpgraph");
$mime_type_match['drw'] = array("application/drafting");
$mime_type_match['dsc'] = array("text/prs.lines.tag");
$mime_type_match['dtd'] = array("application/xml", "text/xml");
$mime_type_match['dump'] = array("application/octet-stream");
$mime_type_match['dv'] = array("video/x-dv");
$mime_type_match['dvi'] = array("application/x-dvi");
$mime_type_match['dwf'] = array("model/vnd.dwf", "drawing/x-dwf", "drawing/x-dwf");
$mime_type_match['dwg'] = array("image/vnd.dwg", "application/acad", "application/autocad", "image/vnd", "image/x-dwg");
$mime_type_match['dx'] = array("chemical/x-jcamp-dx");
$mime_type_match['dxf'] = array("image/vnd.dxf", "application/dxf", "image/x-dwg", "image/x-dxf");
$mime_type_match['dxr'] = array("application/vnd.dxr", "application/x-director");
$mime_type_match['ebk'] = array("application/x-expandedbook");
$mime_type_match['ecelp4800'] = array("audio/vnd.nuera.ecelp4800");
$mime_type_match['ecelp7470'] = array("audio/vnd.nuera.ecelp7470");
$mime_type_match['edm'] = array("application/vnd.novadigm.EDM");
$mime_type_match['edx'] = array("application/vnd.novadigm.EDX");
$mime_type_match['ei6'] = array("application/vnd.pg.osasli");
$mime_type_match['el'] = array("text/x-script.elisp");
$mime_type_match['elc'] = array("application/x-bytecode.elisp", "application/x-elc");
$mime_type_match['emb'] = array("chemical/x-embl-dl-nucleotide");
$mime_type_match['embl'] = array("chemical/x-embl-dl-nucleotide");
$mime_type_match['eml'] = array("message/rfc822");
$mime_type_match['enc'] = array("video/mpeg");
$mime_type_match['env'] = array("application/x-envoy");
$mime_type_match['eol'] = array("audio/vnd.digital-winds");
$mime_type_match['epb'] = array("application/x-epublisher");
$mime_type_match['eps'] = array("application/postscript");
$mime_type_match['es'] = array("application/x-esrehber", "audio/echospeech");
$mime_type_match['esl'] = array("audio/echospeech");
$mime_type_match['etc'] = array("application/x-earthtime");
$mime_type_match['etx'] = array("text/x-setext");
$mime_type_match['evm'] = array("x-lml/x-evm");
$mime_type_match['evy'] = array("application/envoy", "application/x-envoy");
$mime_type_match['exc'] = array("text/plain");
$mime_type_match['exe'] = array("application/octet-stream", "application/x-msdownload");
$mime_type_match['ext'] = array("application/vnd.novadigm.EXT");
$mime_type_match['ez'] = array("application/andrew-inset");
$mime_type_match['f'] = array("text/plain", "text/x-fortran");
$mime_type_match['f77'] = array("text/x-fortran");
$mime_type_match['f90'] = array("text/plain", "text/x-fortran");
$mime_type_match['faxmgr'] = array("application/x-fax-manager");
$mime_type_match['faxmgrjob'] = array("application/x-fax-manager-job");
$mime_type_match['fbs'] = array("image/vnd.fastbidsheet");
$mime_type_match['fdf'] = array("application/vnd.fdf");
$mime_type_match['fdml'] = array("text/html");
$mime_type_match['fg5'] = array("application/vnd.fujitsu.oasysgp");
$mime_type_match['fgd'] = array("application/x-director");
$mime_type_match['fh'] = array("image/x-freehand");
$mime_type_match['fh4'] = array("image/x-freehand");
$mime_type_match['fh5'] = array("image/x-freehand");
$mime_type_match['fh7'] = array("image/x-freehand");
$mime_type_match['fhc'] = array("image/x-freehand");
$mime_type_match['fif'] = array("application/fractals", "image/fif");
$mime_type_match['fli'] = array("video/fli", "video/x-fli");
$mime_type_match['flo'] = array("image/florian");
$mime_type_match['flx'] = array("text/vnd.fmi.flexstor", "text/html");
$mime_type_match['fly'] = array("text/vnd.fly");
$mime_type_match['fm'] = array("application/x-framemaker", "application/x-maker");
$mime_type_match['fmf'] = array("video/x-atomic3d-feature");
$mime_type_match['fml'] = array("application/file-mirror-list", "application/x-file-mirror-list");
$mime_type_match['for'] = array("text/plain", "text/x-fortran");
$mime_type_match['fp5'] = array("application/filemaker5");
$mime_type_match['fpx'] = array("application/vnd.netfpx", "image/vnd.fpx", "image/vnd.net-fpx", "image/x-fpx");
$mime_type_match['frame'] = array("application/x-framemaker");
$mime_type_match['frl'] = array("application/freeloader");
$mime_type_match['frm'] = array("application/vnd.ufdl", "application/vnd.xfdl", "application/x-framemaker");
$mime_type_match['fst'] = array("image/vnd.fst");
$mime_type_match['fti'] = array("application/vnd.anser-web-funds-transfer-initiation");
$mime_type_match['funk'] = array("audio/make");
$mime_type_match['fvi'] = array("video/isivideo");
$mime_type_match['fvt'] = array("video/vnd.fvt");
$mime_type_match['g'] = array("text/plain");
$mime_type_match['g3'] = array("image/g3fax");
$mime_type_match['gac'] = array("application/vnd.groove-account");
$mime_type_match['gau'] = array("chemical/x-gaussian-input");
$mime_type_match['gdb'] = array("x-lml/x-gdb");
$mime_type_match['gdl'] = array("model/vnd.gdl", "model/vnd.gs.gdl");
$mime_type_match['gif'] = array("image/gif");
$mime_type_match['gim'] = array("application/vnd.groove-identity-message");
$mime_type_match['gl'] = array("video/gl", "video/x-gl");
$mime_type_match['gph'] = array("application/vnd.FloGraphIt");
$mime_type_match['gps'] = array("application/x-gps");
$mime_type_match['gqf'] = array("application/vnd.grafeq");
$mime_type_match['gqs'] = array("application/vnd.grafeq");
$mime_type_match['grv'] = array("application/vnd.groove-injector");
$mime_type_match['gsd'] = array("audio/x-gsm");
$mime_type_match['gsm'] = array("model/vnd.gdl", "model/vnd.gs.gdl", "audio/x-gsm");
$mime_type_match['gsp'] = array("application/x-gsp");
$mime_type_match['gss'] = array("application/x-gss");
$mime_type_match['gtar'] = array("application/x-gtar");
$mime_type_match['gtm'] = array("application/vnd.froove-tool-message", "application/vnd.groove-tool-message");
$mime_type_match['gtp'] = array("application/bsi-gtp");
$mime_type_match['gtw'] = array("model/vnd.gtw");
$mime_type_match['gz'] = array("application/x-compressed", "application/x-gzip");
$mime_type_match['gzip'] = array("application/x-gzip", "multipart/x-gzip");
$mime_type_match['h'] = array("text/plain", "text/x-h");
$mime_type_match['hdf'] = array("application/x-hdf");
$mime_type_match['hdml'] = array("text/x-hdml");
$mime_type_match['help'] = array("application/x-helpfile");
$mime_type_match['hgl'] = array("application/vnd.hp-HPGL");
$mime_type_match['hh'] = array("text/plain", "text/x-h");
$mime_type_match['hlb'] = array("text/x-script");
$mime_type_match['hlp'] = array("application/hlp", "application/winhlp", "application/x-helpfile", "application/x-winhelp");
$mime_type_match['hpg'] = array("application/vnd.hp-HPGL");
$mime_type_match['hpgl'] = array("application/vnd.hp-HPGL");
$mime_type_match['hpi'] = array("application/vnd.hp-hpid");
$mime_type_match['hpid'] = array("application/vnd.hp-hpid");
$mime_type_match['hps'] = array("application/vnd.hp-hps");
$mime_type_match['hqx'] = array("application/mac-binhex40", "application/binhex", "application/binhex4", "application/mac-binhex", "application/x-binhex40", "application/x-mac-binhex40");
$mime_type_match['hta'] = array("application/hta");
$mime_type_match['htc'] = array("text/x-component");
$mime_type_match['htm'] = array("text/html");
$mime_type_match['html'] = array("text/html");
$mime_type_match['htmls'] = array("text/html");
$mime_type_match['htt'] = array("text/webviewhtml");
$mime_type_match['htx'] = array("text/html");
$mime_type_match['ic0'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic1'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic2'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic3'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic4'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic5'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic6'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic7'] = array("application/vnd.commerce-battelle");
$mime_type_match['ic8'] = array("application/vnd.commerce-battelle");
$mime_type_match['ica'] = array("application/vnd.commerce-battelle");
$mime_type_match['icc'] = array("application/vnd.commerce-battelle");
$mime_type_match['icd'] = array("application/vnd.commerce-battelle");
$mime_type_match['ice'] = array("x-conference/x-cooltalk");
$mime_type_match['icf'] = array("application/vnd.commerce-battelle");
$mime_type_match['ico'] = array("image/x-icon");
$mime_type_match['idc'] = array("text/plain");
$mime_type_match['ief'] = array("image/ief");
$mime_type_match['iefs'] = array("image/ief");
$mime_type_match['ifm'] = array("application/vnd.shana.informed.formdata");
$mime_type_match['ifs'] = array("image/ifs");
$mime_type_match['iges'] = array("model/iges", "application/iges");
$mime_type_match['igs'] = array("model/iges", "application/iges");
$mime_type_match['iif'] = array("application/vnd.shana.informed.interchange");
$mime_type_match['iii'] = array("application/x-iphone");
$mime_type_match['ima'] = array("application/x-ima");
$mime_type_match['imap'] = array("application/x-httpd-imap");
$mime_type_match['imd'] = array("application/immedia");
$mime_type_match['imp'] = array("application/vnd.accpac.simply.imp");
$mime_type_match['ims'] = array("application/immedia");
$mime_type_match['inf'] = array("application/inf");
$mime_type_match['ins'] = array("application/x-NET-Install", "application/x-insight", "application/x-internet-signup");
$mime_type_match['insight'] = array("application/x-insight");
$mime_type_match['inst'] = array("application/x-install");
$mime_type_match['ip'] = array("application/x-ip2");
$mime_type_match['ipk'] = array("application/vnd.shana.informed.package");
$mime_type_match['ips'] = array("application/x-ipscript");
$mime_type_match['ipx'] = array("application/x-ipix");
$mime_type_match['ism'] = array("model/vnd.gdl", "model/vnd.gs.gdl");
$mime_type_match['isp'] = array("application/x-internet-signup");
$mime_type_match['ist'] = array("chemical/x-isostar");
$mime_type_match['istr'] = array("chemical/x-isostar");
$mime_type_match['isu'] = array("video/x-isvideo");
$mime_type_match['it'] = array("audio/it", "audio/x-mod");
$mime_type_match['itp'] = array("application/vnd.shana.informed.formtemp");
$mime_type_match['itz'] = array("audio/x-mod");
$mime_type_match['iv'] = array("application/x-inventor");
$mime_type_match['ivf'] = array("video/x-ivf");
$mime_type_match['ivr'] = array("i-world/i-vrml");
$mime_type_match['ivy'] = array("application/x-livescreen");
$mime_type_match['jad'] = array("text/vnd.sun.j2me.app-descriptor");
$mime_type_match['jam'] = array("audio/x-jam");
$mime_type_match['jar'] = array("application/java-archive", "application/x-java-archive");
$mime_type_match['jav'] = array("text/plain", "text/x-java-source");
$mime_type_match['java'] = array("text/plain", "text/x-java-source");
$mime_type_match['jcm'] = array("application/x-java-commerce");
$mime_type_match['jdx'] = array("chemical/x-jcamp-dx");
$mime_type_match['jfif'] = array("image/jpeg", "image/pjpeg");
$mime_type_match['jfif-tbnl'] = array("image/jpeg");
$mime_type_match['jpe'] = array("image/jpeg", "image/pjpeg");
$mime_type_match['jpeg'] = array("image/jpeg", "image/pjpeg");
$mime_type_match['jpg'] = array("image/jpeg", "image/pjpeg");
$mime_type_match['jps'] = array("image/x-jps");
$mime_type_match['js'] = array("application/x-javascript", "application/x-ns-proxy-autoconfig");
$mime_type_match['jut'] = array("image/jutvision");
$mime_type_match['jvs'] = array("application/x-ns-proxy-autoconfig");
$mime_type_match['jwc'] = array("application/jwc");
$mime_type_match['kar'] = array("audio/midi", "music/x-karaoke");
$mime_type_match['kin'] = array("chemical/x-kinemage");
$mime_type_match['ksh'] = array("application/x-ksh", "text/x-script.ksh");
$mime_type_match['la'] = array("audio/nspaudio", "audio/x-nspaudio");
$mime_type_match['lak'] = array("x-lml/x-lak");
$mime_type_match['lam'] = array("audio/x-liveaudio");
$mime_type_match['latex'] = array("application/x-latex");
$mime_type_match['lcc'] = array("application/fastman");
$mime_type_match['lcl'] = array("application/x-digitalloca");
$mime_type_match['lcr'] = array("application/x-digitalloca");
$mime_type_match['lgh'] = array("application/lgh");
$mime_type_match['lha'] = array("application/lha", "application/octet-stream", "application/x-lha");
$mime_type_match['lhx'] = array("application/octet-stream");
$mime_type_match['lic'] = array("application/x-enterlicense");
$mime_type_match['licmgr'] = array("application/x-licensemgr");
$mime_type_match['list'] = array("text/plain");
$mime_type_match['list3820'] = array("application/vnd.ibm.modcap");
$mime_type_match['listafp'] = array("application/vnd.ibm.modcap");
$mime_type_match['lma'] = array("audio/nspaudio", "audio/x-nspaudio");
$mime_type_match['lml'] = array("x-lml/x-lml");
$mime_type_match['lmlpack'] = array("x-lml/x-lmlpack");
$mime_type_match['lmp'] = array("model/vnd.gdl", "model/vnd.gs.gdl");
$mime_type_match['log'] = array("text/plain");
$mime_type_match['lsf'] = array("video/x-la-asf", "video/x-ms-asf");
$mime_type_match['lsp'] = array("application/x-lisp", "text/x-script.lisp");
$mime_type_match['lst'] = array("text/plain");
$mime_type_match['lsx'] = array("text/x-la-asf", "video/x-la-asf", "video/x-ms-asf");
$mime_type_match['ltx'] = array("application/x-latex");
$mime_type_match['lvp'] = array("audio/vnd.lucent.voice");
$mime_type_match['lwp'] = array("application/vnd.lotus-wordpro");
$mime_type_match['lzh'] = array("application/octet-stream", "application/x-lzh");
$mime_type_match['lzx'] = array("application/lzx", "application/octet-stream", "application/x-lzx");
$mime_type_match['m'] = array("text/plain", "text/x-m");
$mime_type_match['m13'] = array("application/x-msmediaview");
$mime_type_match['m14'] = array("application/x-msmediaview");
$mime_type_match['m1v'] = array("video/mpeg");
$mime_type_match['m2a'] = array("audio/mpeg");
$mime_type_match['m2v'] = array("video/mpeg");
$mime_type_match['m3a'] = array("audio/mpeg");
$mime_type_match['m3u'] = array("audio/mpegurl", "audio/x-mpegurl", "audio/x-mpequrl", "audio/x-scpls", "uadio/scpls");
$mime_type_match['ma'] = array("application/mathematica-old", "application/mathematica");
$mime_type_match['mag'] = array("application/vnd.ecowin.chart");
$mime_type_match['mail'] = array("application/x-mailfolder");
$mime_type_match['maker'] = array("application/x-framemaker");
$mime_type_match['man'] = array("application/x-troff-man");
$mime_type_match['map'] = array("application/x-navimap", "magnus-internal/imagemap");
$mime_type_match['mar'] = array("text/plain");
$mime_type_match['mb'] = array("application/mathematica-old", "application/mathematica");
$mime_type_match['mbd'] = array("application/mbedlet");
$mime_type_match['mbm'] = array("image/x-epoc-mbm");
$mime_type_match['mc$'] = array("application/x-magic-cap-package-1.0");
$mime_type_match['mcd'] = array("application/vnd.mcd", "application/vnd.vectorworks", "application/mcad", "application/x-mathcad");
$mime_type_match['mcf'] = array("image/vasa", "text/mcf");
$mime_type_match['mcm'] = array("chemical/x-macmolecule");
$mime_type_match['mcp'] = array("application/netmc");
$mime_type_match['mct'] = array("application/x-mascot");
$mime_type_match['mdb'] = array("application/msaccess", "application/x-msaccess");
$mime_type_match['mdz'] = array("audio/x-mod");
$mime_type_match['me'] = array("application/x-troff-me");
$mime_type_match['med'] = array("application/x-att-a2bmusic-pu");
$mime_type_match['mes'] = array("application/x-att-a2bmusic");
$mime_type_match['mesh'] = array("model/mesh");
$mime_type_match['mht'] = array("message/rfc822");
$mime_type_match['mhtml'] = array("message/rfc822");
$mime_type_match['mi'] = array("application/x-mif");
$mime_type_match['mid'] = array("application/x-midi", "audio/mid", "audio/midi", "audio/x-mid", "audio/x-midi", "music/crescendo", "x-music/x-midi");
$mime_type_match['midi'] = array("application/x-midi", "audio/midi", "audio/x-mid", "audio/x-midi", "music/crescendo", "x-music/x-midi");
$mime_type_match['mif'] = array("application/vnd.mif", "application/x-frame", "application/x-mif");
$mime_type_match['mil'] = array("image/x-cals");
$mime_type_match['mime'] = array("message/rfc822", "www/mime");
$mime_type_match['mio'] = array("audio/x-mio");
$mime_type_match['mjf'] = array("audio/x-vnd.AudioExplosion.MjuiceMediaFile");
$mime_type_match['mjpg'] = array("video/x-motion-jpeg");
$mime_type_match['ml5'] = array("application/ml5");
$mime_type_match['mm'] = array("application/base64", "application/x-meme");
$mime_type_match['mmd'] = array("chemical/x-macromodel", "chemical/x-macromodel-input");
$mime_type_match['mme'] = array("application/base64");
$mime_type_match['mmod'] = array("chemical/x-macromodel-input");
$mime_type_match['mmr'] = array("image/vnd.fujixerox.edmics-mmr");
$mime_type_match['mng'] = array("video/x-mng");
$mime_type_match['mny'] = array("application/x-msmoney");
$mime_type_match['moc'] = array("application/x-mocha");
$mime_type_match['mocha'] = array("application/x-mocha");
$mime_type_match['mod'] = array("audio/mod", "audio/x-mod");
$mime_type_match['mof'] = array("application/x-yumekara");
$mime_type_match['mol'] = array("chemical/x-mdl-molfile", "chemical/x-mdl-molfile");
$mime_type_match['moov'] = array("video/quicktime");
$mime_type_match['mop'] = array("chemical/x-mopac-input");
$mime_type_match['mov'] = array("video/quicktime");
$mime_type_match['movie'] = array("video/x-sgi-movie");
$mime_type_match['mp2'] = array("video/mpeg", "audio/mpeg", "audio/x-mpeg", "video/x-mpeg", "video/x-mpeg2a");
$mime_type_match['mp2a'] = array("audio/x-mpeg2");
$mime_type_match['mp2v'] = array("video/x-mpeg2");
$mime_type_match['mp3'] = array("video/mpeg", "audio/mp3", "audio/mpeg", "audio/mpeg3", "audio/mpg", "audio/x-mpeg", "audio/x-mpeg-3", "video/x-mpeg");
$mime_type_match['mp3url'] = array("audio/x-mpegurl");
$mime_type_match['mpa'] = array("video/mpeg", "audio/mpeg");
$mime_type_match['mpa2'] = array("audio/x-mpeg2");
$mime_type_match['mpc'] = array("application/x-project");
$mime_type_match['mpd'] = array("application/vnd.ms-project");
$mime_type_match['mpe'] = array("video/mpeg");
$mime_type_match['mpeg'] = array("video/mpeg");
$mime_type_match['mpf'] = array("text/vnd.ms-mediapackage", "text/vnd-mediapackage");
$mime_type_match['mpg'] = array("video/mpegaudio/mpeg");
$mime_type_match['mpga'] = array("audio/mpeg");
$mime_type_match['mpp'] = array("application/vnd.ms-project");
$mime_type_match['mps'] = array("application/x-mapserver", "video/x-mpeg-system");
$mime_type_match['mpt'] = array("application/vnd.ms-project", "application/x-project");
$mime_type_match['mpv'] = array("application/x-project", "video/mpeg");
$mime_type_match['mpv2'] = array("video/mpeg", "video/x-mpeg2");
$mime_type_match['mpx'] = array("application/x-project");
$mime_type_match['mpy'] = array("application/vnd.ibm.MiniPay");
$mime_type_match['mrc'] = array("application/marc");
$mime_type_match['mrl'] = array("text/x-mrml");
$mime_type_match['ms'] = array("application/x-troff-ms");
$mime_type_match['msf'] = array("application/vnd.epson.msf");
$mime_type_match['msh'] = array("model/mesh");
$mime_type_match['msl'] = array("application/vnd.Mobius.MSL");
$mime_type_match['msm'] = array("model/vnd.gdl", "model/vnd.gs.gdl");
$mime_type_match['mss'] = array("audio/mss");
$mime_type_match['msv'] = array("application/x-mystars-view");
$mime_type_match['mts'] = array("model/vnd.mts", "application/metastream");
$mime_type_match['mus'] = array("application/vnd.musician");
$mime_type_match['mv'] = array("video/x-sgi-movie");
$mime_type_match['mwc'] = array("application/vnd.dpgraph");
$mime_type_match['mxs'] = array("application/vnd.triscape.mxs");
$mime_type_match['my'] = array("audio/make");
$mime_type_match['mzz'] = array("application/x-vnd.AudioExplosion.mzz");
$mime_type_match['nap'] = array("image/naplps");
$mime_type_match['naplps'] = array("image/naplps");
$mime_type_match['nb'] = array("application/mathematica");
$mime_type_match['nc'] = array("application/x-netcdf");
$mime_type_match['nclk'] = array("text/html");
$mime_type_match['ncm'] = array("application/vnd.nokia.configuration-message");
$mime_type_match['ndb'] = array("x-lml/x-ndb");
$mime_type_match['ndl'] = array("application/vnd.lotus-notes");
$mime_type_match['nif'] = array("application/x-nif", "image/x-niff");
$mime_type_match['niff'] = array("image/x-niff");
$mime_type_match['nix'] = array("application/x-mix-transfer");
$mime_type_match['nls'] = array("text/nls");
$mime_type_match['nml'] = array("application/vnd.enliven");
$mime_type_match['nmz'] = array("application/x-scream");
$mime_type_match['nnd'] = array("application/vnd.noblenet-directory");
$mime_type_match['nns'] = array("application/vnd.noblenet-sealer");
$mime_type_match['nnw'] = array("application/vnd.noblenet-web");
$mime_type_match['npx'] = array("application/x-netfpx");
$mime_type_match['ns2'] = array("application/vnd.lotus-notes");
$mime_type_match['ns3'] = array("application/vnd.lotus-notes");
$mime_type_match['ns4'] = array("application/vnd.lotus-notes");
$mime_type_match['nsc'] = array("application/x-conference");
$mime_type_match['nsf'] = array("application/vnd.lotus-notes");
$mime_type_match['nsg'] = array("application/vnd.lotus-notes");
$mime_type_match['nsh'] = array("application/vnd.lotus-notes");
$mime_type_match['ntf'] = array("application/vnd.lotus-notes");
$mime_type_match['nvd'] = array("application/x-navidoc");
$mime_type_match['nvm'] = array("application/x-navimap");
$mime_type_match['nws'] = array("message/rfc822");
$mime_type_match['o'] = array("application/octet-stream");
$mime_type_match['oa2'] = array("application/vnd.fujitsu.oasys2");
$mime_type_match['oa3'] = array("application/vnd.fujitsu.oasys3");
$mime_type_match['oas'] = array("application/vnd.fujitsu.oasys");
$mime_type_match['obd'] = array("application/x-msbinder");
$mime_type_match['oda'] = array("application/oda");
$mime_type_match['omc'] = array("application/x-omc");
$mime_type_match['omcd'] = array("application/x-omcdatamaker");
$mime_type_match['omcr'] = array("application/x-omcregerator");
$mime_type_match['or2'] = array("application/vnd.lotus-organizer");
$mime_type_match['or3'] = array("application/vnd.lotus-organizer");
$mime_type_match['org'] = array("application/vnd.lotus-organizer");
$mime_type_match['orq'] = array("application/ocsp-request");
$mime_type_match['ors'] = array("application/ocsp-response");
$mime_type_match['ota'] = array("image/x-ota-bitmap");
$mime_type_match['p'] = array("text/x-pascal");
$mime_type_match['p10'] = array("application/pkcs10", "application/x-pkcs10");
$mime_type_match['p12'] = array("application/pkcs-12", "application/x-pkcs12");
$mime_type_match['p7a'] = array("application/x-pkcs7-signature");
$mime_type_match['p7b'] = array("application/x-pkcs7-certificates");
$mime_type_match['p7c'] = array("application/pkcs7-mime", "application/x-pkcs7-mime");
$mime_type_match['p7m'] = array("application/pkcs7-mime", "application/x-pkcs7-mime");
$mime_type_match['p7r'] = array("application/x-pkcs7-certreqresp");
$mime_type_match['p7s'] = array("application/pkcs7-signature");
$mime_type_match['pac'] = array("application/x-ns-proxy-autoconfig", "audio/x-pac");
$mime_type_match['pae'] = array("audio/x-epac");
$mime_type_match['pan'] = array("application/x-pan");
$mime_type_match['part'] = array("application/pro_eng");
$mime_type_match['pas'] = array("text/pascal");
$mime_type_match['pat'] = array("audio/x-pat");
$mime_type_match['pbd'] = array("application/vnd.powerbuilder6-s", "application/vnd.powerbuilder6", "application/vnd.powerbuilder7-s", "application/vnd.powerbuilder75-s", "application/vnd.powerbuilder75", "application/vnd.powerbuilder7");
$mime_type_match['pbm'] = array("image/x-portable-bitmap");
$mime_type_match['pcd'] = array("image/x-photo-cd");
$mime_type_match['pcl'] = array("application/vnd.hp-PCL", "application/x-pcl");
$mime_type_match['pct'] = array("image/x-pict");
$mime_type_match['pcx'] = array("image/x-pcx");
$mime_type_match['pda'] = array("image/x-pda");
$mime_type_match['pdb'] = array("chemical/x-pdb");
$mime_type_match['pdf'] = array("application/pdf");
$mime_type_match['pfr'] = array("application/font-tdpfr");
$mime_type_match['pfunk'] = array("audio/make", "audio/make.my.funk");
$mime_type_match['pfx'] = array("application/x-pkcs12");
$mime_type_match['pgm'] = array("image/x-portable-graymap", "image/x-portable-greymap");
$mime_type_match['pgn'] = array("application/x-chess-pgn");
$mime_type_match['pgp'] = array("application/pgp-encrypted");
$mime_type_match['pic'] = array("image/pict");
$mime_type_match['pict'] = array("image/pict", "image/x-pict");
$mime_type_match['pkg'] = array("application/x-newton-compatible-pkg");
$mime_type_match['pki'] = array("application/pkixcmp");
$mime_type_match['pko'] = array("application/vnd.ms-pki.pko");
$mime_type_match['pl'] = array("text/plain", "text/x-script.perl");
$mime_type_match['plc'] = array("application/vnd.Mobius.PLC");
$mime_type_match['plg'] = array("text/html");
$mime_type_match['plj'] = array("audio/vnd.everad.plj");
$mime_type_match['pls'] = array("audio/mpegurl", "audio/scpls", "audio/x-mpequrl", "audio/x-scpls", "audio/scpls");
$mime_type_match['plx'] = array("application/x-PiXCLscript");
$mime_type_match['pm'] = array("application/x-perl", "image/x-xpixmap", "text/x-script.perl-module");
$mime_type_match['pm4'] = array("application/x-pagemaker");
$mime_type_match['pm5'] = array("application/x-pagemaker");
$mime_type_match['pml'] = array("application/vnd.ctc-posml");
$mime_type_match['png'] = array("image/png", "image/x-png");
$mime_type_match['pnm'] = array("application/x-portable-anymap", "image/x-portable-anymap");
$mime_type_match['pot'] = array("application/vnd.ms-powerpoint", "application/mspowerpoint");
$mime_type_match['pov'] = array("model/x-pov");
$mime_type_match['ppa'] = array("application/vnd.ms-powerpoint");
$mime_type_match['ppm'] = array("image/x-portable-pixmap");
$mime_type_match['pps'] = array("application/vnd.ms-powerpoint", "application/mspowerpoint");
$mime_type_match['ppt'] = array("application/vnd.ms-powerpoint", "application/mspowerpoint", "application/powerpoint", "application/x-mspowerpoint");
$mime_type_match['ppz'] = array("application/mspowerpoint", "application/ppt");
$mime_type_match['pqf'] = array("application/x-cprplayer");
$mime_type_match['pqi'] = array("application/cprplayer");
$mime_type_match['pre'] = array("application/vnd.lotus-freelance", "application/x-freelance");
$mime_type_match['prf'] = array("application/pics-rules");
$mime_type_match['proxy'] = array("application/x-ns-proxy-autoconfig");
$mime_type_match['prt'] = array("application/pro_eng");
$mime_type_match['prz'] = array("application/vnd.lotus-freelance");
$mime_type_match['ps'] = array("application/postscript");
$mime_type_match['psd'] = array("application/octet-stream");
$mime_type_match['pseg3820'] = array("application/vnd.ibm.modcap");
$mime_type_match['psid'] = array("audio/prs.sid");
$mime_type_match['pti'] = array("image/prs.pti");
$mime_type_match['ptlk'] = array("application/listenup");
$mime_type_match['pub'] = array("application/x-mspublisher");
$mime_type_match['puz'] = array("application/x-crossword");
$mime_type_match['pvu'] = array("paleovu/x-pv");
$mime_type_match['pwn'] = array("application/vnd.3M.Post-it-Notes");
$mime_type_match['pwz'] = array("application/vnd.ms-powerpoint");
$mime_type_match['py'] = array("text/x-script.phyton");
$mime_type_match['pyc'] = array("applicaiton/x-bytecode.python");
$mime_type_match['qam'] = array("application/vnd.epson.quickanime");
$mime_type_match['qbo'] = array("application/vnd.intu.qbo");
$mime_type_match['qca'] = array("application/vnd.ericsson.quickcall");
$mime_type_match['qcall'] = array("application/vnd.ericsson.quickcall");
$mime_type_match['qcp'] = array("audio/vnd.qcelp");
$mime_type_match['qd3'] = array("x-world/x-3dmf");
$mime_type_match['qd3d'] = array("x-world/x-3dmf");
$mime_type_match['qfx'] = array("application/vnd.intu.qfx");
$mime_type_match['qif'] = array("image/x-quicktime");
$mime_type_match['qps'] = array("application/vnd.publishare-delta-tree");
$mime_type_match['qry'] = array("text/html");
$mime_type_match['qt'] = array("video/quicktime");
$mime_type_match['qtc'] = array("video/x-qtc");
$mime_type_match['qti'] = array("image/x-quicktime");
$mime_type_match['qtif'] = array("image/x-quicktime");
$mime_type_match['qtvr'] = array("video/quicktime");
$mime_type_match['r3t'] = array("text/vnd.rn-realtext3d");
$mime_type_match['ra'] = array("application/x-pn-realaudio", "audio/vnd.rn-realaudio", "audio/x-pn-realaudio", "audio/x-pn-realaudio-plugin", "audio/x-realaudio");
$mime_type_match['ram'] = array("application/x-pn-realaudio", "audio/x-pn-realaudio", "audio/x-pn-realaudio-plugin");
$mime_type_match['rar'] = array("application/x-rar-compressed", "application/octet-stream");
$mime_type_match['ras'] = array("application/x-cmu-raster", "image/cmu-raster", "image/x-cmu-raster");
$mime_type_match['rast'] = array("image/cmu-raster");
$mime_type_match['rb'] = array("application/x-rocketbook");
$mime_type_match['rct'] = array("application/prs.nprend");
$mime_type_match['rep'] = array("application/vnd.businessobjects");
$mime_type_match['rexx'] = array("text/x-script.rexx");
$mime_type_match['rf'] = array("image/vnd.rn-realflash");
$mime_type_match['rgb'] = array("image/x-rgb");
$mime_type_match['rjs'] = array("application/vnd.rn-realsystem-rjs");
$mime_type_match['rlc'] = array("image/vnd.fujixerox.edmics-rlc");
$mime_type_match['rlf'] = array("application/x-richlink");
$mime_type_match['rm'] = array("application/vnd.rn-realmedia", "application/x-pn-realaudio", "audio/x-pn-realaudio", "audio/x-pn-realaudio-plugin");
$mime_type_match['rmi'] = array("audio/mid");
$mime_type_match['rmm'] = array("audio/x-pn-realaudio");
$mime_type_match['rmp'] = array("application/vnd.rn-rn_music_package", "audio/x-pn-realaudio", "audio/x-pn-realaudio-plugin");
$mime_type_match['rmx'] = array("application/vnd.rn-realsystem-rmx");
$mime_type_match['rnd'] = array("application/prs.nprend");
$mime_type_match['rng'] = array("application/ringing-tones", "application/vnd.nokia.ringing-tone");
$mime_type_match['rnx'] = array("application/vnd.rn-realplayer");
$mime_type_match['roff'] = array("application/x-troff");
$mime_type_match['rp'] = array("image/vnd.rn-realpix");
$mime_type_match['rpm'] = array("application/x-pn-realaudio", "audio/x-pn-RealAudio-plugin", "audio/x-pn-realaudio-plugin");
$mime_type_match['rsm'] = array("model/vnd.gdl", "model/vnd.gs.gdl");
$mime_type_match['rsml'] = array("application/vnd.rn-rsml");
$mime_type_match['rt'] = array("text/richtext", "text/vnd.rn-realtext");
$mime_type_match['rte'] = array("x-lml/x-gps");
$mime_type_match['rtf'] = array("text/richtext", "application/msword", "application/rtf", "application/x-rtf", "text/rtf");
$mime_type_match['rtg'] = array("application/metastream");
$mime_type_match['rts'] = array("application/x-rtsl");
$mime_type_match['rtx'] = array("text/richtext", "application/rtf");
$mime_type_match['rv'] = array("video/vnd.rn-realvideo");
$mime_type_match['rxn'] = array("chemical/x-mdl-rxn", "chemical/x-mdl-rxnfile");
$mime_type_match['s'] = array("text/x-asm");
$mime_type_match['s3m'] = array("audio/s3m", "audio/x-mod");
$mime_type_match['s3z'] = array("audio/x-mod");
$mime_type_match['sam'] = array("application/vnd.lotus-wordpro");
$mime_type_match['saveme'] = array("application/octet-stream");
$mime_type_match['sbk'] = array("application/x-tbook", "audio/x-sbk");
$mime_type_match['sc'] = array("application/x-showcase");
$mime_type_match['scd'] = array("application/x-msschedule");
$mime_type_match['scm'] = array("application/vnd.lotus-screencam", "application/x-lotusscreencam", "text/x-script.guile", "text/x-script.scheme", "video/x-scm");
$mime_type_match['scp'] = array("text/plain");
$mime_type_match['sct'] = array("text/scriptlet");
$mime_type_match['sdf'] = array("application/e-score", "chemical/x-mdl-sdf");
$mime_type_match['sdml'] = array("text/plain");
$mime_type_match['sdp'] = array("application/sdp", "application/x-sdp");
$mime_type_match['sdr'] = array("application/sounder");
$mime_type_match['sds'] = array("application/x-onlive");
$mime_type_match['sea'] = array("application/sea", "application/x-sea", "application/x-stuffit");
$mime_type_match['see'] = array("application/vnd.seemail");
$mime_type_match['ser'] = array("application/x-java-serialized-object");
$mime_type_match['set'] = array("application/set");
$mime_type_match['sgi-lpr'] = array("application/x-sgi-lpr");
$mime_type_match['sgm'] = array("text/sgml", "text/x-sgml");
$mime_type_match['sgml'] = array("text/sgml", "text/x-sgml");
$mime_type_match['sh'] = array("application/x-bsh", "application/x-sh", "application/x-shar", "text/x-script.sh");
$mime_type_match['sha'] = array("application/x-shar");
$mime_type_match['shar'] = array("application/x-bsh", "application/x-shar");
$mime_type_match['sho'] = array("application/x-showcase");
$mime_type_match['show'] = array("application/x-showcase");
$mime_type_match['showcase'] = array("application/x-showcase");
$mime_type_match['shtml'] = array("text/html", "magnus-internal/parsed-html", "text/x-server-parsed-html");
$mime_type_match['shw'] = array("application/presentations");
$mime_type_match['si'] = array("text/vnd.wap.si");
$mime_type_match['sic'] = array("application/vnd.wap.sic");
$mime_type_match['sid'] = array("audio/prs.sid", "audio/x-psid");
$mime_type_match['silo'] = array("model/mesh");
$mime_type_match['sis'] = array("application/vnd.symbian.install");
$mime_type_match['sit'] = array("application/x-sit", "application/x-stuffit");
$mime_type_match['skc'] = array("chemical/x-mdl-isis");
$mime_type_match['skd'] = array("application/vnd.koan", "application/x-koan");
$mime_type_match['skm'] = array("application/vnd.koan", "application/x-koan");
$mime_type_match['skp'] = array("application/vnd.koan", "application/x-koan");
$mime_type_match['skt'] = array("application/vnd.koan", "application/x-koan");
$mime_type_match['sl'] = array("text/vnd.wap.sl", "application/x-seelogo");
$mime_type_match['slc'] = array("application/vnd.wap.slc", "application/x-salsa");
$mime_type_match['slides'] = array("application/x-showcase");
$mime_type_match['slt'] = array("application/vnd.epson.salt");
$mime_type_match['smd'] = array("chemical/x-smd");
$mime_type_match['smi'] = array("application/smil", "chemical/x-daylight-smiles", "chemical/x-x-daylight-smiles");
$mime_type_match['smil'] = array("application/smil");
$mime_type_match['smp'] = array("application/studiom");
$mime_type_match['snd'] = array("audio/basic", "audio/x-adpcm");
$mime_type_match['sol'] = array("application/solids");
$mime_type_match['spc'] = array("application/x-pkcs7-certificates", "chemical/x-galactic-spc", "text/x-speech");
$mime_type_match['spl'] = array("application/futuresplash", "application/x-futuresplash");
$mime_type_match['spo'] = array("text/vnd.in3d.spot");
$mime_type_match['spot'] = array("text/vnd.in3d.spot");
$mime_type_match['spr'] = array("application/x-sprite");
$mime_type_match['sprite'] = array("application/x-sprite");
$mime_type_match['spt'] = array("application/x-spt");
$mime_type_match['src'] = array("application/x-wais-source");
$mime_type_match['ssf'] = array("application/vnd.epson.ssf");
$mime_type_match['ssi'] = array("text/x-server-parsed-html");
$mime_type_match['ssm'] = array("application/streamingmedia");
$mime_type_match['sst'] = array("application/vnd.ms-pki.certstore");
$mime_type_match['step'] = array("application/step");
$mime_type_match['stf'] = array("application/vnd.wt.stf");
$mime_type_match['stk'] = array("application/hyperstudio");
$mime_type_match['stl'] = array("application/sla", "application/vnd.ms-pki.stl", "application/x-navistyle");
$mime_type_match['stp'] = array("application/step");
$mime_type_match['str'] = array("application/vnd.pg.format", "audio/x-str");
$mime_type_match['sv4cpio'] = array("application/x-sv4cpio");
$mime_type_match['sv4crc'] = array("application/x-sv4crc");
$mime_type_match['svf'] = array("image/vnd.svf", "image/vnd", "image/x-dwg");
$mime_type_match['svg'] = array("image/svg-xml");
$mime_type_match['svh'] = array("image/svh");
$mime_type_match['svr'] = array("application/x-world", "x-world/x-svr");
$mime_type_match['swf'] = array("application/x-shockwave-flash");
$mime_type_match['swfl'] = array("application/x-shockwave-flash");
$mime_type_match['sys'] = array("video/x-mpeg-system");
$mime_type_match['t'] = array("application/x-troff");
$mime_type_match['tad'] = array("application/octet-stream");
$mime_type_match['tag'] = array("text/prs.lines.tag");
$mime_type_match['talk'] = array("plugin/talker", "text/x-speech", "x-plugin/x-talker");
$mime_type_match['tar'] = array("appliation/x-tar", "application/x-tar");
$mime_type_match['tardist'] = array("application/x-tardist");
$mime_type_match['taz'] = array("application/x-tar");
$mime_type_match['tbk'] = array("application/toolbook", "application/x-tbook");
$mime_type_match['tbp'] = array("application/x-timbuktu");
$mime_type_match['tbt'] = array("application/timbuktu");
$mime_type_match['tcl'] = array("application/x-tcl", "text/x-script.tcl");
$mime_type_match['tcsh'] = array("text/x-script.tcsh");
$mime_type_match['tex'] = array("application/x-tex");
$mime_type_match['texi'] = array("application/x-tex", "application/x-texinfo");
$mime_type_match['texinfo'] = array("application/x-texinfo");
$mime_type_match['text'] = array("text/plain", "application/plain", "application/text");
$mime_type_match['tgf'] = array("chemical/x-mdl-tgf");
$mime_type_match['tgz'] = array("application/gnutar", "application/x-compressed", "application/x-tar");
$mime_type_match['tif'] = array("image/tiff", "image/x-tiff");
$mime_type_match['tiff'] = array("image/tiff", "image/x-tiff");
$mime_type_match['tki'] = array("application/x-tkined");
$mime_type_match['tkined'] = array("application/x-tkined");
$mime_type_match['toc'] = array("application/toc");
$mime_type_match['tpl'] = array("application/vnd.groove-tool-template");
$mime_type_match['tr'] = array("application/x-troff");
$mime_type_match['tra'] = array("application/vnd.trueapp");
$mime_type_match['trk'] = array("x-lml/x-gps");
$mime_type_match['trm'] = array("application/x-msterminal");
$mime_type_match['tsi'] = array("audio/tsp-audio", "audio/tsplayer");
$mime_type_match['tsp'] = array("application/dsptype", "audio/tsplayer");
$mime_type_match['tsv'] = array("text/tab-separated-values");
$mime_type_match['ttf'] = array("application/octet-stream");
$mime_type_match['ttz'] = array("application/t-time");
$mime_type_match['turbot'] = array("image/florian");
$mime_type_match['tvm'] = array("application/x-tvml");
$mime_type_match['tvml'] = array("application/x-tvml");
$mime_type_match['txf'] = array("application/vnd.Mobius.TXF");
$mime_type_match['txt'] = array("text/plain", "application/text");
$mime_type_match['ufdl'] = array("application/vnd.ufdl");
$mime_type_match['uil'] = array("text/x-uil");
$mime_type_match['uni'] = array("text/uri-list");
$mime_type_match['unis'] = array("text/uri-list");
$mime_type_match['unv'] = array("application/i-deas");
$mime_type_match['uri'] = array("text/uri-list");
$mime_type_match['uris'] = array("text/uri-list");
$mime_type_match['urls'] = array("application/x-url-list");
$mime_type_match['ustar'] = array("application/x-ustar", "multipart/x-ustar");
$mime_type_match['uu'] = array("application/octet-stream", "application/uue", "text/x-uuencode");
$mime_type_match['uue'] = array("application/uue", "text/x-uuencode");
$mime_type_match['v5d'] = array("application/vis5d");
$mime_type_match['vbk'] = array("audio/vnd.nortel.vbk");
$mime_type_match['vbox'] = array("application/vnd.previewsystems.box");
$mime_type_match['vcd'] = array("application/x-cdlink");
$mime_type_match['vcf'] = array("text/x-vcard");
$mime_type_match['vcg'] = array("application/vnd.groove-vcard");
$mime_type_match['vcs'] = array("text/x-vCalendar");
$mime_type_match['vcx'] = array("application/vnd.vcx");
$mime_type_match['vda'] = array("application/vda");
$mime_type_match['vdo'] = array("video/vdo");
$mime_type_match['vew'] = array("application/vnd.lotus-approach", "application/groupwise");
$mime_type_match['vis'] = array("application/vnd.informix-visionary");
$mime_type_match['viv'] = array("video/vnd.vivo", "video/vivo");
$mime_type_match['vivo'] = array("video/vnd.vivo", "video/vivo");
$mime_type_match['vmd'] = array("application/vocaltec-media-desc", "chemical/x-vmd");
$mime_type_match['vmf'] = array("application/vocaltec-media-file");
$mime_type_match['vmi'] = array("application/x-dremacast-vms-info");
$mime_type_match['vms'] = array("application/x-dremacast-vms");
$mime_type_match['voc'] = array("audio/voc", "audio/x-voc");
$mime_type_match['vos'] = array("video/vosaic");
$mime_type_match['vox'] = array("audio/voxware");
$mime_type_match['vqe'] = array("audio/x-twinvq-plugin");
$mime_type_match['vqf'] = array("audio/x-twinvq");
$mime_type_match['vql'] = array("audio/x-twinvq", "audio/x-twinvq-plugin");
$mime_type_match['vre'] = array("x-world/x-vream");
$mime_type_match['vrj'] = array("x-world/x-vrt");
$mime_type_match['vrml'] = array("model/vrml", "application/x-vrml", "x-world/x-vrml");
$mime_type_match['vrt'] = array("x-world/x-vrt");
$mime_type_match['vrw'] = array("x-world/x-vream");
$mime_type_match['vsd'] = array("application/vnd.visio", "application/x-visio");
$mime_type_match['vsl'] = array("application/x-cnet-vsl");
$mime_type_match['vss'] = array("application/vnd.visio");
$mime_type_match['vst'] = array("application/vnd.visio", "application/x-visio");
$mime_type_match['vsw'] = array("application/vnd.visio", "application/x-visio");
$mime_type_match['vts'] = array("workbook/formulaone");
$mime_type_match['vtu'] = array("model/vnd.vtu");
$mime_type_match['w60'] = array("application/wordperfect6.0");
$mime_type_match['w61'] = array("application/wordperfect6.1");
$mime_type_match['w6w'] = array("application/msword");
$mime_type_match['wav'] = array("application/x-wav", "audio/wav", "audio/x-wav");
$mime_type_match['wax'] = array("audio/x-ms-wax");
$mime_type_match['wb1'] = array("application/x-qpro");
$mime_type_match['wbc'] = array("application/x-webshots");
$mime_type_match['wbmp'] = array("image/vnd.wap.wbmp");
$mime_type_match['wbxml'] = array("application/vnd.wap.sic", "application/vnd.wap.slc", "application/vnd.wap.wbxml", "application/vnd.wap.wmlc");
$mime_type_match['web'] = array("application/vnd.xara");
$mime_type_match['wi'] = array("image/wavelet");
$mime_type_match['win'] = array("model/vnd.gdl", "model/vnd.gs.gdl");
$mime_type_match['wiz'] = array("application/msword");
$mime_type_match['wk1'] = array("application/vnd.lotus-1-2-3", "application/x-123");
$mime_type_match['wk3'] = array("application/vnd.lotus-1-2-3");
$mime_type_match['wk4'] = array("application/vnd.lotus-1-2-3");
$mime_type_match['wkz'] = array("application/x-wingz");
$mime_type_match['wm'] = array("video/x-ms-asf");
$mime_type_match['wma'] = array("audio/x-ms-wma");
$mime_type_match['wmf'] = array("application/x-msmetafile", "image/x-wmf", "windows/metafile");
$mime_type_match['wml'] = array("text/vnd.wap.wml");
$mime_type_match['wmlc'] = array("application/vnd.wap.wmlc");
$mime_type_match['wmls'] = array("text/vnd.wap.wmlscript");
$mime_type_match['wmlsc'] = array("application/vnd.wap.wmlscriptc");
$mime_type_match['wmv'] = array("video/x-ms-wmv");
$mime_type_match['wmx'] = array("video/x-ms-wmx");
$mime_type_match['word'] = array("application/msword");
$mime_type_match['wp'] = array("application/wordperfect");
$mime_type_match['wp5'] = array("application/wordperfect", "application/wordperfect6.0");
$mime_type_match['wp6'] = array("application/wordperfect");
$mime_type_match['wpd'] = array("application/wordperfect", "application/x-wpwin");
$mime_type_match['wpt'] = array("x-lml/x-gps");
$mime_type_match['wq1'] = array("application/x-lotus");
$mime_type_match['wri'] = array("application/mswrite", "application/x-mswrite", "application/x-wri");
$mime_type_match['wrl'] = array("model/vrml", "application/x-world", "i-world/i-vrml", "x-world/x-vrml");
$mime_type_match['wrz'] = array("model/vrml", "x-world/x-vrml");
$mime_type_match['wsc'] = array("text/sgml", "text/scriptlet");
$mime_type_match['wsrc'] = array("application/x-wais-source");
$mime_type_match['wtb'] = array("application/vnd.webturbo");
$mime_type_match['wtk'] = array("application/x-wintalk");
$mime_type_match['wtx'] = array("text/plain");
$mime_type_match['wv'] = array("video/wavelet");
$mime_type_match['wvx'] = array("video/x-ms-wvx");
$mime_type_match['wxl'] = array("application/x-wxl");
$mime_type_match['x3d'] = array("application/vnd.hzn-3d-crossword");
$mime_type_match['xar'] = array("application/vnd.xara", "application/vnd.xara");
$mime_type_match['xbd'] = array("application/vnd.fujixerox.docuworks.binder");
$mime_type_match['xbm'] = array("image/x-xbitmap", "image/x-xbm", "image/xbm");
$mime_type_match['xdm'] = array("application/x-xdma");
$mime_type_match['xdma'] = array("application/x-xdma");
$mime_type_match['xdr'] = array("video/x-amt-demorun");
$mime_type_match['xdw'] = array("application/vnd.fujixerox.docuworks");
$mime_type_match['xfdl'] = array("application/vnd.xfdl");
$mime_type_match['xgz'] = array("xgl/drawing");
$mime_type_match['xif'] = array("image/vnd.xiff");
$mime_type_match['xl'] = array("application/excel");
$mime_type_match['xla'] = array("application/excel", "application/vnd.ms-excel", "application/x-excel", "application/x-msexcel");
$mime_type_match['xlb'] = array("application/vnd.ms-excel", "application/excel", "application/x-excel");
$mime_type_match['xlc'] = array("application/vnd.ms-excel", "application/excel", "application/x-excel");
$mime_type_match['xld'] = array("application/excel", "application/x-excel");
$mime_type_match['xlk'] = array("application/excel", "application/x-excel");
$mime_type_match['xll'] = array("application/vnd.ms-excel", "application/excel", "application/x-excel");
$mime_type_match['xlm'] = array("application/vnd.ms-excel", "application/excel", "application/x-excel");
$mime_type_match['xls'] = array("application/vnd.ms-excel", "application/excel", "application/x-excel", "application/x-msexcel");
$mime_type_match['xlt'] = array("application/excel", "application/vnd.ms-excel", "application/x-excel");
$mime_type_match['xlv'] = array("application/excel", "application/x-excel");
$mime_type_match['xlw'] = array("application/vnd.ms-excel", "application/excel", "application/x-excel", "application/x-msexcel");
$mime_type_match['xm'] = array("audio/x-mod", "audio/xm");
$mime_type_match['xml'] = array("application/xml", "text/vnd.IPTC.NITF", "text/vnd.IPTC.NewsML", "text/vnd.wap.si", "text/vnd.wap.sl", "text/vnd.wap.wml", "text/xml");
$mime_type_match['xmz'] = array("audio/x-mod", "xgl/movie");
$mime_type_match['x-png'] = array("image/png");
$mime_type_match['xpix'] = array("application/x-vnd.ls-xpix");
$mime_type_match['xpm'] = array("image/x-xpixmap", "image/x-xpm", "image/xpm");
$mime_type_match['xpr'] = array("application/vnd.is-xpr");
$mime_type_match['xpw'] = array("application/vnd.intercon.formnet");
$mime_type_match['xpx'] = array("application/vnd.intercon.formnet");
$mime_type_match['xsl'] = array("text/xml", "text/xsl");
$mime_type_match['xsr'] = array("video/x-amt-showrun");
$mime_type_match['xul'] = array("text/xul");
$mime_type_match['xwd'] = array("image/x-xwd", "image/x-xwindowdump");
$mime_type_match['xyz'] = array("chemical/x-pdb", "chemical/x-xyz");
$mime_type_match['yz1'] = array("application/x-yz1");
$mime_type_match['Z'] = array("application/x-compressed");
$mime_type_match['zac'] = array("application/x-zaurus-zac");
$mime_type_match['zip'] = array("application/zip", "application/x-compressed", "application/x-zip-compressed", "multipart/x-zip");
$mime_type_match['zoo'] = array("application/octet-stream");
$mime_type_match['zsh'] = array("text/x-script.zsh");
$mime_type_match['ztardist'] = array("application/x-ztardist");



Original file list by excitex2 :
http://www.4homepages.de/forum/index.php?topic=15253.0
Thanks to excitex2

4) create a new icon .gif icon in templates/<your templates>/icons/ (in our example it should be mp3.gif)
this icon will be showed for the files that don't have thumbnails.



Sometimes you might receive an error without any MIME type i.e.
Quote
Invalid file type: (flv, )
In that case you must add an empty string:
Quote
$mime_type_match['flv'] = array("video/x-flv", "");

90
To fix that you'll need change the type of cat_hits field in 4images_categories table from smallint(6) to int(10)

Here is MySQL query for your convinience:
Code: [Select]
ALTER TABLE `4images_categories` CHANGE `cat_hits` `cat_hits` INT( 10 ) DEFAULT '0' NOT NULL

Pages: 1 2 3 4 5 [6] 7 8 9 10 ... 14