photoarchive-commits Mailing List for photoarchive
Brought to you by:
lord
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(13) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(1) |
| 2005 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(13) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Vadim Z. <lo...@us...> - 2006-03-01 06:00:36
|
Update of /cvsroot/photoarchive/photoarchive/src/toflickr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16317/toflickr Log Message: Directory /cvsroot/photoarchive/photoarchive/src/toflickr added to the repository |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:56:46
|
Update of /cvsroot/photoarchive/photoarchive/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14175/doc Added Files: COPYING ChangeLog INSTALL README TODO Log Message: major code reorg --- NEW FILE: COPYING --- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) 19yy <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. --- NEW FILE: ChangeLog --- 2006-02-28 Vadim Zaliva <lo...@mb...> * Core reorg - moved code to separate directories 2004-07-15 Vadim Zaliva <lo...@ze...> * config.ing: * rss.php: simple rss feed generator for new images 2001-10-21 Vadim Zaliva <lo...@cr...> * upload_image_handler.php: location of image conversion scripts is specified in cfg. * login_handler.php: Patch from ty...@us... to work around problem http://support.microsoft.com/support/kb/articles/q176/1/13.asp which prevented photoarchive to run under IIS on Windows. * upload_image_handler.php: Patch from ty...@us... which allows to product thumbnails not only for JPEG images, but also for GIF and PNG. Also it uses PPMTOJPEG instead of CJPEG which was sometimes causing thumbnails corruption under Windows. 2001-06-25 Vadim Zaliva <lo...@cr...> * thumbnail.php: * image.php: corrected problem when under load it failes to show some images and thumbnails. 2001-06-12 Vadim Zaliva <lo...@cr...> * Patch from H. Wade Minter <mi...@lu...>: 1) fixes a bug in the date code, where adding a photo would accept an empty date properly, but when you went to edit the photo, the date would show up as 0/0/0000, which you would manually have to remove. 2) Manually specifies the path to djpeg, pnmscale, and cjpeg, because at least on my FreeBSD systems, those programs are not in the web server's path. Added an entry for that in the config.inc file. 3) Let the user specify in the config.inc file how many pictures they want included in the "Top 10" section, instead of a hardcoded 10. 3.5) Also, I've set it so that a picture must have been viewed at least once before it can show up on the "Top 10" page, preventing the page from being full of images nobody has looked at. 2000-10-02 Vadim Zaliva <lo...@cr...> * misc.inc: code from footer.inc moved here. * show_group.php: all group operations are mooved to footer * footer.inc: split footer to GOTO and OPERATIONS. 2000-09-13 Vadim Zaliva <lo...@cr...> * README (Note): added reference to Joseph W. Breu photoarchive 2000-09-10 Vadim Zaliva <lo...@cr...> * create.tables.mysql.sql: small typo corrected. Found by Jan Johansson . 2000-08-11 Vadim Zaliva <lo...@cr...> * thumbnail.php: * image.php: * misc.inc: Handling of If-Modified-Since header. 2000-08-10 Vadim Zaliva <lo...@cr...> * misc.inc: showing groups and pictures in one huge table. 2000-08-09 Vadim Zaliva <lo...@cr...> * upload_image_handler.php: using MySQL function to set publishing date. * image.php: Added Content-Lenght field. * thumbnail.php: Added Last-Modified header - to aid caching. * image.php: corrected content-type for images, Added Last-Modified header - to aid caching. * misc.inc: * edit_image.php: Now thumbnails and images URL contain image Id not as parameter, but as path of URL. This is done to allow cahcing of them by browser. Thanks Alex Vasylenko <lx...@ne...> for idea. 2000-08-02 Vadim Zaliva <lo...@cr...> * create.tables.mysql.sql: * show_group.php: Better table sturcture for groups hierarchy 2000-08-01 Vadim Zaliva <lo...@cr...> * show_group.php: in admin mode added operations to EDIT, DELETE, VIEW images and groups. * create.tables.mysql.sql: * show_group.php: * misc.inc: groups hierarchy. 2000-07-28 Vadim Zaliva <lo...@cr...> * stats.php: simple statistics implemented. 2000-07-26 Vadim Zaliva <lo...@cr...> * config.inc: version 1.2 * create.tables.mysql.sql: moved indices creation to CREATE TABLE statements 2000-07-25 Vadim Zaliva <lo...@cr...> * edit_group_handler.php: Corrected bug #110189. * upload_image_handler.php: corrected problem with thumbnails generation when image is uploaded from MS Internet Explorer v5. * top10.php: more efficient way to retreive top 10 under MySQL. 2000-07-21 Vadim Zaliva <lo...@cr...> * config.inc: v1.1 released * image_detail.php: Show message when image not found. * login_handler.php: * misc.inc: For higher security - using MD5 of admin password as cookie. Show message when group contains no images. * search_handler.php: * search.php: Search implemented 2000-07-20 Vadim Zaliva <lo...@cr...> * misc.inc: * top10.php: * show_group.php: Code reorg - image list display code is not duplicated anymore. * Added proper SQL quoting of all parameters. * show_group.php: * image_detail.php: * groups.php: * footer.inc: Changes style of all navigation links * show_group.php: Added Edit, Delete links at the group view in admin mode. * edit_group.php: * edit_group_handler.php: * create.tables.mysql.sql: Added "Comment" field to Groups. * upload_image.php: * edit_image.php: stripping slashesh in group names in list. 2000-07-19 Vadim Zaliva <lo...@cr...> * create.tables.mysql.sql: index creation statements added * image_detail.php: picture views by admin are not counted. * config.inc: version 1.0 released 2000-07-18 Vadim Zaliva <lo...@cr...> * image_detail.php: image delete confirmation * groups.php: group delete confirmation. * delete_group_handler.php: corrected problem with not detecting admin priveledges while deleting group. * ShotAt field is not holding just Date, not Date and Time. Also this field not is optional and if ommited when image is uploaded or edited will show 0. * .htaccess: corrected problem with forbidden access to 'styles.inc'. 2000-07-17 Vadim Zaliva <lo...@cr...> * upload_image_handler.php: removing generated thumbnail files. --- NEW FILE: INSTALL --- $Id: INSTALL,v 1.1 2006/03/01 05:56:39 lord Exp $ To install 'photoarchive' you need to have following: 1. MySQL server 2. Apache http server 3. php3 4. cjped, djpeg, pnmscape (to produce thumbnails. see also http://netpbm.sourceforge.net/, http://www.ijg.org/) Here is list of RedHat packages I am using: MySQL-3.22.32-1 php-3.0.15-2 php-mysql-3.0.14-2mdk apache-1.3.12-2 libjpeg-6b-9 libgr-progs-2.0.13-20 1. CREATE new database in MySQL where your photos will be stored 2. CREATE tables using SQL from 'create.tables.mysql.sql' file 3. GRANT some user access permissions to newly created database 4. Copy all .php and .inc file to the directory under server HTML root. Make sure permissions are OK, so https can load them. (you may have to configure apache to recognized .php as PHP code) 5. To hide your database and admin password, copy .htaccess file to same directory where config.inc is located. (You may have to configure apache to use .htacces) 6. edit 'config.inc' If you are updating from version 1.2 you need to execute following SQL commands: ALTER TABLE Images MODIFY COLUMN PublishedAt DATETIME NOT NULL; ALTER TABLE Groups ADD COLUMN ParentGroupId INTEGER NULL; ALTER TABLE Groups ADD FOREIGN KEY (ParentGroupId) REFERENCES Groups(Id); If you are updating from version 1.0 you need to execute following SQL commands: ALTER TABLE Groups ADD COLUMN Comment VARCHAR(255) NULL; CREATE UNIQUE INDEX ImageIdIndex ON Images (Id); CREATE UNIQUE INDEX GroupIdIndex ON Groups (Id); CREATE UNIQUE INDEX ImageGroupsInidex ON ImageGroups (GroupId, ImageId); If you are updating from version 0.9 you need to execute following SQL command: ALTER TABLE Images CHANGE ShotAt ShotAt DATE NOT NULL; ALTER TABLE Groups ADD COLUMN Comment VARCHAR(255) NULL; CREATE UNIQUE INDEX ImageIdIndex ON Images (Id); CREATE UNIQUE INDEX GroupIdIndex ON Groups (Id); CREATE UNIQUE INDEX ImageGroupsInidex ON ImageGroups (GroupId, ImageId); --- NEW FILE: README --- $Id: README,v 1.1 2006/03/01 05:56:39 lord Exp $ This program allows you to organize your personal photos into web album. All data (including) will be stord in mySQL database. The program is written in PHP. I wrote is because I was not able to find other software which will have all features I need. Main design goals: 1. Everything is stored in the database 2. All adminstration is done via web interface 3. Image could be referenced in several groups 4. It should be easy to use To see what other features I might add in future, look at TODO file. To see this software in action, you can take a look at my photo album at: http://www.crocodile.org/lord/photoarchive/ All your suggestions, bug reports, patches, ideas are welcome. Please send bug reports via bug reporting form at project home page at: http://sourceforge.net/projects/photoarchive/ Vadim Zaliva <lo...@cr...> Severel people sent me patches, improvements suggestions, bugfixes. Here is list of them: H. Wade Minter <mi...@lu...> Alex Vasylenko <lx...@ne...> ? ty...@us... I am very thankful for their help. Note: ----- This program shouldn't be confused with the photoarchive program that was written by Joseph W. Breu <br...@cf...>. They have the same concept, but are written in completely different languages. His application can be found at: http://www.breu.org/archive/ If you don't like mine, then I encourage you to try his! --- NEW FILE: TODO --- $Id: TODO,v 1.1 2006/03/01 05:56:39 lord Exp $ Generic features: . Nice html (sorry I am not WWW designer). . Public/private bit. . Viewer comments. . Localisation. . Extract thumbnail from JPEG image if it is already present there. . Allow to see X most recently added pictures. . Uploading group of images as ZIP/JAR/TAR file. . When uploading image to group, make this group selected automagically in upload page. . Storing image in several resolutions. . Opening image for viewing in new window (optional) . Move comments in image_detail to be located directly under image. Make sure comment does not contain extra line feed at the end. . Scale impage after upload to some standard size (like 800x600) Multiuser features (not sure if I want to do these): . Picture owner field. . ACLs. . Picture rating. Unfinished stuff: . In group list, for sub-groups show number of groups in addition to number of images shown now. . In footer, upload and new child group should take parent parameter. |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:56:44
|
Update of /cvsroot/photoarchive/photoarchive/sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14175/sql Added Files: create.tables.mysql.sql createdb.sql Log Message: major code reorg --- NEW FILE: create.tables.mysql.sql --- CREATE TABLE Groups ( Id INTEGER NOT NULL, Name VARCHAR(127) NULL, Comment VARCHAR(255) NULL, ParentGroupId INTEGER NULL, PRIMARY KEY (Id), FOREIGN KEY (ParentGroupId) REFERENCES Groups(Id), UNIQUE INDEX GroupIdIndex (Id) ); CREATE TABLE Images ( Id INTEGER NOT NULL, Views INTEGER NOT NULL, Caption VARCHAR(127) NULL, Comment VARCHAR(255) NULL, Format VARCHAR(32) NOT NULL, Width INTEGER NOT NULL, Height INTEGER NOT NULL, Bytes INTEGER NOT NULL, Image MEDIUMBLOB NOT NULL, Thumbnail MEDIUMBLOB NULL, PublishedAt DATETIME NOT NULL, ShotAt DATE NULL, PRIMARY KEY (Id), UNIQUE INDEX ImageIdIndex (Id) ); CREATE TABLE ImageGroups ( GroupId INTEGER NOT NULL, ImageId INTEGER NOT NULL, PRIMARY KEY (GroupId, ImageId), FOREIGN KEY (GroupId) REFERENCES Groups(Id), FOREIGN KEY (ImageId) REFERENCES Images(Id), UNIQUE INDEX ImageGroupsIndex (GroupId, ImageId) ); --- NEW FILE: createdb.sql --- CREATE DATABASE PHOTO on disk1=300 log on stplog=50 with override go sp_dboption PHOTO,'trunc log on chkpt', true go sp_dboption PHOTO,'abort tran on log full', true go sp_helpdb go |
Update of /cvsroot/photoarchive/photoarchive/src/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14175/src/web Added Files: config.inc confirm.php connect.inc delete_group_handler.php delete_image_handler.php edit_group.php edit_group_handler.php edit_image.php edit_image_handler.php group.jpg groups.php image.php image_detail.php login.php login_handler.php logout_handler.php misc.inc php-dbi.inc rss.php search.php search_handler.php show_group.php stats.php styles.inc thumbnail.php top10.php upload_image.php upload_image_handler.php xml.gif Log Message: major code reorg --- NEW FILE: config.inc --- <?php // Site-specific settings. // Configure these for your site. // You shouldn't have to modify anything outside of this file. // ///////////////////////////////////////////////////////////////// $PROGRAM_NAME = "PhotoArchive v2.0b"; $PROGRAM_URL = "http://www.crocodile.org/software.html"; // Database settings // db_type should be one of: "mysql", "oracle", "postgresql", "odbc" // MySQL example $db_type = "mysql"; $db_host = "localhost"; $db_login = "X"; $db_password = "X"; $db_database = "PHOTO"; // Params $thumbnails_per_row = 4; $max_file_size = 1024*1024; // 1 Mb $max_search_results = 32 ; $top_number = 20; # The number of pictures to show in # the "Top X" section (ie. Top 10, Top 25) //File Locations //As these binaries will probably not be in your path, you should //specify the path to them. $djpeg = "/usr/bin/djpeg"; $pnmscale = "/usr/bin/pnmscale"; $ppmtojpeg = "/usr/bin/ppmtojpeg"; $giftopnm = "/usr/bin/giftopnm"; $pngtopnm = "/usr/bin/pngtopnm"; // RSS-related $FEED_NAME="Vadim Zaliva Photoarchive"; $FEED_URL="http://www.crocodile.org/lord/photoarchive/"; $FEED_DESCR="Vadim Zaliva Photo Archive"; $RSS_MAX_RECORDS=100; // Admin $admin_password = "X"; ?> --- NEW FILE: confirm.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } if(!isset($OKURL)) { die("Need 'OKURL' parameters"); } if(!isset($CANCELURL)) { die("Need 'CANCELURL' parameters"); } if(!isset($Question)) { die("Need 'Question' parameters"); } ?> <HTML> <HEAD> <TITLE>Confirmation</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1 CLASS="title">Confirmation</H1> <p> <?php // I have no idea why I need to strip slashes here. echo stripslashes($Question); ?> </p> <?php echo "<a href=\"$OKURL\">[OK]</a> "; echo "<a href=\"$CANCELURL\">[Cancel]</a>"; show_footer($INVALID_GID, null); ?> --- NEW FILE: connect.inc --- <?php // db settings are in config.inc // Establish a database connection. $c = dbi_connect ( $db_host, $db_login, $db_password, $db_database ); if ( ! $c ) { echo "Error connecting to database:<BLOCKQUOTE>" . dbi_error () . "</BLOCKQUOTE>\n"; exit; } ?> --- NEW FILE: delete_group_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } if(!isset($Id)) { die("Need 'Id' parameters"); } else { $Id=addslashes($Id); } include "config.inc"; include "php-dbi.inc"; include "connect.inc"; if(!dbi_query("DELETE FROM ImageGroups WHERE GroupId=$Id")) { $error = dbi_error (); } else if(!dbi_query("DELETE FROM Groups WHERE Id=$Id")) { $error = dbi_error (); } else { do_redirect("show_group.php?Id=-1"); } ?> <HTML> <HEAD> <TITLE>Error</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Error</H1> <BLOCKQUOTE class="error"> <?php echo $error; echo "</BLOCKQUOTE>"; show_footer($INVALID_GID, null); ?> --- NEW FILE: delete_image_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } if(!isset($Id)) { die("Need 'Id' parameters"); } else { $Id=addslashes($Id); } include "config.inc"; include "php-dbi.inc"; include "connect.inc"; if(!dbi_query("DELETE FROM ImageGroups WHERE ImageId=$Id")) { $error = dbi_error (); } else if(!dbi_query("DELETE FROM Images WHERE Id=$Id")) { $error = dbi_error (); } else { do_redirect("show_group.php?Id=-1"); } ?> <HTML> <HEAD> <TITLE>Error</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Error</H1> <BLOCKQUOTE class="error"> <?php echo $error; echo "</BLOCKQUOTE>"; show_footer($INVALID_GID, null); ?> --- NEW FILE: edit_group.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } ?> <HTML> <HEAD> <TITLE>Edit group</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Edit Group</H1> <?php echo "<FORM METHOD=\"POST\" ACTION=\"edit_group_handler.php\">\n"; if(isset($Id)) { $Id=addslashes($Id); // Editing Group echo "<INPUT TYPE=\"hidden\" NAME=\"Change\" value=\"update\">\n"; $res = dbi_query ("SELECT Name, Comment FROM Groups WHERE Id=$Id"); if($res) { if ( $row = dbi_fetch_row ( $res ) ) { echo "<INPUT TYPE=\"hidden\" NAME=\"Id\" value=\"$Id\">\n"; echo "<TABLE>\n"; $name=stripslashes($row[0]); echo "<TR><TD class=fieldname>Name</TD><TD><INPUT TYPE=\"text\" NAME=\"Name\" size=80 value=\"$name\"></TD></TR>\n"; $comment=stripslashes($row[1]); echo "<TR><TD class=fieldname>Comment</TD><TD><TEXTAREA NAME=\"Comment\" cols=80 rows=10>$comment</TEXTAREA></TD></TR>\n"; } dbi_free_result ( $res ); } } else { // New group echo "<INPUT TYPE=\"hidden\" NAME=\"Change\" value=\"create\">\n"; echo "<TABLE>\n"; echo "<TR><TD class=fieldname>Name</TD><TD><INPUT TYPE=\"text\" NAME=\"Name\" size=80></TD></TR>\n"; echo "<TR><TD class=fieldname>Comment</TD><TD><TEXTAREA NAME=\"Comment\" cols=80 rows=10></TEXTAREA></TD></TR>\n"; } echo "</TABLE>\n"; echo "<INPUT TYPE=\"submit\" VALUE=\"Submit\">\n"; echo "</FORM>\n"; show_footer($INVALID_GID, null); ?> --- NEW FILE: edit_group_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } if(!isset($Name) || !isset($Change) || !isset($Comment)) { die("Need 'Name', 'Change', 'Comment' parameters"); } if($Change == "Update" && !isset($Id)) { die("Need 'Id' parameters"); } include "config.inc"; include "php-dbi.inc"; include "connect.inc"; $Name = addslashes($Name); $Comment = addslashes($Comment); if($Change == "update") { $sql = "UPDATE Groups SET Name='$Name', Comment='$Comment' WHERE Id=$Id"; } else { $res=dbi_query("SELECT MAX(Id)+1 FROM Groups"); if($res) { if($row = dbi_fetch_row( $res )) { if($row[0] != null) { $newid = $row[0]; } else { $newid = 0; } } else { // no records yet $newid = 0; } $sql = "INSERT INTO Groups (Id, Name, Comment) VALUES ($newid, '$Name', '$Comment')"; dbi_free_result ( $res ); } else { $error = dbi_error (); } } if(!dbi_query($sql)) { $error = dbi_error (); } else { do_redirect("show_group.php?Id=-1"); } ?> <HTML> <HEAD> <TITLE>Error</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Error</H1> <BLOCKQUOTE class="error"> <?php echo $error; echo "</BLOCKQUOTE>"; show_footer($INVALID_GID, null); ?> --- NEW FILE: edit_image.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } if(!isset($Id)) { die("Need 'Id' parameter"); } else { $Id=addslashes($Id); } ?> <HTML> <HEAD> <TITLE>Edit Image</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Edit Image</H1> <?php echo "<IMG SRC=\"thumbnail.php/$Id\">"; $sql = "SELECT Caption, Comment, DAYOFMONTH(ShotAt), MONTH(ShotAt), YEAR(ShotAt) FROM Images WHERE Id=$Id"; $res = dbi_query ( $sql ); if ( $res ) { if($row = dbi_fetch_row( $res )) dbi_free_result ( $res ); $caption = stripslashes($row[0]); $comment = stripslashes($row[1]); $row[2] == 0 ? $shot_day = '' : $shot_day = $row[2]; $row[3] == 0 ? $shot_month = '' : $shot_month = $row[3]; $row[4] == 0 ? $shot_year = '' : $shot_year = $row[4]; } ?> <FORM METHOD="POST" ACTION="edit_image_handler.php"> <TABLE> <?php gen_max_file_size_field() ?> <TR> <TD class=fieldname>Title</TD> <?php echo "<TD><INPUT TYPE=\"text\" NAME=\"Caption\" size=80 VALUE=\"$caption\"\"></TD>"; ?> </TR> <TR> <TD class=fieldname>Date<br><i>dd.mm.yyyy (optional)</i></TD> <TD> <?php echo "<INPUT TYPE=\"text\" NAME=\"ShotAtDay\" size=2 VALUE=\"$shot_day\">"; echo "<INPUT TYPE=\"text\" NAME=\"ShotAtMonth\" size=2 VALUE=\"$shot_month\">"; echo "<INPUT TYPE=\"text\" NAME=\"ShotAtYear\" size=4 VALUE=\"$shot_year\">"; ?> </TD> </TR> <TR> <TD class=fieldname>Comment</TD> <TD><TEXTAREA NAME="Comment" cols=80 rows=10><?php echo $comment;?></TEXTAREA></TD> </TR> <TR> <TD class=fieldname>Groups</TD> <TD><SELECT NAME="Groups[]" size=15 MULTIPLE> <?php $res = dbi_query ("SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId AND ImageGroups.ImageId=$Id GROUP BY Groups.Id ORDER BY Groups.Id"); if($res) { while($row = dbi_fetch_row($res)) { $row[1]=stripslashes($row[1]); if($row[2]==0) { echo "<OPTION value=\"$row[0]\">$row[1]\n"; } else { echo "<OPTION value=\"$row[0]\" SELECTED>$row[1]\n"; } } dbi_free_result ( $res ); } ?> </SELECT></TD> </TR> </TABLE> <INPUT TYPE="submit" VALUE="Submit"> <?php echo "<INPUT TYPE=\"hidden\" NAME=\"Id\" VALUE=\"$Id\">"; ?> </FORM> <?php show_footer($INVALID_GID, null); ?> --- NEW FILE: edit_image_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } if(!isset($Caption) || !isset($Comment) || !isset($Groups ) || !isset($Id) ) { die("Need 'You must fill all fields' parameters"); } if(!isset($ShotAtDay ) || !isset($ShotAtMonth) || !isset($ShotAtYear ) || $ShotAtDay == '' || $ShotAtMonth == '' || $ShotAtYear == '') { // Date not set - null $shot_at = "NULL"; } else { if($ShotAtYear<1900) { die("Year must be full 4 digits, now it is '$ShotAtYear'"); } $shot_at = addslashes("$ShotAtYear-$ShotAtMonth-$ShotAtDay"); } include "config.inc"; include "php-dbi.inc"; include "connect.inc"; $Comment = addslashes($Comment); $Caption = addslashes($Caption); $Id = addslashes($Id); $sql = "UPDATE Images SET Caption='$Caption', Comment='$Comment', ShotAt='$shot_at' WHERE Id=$Id"; if(!dbi_query($sql)) { $error = dbi_error (); } else { // Image added, not let us add it to groups // First, remove all old groups references if(!dbi_query("DELETE FROM ImageGroups WHERE ImageId=$Id")) { $error = dbi_error (); } else { // add new groups references $i=0; while($i < count($Groups)) { $sql="INSERT INTO ImageGroups (ImageId, GroupId) VALUES ($Id, $Groups[$i])"; if(!dbi_query($sql)) { $error = dbi_error (); break; } $i++; } do_redirect("image_detail.php?Id=$Id"); } } ?> <HTML> <HEAD> <TITLE>Error</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Error</H1> <BLOCKQUOTE class="error"> <?php echo $error; echo "</BLOCKQUOTE>"; show_footer($INVALID_GID, null); ?> --- NEW FILE: group.jpg --- ÿØÿà Software::GNOME Icon Editor CREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 75, Smoothing = 0 ÿÛ $.' ",#(7),01444'9=82<.342ÿÛ ÿÄ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿÄ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÚ èh¢ÏJðGÄ«1ÜqüËíõÖxóQóÂðêtÊïÂEõsÈü+ÂkE5»øìþÌaSMKD¸ë¡£âMPÉog¤¡>]j$÷} ËÎÒ³bÌrIÉ4EÿÙ --- NEW FILE: groups.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; ?> <HTML> <HEAD> <TITLE>Images by group</TITLE> <LINK rel="alternative" TYPE="application/rss+xml" TITLE="RSS" HREF="rss.php"/> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1 CLASS="title"> Images by group </H1> <TABLE BORDER="1"> <TR> <TH CLASS="tableheader">Group Name</TH> <TH CLASS="tableheader"># of images</TH> <?php if(isAdmin()) { echo "<TH CLASS=\"tableheader\">Edit</TH>"; echo "<TH CLASS=\"tableheader\">Delete</TH>"; } ?> </TR> <?php $sql = "SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId GROUP BY Groups.Id ORDER BY Groups.Id"; $res = dbi_query ( $sql ); $total = 0; if ( $res ) { while ( $row = dbi_fetch_row ( $res ) ) { echo "<TR>"; echo "<TD CLASS=\"tablecell\">"; echo "<A HREF=\"show_group.php?Id=$row[0]\">"; if(strlen($row[1])) { $row[1]=stripslashes($row[1]); } else { $row[1]="UNKNOWN"; } echo $row[1]; echo "</A>"; echo "</TD>"; echo "<TD CLASS=\"tablecell\">"; echo "$row[2]"; echo "</TD>"; if(isAdmin()) { echo "<TD CLASS=\"tablecell\"><A HREF=\"edit_group.php?Id=$row[0]\">[Edit]</A></TD>"; $del_url="confirm.php?OKURL=" . rawurlencode("delete_group_handler.php?Id=$row[0]") . "&CANCELURL=" . rawurlencode("show_group.php?Id=-1") . "&Question=" . rawurlencode("Are you sure you want to delete group '$row[1]'"); echo "<TD CLASS=\"tablecell\"><A HREF=\"$del_url\">[Delete]</A></TD>"; } echo "</TR>\n"; $total+=$row[2]; } echo "<TR><TD CLASS=\"tablecell\"><I>Total</I></TD><TD CLASS=\"tablecell\"><I>$total</I></TD></TR>"; dbi_free_result ( $res ); } echo "</TABLE>"; show_footer($INVALID_GID, null); ?> --- NEW FILE: image.php --- <?php php_track_vars?> <?php $Id=addslashes(substr($PATH_INFO,1)); include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; $headers = getallheaders(); $since = $headers["If-Modified-Since"]; if(isset($since)) { $sincets=HTTP11DateParser(trim($since)); } else { $sincets=-1; } if($sincets==-1) { $sql = "SELECT Format, Image, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images WHERE Id=$Id"; } else { $sql = "SELECT Format, Image, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images WHERE Id=$Id AND UNIX_TIMESTAMP(PublishedAt)>$sincets"; } $found = false; $res = dbi_query ( $sql ); if($res) { if( $row = dbi_fetch_row ( $res ) ) { Header("Content-type: $row[0]"); Header("Last-Modified: " . timet2httpdate($row[2])); Header("Content-Length: $row[3]"); $found = true; echo $row[1]; } dbi_free_result ( $res ); } if(!$found && $sincets!=-1) { header("HTTP/1.1 304 Not Modified"); } ?> --- NEW FILE: image_detail.php --- <?php php_track_vars?> <HTML> <HEAD> <TITLE>Image Detail</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <?php if(!isset($Id)) { die("Need 'Id' parameter"); } else { $Id=addslashes($Id); } include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; $found=false; if($res=dbi_query("SELECT Caption, Width, Height, Bytes, ShotAt, Comment, Views FROM Images WHERE Id=$Id")) { if($row = dbi_fetch_row($res)) { $found=true; $caption=stripslashes($row[0]); echo "<H1 CLASS=\"title\">" . $caption . "</H1>\n"; echo "<IMG SRC=image.php/$Id>"; echo "<hr>\n"; echo "<TABLE BORDER=\"1\">"; echo "<TR><TD CLASS=\"tablecell\">Size</TD><TD CLASS=\"tablecell\">$row[1] x $row[2]</TD></TR>"; echo "<TR><TD CLASS=\"tablecell\">Bytes</TD><TD CLASS=\"tablecell\">$row[3]</TD></TR>"; if(strlen($row[4])) { if($row[4]=="0000-00-00") { $row[4]="Unknown"; } echo "<TR><TD CLASS=\"tablecell\">Date</TD><TD CLASS=\"tablecell\">$row[4]</TD></TR>"; } $comment = stripslashes($row[5]); if(isAdmin()) { echo "<TR><TD CLASS=\"tablecell\">Times Viewed</TD><TD CLASS=\"tablecell\">$row[6]</TD></TR>"; } dbi_free_result ( $res ); if($res = dbi_query("SELECT ImageGroups.GroupId, Groups.Name FROM ImageGroups,Groups WHERE ImageGroups.ImageId=$Id AND ImageGroups.GroupId=Groups.Id;")) { echo "<TR><TD CLASS=\"tablecell\">Groups:</TD><TD CLASS=\"tablecell\">"; $ng=0; while ( $row = dbi_fetch_row ( $res ) ) { if($ng!=0) echo ", "; echo "<A HREF=\"show_group.php?Id=$row[0]\">". stripslashes($row[1]) . "</A>"; $ng++; } echo "</TD></TR>"; dbi_free_result ( $res ); } echo "</TABLE>"; if(strlen($comment)) { echo "<br><TABLE><TR><TD class=\"description\"><pre>$comment</pre></TD></TR></TABLE>"; } if(isAdmin()) { echo "<p CLASS=navigation>Image: "; echo "<A HREF=\"edit_image.php?Id=$Id\">[Edit]</A>, "; $del_url="confirm.php?OKURL=" . rawurlencode("delete_image_handler.php?Id=$Id") . "&CANCELURL=" . rawurlencode("image_detail.php?Id=$Id") . "&Question=" . rawurlencode("Are you sure you want to delete image '$caption'"); echo "<A HREF=\"$del_url\">[Delete]</A>"; echo "</p>"; } } if(!isAdmin() && $found) { dbi_query ("UPDATE Images SET Views=Views+1 WHERE Id=$Id"); } } if(!$found) { echo "<p class=error>Image Not Found</p>\n"; } show_footer($INVALID_GID, null); ?> --- NEW FILE: login.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; ?> <HTML> <HEAD> <TITLE>Admin Login</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Admin login</H1> <FORM METHOD="POST" ACTION="login_handler.php"> <table> <tr> <td>Password:</td> <td><INPUT TYPE="password" NAME="Password" SIZE=32></td> </tr> </table> <INPUT TYPE="submit" VALUE="Login"> </FORM> <?php show_footer($INVALID_GID, null); ?> --- NEW FILE: login_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if($Password != $admin_password) { do_redirect("login.php"); } else if ($Password == $admin_password) { setcookie("photoarchive_admin", md5($GLOBALS["admin_password"]), time()+3600*12); //Expire in 12 hours } ?> <SCRIPT LANGUAGE="JavaScript"> document.cookie = 'Authenticated=1'; location.href="groups.php"; </SCRIPT> --- NEW FILE: logout_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; setcookie("photoarchive_admin"); do_redirect("show_group.php?Id=-1"); ?> --- NEW FILE: misc.inc --- <?php // $Id: misc.inc,v 1.1 2006/03/01 05:56:40 lord Exp $ // send a redirect to the specified page function do_redirect ( $url ) { Header ( "Location: $url" ); echo "<HTML><HEAD>"; include "styles.inc"; echo "<TITLE>Redirect</TITLE></HEAD><BODY CLASS=body>" . "Please go <A HREF=\"" . $url . "\">here</A>.</BODY></HTML>.\n"; exit; } function isAdmin () { return ($GLOBALS["HTTP_COOKIE_VARS"]["photoarchive_admin"] == md5($GLOBALS["admin_password"])); } function gen_max_file_size_field() { $m = $GLOBALS["max_file_size"]; return "<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$m\">"; } function start_group_page($gname, $gcomment) { echo "<HTML><HEAD>\n"; echo "<TITLE>$gname</TITLE>\n"; include "styles.inc"; echo "</HEAD>\n"; echo "<BODY CLASS=body>\n"; echo "<H1 CLASS=\"title\">$gname</H1>\n"; if(strlen($gcomment)) { echo "<br><TABLE><TR><TD class=\"description\"><pre>$gcomment</pre></TD></TR></TABLE>\n"; } echo "<BR><TABLE CLASS=\"imagegrid\" BORDER=\"1\">\n"; } function end_group_page($off) { echo "</TABLE>\n"; } // Shows sequence of images // 'sql' must produce following data: // Images.Id, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views function list_images($sql, $maxn, $MyId, $n) { $t = 0; if($res = dbi_query($sql)) { while($row=dbi_fetch_row($res)) { if($n==0) { echo "<TR>"; } echo "<TD CLASS=\"imagebox\"><TABLE width=\"100%\">"; echo "<TR><TD align=\"center\">"; echo "<A HREF=\"image_detail.php?Id=$row[0]\">"; echo "<IMG SRC=\"thumbnail.php/$row[0]\"></A>"; echo "</TD></TR>"; echo "<TR><TD>"; echo "<B>Title: </B>"; if(strlen($row[1])) { echo stripslashes($row[1]); } else { echo "UNKNOWN"; } echo "</TD></TR>"; echo "<TR><TD>"; echo "<B>Pixels: </B>$row[2] x $row[3]"; echo "</TD></TR>"; echo "<TR><TD>"; echo "<B>Bytes: </B>$row[4]"; echo "</TD></TR>"; if(isAdmin()) { echo "<TR><TD>"; echo "<B>Views: </B>$row[5]"; echo "</TD></TR>"; echo "<TR><TD>"; echo "<p CLASS=navigation>Operations: "; echo "<A HREF=\"edit_image.php?Id=$row[0]\">[Edit]</A>"; $del_url="confirm.php?OKURL=" . rawurlencode("delete_image_handler.php?Id=$row[0]") . "&CANCELURL=" . rawurlencode("show_group.php?Id=$MyId") . "&Question=" . rawurlencode("Are you sure you want to delete image '$caption'"); echo ", <A HREF=\"$del_url\">[Delete]</A>"; echo ", <A HREF=\"image_detail.php?Id=$row[0]\">[Show]</A>"; echo "</TD></TR>"; } echo "</TABLE></TD>\n"; $n++; if($n==$GLOBALS["thumbnails_per_row"]) { echo "</tr>"; $n=0; } $t++; if($t==$maxn && $maxn!=-1) { break; } } dbi_free_result ( $res ); } return $n; } // Shows sequence of images // 'sql' must produce following data: // Groups.Id, Groups.Name, Groups.Counter function list_groups($sql, $MyId, $parentg, $n) { if($parentg!=$MyId) { if($n==0) echo "<tr>\n"; echo "<TD CLASS=\"groupbox\"><TABLE width=\"100%\">"; echo "<TR><TD align=\"center\">"; echo "<A HREF=\"show_group.php?Id=$parentg\">"; echo "<IMG SRC=\"group.jpg\"></A>"; echo "</TD></TR>"; echo "<TR><TD>"; echo "<B>Parent</B>"; echo "</TD></TR></TABLE></TD>"; $n++; } if($res = dbi_query($sql)) { while($row=dbi_fetch_row($res)) { if($n==0) { echo "<TR>\n"; } echo "<TD CLASS=\"groupbox\"><TABLE width=\"100%\">"; echo "<TR><TD align=\"center\">"; echo "<A HREF=\"show_group.php?Id=$row[0]\">"; echo "<IMG SRC=\"group.jpg\"></A>"; echo "</TD></TR>"; echo "<TR><TD>"; echo "<B>Name: </B>"; if(strlen($row[1])) { echo stripslashes($row[1]); } else { echo "UNKNOWN"; } echo "</TD></TR>"; echo "<TR><TD>"; echo "<B>Images: </B>$row[2]"; echo "</TD></TR>"; if(isAdmin()) { echo "<TR><TD>"; echo "<p CLASS=navigation>Operations: "; echo "<A HREF=\"edit_group.php?Id=$row[0]\">[Edit]</A>"; $del_url="confirm.php?OKURL=" . rawurlencode("delete_group_handler.php?Id=$row[0]") . "&CANCELURL=" . rawurlencode("show_group.php?Id=$MyId") . "&Question=" . rawurlencode("Are you sure you want to delete group '$row[1]'"); echo ", <A HREF=\"$del_url\">[Delete]</A>"; echo ", <A HREF=\"show_group.php?Id=$row[0]\">[Show]</A>"; echo "</TD></TR>"; } echo "</TABLE></TD>\n"; $n++; if($n==$GLOBALS["thumbnails_per_row"]) { echo "</tr>\n"; $n=0; } } dbi_free_result ( $res ); } return $n; } function keyword2LIKEpattern($Keyword) { return "%". str_replace("_", "\\_", str_replace("%", "\\%", $Keyword)) . "%"; } // Returns date formatted according to RFC 2616. // e.g. Tue, 01 Aug 2000 18:08:06 GMT function timet2httpdate($t) { setlocale(LC_TIME, "C"); return gmstrftime("%a, %d %b %Y %H:%M:%S GMT", $t); } // Return number of month (1-12) // from it's abbreviation like 'Apr'. function abbr_month($a) { $m = array ( "Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12 ); return $m[$a]; } // This function parses date as it // defined in rfc 2616 // 3 basic formats are understood: // // Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format // // Returns value as unix timestamp or -1 is parsing failed. // function HTTP11DateParser($s) { if(preg_match("/^[A-Z][a-z][a-z]\, (\d\d) ([A-Z][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$/", $s, $p)) { $m=abbr_month($p[2]); if(!isset($m)) return -1; return gmmktime($p[4], $p[5], $p[6], $m, $p[1], $p[3]); } else if(preg_match("/^[A-Z][a-z]+\, (\d\d)-([A-Z][a-z][a-z])-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/", $s, $p)) { $m=abbr_month($p[2]); if(!isset($m)) return -1; return gmmktime($p[4], $p[5], $p[6], $m, $p[1], $p[3]); } else if(preg_match("/^[A-Z][a-z][a-z] ([A-Z][a-z][a-z]) \s?(\d+) (\d\d):(\d\d):(\d\d) (\d\d\d\d)$/", $s, $p)) { $m=abbr_month($p[1]); if(!isset($m)) return -1; return gmmktime($p[3], $p[4], $p[5], $m, $p[2], $p[6]); } else { return -1; } } // -- Constants -- $TOP_GID = -1; $INVALID_GID = -2; // -- Footer -- function show_footer ($Id, $gname) { echo "<HR>"; echo "<p CLASS=navigation>"; echo "Goto: <a href=\"show_group.php?Id=-1\">[Top Group]</a>"; if(isAdmin()) { echo ", <A HREF=\"top10.php\">[Most Popular]</A>"; echo ", <A HREF=\"stats.php\">[Statistics]</A>"; } echo "<p CLASS=navigation>"; echo "Operations: "; echo "<A HREF=\"search.php\">[Global Search]</A>"; if(isAdmin()) { if($Id!=$GLOBALS["INVALID_GID"]) { // In any valid group (including top you can do this): echo ", <A HREF=\"upload_image.php\">[Upload Image To Current Group]</A>"; echo ", <A HREF=\"edit_group.php\">[New Child Group]</A>"; if($Id!=$GLOBALS["TOP_GID"]) { // In any valid group (excluding top you can do this): echo ", <A HREF=\"edit_group.php?Id=$Id\">[Edit Current Group]</A>"; $del_url="confirm.php?OKURL=" . rawurlencode("delete_group_handler.php?Id=$Id") . "&CANCELURL=" . rawurlencode("show_group.php?Id=$Id") . "&Question=" . rawurlencode("Are you sure you want to delete group '$gname'"); echo ", <A HREF=\"$del_url\">[Delete Current Group]</A>"; } } echo ", <A HREF=\"logout_handler.php\">[Logout]</A>"; } else { echo ", <A HREF=\"login.php\">[Login]</A>"; } echo ", <A HREF=\"rss.php\"><IMG SRC=\"rss.php\"></A>"; echo "</p>"; echo "<p class=copyright>Generated By: <a href=\"$PROGRAM_URL\">$PROGRAM_NAME</a> © Copyright 2000, Vadim Zaliva <lo...@cr...></p>"; echo "</BODY>"; echo "</HTML>"; } ?> --- NEW FILE: php-dbi.inc --- <?php // php-dbi.inc // // (C) Craig Knudsen, ckn...@ra..., http://www.radix.net/~cknudsen/ // License: GNU GPL (see www.gnu.org) // // The functions defined in this file are meant to provide a single // API to the different PHP database APIs. Unfortunately, this is // necessary since PHP does not yet have a common db API. // The value of $GLOBALS["db_type"] should be defined somewhere // to one of the following: // mysql // oracle (This uses the Oracle8 OCI API, so Oracle 8 libs are required) // postgresl // odbc // Limitations: // This assumes a single connection to a single database // for the sake of simplicity. Do not make a new query until you // are completely finished with the previous one. // Rather than use the associative arrays returned with // xxx_fetch_array(), normal arrays are used with xxx_fetch_row(). // (Some db APIs don't support xxx_fetch_array().) // // History: // 22-Apr-2000 Ken Harris <kh...@lh...> // PostgreSQL fixes // 23-Feb-2000 Craig Knudsen <ckn...@ra...> // Initial release // // Limitations: // Fetched rows are returned in non-associative arrays. // Open up a database connection // Always do a pooled connection if the db supports it // For ODBC, $host is ignored, $database = DSN // For Oracle, $database = tnsnames name function dbi_connect ( $host, $login, $password, $database ) { if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { $c = mysql_pconnect ( $host, $login, $password ); if ( $c ) { if ( ! mysql_select_db ( $database ) ) return false; return $c; } else { return false; } } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) { if ( strlen ( $host ) && strcmp ( $host, "localhost" ) ) $c = OCIPLogon ( "$login@$host", $password, $database ); else $c = OCIPLogon ( $login, $password, $database ); $GLOBALS["oracle_connection"] = $c; return $c; } else if ( strcmp ( $GLOBALS["db_type"], "postgresql" ) == 0 ) { $c = pg_connect ( "host=$host dbname=$database user=$login" ); $GLOBALS["postgresql_connection"] = $c; if ( ! $c ) { die("Error connecting to database"); exit; } return $c; } else if ( strcmp ( $GLOBALS["db_type"], "odbc" ) == 0 ) { $c = odbc_pconnect ( $database, $login, $password ); $GLOBALS["odbc_connection"] = $c; return $c; } else { dbi_fatal_error ( "dbi_connect(): db_type not defined." ); } } // Close a database connection // Not necessary for any database that uses pooled connections // such as MySQL function dbi_close ( $conn ) { if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { return mysql_close ( $conn ); } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) { return OCILogOff ( $conn ); } else if ( strcmp ( $GLOBALS["db_type"], "postgresql" ) == 0 ) { return pg_close ( $GLOBALS["postgresql_connection"] ); } else if ( strcmp ( $GLOBALS["db_type"], "odbc" ) == 0 ) { return odbc_close ( $GLOBALS["odbc_connection"] ); } else { dbi_fatal_error ( "dbi_close(): db_type not defined." ); } } // Select the database that all queries should use //function dbi_select_db ( $database ) { // if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { // return mysql_select_db ( $database ); // } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) { // // Not supported. Must sent up a tnsname and user that uses // // the correct tablesapce. // return true; // } else { // dbi_fatal_error ( "dbi_select_db(): db_type not defined." ); // } //} // Execute an SQL query function dbi_query ( $sql ) { if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { return mysql_query ( $sql ); } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) { $GLOBALS["oracle_statement"] = OCIParse ( $GLOBALS["oracle_connection"], $sql ); return OCIExecute ( $GLOBALS["oracle_statement"], OCI_COMMIT_ON_SUCCESS ); } else if ( strcmp ( $GLOBALS["db_type"], "postgresql" ) == 0 ) { $GLOBALS["postgresql_row"] = 0; $GLOBALS["postgresql_row"] = 0; $res = pg_exec ( $GLOBALS["postgresql_connection"], $sql ); if ( ! $res ) { die("Error executing SQL"); exit; } $GLOBALS["postgresql_numrows"] = pg_numrows ( $res ); return $res; } else if ( strcmp ( $GLOBALS["db_type"], "odbc" ) == 0 ) { $GLOBALS["odbc_row"] = 0; return odbc_exec ( $GLOBALS["odbc_connection"], $sql ); } else { dbi_fatal_error ( "dbi_query(): db_type not defined." ); } } // Determine the number of rows from a result //function dbi_num_rows ( $res ) { // if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { // return mysql_num_rows ( $res ); // } else { // dbi_fatal_error ( "dbi_num_rows(): db_type not defined." ); // } //} // Retrieve a single row from the database and return it // as an array. // Note: we don't use the more useful xxx_fetch_array because not all // databases support this function. function dbi_fetch_row ( $res ) { if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { return mysql_fetch_array ( $res ); } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) { if ( OCIFetchInto ( $GLOBALS["oracle_statement"], &$row, OCI_NUM + OCI_RETURN_NULLS ) ) return $row; return 0; } else if ( strcmp ( $GLOBALS["db_type"], "postgresql" ) == 0 ) { if ( $GLOBALS["postgresql_numrows"] > $GLOBALS["postgresql_row"] ) { $r = pg_fetch_array ( $res, $GLOBALS["postgresql_row"]++ ); if ( ! $r ) { die("Unable to fetch row"); return ''; } } else { $r = ''; } return $r; } else if ( strcmp ( $GLOBALS["db_type"], "odbc" ) == 0 ) { $num_fields = odbc_num_fields ( $res ); if ( ! odbc_fetch_into ( $res, $GLOBALS["odbc_row"]++, &$ret ) ) return false; return $ret; } else { dbi_fatal_error ( "dbi_fetch_row(): db_type not defined." ); } } // Free a result set. // This isn't really necessary for PHP4 since this is done automatically, // but it's a good habit for PHP3. function dbi_free_result ( $res ) { if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { return mysql_free_result ( $res ); } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) { // Not supported. Ingore. if ( $GLOBALS["oracle_statement"] >= 0 ) { OCIFreeStatement ( $GLOBALS["oracle_statement"] ); $GLOBALS["oracle_statement"] = -1; } } else if ( strcmp ( $GLOBALS["db_type"], "postgresql" ) == 0 ) { return pg_freeresult ( $res ); } else if ( strcmp ( $GLOBALS["db_type"], "odbc" ) == 0 ) { return odbc_free_result ( $res ); } else { dbi_fatal_error ( "dbi_free_result(): db_type not defined." ); } } // Get the latest db error message. function dbi_error () { if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) { $ret = mysql_error (); } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) { $ret = OCIError ( $GLOBALS["oracle_connection"] ); } else if ( strcmp ( $GLOBALS["db_type"], "postgresql" ) == 0 ) { $ret = pg_errormessage ( $GLOBALS["postgresql_connection"] ); } else if ( strcmp ( $GLOBALS["db_type"], "odbc" ) == 0 ) { // no way to get error from ODBC API $ret = "Unknown ODBC error"; } else { $ret = "dbi_error(): db_type not defined."; } if ( strlen ( $ret ) ) return $ret; else return "Unknown error"; } // display an error message and exit function dbi_fatal_error ( $msg ) { die("<H2>Error</H2>$msg"); exit; } ?> --- NEW FILE: rss.php --- <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; $headers = getallheaders(); if(isset($headers["If-None-Match"])) { $since = trim($headers["If-None-Match"]); $sql = "select MAX(Id) FROM Images WHERE Id>".addslashes($since); } else { $since = NULL; $sql = "select MAX(Id) FROM Images"; } $res = dbi_query($sql); if($res) { if( $row = dbi_fetch_row( $res ) ) { if($row[0]) { Header("Etag: $row[0]"); } else { if($since) { Header("Etag: $since"); Header("HTTP/1.1 304 Not Modified"); return; } } } dbi_free_result ( $res ); } Header("Content-type: text/xml; charset=\"utf-8\""); print("<?xml version='1.0' encoding='utf-8'?>\r\n"); print("<rss version='2.0'>\r\n"); print("<channel>\r\n"); print("<title>$FEED_NAME</title>\r\n"); print("<link>$FEED_URL</link>\r\n"); print("<language>en</language>\r\n"); print("<description>$FEED_DESCR</description>"); if($since) { $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images WHERE Id>" . addslashes($since) . " ORDER BY Id DESC"; } else { $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images ORDER BY Id DESC LIMIT " . $RSS_MAX_RECORDS; } $result = dbi_query($sql); if($result) { while($row = dbi_fetch_row($result)) { print("<item>\r\n"); print("<title>" . htmlspecialchars($row[1]) . "</title>\r\n" ); print("<link>" . $FEED_URL . "image_detail.php?Id=" . $row[0] . "</link>\r\n"); print("<pubDate>" . htmlspecialchars(date("r", $row[2])) . "</pubDate>\r\n"); print("<description>" . htmlspecialchars("<img src=\"" . $FEED_URL . "thumbnail.php/" . $row[0] . "\">") . "</description>\r\n"); /*print("<author>" . htmlspecialchars("") . "</author>\r\n"); */ print("<enclosure url=\"" . $FEED_URL . "image.php/" . $row[0] . "\" length=\"" . $row[3] . "\" type=\"image/jpeg\"/>\r\n" ); print("</item>\r\n\r\n"); } dbi_free_result($result); } ?> </channel> </rss> --- NEW FILE: search.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; ?> <HTML> <HEAD> <TITLE>Search Images</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Search Images</H1> <FORM METHOD="POST" ACTION="search_handler.php"> <TABLE> <TR> <TD class=fieldname>Keyword</TD> <TD><INPUT TYPE="text" NAME="Keyword" size=80></TD> </TR> <TR> <TD class=fieldname>Where</TD> <TD> <TABLE> <TR> <TD><INPUT TYPE="RADIO" CHECKED NAME="Scope" VALUE="title"></TD> <TD>Image Title Only</TD> </TR> <TR> <TD><INPUT TYPE="RADIO" NAME="Scope" VALUE="description"></TD> <TD>Image Description Only</TD> </TR> <TR> <TD><INPUT TYPE="RADIO" NAME="Scope" VALUE="both"></TD> <TD>Image Title and Description</TD> </TR> </TABLE> </TD> </TR> <TR> <TD class=fieldname>Max matches shown</TD> <?php echo "<TD><INPUT TYPE=\"text\" NAME=\"MaxMatches\" size=3 value=$max_search_results></TD>\n"; ?> </TR> </TABLE> <INPUT TYPE="submit" VALUE="Submit"> </FORM> <?php show_footer($INVALID_GID, null); ?> --- NEW FILE: search_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if(!isset($Keyword) || $Keyword=='') { die("Need keywords"); } if(!isset($Scope) || $Scope=='') { die("Need 'Scope' parameter"); } if(!isset($MaxMatches) || $MaxMatches > $GLOBALS["max_search_results"] || $MaxMatches < 1) { $MaxMatches=$GLOBALS["max_search_results"]; } ?> <?php start_group_page("Search results", "Results of search for: <b><pre>$Keyword</pre></b>"); $sql = "select Id, Caption, Width, Height, Bytes, Views from Images WHERE "; $pattern=keyword2LIKEpattern($Keyword); if($Scope=="description") { $sql=$sql . "Comment LIKE '$pattern'"; } else if($Scope=="both") { $sql=$sql . "Comment LIKE '$pattern' OR Caption LIKE '$pattern'"; } else { $sql=$sql . "Caption LIKE '$pattern'"; } $sql = $sql . " ORDER BY Images.ShotAt"; list_images($sql, $MaxMatches, -1); show_footer($INVALID_GID, null); ?> --- NEW FILE: show_group.php --- <?php php_track_vars?> <?php if(!isset($Id)) { $Id=-1; } else { $Id = addslashes($Id); } include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; ?> <?php if($Id!=-1) { $gname = "Unnamed group"; $parentg = -1; if($res = dbi_query("SELECT Name, Comment, ParentGroupId FROM Groups WHERE Id=$Id")) { if($row = dbi_fetch_row ( $res )) { $gname = stripslashes($row[0]); $gcomment = stripslashes($row[1]); if($row[2]==null || $row[2]=="") { $parentg = -1; } else { $parentg = stripslashes($row[2]); } } dbi_free_result ( $res ); } } else { $gname = "Top group"; $parentg = -1; } start_group_page($gname, $gcomment); if($Id!=-1) { $sql = "SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId WHERE Groups.ParentGroupId=$Id GROUP BY Groups.Id, Groups.Name"; } else { $sql = "SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId WHERE ParentGroupId IS NULL GROUP BY Groups.Id ORDER BY Groups.Id"; } $off = list_groups($sql, $Id, $parentg, 0); if($Id!=-1) { $sql = "select Images.Id, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views from Images, ImageGroups WHERE ImageGroups.GroupId=$Id AND Images.Id=ImageGroups.ImageId ORDER BY Images.ShotAt"; $off = list_images($sql, -1, $Id, $off); } end_group_page($off); show_footer($Id, null); ?> --- NEW FILE: stats.php --- <?php php_track_vars?> <HTML> <HEAD> <TITLE>Photo Album Statistics</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1 class="title">Photo Album Statistics</H1> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if($res=dbi_query("SELECT COUNT(Images.Id), SUM(Bytes), SUM(Views) FROM Images")) { if($row = dbi_fetch_row($res)) { echo "<TABLE BORDER=\"1\">"; echo "<TR><TD CLASS=\"tablecell\">Images</TD><TD CLASS=\"tablecell\">$row[0]</TD></TR>"; $mb=(integer)($row[1]/(1024*1024)); echo "<TR><TD CLASS=\"tablecell\">Mbytes</TD><TD CLASS=\"tablecell\">$mb</TD></TR>"; echo "<TR><TD CLASS=\"tablecell\">Views</TD><TD CLASS=\"tablecell\">$row[2]</TD></TR>"; dbi_free_result ( $res ); echo "</TABLE>"; } else { echo "<p class=error>Error getting statistics</p>\n"; } } else { echo "<p class=error>Error getting statistics</p>\n"; } show_footer($INVALID_GID, null); ?> --- NEW FILE: styles.inc --- <STYLE type="text/css"> <!-- .body { color: #000000; background-color: #AAAAAA; text-decoration: none; } .tablecell { color: #000000; text-decoration: bold; background-color: #FFFFFF; } .tableheader { color: #FFFFFF; background-color: #000000; } .imagebox { color: #000000; text-decoration: none; background-color: #E7E7E7; } .groupbox { color: #000000; text-decoration: none; background-color: #CCCCCC; } .imagegrid { color: #000000; text-decoration: none; background-color: #E7E7E7; } .navigation { color: #6666CC; font-weight:bold; } .copyright { color: #000000; font-weight: italic; font-size: xx-small; } .error { color: #FF0000; font-weight: bold; font-size: x-large; } .fieldname { color: #000000; font-weight: bold; } .description { color: #000000; background-color: #EEEE00; font-weight: italic; } .title { color: #AA0000; font-weight: italic; } --> </STYLE> --- NEW FILE: thumbnail.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; $Id=addslashes(substr($PATH_INFO,1)); $headers = getallheaders(); $since = $headers["If-Modified-Since"]; if(isset($since)) { $sincets=HTTP11DateParser(trim($since)); } else { $sincets=-1; } if($sincets==-1) { $sql = "SELECT Thumbnail, UNIX_TIMESTAMP(PublishedAt) FROM Images WHERE Id=$Id"; } else { $sql = "SELECT Thumbnail, UNIX_TIMESTAMP(PublishedAt) FROM Images WHERE Id=$Id AND UNIX_TIMESTAMP(PublishedAt)>$sincets"; } $found = false; $res = dbi_query ( $sql ); if ( $res ) { if( $row = dbi_fetch_row ( $res ) ) { Header("Last-Modified: " . timet2httpdate($row[1])); Header("Content-type: image/jpeg"); $found = true; echo $row[0]; } dbi_free_result ( $res ); } if(!$found && $sincets!=-1) { header("HTTP/1.1 304 Not Modified"); } ?> --- NEW FILE: top10.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } start_group_page("Top $top_number images", "The $top_number most-viewed images"); if($GLOBALS["db_type"] == "mysql") { // LIMIT is MySQL specific. $sql = "select Images.Id, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views FROM Images WHERE Images.Views > 0 ORDER BY Images.Views DESC LIMIT $top_number"; } else { $sql = "select Images.Id, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views FROM Images WHERE Images.Views > 0 ORDER BY Images.Views DESC"; } list_images($sql, $top_number, $Id, -1); show_footer($INVALID_GID, null); ?> --- NEW FILE: upload_image.php --- <?php php_track_vars?> <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } ?> <HTML> <HEAD> <TITLE>Upload Image</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Upload Image</H1> <FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="upload_image_handler.php"> <TABLE> <?php gen_max_file_size_field() ?> <TR> <TD class=fieldname>Title</TD> <TD><INPUT TYPE="text" NAME="Caption" size=80"></TD> </TR> <TR> <TD class=fieldname>Date<br><i>dd.mm.yyyy (optional)</i></TD> <TD> <INPUT TYPE="text" NAME="ShotAtDay" size=2> <INPUT TYPE="text" NAME="ShotAtMonth" size=2> <INPUT TYPE="text" NAME="ShotAtYear" size=4> </TD> </TR> <TR> <TD class=fieldname>Comment</TD> <TD><TEXTAREA NAME="Comment" cols=80 rows=10"></TEXTAREA></TD> </TR> <TR> <TD class=fieldname>Groups</TD> <TD><SELECT NAME="Groups[]" size=15 MULTIPLE> <?php $res = dbi_query ("SELECT Id, Name FROM Groups"); if($res) { while($row = dbi_fetch_row($res)) { $row[1]=stripslashes($row[1]); echo "<OPTION value=\"$row[0]\">$row[1]\n"; } dbi_free_result ( $res ); } ?> </SELECT></TD> </TR> <TR> <TD class=fieldname>File</i></TD> <TD><INPUT TYPE="FILE" NAME="File""></TD> </TR> </TABLE> <INPUT TYPE="submit" VALUE="Submit"> </FORM> <?php show_footer($INVALID_GID, null); ?> --- NEW FILE: upload_image_handler.php --- <?php php_track_vars?> <?php include "config.inc"; include "misc.inc"; if(!isAdmin()) { die("Must be admin!"); } if(!isset($Caption) || !isset($Comment) || !isset($Groups ) || !isset($File) ) { die("Need 'You must fill all fields' parameters"); } if(!isset($ShotAtDay ) || !isset($ShotAtMonth ) || !isset($ShotAtYear ) || $ShotAtDay == '' || $ShotAtMonth == '' || $ShotAtYear == '') { // Date not set - null $shot_at = "NULL"; } else { if($ShotAtYear<1900) { die("Year must be full 4 digits"); } $shot_at = addslashes("$ShotAtYear-$ShotAtMonth-$ShotAtDay"); } include "config.inc"; include "php-dbi.inc"; include "connect.inc"; $res=dbi_query("SELECT MAX(Id)+1 FROM Images"); if($res) { if($row = dbi_fetch_row( $res )) { if($row[0] != null) { $newid = $row[0]; } else { $newid = 0; } } else { // no records yet $newid = 0; } dbi_free_result ( $res ); // get contents of a file into a string $fd = fopen( $File, "r"); $data = addslashes(fread($fd, filesize($File))); fclose($fd); $size=getimagesize($File); $Comment = addslashes($Comment); $Caption = addslashes($Caption); //produce thumbnail if($File_type=="image/jpeg" || $File_type=="image/pjpeg") { system("$djpeg -pnm $File | $pnmscale -xscale 0.1 -yscale 0.1 | $ppmtojpeg > $File.tmb"); $fd = fopen( "$File.tmb", "r"); $tmb = addslashes(fread($fd, filesize("$File.tmb"))); fclose($fd); unlink($File.tmb); } if($File_type=="image/gif") { system("$giftopnm $File | $pnmscale -xscale 0.1 -yscale 0.1 | $ppmtojpeg > $File.tmb"); $fd = fopen( "$File.tmb", "r"); $tmb = addslashes(fread($fd, filesize("$File.tmb"))); fclose($fd); unlink($File.tmb); } if($File_type=="image/x-png") { system("$pngtopnm $File | $pnmscale -xscale 0.1 -yscale 0.1 | $ppmtojpeg > $File.tmb"); $fd = fopen( "$File.tmb", "r"); $tmb = addslashes(fread($fd, filesize("$File.tmb"))); fclose($fd); unlink($File.tmb); } $sql = "INSERT INTO Images (Id, Views, Bytes, Format, Caption, Comment, ShotAt, PublishedAt, Width, Height, Image, Thumbnail) VALUES ($newid, 0, $File_size, '$File_type', '$Caption', '$Comment', '$shot_at', NOW(), $size[0], $size[1], '$data', '$tmb')"; if(!dbi_query($sql)) { $error = dbi_error (); } else { // Image added, not let us add it to groups $i=0; while($i < count($Groups)) { $g = addslashes($Groups[$i]); $sql="INSERT INTO ImageGroups (ImageId, GroupId) VALUES ($newid, $g)"; if(!dbi_query($sql)) { $error = dbi_error (); break; } $i++; } echo "<HTML><HEAD><TITLE>Upload successful</TITLE>"; include "styles.inc"; echo "</HEAD><BODY CLASS=body><H1 CLASS=title>Upload successful</H1>"; echo "<p>Your image was sucessfully uploaded to the archive."; echo "You can see it <a href=\"image_detail.php?Id=$newid\">here</a>."; show_footer($INVALID_GID, null); return; } } else { $error = dbi_error (); } ?> <HTML> <HEAD> <TITLE>Error</TITLE> <?php include "styles.inc"; ?> </HEAD> <BODY CLASS=body> <H1>Error</H1> <BLOCKQUOTE class="error"> <?php echo $error; echo "</BLOCKQUOTE>"; show_footer($INVALID_GID, null); ?> --- NEW FILE: xml.gif --- GIF89a$ NÞ2ÕM..2ôçNõ2 õþù2ÞeHEÂ*\Èpá |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:56:43
|
Update of /cvsroot/photoarchive/photoarchive/src/rebuild_icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14175/src/rebuild_icons Added Files: dbcfg.py rebuild_icons.py Log Message: major code reorg --- NEW FILE: dbcfg.py --- #!/usr/local/bin/python # # $Id: dbcfg.py,v 1.1 2006/03/01 05:56:40 lord Exp $ # # Read db settings # # @author Vadim Zaliva <lo...@cr...> # import sys import ConfigParser def read(filename, section): cfg=ConfigParser.ConfigParser() try: f=open(filename, 'r') except Exception: raise Exception(2, "Error opening config file '%s'" % (filename)) try: cfg.readfp(f,filename) finally: f.close() if not cfg.has_section(section): raise Exception(2, "Missing DB section in config") opts = ["host","user", "password", "database"] for o in opts: if not cfg.has_option(section, o): raise Exception(2, "Missing option '%s' in '%s' section in config" % (o, section)) return tuple([cfg.get(section, o) for o in opts]) --- NEW FILE: rebuild_icons.py --- #!/usr/local/bin/python # # $Id: rebuild_icons.py,v 1.1 2006/03/01 05:56:40 lord Exp $ # # Command line utility to rebuild missing icons. # in photoarchive. # # @author Vadim Zaliva <lo...@cr...> # import sys import os import MySQLdb import ConfigParser import getopt import array import dbcfg def update_thumbnail(db, img, id): print "Processing image %d" % (id) tmp_fname = os.tmpnam() ifile = open(tmp_fname, "w+") try: try: img.tofile(ifile) finally: ifile.close() tmb_tmp_fname = os.tmpnam() os.system("djpeg -pnm %s | pnmscale -xscale 0.1 -yscale 0.1 | ppmtojpeg > %s" % (tmp_fname, tmb_tmp_fname)) try: tfile = open(tmb_tmp_fname, "rb") try: tmb=array.array('c', tfile.read()) finally: tfile.close() c=db.cursor() try: c.execute("UPDATE Images SET Thumbnail=%s WHERE Id=%s", (tmb, id)) finally: c.close() finally: os.unlink(tmb_tmp_fname) finally: os.unlink(tmp_fname) def rebuild_icons(db): c=db.cursor() try: c.execute("SELECT Id, Image FROM Images WHERE length(Thumbnail) = 0") while True: r=c.fetchone() if r: update_thumbnail(db, r[1], r[0]); else: break finally: c.close() def usage(): sys.stderr.write("Usage: rebuild_images.py [-f cfgile] [-s cfgsection]\n") def main(): try: opts, args = getopt.getopt(sys.argv[1:], "f:s:", ["cfgfile=","cfgsection="]) except getopt.GetoptError: usage() sys.exit(2) cfgfile = "db.ini" cfgsection = "DB" for o, a in opts: if o in ("-f", "--cfgfile"): cfgfile = a if o in ("-s", "--cfgsection"): cfgsection = a if len(args) != 0: usage() sys.exit(2) try: (db_host,db_user,db_pass,db_name) = dbcfg.read(cfgfile, cfgsection) except Exception, (errno, strerror): print "Error reading config file: %s\n" % (strerror) sys.exit(errno) try: db=MySQLdb.connect(db_host,db_user,db_pass,db_name) except Exception, (errno, strerror): print "DB connnection error: %s" % (strerror) sys.exit(errno) try: try: rebuild_icons(db) except Exception: sys.exit(1) finally: db.close() sys.exit(0) if __name__ == "__main__": main() |
Update of /cvsroot/photoarchive/photoarchive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14175 Removed Files: COPYING ChangeLog INSTALL README TODO config.inc confirm.php connect.inc create.tables.mysql.sql createdb.sql db.ini dbcfg.py delete_group_handler.php delete_image_handler.php edit_group.php edit_group_handler.php edit_image.php edit_image_handler.php group.jpg groups.php image.php image_detail.php login.php login_handler.php logout_handler.php misc.inc php-dbi.inc rebuild_icons.py rss.php search.php search_handler.php show_group.php stats.php styles.inc thumbnail.php top10.php upload_image.php upload_image_handler.php xml.gif Log Message: major code reorg --- COPYING DELETED --- --- ChangeLog DELETED --- --- INSTALL DELETED --- --- README DELETED --- --- TODO DELETED --- --- config.inc DELETED --- --- confirm.php DELETED --- --- connect.inc DELETED --- --- create.tables.mysql.sql DELETED --- --- createdb.sql DELETED --- --- db.ini DELETED --- --- dbcfg.py DELETED --- --- delete_group_handler.php DELETED --- --- delete_image_handler.php DELETED --- --- edit_group.php DELETED --- --- edit_group_handler.php DELETED --- --- edit_image.php DELETED --- --- edit_image_handler.php DELETED --- --- group.jpg DELETED --- --- groups.php DELETED --- --- image.php DELETED --- --- image_detail.php DELETED --- --- login.php DELETED --- --- login_handler.php DELETED --- --- logout_handler.php DELETED --- --- misc.inc DELETED --- --- php-dbi.inc DELETED --- --- rebuild_icons.py DELETED --- --- rss.php DELETED --- --- search.php DELETED --- --- search_handler.php DELETED --- --- show_group.php DELETED --- --- stats.php DELETED --- --- styles.inc DELETED --- --- thumbnail.php DELETED --- --- top10.php DELETED --- --- upload_image.php DELETED --- --- upload_image_handler.php DELETED --- --- xml.gif DELETED --- |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:56:42
|
Update of /cvsroot/photoarchive/photoarchive/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14175/etc Added Files: db.ini Log Message: major code reorg --- NEW FILE: db.ini --- [DB] host = localhost user = X password = X database = PHOTO |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:54:48
|
Update of /cvsroot/photoarchive/photoarchive/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13282/doc Log Message: Directory /cvsroot/photoarchive/photoarchive/doc added to the repository |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:53:25
|
Update of /cvsroot/photoarchive/photoarchive/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12649/etc Log Message: Directory /cvsroot/photoarchive/photoarchive/etc added to the repository |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:52:45
|
Update of /cvsroot/photoarchive/photoarchive/src/rebuild_icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12189/rebuild_icons Log Message: Directory /cvsroot/photoarchive/photoarchive/src/rebuild_icons added to the repository |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:49:59
|
Update of /cvsroot/photoarchive/photoarchive/src/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10642/web Log Message: Directory /cvsroot/photoarchive/photoarchive/src/web added to the repository |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:49:43
|
Update of /cvsroot/photoarchive/photoarchive/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10547/src Log Message: Directory /cvsroot/photoarchive/photoarchive/src added to the repository |
|
From: Vadim Z. <lo...@us...> - 2006-03-01 05:48:26
|
Update of /cvsroot/photoarchive/photoarchive/sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9932/sql Log Message: Directory /cvsroot/photoarchive/photoarchive/sql added to the repository |
|
From: Vadim Z. <lo...@us...> - 2005-03-25 00:14:29
|
Update of /cvsroot/photoarchive/photoarchive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2292 Added Files: db.ini dbcfg.py rebuild_icons.py Log Message: python script to re-build missing icons --- NEW FILE: db.ini --- [DB] host = localhost user = X password = X database = PHOTO --- NEW FILE: dbcfg.py --- #!/usr/local/bin/python # # $Id: dbcfg.py,v 1.1 2005/03/25 00:14:18 lord Exp $ # # Read db settings # # @author Vadim Zaliva <lo...@cr...> # import sys import ConfigParser def read(filename, section): cfg=ConfigParser.ConfigParser() try: f=open(filename, 'r') except Exception: raise Exception(2, "Error opening config file '%s'" % (filename)) try: cfg.readfp(f,filename) finally: f.close() if not cfg.has_section(section): raise Exception(2, "Missing DB section in config") opts = ["host","user", "password", "database"] for o in opts: if not cfg.has_option(section, o): raise Exception(2, "Missing option '%s' in '%s' section in config" % (o, section)) return tuple([cfg.get(section, o) for o in opts]) --- NEW FILE: rebuild_icons.py --- #!/usr/local/bin/python # # $Id: rebuild_icons.py,v 1.1 2005/03/25 00:14:18 lord Exp $ # # Command line utility to rebuild missing icons. # in photoarchive. # # @author Vadim Zaliva <lo...@cr...> # import sys import os import MySQLdb import ConfigParser import getopt import array import dbcfg def update_thumbnail(db, img, id): print "Processing image %d" % (id) tmp_fname = os.tmpnam() ifile = open(tmp_fname, "w+") try: try: img.tofile(ifile) finally: ifile.close() tmb_tmp_fname = os.tmpnam() os.system("djpeg -pnm %s | pnmscale -xscale 0.1 -yscale 0.1 | ppmtojpeg > %s" % (tmp_fname, tmb_tmp_fname)) try: tfile = open(tmb_tmp_fname, "rb") try: tmb=array.array('c', tfile.read()) finally: tfile.close() c=db.cursor() try: c.execute("UPDATE Images SET Thumbnail=%s WHERE Id=%s", (tmb, id)) finally: c.close() finally: os.unlink(tmb_tmp_fname) finally: os.unlink(tmp_fname) def rebuild_icons(db): c=db.cursor() try: c.execute("SELECT Id, Image FROM Images WHERE length(Thumbnail) = 0") while True: r=c.fetchone() if r: update_thumbnail(db, r[1], r[0]); else: break finally: c.close() def usage(): sys.stderr.write("Usage: rebuild_images.py [-f cfgile] [-s cfgsection]\n") def main(): try: opts, args = getopt.getopt(sys.argv[1:], "f:s:", ["cfgfile=","cfgsection="]) except getopt.GetoptError: usage() sys.exit(2) cfgfile = "db.ini" cfgsection = "DB" for o, a in opts: if o in ("-f", "--cfgfile"): cfgfile = a if o in ("-s", "--cfgsection"): cfgsection = a if len(args) != 0: usage() sys.exit(2) try: (db_host,db_user,db_pass,db_name) = dbcfg.read(cfgfile, cfgsection) except Exception, (errno, strerror): print "Error reading config file: %s\n" % (strerror) sys.exit(errno) try: db=MySQLdb.connect(db_host,db_user,db_pass,db_name) except Exception, (errno, strerror): print "DB connnection error: %s" % (strerror) sys.exit(errno) try: try: rebuild_icons(db) except Exception: sys.exit(1) finally: db.close() sys.exit(0) if __name__ == "__main__": main() |
|
From: Vadim Z. <lo...@us...> - 2004-12-05 09:12:25
|
Update of /cvsroot/photoarchive/photoarchive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20518 Modified Files: groups.php Log Message: RSS feed auto-discovery added Index: groups.php =================================================================== RCS file: /cvsroot/photoarchive/photoarchive/groups.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** groups.php 20 Nov 2001 19:24:06 -0000 1.7 --- groups.php 5 Dec 2004 09:12:12 -0000 1.8 *************** *** 12,15 **** --- 12,16 ---- <HEAD> <TITLE>Images by group</TITLE> + <LINK rel="alternative" TYPE="application/rss+xml" TITLE="RSS" HREF="rss.php"/> <?php include "styles.inc"; ?> </HEAD> |
|
From: Vadim Z. <lo...@us...> - 2004-11-21 22:10:33
|
Update of /cvsroot/photoarchive/photoarchive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23940 Modified Files: rss.php Log Message: returning thumbnails as body Index: rss.php =================================================================== RCS file: /cvsroot/photoarchive/photoarchive/rss.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rss.php 3 Nov 2004 03:34:37 -0000 1.2 --- rss.php 21 Nov 2004 22:09:05 -0000 1.3 *************** *** 69,72 **** --- 69,75 ---- print("<link>" . $FEED_URL . "image_detail.php?Id=" . $row[0] . "</link>\r\n"); print("<pubDate>" . htmlspecialchars(date("r", $row[2])) . "</pubDate>\r\n"); + print("<description>" . + htmlspecialchars("<img src=\"" . $FEED_URL . "thumbnail.php/" . $row[0] . "\">") + . "</description>\r\n"); /*print("<author>" . htmlspecialchars("") . "</author>\r\n"); */ print("<enclosure url=\"" . |
|
From: Vadim Z. <lo...@us...> - 2004-11-03 03:34:48
|
Update of /cvsroot/photoarchive/photoarchive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10293 Modified Files: rss.php Log Message: enclosures support Index: rss.php =================================================================== RCS file: /cvsroot/photoarchive/photoarchive/rss.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rss.php 15 Jul 2004 23:29:53 -0000 1.1 --- rss.php 3 Nov 2004 03:34:37 -0000 1.2 *************** *** 5,16 **** $headers = getallheaders(); - $since = $headers["If-None-Match"]; ! if(isset($since)) { ! $since = trim($since); $sql = "select MAX(Id) FROM Images WHERE Id>".addslashes($since); } else { $sql = "select MAX(Id) FROM Images"; } --- 5,16 ---- $headers = getallheaders(); ! if(isset($headers["If-None-Match"])) { ! $since = trim($headers["If-None-Match"]); $sql = "select MAX(Id) FROM Images WHERE Id>".addslashes($since); } else { + $since = NULL; $sql = "select MAX(Id) FROM Images"; } *************** *** 26,30 **** } else { ! if(isset($since)) { Header("Etag: $since"); --- 26,30 ---- } else { ! if($since) { Header("Etag: $since"); *************** *** 49,58 **** print("<description>$FEED_DESCR</description>"); ! if(isset($since)) { ! $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt) FROM Images WHERE Id>" . addslashes($since) . " ORDER BY Id DESC"; } else { ! $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt) FROM Images WHERE Id>" . addslashes($since) . " ORDER BY Id DESC LIMIT " . $RSS_MAX_RECORDS; } --- 49,58 ---- print("<description>$FEED_DESCR</description>"); ! if($since) { ! $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images WHERE Id>" . addslashes($since) . " ORDER BY Id DESC"; } else { ! $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images ORDER BY Id DESC LIMIT " . $RSS_MAX_RECORDS; } *************** *** 70,73 **** --- 70,81 ---- print("<pubDate>" . htmlspecialchars(date("r", $row[2])) . "</pubDate>\r\n"); /*print("<author>" . htmlspecialchars("") . "</author>\r\n"); */ + print("<enclosure url=\"" . + $FEED_URL . + "image.php/" . + $row[0] . + "\" length=\"" . + $row[3] . + "\" type=\"image/jpeg\"/>\r\n" + ); print("</item>\r\n\r\n"); } |
|
From: Vadim Z. <lo...@us...> - 2004-07-16 00:03:12
|
Update of /cvsroot/photoarchive/photoarchive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25472 Modified Files: misc.inc Added Files: xml.gif Log Message: RSS link in footer --- NEW FILE: xml.gif --- GIF89a$ NÞ2ÕM..2ôçNõ2 õþù2ÞeHEÂ*\Èpá Index: misc.inc =================================================================== RCS file: /cvsroot/photoarchive/photoarchive/misc.inc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** misc.inc 20 Nov 2001 19:24:06 -0000 1.14 --- misc.inc 16 Jul 2004 00:03:04 -0000 1.15 *************** *** 342,345 **** --- 342,346 ---- echo ", <A HREF=\"login.php\">[Login]</A>"; } + echo ", <A HREF=\"rss.php\"><IMG SRC=\"rss.php\"></A>"; echo "</p>"; *************** *** 350,352 **** } ! ?> \ No newline at end of file --- 351,353 ---- } ! ?> |
|
From: Vadim Z. <lo...@us...> - 2004-07-15 23:30:02
|
Update of /cvsroot/photoarchive/photoarchive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19745 Modified Files: ChangeLog config.inc Added Files: rss.php Log Message: simple RSS feed generator --- NEW FILE: rss.php --- <?php include "config.inc"; include "php-dbi.inc"; include "connect.inc"; $headers = getallheaders(); $since = $headers["If-None-Match"]; if(isset($since)) { $since = trim($since); $sql = "select MAX(Id) FROM Images WHERE Id>".addslashes($since); } else { $sql = "select MAX(Id) FROM Images"; } $res = dbi_query($sql); if($res) { if( $row = dbi_fetch_row( $res ) ) { if($row[0]) { Header("Etag: $row[0]"); } else { if(isset($since)) { Header("Etag: $since"); Header("HTTP/1.1 304 Not Modified"); return; } } } dbi_free_result ( $res ); } Header("Content-type: text/xml; charset=\"utf-8\""); print("<?xml version='1.0' encoding='utf-8'?>\r\n"); print("<rss version='2.0'>\r\n"); print("<channel>\r\n"); print("<title>$FEED_NAME</title>\r\n"); print("<link>$FEED_URL</link>\r\n"); print("<language>en</language>\r\n"); print("<description>$FEED_DESCR</description>"); if(isset($since)) { $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt) FROM Images WHERE Id>" . addslashes($since) . " ORDER BY Id DESC"; } else { $sql = "SELECT Id, Caption, UNIX_TIMESTAMP(PublishedAt) FROM Images WHERE Id>" . addslashes($since) . " ORDER BY Id DESC LIMIT " . $RSS_MAX_RECORDS; } $result = dbi_query($sql); if($result) { while($row = dbi_fetch_row($result)) { print("<item>\r\n"); print("<title>" . htmlspecialchars($row[1]) . "</title>\r\n" ); print("<link>" . $FEED_URL . "image_detail.php?Id=" . $row[0] . "</link>\r\n"); print("<pubDate>" . htmlspecialchars(date("r", $row[2])) . "</pubDate>\r\n"); /*print("<author>" . htmlspecialchars("") . "</author>\r\n"); */ print("</item>\r\n\r\n"); } dbi_free_result($result); } ?> </channel> </rss> Index: ChangeLog =================================================================== RCS file: /cvsroot/photoarchive/photoarchive/ChangeLog,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ChangeLog 21 Oct 2001 18:17:15 -0000 1.32 --- ChangeLog 15 Jul 2004 23:29:53 -0000 1.33 *************** *** 1,2 **** --- 1,7 ---- + 2004-07-15 Vadim Zaliva <lo...@ze...> + + * config.ing: + * rss.php: simple rss feed generator for new images + 2001-10-21 Vadim Zaliva <lo...@cr...> Index: config.inc =================================================================== RCS file: /cvsroot/photoarchive/photoarchive/config.inc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** config.inc 20 Nov 2001 19:26:51 -0000 1.13 --- config.inc 15 Jul 2004 23:29:53 -0000 1.14 *************** *** 36,39 **** --- 36,45 ---- $pngtopnm = "/usr/bin/pngtopnm"; + // RSS-related + $FEED_NAME="Vadim Zaliva Photoarchive"; + $FEED_URL="http://www.crocodile.org/lord/photoarchive/"; + $FEED_DESCR="Vadim Zaliva Photo Archive"; + $RSS_MAX_RECORDS=100; + // Admin |
|
From: Mike G. <mgi...@us...> - 2001-12-29 05:39:37
|
Update of /cvsroot/photoarchive/photoarchive
In directory usw-pr-cvs1:/tmp/cvs-serv22007
Modified Files:
Tag: mgifford-patches
create.tables.mysql.sql
Added Files:
Tag: mgifford-patches
upgrade.tables.sql
Log Message:
New SQL Tables & Upgrade Script
--- NEW FILE: upgrade.tables.sql ---
ALTER TABLE Groups DROP PRIMARY KEY;
ALTER TABLE Groups CHANGE Id ID INT(11) NOT NULL;
ALTER TABLE Groups CHANGE ParentGroupId ParentID INT(11) DEFAULT '0' NOT NULL;
ALTER TABLE Groups CHANGE Comment Comment TEXT NULL;
ALTER TABLE Groups ADD PRIMARY KEY(ID);
ALTER TABLE Groups ADD UNIQUE(ID);
ALTER TABLE Groups ADD INDEX(ID);
ALTER TABLE ImageGroups DROP PRIMARY KEY;
ALTER TABLE ImageGroups CHANGE GroupID GroupID INT(11) NOT NULL;
ALTER TABLE ImageGroups CHANGE ImageId ImageID INT(11) NOT NULL;
ALTER TABLE ImageGroups ADD PRIMARY KEY(GroupID,ImageID);
ALTER TABLE ImageGroups ADD UNIQUE(GroupID,ImageID);
ALTER TABLE ImageGroups ADD INDEX(GroupID,ImageID);
ALTER TABLE Images DROP PRIMARY KEY;
ALTER TABLE Images CHANGE Id ID INT(11) NOT NULL;
ALTER TABLE Images CHANGE Views Views INT(11) NULL;
ALTER TABLE Images CHANGE Comment Comment TEXT NULL;
ALTER TABLE Images CHANGE Width Width INT(11) NULL;
ALTER TABLE Images CHANGE Height Height INT(11) NULL;
ALTER TABLE Images CHANGE Bytes Bytes INT(11) NULL;
ALTER TABLE Images ADD PRIMARY KEY(ID);
ALTER TABLE Images ADD UNIQUE(ID);
ALTER TABLE Images ADD INDEX(ID);
CREATE TABLE Sentcards (
ID varchar(48) NOT NULL,
s_name varchar(30) NOT NULL,
s_email varchar(45) NOT NULL,
r_name varchar(30) NOT NULL,
r_email varchar(45) NOT NULL,
message varchar(255) NOT NULL,
imageID varchar(30) NOT NULL,
dateSent timestamp(14) NULL,
PRIMARY KEY (ID),
UNIQUE ID (ID)
);
Index: create.tables.mysql.sql
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/create.tables.mysql.sql,v
retrieving revision 1.5.4.2
retrieving revision 1.5.4.3
diff -C2 -d -r1.5.4.2 -r1.5.4.3
*** create.tables.mysql.sql 2001/12/29 04:23:28 1.5.4.2
--- create.tables.mysql.sql 2001/12/29 05:39:33 1.5.4.3
***************
*** 1,47 ****
CREATE TABLE Groups (
! ID int(11) DEFAULT '0' NOT NULL,
! Name varchar(127),
! Comment text,
! ParentID int(11) DEFAULT '0' NOT NULL,
! InitImageID int(11),
PRIMARY KEY (ID),
! UNIQUE GroupIdIndex (ID)
);
CREATE TABLE ImageGroups (
! GroupID int(11) DEFAULT '0' NOT NULL,
! ImageID int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (GroupID, ImageID),
! UNIQUE ImageGroupsInidex (GroupID, ImageID)
);
CREATE TABLE Images (
! ID int(11) DEFAULT '0' NOT NULL,
! Views int(11) DEFAULT '0' NOT NULL,
! Caption varchar(127),
! Comment text,
! Format varchar(32) NOT NULL,
! Width int(11) DEFAULT '0' NOT NULL,
! Height int(11) DEFAULT '0' NOT NULL,
! Bytes int(11) DEFAULT '0' NOT NULL,
! Image mediumblob NOT NULL,
! Thumbnail mediumblob,
! PublishedAt timestamp(14),
! ShotAt date,
PRIMARY KEY (ID),
! UNIQUE ImageIdIndex (ID)
);
CREATE TABLE Sentcards (
! ID varchar(48) NOT NULL,
! s_name varchar(30) NOT NULL,
! s_email varchar(45) NOT NULL,
! r_name varchar(30) NOT NULL,
! r_email varchar(45) NOT NULL,
! message varchar(255) NOT NULL,
! imageID varchar(30) NOT NULL,
! dateSent timestamp(14),
PRIMARY KEY (ID),
! UNIQUE ID (ID)
);
--- 1,69 ----
+ # --------------------------------------------------------
+ #
+ # Table structure for table 'Groups'
+ #
CREATE TABLE Groups (
! ID INT(11) DEFAULT '0' NOT NULL,
! Name VARCHAR(127) NULL,
! Comment TEXT NULL,
! ParentID INT(11) DEFAULT '0' NOT NULL,
! InitImageID INT(11) NULL,
PRIMARY KEY (ID),
! UNIQUE INDEX GroupIdIndex (ID)
);
+
+ # --------------------------------------------------------
+ #
+ # Table structure for table 'ImageGroups'
+ #
+
CREATE TABLE ImageGroups (
! GroupID INT(11) DEFAULT '0' NOT NULL,
! ImageID INT(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (GroupID, ImageID),
! UNIQUE INDEX ImageGroupsInidex (GroupID, ImageID)
);
+
+ # --------------------------------------------------------
+ #
+ # Table structure for table 'Images'
+ #
+
CREATE TABLE Images (
! ID INT(11) DEFAULT '0' NOT NULL,
! Views INT(11) DEFAULT '0' NOT NULL,
! Caption VARCHAR(127) NULL,
! Comment TEXT NULL,
! Format VARCHAR(32) NOT NULL,
! Width INT(11) DEFAULT '0' NOT NULL,
! Height INT(11) DEFAULT '0' NOT NULL,
! Bytes INT(11) DEFAULT '0' NOT NULL,
! Image MEDIUMBLOB NOT NULL,
! Thumbnail MEDIUMBLOB NULL,
! PublishedAt TIMESTAMP(14) NULL,
! ShotAt DATE NULL,
PRIMARY KEY (ID),
! UNIQUE INDEX ImageIdIndex (ID)
);
+
+ # --------------------------------------------------------
+ #
+ # Table structure for table 'Sentcards'
+ #
+
CREATE TABLE Sentcards (
! ID VARCHAR(48) NOT NULL,
! s_name VARCHAR(30) NOT NULL,
! s_email VARCHAR(45) NOT NULL,
! r_name VARCHAR(30) NOT NULL,
! r_email VARCHAR(45) NOT NULL,
! message VARCHAR(255) NOT NULL,
! imageID VARCHAR(30) NOT NULL,
! dateSent TIMESTAMP(14) NULL,
PRIMARY KEY (ID),
! UNIQUE INDEX ID (ID)
);
|
|
From: Mike G. <mgi...@us...> - 2001-12-29 04:23:32
|
Update of /cvsroot/photoarchive/photoarchive
In directory usw-pr-cvs1:/tmp/cvs-serv11354
Modified Files:
Tag: mgifford-patches
create.tables.mysql.sql edit_image.php edit_image_handler.php
misc.inc show_group.php upload_image.php
upload_image_handler.php
Log Message:
Re-Thumbnailing Added
Index: create.tables.mysql.sql
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/create.tables.mysql.sql,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -C2 -d -r1.5.4.1 -r1.5.4.2
*** create.tables.mysql.sql 2001/11/06 22:02:39 1.5.4.1
--- create.tables.mysql.sql 2001/12/29 04:23:28 1.5.4.2
***************
*** 5,9 ****
Comment text,
ParentID int(11) DEFAULT '0' NOT NULL,
! InitImageID tinyint(4),
PRIMARY KEY (ID),
UNIQUE GroupIdIndex (ID)
--- 5,9 ----
Comment text,
ParentID int(11) DEFAULT '0' NOT NULL,
! InitImageID int(11),
PRIMARY KEY (ID),
UNIQUE GroupIdIndex (ID)
Index: edit_image.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/edit_image.php,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -C2 -d -r1.5.4.1 -r1.5.4.2
*** edit_image.php 2001/11/06 22:02:39 1.5.4.1
--- edit_image.php 2001/12/29 04:23:28 1.5.4.2
***************
*** 36,40 ****
echo "<IMG SRC=\"thumbnail.php?ID=$ID\">";
! $sql = "SELECT Caption, Comment, DAYOFMONTH(ShotAt), MONTH(ShotAt), YEAR(ShotAt) FROM Images WHERE ID=$ID";
$res = dbi_query ( $sql );
--- 36,40 ----
echo "<IMG SRC=\"thumbnail.php?ID=$ID\">";
! $sql = "SELECT Caption, Comment, DAYOFMONTH(ShotAt), MONTH(ShotAt), YEAR(ShotAt), Image FROM Images WHERE ID=$ID";
$res = dbi_query ( $sql );
***************
*** 49,52 ****
--- 49,53 ----
$shot_month = $row[3];
$shot_year = $row[4];
+ $Image = $row[5];
}
***************
*** 111,114 ****
--- 112,123 ----
?>
+ </FORM>
+
+ <br>
+
+ <FORM METHOD="POST" ACTION="edit_image_handler.php">
+ <INPUT TYPE="submit" VALUE="ReThumbnail">
+ <INPUT TYPE="hidden" NAME="ReThumbnail" VALUE="ReThumbnail">
+ <INPUT TYPE="hidden" NAME="ID" VALUE="<?php echo $ID; ?>">
</FORM>
Index: edit_image_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/edit_image_handler.php,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -C2 -d -r1.3.4.1 -r1.3.4.2
*** edit_image_handler.php 2001/11/06 22:02:39 1.3.4.1
--- edit_image_handler.php 2001/12/29 04:23:28 1.3.4.2
***************
*** 3,6 ****
--- 3,8 ----
include "config.inc.php";
+ include "$baseDIR/php-dbi.inc";
+ include "$baseDIR/connect.inc";
include "$baseDIR/misc.inc";
***************
*** 10,17 ****
}
if(!isset($Caption) ||
!isset($Comment) ||
! !isset($Groups ) ||
! !isset($ID)
)
{
--- 12,69 ----
}
+ if(!isset($ID)) { die("You must have an ID to proceed"); }
+
+ if($ReThumbnail) {
+
+ $sql = "SELECT Image FROM Images WHERE ID='$ID'";
+ $res = dbi_query ( $sql );
+ if ( $res ) {
+ if($row = dbi_fetch_row( $res ))
+ dbi_free_result ( $res );
+ $Images = $row[0];
+ }
+
+ // Alternate way to determine strlen
+ // $result = mysql_query($sql);
+ // $ImageSize = mysql_field_len ($result, 0);
+ // $ImageSize = strlen($Images);
+ // echo $ImageSize;
+
+
+ // echo "Image: <br>$Images";
+
+ $File = "ReThumbnail.jpg";
+
+ // Write DB 2 File
+ $fd = fopen($File, "wb");
+ // fputs($fd,$Images,$ImageSize);
+ fputs($fd,$Images);
+ fclose($fd);
+
+ // Create Thumbnail
+ // djpeg -pnm ReThumbnail.jpg | pnmscale -xscale .1 -yscale .1 | cjpeg > ReThumbnail.jpg.tmb
+ system("djpeg -pnm $File | pnmscale -xscale $xscale -yscale $yscale | cjpeg > $File.tmb");
+ // system("djpeg -pnm -scale 1/8 $File | cjpeg > $File.tmb");
+
+ // Read Created Thumbnail into string
+ $fd = fopen( "$File.tmb", "rb");
+ $tmb = addslashes(fread($fd,filesize("$File.tmb")));
+ fclose($fd);
+
+ // echo "<br>Temp Thumb File: $File.tmb";
+ // echo "<br>Thumbnail: <br>$tmb";
+
+ $sql = "UPDATE Images SET Thumbnail='$tmb' WHERE ID=$ID";
+ if(dbi_query($sql)) {
+ echo "ReThumbnailing Successful - <a href=\"" . $HTTP_REFERER . "\">Go Back</a>";
+ exit;
+ } else {
+ $error = dbi_error ();
+ }
+ } else {
+
if(!isset($Caption) ||
!isset($Comment) ||
! !isset($Groups )
)
{
***************
*** 19,22 ****
--- 71,76 ----
}
+
+
if(!isset($ShotAtDay ) ||
!isset($ShotAtMonth) ||
***************
*** 38,43 ****
// include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
$Comment = addslashes($Comment);
--- 92,97 ----
// include "config.inc.php";
! // include "$baseDIR/php-dbi.inc";
! // include "$baseDIR/connect.inc";
$Comment = addslashes($Comment);
***************
*** 46,53 ****
! $sql = "UPDATE Images SET Caption='$Caption', Comment='$Comment', ShotAt='$shot_at' WHERE ID=$ID";
! if(!dbi_query($sql))
! {
$error = dbi_error ();
} else
--- 100,106 ----
! $sql = "UPDATE Images SET Caption='$Caption', Comment='$Comment', ShotAt='$shot_at' WHERE ID='$ID'";
! if(!dbi_query($sql)) {
$error = dbi_error ();
} else
***************
*** 76,79 ****
--- 129,134 ----
}
}
+
+ } // ReThumbnail
?>
Index: misc.inc
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/misc.inc,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -C2 -d -r1.4.4.1 -r1.4.4.2
*** misc.inc 2001/11/06 22:02:40 1.4.4.1
--- misc.inc 2001/12/29 04:23:28 1.4.4.2
***************
*** 69,73 ****
echo "</TD></TR>";
echo "<TR><TD>";
! echo "<B>Title: </B>";
if(strlen($row[1])) {
echo stripslashes($row[1]);
--- 69,73 ----
echo "</TD></TR>";
echo "<TR><TD>";
! echo "<B>$row[0]: </B>";
if(strlen($row[1])) {
echo stripslashes($row[1]);
***************
*** 85,89 ****
echo "<B>Views: </B>$row[5]";
echo "</TD></TR>";
! echo "</TABLE></TD>\n";
}
$n++;
--- 85,91 ----
echo "<B>Views: </B>$row[5]";
echo "</TD></TR>";
! echo "</TABLE>";
! echo "<center><FORM METHOD=POST ACTION=\"edit_image_handler.php\"><INPUT TYPE=SUBMIT VALUE=\"ReThumb\"><INPUT TYPE=HIDDEN NAME=\"ReThumbnail\" VALUE=\"ReThumbnail\"><INPUT TYPE=HIDDEN NAME=\"ID\" VALUE=\"$row[0]\"></FORM></center>";
! echo "</TD>\n";
}
$n++;
Index: show_group.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/show_group.php,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -C2 -d -r1.4.4.1 -r1.4.4.2
*** show_group.php 2001/11/06 22:02:40 1.4.4.1
--- show_group.php 2001/12/29 04:23:28 1.4.4.2
***************
*** 37,41 ****
start_group_page($gname, $gcomment);
! $sql = "SELECT Images.ID, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views FROM ImageGroups, Images WHERE ImageGroups.GroupID=$ID AND Images.ID=ImageGroups.ImageID ORDER BY Images.ShotAt";
// echo $sql;
--- 37,41 ----
start_group_page($gname, $gcomment);
! $sql = "SELECT Images.ID, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views FROM ImageGroups, Images WHERE ImageGroups.GroupID=$ID AND Images.ID=ImageGroups.ImageID ORDER BY Images.ID ";
// echo $sql;
Index: upload_image.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/upload_image.php,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -C2 -d -r1.4.4.1 -r1.4.4.2
*** upload_image.php 2001/11/06 22:02:40 1.4.4.1
--- upload_image.php 2001/12/29 04:23:28 1.4.4.2
***************
*** 53,57 ****
<TR>
<TD class=fieldname>File</i></TD>
! <TD><INPUT TYPE="FILE" NAME="File""></TD>
</TR>
</TABLE>
--- 53,57 ----
<TR>
<TD class=fieldname>File</i></TD>
! <TD><INPUT TYPE="FILE" NAME="File"></TD>
</TR>
</TABLE>
Index: upload_image_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/upload_image_handler.php,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.2
diff -C2 -d -r1.6.4.1 -r1.6.4.2
*** upload_image_handler.php 2001/11/06 22:02:40 1.6.4.1
--- upload_image_handler.php 2001/12/29 04:23:28 1.6.4.2
***************
*** 69,85 ****
$size=getimagesize($File);
-
$Comment = addslashes($Comment);
$Caption = addslashes($Caption);
!
//produce thumbnail
! if($File_type=="image/jpeg" || $File_type=="image/pjpeg")
! {
system("djpeg -pnm $File | pnmscale -xscale $xscale -yscale $yscale | cjpeg > $File.tmb");
$fd = fopen( "$File.tmb", "r");
$tmb = addslashes(fread($fd, filesize("$File.tmb")));
fclose($fd);
unlink("$File.tmb");
! }
$sql = "INSERT INTO Images (ID, Views, Bytes, Format, Caption, Comment, ShotAt, PublishedAt, Width, Height, Image, Thumbnail) VALUES ($newid, 0, $File_size, '$File_type', '$Caption', '$Comment', '$shot_at', '$published_at', $size[0], $size[1], '$data', '$tmb')";
--- 69,86 ----
$size=getimagesize($File);
$Comment = addslashes($Comment);
$Caption = addslashes($Caption);
!
//produce thumbnail
! // if($File_type=="image/jpeg" || $File_type=="image/pjpeg") {
system("djpeg -pnm $File | pnmscale -xscale $xscale -yscale $yscale | cjpeg > $File.tmb");
$fd = fopen( "$File.tmb", "r");
$tmb = addslashes(fread($fd, filesize("$File.tmb")));
fclose($fd);
+ // echo "$size || $File || $xscale:$yscale || " . ("$File.tmb");
unlink("$File.tmb");
! // }
!
!
$sql = "INSERT INTO Images (ID, Views, Bytes, Format, Caption, Comment, ShotAt, PublishedAt, Width, Height, Image, Thumbnail) VALUES ($newid, 0, $File_size, '$File_type', '$Caption', '$Comment', '$shot_at', '$published_at', $size[0], $size[1], '$data', '$tmb')";
|
|
From: Vadim Z. <lo...@us...> - 2001-11-20 19:29:15
|
Update of /cvsroot/photoarchive/photoarchive In directory usw-pr-cvs1:/tmp/cvs-serv2609 Removed Files: footer.inc Log Message: wrong branch. --- footer.inc DELETED --- |
Update of /cvsroot/photoarchive/photoarchive In directory usw-pr-cvs1:/tmp/cvs-serv2318 Removed Files: config.inc.php contact.php function.php header.inc index.php profile.php purchase.php sendCard.php showCard.php Log Message: these files are now in Mike's branch. --- config.inc.php DELETED --- --- contact.php DELETED --- --- function.php DELETED --- --- header.inc DELETED --- --- index.php DELETED --- --- profile.php DELETED --- --- purchase.php DELETED --- --- sendCard.php DELETED --- --- showCard.php DELETED --- |
|
From: Vadim Z. <lo...@us...> - 2001-11-20 19:26:56
|
Update of /cvsroot/photoarchive/photoarchive In directory usw-pr-cvs1:/tmp/cvs-serv1510 Added Files: config.inc group.jpg Log Message: restoring changes |
Update of /cvsroot/photoarchive/photoarchive
In directory usw-pr-cvs1:/tmp/cvs-serv32199
Modified Files:
confirm.php create.tables.mysql.sql delete_group_handler.php
delete_image_handler.php edit_group.php edit_group_handler.php
edit_image.php edit_image_handler.php groups.php image.php
image_detail.php login.php login_handler.php
logout_handler.php misc.inc search.php search_handler.php
show_group.php styles.inc thumbnail.php top10.php
upload_image.php upload_image_handler.php
Log Message:
Unodoing Mike's comit into wrong branch.
Index: confirm.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/confirm.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** confirm.php 2001/11/06 21:21:21 1.4
--- confirm.php 2001/11/20 19:24:06 1.5
***************
*** 2,9 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
if(!isAdmin())
--- 2,9 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
if(!isAdmin())
***************
*** 49,53 ****
echo "<a href=\"$CANCELURL\">[Cancel]</a>";
! include "footer.inc";
?>
--- 49,53 ----
echo "<a href=\"$CANCELURL\">[Cancel]</a>";
! show_footer($INVALID_GID, null);
?>
Index: create.tables.mysql.sql
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/create.tables.mysql.sql,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** create.tables.mysql.sql 2001/11/06 21:21:21 1.10
--- create.tables.mysql.sql 2001/11/20 19:24:06 1.11
***************
*** 1,47 ****
! CREATE TABLE Groups (
! ID int(11) DEFAULT '0' NOT NULL,
! Name varchar(127),
! Comment text,
! ParentID int(11) DEFAULT '0' NOT NULL,
! InitImageID tinyint(4),
! PRIMARY KEY (ID),
! UNIQUE GroupIdIndex (ID)
);
! CREATE TABLE ImageGroups (
! GroupID int(11) DEFAULT '0' NOT NULL,
! ImageID int(11) DEFAULT '0' NOT NULL,
! PRIMARY KEY (GroupID, ImageID),
! UNIQUE ImageGroupsInidex (GroupID, ImageID)
);
! CREATE TABLE Images (
! ID int(11) DEFAULT '0' NOT NULL,
! Views int(11) DEFAULT '0' NOT NULL,
! Caption varchar(127),
! Comment text,
! Format varchar(32) NOT NULL,
! Width int(11) DEFAULT '0' NOT NULL,
! Height int(11) DEFAULT '0' NOT NULL,
! Bytes int(11) DEFAULT '0' NOT NULL,
! Image mediumblob NOT NULL,
! Thumbnail mediumblob,
! PublishedAt timestamp(14),
! ShotAt date,
! PRIMARY KEY (ID),
! UNIQUE ImageIdIndex (ID)
);
- CREATE TABLE Sentcards (
- ID varchar(48) NOT NULL,
- s_name varchar(30) NOT NULL,
- s_email varchar(45) NOT NULL,
- r_name varchar(30) NOT NULL,
- r_email varchar(45) NOT NULL,
- message varchar(255) NOT NULL,
- imageID varchar(30) NOT NULL,
- dateSent timestamp(14),
- PRIMARY KEY (ID),
- UNIQUE ID (ID)
- );
\ No newline at end of file
--- 1,48 ----
! CREATE TABLE Groups
! (
! Id INTEGER NOT NULL,
! Name VARCHAR(127) NULL,
! Comment VARCHAR(255) NULL,
!
! ParentGroupId INTEGER NULL,
!
! PRIMARY KEY (Id),
! FOREIGN KEY (ParentGroupId) REFERENCES Groups(Id),
! UNIQUE INDEX GroupIdIndex (Id)
);
!
! CREATE TABLE Images
! (
! Id INTEGER NOT NULL,
! Views INTEGER NOT NULL,
! Caption VARCHAR(127) NULL,
! Comment VARCHAR(255) NULL,
!
! Format VARCHAR(32) NOT NULL,
! Width INTEGER NOT NULL,
! Height INTEGER NOT NULL,
! Bytes INTEGER NOT NULL,
!
! Image MEDIUMBLOB NOT NULL,
! Thumbnail MEDIUMBLOB NULL,
!
! PublishedAt DATETIME NOT NULL,
! ShotAt DATE NULL,
!
! PRIMARY KEY (Id),
! UNIQUE INDEX ImageIdIndex (Id)
);
! CREATE TABLE ImageGroups
! (
! GroupId INTEGER NOT NULL,
! ImageId INTEGER NOT NULL,
!
! PRIMARY KEY (GroupId, ImageId),
! FOREIGN KEY (GroupId) REFERENCES Groups(Id),
! FOREIGN KEY (ImageId) REFERENCES Images(Id),
! UNIQUE INDEX ImageGroupsIndex (GroupId, ImageId)
);
Index: delete_group_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/delete_group_handler.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** delete_group_handler.php 2001/11/06 21:21:21 1.6
--- delete_group_handler.php 2001/11/20 19:24:06 1.7
***************
*** 2,7 ****
<?php
! include "config.inc.php";
! include "$baseDIR/misc.inc";
if(!isAdmin())
--- 2,7 ----
<?php
! include "config.inc";
! include "misc.inc";
if(!isAdmin())
***************
*** 10,33 ****
}
! if(!isset($ID))
{
! die("Need 'ID' parameters");
} else
{
! $ID=addslashes($ID);
}
! // include "config.inc";
include "php-dbi.inc";
include "connect.inc";
! if(!dbi_query("DELETE FROM ImageGroups WHERE GroupID=$ID"))
{
$error = dbi_error ();
! } else if(!dbi_query("DELETE FROM Groups WHERE ID=$ID"))
{
$error = dbi_error ();
} else {
! do_redirect("groups.php");
}
--- 10,33 ----
}
! if(!isset($Id))
{
! die("Need 'Id' parameters");
} else
{
! $Id=addslashes($Id);
}
! include "config.inc";
include "php-dbi.inc";
include "connect.inc";
! if(!dbi_query("DELETE FROM ImageGroups WHERE GroupId=$Id"))
{
$error = dbi_error ();
! } else if(!dbi_query("DELETE FROM Groups WHERE Id=$Id"))
{
$error = dbi_error ();
} else {
! do_redirect("show_group.php?Id=-1");
}
***************
*** 47,51 ****
echo $error;
echo "</BLOCKQUOTE>";
! include "footer.inc";
?>
--- 47,52 ----
echo $error;
echo "</BLOCKQUOTE>";
!
! show_footer($INVALID_GID, null);
?>
Index: delete_image_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/delete_image_handler.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** delete_image_handler.php 2001/11/06 21:21:21 1.5
--- delete_image_handler.php 2001/11/20 19:24:06 1.6
***************
*** 2,7 ****
<?php
! include "config.inc.php";
! include "$baseDIR/misc.inc";
if(!isAdmin())
--- 2,7 ----
<?php
! include "config.inc";
! include "misc.inc";
if(!isAdmin())
***************
*** 10,33 ****
}
! if(!isset($ID))
{
! die("Need 'ID' parameters");
} else
{
! $ID=addslashes($ID);
}
! // include "config.inc";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! if(!dbi_query("DELETE FROM ImageGroups WHERE ImageID=$ID"))
{
$error = dbi_error ();
! } else if(!dbi_query("DELETE FROM Images WHERE ID=$ID"))
{
$error = dbi_error ();
} else {
! do_redirect("groups.php");
}
--- 10,33 ----
}
! if(!isset($Id))
{
! die("Need 'Id' parameters");
} else
{
! $Id=addslashes($Id);
}
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! if(!dbi_query("DELETE FROM ImageGroups WHERE ImageId=$Id"))
{
$error = dbi_error ();
! } else if(!dbi_query("DELETE FROM Images WHERE Id=$Id"))
{
$error = dbi_error ();
} else {
! do_redirect("show_group.php?Id=-1");
}
***************
*** 47,51 ****
echo $error;
echo "</BLOCKQUOTE>";
! include "footer.inc";
?>
--- 47,52 ----
echo $error;
echo "</BLOCKQUOTE>";
!
! show_footer($INVALID_GID, null);
?>
Index: edit_group.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/edit_group.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** edit_group.php 2001/11/06 21:21:21 1.6
--- edit_group.php 2001/11/20 19:24:06 1.7
***************
*** 2,10 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
! include "$baseDIR/function.php";
if(!isAdmin())
--- 2,9 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
if(!isAdmin())
***************
*** 27,51 ****
echo "<FORM METHOD=\"POST\" ACTION=\"edit_group_handler.php\">\n";
! if(isset($ID))
{
! $ID=addslashes($ID);
// Editing Group
echo "<INPUT TYPE=\"hidden\" NAME=\"Change\" value=\"update\">\n";
! $res = dbi_query ("SELECT Name,Comment,ParentID,InitImageID FROM Groups WHERE ID=$ID");
if($res)
{
if ( $row = dbi_fetch_row ( $res ) )
{
! echo "<INPUT TYPE=\"hidden\" NAME=\"ID\" value=\"$ID\">\n";
echo "<TABLE>\n";
$name=stripslashes($row[0]);
! echo "<TR><TD class=fieldname>Group Name</TD><TD><INPUT TYPE=\"text\" NAME=\"Name\" size=80 value=\"$name\"></TD></TR>\n";
$comment=stripslashes($row[1]);
echo "<TR><TD class=fieldname>Comment</TD><TD><TEXTAREA NAME=\"Comment\" cols=80 rows=10>$comment</TEXTAREA></TD></TR>\n";
- $ParentID=$row[2];
- // echo "Edit_Group: $ParentID==$row[2]<br>";
- echo "<TR><TD class=fieldname>Parent Group <br><em>(Is this a sub group?)</em></TD><TD>" . groupDropDown('',$ParentID) . "</TD></TR>";
- echo "<TR><TD class=fieldname>Default Group Image</TD><TD><INPUT TYPE=\"text\" NAME=\"InitImageID\" size=5 value=\"$row[3]\"></TD></TR>";
}
dbi_free_result ( $res );
--- 26,46 ----
echo "<FORM METHOD=\"POST\" ACTION=\"edit_group_handler.php\">\n";
! if(isset($Id))
{
! $Id=addslashes($Id);
// Editing Group
echo "<INPUT TYPE=\"hidden\" NAME=\"Change\" value=\"update\">\n";
! $res = dbi_query ("SELECT Name, Comment FROM Groups WHERE Id=$Id");
if($res)
{
if ( $row = dbi_fetch_row ( $res ) )
{
! echo "<INPUT TYPE=\"hidden\" NAME=\"Id\" value=\"$Id\">\n";
echo "<TABLE>\n";
$name=stripslashes($row[0]);
! echo "<TR><TD class=fieldname>Name</TD><TD><INPUT TYPE=\"text\" NAME=\"Name\" size=80 value=\"$name\"></TD></TR>\n";
$comment=stripslashes($row[1]);
echo "<TR><TD class=fieldname>Comment</TD><TD><TEXTAREA NAME=\"Comment\" cols=80 rows=10>$comment</TEXTAREA></TD></TR>\n";
}
dbi_free_result ( $res );
***************
*** 58,63 ****
echo "<TR><TD class=fieldname>Name</TD><TD><INPUT TYPE=\"text\" NAME=\"Name\" size=80></TD></TR>\n";
echo "<TR><TD class=fieldname>Comment</TD><TD><TEXTAREA NAME=\"Comment\" cols=80 rows=10></TEXTAREA></TD></TR>\n";
- echo "<TR><TD class=fieldname>Sub-Groups</TD><TD>" . groupDropDown('','') . "</TD></TR>";
- echo "<TR><TD class=fieldname>Default Group Image</TD><TD><INPUT TYPE=\"text\" NAME=\"InitImageID\" size=5></TD></TR>";
}
echo "</TABLE>\n";
--- 53,56 ----
***************
*** 65,68 ****
echo "</FORM>\n";
! include "footer.inc";
?>
--- 58,61 ----
echo "</FORM>\n";
! show_footer($INVALID_GID, null);
?>
Index: edit_group_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/edit_group_handler.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** edit_group_handler.php 2001/11/06 21:21:21 1.6
--- edit_group_handler.php 2001/11/20 19:24:06 1.7
***************
*** 2,7 ****
<?php
! include "config.inc.php";
! include "$baseDIR/misc.inc";
if(!isAdmin())
--- 2,7 ----
<?php
! include "config.inc";
! include "misc.inc";
if(!isAdmin())
***************
*** 15,25 ****
}
! if($Change == "Update" && !isset($ID))
{
! die("Need 'ID' parameters");
}
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
$Name = addslashes($Name);
--- 15,26 ----
}
! if($Change == "Update" && !isset($Id))
{
! die("Need 'Id' parameters");
}
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
$Name = addslashes($Name);
***************
*** 27,36 ****
if($Change == "update")
{
! $sql = "UPDATE Groups SET Name='$Name', Comment='$Comment', ParentID='$Groups[0]', InitImageID='$InitImageID' WHERE ID=$ID";
! // echo $sql;
} else
{
! $res=dbi_query("SELECT MAX(ID)+1 FROM Groups");
if($res)
{
--- 28,36 ----
if($Change == "update")
{
! $sql = "UPDATE Groups SET Name='$Name', Comment='$Comment' WHERE Id=$Id";
} else
{
! $res=dbi_query("SELECT MAX(Id)+1 FROM Groups");
if($res)
{
***************
*** 49,54 ****
$newid = 0;
}
! $sql = "INSERT INTO Groups (ID, Name, Comment,ParentID,InitImageID) VALUES ($newid, '$Name', '$Comment','$Groups[0]','$InitImageID')";
! // echo $sql;
dbi_free_result ( $res );
} else
--- 49,53 ----
$newid = 0;
}
! $sql = "INSERT INTO Groups (Id, Name, Comment) VALUES ($newid, '$Name', '$Comment')";
dbi_free_result ( $res );
} else
***************
*** 63,67 ****
} else
{
! do_redirect("groups.php");
}
--- 62,66 ----
} else
{
! do_redirect("show_group.php?Id=-1");
}
***************
*** 81,85 ****
echo $error;
echo "</BLOCKQUOTE>";
! include "footer.inc";
?>
--- 80,85 ----
echo $error;
echo "</BLOCKQUOTE>";
!
! show_footer($INVALID_GID, null);
?>
Index: edit_image.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/edit_image.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** edit_image.php 2001/11/06 21:21:21 1.9
--- edit_image.php 2001/11/20 19:24:06 1.10
***************
*** 2,10 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
! include "$baseDIR/function.php";
if(!isAdmin())
--- 2,9 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
if(!isAdmin())
***************
*** 13,22 ****
}
! if(!isset($ID))
{
! die("Need 'ID' parameter");
} else
{
! $ID=addslashes($ID);
}
--- 12,21 ----
}
! if(!isset($Id))
{
! die("Need 'Id' parameter");
} else
{
! $Id=addslashes($Id);
}
***************
*** 34,40 ****
<?php
! echo "<IMG SRC=\"thumbnail.php?ID=$ID\">";
! $sql = "SELECT Caption, Comment, DAYOFMONTH(ShotAt), MONTH(ShotAt), YEAR(ShotAt) FROM Images WHERE ID=$ID";
$res = dbi_query ( $sql );
--- 33,39 ----
<?php
! echo "<IMG SRC=\"thumbnail.php/$Id\">";
! $sql = "SELECT Caption, Comment, DAYOFMONTH(ShotAt), MONTH(ShotAt), YEAR(ShotAt) FROM Images WHERE Id=$Id";
$res = dbi_query ( $sql );
***************
*** 46,52 ****
$comment = stripslashes($row[1]);
! $shot_day = $row[2];
! $shot_month = $row[3];
! $shot_year = $row[4];
}
--- 45,51 ----
$comment = stripslashes($row[1]);
! $row[2] == 0 ? $shot_day = '' : $shot_day = $row[2];
! $row[3] == 0 ? $shot_month = '' : $shot_month = $row[3];
! $row[4] == 0 ? $shot_year = '' : $shot_year = $row[4];
}
***************
*** 65,76 ****
<TD class=fieldname>Date<br><i>dd.mm.yyyy (optional)</i></TD>
<TD>
!
! <?php
! echo dateinput('ShotAtDay',$shot_day,'ShotAtMonth',$shot_month,'ShotAtYear',$shot_year);
! // echo "<INPUT TYPE=\"text\" NAME=\"ShotAtDay\" size=2 VALUE=\"$shot_day\">";
! // echo "<INPUT TYPE=\"text\" NAME=\"ShotAtMonth\" size=2 VALUE=\"$shot_month\">";
! // echo "<INPUT TYPE=\"text\" NAME=\"ShotAtYear\" size=4 VALUE=\"$shot_year\">";
! ?>
!
</TD>
</TR>
--- 64,72 ----
<TD class=fieldname>Date<br><i>dd.mm.yyyy (optional)</i></TD>
<TD>
! <?php
! echo "<INPUT TYPE=\"text\" NAME=\"ShotAtDay\" size=2 VALUE=\"$shot_day\">";
! echo "<INPUT TYPE=\"text\" NAME=\"ShotAtMonth\" size=2 VALUE=\"$shot_month\">";
! echo "<INPUT TYPE=\"text\" NAME=\"ShotAtYear\" size=4 VALUE=\"$shot_year\">";
! ?>
</TD>
</TR>
***************
*** 85,89 ****
<?php
! $res = dbi_query ("SELECT Groups.ID, Groups.Name, COUNT(ImageGroups.ImageID) FROM Groups LEFT JOIN ImageGroups ON Groups.ID=ImageGroups.GroupID AND ImageGroups.ImageID=$ID GROUP BY Groups.ID ORDER BY Groups.ID");
if($res)
{
--- 81,85 ----
<?php
! $res = dbi_query ("SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId AND ImageGroups.ImageId=$Id GROUP BY Groups.Id ORDER BY Groups.Id");
if($res)
{
***************
*** 108,112 ****
<INPUT TYPE="submit" VALUE="Submit">
<?php
! echo "<INPUT TYPE=\"hidden\" NAME=\"ID\" VALUE=\"$ID\">";
?>
--- 104,108 ----
<INPUT TYPE="submit" VALUE="Submit">
<?php
! echo "<INPUT TYPE=\"hidden\" NAME=\"Id\" VALUE=\"$Id\">";
?>
***************
*** 114,117 ****
<?php
! include "footer.inc";
?>
--- 110,114 ----
<?php
!
! show_footer($INVALID_GID, null);
?>
Index: edit_image_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/edit_image_handler.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** edit_image_handler.php 2001/11/06 21:21:21 1.5
--- edit_image_handler.php 2001/11/20 19:24:06 1.6
***************
*** 2,7 ****
<?php
! include "config.inc.php";
! include "$baseDIR/misc.inc";
if(!isAdmin())
--- 2,7 ----
<?php
! include "config.inc";
! include "misc.inc";
if(!isAdmin())
***************
*** 13,17 ****
!isset($Comment) ||
!isset($Groups ) ||
! !isset($ID)
)
{
--- 13,17 ----
!isset($Comment) ||
!isset($Groups ) ||
! !isset($Id)
)
{
***************
*** 37,50 ****
}
! // include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
$Comment = addslashes($Comment);
$Caption = addslashes($Caption);
! $ID = addslashes($ID);
! $sql = "UPDATE Images SET Caption='$Caption', Comment='$Comment', ShotAt='$shot_at' WHERE ID=$ID";
if(!dbi_query($sql))
--- 37,50 ----
}
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
$Comment = addslashes($Comment);
$Caption = addslashes($Caption);
! $Id = addslashes($Id);
! $sql = "UPDATE Images SET Caption='$Caption', Comment='$Comment', ShotAt='$shot_at' WHERE Id=$Id";
if(!dbi_query($sql))
***************
*** 56,60 ****
// First, remove all old groups references
! if(!dbi_query("DELETE FROM ImageGroups WHERE ImageID=$ID"))
{
$error = dbi_error ();
--- 56,60 ----
// First, remove all old groups references
! if(!dbi_query("DELETE FROM ImageGroups WHERE ImageId=$Id"))
{
$error = dbi_error ();
***************
*** 65,69 ****
while($i < count($Groups))
{
! $sql="INSERT INTO ImageGroups (ImageID, GroupID) VALUES ($ID, $Groups[$i])";
if(!dbi_query($sql))
{
--- 65,69 ----
while($i < count($Groups))
{
! $sql="INSERT INTO ImageGroups (ImageId, GroupId) VALUES ($Id, $Groups[$i])";
if(!dbi_query($sql))
{
***************
*** 73,77 ****
$i++;
}
! do_redirect("image_detail.php?ID=$ID");
}
}
--- 73,77 ----
$i++;
}
! do_redirect("image_detail.php?Id=$Id");
}
}
***************
*** 92,96 ****
echo $error;
echo "</BLOCKQUOTE>";
! include "footer.inc";
?>
--- 92,97 ----
echo $error;
echo "</BLOCKQUOTE>";
!
! show_footer($INVALID_GID, null);
?>
Index: groups.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/groups.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** groups.php 2001/11/06 21:21:21 1.6
--- groups.php 2001/11/20 19:24:06 1.7
***************
*** 2,9 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
?>
--- 2,9 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
?>
***************
*** 21,31 ****
<TR>
<TH CLASS="tableheader">Group Name</TH>
- <TH CLASS="tableheader">Parent Group</TH>
<TH CLASS="tableheader"># of images</TH>
- <TH CLASS="tableheader">Base Image</TH>
- <TH CLASS="tableheader">Image Megs</TH>
-
<?php
- // <TH CLASS="tableheader">Bytes</TH>
if(isAdmin())
{
--- 21,26 ----
***************
*** 37,149 ****
</TR>
<?php
- // Was working..
- // $sql = "SELECT Groups.ID, Groups.Name, Groups.ParentID, COUNT(ImageGroups.ImageID), InitImageID FROM Groups LEFT JOIN ImageGroups ON (Groups.ID=ImageGroups.GroupID) GROUP BY Groups.ID ORDER BY Groups.ParentID,Groups.Name";
-
- // $sql = "SELECT pg.ID, pg.Name, cg.ParentID, cg.ID, cg.Name, cg.InitImageID FROM Groups pg, Groups cg WHERE cg.ParentID = pg.ID ORDER BY pg.Name, cg.Name";
- // Top-Parent Groups
! $sql = "SELECT Groups.ID, Groups.Name, Groups.ParentID, COUNT(ImageGroups.ImageID), InitImageID FROM Groups LEFT JOIN ImageGroups ON (Groups.ID=ImageGroups.GroupID) WHERE Groups.ParentID = '0' GROUP BY Groups.ID ORDER BY Groups.ParentID,Groups.Name";
$res = dbi_query ( $sql );
$total = 0;
! if ( $res ) {
! echo "<TR><TD COLSPAN=5>Top-Parent Groups</TD><TR>";
! while ( $row = dbi_fetch_row ( $res ) ) {
! echo "<TR><TD CLASS=\"tablecell\">$row[0]: <A HREF=\"show_group.php?ID=$row[0]\">";
! if(strlen($row[1])) {
! $row[1]=stripslashes($row[1]);
! } else {
! $row[1]="UNKNOWN";
! }
! echo $row[1] . "</A>";
! echo "</TD><TD CLASS=\"tablecell\"> $row[2] </TD>";
! echo "<TD CLASS=\"tablecell\"> $row[3] </TD>";
! echo "<TD CLASS=\"tablecell\"> $row[4] </TD>";
! echo "<TD CLASS=\"tablecell\"> </TD>";
! if(isAdmin()) {
! echo "<TD CLASS=\"tablecell\"><A HREF=\"edit_group.php?ID=$row[0]\">[Edit]</A></TD>";
! $del_url="confirm.php?OKURL=" . Rawurlencode("delete_group_handler.php?ID=$row[0]") . "&CANCELURL=" . rawurlencode("groups.php") . "&Question=" . rawurlencode("Are you sure you want to delete group '$row[1]'");
! echo "<TD CLASS=\"tablecell\"><A HREF=\"$del_url\">[Delete]</A></TD>";
! }
! echo "</TR>\n";
! $total+=$row[3];
! }
! dbi_free_result ( $res );
! }
! // Sub-Groups - Calculates Size
! $megs = 0;
! $sql = "SELECT cg.ID, cg.Name, cg.ParentID, count(i.ID), cg.InitImageID, sum(i.Bytes), cg.Name FROM Groups pg, Groups cg, ImageGroups ig, Images i WHERE cg.ParentID = pg.ID AND cg.ID = ig.GroupID AND ig.ImageID = i.ID group by pg.ID, cg.ID ORDER BY pg.ID, cg.Name";
! $megs = 0;
! $res = dbi_query ( $sql );
! if ( $res ) {
! echo "<TR><TD COLSPAN=5>Sub-Groups</TD><TR>";
! while ( $row = dbi_fetch_row ( $res ) ) {
! echo "<TR><TD CLASS=\"tablecell\">$row[0]: <A HREF=\"show_group.php?ID=$row[0]\">";
! if(strlen($row[1])) {
$row[1]=stripslashes($row[1]);
} else {
$row[1]="UNKNOWN";
}
- $bytes = $row[5];
- $megs = $bytes/1048576;
- echo $row[1] . "</A>";
- echo "</TD><TD CLASS=\"tablecell\"> $row[2] </TD>";
- echo "<TD CLASS=\"tablecell\"> $row[3] </TD>";
- echo "<TD CLASS=\"tablecell\"> $row[4] </TD>";
- echo "<TD CLASS=\"tablecell\"> ";
- printf("%.1f",$megs);
- echo " </TD>";
- if(isAdmin()) {
- echo "<TD CLASS=\"tablecell\"><A HREF=\"edit_group.php?ID=$row[0]\">[Edit]</A></TD>";
- $del_url="confirm.php?OKURL=" . Rawurlencode("delete_group_handler.php?ID=$row[0]") . "&CANCELURL=" . rawurlencode("groups.php") . "&Question=" . rawurlencode("Are you sure you want to delete group '$row[1]'");
- echo "<TD CLASS=\"tablecell\"><A HREF=\"$del_url\">[Delete]</A></TD>";
- }
- echo "</TR>\n";
- $total+=$row[3];
- $totalMegs+=$megs;
- }
- dbi_free_result ( $res );
- }
! // Empty Groups
! // $sql = "SELECT Groups.ID, Groups.Name, Groups.ParentID, COUNT(ImageGroups.ImageID) count, InitImageID FROM Groups LEFT JOIN ImageGroups ON (Groups.ID=ImageGroups.GroupID) WHERE count IS NULL GROUP BY Groups.ID ORDER BY Groups.ParentID,Groups.Name";
! $sql = "SELECT Groups.ID, Groups.Name, Groups.ParentID, COUNT(ImageGroups.ImageID) count, InitImageID FROM Groups LEFT OUTER JOIN ImageGroups ON (Groups.ID=ImageGroups.GroupID) WHERE ParentID != '0' AND ImageGroups.GroupID IS NULL GROUP BY Groups.ID ORDER BY Groups.ParentID,Groups.Name";
- $res = dbi_query ( $sql );
- if ( $res ) {
- echo "<TR><TD COLSPAN=5>Empty Groups</TD><TR>";
- while ( $row = dbi_fetch_row ( $res ) ) {
- echo "<TR><TD CLASS=\"tablecell\">$row[0]: <A HREF=\"show_group.php?ID=$row[0]\">";
- if(strlen($row[1])) {
- $row[1]=stripslashes($row[1]);
- } else {
- $row[1]="UNKNOWN";
- }
- echo $row[1] . "</A>";
- echo " </TD><TD CLASS=\"tablecell\">$row[2] </TD>";
- echo "<TD CLASS=\"tablecell\">$row[3] </TD>";
- echo "<TD CLASS=\"tablecell\">$row[4] </TD>";
- echo "<TD CLASS=\"tablecell\"> </TD>";
- if(isAdmin()) {
- echo "<TD CLASS=\"tablecell\"><A HREF=\"edit_group.php?ID=$row[0]\">[Edit]</A></TD>";
- $del_url="confirm.php?OKURL=" . Rawurlencode("delete_group_handler.php?ID=$row[0]") . "&CANCELURL=" . rawurlencode("groups.php") . "&Question=" . rawurlencode("Are you sure you want to delete group '$row[1]'");
echo "<TD CLASS=\"tablecell\"><A HREF=\"$del_url\">[Delete]</A></TD>";
}
echo "</TR>\n";
- $total+=$row[3];
- }
- dbi_free_result ( $res );
- }
! echo "<TR><TD CLASS=\"tablecell\"><I>Total</I></TD><TD CLASS=\"tablecell\"> </TD><TD CLASS=\"tablecell\"><I>$total</I></TD><TD CLASS=\"tablecell\"> </TD><TD CLASS=\"tablecell\"><I>";
! printf("%.1f",$totalMegs);
! echo "</I></TD></TR>";
echo "</TABLE>";
! include "footer.inc";
?>
--- 32,89 ----
</TR>
<?php
! $sql = "SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId GROUP BY Groups.Id ORDER BY Groups.Id";
$res = dbi_query ( $sql );
$total = 0;
! if ( $res )
! {
! while ( $row = dbi_fetch_row ( $res ) )
! {
! echo "<TR>";
! echo "<TD CLASS=\"tablecell\">";
! echo "<A HREF=\"show_group.php?Id=$row[0]\">";
! if(strlen($row[1]))
! {
$row[1]=stripslashes($row[1]);
} else {
$row[1]="UNKNOWN";
}
! echo $row[1];
! echo "</A>";
! echo "</TD>";
! echo "<TD CLASS=\"tablecell\">";
! echo "$row[2]";
! echo "</TD>";
! if(isAdmin())
! {
! echo "<TD CLASS=\"tablecell\"><A HREF=\"edit_group.php?Id=$row[0]\">[Edit]</A></TD>";
!
! $del_url="confirm.php?OKURL=" .
! rawurlencode("delete_group_handler.php?Id=$row[0]") .
! "&CANCELURL=" .
! rawurlencode("show_group.php?Id=-1") .
! "&Question=" .
! rawurlencode("Are you sure you want to delete group '$row[1]'");
echo "<TD CLASS=\"tablecell\"><A HREF=\"$del_url\">[Delete]</A></TD>";
}
+
echo "</TR>\n";
! $total+=$row[2];
! }
! echo "<TR><TD CLASS=\"tablecell\"><I>Total</I></TD><TD CLASS=\"tablecell\"><I>$total</I></TD></TR>";
+ dbi_free_result ( $res );
+ }
echo "</TABLE>";
!
! show_footer($INVALID_GID, null);
?>
Index: image.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/image.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** image.php 2001/11/06 21:21:22 1.13
--- image.php 2001/11/20 19:24:06 1.14
***************
*** 2,29 ****
<?php
! if(!isset($ID))
! {
! die("Need 'ID' parameter");
} else
{
! $ID=addslashes($ID);
}
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
!
! $sql = "SELECT Format,Image FROM Images WHERE ID=$ID";
! $res = dbi_query ( $sql );
! if ( $res )
{
if( $row = dbi_fetch_row ( $res ) )
{
! // Header("Content-type: $row[0]");
! Header("Content-type: image/jpeg");
echo $row[1];
}
dbi_free_result ( $res );
}
?>
--- 2,50 ----
<?php
! $Id=addslashes(substr($PATH_INFO,1));
!
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
!
! $headers = getallheaders();
! $since = $headers["If-Modified-Since"];
!
! if(isset($since))
! {
! $sincets=HTTP11DateParser(trim($since));
} else
{
! $sincets=-1;
}
! if($sincets==-1)
! {
! $sql = "SELECT Format, Image, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images WHERE Id=$Id";
! } else
! {
! $sql = "SELECT Format, Image, UNIX_TIMESTAMP(PublishedAt), Bytes FROM Images WHERE Id=$Id AND UNIX_TIMESTAMP(PublishedAt)>$sincets";
! }
! $found = false;
! $res = dbi_query ( $sql );
! if($res)
{
if( $row = dbi_fetch_row ( $res ) )
{
! Header("Content-type: $row[0]");
! Header("Last-Modified: " . timet2httpdate($row[2]));
! Header("Content-Length: $row[3]");
! $found = true;
echo $row[1];
}
dbi_free_result ( $res );
}
+
+ if(!$found && $sincets!=-1)
+ {
+ header("HTTP/1.1 304 Not Modified");
+ }
+
?>
Index: image_detail.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/image_detail.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** image_detail.php 2001/11/06 21:21:22 1.9
--- image_detail.php 2001/11/20 19:24:06 1.10
***************
*** 10,28 ****
<?php
! if(!isset($ID))
{
! die("Need 'ID' parameter");
} else
{
! $ID=addslashes($ID);
}
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
$found=false;
! if($res=dbi_query("SELECT Caption, Width, Height, Bytes, ShotAt, Comment, Views FROM Images WHERE ID=$ID"))
{
if($row = dbi_fetch_row($res))
--- 10,28 ----
<?php
! if(!isset($Id))
{
! die("Need 'Id' parameter");
} else
{
! $Id=addslashes($Id);
}
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
$found=false;
! if($res=dbi_query("SELECT Caption, Width, Height, Bytes, ShotAt, Comment, Views FROM Images WHERE Id=$Id"))
{
if($row = dbi_fetch_row($res))
***************
*** 31,35 ****
$caption=stripslashes($row[0]);
echo "<H1 CLASS=\"title\">" . $caption . "</H1>\n";
! echo "<IMG SRC=image.php?ID=$ID>";
echo "<hr>\n";
--- 31,35 ----
$caption=stripslashes($row[0]);
echo "<H1 CLASS=\"title\">" . $caption . "</H1>\n";
! echo "<IMG SRC=image.php/$Id>";
echo "<hr>\n";
***************
*** 56,60 ****
dbi_free_result ( $res );
! if($res = dbi_query("SELECT ImageGroups.GroupID, Groups.Name FROM ImageGroups,Groups WHERE ImageGroups.ImageID=$ID AND ImageGroups.GroupID=Groups.ID;"))
{
echo "<TR><TD CLASS=\"tablecell\">Groups:</TD><TD CLASS=\"tablecell\">";
--- 56,60 ----
dbi_free_result ( $res );
! if($res = dbi_query("SELECT ImageGroups.GroupId, Groups.Name FROM ImageGroups,Groups WHERE ImageGroups.ImageId=$Id AND ImageGroups.GroupId=Groups.Id;"))
{
echo "<TR><TD CLASS=\"tablecell\">Groups:</TD><TD CLASS=\"tablecell\">";
***************
*** 64,68 ****
if($ng!=0)
echo ", ";
! echo "<A HREF=\"show_group.php?ID=$row[0]\">". stripslashes($row[1]) . "</A>";
$ng++;
}
--- 64,68 ----
if($ng!=0)
echo ", ";
! echo "<A HREF=\"show_group.php?Id=$row[0]\">". stripslashes($row[1]) . "</A>";
$ng++;
}
***************
*** 80,90 ****
if(isAdmin())
{
! echo "<p CLASS=navigation>Operations: ";
! echo "<A HREF=\"edit_image.php?ID=$ID\">[Edit]</A>, ";
$del_url="confirm.php?OKURL=" .
! rawurlencode("delete_image_handler.php?ID=$ID") .
"&CANCELURL=" .
! rawurlencode("image_detail.php?ID=$ID") .
"&Question=" .
rawurlencode("Are you sure you want to delete image '$caption'");
--- 80,90 ----
if(isAdmin())
{
! echo "<p CLASS=navigation>Image: ";
! echo "<A HREF=\"edit_image.php?Id=$Id\">[Edit]</A>, ";
$del_url="confirm.php?OKURL=" .
! rawurlencode("delete_image_handler.php?Id=$Id") .
"&CANCELURL=" .
! rawurlencode("image_detail.php?Id=$Id") .
"&Question=" .
rawurlencode("Are you sure you want to delete image '$caption'");
***************
*** 97,101 ****
if(!isAdmin() && $found)
{
! dbi_query ("UPDATE Images SET Views=Views+1 WHERE ID=$ID");
}
}
--- 97,101 ----
if(!isAdmin() && $found)
{
! dbi_query ("UPDATE Images SET Views=Views+1 WHERE Id=$Id");
}
}
***************
*** 106,110 ****
}
! include "footer.inc";
?>
--- 106,111 ----
}
!
! show_footer($INVALID_GID, null);
?>
Index: login.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/login.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** login.php 2001/11/06 21:21:22 1.3
--- login.php 2001/11/20 19:24:06 1.4
***************
*** 2,9 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
?>
--- 2,9 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
?>
***************
*** 30,33 ****
<?php
! include "footer.inc";
?>
--- 30,34 ----
<?php
!
! show_footer($INVALID_GID, null);
?>
Index: login_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/login_handler.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** login_handler.php 2001/11/06 21:21:22 1.6
--- login_handler.php 2001/11/20 19:24:06 1.7
***************
*** 2,33 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
! if($Password == $admin_password)
{
setcookie("photoarchive_admin", md5($GLOBALS["admin_password"]), time()+3600*12); //Expire in 12 hours
- do_redirect("groups.php");
}
-
- ?>
-
- <HTML>
- <HEAD>
- <TITLE>Login Failed</TITLE>
- <?php include "styles.inc"; ?>
- </HEAD>
- <BODY CLASS=body>
-
- <H1>Login failed</H1>
-
- <p class="error">Sorry, but password you've submitted is incorrect. Please try again!
-
- <?php
- include "footer.inc";
?>
-
--- 2,23 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
! if($Password != $admin_password)
! {
! do_redirect("login.php");
! }
! else if ($Password == $admin_password)
{
setcookie("photoarchive_admin", md5($GLOBALS["admin_password"]), time()+3600*12); //Expire in 12 hours
}
?>
+ <SCRIPT LANGUAGE="JavaScript">
+ document.cookie = 'Authenticated=1';
+ location.href="groups.php";
+ </SCRIPT>
Index: logout_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/logout_handler.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** logout_handler.php 2001/11/06 21:21:22 1.3
--- logout_handler.php 2001/11/20 19:24:06 1.4
***************
*** 2,11 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
setcookie("photoarchive_admin");
! do_redirect("groups.php");
?>
--- 2,11 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
setcookie("photoarchive_admin");
! do_redirect("show_group.php?Id=-1");
?>
Index: misc.inc
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/misc.inc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** misc.inc 2001/11/06 21:21:22 1.13
--- misc.inc 2001/11/20 19:24:06 1.14
***************
*** 1,5 ****
<?php
! // $ID: misc.inc,v 1.4 2000/07/21 19:12:00 lord Exp $
// send a redirect to the specified page
--- 1,5 ----
<?php
! // $Id$
// send a redirect to the specified page
***************
*** 36,95 ****
{
echo "<br><TABLE><TR><TD class=\"description\"><pre>$gcomment</pre></TD></TR></TABLE>\n";
! }
}
// Shows sequence of images
// 'sql' must produce following data:
! // Images.ID, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views
! function list_images($sql, $maxn)
{
$t = 0;
if($res = dbi_query($sql))
{
- $n = 0;
while($row=dbi_fetch_row($res))
{
- if($t==0)
- {
- echo "<TABLE>\n";
- }
-
if($n==0)
{
echo "<TR>";
}
! echo "<TD>";
! if(isAdmin()) {
! echo "<TABLE CLASS=\"imagebox\" BORDER=\"1\">";
! echo "<TR><TD align=\"center\">";
}
! echo "<A HREF=\"image_detail.php?ID=$row[0]\">";
! echo "<IMG SRC=\"thumbnail.php?ID=$row[0]\"></A>";
! if(isAdmin()) {
! echo "</TD></TR>";
! echo "<TR><TD>";
! echo "<B>Title: </B>";
! if(strlen($row[1])) {
! echo stripslashes($row[1]);
! } else {
! echo "UNKNOWN";
! }
! echo "</TD></TR>";
! echo "<TR><TD>";
! echo "<B>Pixels: </B>$row[2] x $row[3]";
! echo "</TD></TR>";
! echo "<TR><TD>";
! echo "<B>Bytes: </B>$row[4]";
! echo "</TD></TR>";
! echo "<TR><TD>";
! echo "<B>Views: </B>$row[5]";
! echo "</TD></TR>";
! echo "</TABLE></TD>\n";
}
$n++;
if($n==$GLOBALS["thumbnails_per_row"])
{
! echo "</TR>";
$n=0;
}
--- 36,119 ----
{
echo "<br><TABLE><TR><TD class=\"description\"><pre>$gcomment</pre></TD></TR></TABLE>\n";
! }
! echo "<BR><TABLE CLASS=\"imagegrid\" BORDER=\"1\">\n";
}
+ function end_group_page($off)
+ {
+ echo "</TABLE>\n";
+ }
+
// Shows sequence of images
// 'sql' must produce following data:
! // Images.Id, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views
! function list_images($sql, $maxn, $MyId, $n)
{
$t = 0;
if($res = dbi_query($sql))
{
while($row=dbi_fetch_row($res))
{
if($n==0)
{
echo "<TR>";
}
!
! echo "<TD CLASS=\"imagebox\"><TABLE width=\"100%\">";
! echo "<TR><TD align=\"center\">";
! echo "<A HREF=\"image_detail.php?Id=$row[0]\">";
! echo "<IMG SRC=\"thumbnail.php/$row[0]\"></A>";
! echo "</TD></TR>";
!
! echo "<TR><TD>";
! echo "<B>Title: </B>";
! if(strlen($row[1]))
! {
! echo stripslashes($row[1]);
! } else
! {
! echo "UNKNOWN";
}
! echo "</TD></TR>";
!
! echo "<TR><TD>";
! echo "<B>Pixels: </B>$row[2] x $row[3]";
! echo "</TD></TR>";
!
! echo "<TR><TD>";
! echo "<B>Bytes: </B>$row[4]";
! echo "</TD></TR>";
!
! if(isAdmin())
! {
! echo "<TR><TD>";
! echo "<B>Views: </B>$row[5]";
! echo "</TD></TR>";
!
! echo "<TR><TD>";
! echo "<p CLASS=navigation>Operations: ";
! echo "<A HREF=\"edit_image.php?Id=$row[0]\">[Edit]</A>";
!
! $del_url="confirm.php?OKURL=" .
! rawurlencode("delete_image_handler.php?Id=$row[0]") .
! "&CANCELURL=" .
! rawurlencode("show_group.php?Id=$MyId") .
! "&Question=" .
! rawurlencode("Are you sure you want to delete image '$caption'");
!
!
! echo ", <A HREF=\"$del_url\">[Delete]</A>";
! echo ", <A HREF=\"image_detail.php?Id=$row[0]\">[Show]</A>";
! echo "</TD></TR>";
!
}
+
+ echo "</TABLE></TD>\n";
+
$n++;
if($n==$GLOBALS["thumbnails_per_row"])
{
! echo "</tr>";
$n=0;
}
***************
*** 101,122 ****
}
dbi_free_result ( $res );
- if($n!=0)
- {
- echo "</TR>";
- }
}
! if($t!=0)
{
! echo "</TABLE>\n";
! } else
{
! echo "\n<!-- No Images Found -->\n";
}
! return $t;
}
function keyword2LIKEpattern($Keyword)
{
return "%". str_replace("_", "\\_", str_replace("%", "\\%", $Keyword)) . "%";
}
--- 125,351 ----
}
dbi_free_result ( $res );
}
! return $n;
! }
!
! // Shows sequence of images
! // 'sql' must produce following data:
! // Groups.Id, Groups.Name, Groups.Counter
! function list_groups($sql, $MyId, $parentg, $n)
! {
! if($parentg!=$MyId)
{
! if($n==0)
! echo "<tr>\n";
!
! echo "<TD CLASS=\"groupbox\"><TABLE width=\"100%\">";
! echo "<TR><TD align=\"center\">";
! echo "<A HREF=\"show_group.php?Id=$parentg\">";
! echo "<IMG SRC=\"group.jpg\"></A>";
! echo "</TD></TR>";
! echo "<TR><TD>";
! echo "<B>Parent</B>";
! echo "</TD></TR></TABLE></TD>";
!
! $n++;
! }
!
! if($res = dbi_query($sql))
{
! while($row=dbi_fetch_row($res))
! {
! if($n==0)
! {
! echo "<TR>\n";
! }
!
! echo "<TD CLASS=\"groupbox\"><TABLE width=\"100%\">";
! echo "<TR><TD align=\"center\">";
! echo "<A HREF=\"show_group.php?Id=$row[0]\">";
! echo "<IMG SRC=\"group.jpg\"></A>";
! echo "</TD></TR>";
!
! echo "<TR><TD>";
! echo "<B>Name: </B>";
! if(strlen($row[1]))
! {
! echo stripslashes($row[1]);
! } else
! {
! echo "UNKNOWN";
! }
! echo "</TD></TR>";
!
! echo "<TR><TD>";
! echo "<B>Images: </B>$row[2]";
! echo "</TD></TR>";
!
! if(isAdmin())
! {
! echo "<TR><TD>";
!
!
! echo "<p CLASS=navigation>Operations: ";
! echo "<A HREF=\"edit_group.php?Id=$row[0]\">[Edit]</A>";
!
! $del_url="confirm.php?OKURL=" .
! rawurlencode("delete_group_handler.php?Id=$row[0]") .
! "&CANCELURL=" .
! rawurlencode("show_group.php?Id=$MyId") .
! "&Question=" .
! rawurlencode("Are you sure you want to delete group '$row[1]'");
!
! echo ", <A HREF=\"$del_url\">[Delete]</A>";
! echo ", <A HREF=\"show_group.php?Id=$row[0]\">[Show]</A>";
! echo "</TD></TR>";
! }
!
!
! echo "</TABLE></TD>\n";
!
! $n++;
!
! if($n==$GLOBALS["thumbnails_per_row"])
! {
! echo "</tr>\n";
! $n=0;
! }
! }
! dbi_free_result ( $res );
}
!
! return $n;
}
+
function keyword2LIKEpattern($Keyword)
{
return "%". str_replace("_", "\\_", str_replace("%", "\\%", $Keyword)) . "%";
+ }
+
+ // Returns date formatted according to RFC 2616.
+ // e.g. Tue, 01 Aug 2000 18:08:06 GMT
+ function timet2httpdate($t)
+ {
+ setlocale(LC_TIME, "C");
+ return gmstrftime("%a, %d %b %Y %H:%M:%S GMT", $t);
+ }
+
+ // Return number of month (1-12)
+ // from it's abbreviation like 'Apr'.
+ function abbr_month($a)
+ {
+ $m = array (
+ "Jan" => 1,
+ "Feb" => 2,
+ "Mar" => 3,
+ "Apr" => 4,
+ "May" => 5,
+ "Jun" => 6,
+ "Jul" => 7,
+ "Aug" => 8,
+ "Sep" => 9,
+ "Oct" => 10,
+ "Nov" => 11,
+ "Dec" => 12
+ );
+ return $m[$a];
+ }
+
+ // This function parses date as it
+ // defined in rfc 2616
+ // 3 basic formats are understood:
+ //
+ // Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
+ // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
+ // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
+ //
+ // Returns value as unix timestamp or -1 is parsing failed.
+ //
+ function HTTP11DateParser($s)
+ {
+ if(preg_match("/^[A-Z][a-z][a-z]\, (\d\d) ([A-Z][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$/", $s, $p))
+ {
+ $m=abbr_month($p[2]);
+ if(!isset($m))
+ return -1;
+ return gmmktime($p[4], $p[5], $p[6], $m, $p[1], $p[3]);
+
+ } else if(preg_match("/^[A-Z][a-z]+\, (\d\d)-([A-Z][a-z][a-z])-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/", $s, $p))
+ {
+ $m=abbr_month($p[2]);
+ if(!isset($m))
+ return -1;
+ return gmmktime($p[4], $p[5], $p[6], $m, $p[1], $p[3]);
+ } else if(preg_match("/^[A-Z][a-z][a-z] ([A-Z][a-z][a-z]) \s?(\d+) (\d\d):(\d\d):(\d\d) (\d\d\d\d)$/", $s, $p))
+ {
+ $m=abbr_month($p[1]);
+ if(!isset($m))
+ return -1;
+ return gmmktime($p[3], $p[4], $p[5], $m, $p[2], $p[6]);
+ } else
+ {
+ return -1;
+ }
+ }
+
+ // -- Constants --
+
+ $TOP_GID = -1;
+ $INVALID_GID = -2;
+
+ // -- Footer --
+
+ function show_footer ($Id, $gname)
+ {
+ echo "<HR>";
+ echo "<p CLASS=navigation>";
+
+ echo "Goto: <a href=\"show_group.php?Id=-1\">[Top Group]</a>";
+ if(isAdmin())
+ {
+ echo ", <A HREF=\"top10.php\">[Most Popular]</A>";
+ echo ", <A HREF=\"stats.php\">[Statistics]</A>";
+ }
+
+ echo "<p CLASS=navigation>";
+ echo "Operations: ";
+ echo "<A HREF=\"search.php\">[Global Search]</A>";
+ if(isAdmin())
+ {
+ if($Id!=$GLOBALS["INVALID_GID"])
+ {
+ // In any valid group (including top you can do this):
+
+ echo ", <A HREF=\"upload_image.php\">[Upload Image To Current Group]</A>";
+ echo ", <A HREF=\"edit_group.php\">[New Child Group]</A>";
+
+ if($Id!=$GLOBALS["TOP_GID"])
+ {
+ // In any valid group (excluding top you can do this):
+
+ echo ", <A HREF=\"edit_group.php?Id=$Id\">[Edit Current Group]</A>";
+
+ $del_url="confirm.php?OKURL=" .
+ rawurlencode("delete_group_handler.php?Id=$Id") .
+ "&CANCELURL=" .
+ rawurlencode("show_group.php?Id=$Id") .
+ "&Question=" .
+ rawurlencode("Are you sure you want to delete group '$gname'");
+ echo ", <A HREF=\"$del_url\">[Delete Current Group]</A>";
+ }
+ }
+
+ echo ", <A HREF=\"logout_handler.php\">[Logout]</A>";
+ } else
+ {
+ echo ", <A HREF=\"login.php\">[Login]</A>";
+ }
+
+ echo "</p>";
+ echo "<p class=copyright>Generated By: <a href=\"$PROGRAM_URL\">$PROGRAM_NAME</a> © Copyright 2000, Vadim Zaliva <lo...@cr...></p>";
+
+ echo "</BODY>";
+ echo "</HTML>";
}
Index: search.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/search.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** search.php 2001/11/06 21:21:22 1.3
--- search.php 2001/11/20 19:24:06 1.4
***************
*** 2,9 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
?>
--- 2,9 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
?>
***************
*** 58,61 ****
<?php
! include "footer.inc";
?>
--- 58,62 ----
<?php
!
! show_footer($INVALID_GID, null);
?>
Index: search_handler.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/search_handler.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** search_handler.php 2001/11/06 21:21:22 1.4
--- search_handler.php 2001/11/20 19:24:06 1.5
***************
*** 2,9 ****
<?php
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
if(!isset($Keyword) || $Keyword=='')
--- 2,9 ----
<?php
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
if(!isset($Keyword) || $Keyword=='')
***************
*** 27,31 ****
start_group_page("Search results", "Results of search for: <b><pre>$Keyword</pre></b>");
! $sql = "select ID, Caption, Width, Height, Bytes, Views from Images WHERE ";
$pattern=keyword2LIKEpattern($Keyword);
--- 27,31 ----
start_group_page("Search results", "Results of search for: <b><pre>$Keyword</pre></b>");
! $sql = "select Id, Caption, Width, Height, Bytes, Views from Images WHERE ";
$pattern=keyword2LIKEpattern($Keyword);
***************
*** 43,48 ****
$sql = $sql . " ORDER BY Images.ShotAt";
! list_images($sql, $MaxMatches);
! include "footer.inc";
?>
--- 43,49 ----
$sql = $sql . " ORDER BY Images.ShotAt";
! list_images($sql, $MaxMatches, -1);
!
! show_footer($INVALID_GID, null);
?>
Index: show_group.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/show_group.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** show_group.php 2001/11/06 21:21:22 1.10
--- show_group.php 2001/11/20 19:24:06 1.11
***************
*** 2,63 ****
<?php
! if(!isset($ID))
{
! die("Need 'ID' parameter");
} else
{
! $ID = addslashes($ID);
}
! include "config.inc.php";
! include "$baseDIR/php-dbi.inc";
! include "$baseDIR/connect.inc";
! include "$baseDIR/misc.inc";
?>
<?php
- $gname = "Unnamed Group";
-
- // $sql = "SELECT Groups.Name, Groups.Comment, SUM(Images.Views) FROM Groups, Images, ImageGroups WHERE ImageGroups.GroupID=$ID AND Groups.ID=$ID";
-
- $sql = "SELECT Name, Comment FROM Groups WHERE ID=$ID";
! if($res = dbi_query($sql))
{
! if($row = dbi_fetch_row ( $res ))
! {
! $gname = stripslashes($row[0]);
! $gcomment = stripslashes($row[1]);
! $gbytes = stripslashes($row[2]);
! // echo "@@@$gname $gcomment $gbytes";
! }
! dbi_free_result ( $res );
}
start_group_page($gname, $gcomment);
-
- $sql = "SELECT Images.ID, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views FROM ImageGroups, Images WHERE ImageGroups.GroupID=$ID AND Images.ID=ImageGroups.ImageID ORDER BY Images.ShotAt";
! // echo $sql;
! list_images($sql, -1);
! if(isAdmin())
{
! echo "<p CLASS=navigation>Operations: ";
! echo "<A HREF=\"edit_group.php?ID=$ID\">[Edit]</A>, ";
!
! $del_url="confirm.php?OKURL=" .
! rawurlencode("delete_group_handler.php?ID=$ID") .
! "&CANCELURL=" .
! rawurlencode("show_group.php?ID=$ID") .
! "&Question=" .
! rawurlencode("Are you sure you want to delete group '$gname'");
! echo "<A HREF=\"$del_url\">[Delete]</A>";
! echo "</p>";
}
! include "footer.inc";
?>
--- 2,68 ----
<?php
! if(!isset($Id))
{
! $Id=-1;
} else
{
! $Id = addslashes($Id);
}
! include "config.inc";
! include "php-dbi.inc";
! include "connect.inc";
! include "misc.inc";
?>
<?php
! if($Id!=-1)
{
! $gname = "Unnamed group";
! $parentg = -1;
! if($res = dbi_query("SELECT Name, Comment, ParentGroupId FROM Groups WHERE Id=$Id"))
! {
! if($row = dbi_fetch_row ( $res ))
! {
! $gname = stripslashes($row[0]);
! $gcomment = stripslashes($row[1]);
! if($row[2]==null || $row[2]=="")
! {
! $parentg = -1;
! } else
! {
! $parentg = stripslashes($row[2]);
! }
! }
! dbi_free_result ( $res );
! }
! } else
! {
! $gname = "Top group";
! $parentg = -1;
}
start_group_page($gname, $gcomment);
! if($Id!=-1)
! {
! $sql = "SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId WHERE Groups.ParentGroupId=$Id GROUP BY Groups.Id, Groups.Name";
! } else {
! $sql = "SELECT Groups.Id, Groups.Name, COUNT(ImageGroups.ImageId) FROM Groups LEFT JOIN ImageGroups ON Groups.Id=ImageGroups.GroupId WHERE ParentGroupId IS NULL GROUP BY Groups.Id ORDER BY Groups.Id";
! }
! $off = list_groups($sql, $Id, $parentg, 0);
! if($Id!=-1)
{
! $sql = "select Images.Id, Images.Caption, Images.Width, Images.Height, Images.Bytes, Images.Views from Images, ImageGroups WHERE ImageGroups.GroupId=$Id AND Images.Id=ImageGroups.ImageId ORDER BY Images.ShotAt";
! $off = list_images($sql, -1, $Id, $off);
}
+ end_group_page($off);
!
! show_footer($Id, null);
?>
Index: styles.inc
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/styles.inc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** styles.inc 2001/11/06 21:21:22 1.4
--- styles.inc 2001/11/20 19:24:06 1.5
***************
*** 1,4 ****
--- 1,5 ----
<STYLE type="text/css">
<!--
+
.body {
color: #000000;
***************
*** 6,9 ****
--- 7,11 ----
text-decoration: none;
}
+
.tablecell {
color: #000000;
***************
*** 11,18 ****
--- 13,22 ----
background-color: #FFFFFF;
}
+
.tableheader {
color: #FFFFFF;
background-color: #000000;
}
+
.imagebox {
color: #000000;
***************
*** 20,23 ****
--- 24,40 ----
background-color: #E7E7E7;
}
+
+ .groupbox {
+ color: #000000;
+ text-decoration: none;
+ background-color: #CCCCCC;
+ }
+
+ .imagegrid {
+ color: #000000;
+ text-decoration: none;
+ background-color: #E7E7E7;
+ }
+
.navigation {
color: #6666CC;
Index: thumbnail.php
===================================================================
RCS file: /cvsroot/photoarchive/photoarchive/thumbnail.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** thumbnail.php 2001/11/06 21:21:22 1.10
--- thumbnail.php 2001/11/20 19:24:06 1.11
***************
*** 2,19 ****
<?php
! if(!isset($ID))
! {
! die("Need 'ID' parameter");
} else
{
! $ID=addslashes($ID);
}
! include "config.i...
[truncated message content] |