Author Topic: deleting all LIGHTBOX code from script  (Read 6054 times)

0 Members and 1 Guest are viewing this topic.

Offline ~Ally~

  • Pre-Newbie
  • Posts: 7
    • View Profile
deleting all LIGHTBOX code from script
« on: August 23, 2005, 05:13:36 PM »
I noticed that even with the lightbox disabled (button deleted, lightbox.php deleted) the database is still being updated every single time a member logs in. Can this code be removed without messing up something else? My database is using too much RAM so I'm trying everything I can to cut back.

There is code on the following pages, at least:
details.php
Code: [Select]
//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = (check_permission("auth_readcomment", $cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name = htmlspecialchars($image_row['image_name']);
show_image($image_row, $mode, 0, 1);

$in_mode = 0;

$sql = "";
if ($mode == "lightbox") {
  if (!empty($user_info['lightbox_image_ids'])) {
    $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
    $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM ".IMAGES_TABLE."
            WHERE image_active = 1 AND image_id IN ($image_id_sql) AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").") AND cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN")."))
            ORDER BY ".$config['image_order']." ".$config['image_sort'];
    $in_mode = 1;
  }
}



//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];

if ($mode == "lightbox" && $in_mode) {
  $page_url = "";
  if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
    if (!empty($regs[1]) && $regs[1] != 1) {
      $page_url = "?".URL_PAGE."=".$regs[1];
    }
  }

index.php
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']
  )
);


categories.php
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']
  )
);

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: deleting all LIGHTBOX code from script
« Reply #1 on: September 22, 2005, 02:25:53 AM »
in includes/sessions.php find:
Code: [Select]
      $sql = "SELECT u.*, l.*
              FROM ".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
              WHERE ".get_user_table_field("u.", "user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.", "user_id");

Replace it with:
Code: [Select]
      $sql = "SELECT u.*
              FROM ".USERS_TABLE." u
              WHERE ".get_user_table_field("u.", "user_id")." = $user_id";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ~Ally~

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: deleting all LIGHTBOX code from script
« Reply #2 on: September 22, 2005, 02:35:31 AM »
thanks, I hope it helps with server strain a little :)

Offline haenz

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • HAENZWORLD
Re: deleting all LIGHTBOX code from script
« Reply #3 on: September 25, 2005, 10:58:19 PM »
so its allright to cancel the "lightbox-codes" from the other script...just replacing the one in details.php...or must be the others also replaced with an adapted script?!

cya luca