Author Topic: [MOD]-BETA Whole/part category download  (Read 77422 times)

0 Members and 1 Guest are viewing this topic.

Offline propertysnaps

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [MOD]-BETA Whole/part category download
« Reply #45 on: May 26, 2008, 02:33:43 PM »
I have just changed to a dedicated server and now this mod seems to have stoped working, I get this error (below)  however my lightbox download still works, so very weird.

This is the error.

DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id FROM 4images_images i, 4images_Jobs c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id = 373 AND c.cat_id = i.cat_id ORDER BY image_name ASC LIMIT 0, 40
Unknown column 'i.user_id' in 'on clause'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/property/public_html/imagemanager/includes/db_mysql.php on line 116

DB Error: Bad SQL Query: SELECT cat_id, image_media_file, image_download_url FROM 4images_images WHERE image_active = 1 AND image_id IN () AND cat_id IN (0, 451, 519, 488, 515, 484, 478, 486, 490, 462, 465, 476, 480, 448, 444, 494, 210, 333, 461, 518, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 561, 249, 446, 166, 341, 248, 247, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 48, 49, 56, 58, 62, 63, 64, 66, 68, 69, 70, 72, 73, 75, 77, 81, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 121, 122, 123, 124, 125, 126, 127, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 147, 148, 150, 151, 152, 154, 156, 157, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 223, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 326, 327, 328, 329, 330, 331, 332, 334, 335, 336, 337, 338, 339, 340, 342, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 361, 362, 363, 364, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 380, 381, 382, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 439, 432, 433, 434, 435, 436, 437, 438, 440, 441, 442, 443, 445, 447, 449, 450, 452, 453, 454, 455, 456, 457, 458, 459, 460, 463, 464, 466, 467, 468, 469, 470, 475, 477, 479, 481, 482, 483, 485, 487, 489, 493, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 516, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 556, 557, 558, 559, 560)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND cat_id IN (0, 451, 519, 488, 515, 484, 478, 486, 490, 462, 465, 476, 480, ' at line 3



Any help or ideas would be great

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD]-BETA Whole/part category download
« Reply #46 on: May 26, 2008, 02:52:50 PM »
hi,

try to change
http://www.4homepages.de/forum/index.php?topic=3479.0

2.2 (Add after:) code:

to
Code: [Select]
elseif ($action == "page") {
  if (!function_exists("gzcompress") || !function_exists("crc32")) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

//-------------------------------------------------------\\
//------- need find out witch pictures are desplayed ----\\
//------ this code was taken from categories.php file ---\\
//----- with some modification-adaption to this script --\\
//------- so, if someone could give me an example --------\\
//------- how to transfer a string from one php file -----\\
//------ to another, I would really appreciated and ------\\
//--------------- modification would be less -------------\\
//----- (I've tryed use global $string; - it didnt work) --\\
//--------------------------------------------------------\\

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}
$sql = "SELECT i.image_id, i.cat_id, i.user_id
        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 = $cat_id AND c.cat_id = i.cat_id
        ORDER BY ".$config['image_order']." ".$config['image_sort']."
        LIMIT ".$_GET['offset'].", $perpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$page_download = "";
while ($image_row = $site_db->fetch_array($result)){
$page_download .= ", ".$image_row['image_id'];
}
$image_id_sql = trim($page_download, ", ");
//--------------------------------------------------------------\\
//---- the rest of the code was taken from download-lightbox----\\
//--------------------------------------------------------------\\
  $sql = "SELECT cat_id, image_media_file, image_download_url
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_download").")";
  $result = $site_db->query($sql);
  if ($result) {
    include(ROOT_PATH."includes/zip.php");
    $zipfile = new zipfile();
    $file_added = 0;
    while ($image_row = $site_db->fetch_array($result)) {
      if (!empty($image_row['image_download_url'])) {
        if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
          $file_path = $image_row['image_download_url'];
          $file_name = basename($image_row['image_download_url']);
        }
      }
      elseif (is_remote($image_row['image_media_file'])) {
        $file_path = $image_row['image_media_file'];
        $file_name = basename($image_row['image_media_file']);
      }
      else {
        $file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
        $file_name = $image_row['image_media_file'];
      }

      if (!empty($file_path)) {
        @set_time_limit(120);
        if (!$file_data = get_file_data($file_path)) {
          continue;
        }
        $zipfile->add_file($file_data, $file_name);
        $file_added = 1;
        unset($file_data);
      }
    }

    if ($file_added) {
      @set_time_limit(120);
      $file['file_name'] = time().".zip";
      $file['file_data'] = $zipfile->file();
      $file['file_size'] = strlen($file['file_data']);
    }
    else {
      header("Location: ".$site_sess->url($url, "&"));
      exit;
    }
  }
}
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline propertysnaps

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [MOD]-BETA Whole/part category download
« Reply #47 on: May 26, 2008, 03:34:41 PM »
Weird, I have made the change but get this error now-

Fatal error: Call to undefined method Zipfile::file() in /home/property/public_html/imagemanager/download.php on line 353


this is my download.php file

<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: download.php                                         *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.4                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 0;

$nozip 1;
define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

function 
get_remote_file($url) {
  
$file_data "";
  
$url = @parse_url($url);
  if (isset(
$url['path']) && isset($url['scheme']) && eregi("http"$url['scheme'])) {
    
$url['port'] = (!isset($url['port'])) ? 80 $url['port'];
    if (
$fsock = @fsockopen($url['host'], $url['port'], $errno$errstr)) {
      @
fputs($fsock"GET ".$url['path']." HTTP/1.1\r\n");
      @
fputs($fsock"HOST: ".$url['host']."\r\n");
      @
fputs($fsock"Connection: close\r\n\r\n");
      
$file_data "";
      while (!@
feof($fsock)) {
        
$file_data .= @fread($fsock1000);
      }
      @
fclose($fsock);
      if (
preg_match("/Content-Length\: ([0-9]+)[^\/ \n]/i"$file_data$regs)) {
        
$file_data substr($file_datastrlen($file_data) - $regs[1], $regs[1]);
      }
    }
  }
  return (!empty(
$file_data)) ? $file_data 0;
}

function 
get_file_data($file_path) {
  global 
$script_url;
  
ob_start();
  @
ob_implicit_flush(0);
  @
readfile($file_path);
  
$file_data ob_get_contents();
  
ob_end_clean();
  if (!empty(
$file_data)) {
    return 
$file_data;
  }
  elseif (
is_remote_file($file_path)) {
    
$file_data get_remote_file($file_path);
  }
  else {
    if (!
file_exists($file_path)) {
      
$file_path preg_replace("/\/{2,}/""/"get_document_root()."/".$file_path);
    }
    if (
file_exists($file_path)) {
      
$file_size = @filesize($file_path);
      
$fp = @fopen($file_path"rb");
      if (
$fp) {
        
$file_data = @fread($fp$file_size);
        @
fclose($fp);
      }
    }
  }
  if (empty(
$file_data)) {
    if (
ereg("^\/"$file_path)) {
      
preg_match("/^(http:\/\/[^\/]+)/i"$script_url$regs);
      
$script_url $regs[1];
    }
    
$file_data get_remote_file($script_url."/".$file_path);
  }
  return (!empty(
$file_data)) ? $file_data 0;
}

function 
send_file($file_name$file_path) {
  
$data get_file_data($file_path);

  @
session_write_close();
	

	
header("Cache-Control: no-cache, must-revalidate");
  
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

  if (
get_user_os() == "MAC") {
    
header("Content-Type: application/x-unknown\n");
    
header("Content-Disposition: attachment; filename=\"".$file_name."\"\n");
  }
  elseif (
get_browser_info() == "MSIE") {
    
$disposition = (!eregi("\.zip$"$file_name)) ? 'attachment' 'inline';
    
header("Content-Disposition: $disposition; filename=\"".$file_name."\"\n");
    
header("Content-Type: application/x-ms-download\n");
  }
  else {
    
header("Content-Disposition: attachment; filename=\"".$file_name."\"\n");
    
header("Content-Type: application/octet-stream\n");
  }
  
header("Content-Length: ".strlen($data)."\n\n");

  echo 
$data;
}

$file = array();

if (
$action == "lightbox") {
  if (empty(
$user_info['lightbox_image_ids']) || !function_exists("gzcompress") || !function_exists("crc32")) {
    
redirect($url);
  }

  if (!
check_download_token($user_info['lightbox_image_ids'])) {
    
redirect("index.php");
  }

  
$image_id_sql str_replace(" "", "trim($user_info['lightbox_image_ids']));
  
$image_ids = array();
  
$sql "SELECT image_id, cat_id, image_media_file, image_download_url
          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").", ".get_auth_cat_sql("auth_viewcat""NOTIN").get_auth_cat_sql("auth_download""NOTIN").")";
  
$result $site_db->query($sql);

  if (
$result) {
    include(
ROOT_PATH."includes/zip.php");
    
$zipfile = new zipfile();
    
$file_added 0;
    while (
$image_row $site_db->fetch_array($result)) {
      if (!empty(
$image_row['image_download_url'])) {
        if (
is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
          
$file_path $image_row['image_download_url'];
          
$file_name basename($image_row['image_download_url']);
        }
      }
      elseif (
is_remote($image_row['image_media_file'])) {
        
$file_path $image_row['image_media_file'];
        
$file_name get_basefile($image_row['image_media_file']);
      }
      else {
        
$file_path MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
        
$file_name $image_row['image_media_file'];
      }

      if (!empty(
$file_path)) {
        @
set_time_limit(120);
        if (!
$file_data get_file_data($file_path)) {
          continue;
        }
        
$zipfile->add_file($file_data$file_name);
        
$file_added 1;
        unset(
$file_data);
        
$image_ids[] = $image_row['image_id'];
      }
    }

    if (
$file_added) {
      if (
$user_info['user_level'] != ADMIN) {
        
$sql "UPDATE ".IMAGES_TABLE."
                SET image_downloads = image_downloads + 1
                WHERE image_id IN ("
.trim(implode(", "$image_ids)).")";
        
$site_db->query($sql);
      }

      @
set_time_limit(120);
      
$file['file_data'] = $zipfile->send(time().".zip");
      exit;
    }
    else {
      
redirect($url);
    }
  }
}
elseif (
$image_id) {
  if (isset(
$HTTP_GET_VARS['size']) || isset($HTTP_POST_VARS['size'])) {
    
$size = (isset($HTTP_GET_VARS['size'])) ? intval($HTTP_GET_VARS['size']) : intval($HTTP_POST_VARS['size']);
  }
  else {
    
$size 0;
  }

  
$sql "SELECT cat_id, user_id, image_media_file, image_download_url, image_downloads
          FROM "
.IMAGES_TABLE."
          WHERE image_id = 
$image_id AND image_active = 1";
  
$image_row $site_db->query_firstrow($sql);

  if (!
$image_row || !check_permission("auth_viewcat"$image_row['cat_id']) || !check_permission("auth_viewimage"$image_row['cat_id'])) {
    
redirect($url);
  }
  else {
    if (!
check_permission("auth_download"$image_row['cat_id'])) {
      
redirect($url);
    }

    if (!
check_download_token($image_id)) {
      echo 
"Hotlinking is not allowed";
	
	
	
exit;
	
	
	
redirect("index.php");
    }
  }

  
$remote_url 0;
  if (!empty(
$image_row['image_download_url'])) {
    if (
is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
      
ereg("(.+)\.(.+)"basename($image_row['image_download_url']), $regs);
      
$file_name $regs[1];
      
$file_extension $regs[2];

      
$file['file_name'] = $file_name.(($size) ? "_".$size "").".".$file_extension;
      
$file['file_path'] = dirname($image_row['image_download_url'])."/".$file['file_name'];
    }
    else {
      
$file['file_path'] = $image_row['image_download_url'];
      
$remote_url 1;
    }
  }
  elseif (
is_remote_file($image_row['image_media_file'])) {
    
ereg("(.+)\.(.+)"get_basefile($image_row['image_media_file']), $regs);
    
$file_name $regs[1];
    
$file_extension $regs[2];

    
$file['file_name'] = $file_name.(($size) ? "_".$size "").".".$file_extension;
    
$file['file_path'] = dirname($image_row['image_media_file'])."/".$file['file_name'];
  }
  else {
    
ereg("(.+)\.(.+)"get_basefile($image_row['image_media_file']), $regs);
    
$file_name $regs[1];
    
$file_extension $regs[2];

    
$file['file_name'] = $file_name.(($size) ? "_".$size "").".".$file_extension;
    
$file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
  }

  if (
$user_info['user_level'] != ADMIN) {
    
$sql "UPDATE ".IMAGES_TABLE."
            SET image_downloads = image_downloads + 1
            WHERE image_id = 
$image_id";
    
$site_db->query($sql);
  }

  if (!empty(
$file['file_path'])) {
    @
set_time_limit(120);
    if (
$remote_url) {
      
redirect($file['file_path']);
    }

    if (
$action == "zip" && !eregi("\.zip$"$file['file_name']) && function_exists("gzcompress") && function_exists("crc32")) {
      include(
ROOT_PATH."includes/zip.php");
      
$zipfile = new zipfile();
      
$zipfile->add_file(get_file_data($file['file_path']), $file['file_name']);

      
$zipfile->send(get_file_name($file['file_name']).".zip");
    } else {
        
send_file($file['file_name'], $file['file_path']);
    }
    exit;
  }
  else {
    echo 
$lang['download_error']."\n<!-- EMPTY FILE PATH //-->";
    exit;
  }
}

elseif (
$action == "page") {
  if (!
function_exists("gzcompress") || !function_exists("crc32")) {
    
header("Location: ".$site_sess->url($url"&"));
    exit;
  }

//-------------------------------------------------------\\
//------- need find out witch pictures are desplayed ----\\
//------ this code was taken from categories.php file ---\\
//----- with some modification-adaption to this script --\\
//------- so, if someone could give me an example --------\\
//------- how to transfer a string from one php file -----\\
//------ to another, I would really appreciated and ------\\
//--------------- modification would be less -------------\\ 
//----- (I've tryed use global $string; - it didnt work) --\\
//--------------------------------------------------------\\

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}
$sql "SELECT i.image_id, i.cat_id, i.user_id
        FROM ("
.IMAGES_TABLE." i,  ".Jobs_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 = 
$cat_id AND c.cat_id = i.cat_id
        ORDER BY "
.$config['image_order']." ".$config['image_sort']."
        LIMIT "
.$_GET['offset'].", $perpage";
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);
$page_download "";
while (
$image_row $site_db->fetch_array($result)){
$page_download .= ", ".$image_row['image_id'];
}
$image_id_sql trim($page_download", ");
//--------------------------------------------------------------\\
//---- the rest of the code was taken from download-lightbox----\\
//--------------------------------------------------------------\\
  
$sql "SELECT cat_id, image_media_file, image_download_url
          FROM "
.IMAGES_TABLE."
          WHERE image_active = 1 AND image_id IN (
$image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_download").")";
  
$result $site_db->query($sql);
  if (
$result) {
    include(
ROOT_PATH."includes/zip.php");
    
$zipfile = new zipfile();
    
$file_added 0;
    while (
$image_row $site_db->fetch_array($result)) {
      if (!empty(
$image_row['image_download_url'])) {
        if (
is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
          
$file_path $image_row['image_download_url'];
          
$file_name basename($image_row['image_download_url']);
        }
      }
      elseif (
is_remote($image_row['image_media_file'])) {
        
$file_path $image_row['image_media_file'];
        
$file_name basename($image_row['image_media_file']);
      }
      else {
        
$file_path MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
        
$file_name $image_row['image_media_file'];
      }

      if (!empty(
$file_path)) {
        @
set_time_limit(120);
        if (!
$file_data get_file_data($file_path)) {
          continue;
        }
        
$zipfile->add_file($file_data$file_name);
        
$file_added 1;
        unset(
$file_data);
      }
    }

    if (
$file_added) {
      @
set_time_limit(120);
      
$file['file_name'] = time().".zip";
      
$file['file_data'] = $zipfile->file();
      
$file['file_size'] = strlen($file['file_data']);
    }
    else {
      
header("Location: ".$site_sess->url($url"&"));
      exit;
    }
  }
}

else {
  echo 
$lang['download_error']."\n<!-- NO ACTION SPECIFIED //-->";
  exit;
}

exit;
?>
« Last Edit: October 11, 2010, 06:25:34 PM by Rembrandt »

Offline propertysnaps

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [MOD]-BETA Whole/part category download
« Reply #48 on: June 14, 2008, 08:21:31 AM »
Fixed it by replacing


    if ($file_added) {
      @set_time_limit(120);
      $file['file_name'] = time().".zip";
      $file['file_data'] = $zipfile->file();
      $file['file_size'] = strlen($file['file_data']);
    }
    else {

with

    if ($file_added) {
      @set_time_limit(120);
 $file['file_data'] = $zipfile->send(time().".zip");

Offline khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD]-BETA Whole/part category download
« Reply #49 on: October 01, 2010, 10:38:25 PM »
Hello,

Trying to use this MOD with 4images 1.7.7, when click on download button i get this error.
Code: [Select]
An unexpected error occured. Please try again later.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/user3/public_html/includes/db_mysql.php on line 116

An unexpected error occured. Please try again later.

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: [MOD]-BETA Whole/part category download
« Reply #50 on: October 02, 2010, 06:21:23 AM »
try re-do step 2.2
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)

Deepanshu

  • Guest
Re: [MOD]-BETA Whole/part category download
« Reply #51 on: October 02, 2010, 09:09:53 AM »
This message has been deleted by Rembrandt as spam!
« Last Edit: October 02, 2010, 03:18:03 PM by Rembrandt »

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [MOD]-BETA Whole/part category download
« Reply #52 on: October 11, 2010, 05:49:41 PM »
try re-do step 2.2

Hi,

iam getting this:

Code: [Select]
Fatal error: Call to undefined function get_file_data() in /home/www/web0/html/4images/download.php on line 338
Is it working for someone with 1.7.8?


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

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: [MOD]-BETA Whole/part category download
« Reply #53 on: October 12, 2010, 02:29:59 AM »
I've updated step 2.1
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 x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [MOD]-BETA Whole/part category download
« Reply #54 on: October 12, 2010, 03:42:31 AM »
I've updated step 2.1

Hi,

thx but i got this:

Code: [Select]
Fatal error: Call to undefined method Zipfile::file() in /home/www/web0/html/4images/download.php on line 357
EDIT:

Quote from: chrisonline link=topic=3479.msg100970#msg100970
For the Version 1.7.x you must change following line

      $file['file_data'] = $zipfile->file();

with this one

      $file['file_data'] = $zipfile->send(time().".zip");

After that the MOD doing his job succesfully

After this it was working ;) thx chris

Edit2:

but if download_button is placed in categories.html and i navigate into the first categorie that
is only a container for the subcategories with the images and press the download button in get:

Code: [Select]
DB Error: Bad SQL Query: SELECT cat_id, image_media_file, image_download_url FROM 4images_images WHERE image_active = 1 AND image_id IN () AND cat_id IN (0, 1, 16, 33, 2, 9, 29, 4, 6, 28, 7, 27, 19, 26, 18, 34, 17, 35, 14, 36, 13, 37, 12, 3, 31)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND cat_id IN (0, 1, 16, 33, 2, 9, 29, 4, 6, 28, 7, 27, 19, 26, 18, 34, 17, 35' at line 3

Is it normal that i have to be in the thumbnails view to get the button working because there it works.
Where to place download_button that it only shown in subcategories?


Greetz X23
« Last Edit: October 12, 2010, 04:07:08 AM by x23piracy »

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD]-BETA Whole/part category download
« Reply #55 on: October 14, 2010, 04:07:54 PM »
Thnx V@no this MOD is working for me now, the generated zip file name is numeric (random numbers "12387653.zip") is it possible to make zip file name as category name? i.e my_cat_name.zip.

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [MOD]-BETA Whole/part category download
« Reply #56 on: October 14, 2010, 05:03:30 PM »
Thnx V@no this MOD is working for me now, the generated zip file name is numeric (random numbers "12387653.zip") is it possible to make zip file name as category name? i.e my_cat_name.zip.

Hi,

thats the line that defines the name (download.php):

Code: [Select]
     $file['file_name'] = time().".zip";
you should change:

Code: [Select]
time().
to what ever i think... im not sure but maybe V@no clears that up ;)
Iam also not sure if $cat_name is working in download.php...

EDIT:

It seems that iam wrong with that, i've tried:

Code: [Select]
time()."pups.zip"
But the filename is allready only the timestamp... hmmm V@no help please :)


Greetz X23

« Last Edit: October 14, 2010, 08:24:16 PM by x23piracy »

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

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: [MOD]-BETA Whole/part category download
« Reply #57 on: October 15, 2010, 01:33:16 AM »
@x23piracy:
that is the correct line and it should work...

Try replace that line with:
      $file['file_name'] = $cat_cache[$cat_id]['cat_name'].".zip";
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 khan

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [MOD]-BETA Whole/part category download
« Reply #58 on: October 15, 2010, 01:05:32 PM »
Hi,

thnx for your help works fine for me now just want v@no to review the code if it is ok.
if ($file_added) {
      @
set_time_limit(120);
      
$file['file_name'] = $cat_cache[$cat_id]['cat_name'].".zip";
      
$file['file_data'] = $zipfile->send($cat_cache[$cat_id]['cat_name'].".zip");
      
$file['file_size'] = strlen($file['file_data']);
    }


Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [MOD]-BETA Whole/part category download
« Reply #59 on: October 15, 2010, 01:33:55 PM »
Hi,

thnx for your help works fine for me now just want v@no to review the code if it is ok.
if ($file_added) {
      @
set_time_limit(120);
      
$file['file_name'] = $cat_cache[$cat_id]['cat_name'].".zip";
      
$file['file_data'] = $zipfile->send($cat_cache[$cat_id]['cat_name'].".zip");
      
$file['file_size'] = strlen($file['file_data']);
    }



Hi,

it's working you can try that without any risk ;)


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--