Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Data not written - i cant find the error in code - can anyone help

Asked Modified Viewed 2,988 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

my database table:

$inf_newtable[2] = DB_FIGURE." (
      figure_id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
      figure_title varchar(200) NOT NULL DEFAULT '',
      figure_cat mediumint(8) unsigned NOT NULL DEFAULT '0',
      figure_name mediumint(8) unsigned NOT NULL DEFAULT '1',
      
      
      figure_description text NOT NULL,
      figure_url varchar(200) NOT NULL DEFAULT '',
      figure_file varchar(100) NOT NULL DEFAULT '',
      figure_image varchar(100) NOT NULL DEFAULT '',
      
      figure_filesize varchar(20) NOT NULL DEFAULT '',
      figure_datestamp int(10) unsigned NOT NULL DEFAULT '0',
      figure_author varchar(200) NOT NULL DEFAULT '',
      figure_language varchar(200) NOT NULL DEFAULT '',
      figure_publisher varchar(200) NOT NULL DEFAULT '',
      figure_pubdate varchar(200) NOT NULL DEFAULT '',
      
      figure_count int(10) unsigned NOT NULL DEFAULT '0',
      figure_allow_comments tinyint(1) unsigned NOT NULL DEFAULT '1',
      figure_allow_ratings tinyint(1) unsigned NOT NULL DEFAULT '1',
      KEY figure_datestamp (figure_datestamp),
      KEY figure_count (figure_count),
      PRIMARY KEY (figure_id)
   ) TYPE=MyISAM;";
$inf_droptable[2] = DB_FIGURE;



my code (data would be NOT stored in database ... i have a error somewhere but i cant find it)
guess its around line 200

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: figure_items.php
| Author: Khalid545
| URL: http://khalidb.co.cc/
| E-Mail: khalidd545@gmail.com
| Original file: downloads.php By Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original manufacturer(s).
+--------------------------------------------------------*/
require_once "../../../maincore.php";
require_once THEMES."templates/admin_header.php";
require_once INCLUDES."bbcode_include.php";
include "../infusion_db.php";

$asettings['figure_photo_max_b'] = 400000;
$asettings['figure_photo_max_w'] = 1000;
$asettings['figure_photo_max_h'] = 1000;

if (!checkrights("BOL") || !defined("iAUTH") || $_GET['aid'] != iAUTH) { redirect(BASEDIR."index.php"); }

if (isset($_GET['status']) && !isset($message)) {
   if ($_GET['status'] == "sn") {
      $message = $locale['figure_110'];
   } elseif ($_GET['status'] == "su") {
      $message = $locale['figure_111'];
   } elseif ($_GET['status'] == "se") {
      $message = $locale['figure_113']."<br />\n<span class='small'>";
      if ($_GET['error'] == 0) { $message .= $locale['figure_117']."</span>"; }
      elseif ($_GET['error'] == 1) { $message .= $locale['figure_114']."</span>"; }
      elseif ($_GET['error'] == 2) { $message .= sprintf($locale['figure_115'], parsebytesize($asettings['figure_max_b']))."</span>"; }
      elseif ($_GET['error'] == 3) { $message .= sprintf($locale['figure_116'], str_replace(',', ' ', $asettings['figure_types']))."</span>"; }
      elseif ($_GET['error'] == 4) { $message .= $locale['figure_118']."</span>"; }
      elseif ($_GET['error'] == 5) { $message .=  $locale['figure_170']."</span>";}
      elseif ($_GET['error'] == 6) { $message .=  sprintf($locale['figure_171'], parsebytesize($asettings['figure_photo_max_b']))."</span>";}
      elseif ($_GET['error'] == 7) { $message .=  $locale['figure_172']."</span>";}
      elseif ($_GET['error'] == 8) { $message .=  sprintf($locale['figure_173'], $asettings['figure_photo_max_w'], $asettings['figure_photo_max_h'])."</span>";}
   } elseif ($_GET['status'] == "del") {
      $message = $locale['figure_112'];
   }
   if ($message) { echo "<div id='close-message'><div class='admin-message'>".$message."</div></div>\n"; }
}

$result = dbquery("SELECT * FROM ".DB_FIGURE_CATS);
if (dbrows($result)) {
   if ((isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['figure_id']) && isnum($_GET['figure_id']))) {
      $result = dbquery("SELECT figure_file, figure_cat FROM ".DB_FIGURE." WHERE figure_id='".$_GET['figure_id']."'");
      if (dbrows($result)) {
         $data = dbarray($result);
         if (!empty($data['figure_file']) && file_exists(FIGURES.$data['figure_file'])) {
            @unlink(FIGURES.$data['figure_file']);
         }
         if (!empty($data['figure_image']) && file_exists(IMAGES_FIGURE.$data['figure_image'])) {
            @unlink(IMAGES_FIGURE.$data['figure_image']);
         }
         $result = dbquery("DELETE FROM ".DB_FIGURE." WHERE figure_id='".$_GET['figure_id']."'");
         $result = dbquery("UPDATE ".DB_FIGURE_CATS." SET figure_cat_items=figure_cat_items-1 WHERE figure_cat_id='".$data['figure_cat']."'");
         $result = dbquery("DELETE FROM ".DB_BCOMMENTS." WHERE comment_item_id='".$_POST['figure_id']."' and comment_type='BO'");
         $result = dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_item_id='".$_POST['news_id']."' and rating_type='B'");
      }   
      redirect(FUSION_SELF.$aidlink."&figure_cat_id=".intval($_GET['figure_cat_id'])."&status=del");
   } elseif (isset($_POST['save_download'])) {
      $valid_ext = explode(",", $asettings['figure_types']);
      $error = 0;
      $figure_title = stripinput($_POST['figure_title']);
      $figure_variant = stripinput($_POST['figure_variant']);
      $figure_manufacturer = stripinput($_POST['figure_manufacturer']);
      $figure_submanufacturer = stripinput($_POST['figure_submanufacturer']);
      $figure_country = stripinput($_POST['figure_country']);
      $figure_brand = stripinput($_POST['figure_brand']);
      $figure_series = stripinput($_POST['figure_series']);

      $figure_scale = stripinput($_POST['figure_scale']);
      $figure_weight = stripinput($_POST['figure_weight']);
      $figure_height = stripinput($_POST['figure_height']);
      $figure_width = stripinput($_POST['figure_width']);
      $figure_depth = stripinput($_POST['figure_depth']);
      $figure_material = stripinput($_POST['figure_material']);
      $figure_packaging = stripinput($_POST['figure_packaging']);

      $figure_pubdate = stripinput($_POST['figure_pubdate']);
      $figure_retailprice = stripinput($_POST['figure_retailprice']);
      $figure_limitation = stripinput($_POST['figure_limitation']);
      $figure_editionsize = stripinput($_POST['figure_editionsize']);
      $figure_artists = stripinput($_POST['figure_artists']);

      $figure_description = trim(stripinput($_POST['figure_description']));   

      $figure_filesize = stripinput($_POST['figure_filesize']);
      if (isset($_POST['del_upload']) && isset($_GET['figure_id']) && isnum($_GET['figure_id'])) {
         $result = dbquery("SELECT figure_file FROM ".DB_FIGURE." WHERE figure_id='".$_GET['figure_id']."'");
         if (dbrows($result)) {
            $data = dbarray($result);
            if (!empty($data['figure_file']) && file_exists(FIGURES.$data['figure_file'])) {
               @unlink(FIGURES.$data['figure_file']);
            }
         }   
         $figure_file = "";
      } elseif (!empty($_FILES['figure_file']['name']) && is_uploaded_file($_FILES['figure_file']['tmp_name'])) {
         $figure_url = "";

         $file = $_FILES['figure_file'];
         $file_name = str_replace(" ", "_", strtolower(substr($file['name'], 0, strrpos($file['name'], "."))));
         $file_ext = strtolower(strrchr($file['name'],"."));
         $target_folder = FIGURES;
         if (!preg_match("/^[-0-9A-Z_\.\[\]]+$/i", $file_name)) {
            // Invalid file name
            $error = 1;
         } elseif ($file['size'] > $asettings['figure_max_b']){
            // Invalid file size
            $error = 2;
         } elseif (!in_array($file_ext, $valid_ext)) {
            // Invalid file extension
            $error = 3;
         } else {
            if (file_exists($target_folder.$file_name.$file_ext)) {
               $i = 1; $file_name_2 = $file_name;
               while (file_exists($target_folder.$file_name_2.$file_ext)) {
                  $file_name_2 = $file_name."_".$i;
                  $i++;
               }
               $file_name = $file_name_2;
            }
            move_uploaded_file($file['tmp_name'], $target_folder.$file_name.$file_ext);
            chmod($target_folder.$file_name.$file_ext, 0644);
            $figure_file = $file_name.$file_ext;
            if (isset($_POST['calc_upload'])) {
               $figure_filesize = parsebytesize($file['size']);
            }
         }
      } elseif ((isset($_POST['figure_url']) && $_POST['figure_url'] != "")  || isset($_POST['figure_file'])) {
         $figure_url = (isset($_POST['figure_url']) ? stripinput($_POST['figure_url']) : "");
         $figure_file = (isset($_POST['figure_file']) ? $_POST['figure_file'] : "");
      } else {
         $error = 4;
      }
      if (isset($_FILES['figure_image']) && is_uploaded_file($_FILES['figure_image']['tmp_name'])) {
         require_once INCLUDES."photo_functions_include.php";
         $image = $_FILES['figure_image'];
         $image_name = str_replace(" ", "_", strtolower(substr($image['name'], 0, strrpos($image['name'], "."))));
         $image_ext = strtolower(strrchr($image['name'],"."));

         if ($image_ext == ".gif") { $filetype = 1;
         } elseif ($image_ext == ".jpg") { $filetype = 2;
         } elseif ($image_ext == ".png") { $filetype = 3;
         } else { $filetype = false; }

         if (!preg_match("/^[-0-9A-Z_\.\[\]]+$/i", $image_name)) {
            $error = 5;
         } elseif ($image['size'] > $asettings['figure_photo_max_b']){
            $error = 6;
         } elseif (!$filetype) {
            $error = 7;
         } else {
            $image_full = image_exists(IMAGES_FIGURE, $image_name.$image_ext);
            move_uploaded_file($_FILES['figure_image']['tmp_name'], IMAGES_FIGURE.$image_full);
            if (function_exists("chmod")) { chmod(IMAGES_FIGURE.$image_full, 0644); }
            $imagefile = @getimagesize(IMAGES_FIGURE.$image_full);
            if ($imagefile[0] > $asettings['figure_photo_max_w'] || $imagefile[1] > $asettings['figure_photo_max_h']) {
               $error = 8;
               unlink(IMAGES_FIGURE.$image_full);
            } else {
               createthumbnail($filetype, IMAGES_FIGURE.$image_full, IMAGES_FIGURE.$image_full, 550, 550);
            }
         }
         if (!$error) {
            $figure_image = $image_full;
         } else {
            $figure_image = "";
         }
      } else {
         $figure_image = (isset($_POST['figure_image']) ? $_POST['figure_image'] : "");
      }
      $figure_cat = intval($_POST['figure_cat']);
      $figure_comments = isset($_POST['figure_comments']) ? "1" : "0";
      $figure_ratings = isset($_POST['figure_ratings']) ? "1" : "0";
      if ($figure_title && $error == 0) {
         if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['figure_id']) && isnum($_GET['figure_id']))) {
            if (isset($_POST['del_image'])) {
               if (!empty($data['figure_image']) && file_exists(IMAGES_FIGURE.$data['figure_image'])) { unlink(IMAGES_FIGURE.$data['figure_image']); }
               $figure_image = "";
            }
            $figure_datestamp = isset($_POST['update_datestamp']) ? ", figure_datestamp='".time()."'" : "";
            $result = dbquery("SELECT figure_cat FROM ".DB_FIGURE." WHERE figure_id='".$_GET['figure_id']."'");
            if (dbrows($result)) {
               $data = dbarray($result);
               if ($data['figure_cat']!=$figure_cat) {
                  $result = dbquery("UPDATE ".DB_FIGURE_CATS." SET figure_cat_items=figure_cat_items-1 WHERE figure_cat_id='".$data['figure_cat']."'");
                  $result = dbquery("UPDATE ".DB_FIGURE_CATS." SET figure_cat_items=figure_cat_items+1 WHERE figure_cat_id='".$figure_cat."'");
               }
            }
            $result = dbquery("UPDATE ".DB_FIGURE." SET figure_title ='$figure_title', figure_cat ='$figure_cat',   figure_file ='$figure_file', figure_image ='$figure_image', figure_name ='$figure_name', figure_filesize ='$figure_filesize', figure_manufacturer ='$figure_manufacturer', figure_submanufacturer ='$figure_submanufacturer', figure_brand ='$figure_brand',figure_series ='$figure_series',figure_variant ='$figure_variant',figure_scale ='$figure_scale', figure_weight ='$figure_weight', figure_height ='$figure_height', figure_width ='$figure_width',figure_depth ='$figure_depth',figure_material ='$figure_material',figure_packaging ='$figure_packaging',figure_retailprice ='$figure_retailprice',figure_limitation ='$figure_limitation',figure_editionsize ='$figure_editionsize',figure_artists ='$figure_artists',
figure_country ='$figure_country',figure_pubdate ='$figure_pubdate',figure_count ='$figure_count',figure_description='$figure_description', figure_image='$figure_image', figure_file='$figure_file', figure_allow_comments='$figure_comments', figure_allow_ratings='$figure_ratings', figure_filesize='$figure_filesize'".$figure_datestamp." WHERE figure_id='".$_GET['figure_id']."'");
            redirect(FUSION_SELF.$aidlink."&figure_cat_id=".$figure_cat."&status=su");
         } else {
            $result = dbquery("INSERT INTO ".DB_FIGURE." (figure_title,figure_cat,figure_description,figure_url,figure_file,figure_image,figure_name,figure_filesize,figure_datestamp,figure_manufacturer,figure_submanufacturer,figure_brand,figure_series,figure_variant,figure_scale,figure_weight,figure_height,figure_width,figure_depth,figure_material,figure_packaging,figure_retailprice,figure_limitation,figure_editionsize,figure_artists,figure_country,figure_pubdate,figure_count,figure_allow_comments,figure_allow_ratings) VALUES ('$figure_title', '$figure_manufacturer', '$figure_country', '$figure_submanufacturer', '$figure_pubdate', '$figure_image', '$figure_description', '$figure_url', '$figure_file', '$figure_cat', '".$userdata['user_id']."', '$figure_filesize', '".time()."', '0', '$figure_comments', '$figure_ratings')");
            $result = dbquery("UPDATE ".DB_FIGURE_CATS." SET figure_cat_items=figure_cat_items+1 WHERE figure_cat_id='".$figure_cat."'");
            redirect(FUSION_SELF.$aidlink."&figure_cat_id=".$figure_cat."&status=sn");
         }
      } else {
         redirect(FUSION_SELF.$aidlink."&status=se&error=$error");
      }
   }
   if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['figure_id']) && isnum($_GET['figure_id']))) {
      $result = dbquery("SELECT * FROM ".DB_FIGURE." WHERE figure_id='".$_GET['figure_id']."'");
      if (dbrows($result)) {
         $data = dbarray($result);
         $figure_title = $data['figure_title'];
         $figure_variant = $data['figure_variant'];
         $figure_manufacturer = $data['figure_manufacturer'];
         $figure_submanufacturer = $data['figure_submanufacturer'];
         $figure_country = $data['figure_country'];
         $figure_brand = $data['figure_brand'];
         $figure_series = $data['figure_series'];

         $figure_scale = $data['figure_scale'];
         $figure_weight = $data['figure_weight'];
         $figure_height = $data['figure_height'];
         $figure_width = $data['figure_width'];
         $figure_depth = $data['figure_depth'];
         $figure_material = $data['figure_material'];
         $figure_packaging = $data['figure_packaging'];

         $figure_pubdate = $data['figure_pubdate'];
         $figure_retailprice = $data['figure_retailprice'];
         $figure_limitation = $data['figure_limitation'];
         $figure_editionsize = $data['figure_editionsize'];
         $figure_artists = $data['figure_artists'];

         $figure_description = trim(stripinput($_POST['figure_description']));         
            
         $figure_image = $data['figure_image'];
         $figure_description = stripinput($data['figure_description']);
         $figure_url = $data['figure_url'];
         $figure_file = $data['figure_file'];
         $figure_filesize = $data['figure_filesize'];
         $figure_comments = $data['figure_allow_comments'] == "1" ? " checked='checked'" : "";
         $figure_ratings = $data['figure_allow_ratings'] == "1" ? " checked='checked'" : "";
         $formaction = FUSION_SELF.$aidlink."&amp;action=edit&amp;figure_cat_id=".$data['figure_cat']."&amp;figure_id=".$data['figure_id'];
         opentable($locale['figure_101']);
      } else {
         redirect(FUSION_SELF.$aidlink);
      }
   } else {
      
         $figure_title = "";
         $figure_variant = "";
         $figure_manufacturer = "";
         $figure_submanufacturer = "";
         $figure_country = "";
         $figure_brand = "";
         $figure_series = "";

         $figure_scale = "";
         $figure_weight = "";
         $figure_height = "";
         $figure_width = "";
         $figure_depth = "";
         $figure_material = "";
         $figure_packaging = "";

         $figure_pubdate = "";
         $figure_retailprice = "";
         $figure_limitation = "";
         $figure_editionsize = "";
         $figure_artists = "";

         $figure_image = "";
         $figure_description = "";
         $figure_url = "";
         $figure_file = "";
         $figure_comments = " checked='checked'";
         $figure_ratings = " checked='checked'";
         $figure_filesize = "";
         $formaction = FUSION_SELF.$aidlink;
      opentable($locale['figure_100']);
   }
   $editlist = ""; if (isset($_GET['action']) && $_GET['action'] == "edit") { $figure_cat = $data['figure_cat']; } else { $figure_cat = ""; }
   $result2 = dbquery("SELECT * FROM ".DB_FIGURE_CATS." WHERE figure_cat_parent='0' ORDER BY figure_cat_name");
   if (dbrows($result2) != 0) {
      while ($data2 = dbarray($result2)) {
         $editlist .= menu_subcats($data2['figure_cat_id'], $data2['figure_cat_name'],1);
      }
   }
   echo "<form id='inputform' method='post' action='".$formaction."' enctype='multipart/form-data'>\n";
   echo "<table cellpadding='0' cellspacing='0' width='460' class='center'>\n<tr>\n";
   
   //Title
   echo "<td width='80' class='tbl'>".$locale['figure_411'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_title' value='".$figure_title."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Variant (locale 441)
   echo "<td width='80' class='tbl'>".$locale['figure_441'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_variant' value='".$figure_variant."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
      
   //Manufacturer (locale 417)
   echo "<td width='80' class='tbl'>".$locale['figure_417'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_manufacturer' value='".$figure_manufacturer."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Sub-Manufacturer (locale 415)
   echo "<td width='80' class='tbl'>".$locale['figure_415'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_submanufacturer' value='".$figure_submanufacturer."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Country (locale 436)
   echo "<td width='80' class='tbl'>".$locale['figure_436'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_country' value='".$figure_country."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Brand (locale 438)
   echo "<td width='80' class='tbl'>".$locale['figure_438'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_brand' value='".$figure_brand."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Series (locale 439)
   echo "<td width='80' class='tbl'>".$locale['figure_439'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_series' value='".$figure_series."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";

   
echo "<td width='80' class='tbl'>&nbsp;</td>\n";
echo "<td>&nbsp;</td>\n";
echo "</tr>\n<tr>\n";   
   
   //Scale (locale 442)
   echo "<td width='80' class='tbl'>".$locale['figure_442'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_scale' value='".$figure_scale."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Weight (locale 443)
   echo "<td width='80' class='tbl'>".$locale['figure_443'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_weight' value='".$figure_weight."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Height (locale 444)
   echo "<td width='80' class='tbl'>".$locale['figure_444'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_height' value='".$figure_height."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Width (locale 445)
   echo "<td width='80' class='tbl'>".$locale['figure_445'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_width' value='".$figure_width."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Depth (locale 446)
   echo "<td width='80' class='tbl'>".$locale['figure_446'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_depth' value='".$figure_depth."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Material (locale 447)
   echo "<td width='80' class='tbl'>".$locale['figure_447'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_material' value='".$figure_material."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Packaging (locale 448)
   echo "<td width='80' class='tbl'>".$locale['figure_448'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_packaging' value='".$figure_packaging."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";

   
echo "<td width='80' class='tbl'>&nbsp;</td>\n";
echo "<td>&nbsp;</td>\n";
echo "</tr>\n<tr>\n";

   
   //Publish date (locale 419)
   echo "<td width='80' class='tbl'>".$locale['figure_419'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_pubdate' value='".$figure_pubdate."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Original Retail Price (locale 449)
   echo "<td width='80' class='tbl'>".$locale['figure_449'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_retailprice' value='".$figure_retailprice."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Limited Edition (locale 450)
   echo "<td width='80' class='tbl'>".$locale['figure_450'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_limitation' value='".$figure_limitation."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
   //Edition Size (locale 451)
   echo "<td width='80' class='tbl'>".$locale['figure_451'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_editionsize' value='".$figure_editionsize."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";

echo "<td width='80' class='tbl'>&nbsp;</td>\n";
echo "<td>&nbsp;</td>\n";
echo "</tr>\n<tr>\n";
   
   //Sculper/Artists (locale 452)
   echo "<td width='80' class='tbl'>".$locale['figure_452'].":</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_artists' value='".$figure_artists."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
   
echo "<td width='80' class='tbl'>&nbsp;</td>\n";
echo "<td>&nbsp;</td>\n";
echo "</tr>\n<tr>\n";   
      
   echo "<td width='80' class='tbl' valign='top'>".$locale['figure_136']."</td>\n<td class='tbl' valign='top'>\n";
   if ($figure_image != "") {
      echo "<label><img src='".IMAGES_FIGURE.$figure_image."' width='350' height='100%' alt='' /><br />\n";
      echo "<input type='checkbox' name='del_image' value='y' /> ".$locale['figure_131']."</label>\n";
      echo "<input type='hidden' name='figure_image' value='".$figure_image."' />\n";
   } else {
      echo "<input type='file' name='figure_image' class='textbox' style='width:250px;' /><br />\n";
      echo sprintf($locale['figure_137'], parsebytesize($asettings['figure_photo_max_b']))."\n";
   }
   echo "</td>\n</tr>\n<tr>\n";
   echo "<td valign='top' width='80' class='tbl'>".$locale['figure_423'].":</td>\n";
   echo "<td class='tbl'><textarea name='figure_description' cols='60' rows='10' class='textbox' style='width:380px;'>".$figure_description."</textarea></td>\n";
   echo "</tr>\n<tr>\n";
   echo "<td class='tbl'></td><td class='tbl'>\n";
   echo display_bbcodes("360px", "figure_description")."</td>\n";
   echo "</tr>\n<tr>\n";
   echo "<td width='80' class='tbl'>".$locale['figure_122']."</td>\n";
   echo "<td class='tbl'><input type='text' name='figure_url' value='".$figure_url."' class='textbox' style='width:380px;' /></td>\n";
   echo "</tr>\n<tr>\n";
/*  echo "<td width='80' class='tbl' valign='top'>".$locale['figure_130']."</td>\n<td class='tbl' valign='top'>\n";
   if (!empty($figure_file)) {
      echo "<a href='".FIGURES.$figure_file."'>".FIGURES.$figure_file."</a><br />\n";
      echo "<label><input type='checkbox' name='del_upload' value='1' /> ".$locale['figure_131']."</label>\n";
      echo "<input type='hidden' name='figure_file' value='".$figure_file."' />";
   } else {
      echo "<input type='file' name='figure_file' class='textbox' style='width:150px;' /><br />\n";
      echo sprintf($locale['figure_133'], parsebytesize($asettings['figure_max_b']), str_replace(',', ' ', $asettings['figure_types']))."<br />\n";
      echo "<label><input type='checkbox' name='calc_upload' id='calc_upload' value='1' /> ".$locale['figure_132']."</label>\n";
   }
   
   echo "</td>\n</tr>\n<tr>\n";
   */
   echo "<td width='80' class='tbl'>".$locale['figure_123'].":</td>\n";
   echo "<td class='tbl'><select name='figure_cat' class='textbox'>\n".$editlist."</select></td>\n";
   echo "</tr>\n<tr>\n";
   //echo "<td width='80' class='tbl'>".$locale['figure_422'].":</td>\n";
   //echo "<td class='tbl'><input type='text' name='figure_filesize' id='figure_filesize' value='".$figure_filesize."' class='textbox' style='width:150px;' /></td>\n";
   //echo "</tr>\n<tr>\n";
   echo "<td class='tbl'></td><td class='tbl'>\n";
   echo "<label><input type='checkbox' name='figure_comments' value='yes''".$figure_comments." /> ".$locale['figure_124']."</label>\n";
   echo "<br /><label><input type='checkbox' name='figure_ratings' value='yes''".$figure_ratings." /> ".$locale['figure_125']."</label>\n</td>\n";
   echo "</tr>\n<tr>\n";
   
   
   echo "<td width='80' class='tbl' valign='top'></td>\n<td class='tbl' valign='top'>\n";
   if (isset($_GET['action']) && $_GET['action'] == "edit") {
      echo "<label><input type='checkbox' name='update_datestamp' value='1' /> ".$locale['figure_129']."</label>\n";
   }
   echo "</td>\n</tr>\n<tr>\n";
   
   
   echo "<td width='80' class='tbl' valign='top'></td>\n<td class='tbl' valign='top'>\n";
   echo "<b><h4><input type='submit' name='save_download' value='".$locale['figure_128']."' class='button' /></b></h4></td>\n";
   echo "</tr>\n</table>\n</form>\n";
   echo "* MSRP = Manufacturer's Suggested Retail Price\n";
   closetable();

   opentable($locale['figure_102']);
   echo "<table cellpadding='0' cellspacing='0' width='400' class='center'>\n";
   $result = dbquery("SELECT * FROM ".DB_FIGURE_CATS." WHERE figure_cat_parent='0' ORDER BY figure_cat_name");
   if (dbrows($result)) {
      echo "<tr>\n";
      echo "<td class='tbl2'>".$locale['figure_140']."</td>\n";
      echo "<td align='right' class='tbl2'>".$locale['figure_141']."</td>\n";
      echo "</tr>\n<tr>\n";
      echo "<td colspan='2' height='1'></td>\n";
      echo "</tr>\n";
      if (!isset($_GET['figure_cat_id']) || !isnum($_GET['figure_cat_id'])) { $_GET['figure_cat_id'] = 0; }
      while ($data = dbarray($result)) {
         if ($data['figure_cat_id'] == $_GET['figure_cat_id']) { $p_img = "off"; $div = ""; } else { $p_img = "on"; $div = "style='display:none'"; }
         echo "<tr>\n";
         echo "<td class='tbl2'>".$data['figure_cat_name']."</td>\n";
         echo "<td class='tbl2' align='right'><img src='".get_image("panel_$p_img")."' name='b_".$data['figure_cat_id']."' alt='' onclick=\"javascript:flipBox('".$data['figure_cat_id']."')\" /></td>\n";
         echo "</tr>\n";
         $result2 = dbquery("SELECT * FROM ".DB_FIGURE." WHERE figure_cat='".$data['figure_cat_id']."' ORDER BY figure_title");
         if (dbrows($result2) != 0) {
            echo "<tr>\n<td colspan='2'>\n";
            echo "<div id='box_".$data['figure_cat_id']."'".$div.">\n";
            echo "<table cellpadding='0' cellspacing='0' width='100%'>\n";
            while ($data2 = dbarray($result2)) {
               if (!empty($data2['figure_file']) && file_exists(FIGURES.$data2['figure_file'])) {
                  $figure_url = FIGURES.$data2['figure_file'];
               } elseif (!strstr($data2['figure_url'],"http://") && !strstr($data2['figure_url'],"../")) {
                  $figure_url = BASEDIR.$data2['figure_url'];
               } else {
                  $figure_url = $data2['figure_url'];
               }
               echo "<tr>\n<td class='tbl'><a href='$figure_url' target='_blank'>".$data2['figure_title']."</a></td>\n";
               echo "<td align='right' width='100' class='tbl'><a href='".FUSION_SELF.$aidlink."&amp;action=edit&amp;figure_cat_id=".$data['figure_cat_id']."&amp;figure_id=".$data2['figure_id']."'>".$locale['figure_142']."</a> -\n";
               echo "<a href='".FUSION_SELF.$aidlink."&amp;action=delete&amp;figure_cat_id=".$data['figure_cat_id']."&amp;figure_id=".$data2['figure_id']."' onclick=\"return confirm('".$locale['figure_160']."');\">".$locale['figure_131']."</a></td>\n";
               echo "</tr>\n";
            }
            echo "</table>\n</div>\n</td>\n</tr>\n";
         }
         echo subcats($data['figure_cat_id'], 1);
      }
      echo "</table>\n";
   } else {
      echo "<tr>\n<td align='center'><br />\n";
      echo $locale['figure_150']."<br /><br /></td>\n";
      echo "</tr>\n</table>\n";
   }
   closetable();
} else {
   opentable($locale['figure_102']);
   echo "<div style='text-align:center'>".$locale['figure_151']."<br />\n".$locale['figure_152']."<br /><br />\n";
   echo "<a href='figure_cats.php".$aidlink."'>".$locale['figure_153']."</a>".$locale['figure_154']."</div>\n";
   closetable();
}

echo "<script country='JavaScript' type='text/javascript'>
$(document).ready(function() {
   $('#calc_upload').click(
   function() {
      if ($('#calc_upload').attr('checked')) {
         $('#figure_filesize').attr('readonly', 'readonly');
         $('#calc_upload').attr('checked', 'checked');
      } else {
         $('#figure_filesize').removeAttr('readonly');
         $('#calc_upload').removeAttr('checked');
      }
   });
});
</script>";

function subcats ($id, $level) {
   global $aidlink, $locale;
   $sublist = "";
   $sresult[$id] = dbquery("SELECT figure_cat_id, figure_cat_name, figure_cat_description, figure_cat_access FROM ".DB_FIGURE_CATS." WHERE figure_cat_parent='".$id."' ORDER BY figure_cat_name");
   if (dbrows($sresult[$id]) != 0) {
      while ($sdata[$id] = dbarray($sresult[$id])) {
         if ($sdata[$id]['figure_cat_id'] == $_GET['figure_cat_id']) { $p_img = "off"; $div = ""; } else { $p_img = "on"; $div = "style='display:none'"; }
         $sublist .= "<tr>\n";
         $sublist .= "<td class='tbl2'>".str_repeat("&mdash; ",$level)." ".$sdata[$id]['figure_cat_name']."</td>\n";
         $sublist .= "<td class='tbl2' align='right'><img src='".get_image("panel_$p_img")."' name='b_".$sdata[$id]['figure_cat_id']."' alt='' onclick=\"javascript:flipBox('".$sdata[$id]['figure_cat_id']."')\" /></td>\n";
         $sublist .= "</tr>\n";
         $bresult[$id] = dbquery("SELECT * FROM ".DB_FIGURE." WHERE figure_cat='".$sdata[$id]['figure_cat_id']."' ORDER BY figure_title");
         if (dbrows($bresult[$id]) != 0) {
            $sublist .= "<tr>\n<td colspan='2'>\n";
            $sublist .= "<div id='box_".$sdata[$id]['figure_cat_id']."'".$div.">\n";
            $sublist .= "<table cellpadding='0' cellspacing='0' width='100%'>\n";
            while ($bdata[$id] = dbarray($bresult[$id])) {
               if (!empty($bdata[$id]['figure_file']) && file_exists(FIGURES.$bdata[$id]['figure_file'])) {
                  $figure_url = FIGURES.$bdata[$id]['figure_file'];
               } elseif (!strstr($bdata[$id]['figure_url'],"http://") && !strstr($bdata[$id]['figure_url'],"../")) {
                  $figure_url = BASEDIR.$bdata[$id]['figure_url'];
               } else {
                  $figure_url = $bdata[$id]['figure_url'];
               }
               $sublist .= "<tr>\n<td class='tbl'><a href='$figure_url' target='_blank'>".$bdata[$id]['figure_title']."</a></td>\n";
               $sublist .= "<td align='right' width='100' class='tbl'><a href='".FUSION_SELF.$aidlink."&amp;action=edit&amp;figure_cat_id=".$sdata[$id]['figure_cat_id']."&amp;figure_id=".$bdata[$id]['figure_id']."'>".$locale['figure_142']."</a> -\n";
               $sublist .= "<a href='".FUSION_SELF.$aidlink."&amp;action=delete&amp;figure_cat_id=".$sdata[$id]['figure_cat_id']."&amp;figure_id=".$bdata[$id]['figure_id']."' onclick=\"return confirm('".$locale['figure_160']."');\">".$locale['figure_131']."</a></td>\n";
               $sublist .= "</tr>\n";
            }
            $sublist .= "</table>\n</div>\n</td>\n</tr>\n";
         }
         $sublist .= subcats($sdata[$id]['figure_cat_id'], $level+1);
      }
   }
   return $sublist;
}

function menu_subcats($id, $name, $level) {
   global $figure_cat, $asettings; $sel = "";
   if (isset($_GET['action']) && $_GET['action'] == "edit") { $sel = ($figure_cat == $id ? " selected='selected'" : ""); }
   $list = "<option value='".$id."'$sel>".str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;",$level-1)." ".$name."</option>\n";
   if ($asettings['subcats']) {
      $sresult[$id] = dbquery("SELECT figure_cat_id, figure_cat_name FROM ".DB_FIGURE_CATS." WHERE figure_cat_parent='".$id."' ORDER BY figure_cat_name");
      if (dbrows($sresult[$id]) != 0) {
         while ($sdata[$id] = dbarray($sresult[$id])) {
            $list .= menu_subcats($sdata[$id]['figure_cat_id'], $sdata[$id]['figure_cat_name'], $level+1);
         }
      }
   }
   return $list;
}

require_once THEMES."templates/footer.php";
?>
0 replies
There are no post found.

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet