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.


Messages - Husky

Pages: [1] 2
1
Yes, an mod which saves the settings of images per page in cookies would be great :)


There is one, I just wasn't able to remember the name or to find it in here again.

2
Hi my friends,

I am searching a tool (I know it exists, but was not able to find it), which is saving the preferences of a user in a cookie, so that the user will have his settings again when he comes back.

F.e. I want to see all 40 pictures on a page and not only 12!

Can somebody give me that link (to this Mod?!)


Thank you very much!

3
Well our Server has "Safe Mode" but I already fixed that problem with the help of this forum!

About php ... Our server runs with

MySQL - 5.0.24a
and
phpMyAdmin - 2.8.2


Husky

4
Again this error ...


The problem is the ADD CATEGORY thing is not working ...

After adding a category, I get the error and the folder is not on my FTP Account!

But the folder is in the gallery but you can not move or upload pictures in it!
When I create a folder (with the cat number) manuelly on my FTP Account, everything works fine!!!

I need your help!

Husky

PS: This is excatly my problem ...
http://www.4homepages.de/forum/index.php?topic=3383.0

But it is not working after the first category, like mentioned in the FAQ!

5
The rights are all 777 in the folders you mentioned!

This is my code:
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: categories.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.                              *
 *                                                                        *
 *************************************************************************/

define('IN_CP'1);
define('ROOT_PATH''./../');
require(
'admin_global.php');

$show_all_subcats false;
$open_cat_link '<img src="./images/plus.gif" border="0">';
$close_cat_link '<img src="./images/minus.gif" border="0">';

$show_cat_order_dropdown true;

include(
ROOT_PATH.'includes/search_utils.php');

if (
$action == "") {
  
$action "modifycats";
}

$access_field_array = array(
  
"auth_viewcat" => AUTH_ALL,
  
"auth_viewimage" => AUTH_ALL,
  
"auth_download" => AUTH_USER,
  
"auth_upload" => AUTH_USER,
  
"auth_directupload" => AUTH_ADMIN,
  
"auth_vote" => AUTH_ALL,
  
"auth_sendpostcard" => AUTH_ALL,
  
"auth_readcomment" => AUTH_ALL,
  
"auth_postcomment" => AUTH_USER
);

$access_array = array(
  
AUTH_ALL => $lang['all'],
  
AUTH_USER => $lang['userlevel_registered'],
  
AUTH_ACL => $lang['private'],
  
AUTH_ADMIN => $lang['userlevel_admin']
);

function 
show_access_select($title ""$type$status) {
  global 
$access_array$HTTP_POST_VARS;
  if (isset(
$HTTP_POST_VARS[$type])) {
    
$status $HTTP_POST_VARS[$type];
  }
  echo 
"<tr class=\"".get_row_bg()."\" valign=\"top\">\n<td><p class=\"rowtitle\">".$title."</p></td>\n";
  echo 
"<td>\n<select name=\"".$type."\">\n";
  foreach (
$access_array as $key => $val) {
    echo 
"<option value=\"".$key."\"";
    if (
$status == $key) {
      echo 
" selected=\"selected\"";
    }
    echo 
">".$val."</option>\n";
  }
  echo 
"</select>\n</td>\n</tr>\n";
}

 function 
create_cat_folder($path$mode) {
   if (@
is_dir($path)) {
     @
chmod($path$mode);
     return 
true;
   }
   else {
     
$oldumask umask(0);
     
$result mkdir($path$mode);
     
umask($oldumask);
     if (!@
is_dir($path) || !$result) {
       
$result mkdir($path0755);
      @
chmod($path$mode);
     }
     return 
$result;
   }
 }

//initialisation de la connection FTP
$ftp_server='XXX'// your FTP IP Serveur
$conn_id ftp_connect($ftp_server);

// login et mot de passe
$user="XXX"// your login name
$passwd="XXX"// your password
$login_result ftp_login($conn_id$user$passwd);

// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {
echo 
"Mauvaise connexion FTP";
echo 
"Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result ftp_mkdir($conn_id,$path);
}

//Fermeture de la connection ftp
ftp_close($conn_id);
}

//initialisation de la connection FTP
$ftp_server='XXX'// your FTP IP Serveur
$conn_id ftp_connect($ftp_server);

// login et mot de passe
$user="XXX"// your login name
$passwd="XXX"// your password
$login_result ftp_login($conn_id$user$passwd);

// Vérification de la connection
if ((!$conn_id) || (!$login_result)) {
echo 
"Mauvaise connexion FTP";
echo 
"Essaye de se connecter a $ftp_server for user $ftp_user_name";
die;
} else {

//ici, la connection est bien effectuée, alors on appelle la fonction qui crée le répertoire
$result ftp_rmdir($conn_id,$path);
}

//Fermeture de la connection ftp
ftp_close($conn_id);

}

function 
remove_subcategories($cid 0$depth 1) {
  global 
$site_db$error_log$lang$category_cache;

  if (!isset(
$category_cache[$cid])) {
    return 
false;
  }
  foreach (
$category_cache[$cid] as $key => $cats) {
    echo 
"<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>\n";
    if (
$depth 1) {
      echo 
str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;"$depth 1)."\n";
    }
    echo 
"</td><td>\n";

    
$sql "DELETE FROM ".GROUP_ACCESS_TABLE."
            WHERE cat_id = "
.$cats['cat_id'];
    
$site_db->query($sql);

    
$sql "DELETE FROM ".CATEGORIES_TABLE."
            WHERE cat_id = "
.$cats['cat_id'];

    if (
$site_db->query($sql)) {
      echo 
$lang['cat_delete_success']." <b>".format_text($cats['cat_name'], 2)."</b> (ID: ".$cats['cat_id'].")<br />\n";
    }
    else {
      
$error_log[] = $lang['cat_delete_error']." <b>".format_text($cats['cat_name'], 2)."</b> (ID: ".$cats['cat_id'].")";
    }

    
$sql "SELECT image_id
            FROM "
.IMAGES_TABLE."
            WHERE cat_id = "
.$cats['cat_id'];
    
$img_result $site_db->query($sql);

    
$image_ids_sql 0;
    while (
$image_row $site_db->fetch_array($img_result)) {
      
$image_ids_sql .= (($image_ids_sql != "") ? ", " "").$image_row['image_id'];
    }

    
$sql "DELETE FROM ".IMAGES_TABLE."
            WHERE image_id IN (
$image_ids_sql)";
    if (
$site_db->query($sql)) {
      echo 
"-&raquo ".$lang['image_delete_success']."<br />\n";
    }
    else {
      
$error_log[] = $lang['image_delete_error']." (".format_text($cats['cat_name'], 2).", ID: ".$cats['cat_id'].")";
    }

    if (!empty(
$cats['cat_id'])) {
      if (
remove_cat_folder(MEDIA_PATH."/".$cats['cat_id'])) {
        echo 
"-&raquo ".$lang['file_delete_success']."<br />\n";
      }
      else {
        
$error_log[] = $lang['file_delete_error']." (".format_text($cats['cat_name'], 2).", ID: ".$cats['cat_id'].")";
      }
      if (
remove_cat_folder(THUMB_PATH."/".$cats['cat_id'])) {
        echo 
"-&raquo ".$lang['thumb_delete_success']."<br />\n";
      }
      else {
        
$error_log[] = $lang['thumb_delete_error']." (".format_text($cats['cat_name'], 2).", ID: ".$cats['cat_id'].")";
      }
    }

    
$sql "DELETE FROM ".COMMENTS_TABLE."
            WHERE image_id IN (
$image_ids_sql)";
    if (
$site_db->query($sql)) {
      echo 
"-&raquo ".$lang['comments_delete_success']."<br />\n";
    }
    else {
      
$error_log[] = $lang['comments_delete_error']." (".format_text($cats['cat_name'], 2).", ID: ".$cats['cat_id'].")";
    }

    
remove_searchwords($image_ids_sql);

    echo 
"<br /></td></tr></table>\n";
    
remove_subcategories($cats['cat_id'], $depth 1);
  }
  unset(
$category_cache[$cid]);
  return 
true;
}

function 
show_category_rows($cid 0$depth 1) {
  global 
$site_db$site_sess$lang$category_cache$cat_parent_cache;

  if (!isset(
$category_cache[$cid])) {
    return 
false;
  }
  foreach (
$category_cache[$cid] as $key => $cats) {
    
$class "tablerow2";
    if (
$cats['cat_parent_id'] == 0) {
      
$class "tablerow";
    }

    echo 
"<tr class=\"$class\">\n";

    if (!
$GLOBALS['show_all_subcats']) {
      if (!empty(
$cat_parent_cache[$cats['cat_id']])) {

        
$href $site_sess->url("categories.php?action=modifycats");
        if (isset(
$GLOBALS['map'][$cats['cat_id']]) || $GLOBALS['open_all']) {
          
$char $GLOBALS['close_cat_link'];
          
$href .= "&closecat=".$cats['cat_id'];
        } else {
          
$char $GLOBALS['open_cat_link'];
          
$href .= "&opencat=".$cats['cat_id'];
        }
        
$char '<a href="'.$href.'">'.$char.'</a>';
      } else {
          
$char '&nbsp;';
      }
      echo 
"<td align=\"center\">".$char."</td>";
    }

    echo 
"<td>\n";

    if (
$depth 1) {
      echo 
str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;"$depth 1)."<img src=\"images/folder_path.gif\" alt=\"\">\n";
    }
    echo 
"<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" target=\"_blank\">".format_text($cats['cat_name'], 2)."</a>\n</b> (ID: ".$cats['cat_id'].")&nbsp;&nbsp;&nbsp;&nbsp;";
    
show_text_link($lang['edit'], "categories.php?action=editcat&cat_id=".$cats['cat_id']);
    
show_text_link($lang['delete'], "categories.php?action=removecat&cat_id=".$cats['cat_id']);
    
show_text_link($lang['add_subcategory'], "categories.php?action=addcat&cat_parent_id=".$cats['cat_id']);
    echo 
"\n</td>\n<td align=\"center\">";
    echo 
"<a href=\"".$site_sess->url("categories.php?action=ordercat&move=up&cat_id=".$cats['cat_id'])."\"><img src=\"images/arrow_up.gif\" border=\"0\"></a>\n";
    echo 
"<a href=\"".$site_sess->url("categories.php?action=ordercat&move=down&cat_id=".$cats['cat_id'])."\"><img src=\"images/arrow_down.gif\" border=\"0\"></a>\n";
    echo 
"</td>\n</tr>\n";
    
show_category_rows($cats['cat_id'], $depth 1);
  }
  unset(
$category_cache[$cid]);
}

function 
update_cat_order($parent_id 0) {
  global 
$site_db;
  
$sql "SELECT cat_id
          FROM "
.CATEGORIES_TABLE."
          WHERE cat_parent_id = 
$parent_id
          ORDER BY cat_order ASC"
;
  
$result $site_db->query($sql);
  
$i 10;
  while (
$row $site_db->fetch_array($result)) {
    
$sql "UPDATE ".CATEGORIES_TABLE."
            SET cat_order = 
$i
            WHERE cat_id = "
.$row['cat_id'];
    
$site_db->query($sql);
    
$i += 10;
  }
}

function 
get_cat_order_dropdown($parent_id 0$cat_order 0) {
  global 
$cat_cache$cat_parent_cache$lang$HTTP_POST_VARS;

  
$category_list "
<script language=\"JavaScript\" type=\"text/JavaScript\">
<!--
var group = new Array();
"
;
foreach (
$cat_parent_cache as $key => $val) {
  
$i 0;
  
$category_list .= "group[".$key."] = new Array();\n";
  
$category_list .= "group[".$key."][".$i++."] = new Option(\"".$lang['at_beginning']."\", \"5\");\n";
  
$category_list .= "group[".$key."][".$i++."] = new Option(\"".$lang['at_end']."\", \"0\");\n";

  foreach (
$val as $val2) {
    
$category_list .= "group[".$key."][".$i++."] = new Option(\"".$lang['after']." ".format_text($cat_cache[$val2]['cat_name'], 2)."\", \"".($cat_cache[$val2]['cat_order'] + 5)."\");\n";
  }
  
$category_list .= "\n";
}
$category_list .= "
function update_order_select(x) {
  for (i = document.cat_form.cat_order.length - 1; i > 0; i--) {
    document.cat_form.cat_order.options[i] = null;
  }

  if (!group[x]) {
    return;
  }

  for (i = 0; i < group[x].length; i++) {
    document.cat_form.cat_order.options[i] = new Option(group[x][i].text, group[x][i].value);
  }
  document.cat_form.cat_order.options[0].selected = true;
}
//-->
</script>
"
;

  
$category_list .= "\n<select name=\"cat_order\" class=\"categoryselect\">\n";
  
$category_list .= "<option value=\"0\"";
  if (isset(
$HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == 0) {
    
$category_list .= " selected";
  }
  
$category_list .= ">".$lang['at_end']."</option>\n";
  
$category_list .= "<option value=\"5\"";
  if (isset(
$HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == 5) {
    
$category_list .= " selected";
  }
  elseif (!isset(
$HTTP_POST_VARS['cat_order']) && $cat_order == 10) {
    
$category_list .= " selected";
  }
  
$category_list .= ">".$lang['at_beginning']."</option>\n";
  if (isset(
$cat_parent_cache[$parent_id])) {
    foreach (
$cat_parent_cache[$parent_id] as $key => $val) {
      
$category_list .= "<option value=\"".($cat_cache[$val]['cat_order'] + 5)."\"";
      if (isset(
$HTTP_POST_VARS['cat_order']) && $HTTP_POST_VARS['cat_order'] == ($cat_cache[$val]['cat_order'] + 5)) {
        
$category_list .= " selected";
      }
      elseif (!isset(
$HTTP_POST_VARS['cat_order']) && $cat_cache[$val]['cat_order'] == $cat_order 10) {
        
$category_list .= " selected";
      }
      
$category_list .= ">".$lang['after']." ".format_text($cat_cache[$val]['cat_name'], 2)."</option>\n";
    }
  }
  
$category_list .= "</select>
  <script language=\"JavaScript\" type=\"text/JavaScript\">
  //update_order_select("
.$parent_id.");
  </script>
  "
;

  return 
$category_list;
}

function 
get_subcategories_id($cat_id 0) {
  global 
$subcat_ids$cat_parent_cache;

  if (!isset(
$cat_parent_cache[$cat_id])) {
    return 
false;
  }

  foreach (
$cat_parent_cache[$cat_id] as $key => $val) {
    
$subcat_ids[] = $val;
    
get_subcategories_id($val);
  }

  return 
$subcat_ids;
}

function 
forward_to_modify($msg) {
  global 
$site_sess;
  
$site_sess->set_session_var('msg'$msg);
  
redirect("categories.php?action=modifycats");
}

if (
$action == "ordercat") {
  
$cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);
  
$move = (isset($HTTP_POST_VARS['move'])) ? trim($HTTP_POST_VARS['move']) : trim($HTTP_GET_VARS['move']);

  
$number = ($move == "up") ? -15 15;

  
$sql "UPDATE ".CATEGORIES_TABLE."
          SET cat_order = cat_order + 
$number
          WHERE cat_id = 
$cat_id";
  
$site_db->query($sql);

  
update_cat_order($cat_cache[$cat_id]['cat_parent_id']);
  
//$action = "modifycats";
  
forward_to_modify($msg);
}

if (
$action == "deletecat") {
  
$error_log = array();
  
show_admin_header();
  
show_table_header($lang['main_category'], 1);
  
$cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  
$sql "SELECT cat_id, cat_name, cat_parent_id
          FROM "
.CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC"
;
  
$result $site_db->query($sql);
  
$category_cache = array();
  while (
$row $site_db->fetch_array($result)) {
    
$category_cache[$row['cat_parent_id']][$row['cat_id']] = $row;
  }

  echo 
"<tr><td class=\"tablerow\">\n";
  echo 
"<table border=\"0\" cellpadding=\"2\" cellspacing=0><tr><td>&nbsp;</td><td>\n";

  
$sql "DELETE FROM ".GROUP_ACCESS_TABLE."
          WHERE cat_id = "
.$cat_id;
  
$site_db->query($sql);

  
$sql "DELETE FROM ".CATEGORIES_TABLE."
          WHERE cat_id = "
.$cat_id;

  if (
$site_db->query($sql)) {
    echo 
$lang['cat_delete_success']." <b>".format_text($cat_cache[$cat_id]['cat_name'], 2)."</b> (ID: ".$cat_id.")<br />\n";
  }
  else {
    
$error_log[] = $lang['cat_delete_error']." <b>".format_text($cat_cache[$cat_id]['cat_name'], 2)."</b> (ID: ".$cat_id.")";
  }

  
$sql "SELECT image_id
          FROM "
.IMAGES_TABLE."
          WHERE cat_id = "
.$cat_id;
  
$img_result $site_db->query($sql);

  
$image_ids_sql 0;
  while (
$image_row $site_db->fetch_array($img_result)) {
    
$image_ids_sql .= (($image_ids_sql != "") ? ", " "").$image_row['image_id'];
  }

  
$sql "DELETE FROM ".IMAGES_TABLE."
          WHERE image_id IN (
$image_ids_sql)";
  if (
$site_db->query($sql)) {
    echo 
"-&raquo ".$lang['image_delete_success']."<br />\n";
  }
  else {
    
$error_log[] = $lang['image_delete_error']." (".format_text($cat_cache[$cat_id]['cat_name'], 2).", ID: ".$cat_id.")";
  }

  if (!empty(
$cat_id)) {
    if (
remove_cat_folder(MEDIA_PATH."/".$cat_id)) {
      echo 
"-&raquo ".$lang['file_delete_success']."<br />\n";
    }
    else {
      
$error_log[] = $lang['file_delete_error']." (".format_text($cat_cache[$cat_id]['cat_name'], 2).", ID: ".$cat_id.")";
    }
    if (
remove_cat_folder(THUMB_PATH."/".$cat_id)) {
      echo 
"-&raquo ".$lang['thumb_delete_success']."<br />\n";
    }
    else {
      
$error_log[] = $lang['thumb_delete_error']." (".format_text($cat_cache[$cat_id]['cat_name'], 2).", ID: ".$cat_id.")";
    }
  }

  
$sql "DELETE FROM ".COMMENTS_TABLE."
          WHERE image_id IN (
$image_ids_sql)";
  if (
$site_db->query($sql)) {
    echo 
"-&raquo ".$lang['comments_delete_success']."<br />\n";
  }
  else {
    
$error_log[] = $lang['comments_delete_error']." (".format_text($cat_cache[$cat_id]['cat_name'], 2).", ID: ".$cat_id.")";
  }

  
remove_searchwords($image_ids_sql);

  echo 
"<br /></td></tr></table>\n";
  echo 
"</td></tr>\n";
  
show_table_separator($lang['sub_categories'], 1);
  echo 
"<tr><td class=\"tablerow\">\n";
  if (!
remove_subcategories($cat_id)) {
    echo 
$lang['no_subcategories'];
  }
  echo 
"</td></tr>\n";
  
show_table_footer();
  if (!empty(
$error_log)) {
    
show_table_header("Error Log:"1);
    echo 
"<tr><td class=\"tablerow\">\n";
    echo 
"<table border=\"0\" cellpadding=\"\"2 cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
    echo 
"<b>".$lang['error_log_desc']."</b>\n<ul>\n";
    foreach (
$error_log as $key => $val) {
      
printf ("<li>%s</li>\n"$val);
    }
    echo 
"</ul>\n</td></tr></table>\n";
    echo 
"</td></tr>\n";
    
show_table_footer();
  }
  echo 
"<p>";
  
show_text_link($lang['back_overview'],"categories.php?action=modifycats");
}

if (
$action == "removecat") {
  
$cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  
show_admin_header();
  
show_form_header("categories.php""deletecat");
  
show_hidden_input("cat_id"$cat_id);
  
show_table_header($lang['delete'].": ".format_text($cat_cache[$cat_id]['cat_name'], 2), 2);
  
show_description_row($lang['delete_cat_confirm']);
  
show_form_footer($lang['yes'], ""2$lang['no']);
}

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

  
$auth_viewcat $HTTP_POST_VARS['auth_viewcat'];
  
$auth_viewimage $HTTP_POST_VARS['auth_viewimage'];
  
$auth_download $HTTP_POST_VARS['auth_download'];
  
$auth_upload $HTTP_POST_VARS['auth_upload'];
  
$auth_directupload $HTTP_POST_VARS['auth_directupload'];
  
$auth_vote $HTTP_POST_VARS['auth_vote'];
  
$auth_sendpostcard $HTTP_POST_VARS['auth_sendpostcard'];
  
$auth_readcomment $HTTP_POST_VARS['auth_readcomment'];
  
$auth_postcomment $HTTP_POST_VARS['auth_postcomment'];

  if (
$cat_name == "") {
    
$error['cat_name'] = 1;
  }

  if (empty(
$error)) {
    if (!
$cat_order) {
      
$sql "SELECT cat_order
              FROM "
.CATEGORIES_TABLE."
              WHERE cat_parent_id = 
$cat_parent_id
              ORDER BY cat_order DESC
              LIMIT 1"
;
      
$catorder $site_db->query_firstrow($sql);
      
$cat_order $catorder['cat_order'] + 10;
      
$do_update_cat_order 0;
    }
    else {
      
$do_update_cat_order 1;
    }

    
$sql "INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
            VALUES
            ('
$cat_name', '$cat_description', $cat_parent_id$cat_order$auth_viewcat$auth_viewimage$auth_download$auth_upload$auth_directupload$auth_vote$auth_sendpostcard$auth_readcomment$auth_postcomment)";
    
$result $site_db->query($sql);
    
$cat_id $site_db->get_insert_id();

    if (
$result && $cat_id) {
      if (
$do_update_cat_order) {
        
update_cat_order($cat_parent_id);
      }
      
$msg $lang['cat_add_success'];
      
create_cat_folder(MEDIA_PATH."/".$cat_idCHMOD_DIRS);
      
create_cat_folder(THUMB_PATH."/".$cat_idCHMOD_DIRS);
    }
    else {
      
$msg $lang['cat_add_error'];
    }
    
//$action = "modifycats";
    
forward_to_modify($msg);
  }
  else {
    
$msg sprintf("<span class=\"marktext\">%s</span>"$lang['lostfield_error']);
    
$action "addcat";
  }
}

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

  
show_admin_header();
  
show_form_header("categories.php""savecat""cat_form");
  
show_table_header($lang['nav_categories_add'], 2);
  
show_input_row($lang['field_category_name'], "cat_name"""$textinput_size);
  
show_textarea_row($lang['field_description_ext'], "cat_description"""$textarea_size);

  
$cat_parent_id = (isset($HTTP_GET_VARS['cat_parent_id'])) ? $HTTP_GET_VARS['cat_parent_id'] : 0;
  
$category "\n<select name=\"cat_parent_id\" class=\"categoryselect\" onChange=\"update_order_select(this.options[this.selectedIndex].value)\">\n";
  
$category .= "<option value=\"0\">".$lang['main_category']."</option>\n";
  
$category .= "<option value=\"0\">--------------</option>\n";
  
$drop_down_cat_cache = array();
  
$drop_down_cat_cache $cat_parent_cache;
  
$category .= get_category_dropdown_bits($cat_parent_id);
  
$category .= "</select>\n";
  
show_custom_row($lang['field_parent'], $category);

  if (
$show_cat_order_dropdown) {
    
show_custom_row($lang['cat_order'], get_cat_order_dropdown($cat_parent_id));
  }

  
$permission_headline $lang['permissions'];
  if (
$cat_parent_id != 0) {
    
$new_access_field_array = array();

    
$sql "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
            FROM "
.CATEGORIES_TABLE."
            WHERE cat_id = 
$cat_parent_id";
    
$row $site_db->query_firstrow($sql);

    foreach (
$access_field_array as $key => $val) {
      
$new_access_field_array[$key] = $row[$key];
    }
    unset(
$access_field_array);
    
$access_field_array $new_access_field_array;
    
$permission_headline .= "<span class=\"smalltext\"><br>".$lang['permissions_inherited']." (".format_text($row['cat_name'], 2).")</span>";
  }

  
show_table_separator($permission_headline2);
  foreach (
$access_field_array as $key => $val) {
    
show_access_select($lang[$key], $key$val);
  }

  
show_form_footer($lang['add'], $lang['reset'], 2);
}

if (
$action == "updatecat") {
  
$error = array();
  
$cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  
$cat_parent_id intval($HTTP_POST_VARS['cat_parent_id']);
  
$cat_name un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
  
$cat_description un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));
  
$cat_hits intval(trim($HTTP_POST_VARS['cat_hits']));
  
$cat_order = (isset($HTTP_POST_VARS['cat_order'])) ? intval($HTTP_POST_VARS['cat_order']) : 0;

  
$auth_viewcat $HTTP_POST_VARS['auth_viewcat'];
  
$auth_viewimage $HTTP_POST_VARS['auth_viewimage'];
  
$auth_download $HTTP_POST_VARS['auth_download'];
  
$auth_upload $HTTP_POST_VARS['auth_upload'];
  
$auth_directupload $HTTP_POST_VARS['auth_directupload'];
  
$auth_vote $HTTP_POST_VARS['auth_vote'];
  
$auth_sendpostcard $HTTP_POST_VARS['auth_sendpostcard'];
  
$auth_readcomment $HTTP_POST_VARS['auth_readcomment'];
  
$auth_postcomment $HTTP_POST_VARS['auth_postcomment'];

  
$subcat_ids = array();
  
get_subcategories_id($cat_id);

  if (
$cat_parent_id == $cat_id || in_array($cat_parent_id$subcat_ids)) {
    
$msg .= sprintf("<span class=\"marktext\">%s</span><br />"$lang['parent_cat_error']);
    
$error['cat_parent_id'] = 1;
  }
  if (
$cat_name == "") {
    
$error['cat_name'] = 1;
  }

  if (empty(
$error)) {
    if (!
$cat_order) {
      
$sql "SELECT cat_order
              FROM "
.CATEGORIES_TABLE."
              WHERE cat_parent_id = 
$cat_parent_id
              ORDER BY cat_order DESC
              LIMIT 1"
;
      
$catorder $site_db->query_firstrow($sql);
      
$cat_order $catorder['cat_order'] + 10;
      
$do_update_cat_order 0;
    }
    else {
      
$do_update_cat_order 1;
    }

    
$sql "UPDATE ".CATEGORIES_TABLE."
            SET cat_name = '
$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment
            WHERE cat_id = 
$cat_id";
    
$result $site_db->query($sql);

    if (
$result && $do_update_cat_order) {
      
update_cat_order($cat_parent_id);
    }

    
$msg = ($result) ? $lang['cat_edit_success'] : $lang['cat_edit_error'];
    
//$action = "modifycats";
    
forward_to_modify($msg);
  }
  else {
    
$msg .= sprintf("<span class=\"marktext\">%s</span>"$lang['lostfield_error']);
    
$action "editcat";
  }
}

if (
$action == "editcat") {
  if (
$msg != "") {
    
printf("<b>%s</b>\n"$msg);
  }
  
$cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : intval($HTTP_GET_VARS['cat_id']);

  
$sql "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM "
.CATEGORIES_TABLE."
          WHERE cat_id = 
$cat_id";
  
$cat_row $site_db->query_firstrow($sql);

  
show_admin_header();
  
show_form_header("categories.php""updatecat""cat_form");
  
show_hidden_input("cat_id"$cat_id);
  
show_table_header($lang['nav_categories_edit'], 2);
  
show_input_row($lang['field_category_name'], "cat_name"$cat_row['cat_name'], $textinput_size);
  
show_textarea_row($lang['field_description_ext'], "cat_description"$cat_row['cat_description'], $textarea_size);

  
$cat_parent_id $cat_row['cat_parent_id'];
  
$category "\n<select name=\"cat_parent_id\" class=\"categoryselect\" onChange=\"update_order_select(this.options[this.selectedIndex].value)\">\n";
  
$category .= "<option value=\"0\">".$lang['main_category']."</option>\n";
  
$category .= "<option value=\"0\">--------------</option>\n";
  
$drop_down_cat_cache = array();
  
$drop_down_cat_cache $cat_parent_cache;
  
$category .= get_category_dropdown_bits($cat_parent_id);
  
$category .= "</select>\n";
  
show_custom_row($lang['field_parent'], $category);

  if (
$show_cat_order_dropdown) {
    
show_custom_row($lang['cat_order'], get_cat_order_dropdown($cat_parent_id$cat_row['cat_order']));
  }

  
show_input_row($lang['field_hits'], "cat_hits"$cat_row['cat_hits'], 5);

  
show_table_separator($lang['permissions'], 2);
  foreach (
$access_field_array as $key => $val) {
    
show_access_select($lang[$key], $key$cat_row[$key]);
  }

  
show_form_footer($lang['save_changes'], $lang['reset'], 2$lang['back']);
}

if (
$action == "modifycats") {
  
$site_sess->set_session_var('back_url'$self_url);

    
show_admin_header();
    if (
$msg != "") {
    
printf("<b>%s</b>\n<p>"$msg);
  } else {
    
$msg $site_sess->get_session_var('msg');
    if (
$msg != "") {
      
printf("<b>%s</b>\n<p>"$msg);
    }
    
$site_sess->drop_session_var('msg');
  }

  if (
$ser_map $site_sess->get_session_var('map')) {
    
$GLOBALS['map'] = unserialize($ser_map);
  } else {
    
$GLOBALS['map'] = array();
  }

  if (isset(
$HTTP_GET_VARS['opencat'])) {
    
$opencat intval($HTTP_GET_VARS['opencat']);
    
$GLOBALS['map'][$opencat] = $opencat;
  }

  if (isset(
$HTTP_GET_VARS['closecat'])) {
    
$closecat intval($HTTP_GET_VARS['closecat']);
    unset(
$GLOBALS['map'][$closecat]);
  }

  
$open_all false;

  if (isset(
$HTTP_GET_VARS['openall'])) {
    
$open_all true;
  }

  if (isset(
$HTTP_GET_VARS['closeall'])) {
    
$open_all false;
    
$GLOBALS['map'] = array();
  }

  
$sql "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM "
.CATEGORIES_TABLE."
          WHERE cat_parent_id = 0
          ORDER BY cat_order, cat_name ASC"
;
  
$result $site_db->query($sql);

  
$category_cache = array();
  while (
$row $site_db->fetch_array($result)) {
    
$category_cache[$row['cat_parent_id']][$row['cat_id']] = $row;
  }

  if (
$show_all_subcats || $open_all || (!empty($GLOBALS['map']) && is_array($GLOBALS['map']))) {
    
$where_sql "";
    if (!
$show_all_subcats && !$open_all) {
        
$where_sql "WHERE cat_parent_id IN (".implode(", "$GLOBALS['map']).")";
    }
    
$sql "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
            FROM "
.CATEGORIES_TABLE."
            
$where_sql
            ORDER BY cat_order, cat_name ASC"
;

    
$result $site_db->query($sql);

    while (
$row $site_db->fetch_array($result)) {
      
$category_cache[$row['cat_parent_id']][$row['cat_id']] = $row;
      if (
$open_all) {
        
$GLOBALS['map'][$row['cat_id']] = $row['cat_id'];
      }
    }
  }

  echo 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
  echo 
"<tr class=\"tableseparator\">\n";
  if (!
$GLOBALS['show_all_subcats']) {
    echo 
"<td class=\"tableseparator\" width=\"30\">";
    
$href $site_sess->url("categories.php?action=modifycats&openall=1");
    echo 
'<a href="'.$href.'">'.$GLOBALS['open_cat_link'].'</a>';
    
$href $site_sess->url("categories.php?action=modifycats&closeall=1");
    echo 
'<a href="'.$href.'">'.$GLOBALS['close_cat_link'].'</a>';
    echo 
"</td>";
  }
  echo 
"<td class=\"tableseparator\">".$lang['nav_categories_edit']."</td>\n<td class=\"tableseparator\" align=\"center\">".$lang['cat_order']."</td>\n</tr>\n";
  if (
sizeof($category_cache) == 0) {
    echo 
"<tr class=\"".get_row_bg()."\">\n<td colspan=\"3\">".$lang['no_categories']."</td></tr>";
  }
  else {
    
show_category_rows();
  }
  
show_table_footer();

  
$site_sess->set_session_var('map'serialize($GLOBALS['map']));
}
show_admin_footer();
?>

XXX is just to delete my Passwords and FTP Settings! :)

Huskys

The error is Parse error: parse error in /var/www/XXX/html/gallery/admin/categories.php on line 89

6
Would please someone be so gentle and help me with my problem?!

I would be thankful!

Husky

PS: Gerne auch in Deutsch!

7
*push*

8
Hi mates,

I have a problem ... when I want to go to the admin panal I have a problem.

After clicking on Add or Edit categories, I become a white page with this error:

Parse error: parse error in /var/www/web27/html/gallery/admin/categories.php on line 87

I didn't changed my categories.php ...

Any ideas?!

Husky

PS: The .php:
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: categories.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.                              *
 *                                                                        *
 *************************************************************************/

$templates_used 'categories,category_bit,thumbnail_bit';
$main_template 'categories';

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');

if (!
$cat_id || !isset($cat_cache[$cat_id]) || !check_permission("auth_viewcat"$cat_id)) {
  
redirect("index.php");
}

$cache_id create_cache_id(
  
'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']), 08) : 0,
    
$config['template_dir'],
    
$config['language_dir']
  )
);

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

ob_start();

//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
if (!check_permission("auth_upload"$cat_id)) {
  
$upload_url "";
  
$upload_button "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
  
$upload_url $site_sess->url(ROOT_PATH."member.php?action=uploadform&amp;".URL_CAT_ID."=".$cat_id);
  
$upload_button "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}

$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image($cat_id);
$site_template->register_vars(array(
  
"categories" => get_categories($cat_id),
  
"cat_name" => format_text($cat_cache[$cat_id]['cat_name'], 2),
  
"cat_description" => format_text($cat_cache[$cat_id]['cat_description'], 101),
  
"cat_hits" => $cat_cache[$cat_id]['cat_hits'],
  
"upload_url" => $upload_url,
  
"upload_button" => $upload_button,
  
"random_cat_image" => $random_cat_image
));

unset(
$random_cat_image);

//-----------------------------------------------------
//--- Show Images -------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"has_rss"   => true,
  
"rss_title" => "RSS Feed: ".format_text($cat_cache[$cat_id]['cat_name'], 2)." (".str_replace(':'''$lang['new_images']).")",
  
"rss_url"   => $script_url."/rss.php?action=images&amp;".URL_CAT_ID."=".$cat_id
));

$num_rows_all = (isset($cat_cache[$cat_id]['num_images'])) ? $cat_cache[$cat_id]['num_images'] : 0;
$link_arg $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);

include(
ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page$perpage$num_rows_all$link_arg);
$offset $getpaging->get_offset();

$site_template->register_vars(array(
  
"paging" => $getpaging->get_paging(),
  
"paging_stats" => $getpaging->get_paging_stats()
));

$imgtable_width ceil((intval($config['image_table_width'])) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

$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, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id = 
$cat_id AND c.cat_id = i.cat_id
        ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
        LIMIT 
$offset$perpage";
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$thumbnails "";
  
$msg $lang['no_images'];
}
else {
  
$thumbnails "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)){
    if (
$count == 0) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
      
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    
show_image($image_row);
    
$thumbnails .= $site_template->parse_template("thumbnail_bit");
    
$thumbnails .= "\n</td>\n";

    
$count++;
    if (
$count == $config['image_cells']) {
      
$thumbnails .= "</tr>\n";
      
$count 0;
    }
  } 
// end while

  
if ($count 0)  {
    
$leftover = ($config['image_cells'] - $count);
    if (
$leftover 0) {
      for (
$i 0$i $leftover$i++){
        
$thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$thumbnails .= "</tr>\n";
    }
  }
  
$thumbnails .= "</table>\n";
//end else
$site_template->register_vars("thumbnails"$thumbnails);
unset(
$thumbnails);

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

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream
));

$site_template->print_template($site_template->parse_template($main_template));

$content ob_get_contents();
ob_end_clean();

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

  
save_cache_file($cache_id$content);
}

// end if get_cache_file()

echo $content;

//Update Category Hits
if ($user_info['user_level'] != ADMIN && $page == 1) {
  
$sql "UPDATE ".CATEGORIES_TABLE."
          SET cat_hits = cat_hits + 1
          WHERE cat_id = 
$cat_id";
  
$site_db->query($sql);
}

include(
ROOT_PATH.'includes/page_footer.php');
?>

9
Danke für den Tipp, habe ich vergessen zu sagen ...

Alle Ordner haben die freigabe 777 !!! Daran liegt es nicht!
Husky

10
Hi

ich habe eine Frage ... Unser Gallery ist wie der Rest unserer Seite auf einen neuen Server umgezogen.

Sie funktioniert auch einweindfrei, NUR ich habe heute eine neue Category erschaffen und bekomme diesen Fehler:

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid/gid is 759/101 is not allowed to access /var/www/web27/html/gallery/data/media/313 owned by uid/gid 81/81 in /var/www/web27/html/gallery/includes/upload.php on line 113

NUR in anderen Kategorien, kann ich eben alles normal hochladen.

Wie kann denn das passieren und wie kann ich es beheben?!

Safe Mod ist laut Anbieter OFF (kann ich das prüfen?)

Husky

11
Nicky hat sich meiner angenommen und das Problem lösen können!!!!

Werde jetzt nochmal wie Ivan sagt die Gallery neu aufsetzen und dann sollte es funzen !!!

DANKE Jungs!!!

12
Hallo, ich habe alles versucht, so wie ihr es sagtet ...

Aber irgendwie will das nicht ...

Wer mag mir da mal helfen?!

Husky

13
Also ich weiß nicht was Du mit rüberkopieren meinst ...

Aber ich habe alle Security Updates gemacht ...

Und gerne würde ich Dich drüber gucken lassen, sag mir einfach welche Dateien Du brauchst und wie ich Dir da Zugang geben kann.

Kein Problem ... hauptsache Du/Wir kriegen das wieder heile!!

Husky

PS: Darfst mich auch gerne im Messi ansprechen!

14
Hi,

our gallery was hacked (once again) ... the last time the gallery was hacked 1.7.3 version, it could be fixed by our webmaster in a few minutes ...

But this time it is not working anymore ... he is not be able to find the error this stupied hacker made ...

Anyone got any idea how to solve our problem without losing all of our pictures and categories?!

Husky

PS: http://gallery.atleticomadrid.de <--- Now closed until the gallery is able to work again!

PS: Antworten auch in Deutsch möglich

15
Problem gelöst / Problem solved ...

I uploaded an other category.php (the one you can download in the installation pack)
And it worked ... don't ask me why!

Also ich habe die category.php aus dem installations Paket druff gemacht und es läuft wieder, aber KA warum!

Husky

PS: DANKE!

Pages: [1] 2
Post your comments here