Jump to content
tobycatlin

File Library v1.0

Recommended Posts

No problem, nice to give something back. Let me know if it lives up to expectations.

 

Installed ok but my files.php displays things wrong :( it doesnt appear to mix with my current skin...

Share this post


Link to post
Share on other sites
Installed ok but my files.php displays things wrong :( it doesnt appear to mix with my current skin...

 

Cant edit my post :( anyway.. figured it out, its cos im using a template system! in the end I added it in a similar way to "define mainpage"

 

my files.php ended up looking like:

 

     <?php

/*
File library v1.3
files.php

Copyright (t)(c) 2005

Released under the GNU General Public License

Simple file listing script allowing a cover image to be attached to a file an displayed by section

Changes:
31-03-2005 - minor change
-added if statement in case this script is run when there are no files in the files table
*/

$section_query = tep_db_query("SELECT DISTINCT file_section FROM files WHERE file_status = '1'");

if ($section_query) {
   while ($section = tep_db_fetch_array($section_query)){
	 echo '<br><table align="center" ><tr><td class="infoBoxContents" colspan="2"><table width="100%" cellspacing="0" cellpadding="0"><tr>
   <td width="11">' . tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif') . '</td><td class="infoBoxHeading">'.$section[file_section].'</td><td width="11">' . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif') .'</td>
    </tr></table></td></tr>';
	 
	 $file_query = tep_db_query("SELECT * FROM files WHERE file_status = '1' AND file_section = '$section[file_section]'");
	 
	 while ($file = tep_db_fetch_array($file_query)){
	 echo '<tr valign="top">';
	 
	 if ($file[file_image_path]){
   echo '<td class="main" >'. tep_image( $file[file_image_path], $file[file_title], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT).'</td>';
	 }else{
   echo '<td class="infoBoxContents"></td>';
	 }
	 
	 echo '<td width="400" class="infoBoxContents"><b>' . $file[file_title]. '</b><br>' . $file[file_description] .'<br><br><b><a href="' . $file[file_path] . '" target="_BLANK" class="infoBoxContents">download...</a></b></td></tr>';

   echo '<tr><td></td></tr>';

	 }//end while 
 }//end distinct while
}else{
 echo 'No files found';
}
 ?>


     </td>
     </tr>
   </table

Edited by snout

Share this post


Link to post
Share on other sites

I am getting the below error after installing this what looks to be a great conrtib. It appears in the admin page after clicking on files.

 

 

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1

 

select * from files order by file_title limit -20, 20

Share this post


Link to post
Share on other sites
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1

 

What version of MySQL are you using??


I ain't got time to bleed

Share this post


Link to post
Share on other sites

Thank you so much for your help. That fixed my problem. I am now able to add files using Admin.

 

Now, how do I download these files from the website itself.

Share this post


Link to post
Share on other sites

Or not. I find that adding the file is fine. No problems. However, when I come to change the image for another, I get the below error:

 

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in c:\program files\e-novative\WAMP\www\catalog\admin\files.php on line 66

 

Warning: reset() [function.reset]: Passed variable is not an array or object in c:\program files\e-novative\WAMP\www\catalog\admin\includes\functions\database.php on line 55

 

Warning: Variable passed to each() is not an array or object in c:\program files\e-novative\WAMP\www\catalog\admin\includes\functions\database.php on line 79

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where file_id = '4'' at line 1

 

update files se where file_id = '4'

 

[TEP STOP]

Share this post


Link to post
Share on other sites

The previous error also appears when editing the file name.

 

Has anyone worked out how to add the file size to the admin page?

Share this post


Link to post
Share on other sites

Hi All,

 

I have a FRESH install of Oscommerce 2.2ms2-051113 with only CCGV installed.

Apache 2.0.55, PHP 5.1.1, MySQL 4.1

 

I performed the install of File Library v1.31 (31 Mar 2005).

 

I have found numerous issues all of which have already been stated on various posts. These are all the errors summed up which need to be rectified...

 

1. Few Cosmetic Errors:

- Please fill out the following information for the new country".

- Language definitions for TEXT_FILES_COVER_IMAGE, TEXT_DELETE_IMAGE, and NAVBAR_TITLE

 

2. An attempt to load any file larger than 1.99MB causes the error "Warning: No file uploaded." and an empty file record to be created.

I have tried this with jpg, bmp, wmv and pdf.

 

3. An attempt to edit an existing file in admin produces:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\Program Files\Apache Group\Apache2\htdocs\catalog\mky\files.php on line 66

Warning: reset() [function.reset]: Passed variable is not an array or object in C:\Program Files\Apache Group\Apache2\htdocs\catalog\mky\includes\functions\database.php on line 55

Warning: Variable passed to each() is not an array or object in C:\Program Files\Apache Group\Apache2\htdocs\catalog\mky\includes\functions\database.php on line 79
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where file_id = '4'' at line 1

update files se where file_id = '4'

[TEP STOP]

 

A response to these issues would be greatly appreciated.

Share this post


Link to post
Share on other sites

I have the exact same issues, if i find the answer i will reply. Hoping someone has by now :) thanks a million guys!


-------------------------------------------------

Best Regards,

 

ggbig (maestro)

Share this post


Link to post
Share on other sites

Got it!

 

in the admin/files.php find both instances of :

 

$sql_data_array = array_merge...

 

one is

 

if ($action == 'insert') {

$insert_sql_data = array('date_added' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

other is just below it

 

} elseif ($action == 'save') {

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

and change them to

 

if ($action == 'insert') {

$insert_sql_data = array('date_added' => 'now()');

 

$sql_data_array = array_merge((array)$sql_data_array, (array)$insert_sql_data);

 

and

 

} elseif ($action == 'save') {

$sql_data_array = array_merge((array)$sql_data_array, (array)$update_sql_data);

 

BINGO! enjoy!


-------------------------------------------------

Best Regards,

 

ggbig (maestro)

Share this post


Link to post
Share on other sites

i do have another question, can someone code the image and file path fields to hold their values when updating just one or the other??? After you make a new entry and then want to change only the image.... you lose the file path in the admin sidebar, the file is still showing on the store side but the image is not. in the admin if you update only the image you will no longer see the filepath (file name) you will se directory but not name and vice versa for the image :) Thanks im looking into it and will respond with any good news :)


-------------------------------------------------

Best Regards,

 

ggbig (maestro)

Share this post


Link to post
Share on other sites

i have tried the files that state they have the file path and file image path holding for the edit "case" but they do not work for me? any ideas on what the tep_draw_hidden_field part of that case section needs to make it hold those two pieces of info, i have added some stuff tot his contrib and wish to have it fully working :) once done i would like to sumbit the things i have changed/added for all to integrate at their will. Thanks again.


-------------------------------------------------

Best Regards,

 

ggbig (maestro)

Share this post


Link to post
Share on other sites

Someone alive here ?

Get some problems..

 

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /users/xxxxxx/www/shop/xxxxxx/files.php on line 66

 

Warning: reset() expects parameter 1 to be array, null given in /users/xxxxxx/www/shop/xxxxxx/includes/functions/database.php on line 59

 

Warning: Variable passed to each() is not an array or object in /users/xxxxxx/www/shop/xxxxxx/includes/functions/database.php on line 83

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where file_id = '1'' at line 1

 

update files se where file_id = '1'

Edited by TriCon

SELECT signatur FROM dummesprueche WHERE forumsbezug > 0

Share this post


Link to post
Share on other sites

You will probably run into quite a few problems with an addon that has not been updated in 8+ years but for the one you mention, open the files.php line and on line 66 you will see something like array_merge(...,...). After the comma, insert (array).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×