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 ... 14
61
This is an important security fix.
Это очень важная заплатка для опасной дыры в скрипте

Step 1

In search.php any variables or other code that is located below copyright notice
В search.php всё что находится ниже копирайта (который заканьчиватся этой строкой):
Code: [Select]
*************************************************************************/ and above
и выше:
Code: [Select]
$main_template = 'search';

must be moved below
должно быть перенесено ниже:
Code: [Select]
include(ROOT_PATH.'global.php');
In default 4images, the block that must be moved is:
В свежей 4images кусок кода который должен быть перемещён выглядит так:
Code: [Select]
if (isset($HTTP_POST_VARS['show_result']) || isset($HTTP_GET_VARS['show_result'])) {
  $show_result = 1;
}
else {
  $show_result = 0;
}

if (isset($HTTP_POST_VARS['search_keywords']) || isset($HTTP_GET_VARS['search_keywords'])) {
  $search_keywords = (isset($HTTP_POST_VARS['search_keywords'])) ? trim($HTTP_POST_VARS['search_keywords']) : urldecode(trim($HTTP_GET_VARS['search_keywords']));
  if ($search_keywords != "") {
    $show_result = 1;
  }
}
else {
  $search_keywords = "";
}
$org_search_keywords = $search_keywords;

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {
  $search_user = (isset($HTTP_POST_VARS['search_user'])) ? trim($HTTP_POST_VARS['search_user']) : urldecode(trim($HTTP_GET_VARS['search_user']));
  if ($search_user != "") {
    $show_result = 1;
  }
}
else {
  $search_user = "";
}
$org_search_user = $search_user;

if (isset($HTTP_POST_VARS['search_terms'])) {
  $search_terms = (trim($HTTP_POST_VARS['search_terms']) == "all") ? 1 : 0;
}
else {
  $search_terms = 0;
}

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

$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;

if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
  $search_new_images = 1;
  $show_result = 1;
}
else {
  $search_new_images = 0;
}



Step 2

In register.php find:
В register.php найдите:
Code: [Select]
      if ($site_db->not_empty($sql)) {
        $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
        $error = 1;
      }

Insert below:
Добавьте ниже:
Code: [Select]
      elseif (preg_match("#[<>]#", $user_name))
      {
        $msg .= (($msg != "") ? "<br />" : "").$lang['username_bad_characters'];
        $error = 1;
      }


Then in lang/<your language>/main.php at the end, above closing ?> insert:
Затем в lang/<ваш языковой пакет>/main.php в самый конец файла, выше закрывающей ?> добавьте:
Code: [Select]
$lang['username_bad_characters'] = "Username contains not allowed character(s)";

Step 3

In global.php find:
В global.php найдите:
Code: [Select]
//-----------------------------------------------------
//--- Start DB ----------------------------------------
//-----------------------------------------------------

Insert above:
Добавьте выше:
Code: [Select]
if (isset($HTTP_POST_VARS['show_result']) || isset($HTTP_GET_VARS['show_result'])) {
  $show_result = 1;
}
else {
  $show_result = 0;
}

if (isset($HTTP_POST_VARS['search_keywords']) || isset($HTTP_GET_VARS['search_keywords'])) {
  $search_keywords = (isset($HTTP_POST_VARS['search_keywords'])) ? trim($HTTP_POST_VARS['search_keywords']) : urldecode(trim($HTTP_GET_VARS['search_keywords']));
  if ($search_keywords != "") {
    $show_result = 1;
  }
}
else {
  $search_keywords = "";
}

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {
  $search_user = (isset($HTTP_POST_VARS['search_user'])) ? trim($HTTP_POST_VARS['search_user']) : urldecode(trim($HTTP_GET_VARS['search_user']));
  if ($search_user != "") {
    $show_result = 1;
  }
}
else {
  $search_user = "";
}

if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
  $search_new_images = 1;
  $show_result = 1;
}
else {
  $search_new_images = 0;
}

If you wish, you can remove this block of code from search.php to increase perfomance (very insignificaly).
Если вы хотите, то можете удалить такой-же блок кода из search.php, но это не обязательно.



In the attachment below you can find already modifyed default search.php, register.php and global.php
Вы можете загрузить исправленные search.php, register.php и global.php из приложеного архива.

62
Bug Fixes & Patches / [1.7 / 1.7.1] Edit templates = no changes being saved
« on: December 07, 2005, 12:51:06 AM »
On servers where register_globals in PHP settings is turned off, editing templates from ACP (Admin Control Panel) will not save the changes.

To fix that, in admin/templates.php find:
Code: [Select]
if (isset($HTTP_GET_VARS['template_folder']) || isset($HTTP_POST_VARS['template_folder'])) {Insert above:
Code: [Select]
if (isset($HTTP_POST_VARS['content'])) {
  $content = trim($HTTP_POST_VARS['content']);
}
else {
  $content = "";
}

63
FAQ, Tips / I can't set permissions for a user or a group
« on: December 06, 2005, 05:06:03 AM »
Quiet a few people were confused when they go to edit user or user group's permissions and see "blank" table without any options (see first attachment)

The answer is simple:
Edit a category and set needed permissions to "Private"
Then, when you edit user or group's permissions, you should be able set the options (see second attachment)

It's worth to mention, that user/group permissions can only be set for categories, that means that at least one category must exist.

64
Bug Fixes & Patches / [1.7 / 1.7.1] "eCard" sends random image
« on: December 03, 2005, 10:42:54 PM »
This bug only shows after applying [1.7/1.7.1] GET requests override POST requests fix.

In postcards.php find two times:
Code: [Select]
"lang_sender" => $lang['sender'],Insert above each intance:
Code: [Select]
"image_id" => $image_id,

65
----------- [ Introduction ] -------------
With this mod members will have ability have more then one lightbox (album) and share them with others (read only).


----------- [ Features ] ------------
  • Unlimited/limited number of lightboxes.
  • Shared/private lightboxes
  • Global/per member settings: allowed number of lightboxes and if allowed share lightboxes

Lightbox manager:


Shared lightboxes from member's profile page:



Before you start the installation process:
- this mod was created on fresh 4images v1.7.1 and has not been tested on v1.7
(done. tested on fresh v1.7)
- I have not tested it against other mods, such as [MOD] Lightbox for GUESTs v1.2
(done. post updated with little modifications for compability with "Lightbox for Guests" mod)


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

lightbox.php
details.php
download.php
member.php
includes/functions.php
includes/page_header.php
includes/sessions.php
includes/db_field_definitions.php
admin/settings.php
admin/images.php
lang/
<your language>/admin.php
lang/
<your language>/main.php
templates/
<your template>/lightbox.html
templates/
<your template>/member_profile.html
templates/
<your template>/user_logininfo.html
templates/
<your template>/style.css



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

Step 1
Download attached package
Unzip it and upload all files, restoring this file tree:

multilightbox_install.php
templates/
<your template>/lightbox_manage.html
templates/
<your template>/lightbox_dropdown.html

Login as administrator and run the multilightbox_install.php (type in your browser: http://youraddress/path-where-this-file-is/multilightbox_install.php[/b])

Alternatively you can run this MySQL query:
Code: [Select]
ALTER TABLE 4images_users ADD user_lightbox MEDIUMINT( 8 ) UNSIGNED NOT NULL;
ALTER TABLE 4images_users ADD user_lightbox_count SMALLINT( 3 ) DEFAULT '0' NOT NULL;
ALTER TABLE 4images_users ADD user_lightbox_private TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL;

ALTER TABLE 4images_lightboxes ADD id MEDIUMINT( 12 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
ALTER TABLE 4images_lightboxes ADD lightbox_name VARCHAR( 32 ) NOT NULL;
ALTER TABLE 4images_lightboxes ADD lightbox_private TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL;
ALTER TABLE 4images_lightboxes ADD INDEX ( lightbox_private );

INSERT INTO 4images_settings ( setting_name , setting_value ) VALUES ( 'lightbox_count', '5' ), ( 'lightbox_share', '1' );

Ones the database was successfuly updated, delete multilightbox_install.php



Step 2
Open lightbox.php
If you installed [MOD] Lightbox for GUESTs v1.2 MOD, skip this step and continue with Step 2.1
Find:
Code: [Select]
if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) {Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
if (($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) && !((isset($HTTP_POST_VARS['lightbox_id']) && $HTTP_POST_VARS['lightbox_id']) || (isset($HTTP_GET_VARS['lightbox_id']) && $HTTP_GET_VARS['lightbox_id']))) {
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 2.1
Find:
Code: [Select]
//-----------------------------------------------------
//--- Show Images -------------------------------------
//-----------------------------------------------------

Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
if ($user_info['user_level'] == GUEST || ($action != "manage" && $action != "save"))
{
  $action = ($action == "clearlightbox" && $user_info['user_level'] >= USER) ? "manage" : "show";
}
$txt_clickstream = "";
$lightbox_name = "";

$name_error = 0;
$status = array();
$user_info['user_lightbox'] = ($user_info['user_level'] >= USER && $user_info['user_lightbox']) ? $user_info['user_lightbox'] : 0;
$limit = ($user_info['user_lightbox_count'] == -1 || !$config['lightbox_count'] || $user_info['user_level'] == ADMIN) ? -1 : (($user_info['user_lightbox_count']) ? $user_info['user_lightbox_count'] : $config['lightbox_count']);
$total = count($user_info['lightboxes']);
$total_update = $total;
unset($private_new, $name_new);
//-----------------------------------------------------
//--- Update Lightboxes Settings ----------------------
//-----------------------------------------------------
if ($action == "save")
{
  for ($i = 1; $i <= $total_update; $i++)
  {
    $name = (isset($HTTP_POST_VARS['name_'.$i])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['name_'.$i])) : "";
    $id = (isset($HTTP_POST_VARS['id_'.$i])) ? $HTTP_POST_VARS['id_'.$i] : 0;
    $delete = (isset($HTTP_POST_VARS['delete_'.$i])) ? 1 : 0;
    $clear = (isset($HTTP_POST_VARS['clear_'.$i])) ? 1 : 0;
    $private = (isset($HTTP_POST_VARS['private_'.$i])) ? 1 : 0;
    if ($delete && !$clear && $id && $id != $user_info['user_lightbox'])
    {
      $sql = "DELETE FROM ".LIGHTBOXES_TABLE." WHERE id = ".$id;
      if ($site_db->query($sql))
      {
        $status[$id]['msg'] = (($status[$id]['msg'] != "") ? "<br />" : "").preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name), $lang['mlightbox_delete_success']);
        $status[$id]['error'] = 0;
        $total--;
        unset($user_info['lightboxes'][$id]);
      }
      else
      {
        $status[$id]['msg'] = (($status[$id]['msg'] != "") ? "<br />" : "").preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name), $lang['mlightbox_delete_error']);
        $status[$id]['error'] = 1;
      }
    }
    else
    {
      if (!empty($name))
      {
        $do_clear = ($clear) ? ", lightbox_image_ids = ''" : "";
        $sql = "UPDATE ".LIGHTBOXES_TABLE." SET lightbox_name = '".$name."', lightbox_private = ".$private.$do_clear." WHERE id = ".$id;
        if ($site_db->query($sql))
        {
          $status[$id]['msg'] = preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name), $lang['lightbox_update_success']);
          $status[$id]['msg'] .= ($clear) ? "<br />".preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name), $lang['lightbox_delete_success']) : "";
          $status[$id]['error'] = 0;
          $user_info['lightboxes'][$id]['name'] = stripslashes($name);
          $user_info['lightboxes'][$id]['private'] = $private;
          $user_info['lightboxes'][$id]['count'] = ($clear) ? 0 : $user_info['lightboxes'][$id]['count'];
        }
        else
        {
          $status[$id]['msg'] = preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name), $lang['lightbox_update_error']);
          $status[$id]['msg'] .= ($clear) ? "<br />".preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name), $lang['lightbox_delete_error']) : "";
          $status[$id]['error'] = 1;
        }
      }
      elseif ($id)
      {
          $name_error++;
          $status[$id]['error'] = 1;
      }
    }
  }
  $name_new = un_htmlspecialchars(trim($HTTP_POST_VARS['name_new']));
  $private_new = (isset($HTTP_POST_VARS['private_new'])) ? 1 : 0;
//  if ($name_new && !$name_error)
  if ($name_new)
  {
    if ($limit == -1 || $total < $limit)
    {
      $lightbox_id = get_random_key(LIGHTBOXES_TABLE, "lightbox_id");
      $sql = "INSERT INTO ".LIGHTBOXES_TABLE."
              (lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids, lightbox_name, lightbox_private)
              VALUES
              ('$lightbox_id', ".$user_info[$user_table_fields['user_id']].", ".time().", '', '".$name_new."', ".$private_new.")";
      if ($site_db->query($sql))
      {
        $total++;
        $id = $site_db->get_insert_id();
        $status[$id]['msg'] = preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name_new), $lang['lightbox_create_success']);
        $status[$id]['error'] = 0;
        $user_info['lightboxes'][$id]['name'] = stripslashes($name_new);
        $user_info['lightboxes'][$id]['id'] = $id;
        $user_info['lightboxes'][$id]['lightbox_id'] = $lightbox_id;
        $user_info['lightboxes'][$id]['private'] = $private_new;
        $user_info['lightboxes'][$id]['count'] = 0;
        unset($private_new, $name_new);
      }
      else
      {
        $status[0]['msg'] = preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name_new), $lang['lightbox_create_error']);
        $status[0]['error'] = 1;
      }
    }
    else
    {
      $status[0]['msg'] = preg_replace("/".$site_template->start."name".$site_template->end."/iU", stripslashes($name_new), $lang['lightbox_create_error']);
      $status[0]['error'] = 1;
    }
  }
  else
  {
    unset($private_new, $name_new);
  }

  $name = 0;
  $msg = array("good" => (($msg) ? array($msg) : array()), "error" => array(), "plain" => array());
  foreach ($status as $key)
  {
    if ($key['msg'])
    {
      if ($key['error'])
      {
        $msg['error'][] = $key['msg'];
      }
      else
      {
        $msg['good'][] = $key['msg'];
      }
    }
  }
  if ($name_error)
  {
    $msg['error'][] = preg_replace("/".$site_template->start."lightbox".$site_template->end."/iU", (($name_error > 1) ? $lang['lightbox_plural'] : $lang['lightbox_single']), $lang['lightbox_name_error']);
  }
  $action = "manage";
  $msg = (empty($msg)) ? "" : get_msg($msg);
}

if ($user_info['user_level'] >= USER)
{
  $user_lightbox_dropdown = ($total > 1) ? get_dropdown_options("user_lightbox", $user_info['lightboxes_list'], $user_info['user_lightbox'], 1, 0, 1) : "";
}
else
{
  $user_lightbox_dropdown = "";
}
$site_template->register_vars("user_lightbox_dropdown", $user_lightbox_dropdown);
$user_lightbox_dropdown = ($user_lightbox_dropdown) ? $site_template->parse_template("lightbox_dropdown") : "";
$site_template->register_vars("user_lightbox_form", $user_lightbox_dropdown);

//-----------------------------------------------------
//--- Manage Lightboxes -------------------------------
//-----------------------------------------------------
if ($action == "manage")
{
  $txt_clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php")."\">".$lang['lightbox']."</a>".$config['category_separator'].$lang['lightbox_settings'];
  $i = 1;
  $maxlength = 32;
  $list = "";
  foreach ($user_info['lightboxes'] as $key => $val)
  {
    $list .= "<tr".(isset($status[$val['id']]['error']) ? (($status[$val['id']]['error']) ? " class=\"mlightbox0\"" : " class=\"mlightbox1\"") : "")." align=\"center\">\n";
    $list .= "<td>".$i.".</td>\n";
    $list .= "<td><input name=\"name_".$i."\" value=\"".str_replace("\"", "&quot;", $val['name'])."\" maxlength=\"".$maxlength."\" class=\"lightboxinput\" /></td>\n";
    $list .= "<td><a href=\"".$site_sess->url(ROOT_PATH."lightbox.php?user_lightbox=".$val['id'])."\">".$val['count']."</a></td>\n";
    if ($user_info['user_lightbox_private'] && $config['lightbox_share'] || $user_info['user_level'] == ADMIN)
    {
      $list .= "<td><input name=\"private_".$i."\" value=\"1\" type=\"checkbox\"".(($val['private']) ? " checked" : "")." /></td>\n";
    }
    $list .= "<td><input name=\"clear_".$i."\" value=\"1\" type=\"checkbox\" /></td>\n";
    if ($key != $user_info['user_lightbox'])
    {
      $list .= "<td><input name=\"delete_".$i."\" value=\"1\" type=\"checkbox\" />\n";
    }
    else
    {
      $list .= "<td>&nbsp;</td>";
    }
    $list .= "<input name=\"id_".$i."\" value=\"".$val['id']."\" type=\"hidden\" /></td>\n</tr>\n";
    $i++;
  }
  if ($limit == -1 || $total < $limit)
  {
    $list .= "<tr>\n";
    $list .= "<td>&nbsp;</td>\n";
    $list .= "<td colspan=\"2\">".$lang['add_new']."&nbsp;<input name=\"name_new\" value=\"".$name_new."\" size=\"12\" maxlength=\"".$maxlength."\" class=\"lightboxinputnew\" /></td>\n";
    if ($user_info['user_lightbox_private'] && $config['lightbox_share'] || $user_info['user_level'] == ADMIN)
    {
      $list .= "<td align=\"middle\"><input name=\"private_new\" value=\"1\" type=\"checkbox\"".((isset($private_new)) ? (($private_new) ? " checked" : "") : " checked")." /></td>\n";
    }
    $list .= "<td>&nbsp;</td>\n";
    $list .= "<td>&nbsp;</td>\n";
    $list .= "</tr>\n";
  }
  $list .= "<input type=\"hidden\" name=\"action\" value=\"save\" />";
$limit_prc = ($limit) ? round(($total * 100) / $limit) : 0;
$lang_limit = ($limit != -1) ? preg_replace(array("/".$site_template->start."limit".$site_template->end."/siU", "/".$site_template->start."total".$site_template->end."/siU"), array($limit, $total), $lang['lightbox_limit']) : $lang['lightbox_unlimited'];
  $site_template->register_vars(array(
    "list" => $list,
    "limit_prc" => $limit_prc,
    "lang_limit" => $lang_limit,
    "lang_name" => $lang['name'],
    "lang_private" => ($user_info['user_lightbox_private'] && $config['lightbox_share'] || $user_info['user_level'] == ADMIN) ? $lang['private'] : "",
    "lang_delete" => ($total > 1) ? $lang['lang_delete'] : "",
    "lang_images" => $lang['images'],
    "lang_clear" => $lang['clear'],
    "lang_submit" => $lang['save'],
    "lang_reset" => $lang['reset']
  ));
  $site_template->register_vars(array(
    "thumbnails" => $site_template->parse_template('lightbox_manage'),
    "lightbox_in_manage" => 1,
    "lightbox_notin_manage" => 0,
    "lightbox_lastaction" => (empty($user_info['lightbox_lastaction'])) ? format_date($config['date_format']." ".$config['time_format'], $user_info['lightbox_lastaction']) : "n/a",
  ));
  $lightbox_name = $lang['lightbox_settings'];
}
//-----------------------------------------------------
//--- Show Images -------------------------------------
//-----------------------------------------------------
if ($action == "show")
{
  $lightbox_id = (isset($HTTP_POST_VARS['lightbox_id']) && $HTTP_POST_VARS['lightbox_id']) ? $HTTP_POST_VARS['lightbox_id'] : ((isset($HTTP_GET_VARS['lightbox_id']) && $HTTP_GET_VARS['lightbox_id']) ? $HTTP_GET_VARS['lightbox_id'] : 0);
  $ids = "";
  if ($lightbox_id)
  {
    $sql = "SELECT l.lightbox_id, l.lightbox_name, l.lightbox_private, l.lightbox_image_ids, l.user_id, u.user_name, u.user_lightbox_private
            FROM ".LIGHTBOXES_TABLE." l
            LEFT JOIN ".USERS_TABLE." u ON u.user_id = l.user_id
            WHERE l.lightbox_id = '".$lightbox_id."'";
    if ($row = $site_db->query_firstrow($sql))
    {
      $ids = (!$row['lightbox_private'] && $row['user_lightbox_private'] && $config['lightbox_share'] || $user_info['user_level'] == ADMIN ) ? $row['lightbox_image_ids'] : "";//$user_info['lightbox_image_ids'];
      $lightbox_name = stripslashes($row['lightbox_name'])." (".$row['user_name'].")";
    }
    else
    {
      $lightbox_name = "";
    }
  }
  else
  {
    $lightbox_name = $user_info['lightboxes'][$user_info['user_lightbox']]['name'];
  }
  if ($lightbox_name)
  {
    $txt_clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php")."\">".$lang['lightbox']."</a>".$config['category_separator'].$lightbox_name;
  }
  else
  {
    $txt_clickstream = $lang['lightbox'];
  }
  $site_template->register_vars(array(
    "lang_lightbox_manage" => $lang['lightbox_manage'],
    "url_lightbox_manage" => ($user_info['user_level'] >= USER && !$lightbox_id) ? $site_sess->url(ROOT_PATH."lightbox.php?action=manage") : "",
    "lightbox_in_manage" => 0,
    "lightbox_notin_manage" => 1,

  ));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 2.2
Find:
Code: [Select]
if (!empty($user_info['lightbox_image_ids']))  {
  $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  if (!empty($user_info['lightbox_image_ids']) || $lightbox_id)  {
    $image_id_sql = str_replace(" ", ", ", trim((($lightbox_id) ? $ids : $user_info['lightbox_image_ids'])));
    $image_id_sql = (empty($image_id_sql)) ? 0 : $image_id_sql;
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 2.3
Find:
Code: [Select]
   show_image($image_row, "lightbox");Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
    show_image($image_row, "lightbox".(($lightbox_id) ? "&lightbox_id=".$lightbox_id : ""));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 2.4
Find:
Code: [Select]
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['lightbox']."</span>";Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
}
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 2.5a (For people without [MOD] Lightbox for GUESTs installed)
4images v1.7 - 1.7.3

Find:
Code: [Select]
 if (!empty($user_info['lightbox_image_ids'])) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  if (($lightbox_id && !empty($ids)) || (!$lightbox_id && !empty($user_info['lightbox_image_ids']))) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox".(($lightbox_id) ? "&lightbox_id=".$lightbox_id : ""))."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

4images v1.7.4 and newer

Find:
Code: [Select]
 if ($download_allowed && !empty($user_info['lightbox_image_ids'])) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  if ($download_allowed && (($lightbox_id && !empty($ids)) || (!$lightbox_id && !empty($user_info['lightbox_image_ids'])))) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox".(($lightbox_id) ? "&lightbox_id=".$lightbox_id : ""))."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 2.5b (For people with [MOD] Lightbox for GUESTs installed)
Find:
Code: [Select]
 if (!empty($user_info['lightbox_image_ids']) && $user_info['user_level'] != GUEST) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  if ($user_info['user_level'] != GUEST && (($lightbox_id && !empty($ids)) || (!$lightbox_id && !empty($user_info['lightbox_image_ids'])))) {
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox".(($lightbox_id) ? "&lightbox_id=".$lightbox_id : ""))."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 2.5c (For people with [MOD] - Restrict users to use e-card and download if they have not voted first installed)
Find:
Code: [Select]
$array_lightbox_image_ids = explode(" ", $user_info['lightbox_image_ids']); // put lightboxed pics in an array

foreach ($array_lightbox_image_ids as $element) {
if (!in_array ($element, $rated_images)) { // if current lightboxed pics in not found in rated pics by user
$one_not_rated = 1;
   }
}
   if (!empty($user_info['lightbox_image_ids']) && !$one_not_rated) { // !$one_not_rated  :  means all pics in lightbox have been rated
//-------------------------------------------[/[Mod] Restrict users to use e-card and download if they have not voted first]

   $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
$array_lightbox_image_ids = explode(" ", (($lightbox_id && !empty($ids)) ? $ids : $user_info['lightbox_image_ids'])); // put lightboxed pics in an array
$one_not_rated = 0;
foreach ($array_lightbox_image_ids as $element) {
if (!in_array ($element, $rated_images)) { // if current lightboxed pics in not found in rated pics by user
$one_not_rated = 1;
   }
}
   if ((($lightbox_id && !empty($ids)) || (!$lightbox_id && !empty($user_info['lightbox_image_ids']))) && !$one_not_rated) { // !$one_not_rated  :  means all pics in lightbox have been rated
//-------------------------------------------[/[Mod] Restrict users to use e-card and download if they have not voted first]

   $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox".(($lightbox_id) ? "&lightbox_id=".$lightbox_id : ""))."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 2.6 (added 19-02-2006)
Find:
Code: [Select]
$link_arg = $site_sess->url(ROOT_PATH."lightbox.php");Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
$link_arg = ROOT_PATH."lightbox.php".(($lightbox_id) ? "?lightbox_id=".$lightbox_id : "");
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/



Step 3
Open details.php
Find:
Code: [Select]
show_image($image_row, $mode, 0, 1);Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
$lightbox_id = (isset($HTTP_POST_VARS['lightbox_id']) && $HTTP_POST_VARS['lightbox_id']) ? $HTTP_POST_VARS['lightbox_id'] : ((isset($HTTP_GET_VARS['lightbox_id']) && $HTTP_GET_VARS['lightbox_id']) ? $HTTP_GET_VARS['lightbox_id'] : 0);
show_image($image_row, $mode.(($lightbox_id) ? "&lightbox_id=".$lightbox_id : ""), 0, 1);
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 3.1
Find:
Code: [Select]
 if (!empty($user_info['lightbox_image_ids'])) {
    $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  $ids = $user_info['lightbox_image_ids'];
  if ($lightbox_id)
  {
    $sql = "SELECT l.lightbox_id, l.lightbox_name, l.lightbox_private, l.lightbox_image_ids, l.user_id, u.user_name, u.user_lightbox_private
            FROM ".LIGHTBOXES_TABLE." l
            LEFT JOIN ".USERS_TABLE." u ON u.user_id = l.user_id
            WHERE l.lightbox_id = '".$lightbox_id."'";
    if ($row = $site_db->query_firstrow($sql))
    {
      $ids = (!$row['lightbox_private'] && $row['user_lightbox_private'] && $config['lightbox_share'] || $user_info['user_level'] == ADMIN ) ? $row['lightbox_image_ids'] : "";//$user_info['lightbox_image_ids'];
      $lightbox_name = $row['lightbox_name']." (".$row['user_name'].")";
    }
    else
    {
      $lightbox_name = "";
    }
  }
  else
  {
    $lightbox_name = $user_info['lightboxes'][$user_info['user_lightbox']]['name'];
  }
  $txt_clickstream = $lang['lightbox'].(($lightbox_name) ? " - ".$lightbox_name : "");
  if (!empty($ids)) {
    $image_id_sql = str_replace(" ", ", ", trim($ids));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 3.2
Find:
Code: [Select]
 $next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  $next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode.(($lightbox_id) ? "&lightbox_id=".$lightbox_id : "") : ""));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 3.3
Find:
Code: [Select]
 $prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""));Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  $prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode.(($lightbox_id) ? "&lightbox_id=".$lightbox_id : "") : ""));
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 3.5
Find:
Code: [Select]
 $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  $page_url .= ($lightbox_id) ? (($page_url) ? "&" : "?")."lightbox_id=".$lightbox_id : "";
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$txt_clickstream."</a>".$config['category_separator'];
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 4
Open member.php
Find in 4images v1.7-1.7.6:
Code: [Select]
   $user_homepage = (isset($user_row['user_homepage'])) ? format_url($user_row['user_homepage']) : REPLACE_EMPTY;Find in 4images v1.7.7 or newer:
Code: [Select]
   $user_homepage = (isset($user_row['user_homepage'])) ? format_text(format_url($user_row['user_homepage']), 2) : REPLACE_EMPTY;
Insert above:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START INSERT
*/
    $user_lightbox = "";
    $limit = ($user_row['user_lightbox_count'] == -1 || !$config['lightbox_count'] || $user_row['user_level'] == ADMIN) ? -1 : (($user_row['user_lightbox_count']) ? $user_row['user_lightbox_count'] : $config['lightbox_count']);
    if ((($user_row['user_lightbox_private'] || $user_row['user_level'] == ADMIN) && $config['lightbox_share']) || $user_info['user_level'] == ADMIN)
    {
      $condition = "";
      if ($limit != -1)
      {
        $condition = " LIMIT ".$limit;
      }
      $condition;
      $sql = "SELECT lightbox_id, lightbox_name, lightbox_private, lightbox_image_ids
              FROM ".LIGHTBOXES_TABLE."
              WHERE user_id = ".$user_row['user_id'].$condition;
      $result = $site_db->query($sql);
      if ($result)
      {
        while ($row = $site_db->fetch_array($result))
        {
          if (!$row['lightbox_private'] || $user_info['user_level'] == ADMIN)
          {
            $user_lightbox .= (($user_lightbox) ? "<br />" : "").(($user_info['user_level'] == ADMIN) ? ((!$row['lightbox_private']) ? "+ " : "- ") : "")."<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php?lightbox_id=".$row['lightbox_id'])."\">".$row['lightbox_name']." (".((trim($row['lightbox_image_ids'])) ? count(explode(" ", trim($row['lightbox_image_ids']))) : 0).")</a>\n";
          }
        }
      }
    }
    $site_template->register_vars(array(
      "user_lightbox" => $user_lightbox,
      "lang_user_lightbox" => $lang['user_lightbox'],
    ));
/*
  MOD MULTI-LIGHTBOXES
  END INSERT
*/

Step 4.1
Find:
Code: [Select]
 $user_invisible = (isset($HTTP_POST_VARS['user_invisible'])) ? intval($HTTP_POST_VARS['user_invisible']) : 0;Insert below:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START INSERT
*/
//these settings can not be changed by the user, only by administrator from ACP
  if (isset($HTTP_POST_VARS['user_lightbox'])) unset($HTTP_POST_VARS['user_lightbox']);
  if (isset($HTTP_POST_VARS['user_lightbox_private'])) unset($HTTP_POST_VARS['user_lightbox_private']);
  if (isset($HTTP_POST_VARS['user_lightbox_count'])) unset($HTTP_POST_VARS['user_lightbox_count']);
/*
  MOD MULTI-LIGHTBOXES
  END INSERT
*/



Step 5
Open download.php
Find:
Code: [Select]
 if (empty($user_info['lightbox_image_ids']) || !function_exists("gzcompress") || !function_exists("crc32")) {Insert above:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START INSERT
*/
  $lightbox_id = (isset($HTTP_POST_VARS['lightbox_id']) && $HTTP_POST_VARS['lightbox_id']) ? $HTTP_POST_VARS['lightbox_id'] : ((isset($HTTP_GET_VARS['lightbox_id']) && $HTTP_GET_VARS['lightbox_id']) ? $HTTP_GET_VARS['lightbox_id'] : 0);
  if ($lightbox_id)
  {
    $sql = "SELECT l.lightbox_id, l.lightbox_name, l.lightbox_private, l.lightbox_image_ids, l.user_id, u.user_name, u.user_lightbox_private
            FROM ".LIGHTBOXES_TABLE." l
            LEFT JOIN ".USERS_TABLE." u ON u.user_id = l.user_id
            WHERE l.lightbox_id = '".$lightbox_id."'";
    $row = $site_db->query_firstrow($sql);
    $user_info['lightbox_image_ids'] = (!$row['lightbox_private'] && $row['user_lightbox_private'] && $config['lightbox_share'] || $user_info['user_level'] == ADMIN ) ? $row['lightbox_image_ids'] : "";//$user_info['lightbox_image_ids'];
  }
/*
  MOD MULTI-LIGHTBOXES
  END INSERT
*/


Step 6
Open includes/functions.php
Find:
Code: [Select]
 $sql = "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = ".$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
          WHERE user_id = ".$user_info['user_id'];
  return ($site_db->query($sql)) ? 1 : 0;
(there are two instances of this block of code, you must do changes from this step only on find the first instance! This block located inside add_to_lightbox function)
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  $sql = "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = ".$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
          WHERE user_id = ".$user_info['user_id']." AND id = ".$user_info['user_lightbox'];
  if ($site_db->query($sql))
  {
    $user_info['lightboxes'][$user_info['user_lightbox']]['count']++;
    $user_info['lightboxes_list'][$user_info['user_lightbox']] = lightbox_trim($user_info['lightboxes'][$user_info['user_lightbox']]['name'])." (".$user_info['lightboxes'][$user_info['user_lightbox']]['count'].")";
    return true;
  }
  return false;
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 6.1
Find:
Code: [Select]
 $sql = "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = ".$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
          WHERE user_id = ".$user_info['user_id'];
  return ($site_db->query($sql)) ? 1 : 0;
(yes, this is the exact same block as in previous step, but this is second instance! This block located inside remove_from_lightbox function)
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  $sql = "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = ".$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
          WHERE user_id = ".$user_info['user_id']." AND id = ".$user_info['user_lightbox'];
  if ($site_db->query($sql)) {
    $user_info['lightboxes'][$user_info['user_lightbox']]['count']--;
    $user_info['lightboxes_list'][$user_info['user_lightbox']] = lightbox_trim($user_info['lightboxes'][$user_info['user_lightbox']]['name'])." (".$user_info['lightboxes'][$user_info['user_lightbox']]['count'].")";
    return true;
  }
  return false;
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 6.2
Find:
Code: [Select]
 $sql = "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_image_ids = '', lightbox_lastaction = $current_time
          WHERE user_id = ".$user_info['user_id'];
  if ($site_db->query($sql)) {
Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
  $sql = "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = ".$current_time.", lightbox_image_ids = ''
          WHERE user_id = ".$user_info['user_id']." AND id = ".$user_info['user_lightbox'];
  if ($site_db->query($sql)) {
    $user_info['lightboxes'][$user_info['user_lightbox']]['count'] = 0;
    $user_info['lightboxes_list'][$user_info['user_lightbox']] = lightbox_trim($user_info['lightboxes'][$user_info['user_lightbox']]['name'])." (0)";
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 6.3
At the end of the file, above closing ?> insert:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START INSERT
*/function lightbox_trim($name)
{
  $max = 10;
  if (strlen($name) > $max)
  {
    $name = substr($name, 0, $max)."...";
  }
  return $name;
}
function fixhtml($text, $quote = 1, $amp = 0)
{
  if ($amp) $text = str_replace("&", "&amp;", $text);
  if ($quote) $text = str_replace("\"", "&quot;", $text);
  $text = str_replace("<", "&lt;", str_replace(">", "&gt;", $text));
  return $text;
}
/*
  MOD MULTI-LIGHTBOXES
  END INSERT
*/


Step 6.4
If you have PM v2 mod installed, skip this step and continue to Step 7
Otherwise at the end of the file, above closing ?> insert:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START INSERT
*/
function get_msg($msg) {
  $txt = "";
  if (is_array($msg)) {
    $error = implode($msg['error'], "<br />");
    $good = implode($msg['good'], "<br />");
    $plain = implode($msg['plain'], "<br />");
  }
  else {
    $error = $msg;
  }
  if ($error) {
    $txt = "<div class=\"msg_error\">".$error."</div>";
  }
  if ($good) {
    $txt .= "<div class=\"msg_good\">".$good."</div>";
  }
  if ($plain) {
    $txt .= "<div class=\"msg_plain\">".$plain."</div>";
  }
  return $txt;
}
/*
  MOD MULTI-LIGHTBOXES
  END INSERT
*/



Step 7
Open includes/page_header.php
Find:
Code: [Select]
   $msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
    $msg = (add_to_lightbox($id)) ? preg_replace("/".$site_template->start."name".$site_template->end."/iU", $user_info['lightboxes'][$user_info['user_lightbox']]['name'], $lang['lightbox_add_success']) : preg_replace("/".$site_template->start."name".$site_template->end."/iU", $user_info['lightboxes'][$user_info['user_lightbox']]['name'], $lang['lightbox_add_error']);
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 7.1
Find:
Code: [Select]
   $msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
    $msg = (remove_from_lightbox($id)) ? preg_replace("/".$site_template->start."name".$site_template->end."/iU", $user_info['lightboxes'][$user_info['user_lightbox']]['name'], $lang['lightbox_remove_success']) : preg_replace("/".$site_template->start."name".$site_template->end."/iU", $user_info['lightboxes'][$user_info['user_lightbox']]['name'], $lang['lightbox_remove_error']);
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/


Step 7.2
Find:
Code: [Select]
   $msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];Replace with:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START REPLACE
*/
    $msg = (clear_lightbox()) ? preg_replace("/".$site_template->start."name".$site_template->end."/iU", $user_info['lightboxes'][$user_info['user_lightbox']]['name'], $lang['lightbox_clear_success']) : preg_replace("/".$site_template->start."name".$site_template->end."/iU", $user_info['lightboxes'][$user_info['user_lightbox']]['name'], $lang['lightbox_clear_error']);
/*
  MOD MULTI-LIGHTBOXES
  END REPLACE
*/

Step 7.3
Find:
Code: [Select]
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
Insert above:
Code: [Select]
/*
  MOD MULTI-LIGHTBOXES
  START INSERT
*/
//-----------------------------------------------------
//--- Multi-Lightboxes ---------------------------------
//-----------------------------------------------------
if ($user_info['user_level'] >= USER && $config['lightbox_count'])
{
  $user_lightbox_dropdown = (count($user_info['lightboxes_list']) > 1) ? get_dropdown_options("user_lightbox", $user_info['lightboxes_list'], $user_info['user_lightbox'], 1, 0, 1, 0, "", "lightboxidropdown") : "";
}
else
{
  $user_lightbox_dropdown = "";
}
$site_template->register_vars(array(
  "user_lightbox_dropdown" => $user_lightbox_dropdown,
  "lang_lightbox_select" => $lang['lightbox_select'],
));
$user_lightbox_dropdown = ($user_lightbox_dropdown) ? $site_template->parse_template("lightbox_dropdown") : "";
$site_template->register_vars("user_lightbox_form", $user_lightbox_dropdown);
/*
  MOD MULTI-LIGHTBOXES
  END INSERT
*/



Continue next reply

66
FAQ, Tips / Can not switch to a different template
« on: November 17, 2005, 01:32:31 AM »
It seems to be very common problem between new 4images users.
Quote
I uploaded a new template into /templates/ folder, then when I selected it in ACP (Admin Control Panel) - nothing changed
The answer is simple: you are trying switch to a new template in the wrong place.
It must be done in the Settings not at Templates* link in ACP

* Since 4images v1.7.2 that link was renamed to "Edit Templates"

67
This fix will fix a bug that allow visitors download images even these which they are not allowed to view. Also will fix proper redirection to the details page for the clients with blocked referer page.

In download.php find:
Code: [Select]
          WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id NOT IN (".get_auth_cat_sql("auth_download", "NOTIN").")";
Replace it with:
Code: [Select]
          WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN").get_auth_cat_sql("auth_download", "NOTIN").")";
Then find:
Code: [Select]
  if (!check_permission("auth_download", $image_row['cat_id']) || !$image_row) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

Replace it with:
Code: [Select]
  if (!$image_row || !check_permission("auth_viewcat", $image_row['cat_id']) || !check_permission("auth_viewimage", $image_row['cat_id'])) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }
  else
  {
    if (!check_permission("auth_download", $image_row['cat_id']))
    {
//      header("Location: ".$site_sess->url($url, "&"));
      header("Location: ".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id, "&"));
      exit;
    }
  }

68
Bug Fixes & Patches / [1.7/1.7.1] GET requests override POST requests
« on: November 06, 2005, 10:35:36 PM »
This is not quiet a bug and does not affect default 4images installation and only affects some MODs, especialy the ones that uses mod_rewrite in .htaccass.
By default 4images checks if anything was sent through GET and if so, it completely ignores POST and in most cases it should be opposite.

So the fix is replace in global.php:
Code: [Select]
if (isset($HTTP_GET_VARS['action']) || isset($HTTP_POST_VARS['action'])) {
  $action = (isset($HTTP_GET_VARS['action'])) ? stripslashes(trim($HTTP_GET_VARS['action'])) : stripslashes(trim($HTTP_POST_VARS['action']));
}
else {
  $action = "";
}

if (isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) {
  $mode = (isset($HTTP_GET_VARS['mode'])) ? stripslashes(trim($HTTP_GET_VARS['mode'])) : stripslashes(trim($HTTP_POST_VARS['mode']));
}
else {
  $mode = "";
}

if (isset($HTTP_GET_VARS[URL_CAT_ID]) || isset($HTTP_POST_VARS[URL_CAT_ID])) {
  $cat_id = (isset($HTTP_GET_VARS[URL_CAT_ID])) ? intval($HTTP_GET_VARS[URL_CAT_ID]) : intval($HTTP_POST_VARS[URL_CAT_ID]);
}
else {
  $cat_id = 0;
}

if (isset($HTTP_GET_VARS[URL_IMAGE_ID]) || isset($HTTP_POST_VARS[URL_IMAGE_ID])) {
  $image_id = (isset($HTTP_GET_VARS[URL_IMAGE_ID])) ? intval($HTTP_GET_VARS[URL_IMAGE_ID]) : intval($HTTP_POST_VARS[URL_IMAGE_ID]);
}
else {
  $image_id = 0;
}

if (isset($HTTP_GET_VARS[URL_ID]) || isset($HTTP_POST_VARS[URL_ID])) {
  $id = (isset($HTTP_GET_VARS[URL_ID])) ? intval($HTTP_GET_VARS[URL_ID]) : intval($HTTP_POST_VARS[URL_ID]);
}
else {
  $id = 0;
}

if (isset($HTTP_GET_VARS[URL_PAGE]) || isset($HTTP_POST_VARS[URL_PAGE])) {
  $page = (isset($HTTP_GET_VARS[URL_PAGE])) ? intval($HTTP_GET_VARS[URL_PAGE]) : intval($HTTP_POST_VARS[URL_PAGE]);

With this:
Code: [Select]
if (isset($HTTP_GET_VARS['action']) || isset($HTTP_POST_VARS['action'])) {
  $action = (isset($HTTP_POST_VARS['action'])) ? stripslashes(trim($HTTP_POST_VARS['action'])) : stripslashes(trim($HTTP_GET_VARS['action']));
}
else {
  $action = "";
}

if (isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) {
  $mode = (isset($HTTP_POST_VARS['mode'])) ? stripslashes(trim($HTTP_POST_VARS['mode'])) : stripslashes(trim($HTTP_GET_VARS['mode']));
}
else {
  $mode = "";
}

if (isset($HTTP_GET_VARS[URL_CAT_ID]) || isset($HTTP_POST_VARS[URL_CAT_ID])) {
  $cat_id = (isset($HTTP_POST_VARS[URL_CAT_ID])) ? intval($HTTP_POST_VARS[URL_CAT_ID]) : intval($HTTP_GET_VARS[URL_CAT_ID]);
}
else {
  $cat_id = 0;
}

if (isset($HTTP_GET_VARS[URL_IMAGE_ID]) || isset($HTTP_POST_VARS[URL_IMAGE_ID])) {
  $image_id = (isset($HTTP_POST_VARS[URL_IMAGE_ID])) ? intval($HTTP_POST_VARS[URL_IMAGE_ID]) : intval($HTTP_GET_VARS[URL_IMAGE_ID]);
}
else {
  $image_id = 0;
}

if (isset($HTTP_GET_VARS[URL_ID]) || isset($HTTP_POST_VARS[URL_ID])) {
  $id = (isset($HTTP_POST_VARS[URL_ID])) ? intval($HTTP_POST_VARS[URL_ID]) : intval($HTTP_GET_VARS[URL_ID]);
}
else {
  $id = 0;
}

if (isset($HTTP_GET_VARS[URL_PAGE]) || isset($HTTP_POST_VARS[URL_PAGE])) {
  $page = (isset($HTTP_POST_VARS[URL_PAGE])) ? intval($HTTP_POST_VARS[URL_PAGE]) : intval($HTTP_GET_VARS[URL_PAGE]);

69
This mod is usefull against auto-registrations, bots. It will display a picture with random code and visitor must type the code in the field.



As of v1.0 this mod works only with GD, no ImageMagick or NetPBM is supported. Also, GD must be compilled with TrueType library (you can check it in phpinfo())

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

Step 1

Download this package.
Unzip it and upload all files to the root of your 4images installation and restore the following file-tree:
rndimg.php
fonts/comicbd.tff
bg/1.png
bg/2.png
bg/3.png


CHMOD 666 all files

Try to execute rndimg.php by typing in your browser: http://example.com/4images/rndimg.php
If you see an image with code, then you can continue to the next step, otherwise its possible this mod will not work for you at all.


Step 2

Open register.php
Find:
Code: [Select]
    else {
      $msg .= (($msg != "") ? "<br />" : "").$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['email']), $lang['field_required']);
      $error = 1;
    }
Insert below:
Code: [Select]
    $code = $site_sess->get_session_var("rnd_code");
    if (!$code || !isset($HTTP_POST_VARS['code']) || empty($HTTP_POST_VARS['code']))
    {
      $msg .= (($msg != "") ? "<br />" : "").$lang['rndimg_required'];
      $error = 1;
    }
    elseif (strtoupper(trim($HTTP_POST_VARS['code'])) != $code)
    {
      $msg .= (($msg != "") ? "<br />" : "").$lang['rndimg_missmatch'];
      $error = 1;
    }



Step 2.1
Find:
Code: [Select]
  if ($error) {Insert below:
Code: [Select]
    include(ROOT_PATH."rndimg.php");
    $site_template->register_vars(array(
      "lang_rndimg" => $lang['rndimg'],
      "lang_rndimg_expl" => $lang['rndimg_expl'],
      "rndimg_url" => $site_sess->url(ROOT_PATH."rndimg.php?".MD5(time()), "&")."&",
    ));



Step 3

Open lang/<your langauge>/main.php
At the end, above closing ?> insert:
Code: [Select]
$lang['rndimg'] = "Security code";
$lang['rndimg_expl'] = "Please type code from the image<br />Click the image to change it's background";
$lang['rndimg_required'] = "Security code is required";
$lang['rndimg_missmatch'] = "You have entered a wrong security code";



Step 4

Open templates/<your template>/register_form.html
Add
Code: [Select]
          <tr>
            <td class="row2"><b>{lang_rndimg}:</b><br /><img src="{rndimg_url}" onClick="this.src='{rndimg_url}'+((Math.round(Math.random()*(999-100)))+100);"></td>
            <td class="row2 valign="top"><input type="text" name="code" size="5" value="" /><br /><span class="smalltext">{lang_rndimg_expl}</td>
          </tr>
(design is your task ;))




You can upload as many background images and fonts as you wish, no script changes required, the script will pick them randomly. The background images must be jpeg, gif or png type and should be bigger or equal then the WIDTH and HEIGHT settings that set in rndimg.php.
Fonts must be .ttf type.

The default number of letters in the "code" is set to 5, you can change it in rndimg.php in this line:
Quote
function get_code($num = 5, $safe = 1, $norepeat = 0)
when $safe variable is set to true (1) the letters from this array:
Code: [Select]
  $no = array("0","1","i","l","o","7"); //list of characters 0-9 and a-z to exclude from the list. lower case only!will be filtered out from the "code", they will not be used. Set to false (0) if you dont want use the filter.

When $norepeat is set to true (1) it will ensure that no the same letter/number will be generated more then ones. Default is allow duplicate letters/numbers.


There is also a little config that you can play with, which allow you to change size of the image, size of font, font color (shade of grey actualy)



If you would like integrate this mod into comments form, then you can follow ch€ri{Bi}² instructions from this post:
http://www.4homepages.de/forum/index.php?topic=10200.msg68176#msg68176

70
Mods & Plugins (Releases & Support) / [MOD] Sitemap v1.0
« on: August 14, 2005, 06:38:46 PM »
----------- [ Description ] ---------------

This mod will allow you to show list of all categories on one page aka sitemap.


This mod was started in [REQ] List links for all Categories and Subcategories in one page. topic.


----------- [ Changed/new files ] ---------------

Changed files

includes/page_header.php
lang/
<your language> /main.php
templates/
<your template> /user_logininfo.html
templates/
<your template> /user_loginform.html
templates/
<your template> /style.css


New files

sitemap.php
templates/
<your template> /sitemap.html
templates/
<your template> /images/folder1.gif
templates/
<your template> /images/folder2.gif
templates/
<your template> /images/folder3.gif
templates/
<your template> /images/folder4.gif
templates/
<your template> /images/folder_path.gif


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

Step 1

Download attached package below.
Unzip it and upload files to your 4images site, restoring the following file-tree:
sitemap.php
templates/
<your template> /sitemap.html
templates/
<your template> /images/folder1.gif
templates/
<your template> /images/folder2.gif
templates/
<your template> /images/folder3.gif
templates/
<your template> /images/folder4.gif
templates/
<your template> /images/folder_path.gif


Step 2
Open includes/page_header.php
Find:
Code: [Select]
  "media_url" => MEDIA_PATH,Insert below:
Code: [Select]
  "url_sitemap" => $site_sess->url(ROOT_PATH."sitemap.php"),
  "lang_sitemap" => $lang['sitemap'],


Step 3
Open lang/<your language> /main.php
At the end, just above closing ?> insert:
Code: [Select]
/*
  MOD SITEMAP
  START INSERT
*/
$lang['sitemap'] = "Sitemap";
$lang['sitemap_legend'] = "Legend";
$lang['sitemap_viewimages_yes'] = "Allowed view images";
$lang['sitemap_viewimages_no'] = "Not allowed view images";
$lang['sitemap_viewimages_new_yes'] = "With new images and you are allowed view images";
$lang['sitemap_viewimages_new_no'] = "With new images but you are not allowed view images";
$lang['sitemap_cat_info'] = "<span class=\"sitemapinfo\">{lang_images}{lang_new_images}{lang_hits}{lang_description}</span>";
$lang['sitemap_images'] = "Images: {images}";
$lang['sitemap_new_images'] = " (New: {new_images})";
$lang['sitemap_hits'] = " Hits: {hits}";
$lang['sitemap_description'] = " Description: {description}";
$lang['sitemap_hidden'] = "&lt; hidden &gt;";
/*
  MOD SITEMAP
  END INSERT
*/


Step 4
Open
templates/<your template> /user_logininfo.html
and
templates/<your template> /user_loginform.html
In the place where you want the link to sitemap be showed add the following html code:
Code: [Select]
&raquo; <a href="{url_sitemap}">{lang_sitemap}</a>

Step 5
Open templates/<your template> /style.css
Add:
Code: [Select]
/*
 MOD SITEMAP
 START INSERT
*/
.sitemapinfo
{
  font-size: 9px;
padding: 2px 2px 2px 2px;
margin: 2px 2px 2px 2px;
color: #8794A7;
}
.sitemaprow1
{
  background-color: #e1e1e1;
  color: #004c75;
}

.sitemaprow2
{
  background-color: #efefef;
  color: #004c75;
}
/*
 MOD SITEMAP
 END INSERT
*/

71
FAQ, Tips / Error Messages / Fehlermeldungen
« on: August 06, 2005, 12:35:09 AM »
We have combined most common error messages here:
http://www.4homepages.de/forum/index.php?board=18.0

72
FAQ, Tips / How can I show more new images on home page?
« on: July 20, 2005, 02:59:41 AM »
If you would like to show more new images on your 4images homepage, you will need:
Open index.php
Find:
Code: [Select]
$num_new_images = $config['image_cells'];Replace it with:
Code: [Select]
$num_new_images = XX;Where XX is the number of images.

73
If you are logged in to your 4images and give a link to someone, with sessionid attached to it (http://example.com/4images/index.php?sessiond=3DwRG-ef4YHhp3xIv3GOMnQ8Qtd) then there is a chance, that the visitor who visited that link may get automaticaly logged in with your account. This issue was introduced in 4images v1.7.1 (or atleast I've never heard anyone reporting it before that).

Here is a beta patch. Open includes/sessions.php find:
Code: [Select]
    if (!isset($this->session_info['session_user_id'])) {
        return false;
    }
Insert below:
Code: [Select]
    if (!isset($this->session_info['session_ip']) || (isset($this->session_info['session_ip']) && $this->session_info['session_ip'] != $this->user_ip))
    {
      session_regenerate_id();
      $this->session_id = session_id();
      return false;
    }

and to ensure this to work on PHP older then v4.3.2, insert at the end of includes/functions.php just above closing ?> this:
Code: [Select]
if (!function_exists("session_regenerate_id"))
{
  function session_regenerate_id()
  {
    return session_id(md5(uniqid(microtime())));
  }
}


As of now, this patch is in stage "beta", untill more people test it, on more then one computer ;)

74
This is a very common issue, but its not a bug in 4images!

It simple, when you give someone a link to your gallery with sessionid= attached to it, you also giving them a chance to get access to your account through that session!

NEVER GIVE ANYONE A LINK TO YOUR GALLERY WITH A sessionid= ATTACHED TO IT!!!

So, ok, what should you do if this happend?

You'll need edit your database with your favorite MySQL manager (phpmyadmin) and clear (NOT DELETE!!!) 4images_sessions table.
By doing so, you will eliminate any active sessions, meaning any member who logged in without "Log me on automatically next visit" checkbox checked will automaticaly get logged out.

[EDIT]
Try this patch:
http://www.4homepages.de/forum/index.php?topic=8895.0

75
Mods & Plugins (Releases & Support) / [MOD] MySQLi support
« on: July 03, 2005, 07:43:13 PM »
Some of u might know, that MySQL v4.1 can not be used with PHP v3, v4 and even v5 on Windows systems...I think I just heard someone said "huh? PHP5 supports MySQL v4.1 ! what are u talking about?"
Well, this is almost correct, exept for one detail - it supports through a different extension "MySQLi". But unfortunetly if a script that require mysql backend does not support MySQLi extension it will not work at all...
So, here is a support module that should alow 4images uses MySQLi extension.
Note, that not only Windows based servers can use this extension, its just Windows based servers have no other chose, exept for switching to MySQL v4.0.

(no longer valid, PHP v5 supports both extensions)


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

Step 1
Download attached db_mysqli.zip package. (see below)
Unpack it and upload to your server preserve the following directory tree:
includes/db_mysqli.php
data/database/default/mysqli_default.sql

(the mysqli_default.sql file is a simple copy of mysql_default.sql


Step 2
Apply this fix:
http://www.4homepages.de/forum/index.php?topic=8458.0


Step 3
If your 4images already installed then edit config.php
Replace
Code: [Select]
$db_servertype = "mysql";With
Code: [Select]
$db_servertype = "mysqli";

If its not installed, then during intallation u should have a chose between "mysql" and "mysqli" database type.


P.S.
Tested on:
Windows XP Pro SP2
Apache v2.0.52
PHP v5.0.2
MySQL v4.1.7


Windows XP Pro SP3
Apache v2.0.59
PHP v5.2.3
MySQL v5.0.41

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