View Single Post
  #72  
Old 02-20-2009, 12:34 PM
  beetlejuice's Avatar 
beetlejuice beetlejuice is offline
 

eXpert
  
Join Date: Apr 2007
Posts: 251
 

Default Re: Photo Gallery Mod

Looks like DataViking and phpsolutions may be one and the same

Not a single reply to any contact I've made in the last week or so. Not via the forum thread, PM's nor contact from either of his sites envisionlayouts.com and DataViking.com.

I've got to get this finished for a client otherwise it's more money down the drain and here in AUS with our dollar for some reason poor against the US it hurts a bit more than others.

As per the thread 2 posts back I've listed the gallery.php below to see if anyone might be able to see why shadowbox which is used for detailed images is also being called for photos in this gallery mod. I battle around with PHP but it's not my strong suit.

Code:
<?php /*****************************************************************************\ GALLERY FOR XCART! \*****************************************************************************/ # # $Id: form.php,v 1.6.2.1 2007/03/22 13:54:23 svowl Exp $ # require "./auth.php"; require $xcart_dir."/include/categories.php"; x_load('files','image'); x_session_register("file_upload_data"); if (empty($active_modules["Image_Gallery"])){ func_header_location("error_message.php?access_denied&id=7"); } if ($_GET['gallery_cat']){ $cat=$_GET['gallery_cat']; }elseif($_POST['gallery_cat']){ $cat=$_POST['gallery_cat']; }else{ if ($first_cat = func_query("SELECT * FROM {$sql_tbl['gallery_categories']} WHERE avail='Y' AND parent_id=0 ORDER BY order_by ASC LIMIT 0,1")){ $cat=$first_cat[0]["id"]; }else { $cat=0; } } $smarty->assign("list_type",$config['Image_Gallery']['image_category_select_type']); $smarty->assign("lightbox",$config['Image_Gallery']['image_lightbox']); if (@$user_account["usertype"]=="C"){ $smarty->assign("client_upload",$config['Image_Gallery']['image_client_upload']); } //Location if (!function_exists('sortMdArray')){ function sortMdArray(&$aArray, $sBy, $sOrder, $sType){ $sSortby = "sort$sBy"; $sFirstval = current($aArray); $aValues = array_keys($sFirstval); foreach ($aValues as $sInit){ $keyname = "sort$sInit"; $$keyname = array(); } foreach ($aArray as $sKey => $sRow) { foreach ($aValues as $sNames){ $sKeyname = "sort$sNames"; $aTest = array(); $aTest[$sKey] = $sRow[$sNames]; $$sKeyname = array_merge($$sKeyname,$aTest); } } if ($sOrder == "DESC"){ if ($sType == "num"){ array_multisort($$sSortby,SORT_DESC, SORT_NUMERIC,$aArray); } else { array_multisort($$sSortby,SORT_DESC, SORT_STRING,$aArray); } } else { if ($sType == "num"){ array_multisort($$sSortby,SORT_ASC, SORT_NUMERIC,$aArray); } else { array_multisort($$sSortby,SORT_ASC, SORT_STRING,$aArray); } } return $aArray; } } function get_parent_path ($parentid){ global $sql_tbl; $parent_path=array(); $iCount=0; while ($parentid!=0){ $parent= func_query("SELECT * FROM {$sql_tbl['gallery_categories']} WHERE id={$parentid}"); $parent_path[]=array($parent[0]['id'],$parent[0]['name']); $iCount++; $parentid=$parent[0]['parent_id']; if ($iCount>5){ die('Hiba'.$parentid); } } return array_reverse($parent_path); } if (isset($_GET['mode']) and $mode=='show'){ $image=func_query("SELECT * FROM $sql_tbl[gallery_images] WHERE id={$_GET[id]}"); $location_add=get_parent_path($image[0]['category_id']); $location_add[]=array("",$image[0]['name']); }else { $location_add=get_parent_path($cat); } foreach ($location_add as $loc){ if ($loc[0]){ $location[]=array($loc[1],"?gallery_cat=".$loc[0]); }else { $location[]=array($loc[1],""); } } $location[count($location)-1][1]=""; //Back cat id $smarty->assign("back_cat_id", $location[count($location)-2][1]); $smarty->assign("back_cat_name", $location[count($location)-2][0]); $smarty->assign("current_cat_name", $location[count($location)-1][0]); $smarty->assign("location", $location); $smarty->assign("cat", $cat); global $sql_tbl; function get_all_categories(){ global $sql_tbl; if ($all_cats = func_query("SELECT * FROM {$sql_tbl['gallery_categories']} ORDER BY order_by ASC")){ //Replace category names by path foreach (array_keys($all_cats) as $sKey) { if ($all_cats[$sKey]['parent_path']!=""){ $aPath=explode('/',rtrim($all_cats[$sKey]['parent_path'],'/')); $sFullName=""; foreach ($aPath as $sParentId){ if ($parent = func_query("SELECT * FROM {$sql_tbl['gallery_categories']} WHERE id={$sParentId}")){ $sParentName=$parent[0]['name']; $sFullName.=$sParentName.'/'; } } $sFullName.=$all_cats[$sKey]['name']; $all_cats[$sKey]['name']=$sFullName; } } $all_cats=sortMdArray($all_cats,'name','ASC','text'); return $all_cats; } } function get_categories_client($parent_id=0){ global $sql_tbl,$config; if ($cats = func_query("SELECT * FROM {$sql_tbl['gallery_categories']},$sql_tbl[images_H] WHERE $sql_tbl[gallery_categories].avail='Y' AND $sql_tbl[images_H].id=$sql_tbl[gallery_categories].id AND parent_id={$parent_id} ORDER BY order_by ASC ")){ return $cats; }elseif($cats = func_query("SELECT * FROM {$sql_tbl['gallery_categories']} WHERE $sql_tbl[gallery_categories].avail='Y' AND parent_id={$parent_id} ORDER BY order_by ASC ")){ return $cats; }else { return false; } } if ($_POST['mode']!="create_image"){ $images = func_query("SELECT * FROM $sql_tbl[images_G],$sql_tbl[gallery_images] WHERE $sql_tbl[images_G].id=$sql_tbl[gallery_images].id AND category_id=$cat AND $sql_tbl[gallery_images].avail='Y' ORDER BY $sql_tbl[gallery_images].id ASC"); //adding th postfix to the image file name $imagesthumb=array(); if(!empty($images)){ foreach ($images as $image){ $aFile=explode('.',$image['filename']); $image['filename']=$aFile[0].'_tn.'.$aFile[1]; $image['filename_big']=$aFile[0].'.'.$aFile[1]; $imagesthumb[]=$image; } $smarty->assign("images", $imagesthumb); } $cats=get_categories_client($cat); $smarty->assign("cats", $cats); if($config['Image_Gallery']["image_category_select_type"]=="D"){ $smarty->assign("all_cats", get_all_categories()); } }elseif($_POST['mode']=="create_image"){ //Create images from the client side if (!isset($user_account) or @$user_account["usertype"]!="C"){ func_header_location("error_message.php?need_login"); } if ($config['Image_Gallery']['image_client_upload']!="Y"){ func_header_location("error_message.php?access_denied&id=7"); } $cats=get_categories(); $smarty->assign("cats", $cats); if (isset($_POST['image']['id'])){ //Form validation foreach (array("name") as $key) { $err = $err || ($error[$key] = empty($_POST['image'][$key])); } if (!$err){ //Create action db_query("INSERT INTO $sql_tbl[gallery_images] (name,descr,avail,category_id,user_login) VALUES ('{$_POST[image][name]}','{$_POST[image][descr]}','{$_POST[image][avail]}',$_POST[gallery_cat],'{$user_account[login]}')"); $top_message["content"]="Image created!"; $imageid=db_insert_id(); update_image(db_insert_id(),$mode,'G',true); func_header_location("gallery.php?gallery_cat=".$_POST['gallery_cat']); }else { $top_message["content"] = func_get_langvar_by_name("err_filling_form"); $top_message["type"] = "E"; x_session_register("nwslt_object"); $nwslt_object["error"] = $error; $nwslt_object["list"] = $list; func_header_location("gallery.php?mode=new&gallery_cat=".$cat); } } }elseif($_GET['mode']=="show") { //Show one image if ($image=func_query("SELECT * FROM $sql_tbl[gallery_images] WHERE id=$_GET[id]")){ if ($image[0]['avail']!='Y'){ func_header_location("error_message.php?access_denied&id=7"); } $smarty->assign("image",$image[0]); }else { $top_message["content"] = "Invalid image ID!"; func_header_location("gallery.php?gallery_cat=".$cat); } } switch($mode){ case "show": $smarty->assign("main", "gallery_show"); break; case "new": { if (!isset($user_account) or @$user_account["usertype"]!="C"){ func_header_location("error_message.php?need_login"); }else { if ($config['Image_Gallery']['image_client_upload']=="Y"){ $smarty->assign("main", "gallery_new"); break; }else { func_header_location("error_message.php?access_denied&id=7"); } } } default: $smarty->assign("main", "gallery"); } func_display("customer/home.tpl",$smarty); ?>

Hope someone can see it, i've been staring at this for hours.

Thanks

beetlejuice

PS if I need to supply any other codes just yell, I'm standing by.
__________________
XCart 4.5.4, 4.6.1, 4.64 stores
Many, many mods from Altered Cart
XCart Mods Reboot template
The XCart Store Templates and Mods
WCM CDSEO Pro
BCSE Rewards Points and Gallery Mods
and a few others
Reply With Quote