How does a user remove a logo

Requests for additional features or modifications

How does a user remove a logo

Postby squareapple » Mon Apr 30, 2007 5:41 am

How does a user remove a logo after uploading one, they decide not to have a logo at this time, how do they remove it.
squareapple
Advanced User
 
Posts: 132
Joined: Sat Apr 07, 2007 6:24 am

Postby WagonTrader » Mon Apr 30, 2007 7:09 am

Hmm... there isn't currently a way beside asking the admin to remove it, so lets try this...

Modify templates/default/edlist.tpl

Add

Code: Select all
             <input type="checkbox" name="rem_logo" value="1">&nbsp;{lang->desc p1='edlist' p2=$lang_set p3='rem_logo'}


After

Code: Select all
    {if $vs_current_listing.logo != ""}
         <img src={$vs_current_listing.logo}><br>


Modify edlist.php

Change

Code: Select all
   //Logo being uploaded
   $file_info = getimagesize($_FILES['logo']['tmp_name']);
   switch ($file_info[2]){
   case 1:
      $file_ext = "gif";
      break;
   case 2:
      $file_ext = "jpg";
      break;
   case 3:
      $file_ext = "png";
      break;
   case 4:
      $file_ext = "swf";
      break;
   default:
      $file_ext = "";
   }
   $image_file = "$config[root]/logo/$_GET[lid].$file_ext";
   if(move_uploaded_file($_FILES['logo']['tmp_name'], $image_file)){
      //Image Uploaded
      if( ($file_info[0] > $config['logo_w'] OR $file_info[1] > $config['logo_h']) AND function_exists("imagecreate") ){
         //Resize Image
         include_once("classes/resizeimage.inc.php");
         $rimg=new RESIZEIMAGE($image_file);
         $rimg->resize_limitwh($config['logo_w'],$config['logo_h'],$image_file);
         $rimg->close();
         $list_logo = "$config[mainurl]/logo/$_GET[lid].$file_ext?".rand();
      }
      mysql_query("UPDATE $pds_list SET logo_ext='$file_ext' WHERE id='$vs_current_listing[id]';");
   }


To

Code: Select all
   if($_POST['rem_logo'] AND $_FILES['logo']['tmp_name'] == ""){
      $image_file = "$config[root]/logo/$_GET[lid].$vs_current_listing[logo_ext]";
      @unlink($image_file);
   }else{
      //Logo being uploaded
      $file_info = getimagesize($_FILES['logo']['tmp_name']);
      switch ($file_info[2]){
      case 1:
         $file_ext = "gif";
         break;
      case 2:
         $file_ext = "jpg";
         break;
      case 3:
         $file_ext = "png";
         break;
      case 4:
         $file_ext = "swf";
         break;
      default:
         $file_ext = "";
      }
      $image_file = "$config[root]/logo/$_GET[lid].$file_ext";
      if(move_uploaded_file($_FILES['logo']['tmp_name'], $image_file)){
         //Image Uploaded
         if( ($file_info[0] > $config['logo_w'] OR $file_info[1] > $config['logo_h']) AND function_exists("imagecreate") ){
            //Resize Image
            include_once("classes/resizeimage.inc.php");
            $rimg=new RESIZEIMAGE($image_file);
            $rimg->resize_limitwh($config['logo_w'],$config['logo_h'],$image_file);
            $rimg->close();
            $list_logo = "$config[mainurl]/logo/$_GET[lid].$file_ext?".rand();
         }
         mysql_query("UPDATE $pds_list SET logo_ext='$file_ext' WHERE id='$vs_current_listing[id]';");
      }
   }


Add the language code for the checkbox in the language panel - edlist section....

code: rem_logo
english: Remove Logo

This isn't tested so if anyone gives it a try let me know how it worked.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Tested User Logo Removal

Postby Emmett » Fri Oct 12, 2007 6:30 pm

Ok - It works perfect
Tested it 3 cycles of remove/add worked perfect every time.

Thanks for the feature
Emmett
User
 
Posts: 43
Joined: Sun Aug 26, 2007 7:28 am

Postby jgbennette » Fri Jun 06, 2008 2:38 pm

You have to click the "Upload" button to make an effect. Then the graphic holder shows the X instead of the logo graphic. Clicking the "Remove Logo" box and then "Submit" does nothing. Not quite as intuitive as I'd like it.

Any way the "remove logo" click could be a button that makes an instant change right then and there - no other buttons to click? Or - in lieu of that, could it be such that selecting the Remove Logo button then "Submit" deletes the graphic? That would be more intuitive, I think.

BTW, has anyone told you lately how cool you are for providing such great support? Well, let me do it again! You're cool, man! Very! Many thanks!
Joseph
jgbennette
User
 
Posts: 28
Joined: Fri Jun 22, 2007 3:22 pm
Location: Oregon

Postby WagonTrader » Sat Jun 07, 2008 5:37 pm

You can change the checkbox in the edlist.tpl file to use the onClick event handler...

Change

Code: Select all
<input type="checkbox" name="rem_logo" value="1">


To

Code: Select all
<input type="checkbox" name="rem_logo" value="1" onClick="this.form.submit();">


Now when the member clicks the checkbox it should automatically submit the correct form.

The broken image is probably the result of another reported problem that I am researching. Appearantly when an image is uploaded, the image does not show after upload, so likewise it sounds like when an image is removed, the script isn't made aware immediately. Look for that fix when I have it.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby jgbennette » Sat Jun 07, 2008 6:02 pm

Thanks, Dave,

Your code change does not remove the photo. No matter what I do now, the logo remains. Is there something I should do to the edlist.php file, too?

Joseph
Joseph
jgbennette
User
 
Posts: 28
Joined: Fri Jun 22, 2007 3:22 pm
Location: Oregon

Postby WagonTrader » Tue Jul 01, 2008 10:28 am

The following should make the logo go away without a broken image...

Add

Code: Select all
      $vs_current_listing['logo'] = '';
      $tpl-> assign('vs_current_listing',$vs_current_listing);


After

Code: Select all
   if($_POST['rem_logo'] AND $_FILES['logo']['tmp_name'] == ""){
      $image_file = "$config[root]/logo/$_GET[lid].$vs_current_listing[logo_ext]";
      @unlink($image_file);


Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby jgbennette » Tue Jul 01, 2008 8:55 pm

Dave - I can't thank you enough for staying with this project when I know you are busy elsewhere (and maybe would like to make a living).

I STILL have the problem that with the onClick event nothing happens - the logo remains. Further, I can only rid myself of the logo if I take out the onClick event and in my form click the "upload" button after selecting the "remove logo" box.

It's a bit unintuitive for my users at this point.

I've integrated each of the changes on this page and it still doesn't work.

Many thanks again.

JB
Joseph
jgbennette
User
 
Posts: 28
Joined: Fri Jun 22, 2007 3:22 pm
Location: Oregon

Postby WagonTrader » Tue Jul 01, 2008 10:02 pm

Try changing onClick to onBlur or onChange, the page should refresh when checked and onClick might not be the right event handler.

Let me know if any of them work.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby jgbennette » Wed Jul 02, 2008 7:21 am

Hi Dave,

onBlur did nothing at all - even when I click the upload button the logo remains. With the onChange event, I get the same result as with the onClick event. Either way, the logo remains. So far the only method that works is to not use an event handler, click the "remove logo" box and then click "upload" to clear the logo - not very intuitive.

Perhaps the problem is in the "this.form.submit()" portion of that instruction line as the form is clearly not being submitted properly - although the screen does clear and reset my browser window to the top of the page - when I scroll down to the bottom, the logo is still there.

BTW, I'm using Firefox and IE to test this. Both act the same on this page.

Thanks,
Joseph
Joseph
jgbennette
User
 
Posts: 28
Joined: Fri Jun 22, 2007 3:22 pm
Location: Oregon

Postby WagonTrader » Wed Jul 02, 2008 12:40 pm

Okay... sometimes I can be dense. The problem is that the script is checking for the button being pressed. We can get around this with a little change in the templates/default/edlist.tpl file...

Replace

Code: Select all
<input type=submit name=btn_logo value="{lang->desc p1='edlist' p2=$lang_set p3='btn_upload'}" style="font-size:{#submit_btn_font_size#}; background-color:{#submit_btn_bgcolor#};">


With

Code: Select all
<input type=hidden name=btn_logo value="1"><input type=submit name=btn_logo2 value="{lang->desc p1='edlist' p2=$lang_set p3='btn_upload'}" style="font-size:{#submit_btn_font_size#}; background-color:{#submit_btn_bgcolor#};">


Now the hidden file will act as button press however the form is submitted. Go ahead and use the onClick event.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby jgbennette » Thu Jul 03, 2008 7:59 am

Dave,

Yes, that did the trick all right. Thanks.

You're the man!

BTW, I noticed that it now takes two tries at uploading to make the form upload a graphic. But that is WAY better than it was before.

JB
Joseph
jgbennette
User
 
Posts: 28
Joined: Fri Jun 22, 2007 3:22 pm
Location: Oregon

Postby WagonTrader » Thu Jul 03, 2008 10:27 am

I noticed that it now takes two tries at uploading to make the form upload a graphic.


You have to apply this bug fix...

http://phpdirectorysource.com/board/viewtopic.php?t=714

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby jgbennette » Thu Jul 03, 2008 1:26 pm

Score! Works perfectly now. Thanks!!!

JB :D
Joseph
jgbennette
User
 
Posts: 28
Joined: Fri Jun 22, 2007 3:22 pm
Location: Oregon

Re: How does a user remove a logo

Postby gavenp » Wed Mar 17, 2010 4:33 pm

Dave in reference to your modification (by WagonTrader » Tue May 01, 2007 1:09 am ) when I now click ont eh edit button for a member I get the following error message "Parse error: syntax error, unexpected '}' in /hermes/bosweb/web141/b1411/glo.mag/micard/edlist.php on line 350"

here is my editlist.php file. can you see whats wrong with it.
Code: Select all
<?PHP
/*
Copyright (c) 2005-2008, Wagon Trader (an Oregon USA business)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

All pages generated from the use of phpDirectorySource must contain the statement
"Powered by: phpDirectorySource" with an active link to http://www.phpdirectorysource.com,
unless a waiver is granted by the copyright holder.

Neither the name of Wagon Trader nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

//***********************************************
// Include Modules
//***********************************************
include ("modules/modules.php");
include ("classes/inputfilter.php");
$filter = new inputFilter($allow_tags,$allow_attr);

//***********************************************
// Include Variable Sets
//***********************************************
include ("configs/common_vs.php");

//***********************************************
// Assign Local Variables
//***********************************************
$title_tag = $language->desc('site_text',$lang_set,'main_title')." | ".$language->desc('edlist',$lang_set,'title_tag');
$bread_crumb[0] = $language->desc('edlist',$lang_set,'breadcrumb');
$btn_link[0] = "disabled";

if ( isset($_POST['submit_flag']) ){
        //Listing values being posted from the form
        if ( $_POST['cat_str'] != "" ){
                $cat_array = explode(":", $_POST['cat_str']);
        }
        if ( count($_POST['loc']) > 0 ){
                $loc_sel = end($_POST['loc']);
        }
        $_POST = $filter->process($_POST);
        foreach($_POST as $key => $value){
                if ( get_magic_quotes_gpc() AND is_string($value)){
                        $_POST[$key] = stripslashes($value);
                }
        }
        $firm = $_POST['firm'];
        $description = $_POST['description'];
        $website = $_POST['website'];
        $addr1 = $_POST['addr1'];
        $loc1 = $_POST['loc1'];
        $zip = $_POST['zip'];
        $contact = $_POST['contact'];
        $phone = $_POST['phone'];
        $fax = $_POST['fax'];
        $mobile = $_POST['mobile'];
        $listmail = $_POST['listmail'];
        $premium = $_POST['premium'];
        $xtra_1 = $_POST['xtra_1'];
        $xtra_2 = $_POST['xtra_2'];
        $xtra_3 = $_POST['xtra_3'];
        $xtra_4 = $_POST['xtra_4'];
        $xtra_5 = $_POST['xtra_5'];
        $xtra_6 = $_POST['xtra_6'];
}else{
        //Listing values filled from listing variable set
        $r_cat = mysql_query("SELECT cat_id FROM $pds_listcat WHERE list_id='$vs_current_listing[id]';");
        for($x=0;$x<mysql_num_rows($r_cat);$x++){
                $f_cat = mysql_fetch_assoc($r_cat);
                $cat_array[$x] = $f_cat['cat_id'];
                $cat_str = implode(":", $cat_array);
        }
        mysql_free_result($r_cat);
        $firm = $vs_current_listing['firm'];
        $description = $vs_current_listing['description'];
        $website = $vs_current_listing['website'];
        $addr1 = $vs_current_listing['address1'];
        $loc1 = $vs_current_listing['loc1'];
        $zip = $vs_current_listing['zip'];
        $contact = $vs_current_listing['contact'];
        $phone = $vs_current_listing['phone'];
        $fax = $vs_current_listing['fax'];
        $mobile = $vs_current_listing['mobile'];
        $listmail = $vs_current_listing['email'];
        $premium = $vs_current_listing['premium'];
        $xtra_1 = $vs_current_listing['xtra_1'];
        $xtra_2 = $vs_current_listing['xtra_2'];
        $xtra_3 = $vs_current_listing['xtra_3'];
        $xtra_4 = $vs_current_listing['xtra_4'];
        $xtra_5 = $vs_current_listing['xtra_5'];
        $xtra_6 = $vs_current_listing['xtra_6'];
}
$listing_level = $vs_current_listing['level'];

//***********************************************
// Result set paging
//***********************************************

//***********************************************
// Button Press Logic
//***********************************************
if ( isset($_POST['list_reg']) ){
        //Listing submitted

        // Listing level specific variables
        if ($config['auto_update'] AND $vs_current_listing['state'] == 'apr'){
                $state = "apr";
        }else{
                $state = "upd";
        }

        //Error checking
        if ( !count($cat_array) ){
                $notice .= $language->desc('error_text',$lang_set,'error_no_cat')."<br>";
        }
        if ($firm == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_firm')."<br>";
        }
        if ($vs_level[$listing_level][description] and $required[description] and $description == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_desc')."<br>";
        }
        if ($vs_level[$listing_level][website] and $required[website] and $website == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_web')."<br>";
        }
        if ($vs_level[$listing_level][addr1] and $required[address] and $addr1 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_addr')."<br>";
        }
        if ($vs_level[$listing_level][loc1] and $required[loc1] and $loc1 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_loc1')."<br>";
        }
        if ($vs_level[$listing_level][zip] and $required[zip] and $zip == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_zip')."<br>";
        }
        if ($vs_level[$listing_level][contact] and $required[contact] and $contact == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_cont')."<br>";
        }
        if ($vs_level[$listing_level][phone] and $required[phone] and $phone == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_phone')."<br>";
        }
        if ($vs_level[$listing_level][fax] and $required[fax] and $fax == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_fax')."<br>";
        }
        if ($vs_level[$listing_level][mobile] and $required[mobile] and $mobile == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_mob')."<br>";
        }
        if ($vs_level[$listing_level]['listmail'] and $required['listmail']){
                if($listmail == ""){
                        $notice .= $language->desc('error_text',$lang_set,'error_no_mail')."<br>";
                }elseif(!checkEmail($listmail)){
                        $notice .= $language->desc('error_text',$lang_set,'error_mail_bad')."<br>";
                }
        }
        if ($vs_level[$listing_level][xtra_1] and $required[xtra_1] and $xtra_1 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_xtra1')."<br>";
        }
        if ($vs_level[$listing_level][xtra_2] and $required[xtra_2] and $xtra_2 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_xtra2')."<br>";
        }
        if ($vs_level[$listing_level][xtra_3] and $required[xtra_3] and $xtra_3 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_xtra3')."<br>";
        }
        if ($vs_level[$listing_level][xtra_4] and $required[xtra_4] and $xtra_4 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_xtra4')."<br>";
        }
        if ($vs_level[$listing_level][xtra_5] and $required[xtra_5] and $xtra_5 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_xtra5')."<br>";
        }
        if ($vs_level[$listing_level][xtra_6] and $required[xtra_6] and $xtra_6 == ""){
                $notice .= $language->desc('error_text',$lang_set,'error_no_xtra6')."<br>";
        }

        if ($notice == ""){
                //No errors - Update Listing
                foreach($_POST as $key => $value){
                        if (is_string($value)){
                                $post_save[$key] = ($value);
                                $_POST[$key] = mysql_real_escape_string($value);
                        }
                }
                $firm = $_POST['firm'];
                $description = $_POST['description'];
                $website = $_POST['website'];
                $addr1 = $_POST['addr1'];
                $loc1 = $_POST['loc1'];
                $zip = $_POST['zip'];
                $contact = $_POST['contact'];
                $phone = $_POST['phone'];
                $fax = $_POST['fax'];
                $mobile = $_POST['mobile'];
                $listmail = $_POST['listmail'];
                $premium = $_POST['premium'];
                $xtra_1 = $_POST['xtra_1'];
                $xtra_2 = $_POST['xtra_2'];
                $xtra_3 = $_POST['xtra_3'];
                $xtra_4 = $_POST['xtra_4'];
                $xtra_5 = $_POST['xtra_5'];
                $xtra_6 = $_POST['xtra_6'];
                mysql_query ("UPDATE $pds_list SET
                        state='$state',
                        firm='$firm',
                        address1='$addr1',
                        loc1='$loc1',
                        loc_sel='$loc_sel',
                        zip='$zip',
                        contact='$contact',
                        phone='$phone',
                        fax='$fax',
                        mobile='$mobile',
                        description='$description',
                        website='$website',
                        email='$listmail',
                        premium='$premium',
                        d_update=now(),
                        xtra_1='$xtra_1',
                        xtra_2='$xtra_2',
                        xtra_3='$xtra_3',
                        xtra_4='$xtra_4',
                        xtra_5='$xtra_5',
                        xtra_6='$xtra_6'
                        WHERE id='$vs_current_listing[id]';") or die(mysql_error());

                //remove old categories
                mysql_query("DELETE FROM $pds_listcat WHERE list_id='$vs_current_listing[id]';");

                //update categories
                $cat_rows = count($cat_array);
                for ($x=0;$x<$cat_rows;$x++){
                        $cat_id = $cat_array[$x];
                        mysql_query ("INSERT INTO $pds_listcat (list_id, cat_id) VALUES('$vs_current_listing[id]','$cat_id');");

                        //turn on category listing flag
                        if($state == 'apr'){
                                //turn on category listing flag
                                TurnCatOn($cat_id);
                        }else{
                                TurnCatOff($cat_id);
                        }
                }

                //display saved values in form
                $firm = $post_save['firm'];
                $description = $post_save['description'];
                $website = $post_save['website'];
                $addr1 = $post_save['addr1'];
                $loc1 = $post_save['loc1'];
                $zip = $post_save['zip'];
                $contact = $post_save['contact'];
                $phone = $post_save['phone'];
                $fax = $post_save['fax'];
                $mobile = $post_save['mobile'];
                $listmail = $post_save['listmail'];
                $premium = $post_save['premium'];
                $xtra_1 = $post_save['xtra_1'];
                $xtra_2 = $post_save['xtra_2'];
                $xtra_3 = $post_save['xtra_3'];
                $xtra_4 = $post_save['xtra_4'];
                $xtra_5 = $post_save['xtra_5'];
                $xtra_6 = $post_save['xtra_6'];
        }
}elseif ( isset($_POST['add_cat']) ){
        //Adding Category to list
        $cat_id = $_POST[cat][current(array_flip($_POST['add_cat']))];
        if ( @in_array($cat_id, $cat_array) ){
                // Duplicate Category Selected


        }else{
                //Add Category to the list
                $cat_array[] = $cat_id;
                $cat_str = implode(":", $cat_array);
        }
}elseif ( isset($_POST['rem_cat']) ){
        //Remove Category from list
        $cat_id = $_POST[cat][current(array_flip($_POST['rem_cat']))];
        array_splice($cat_array, array_search($cat_id, $cat_array), 1);
        if (count($cat_array) == 0){
                unset($cat_str);
        }else{
                $cat_str = implode(":",$cat_array);
        }
}elseif ( isset($_POST['rem_cat_list']) ){
        //Remove Category from list
        array_splice($cat_array, $_POST[cat_list], 1);
        if (count($cat_array) == 0){
                unset($cat_str);
        }else{
                $cat_str = implode(":",$cat_array);
        }

}elseif ( isset($_POST['btn_logo']) ){
           if($_POST['rem_logo'] AND $_FILES['logo']['tmp_name'] == ""){
      $image_file = "$config[root]/logo/$_GET[lid].$vs_current_listing[logo_ext]";
      @unlink($image_file);
   }else{
      //Logo being uploaded
      $file_info = getimagesize($_FILES['logo']['tmp_name']);
      switch ($file_info[2]){
      case 1:
         $file_ext = "gif";
         break;
      case 2:
         $file_ext = "jpg";
         break;
      case 3:
         $file_ext = "png";
         break;
      case 4:
         $file_ext = "swf";
         break;
      default:
         $file_ext = "";
      }
      $image_file = "$config[root]/logo/$_GET[lid].$file_ext";
      if(move_uploaded_file($_FILES['logo']['tmp_name'], $image_file)){
         //Image Uploaded
         if( ($file_info[0] > $config['logo_w'] OR $file_info[1] > $config['logo_h']) AND function_exists("imagecreate") ){
            //Resize Image
            include_once("classes/resizeimage.inc.php");
            $rimg=new RESIZEIMAGE($image_file);
            $rimg->resize_limitwh($config['logo_w'],$config['logo_h'],$image_file);
            $rimg->close();
            $list_logo = "$config[mainurl]/logo/$_GET[lid].$file_ext?".rand();
         }
         mysql_query("UPDATE $pds_list SET logo_ext='$file_ext' WHERE id='$vs_current_listing[id]';");
      }
   }
                $vs_current_listing['logo'] = "$config[mainurl]/logo/$_GET[lid].$file_ext?".rand();
                $tpl-> assign('vs_current_listing',$vs_current_listing);
        }

}elseif ( isset($_POST['submit_flag']) ){
        //Nothing Pressed - Processing Cascades
}

//***********************************************
// Edit Listing
//***********************************************

if ( $vs_current_user[id] == $vs_current_listing[userid] OR $vs_current_admin){
        // This is the user or admin

}else{
        //This is not the user
        header("location:user.php");
        exit;
}

//Develop category select boxes
if ( isset($_POST[cat]) ){
        $cat_level = count($_POST[cat])+1;
}else{
        $cat_level = 1;
}
$cat_select = "
        <table width=90%>
         <tr>";
for ($i=1;$i<=$cat_level;$i++){
        $cat_select .= "
          <td width=30% align=left valign=top>
           <select name=cat[$i] size=10 style=width:$config[cat_sel_w] onChange=submit()>";
        if ($i == 1){
                $r = mysql_query ("SELECT * FROM $pds_category WHERE p IS NULL or p='0' ORDER BY title;");
        }else{
                $r = mysql_query ("SELECT * FROM $pds_category WHERE p='$cat_rel' ORDER BY title;");
        }
        $rows_r = mysql_num_rows($r);
        for ($x=0;$x<$rows_r;$x++){
                $f = mysql_fetch_assoc($r);
                if ($f[id] == $_POST[cat][$i]){
                        $cat_select .= "<option value=$f[id] selected>".$language->desc('category', $lang_set, $f[id])."</option>";
                        $cat_rel = $f[id];
                }else{
                        $cat_select .= "<option value=$f[id]>".$language->desc('category', $lang_set, $f[id])."</option>";
                }
        }
        mysql_free_result($r);
        if ( isset($_POST[cat][$i]) ){
                $oldcat = $_POST[cat][$i];
        }else{
                $oldcat = $f[id];
        }
        $cat_select .= "
           </select>";
        if ($config['add_any_cat'] and isset($_POST[cat][$i]) and $oldcat == $cat_rel ) {
                if (@!in_array($cat_rel, $cat_array) ){
                        $cat_select .= "
           <input type=submit name=add_cat[$i] value=\"".$language->desc('edlist', $lang_set, 'btn_add_cat')."\">";
                }else{
                        $cat_select .= "
           <input type=submit name=rem_cat[$i] value=\"".$language->desc('edlist', $lang_set, 'btn_rem_cat')."\">";
                }
        }
        $cat_select .= "
           <input type=hidden name=oldcat[$i] value=$oldcat>";
        $child_count = mysql_fetch_array( mysql_query("SELECT COUNT(*) FROM $pds_category WHERE p='$cat_rel';") );
        if (!$child_count[0] or $oldcat != $cat_rel){
                if (!$config['add_any_cat'] and isset($_POST[cat][$i]) and $oldcat == $cat_rel ){
                        $cat_select .= "
           <input type=submit name=add_cat[$i] value=\"".$language->desc('edlist', $lang_set, 'btn_add_cat')."\">";
                }
                $cat_select .= "
          </td>";
                if ($i % $config['cat_col'] == 0){$cat_select .= "</tr><tr>";}
                break;
        }
        $cat_select .= "
          </td>";
        if ($i % $config['cat_col'] == 0){$cat_select .= "</tr><tr>";}
}
$cat_select .= "
        </table>
         </tr>";

if($config['use_loc_sel']){
        //Develop location selects
        $i = 1;
        while ( $end == false ){
                if ($i == 1){
                        $loc_title = $language->desc('loc_level', $lang_set, $config['prim_loc_level']);
                }else{
                        $loc_title = $language->desc('loc_level', $lang_set, $loc_level);
                }
                $show_location .= "
          <tr>
           <td width=50% valign=top align=right bgcolor=#EEEEEE>
                <font style=\"color:#3366CC; font-size:12pt; font-weight:normal; background-color:#EEEEEE;\">
                 $loc_title:&nbsp;&nbsp;&nbsp;
                </font>
           </td>
           <td width=50% align=left valign=left bgcolor=#EEEEEE>
                <select name=loc[$i] size=1 onChange=submit()>";
                if ($i == 1){
                        $r = mysql_query ("SELECT * FROM $pds_locsel WHERE p IS NULL or p='0' ORDER BY title;");
                }else{
                        $r = mysql_query ("SELECT * FROM $pds_locsel WHERE p='$loc_rel' ORDER BY title;");
                }
                if ($_POST[loc][$i] == ""){
                        $_POST[loc][$i] = $vs_loc_sel[$i-1];
                }
                $rows_r = mysql_num_rows($r);
                for ($x=0;$x<$rows_r;$x++){
                        $f = mysql_fetch_assoc($r);
                        if ($x == 0){$loc_rel = $f[id];$loc_level = $f[level];}
                        if ($f[id] == $_POST[loc][$i]){
                                $show_location .= "<option value=$f[id] selected>".$language->desc('location', $lang_set, $f[id])."</option>";
                                $loc_rel = $f[id];
                                $loc_level = $f[level];
                        }else{
                                $show_location .= "<option value=$f[id]>".$language->desc('location', $lang_set, $f[id])."</option>";
                        }
                }
                mysql_free_result($r);
                $child_count = mysql_fetch_array( mysql_query("SELECT COUNT(*) FROM $pds_locsel WHERE p='$loc_rel';") );
                if ($child_count[0]){
                        $i ++;
                }else{
                        $end = true;
                }
                $show_location .= "
           </td>
          </tr>
                ";
        }
}

//***********************************************
// Assign local variables to template
//***********************************************
//Initialize category list
unset ($cat_list);
if ( count($cat_array) > 0 ){
        for ($x=0;$x<count($cat_array);$x++){
                $cat_list[$x][number] = $x;
                $cat_list[$x][catpath] = getCatPath($cat_array[$x]);
        }
        $cats_left = $vs_level[$listing_level][cats]-count($cat_array);
        $cat_str = implode(":", $cat_array);
}else{
        $cats_left = $vs_level[$listing_level][cats];
}

$tpl-> assign('page',$page);
$tpl-> assign('notice',$notice);
$tpl-> assign('login',$login);
$tpl-> assign('usermail',$usermail);
$tpl-> assign('pass',$pass);
$tpl-> assign('vpass',$vpass);
$tpl-> assign('listing_level',$listing_level);
$tpl-> assign('firm',$firm);
$tpl-> assign('description',$description);
$tpl-> assign('website',$website);
$tpl-> assign('addr1',$addr1);
$tpl-> assign('loc1',$loc1);
$tpl-> assign('zip',$zip);
$tpl-> assign('contact',$contact);
$tpl-> assign('phone',$phone);
$tpl-> assign('fax',$fax);
$tpl-> assign('mobile',$mobile);
$tpl-> assign('listmail',$listmail);
$tpl-> assign('premium',$premium);
$tpl-> assign('xtra_1',$xtra_1);
$tpl-> assign('xtra_2',$xtra_2);
$tpl-> assign('xtra_3',$xtra_3);
$tpl-> assign('xtra_4',$xtra_4);
$tpl-> assign('xtra_5',$xtra_5);
$tpl-> assign('xtra_6',$xtra_6);
$tpl-> assign('cat_str',$cat_str);
$tpl-> assign('cat_list',$cat_list);
$tpl-> assign('cats_left',$cats_left);
$tpl-> assign('cat_select',$cat_select);
$tpl-> assign('show_location',$show_location);
$tpl-> assign('title_tag', $title_tag);
$tpl-> assign('bread_crumb', $bread_crumb);
$tpl-> assign('btn_link',$btn_link);
$tpl-> assign('list_logo',$list_logo);
$tpl-> assign('show_page','edlist');

//***********************************************
// Display Template
//***********************************************
$tpl-> display("$config[deftpl]/edlist.tpl");

?>


I would liek to try and finish this modification so it will all work but cant get past this spot.

Gaven
gavenp
New User
 
Posts: 4
Joined: Tue Mar 16, 2010 3:07 am


Return to Mod Requests

Who is online

Users browsing this forum: No registered users and 1 guest