Changeset 590
- Timestamp:
- 02/18/09 14:09:39 (3 years ago)
- Location:
- trunk
- Files:
-
- 22 added
- 6 deleted
- 84 edited
- 1 moved
-
LICENSE.txt (modified) (1 diff)
-
gallery.php (modified) (1 diff)
-
index.php (modified) (1 diff)
-
plog-admin/_install.php (modified) (4 diffs)
-
plog-admin/_upgrade.php (modified) (9 diffs)
-
plog-admin/css/admin.css (modified) (24 diffs)
-
plog-admin/css/lightbox.css (modified) (1 diff)
-
plog-admin/css/login.css (modified) (4 diffs)
-
plog-admin/css/tabs.css (deleted)
-
plog-admin/images/blue-button-bg.gif (added)
-
plog-admin/images/button-bg.gif (deleted)
-
plog-admin/images/close.gif (deleted)
-
plog-admin/images/green-button-bg.gif (added)
-
plog-admin/images/info.gif (added)
-
plog-admin/images/plogger-box-add-green.png (deleted)
-
plog-admin/images/plogger-box-add.png (deleted)
-
plog-admin/images/success.gif (added)
-
plog-admin/includes/install-form-setup-complete.php (deleted)
-
plog-admin/includes/install-form-setup.php (modified) (5 diffs)
-
plog-admin/includes/install-functions.php (modified) (61 diffs)
-
plog-admin/index.php (modified) (8 diffs)
-
plog-admin/js/plogger.js (modified) (3 diffs)
-
plog-admin/plog-admin-functions.php (modified) (80 diffs)
-
plog-admin/plog-admin.php (modified) (13 diffs)
-
plog-admin/plog-feedback.php (modified) (11 diffs)
-
plog-admin/plog-import.php (modified) (20 diffs)
-
plog-admin/plog-manage.php (modified) (20 diffs)
-
plog-admin/plog-options.php (modified) (5 diffs)
-
plog-admin/plog-plugins.php (added)
-
plog-admin/plog-rpc.php (modified) (7 diffs)
-
plog-admin/plog-themes.php (modified) (3 diffs)
-
plog-admin/plog-thumb.php (modified) (1 diff)
-
plog-admin/plog-thumbpopup.php (modified) (2 diffs)
-
plog-admin/plog-upload.php (modified) (5 diffs)
-
plog-comment.php (moved) (moved from trunk/plog-includes/plog-comment.php) (1 diff)
-
plog-config-sample.php (modified) (1 diff)
-
plog-content/plugins (added)
-
plog-content/plugins/index.php (added)
-
plog-content/plugins/latest-comments (added)
-
plog-content/plugins/latest-comments/latest-comments.php (added)
-
plog-content/plugins/latest-comments/meta.php (added)
-
plog-content/plugins/latest-comments/readme.txt (added)
-
plog-content/plugins/latest-images (added)
-
plog-content/plugins/latest-images/latest-images.php (added)
-
plog-content/plugins/latest-images/meta.php (added)
-
plog-content/plugins/latest-images/readme.txt (added)
-
plog-content/plugins/random-images (added)
-
plog-content/plugins/random-images/meta.php (added)
-
plog-content/plugins/random-images/random-images.php (added)
-
plog-content/plugins/random-images/readme.txt (added)
-
plog-content/themes/air/album.php (modified) (1 diff)
-
plog-content/themes/air/collection.php (modified) (1 diff)
-
plog-content/themes/air/collections.php (modified) (1 diff)
-
plog-content/themes/air/comments.php (modified) (4 diffs)
-
plog-content/themes/air/dynamics.js (modified) (4 diffs)
-
plog-content/themes/air/footer.php (modified) (2 diffs)
-
plog-content/themes/air/gallery.css (modified) (5 diffs)
-
plog-content/themes/air/head.php (modified) (1 diff)
-
plog-content/themes/air/header.php (modified) (1 diff)
-
plog-content/themes/air/meta.php (modified) (1 diff)
-
plog-content/themes/air/picture.php (modified) (5 diffs)
-
plog-content/themes/air/search.php (modified) (1 diff)
-
plog-content/themes/air/slideshow.php (modified) (2 diffs)
-
plog-content/themes/air/theme_functions.php (modified) (1 diff)
-
plog-content/themes/default/album.php (modified) (1 diff)
-
plog-content/themes/default/collection.php (modified) (1 diff)
-
plog-content/themes/default/collections.php (modified) (1 diff)
-
plog-content/themes/default/comments.php (modified) (3 diffs)
-
plog-content/themes/default/dynamics.js (modified) (4 diffs)
-
plog-content/themes/default/footer.php (modified) (2 diffs)
-
plog-content/themes/default/gallery.css (modified) (10 diffs)
-
plog-content/themes/default/images/blue-button-bg.gif (added)
-
plog-content/themes/default/meta.php (modified) (1 diff)
-
plog-content/themes/default/picture.php (modified) (4 diffs)
-
plog-content/themes/default/search.php (modified) (1 diff)
-
plog-content/themes/default/slideshow.php (modified) (3 diffs)
-
plog-content/themes/default/theme_functions.php (modified) (1 diff)
-
plog-content/themes/lucid/album.php (modified) (1 diff)
-
plog-content/themes/lucid/collection.php (modified) (1 diff)
-
plog-content/themes/lucid/collections.php (modified) (1 diff)
-
plog-content/themes/lucid/comments.php (modified) (2 diffs)
-
plog-content/themes/lucid/dynamics.js (modified) (4 diffs)
-
plog-content/themes/lucid/footer.php (modified) (1 diff)
-
plog-content/themes/lucid/gallery.css (modified) (3 diffs)
-
plog-content/themes/lucid/head.php (modified) (1 diff)
-
plog-content/themes/lucid/meta.php (modified) (1 diff)
-
plog-content/themes/lucid/picture.php (modified) (2 diffs)
-
plog-content/themes/lucid/search.php (modified) (1 diff)
-
plog-content/themes/lucid/slideshow.php (modified) (2 diffs)
-
plog-content/themes/lucid/theme_functions.php (modified) (1 diff)
-
plog-download.php (modified) (10 diffs)
-
plog-globals.php (modified) (3 diffs)
-
plog-includes/lib/exifer1_7/exif.php (modified) (29 diffs)
-
plog-includes/lib/exifer1_7/makers/canon.php (modified) (28 diffs)
-
plog-includes/lib/exifer1_7/makers/fujifilm.php (modified) (4 diffs)
-
plog-includes/lib/exifer1_7/makers/gps.php (modified) (8 diffs)
-
plog-includes/lib/exifer1_7/makers/nikon.php (modified) (6 diffs)
-
plog-includes/lib/exifer1_7/makers/olympus.php (modified) (3 diffs)
-
plog-includes/lib/exifer1_7/makers/panasonic.php (modified) (4 diffs)
-
plog-includes/lib/exifer1_7/makers/sanyo.php (modified) (4 diffs)
-
plog-includes/lib/phpthumb/fonts/index.php (added)
-
plog-includes/lib/phpthumb/phpThumb.config.php (modified) (1 diff)
-
plog-includes/plog-captcha.php (modified) (10 diffs)
-
plog-includes/plog-functions.php (modified) (134 diffs)
-
plog-load-config.php (modified) (10 diffs)
-
plog-print.php (modified) (2 diffs)
-
plog-remote.php (modified) (3 diffs)
-
plog-rss.php (modified) (12 diffs)
-
plog-thumb.php (modified) (3 diffs)
-
plog-xml.php (modified) (27 diffs)
-
plogger.php (modified) (9 diffs)
-
readme.html (added)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LICENSE.txt
r124 r590 1 GNU GENERAL PUBLIC LICENSE 2 Version 2, June 1991 3 4 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 6 Everyone is permitted to copy and distribute verbatim copies 7 of this license document, but changing it is not allowed. 8 9 Preamble 10 11 The licenses for most software are designed to take away your 12 freedom to share and change it. By contrast, the GNU General Public 13 License is intended to guarantee your freedom to share and change free 14 software--to make sure the software is free for all its users. This 15 General Public License applies to most of the Free Software 16 Foundation's software and to any other program whose authors commit to 17 using it. (Some other Free Software Foundation software is covered by 18 the GNU Library General Public License instead.) You can apply it to 19 your programs, too. 20 21 When we speak of free software, we are referring to freedom, not 22 price. Our General Public Licenses are designed to make sure that you 23 have the freedom to distribute copies of free software (and charge for 24 this service if you wish), that you receive source code or can get it 25 if you want it, that you can change the software or use pieces of it 26 in new free programs; and that you know you can do these things. 27 28 To protect your rights, we need to make restrictions that forbid 29 anyone to deny you these rights or to ask you to surrender the rights. 30 These restrictions translate to certain responsibilities for you if you 1 GNU GENERAL PUBLIC LICENSE 2 Version 2, June 1991 3 4 Copyright (C) 1989, 1991 5 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 6 7 Everyone is permitted to copy and distribute verbatim copies of this license document, but 8 changing it is not allowed. 9 10 Preamble 11 12 The licenses for most software are designed to take away your freedom to share and change it. 13 By contrast, the GNU General Public License is intended to guarantee your freedom to share and 14 change free software--to make sure the software is free for all its users. This General Public License 15 applies to most of the Free Software Foundation's software and to any other program whose authors 16 commit to using it. (Some other Free Software Foundation software is covered by the GNU Library 17 General Public License instead.) You can apply it to your programs, too. 18 19 When we speak of free software, we are referring to freedom, not price. Our General Public Licenses 20 are designed to make sure that you have the freedom to distribute copies of free software (and charge 21 for this service if you wish), that you receive source code or can get it if you want it, that you can 22 change the software or use pieces of it in new free programs; and that you know you can do these 23 things. 24 25 To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to 26 ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you 31 27 distribute copies of the software, or if you modify it. 32 28 33 For example, if you distribute copies of such a program, whether 34 gratis or for a fee, you must give the recipients all the rights that 35 you have. You must make sure that they, too, receive or can get the 36 source code. And you must show them these terms so they know their 37 rights. 38 39 We protect your rights with two steps: (1) copyright the software, and 40 (2) offer you this license which gives you legal permission to copy, 41 distribute and/or modify the software. 42 43 Also, for each author's protection and ours, we want to make certain 44 that everyone understands that there is no warranty for this free 45 software. If the software is modified by someone else and passed on, we 46 want its recipients to know that what they have is not the original, so 47 that any problems introduced by others will not reflect on the original 48 authors' reputations. 49 50 Finally, any free program is threatened constantly by software 51 patents. We wish to avoid the danger that redistributors of a free 52 program will individually obtain patent licenses, in effect making the 53 program proprietary. To prevent this, we have made it clear that any 54 patent must be licensed for everyone's free use or not licensed at all. 55 56 The precise terms and conditions for copying, distribution and 57 modification follow. 29 For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the 30 recipients all the rights that you have. You must make sure that they, too, receive or can get the 31 source code. And you must show them these terms so they know their rights. 32 33 We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which 34 gives you legal permission to copy, distribute and/or modify the software. 35 36 Also, for each author's protection and ours, we want to make certain that everyone understands that 37 there is no warranty for this free software. If the software is modified by someone else and passed on, 38 we want its recipients to know that what they have is not the original, so that any problems introduced 39 by others will not reflect on the original authors' reputations. 40 41 Finally, any free program is threatened constantly by software patents. We wish to avoid the danger 42 that redistributors of a free program will individually obtain patent licenses, in effect making the program 43 proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free 44 use or not licensed at all. 45 46 The precise terms and conditions for copying, distribution and modification follow. 47 48 GNU GENERAL PUBLIC LICENSE 49 50 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 51 52 0. This License applies to any program or other work which contains a notice placed by the copyright 53 holder saying it may be distributed under the terms of this General Public License. The "Program", below, 54 refers to any such program or work, and a "work based on the Program" means either the Program or 55 any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, 56 either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is 57 included without limitation in the term "modification".) Each licensee is addressed as "you". 58 59 Activities other than copying, distribution and modification are not covered by this License; they are 60 outside its scope. The act of running the Program is not restricted, and the output from the Program 61 is covered only if its contents constitute a work based on the Program (independent of having been 62 made by running the Program). Whether that is true depends on what the Program does. 63 64 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any 65 medium, provided that you conspicuously and appropriately publish on each copy an appropriate copy- 66 right notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the 67 absence of any warranty; and give any other recipients of the Program a copy of this License along with 68 the Program. 58 69 59 GNU GENERAL PUBLIC LICENSE 60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 62 0. This License applies to any program or other work which contains 63 a notice placed by the copyright holder saying it may be distributed 64 under the terms of this General Public License. The "Program", below, 65 refers to any such program or work, and a "work based on the Program" 66 means either the Program or any derivative work under copyright law: 67 that is to say, a work containing the Program or a portion of it, 68 either verbatim or with modifications and/or translated into another 69 language. (Hereinafter, translation is included without limitation in 70 the term "modification".) Each licensee is addressed as "you". 71 72 Activities other than copying, distribution and modification are not 73 covered by this License; they are outside its scope. The act of 74 running the Program is not restricted, and the output from the Program 75 is covered only if its contents constitute a work based on the 76 Program (independent of having been made by running the Program). 77 Whether that is true depends on what the Program does. 78 79 1. You may copy and distribute verbatim copies of the Program's 80 source code as you receive it, in any medium, provided that you 81 conspicuously and appropriately publish on each copy an appropriate 82 copyright notice and disclaimer of warranty; keep intact all the 83 notices that refer to this License and to the absence of any warranty; 84 and give any other recipients of the Program a copy of this License 85 along with the Program. 86 87 You may charge a fee for the physical act of transferring a copy, and 88 you may at your option offer warranty protection in exchange for a fee. 89 90 2. You may modify your copy or copies of the Program or any portion 91 of it, thus forming a work based on the Program, and copy and 92 distribute such modifications or work under the terms of Section 1 93 above, provided that you also meet all of these conditions: 94 95 a) You must cause the modified files to carry prominent notices 96 stating that you changed the files and the date of any change. 97 98 b) You must cause any work that you distribute or publish, that in 99 whole or in part contains or is derived from the Program or any 100 part thereof, to be licensed as a whole at no charge to all third 101 parties under the terms of this License. 102 103 c) If the modified program normally reads commands interactively 104 when run, you must cause it, when started running for such 105 interactive use in the most ordinary way, to print or display an 106 announcement including an appropriate copyright notice and a 107 notice that there is no warranty (or else, saying that you provide 108 a warranty) and that users may redistribute the program under 109 these conditions, and telling the user how to view a copy of this 110 License. (Exception: if the Program itself is interactive but 111 does not normally print such an announcement, your work based on 112 the Program is not required to print an announcement.) 70 You may charge a fee for the physical act of transferring a copy, and you may at your option offer 71 warranty protection in exchange for a fee. 72 73 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based 74 on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, 75 provided that you also meet all of these conditions: 76 77 a) You must cause the modified files to carry prominent notices stating that you changed the files 78 and the date of any change. 79 80 b) You must cause any work that you distribute or publish, that in whole or in part contains or is 81 derived from the Program or any part thereof, to be licensed as a whole at no charge to all third 82 parties under the terms of this License. 83 84 c) If the modified program normally reads commands interactively when run, you must cause it, 85 when running for such interactive use in the most ordinary way, to print or display an announcement 86 including an appropriate copyright notice and a notice that there is no warranty (or else, saying that 87 you provide a warranty) and that users may redistribute the program under these conditions, and telling 88 the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not 89 normally print such an announcement, your work based on the Program is not required to print an 90 announcement.) 91 92 These requirements apply to the modified work as a whole. If identifiable sections of that work are not 93 derived from the Program, and can be reasonably considered independent and separate works in themselves, 94 then this License, and its terms, do not apply to those sections when you distribute them as separate works. 95 But when you distribute the same sections as part of a whole which is a work based on the Program, the 96 distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to 97 the entire whole, and thus to each and every part regardless of who wrote it. 98 99 Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; 100 rather, the intent is to exercise the right to control the distribution of derivative or collective works based on 101 the Program. 102 103 In addition, mere aggregation of another work not based on the Program with the Program (or with a work 104 based on the Program) on a volume of a storage or distribution medium does not bring the other work under 105 the scope of this License. 106 107 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or 108 executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: 109 110 a) Accompany it with the complete corresponding machine-readable source code, which must be 111 distributed under the terms of Sections 1 and 2 above on a medium customarily used for software 112 interchange; or, 113 114 b) Accompany it with a written offer, valid for at least three years, to give any third party, for a 115 charge no more than your cost of physically performing source distribution, a complete machine-readable 116 copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on 117 a medium customarily used for software interchange; or, 118 119 c) Accompany it with the information you received as to the offer to distribute corresponding source code. 120 (This alternative is allowed only for noncommercial distribution and only if you received the program in 121 object code or executable form with such an offer, in accord with Subsection b above.) 122 123 The source code for a work means the preferred form of the work for making modifications to it. For an execu- 124 table work, complete source code means all the source code for all modules it contains, plus any associated 125 interface definition files, plus the scripts used to control compilation and installation of the executable. However, 126 as a special exception, the source code distributed need not include anything that is normally distributed (in 127 either source or binary form) with the major components (compiler, kernel, and so on) of the operating system 128 on which the executable runs, unless that component itself accompanies the executable. 129 130 If distribution of executable or object code is made by offering access to copy from a designated place, then 131 offering equivalent access to copy the source code from the same place counts as distribution of the source 132 code, even though third parties are not compelled to copy the source along with the object code. 133 134 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this 135 License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will auto- 136 matically terminate your rights under this License. However, parties who have received copies, or rights, from 137 you under this License will not have their licenses terminated so long as such parties remain in full compliance. 113 138 114 These requirements apply to the modified work as a whole. If 115 identifiable sections of that work are not derived from the Program, 116 and can be reasonably considered independent and separate works in 117 themselves, then this License, and its terms, do not apply to those 118 sections when you distribute them as separate works. But when you 119 distribute the same sections as part of a whole which is a work based 120 on the Program, the distribution of the whole must be on the terms of 121 this License, whose permissions for other licensees extend to the 122 entire whole, and thus to each and every part regardless of who wrote it. 123 124 Thus, it is not the intent of this section to claim rights or contest 125 your rights to work written entirely by you; rather, the intent is to 126 exercise the right to control the distribution of derivative or 127 collective works based on the Program. 128 129 In addition, mere aggregation of another work not based on the Program 130 with the Program (or with a work based on the Program) on a volume of 131 a storage or distribution medium does not bring the other work under 132 the scope of this License. 133 134 3. You may copy and distribute the Program (or a work based on it, 135 under Section 2) in object code or executable form under the terms of 136 Sections 1 and 2 above provided that you also do one of the following: 137 138 a) Accompany it with the complete corresponding machine-readable 139 source code, which must be distributed under the terms of Sections 140 1 and 2 above on a medium customarily used for software interchange; or, 141 142 b) Accompany it with a written offer, valid for at least three 143 years, to give any third party, for a charge no more than your 144 cost of physically performing source distribution, a complete 145 machine-readable copy of the corresponding source code, to be 146 distributed under the terms of Sections 1 and 2 above on a medium 147 customarily used for software interchange; or, 148 149 c) Accompany it with the information you received as to the offer 150 to distribute corresponding source code. (This alternative is 151 allowed only for noncommercial distribution and only if you 152 received the program in object code or executable form with such 153 an offer, in accord with Subsection b above.) 154 155 The source code for a work means the preferred form of the work for 156 making modifications to it. For an executable work, complete source 157 code means all the source code for all modules it contains, plus any 158 associated interface definition files, plus the scripts used to 159 control compilation and installation of the executable. However, as a 160 special exception, the source code distributed need not include 161 anything that is normally distributed (in either source or binary 162 form) with the major components (compiler, kernel, and so on) of the 163 operating system on which the executable runs, unless that component 164 itself accompanies the executable. 165 166 If distribution of executable or object code is made by offering 167 access to copy from a designated place, then offering equivalent 168 access to copy the source code from the same place counts as 169 distribution of the source code, even though third parties are not 170 compelled to copy the source along with the object code. 139 5. You are not required to accept this License, since you have not signed it. However, nothing else grants 140 you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law 141 if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on 142 the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for 143 copying, distributing or modifying the Program or works based on it. 144 145 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically 146 receives a license from the original licensor to copy, distribute or modify the Program subject to these terms 147 and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted 148 herein. You are not responsible for enforcing compliance by third parties to this License. 149 150 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not 151 limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that 152 contradict the conditions of this License, they do not excuse you from the conditions of this License. If you 153 cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent 154 obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license 155 would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly 156 through you, then the only way you could satisfy both it and this License would be to refrain entirely from 157 distribution of the Program. 158 159 If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance 160 of the section is intended to apply and the section as a whole is intended to apply in other circumstances. 161 162 It is not the purpose of this section to induce you to infringe any patents or other property right claims or to 163 contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free 164 software distribution system, which is implemented by public license practices. Many people have made generous 165 contributions to the wide range of software distributed through that system in reliance on consistent application 166 of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any 167 other system and a licensee cannot impose that choice. 168 169 This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this 170 License. 171 172 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by 173 copyrighted interfaces, the original copyright holder who places the Program under this License may add an 174 explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or 175 among countries not thus excluded. In such case, this License incorporates the limitation as if written in the 176 body of this License. 177 178 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from 179 time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address 180 new problems or concerns. 181 182 Each version is given a distinguishing version number. If the Program specifies a version number of this License 183 which applies to it and "any later version", you have the option of following the terms and conditions either of 184 that version or of any later version published by the Free Software Foundation. If the Program does not specify 185 a version number of this License, you may choose any version ever published by the Free Software Foundation. 186 187 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are 188 different, write to the author to ask for permission. For software which is copyrighted by the Free Software 189 Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will 190 be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting 191 the sharing and reuse of software generally. 192 193 NO WARRANTY 194 195 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO 196 THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 197 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 198 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 199 AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 200 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY 201 SERVICING, REPAIR OR CORRECTION. 171 202 172 4. You may not copy, modify, sublicense, or distribute the Program 173 except as expressly provided under this License. Any attempt 174 otherwise to copy, modify, sublicense or distribute the Program is 175 void, and will automatically terminate your rights under this License. 176 However, parties who have received copies, or rights, from you under 177 this License will not have their licenses terminated so long as such 178 parties remain in full compliance. 179 180 5. You are not required to accept this License, since you have not 181 signed it. However, nothing else grants you permission to modify or 182 distribute the Program or its derivative works. These actions are 183 prohibited by law if you do not accept this License. Therefore, by 184 modifying or distributing the Program (or any work based on the 185 Program), you indicate your acceptance of this License to do so, and 186 all its terms and conditions for copying, distributing or modifying 187 the Program or works based on it. 188 189 6. Each time you redistribute the Program (or any work based on the 190 Program), the recipient automatically receives a license from the 191 original licensor to copy, distribute or modify the Program subject to 192 these terms and conditions. You may not impose any further 193 restrictions on the recipients' exercise of the rights granted herein. 194 You are not responsible for enforcing compliance by third parties to 195 this License. 196 197 7. If, as a consequence of a court judgment or allegation of patent 198 infringement or for any other reason (not limited to patent issues), 199 conditions are imposed on you (whether by court order, agreement or 200 otherwise) that contradict the conditions of this License, they do not 201 excuse you from the conditions of this License. If you cannot 202 distribute so as to satisfy simultaneously your obligations under this 203 License and any other pertinent obligations, then as a consequence you 204 may not distribute the Program at all. For example, if a patent 205 license would not permit royalty-free redistribution of the Program by 206 all those who receive copies directly or indirectly through you, then 207 the only way you could satisfy both it and this License would be to 208 refrain entirely from distribution of the Program. 209 210 If any portion of this section is held invalid or unenforceable under 211 any particular circumstance, the balance of the section is intended to 212 apply and the section as a whole is intended to apply in other 213 circumstances. 214 215 It is not the purpose of this section to induce you to infringe any 216 patents or other property right claims or to contest validity of any 217 such claims; this section has the sole purpose of protecting the 218 integrity of the free software distribution system, which is 219 implemented by public license practices. Many people have made 220 generous contributions to the wide range of software distributed 221 through that system in reliance on consistent application of that 222 system; it is up to the author/donor to decide if he or she is willing 223 to distribute software through any other system and a licensee cannot 224 impose that choice. 225 226 This section is intended to make thoroughly clear what is believed to 227 be a consequence of the rest of this License. 228 229 8. If the distribution and/or use of the Program is restricted in 230 certain countries either by patents or by copyrighted interfaces, the 231 original copyright holder who places the Program under this License 232 may add an explicit geographical distribution limitation excluding 233 those countries, so that distribution is permitted only in or among 234 countries not thus excluded. In such case, this License incorporates 235 the limitation as if written in the body of this License. 236 237 9. The Free Software Foundation may publish revised and/or new versions 238 of the General Public License from time to time. Such new versions will 239 be similar in spirit to the present version, but may differ in detail to 240 address new problems or concerns. 241 242 Each version is given a distinguishing version number. If the Program 243 specifies a version number of this License which applies to it and "any 244 later version", you have the option of following the terms and conditions 245 either of that version or of any later version published by the Free 246 Software Foundation. If the Program does not specify a version number of 247 this License, you may choose any version ever published by the Free Software 248 Foundation. 249 250 10. If you wish to incorporate parts of the Program into other free 251 programs whose distribution conditions are different, write to the author 252 to ask for permission. For software which is copyrighted by the Free 253 Software Foundation, write to the Free Software Foundation; we sometimes 254 make exceptions for this. Our decision will be guided by the two goals 255 of preserving the free status of all derivatives of our free software and 256 of promoting the sharing and reuse of software generally. 257 258 NO WARRANTY 259 260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 REPAIR OR CORRECTION. 269 270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 POSSIBILITY OF SUCH DAMAGES. 279 280 END OF TERMS AND CONDITIONS 281 282 How to Apply These Terms to Your New Programs 283 284 If you develop a new program, and you want it to be of the greatest 285 possible use to the public, the best way to achieve this is to make it 286 free software which everyone can redistribute and change under these terms. 287 288 To do so, attach the following notices to the program. It is safest 289 to attach them to the start of each source file to most effectively 290 convey the exclusion of warranty; and each file should have at least 291 the "copyright" line and a pointer to where the full notice is found. 292 293 <one line to give the program's name and a brief idea of what it does.> 294 Copyright (C) <year> <name of author> 295 296 This program is free software; you can redistribute it and/or modify 297 it under the terms of the GNU General Public License as published by 298 the Free Software Foundation; either version 2 of the License, or 299 (at your option) any later version. 300 301 This program is distributed in the hope that it will be useful, 302 but WITHOUT ANY WARRANTY; without even the implied warranty of 303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 GNU General Public License for more details. 305 306 You should have received a copy of the GNU General Public License 307 along with this program; if not, write to the Free Software 308 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 309 310 311 Also add information on how to contact you by electronic and paper mail. 312 313 If the program is interactive, make it output a short notice like this 314 when it starts in an interactive mode: 315 316 Gnomovision version 69, Copyright (C) year name of author 317 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 This is free software, and you are welcome to redistribute it 319 under certain conditions; type `show c' for details. 320 321 The hypothetical commands `show w' and `show c' should show the appropriate 322 parts of the General Public License. Of course, the commands you use may 323 be called something other than `show w' and `show c'; they could even be 324 mouse-clicks or menu items--whatever suits your program. 325 326 You should also get your employer (if you work as a programmer) or your 327 school, if any, to sign a "copyright disclaimer" for the program, if 328 necessary. Here is a sample; alter the names: 329 330 Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 333 <signature of Ty Coon>, 1 April 1989 334 Ty Coon, President of Vice 335 336 This General Public License does not permit incorporating your program into 337 proprietary programs. If your program is a subroutine library, you may 338 consider it more useful to permit linking proprietary applications with the 339 library. If this is what you want to do, use the GNU Library General 340 Public License instead of this License. 203 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT 204 HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, 205 BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 206 ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA 207 OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE 208 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN 209 ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 210 211 END OF TERMS AND CONDITIONS -
trunk/gallery.php
r588 r590 1 1 <?php 2 2 /* This is a backwords compatible file to make old installations work correctly */ 3 include_once(dirname(__FILE__). "/plogger.php");3 include_once(dirname(__FILE__).'/plogger.php'); 4 4 5 5 function the_gallery_head() { -
trunk/index.php
r573 r590 19 19 */ 20 20 ?> 21 <?php require( "plogger.php"); ?>21 <?php require('plogger.php'); ?> 22 22 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 23 23 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -
trunk/plog-admin/_install.php
r588 r590 1 1 <?php 2 if (is_file(dirname(dirname(__FILE__)).'/plog-config.php')) { 3 require_once(dirname(dirname(__FILE__)).'/plog-config.php'); 4 } 2 5 include_once(dirname(dirname(__FILE__)).'/plog-globals.php'); 3 @include_once(PLOGGER_DIR.'plog-config.php');4 6 include_once(PLOGGER_DIR.'plog-includes/plog-functions.php'); 5 7 include_once(PLOGGER_DIR.'plog-admin/includes/install-functions.php'); … … 13 15 header('Content-type: application/octet-stream'); 14 16 header('Content-Disposition: attachment; filename="plog-config.php"'); 15 print$_SESSION['plogger_config'];17 echo $_SESSION['plogger_config']; 16 18 exit(); 17 }18 19 // Create the SQL tables and try to proceed to the admin interface.20 // Only proceeds if the configuration is set.21 if (!empty($_POST['proceed']) && defined('PLOGGER_DB_HOST')) {22 $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME);23 if (empty($mysql)) {24 create_tables();25 configure_plogger($_SESSION['install_values']); // undefined index install_values26 include_once(PLOGGER_DIR.'plog-load-config.php');27 $col = add_collection(plog_tr("Plogger test collection"), plog_tr("Feel free to delete it"));28 // only attempt to create an album if the collection was created - sloppy fix for multiple installs29 if (!empty($col['id'])) {30 $alb = add_album(plog_tr("Plogger test album"), plog_tr("feel free to delete it"), $col['id']);31 }32 unset($_SESSION['plogger_config']);33 unset($_SESSION['install_values']);34 // send to login, redirecting to the Admin -> Options page first35 header("Location: index.php?r=plog-options.php");36 exit;37 } else {38 echo "There was an error with the MySQL connection!";39 }40 19 } 41 20 ?> … … 44 23 <html xmlns="http://www.w3.org/1999/xhtml"> 45 24 <head> 46 <title> Install Plogger</title>25 <title>Plogger <?php echo plog_tr('Gallery | Install') ?></title> 47 26 <meta http-equiv="Content-Type" content="txt/html; charset=utf-8" /> 48 27 <link rel="stylesheet" type="text/css" href="css/admin.css" /> … … 60 39 // if not installed, do the installation 61 40 if (!$installed) { 41 // if not told to proceed, do the configuration setup 62 42 if (empty($_POST['proceed'])) { 63 do_install($_POST); 64 } else { 65 require(PLOGGER_DIR.'plog-admin/includes/install-form-setup-complete.php'); 43 $configured = do_install($_POST); 44 } 45 // if setup configuration done, do the install 46 if (isset($_POST['proceed']) || $configured) { 47 // if not DB information not defined, prompt the user to download the plog-config.php file 48 if (!defined('PLOGGER_DB_HOST')) { 49 echo "\n\n\t" . '<h1>'.plog_tr('Plogger Configuration Complete').'</h1>'; 50 echo "\n\n\t" . '<form action="_install.php" method="post">'; 51 echo "\n\n\t\t" . '<p>'.plog_tr('Configuration setup is now complete.').'</p>'; 52 echo "\n\n\t\t" . '<p>'.plog_tr('Click <strong>Install</strong> to complete the installation.').'</p>'; 53 if (!empty($_SESSION['plogger_config'])) { 54 echo "\n\n\t\t" . '<p>'.sprintf(plog_tr('Before you can proceed, please %s to download configuration file for your gallery, then upload it to your webhost (into the same directory where you installed Plogger itself).'), '<input type="submit" class="submit-inline" name="dlconfig" value="'.plog_tr('click here').'" />').'</p>'; 55 } 56 echo "\n\n\t" . '<p><input type="submit" class="submit" name="proceed" id="proceed" value="'.plog_tr('Install').'" /></p>'; 57 // otherwise, do the install 58 } else { 59 $errors = array(); 60 $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME); 61 if (empty($mysql)) { 62 create_tables(); 63 configure_plogger($_SESSION['install_values']); // undefined index install_values 64 include_once(PLOGGER_DIR.'plog-load-config.php'); 65 // if open permissions, have plogger fix them 66 if (isset($_SESSION['plogger_close_perms'])) { 67 fix_open_perms($_SESSION['plogger_close_perms'], 'delete'); 68 } 69 $col = add_collection(plog_tr('Plogger Test Collection'), plog_tr('Feel free to delete it')); 70 // only attempt to create an album if the collection was created - sloppy fix for multiple installs 71 if (!empty($col['id'])) { 72 $alb = add_album(plog_tr('Plogger Test Album'), plog_tr('Feel free to delete it'), $col['id']); 73 } 74 } else { 75 echo plog_tr('There was an error with the MySQL connection').'!'; 76 } 77 // if no errors, tell the user their login and password and link them to the login 78 if (empty($errors)) { 79 echo "\n\n\t" . '<h1>'.plog_tr('Plogger Install Complete').'</h1>'; 80 echo "\n\n\t" . '<p class="info">'.plog_tr('You have successfully installed Plogger!').'<br /><br />'; 81 echo "\n\n\t" . sprintf(plog_tr('Your username is %s and your password is %s'), '<strong>'.$_SESSION['install_values']['admin_username'].'</strong>', '<strong>'.$_SESSION['install_values']['admin_password'].'</strong>'); 82 echo "\n\n\t" . '</p>'; 83 if (is_open_perms(PLOGGER_DIR.'plog-content/')) { 84 echo "\n\n\t" . '<p class="actions">'.sprintf(plog_tr('You can now CHMOD the %s directory back to 0755'), '<strong>plog-content/</strong>').'.</p>'; 85 } 86 echo "\n\n\t" . '<form action="index.php?r=plog-options.php" method="post">'; 87 echo "\n\t\t" . '<p><input class="submit" type="submit" name="login" value="'.plog_tr('Log In').'" /></p>'; 88 echo "\n\t" . '</form>'. "\n"; 89 unset($_SESSION['plogger_config']); 90 unset($_SESSION['install_values']); 91 } else { 92 // else display the errors 93 } 94 } 66 95 } 67 96 } else { 68 echo $installed; 97 // otherwise it's installed 98 echo '<p>'.plog_tr('Plogger is already installed').'</p>'; 69 99 } 100 close_db(); 101 close_ftp(); 70 102 ?> 71 103 -
trunk/plog-admin/_upgrade.php
r588 r590 1 1 <?php 2 if (is_file(dirname(dirname(__FILE__)).'/plog-config.php')) { 3 require_once(dirname(dirname(__FILE__)).'/plog-config.php'); 4 } 2 5 include(dirname(dirname(__FILE__)).'/plog-globals.php'); 3 @include(PLOGGER_DIR.'plog-config.php');4 include(PLOGGER_DIR.'plog-admin/plog-admin-functions.php');5 6 include(PLOGGER_DIR.'plog-admin/includes/install-functions.php'); 6 7 error_reporting(E_ALL); … … 28 29 // if we are upgrading from 1.0beta1, we do not yet have a valid plog-config.php file 29 30 if (!$beta1) { 30 // now we can include the functions 31 // now we can include the functions - conflict with run_query function in beta 1's plog-connect.php file 31 32 include(PLOGGER_DIR.'plog-includes/plog-functions.php'); 32 33 // make sure Plogger is installed first 33 34 if (!is_plogger_installed()) { 34 35 // if Plogger does not seem to be installed, redirect to _install.php 35 header( "Location: _install.php");36 header('Location: _install.php'); 36 37 } else { 37 38 // if installed, check for safe_mode and if enabled, check for FTP workaround 38 if (i ni_get('safe_mode') && function_exists('ftp_connect')) {39 if (is_safe_mode()) { 39 40 //set up the FTP workaround information if prompted 40 41 if (isset($_POST['ftp_host'])) { … … 90 91 $errors = check_requirements(); 91 92 if (sizeof($errors) > 0) { 92 echo "\n\t" .'<p class="errors">'.plog_tr('Plogger cannot be upgraded until the following problems are resolved').':</p>';93 echo "\n\n\t\t" .'<ul class="info">';93 echo "\n\t" . '<p class="errors">'.plog_tr('Plogger cannot be upgraded until the following problems are resolved').':</p>'; 94 echo "\n\n\t\t" . '<ul class="info">'; 94 95 foreach($errors as $error) { 95 echo "\n\t\t\t" .'<li>' . $error .'</li>';96 echo "\n\t\t\t" . '<li class="margin-5">'.$error.'</li>'; 96 97 } 97 echo "\n\t\t" .'</ul>';98 echo "\n\n\t\t" .'<form method="get" action="'.$_SERVER['REQUEST_URI'].'">98 echo "\n\t\t" . '</ul>'; 99 echo "\n\n\t\t" . '<form method="get" action="'.$_SERVER['REQUEST_URI'].'"> 99 100 <p><input class="submit" type="submit" value="'.plog_tr('Try again').'" /></p> 100 </form>' ."\n";101 </form>' . "\n"; 101 102 } else { // end of requirement check 102 103 $errors = ""; 103 104 104 echo "\n" .'<h1>'.plog_tr('Upgrading Plogger').'</h1>';105 echo "\n" . '<h1>'.plog_tr('Upgrading Plogger').'</h1>'; 105 106 106 107 switch ($step) { … … 109 110 if ($beta1) { 110 111 // include the old sql database info and create a new plog-config.php file with it 111 include (PLOGGER_DIR.'plog-connect.php');112 include_once(PLOGGER_DIR.'plog-connect.php'); 112 113 $conf = create_config_file($DB_HOST, $DB_USER, $DB_PW, $DB_NAME); 113 114 // serve the config file and ask user to upload it to webhost 114 115 $_SESSION['plogger_config'] = $conf; 115 echo "\n\n\t" .'<h2 class="upgrade">'.plog_tr('Updating Configuration').'</h2>';116 echo "\n\n\t\t" .'<p>'.plog_tr('It appears you are updating from Plogger 1.0beta1. Your configuration file needs to be updated.').'</p>';117 echo "\n\n\t\t" .'<form action="_upgrade.php" method="post">';118 echo "\n\n\t\t\t" .'<p>'.sprintf( plog_tr('Before you can proceed, please %s to download the configuration file for your gallery, then upload it to your webhost (into the same directory where you installed Plogger itself).'), '<input class="submit-inline" type="submit" name="dlconfig" value="'.plog_tr('click here').'" />').'</p>';119 echo "\n\n\t\t\t" .'<p><input class="submit" type="submit" name="continue" id="continue" value="'.plog_tr('Continue').'..." /></p>';120 echo "\n\n\t\t" .'</form>'."\n";116 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Updating Configuration').'</h2>'; 117 echo "\n\n\t\t" . '<p>'.plog_tr('It appears you are updating from Plogger 1.0beta1. Your configuration file needs to be updated.').'</p>'; 118 echo "\n\n\t\t" . '<form action="_upgrade.php" method="post">'; 119 echo "\n\n\t\t\t" . '<p>'.sprintf(plog_tr('Before you can proceed, please %s to download the configuration file for your gallery, then upload it to your webhost (into the same directory where you installed Plogger itself).'), '<input class="submit-inline" type="submit" name="dlconfig" value=" '.plog_tr('click here').'" />') . '</p>'; 120 echo "\n\n\t\t\t" . '<p><input class="submit" type="submit" name="continue" id="continue" value=" '.plog_tr('Continue').'..." /></p>'; 121 echo "\n\n\t\t" . '</form>' . "\n"; 121 122 break; 122 123 } else if ($needs_ftp) { … … 124 125 // handle errors and include the information form 125 126 if (!empty($ftp_errors)) { 126 echo "\n\n\t\t" .'<ul class="errors" style="background-image: none;">';127 echo "\n\n\t\t" . '<ul class="errors" style="background-image: none;">'; 127 128 foreach ($ftp_errors as $value) { 128 echo "\n\t\t\t" .'<li>'.$value.'</li>';129 } 130 echo "\n\t\t" .'</ul>';129 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 130 } 131 echo "\n\t\t" . '</ul>'; 131 132 } 132 133 include(PLOGGER_DIR.'plog-admin/includes/install-form-setup.php'); … … 138 139 $return = upgrade_database(); 139 140 if (!empty($return)) { 140 echo "\n\n\t" .'<h2 class="upgrade">'.plog_tr('Updating Database').'</h2>';141 echo "\n\n\t\t" .'<ul class="info">';141 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Updating Database').'</h2>'; 142 echo "\n\n\t\t" . '<ul class="info">'; 142 143 foreach ($return as $value) { 143 echo "\n\t\t\t" .'<li>'.$value.'</li>';144 } 145 echo "\n\t\t" .'</ul>';146 echo "\n\n\t" .'<h2 class="upgrade">'.plog_tr('Done with database upgrade!').'</h2>';147 echo "\n\n\t" .'<form action="_upgrade.php?step=2" method="post">';148 echo "\n\t\t" .'<p><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>';149 echo "\n\t" .'</form>'."\n";150 break; 151 } 152 153 // step 2 - move images and uploads to new locations144 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 145 } 146 echo "\n\t\t" . '</ul>'; 147 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Done with database upgrade!').'</h2>'; 148 echo "\n\n\t" . '<form action="_upgrade.php?step=2" method="post">'; 149 echo "\n\t\t" . '<p><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>'; 150 echo "\n\t" . '</form>' . "\n"; 151 break; 152 } 153 154 // step 2 - move images, albums, collections, and uploads to new locations 154 155 case 2: 155 156 // load the config file 156 157 include_once(PLOGGER_DIR.'plog-load-config.php'); 158 // check if we need to rename the directories due to permissions to force the re-creation of images/ and thumbs/ 159 if (isset($_SESSION['plogger_close_perms'])) { 160 fix_open_perms($_SESSION['plogger_close_perms']); 161 } 157 162 $upgrade_images = upgrade_image_list(); 158 163 if ($upgrade_images['total'] > 0 || isset($_POST['upgrade-images'])) { 159 164 $selects = array('5' => 5, '10' => 10, '25' => 25, '50' => 50, '75' => 75, '100' => 100, '0' => plog_tr('All at once')); 160 echo "\n\n\t" .'<h2 class="upgrade">'.plog_tr('Updating Images').'</h2>';165 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Updating Images').'</h2>'; 161 166 if (!isset($_POST['upgrade-images'])) { 162 echo "\n\n\t" .'<p class="actions">'.sprintf( plog_tr('Plogger needs to restructure %s images'), '<strong>'.$upgrade_images['total'].'</strong>').'</p>';163 echo "\n\n\t" .'<form action="_upgrade.php?step=2" method="post">';167 echo "\n\n\t" . '<p class="actions">'.sprintf(plog_tr('Plogger needs to restructure %s items'), '<strong>'.$upgrade_images['total'].'</strong>') . '</p>'; 168 echo "\n\n\t" . '<form action="_upgrade.php?step=2" method="post">'; 164 169 echo "\n\n\t<p>".plog_tr('Number of images to update per cycle').': '; 165 echo "\n\t\t" .'<select name="num-images">';170 echo "\n\t\t" . '<select name="num-images">'; 166 171 foreach ($selects as $key => $value) { 167 172 $selected = ($key == 0) ? ' selected="selected"' : ''; 168 echo "\n\t\t\t" .'<option value="'.$key.'"'.$selected.'>'.$value.'</option>';169 } 170 echo "\n\t\t" .'</select>';171 echo "\n\t" .'</p>';172 echo "\n\n\t\t<p>* ".sprintf( plog_tr('change this if you have a lot of imagesor if you run into issues with bandwidth or server timeout issues. (i.e. %s which is currently set to %s)'), '<a target="_blank" href="http://www.php.net/manual/en/ref.info.php#ini.max-execution-time">max_execution_time</a>', '<strong>'.ini_get('max_execution_time').' s</strong>').'</p>';173 echo "\n\n\t\t" .'<p><input type="hidden" id="upgrade-images" name="upgrade-images" value="1" />';174 echo "\n\t\t" .'<input class="submit" type="submit" name="continue" value="'.plog_tr('Continue').'..." /></p>';175 echo "\n\n\t" .'</form>'."\n";173 echo "\n\t\t\t" . '<option value="'.$key.'"'.$selected.'>'.$value.'</option>'; 174 } 175 echo "\n\t\t" . '</select>'; 176 echo "\n\t" . '</p>'; 177 echo "\n\n\t\t<p>* ".sprintf(plog_tr('change this if you have a lot of images, or if you run into issues with bandwidth or server timeout issues. (i.e. %s which is currently set to %s)'), '<a target="_blank" href="http://www.php.net/manual/en/ref.info.php#ini.max-execution-time">max_execution_time</a>', '<strong>'.ini_get('max_execution_time').' s</strong>').'</p>'; 178 echo "\n\n\t\t" . '<p><input type="hidden" id="upgrade-images" name="upgrade-images" value="1" />'; 179 echo "\n\t\t" . '<input class="submit" type="submit" name="continue" value="'.plog_tr('Continue').'..." /></p>'; 180 echo "\n\n\t" . '</form>' . "\n"; 176 181 } else { 177 182 $num_images = (isset($_POST['num-images']) && $_POST['num-images'] > 0) ? $_POST['num-images'] : $upgrade_images['total']; 178 183 $return = upgrade_images($num_images, $upgrade_images); 179 184 if (!empty($return['errors'])) { 180 echo "\n\n\t" .'<p class="errors">'.plog_tr('Plogger was unable to move the following images. Please check your permissions.').'</p>';181 echo "\n\n\t\t" .'<ul class="info">';185 echo "\n\n\t" . '<p class="errors">'.plog_tr('Plogger was unable to move the following images. Please check your permissions.').'</p>'; 186 echo "\n\n\t\t" . '<ul class="info">'; 182 187 foreach ($return['errors'] as $value) { 183 echo "\n\t\t\t" .'<li>'.$value.'</li>';184 } 185 echo "\n\t\t" .'</ul>';188 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 189 } 190 echo "\n\t\t" . '</ul>'; 186 191 } 187 192 if (!empty($return['output'])) { 188 echo "\n\n\t" .'<p class="actions">'.plog_tr('Plogger was able to move the following images').':</p>';189 echo "\n\n\t\t" .'<ul class="info">';193 echo "\n\n\t" . '<p class="actions">'.plog_tr('Plogger was able to move the following images').':</p>'; 194 echo "\n\n\t\t" . '<ul class="info">'; 190 195 foreach ($return['output'] as $value) { 191 echo "\n\t\t\t" .'<li>'.$value.'</li>';192 } 193 echo "\n\t\t" .'</ul>';196 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 197 } 198 echo "\n\t\t" . '</ul>'; 194 199 } 195 200 if ($return['count'] == $upgrade_images['total']) { 196 echo "\n\n\t".'<h2 class="upgrade">'.plog_tr('Done with image restructure!').'</h2>'; 197 echo "\n\n\t".'<form action="_upgrade.php?step=3" method="post">'; 198 echo "\n\t\t".'<p><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>'; 199 echo "\n\t".'</form>'."\n"; 201 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Done with image restructure').'!</h2>'; 202 echo "\n\n\t" . '<form action="_upgrade.php?step=3" method="post">'; 203 echo "\n\t\t" . '<p><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>'; 204 echo "\n\t" . '</form>' . "\n"; 205 if (isset($_SESSION['plogger_close_perms'])) { 206 unset($_SESSION['plogger_close_perms']); 207 } 200 208 } else { 201 echo "\n\n\t" .'<p class="actions">'.sprintf(plog_tr('Plogger needs to restructure %s more images'), '<strong>'.( $upgrade_images['total'] - $return['count'] ).'</strong>').'</p>';202 echo "\n\n\t" .'<form action="_upgrade.php?step=2" method="post">';209 echo "\n\n\t" . '<p class="actions">'.sprintf(plog_tr('Plogger needs to restructure %s more images'), '<strong>'.( $upgrade_images['total'] - $return['count'] ).'</strong>').'</p>'; 210 echo "\n\n\t" . '<form action="_upgrade.php?step=2" method="post">'; 203 211 echo "\n\n\t<p>".plog_tr('Number of images to update per cycle').':'; 204 echo "\n\t\t" .'<select name="num-images">';212 echo "\n\t\t" . '<select name="num-images">'; 205 213 foreach ($selects as $key => $value) { 206 214 $selected = ($num_images == $key) ? ' selected="selected"' : ''; 207 echo "\n\t\t\t" .'<option value="'.$key.'"'.$selected.'>'.$value.'</option>';208 } 209 echo "\n\t\t" .'</select>';210 echo "\n\t" .'</p>';211 echo "\n\n\t" .'<p><input type="hidden" id="upgrade-images" name="upgrade-images" value="1" />';212 echo "\n\t" .'<input class="submit" type="submit" name="continue" value="'.plog_tr('Continue').'..." /></p>';213 echo "\n\n\t" .'</form>'."\n";215 echo "\n\t\t\t" . '<option value="'.$key.'"'.$selected.'>'.$value.'</option>'; 216 } 217 echo "\n\t\t" . '</select>'; 218 echo "\n\t" . '</p>'; 219 echo "\n\n\t" . '<p><input type="hidden" id="upgrade-images" name="upgrade-images" value="1" />'; 220 echo "\n\t" . '<input class="submit" type="submit" name="continue" value="'.plog_tr('Continue').'..." /></p>'; 221 echo "\n\n\t" . '</form>' . "\n"; 214 222 } 215 223 } … … 222 230 if (!empty($check_list['themes']) || !empty($check_list['translations'])) { 223 231 if (!empty($check_list['themes'])) { 224 echo "\n\n\t" .'<p class="actions">'.sprintf(plog_tr('Plogger has found old %s files'), plog_tr('theme') ).'. '.sprintf( plog_tr('If you have customized a theme listed below, please verify that you have a copy located in %s before moving on to the next step'), '<strong>plog-content/themes/</strong>' ).':</p>';225 echo "\n\n\t\t" .'<ul class="info">';232 echo "\n\n\t" . '<p class="actions">'.sprintf(plog_tr('Plogger has found old %s files'), plog_tr('theme') ).'. '.sprintf( plog_tr('If you have customized a theme listed below, please verify that you have a copy located in %s before moving on to the next step'), '<strong>plog-content/themes/</strong>' ).':</p>'; 233 echo "\n\n\t\t" . '<ul class="info">'; 226 234 foreach ($check_list['themes'] as $value) { 227 echo "\n\t\t\t" .'<li>'.$value.'</li>';228 } 229 echo "\n\t\t" .'</ul>';235 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 236 } 237 echo "\n\t\t" . '</ul>'; 230 238 } 231 239 if (!empty($check_list['translations'])) { 232 echo "\n\n\t" .'<p class="actions">'.sprintf( plog_tr('Plogger has found old %s files'), plog_tr('translation') ).'. '.sprintf(plog_tr('Please verify that you have a copy located in %s before moving on to the next step'), '<strong>plog-content/translations/</strong>' ).':</p>';233 echo "\n\n\t\t" .'<ul class="info">';240 echo "\n\n\t" . '<p class="actions">'.sprintf(plog_tr('Plogger has found old %s files'), plog_tr('translation') ).'. '.sprintf(plog_tr('Please verify that you have a copy located in %s before moving on to the next step'), '<strong>plog-content/translations/</strong>' ).':</p>'; 241 echo "\n\n\t\t" . '<ul class="info">'; 234 242 foreach ($check_list['translations'] as $value) { 235 echo "\n\t\t\t" .'<li>'.$value.'</li>';236 } 237 echo "\n\t\t" .'</ul>';238 } 239 echo "\n\n\t" .'<form action="_upgrade.php?step=4" method="post">';240 echo "\n\t\t" .'<p><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>';241 echo "\n\t" .'</form>'."\n";243 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 244 } 245 echo "\n\t\t" . '</ul>'; 246 } 247 echo "\n\n\t" . '<form action="_upgrade.php?step=4" method="post">'; 248 echo "\n\t\t" . '<p><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>'; 249 echo "\n\t" . '</form>' . "\n"; 242 250 break; 243 251 } … … 249 257 $cleanup_list = cleanup_list(); 250 258 if (!empty($cleanup_list['files']) || !empty($cleanup_list['folders']) || isset($_POST['do-cleanup'])) { 251 echo "\n\n\t" .'<h2 class="upgrade">'.plog_tr('Cleaning Up Files').'</h2>';259 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Cleaning Up Files').'</h2>'; 252 260 if (!isset($_POST['do-cleanup'])) { 253 echo "\n\n\t" .'<form action="_upgrade.php?step=4" method="post">';254 echo "\n\n\t" .'<p class="actions">'.plog_tr('Plogger has found the following files/folders that are no longer needed').':</p>';255 echo "\n\n\t\t" .'<ul class="info">';261 echo "\n\n\t" . '<form action="_upgrade.php?step=4" method="post">'; 262 echo "\n\n\t" . '<p class="actions">'.plog_tr('Plogger has found the following files/folders that are no longer needed').':</p>'; 263 echo "\n\n\t\t" . '<ul class="info">'; 256 264 foreach ($cleanup_list['files'] as $value) { 257 echo "\n\t\t\t" .'<li>'.$value.'</li>';265 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 258 266 } 259 267 foreach ($cleanup_list['folders'] as $value) { 260 echo "\n\t\t\t" .'<li>'.$value.'</li>';261 } 262 echo "\n\t\t" .'</ul>';263 echo "\n\n\t" .'<p>'.sprintf(plog_tr('You can have Plogger attempt to %s for you, or you can delete them manually via FTP and go to the next step.'), '<input class="submit-inline" type="submit" name="delete" value="'.plog_tr('delete the files').'..." />').'';264 echo "\n\t" .'<input type="hidden" id="do-cleanup" name="do-cleanup" value="1" /></p>';265 echo "\n\n\t" .'</form>';268 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 269 } 270 echo "\n\t\t" . '</ul>'; 271 echo "\n\n\t" . '<p>'.sprintf(plog_tr('You can have Plogger attempt to %s for you, or you can delete them manually via FTP and go to the next step.'), '<input class="submit-inline" type="submit" name="delete" value="'.plog_tr('delete the files').'..." />').''; 272 echo "\n\t" . '<input type="hidden" id="do-cleanup" name="do-cleanup" value="1" /></p>'; 273 echo "\n\n\t" . '</form>'; 266 274 } else { 267 275 $return = cleanup_files($cleanup_list['files'], $cleanup_list['folders']); 268 276 if (!empty($return['errors'])) { 269 echo "\n\n\t" .'<p class="errors">'.plog_tr('Plogger could not delete the following files/folders. Please check your permissions or delete them manually.').'</p>';270 echo "\n\n\t\t" .'<ul class="info">';277 echo "\n\n\t" . '<p class="errors">'.plog_tr('Plogger could not delete the following files/folders. Please check your permissions or delete them manually.').'</p>'; 278 echo "\n\n\t\t" . '<ul class="info">'; 271 279 foreach ($return['errors'] as $value) { 272 echo "\n\t\t\t" .'<li>'.$value.'</li>';273 } 274 echo "\n\t\t" .'</ul>';280 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 281 } 282 echo "\n\t\t" . '</ul>'; 275 283 } 276 284 if (!empty($return['output'])) { 277 echo "\n\n\t" .'<p class="actions">'.plog_tr('Plogger was able to delete the following files/folders').':</p>';278 echo "\n\n\t\t" .'<ul class="info">';285 echo "\n\n\t" . '<p class="actions">'.plog_tr('Plogger was able to delete the following files/folders').':</p>'; 286 echo "\n\n\t\t" . '<ul class="info">'; 279 287 foreach ($return['output'] as $value) { 280 echo "\n\t\t\t" .'<li>'.$value.'</li>';281 } 282 echo "\n\t\t" .'</ul>';288 echo "\n\t\t\t" . '<li class="margin-5">'.$value.'</li>'; 289 } 290 echo "\n\t\t" . '</ul>'; 283 291 } 284 292 if (!empty($return['errors'])) { 285 echo "\n\t" .'<form action="_upgrade.php?step=4" method="post">';286 echo "\n\t\t" .'<p style="float: left;"><input type="hidden" id="do-cleanup" name="do-cleanup" value="1" />';287 echo "\n\t\t" .'<input class="submit" type="submit" name="try again" value="'.plog_tr('Try Again').'" /></p>';288 echo "\n\t" .'</form>'. "\n";293 echo "\n\t" . '<form action="_upgrade.php?step=4" method="post">'; 294 echo "\n\t\t" . '<p style="float: left;"><input type="hidden" id="do-cleanup" name="do-cleanup" value="1" />'; 295 echo "\n\t\t" . '<input class="submit" type="submit" name="try again" value="'.plog_tr('Try Again').'" /></p>'; 296 echo "\n\t" . '</form>'. "\n"; 289 297 } else { 290 echo "\n\n\t" .'<h2 class="upgrade">'.plog_tr('Done with cleanup!').'</h2>';291 } 292 } 293 echo "\n\n\t" .'<form action="_upgrade.php?step=5" method="post">';294 echo "\n\t\t" .'<p style="float: left;"><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>';295 echo "\n\t" .'</form>'. "\n";296 echo "\n\t" .'<p> </p>'. "\n";298 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Done with cleanup!').'</h2>'; 299 } 300 } 301 echo "\n\n\t" . '<form action="_upgrade.php?step=5" method="post">'; 302 echo "\n\t\t" . '<p style="float: left;"><input class="submit" type="submit" name="next" value="'.plog_tr('Next Step').' »" /></p>'; 303 echo "\n\t" . '</form>'. "\n"; 304 echo "\n\t" . '<p> </p>'. "\n"; 297 305 break; 298 306 } … … 300 308 // Finished! 301 309 case 5: 302 echo "\n\n\t".'<h2 class="upgrade">'.plog_tr('Upgrade complete!').'</h2>'; 303 echo "\n\n\t".'<p class="actions">'.plog_tr('You have successfully upgraded Plogger!').'</p>'; 304 echo "\n\n\t".'<form action="index.php" method="post">'; 305 echo "\n\t\t".'<p><input class="submit" type="submit" name="next" value="'.plog_tr('Log In').'" /></p>'; 306 echo "\n\t".'</form>'. "\n"; 310 echo "\n\n\t" . '<h2 class="upgrade">'.plog_tr('Upgrade complete!').'</h2>'; 311 echo "\n\n\t" . '<p class="info">'.plog_tr('You have successfully upgraded Plogger!').'</p>'; 312 if (is_open_perms(PLOGGER_DIR.'plog-content/')) { 313 echo "\n\n\t" . '<p class="actions">'.sprintf(plog_tr('You can now CHMOD the %s directory back to 0755'), '<strong>plog-content/</strong>').'.</p>'; 314 } 315 echo "\n\n\t" . '<form action="index.php" method="post">'; 316 echo "\n\t\t" . '<p><input class="submit" type="submit" name="next" value="'.plog_tr('Log In').'" /></p>'; 317 echo "\n\t" . '</form>'. "\n"; 307 318 break; 308 319 } 309 320 } 321 if (!$beta1) { 322 close_db(); 323 close_ftp(); 324 } 310 325 ?> 311 326 -
trunk/plog-admin/css/admin.css
r587 r590 1 /* Plogger adminstylesheet */1 /* Plogger gallery admin UI stylesheet */ 2 2 3 3 /* Body and general styles */ 4 4 5 5 html { 6 padding: 15px;7 border-bottom: 10px solid #369;8 border-top: 10px solid #36 9;6 margin: 0; 7 padding: 0 15px 15px 15px; 8 border-top: 10px solid #365d95; 9 9 } 10 10 … … 12 12 font-family: tahoma, verdana, arial, sans-serif; 13 13 font-size: 14px; 14 color: #333; 14 15 } 15 16 16 17 a:link, a:visited, a:active { 17 color: maroon;18 color: #24496c; 18 19 text-decoration: none; 19 20 } 20 21 21 22 a:hover { 22 color: navy;23 color: #800; 23 24 text-decoration: underline; 24 25 } … … 26 27 a:focus { 27 28 outline: none; 28 -moz-outline:none; 29 -moz-outline: none; 30 } 31 32 acronym, abbr { 33 cursor: help; 29 34 } 30 35 31 36 h1 { 32 37 font-family: verdana, arial, sans-serif; 33 font-size: 1. 4em;34 margin-top: 2 5px;38 font-size: 1.3em; 39 margin-top: 20px; 35 40 margin-bottom: 15px; 36 41 font-weight: bold; … … 40 45 h2 { 41 46 font-family: verdana, arial, sans-serif; 42 font-size: 1. 2em;47 font-size: 1.1em; 43 48 margin-top: 20px; 44 49 margin-bottom: 15px; … … 64 69 font-size: 13px; 65 70 letter-spacing: normal; 66 } 67 68 input.submit { 69 border: 3px double #999; 70 border-top-color: #ccc; 71 border-left-color: #ccc; 72 background-color: #fff; 73 background-image: url("../images/button-bg.gif"); 71 color: #333; 72 } 73 74 input.submit, input.submit-create, input.submit-delete, input.submit-cancel { 75 border: none; 76 -moz-border-radius: 8px; 77 -khtml-border-radius: 8px; 78 -webkit-border-radius: 8px; 79 border-radius: 8px; 80 -moz-box-sizing: content-box; 81 -webkit-box-sizing: content-box; 82 -khtml-box-sizing: content-box; 83 box-sizing: content-box; 84 color: #fff; 85 font-family: verdana, arial, sans-serif; 86 font-size: 13px !important; 87 font-weight: bold; 88 padding: 2px 5px; 89 cursor: pointer; 90 width: 140px; 91 } 92 93 input.submit, input.submit-delete, input.submit-cancel { 94 background-color: #369; 95 background-image: url("../images/blue-button-bg.gif"); 74 96 background-repeat: repeat-x; 75 color: #333;76 font-size: 90%;77 font-weight: normal;78 padding: 0.25em;79 97 margin-left: 0; 98 } 99 100 input.submit[type="submit"]:hover { 101 color: #a0cca0; 102 } 103 104 input.submit-delete[type="submit"]:hover, input.submit-cancel[type="submit"]:hover { 105 color: #f00; 106 } 107 108 input.submit-create { 109 background-color: #65bc85; 110 background-image: url("../images/green-button-bg.gif"); 111 background-repeat: repeat-x; 112 margin: 0; 113 } 114 115 input.submit-create[type="button"]:hover { 116 color: #24496c; 80 117 } 81 118 … … 88 125 margin: 0; 89 126 padding: 0; 127 border: 0 none; 90 128 cursor: pointer; 91 129 } … … 104 142 } 105 143 144 ul { 145 margin-bottom: 5px; 146 } 147 106 148 /* Header elements */ 107 149 150 #logo { 151 float: left; 152 margin-top: -3px; 153 padding: 0; 154 } 155 156 #logo img { 157 border: 0 none; 158 } 159 108 160 #plogger-version { 161 float: right; 162 width: 375px; 109 163 font-family: verdana, arial, sans-serif; 110 float: right; 111 color: #54a154; 112 font-weight: 500; 113 font-variant: small-caps; 114 letter-spacing: 1px; 164 font-size: 11px; 165 color: #777; 166 margin: 0; 167 padding: 0; 168 } 169 170 #server-info { 171 margin: 5px 0 0 0; 172 padding: 5px 5px 5px 10px; 173 background-color: #f9f9f9; 174 border: 1px solid #d9d9d9; 175 -moz-border-radius: 5px; 176 -khtml-border-radius: 5px; 177 -webkit-border-radius: 5px; 178 border-radius: 5px; 179 white-space: wrap; 180 } 181 182 /* Navigation elements (tabs) */ 183 184 #tab-nav { 185 clear: both; 186 float: left; 187 width: 100%; 188 background: transparent url("../images/bg.gif") repeat-x bottom; 189 font-family: "Lucida Sans Unicode", verdana, arial, sans-serif; 190 font-size: 13px; 191 letter-spacing: normal; 192 line-height: normal; 193 margin-bottom: 15px; 194 border-bottom: 1px solid #369; 195 } 196 197 #tab-nav ul { 198 margin: 0; 199 padding: 10px 0 0 3px; 200 list-style: none; 201 } 202 203 #tab-nav li { 204 float: left; 205 background: url("../images/left.gif") no-repeat left top; 206 margin: 0; 207 padding: 0 0 0 9px; 208 } 209 210 #tab-nav a { 211 float: left; 212 display: block; 213 background: url("../images/right.gif") no-repeat right top; 214 padding: 5px 13px 4px 4px; 215 text-decoration: none; 216 font-weight: normal; 217 color: #765; 218 } 219 220 /* Commented Backslash Hack hides rule from IE5-Mac \*/ 221 #tab-nav a { 222 float: none; 223 } 224 /* End IE5-Mac hack */ 225 226 #tab-nav a:hover { 227 color: green; 228 } 229 230 #tab-nav a:focus { 231 outline: none; 232 -moz-outline: none; 233 } 234 235 #tab-nav #current { 236 background-image: url("../images/left_on.gif"); 237 border-bottom: 1px solid #369; 238 } 239 240 #tab-nav #current a { 241 background-image: url("../images/right_on.gif"); 242 color: #fff; 243 padding-bottom: 4px; 244 font-weight: bold; 245 } 246 247 #tab-nav #current a:focus { 248 outline: none; 249 -moz-outline: none; 250 } 251 252 #tab-nav a em { 253 text-decoration: underline; 254 font-style: normal; 255 } 256 257 #tab-subnav { 258 background: #369; 259 padding: 8px; 260 clear: both; 115 261 } 116 262 117 263 /* Upload page elements */ 264 265 #uploadForm form { 266 margin: 0; 267 padding: 0; 268 } 118 269 119 270 #uploadForm label { … … 128 279 background-repeat: no-repeat; 129 280 background-position: left 1px; 130 padding-left: 2 0px;281 padding-left: 25px; 131 282 } 132 283 … … 140 291 } 141 292 293 .import { 294 margin-bottom: 15px; 295 padding: 8px; 296 margin: 5px; 297 margin-left: 0; 298 background-color: #f9f9f9; 299 border: 1px solid #d9d9d9; 300 -moz-border-radius: 8px; 301 -khtml-border-radius: 8px; 302 -webkit-border-radius: 8px; 303 border-radius: 8px; 304 width: 350px; 305 clear: both; 306 } 307 142 308 /* Manage and Feedback page elements */ 143 309 … … 153 319 font-size: 0.9em; 154 320 margin-right: 5px; 155 padding: 3px;156 font-weight: bold;321 padding: 10px 3px 0 3px; 322 font-weight: normal; 157 323 text-align: right; 158 324 } 159 325 160 #contentList label, select, option { 326 #contentList .pagination span.page-link, #contentList .pagination a.page-link { 327 border: 1px solid #bbb; 328 -moz-border-radius: 3px; 329 -khtml-border-radius: 3px; 330 -webkit-border-radius: 3px; 331 border-radius: 3px; 332 padding: 1px 5px; 333 margin: 0 3px; 334 color: #bbb; 335 text-decoration: none; 336 } 337 338 #contentList .pagination .page-link:hover, #contentList .pagination .page-link a:hover { 339 color: #777; 340 border: 1px solid #777; 341 background-color: #f9f9f9; 342 } 343 344 #contentList .pagination .page-link a:focus { 345 outline: none; 346 -moz-outline: none; 347 } 348 349 #contentList .pagination a.pagPrev, #contentList .pagination a.pagNext { 350 color: #bbb; 351 text-decoration: none; 352 margin: 0 2px; 353 } 354 355 #contentList .pagination a.pagPrev:hover, #contentList .pagination a.pagNext:hover { 356 color: #777; 357 text-decoration: none; 358 } 359 360 #contentList .pagination span.page-link-current { 361 border: 1px solid #369; 362 -moz-border-radius: 3px; 363 -khtml-border-radius: 3px; 364 -webkit-border-radius: 3px; 365 border-radius: 3px; 366 padding: 1px 5px; 367 margin: 0 3px; 368 background-color: #369; 369 color: #fff; 370 } 371 372 #contentList label, #contentList select, #contentList option { 161 373 font-weight: normal; 162 374 } … … 166 378 } 167 379 168 #contentList .entries-page label, select {380 #contentList .entries-page label, #contentList .entries-page select { 169 381 display: block inline; 170 382 margin-bottom: auto; 171 383 } 172 384 173 #contentList .move-del-manage input, select { 385 #contentList .entries-page select { 386 width: 60px; 387 } 388 389 #contentList .move-del-manage input, #contentList .move-del-manage select { 174 390 display: block inline; 175 391 margin-bottom: auto; … … 177 393 font-size: 13px; 178 394 letter-spacing: normal; 395 clear: both; 179 396 } 180 397 … … 200 417 margin: 15px; 201 418 margin-left: 0; 202 border: 2px solid #cc6; 203 background-color: #ffffe0; 419 background-color: #f9f9f9; 420 border: 1px solid #d9d9d9; 421 -moz-border-radius: 5px; 422 -khtml-border-radius: 5px; 423 -webkit-border-radius: 5px; 424 border-radius: 5px; 204 425 width: auto; 205 426 clear: both; … … 207 428 208 429 .edit img { 209 border: 1px solid #000; 430 border: 1px solid #d9d9d9; 431 -moz-border-radius: 5px; 432 -khtml-border-radius: 5px; 433 -webkit-border-radius: 5px; 434 border-radius: 5px; 210 435 padding: 3px; 211 436 background-color: #fff; … … 218 443 border: 1px solid #efefef; 219 444 display: block; 220 } 221 222 .highlight { 223 padding: 8px; 224 background: #ffffe0; 225 border-top: 1px solid #ccc; 226 border-bottom: 1px solid #ccc; 227 width: 98%; 228 } 229 230 .highlight-row { 231 background: #ffffe0; 445 cursor: pointer; 446 } 447 448 .stats, .stats-info { 449 background: #f9f9f9; 450 background-image: url("../images/info.gif"); 451 background-repeat: no-repeat; 452 background-position: 5px 8px; 453 margin-right: 5px; 454 margin-bottom: 15px; 455 border: 1px solid #d9d9d9; 456 -moz-border-radius: 5px; 457 -khtml-border-radius: 5px; 458 -webkit-border-radius: 5px; 459 border-radius: 5px; 460 padding: 8px 5px 8px 28px; 461 clear: both; 462 width: auto; 232 463 } 233 464 234 465 /* Options page elements */ 235 466 236 #options _section label {467 #options-section label { 237 468 font-weight: bold; 238 469 } … … 258 489 } 259 490 260 tr.alt td { 261 background: #fafafa; 262 border-bottom: 1px solid #efefef; 263 } 264 265 /* Themes page elements */ 266 267 #theme-table td { 491 tr.alt td.left { 492 background: #f7f7f7; 493 border-bottom: 1px solid #f3f3f3; 494 -moz-border-radius: 8px 0 0 8px; 495 -webkit-border-top-left-radius: 8px; 496 -webkit-border-bottom-left-radius: 8px; 497 -khtml-border-top-left-radius: 8px; 498 -khtml-border-bottom-left-radius: 8px; 499 border-top-left-radius: 8px; 500 border-bottom-left-radius: 8px; 501 } 502 503 tr.alt td.right { 504 background: #f7f7f7; 505 border-bottom: 1px solid #f3f3f3; 506 -moz-border-radius: 0 8px 8px 0; 507 -webkit-border-top-right-radius: 8px; 508 -khtml-border-top-right-radius: 8px; 509 -webkit-border-bottom-right-radius: 8px; 510 -khtml-border-bottom-right-radius: 8px; 511 border-top-right-radius: 8px; 512 border-bottom-right-radius: 8px; 513 } 514 515 /* Themes and Plugins page elements */ 516 517 #theme-table td, #plugin-table td { 268 518 padding: 8px; 269 } 270 271 #theme-table tr.header th { 519 vertical-align: top; 520 } 521 522 #theme-table tr.header th, #plugin-table tr.header th { 272 523 padding: 8px; 273 524 } 274 525 275 tr.activated td { 276 background: #bedebe; 277 border-bottom: 1px solid #519e51; 526 tr.activated td, tr.enabled td { 527 background: #bed6d7; 528 } 529 530 td.active, td.on { 531 color: #000; 532 font-weight: bold; 278 533 } 279 534 280 535 /* Upload and Manage page elements */ 281 536 282 .cssbox, .cssbox_body, .cssbox_head, .cssbox_head h2 { /* set the image to use and establish the lower-right position */ 283 background: transparent url("../images/plogger-box-add.png") no-repeat bottom right; 284 margin: 0; 285 padding: 0; 286 } 287 288 .cssbox label, .cssbox-green label { 537 /* Blue/green boxes on Upload page */ 538 539 table.cssbox-upload { 540 width: 750px; 541 margin: 0; 289 542 padding: 0; 290 margin: 0; 291 font-weight: bold; 543 } 544 545 td.cssbox-upload-blue, td.cssbox-upload-green { 546 width: 375px !important; 547 margin: 2px 0 0 0; 548 padding: 10px; 549 vertical-align: top; 550 } 551 552 th.cssbox-upload-head-blue h2, th.cssbox-upload-head-green h2 { 553 color: #fff; 554 font-weight: bold; 555 font-size: 14px; 556 text-align: center; 557 vertical-align: top; 558 text-decoration: none; 559 margin: 0; 560 border: 0; 561 padding: 4px 18px; 562 height: 17px; 563 width: auto; 564 -moz-border-radius: 12px 12px 0 0; 565 -webkit-border-top-right-radius: 12px; 566 -webkit-border-top-left-radius: 12px; 567 -khtml-border-top-right-radius: 12px; 568 -khtml-border-top-left-radius: 12px; 569 border-top-right-radius: 12px; 570 border-top-left-radius: 12px; 571 } 572 573 th.cssbox-upload-head-blue h2 { 574 background: transparent url("../images/blue-button-bg.gif") repeat-x top left; 575 } 576 577 th.cssbox-upload-head-green h2 { 578 background: transparent url("../images/green-button-bg.gif") repeat-x top left; 579 } 580 581 td.cssbox-upload-body { 582 margin: 0; 583 padding: 15px 10px 15px 15px; 584 vertical-align: top; 585 width: 350px; 586 background-color: #f9f9f9; 587 border-right: 1px solid #d9d9d9; 588 border-bottom: 1px solid #d9d9d9; 589 border-left: 1px solid #d9d9d9; 590 -moz-border-radius: 0 0 12px 12px; 591 -webkit-border-bottom-right-radius: 12px; 592 -webkit-border-bottom-left-radius: 12px; 593 -khtml-border-bottom-right-radius: 12px; 594 -khtml-border-bottom-left-radius: 12px; 595 border-bottom-right-radius: 12px; 596 border-bottom-left-radius: 12px; 597 } 598 599 .cssbox-upload-body label { 600 font-family: tahoma, verdana, arial, sans-serif; 601 font-size: 14px; 292 602 display: inline; 293 } 294 295 .cssbox-green, .cssbox_body-green, .cssbox_head-green, .cssbox_head-green h2 { 296 background: transparent url("../images/plogger-box-add-green.png") no-repeat bottom right; 297 margin: 0; 298 padding: 0; 299 } 603 font-weight: bold; 604 } 605 606 /* Green box on Manage page */ 300 607 301 608 .cssbox-green { 302 width: 370px !important; /* intended total box width - padding-right(next) */ 303 width: 350px; /* IE Win = width - padding */ 304 padding-right: 15px; /* the gap on the right edge of the image (not content padding) */ 305 margin: 2px 0 20px 0; /* use to position the box */ 609 width: 385px !important; 610 margin: 10px 0 2px 0; 611 padding: 0; 306 612 } 307 613 … … 311 617 } 312 618 313 .cssbox { 314 width: 370px !important; /* intended total box width - padding-right(next) */ 315 width: 355px; /* IE Win = width - padding */ 316 padding-right: 15px; /* the gap on the right edge of the image (not content padding) */ 317 margin: 2px 0 20px 0; /* use to position the box */ 318 } 319 320 .cssbox_head, .cssbox_head-green { /* set the top-right image */ 321 background-position: top right; 322 margin-right: -15px; /* pull the right image over on top of border */ 323 padding-right: 40px; /* right-image-gap + right-inside padding */ 324 } 325 326 .cssbox_head h2, .cssbox_head-green h2 { /* set the top-left image */ 327 background-position: top left; 328 margin: 0; /* reset */ 329 border: 0; /* reset */ 330 padding: 7px 0 15px 20px; /* padding-left = image gap + interior padding ... no padding-right */ 331 height: auto !important; 332 height: 1%; /* IE Holly Hack */ 333 } 334 335 .cssbox_body, .cssbox_body-green { /* set the lower-left corner image */ 336 background-position: bottom left; 337 margin-right: 25px; /* interior-padding right */ 338 padding: 15px 0 15px 20px; /* mirror .cssbox_head right/left */ 339 } 340 341 .cssbox_head h2, .cssbox_head-green h2 { /* Misc Text formatting */ 619 .cssbox-head-green h2 { 342 620 color: #fff; 343 621 font-weight: bold; 344 font-size: 15px; /* this is tricky if box width is in ems */ 345 text-align: center; 346 text-shadow: rgb(0,0,0) 0 2px 5px; /* Safari-only, but I'm doing it just 'cause I can */ 622 font-size: 13px; 623 text-align: left; 347 624 text-decoration: none; 348 } 349 350 .cssbox_body p, .cssbox_body-green p { 625 width: auto; 626 background: transparent url("../images/green-button-bg.gif") repeat-x top left; 627 margin: 0; 628 border: 0; 629 padding: 3px 15px 3px 15px; 630 height: 17px; 631 -moz-border-radius: 8px 8px 0 0; 632 -webkit-border-top-right-radius: 8px; 633 -webkit-border-top-left-radius: 8px; 634 -khtml-border-top-right-radius: 8px; 635 -khtml-border-top-left-radius: 8px; 636 border-top-right-radius: 8px; 637 border-top-left-radius: 8px; 638 } 639 640 .cssbox-head-green h2:hover { 641 color: #24496c; 642 } 643 644 .cssbox-head-green h2.manage { 645 cursor: pointer; 646 } 647 648 .cssbox-body-green { 649 margin: 0; 650 padding: 15px 10px 15px 15px; 651 width: auto; 652 background-color: #f9f9f9; 653 border-right: 1px solid #d9d9d9; 654 border-bottom: 1px solid #d9d9d9; 655 border-left: 1px solid #d9d9d9; 656 -moz-border-radius: 0 0 8px 8px; 657 -webkit-border-bottom-right-radius: 8px; 658 -webkit-border-bottom-left-radius: 8px; 659 -khtml-border-bottom-right-radius: 8px; 660 -khtml-border-bottom-left-radius: 8px; 661 border-bottom-right-radius: 8px; 662 border-bottom-left-radius: 8px; 663 } 664 665 .cssbox-body-green label { 666 font-family: tahoma, verdana, arial, sans-serif; 667 font-size: 14px; 668 display: inline; 669 font-weight: bold; 670 } 671 672 .cssbox-body-green p { 351 673 margin: 0 0 20px; 352 674 } 353 675 354 .cssbox_body a, .css_body a:hover {355 margin: 0 !important;356 padding: 0 !important;357 border: 0 !important;358 text-decoration: underline;359 }360 361 676 /* Action/Error messages */ 362 677 363 .actions { 364 background-image: url("../images/alert.gif"); 678 .success, .actions, .errors, .info, .plugins { 365 679 background-repeat: no-repeat; 366 680 background-position: 5px 8px; 367 681 margin-right: 5px; 368 682 margin-bottom: 15px; 369 border-top: 2px solid #bb0; 370 border-bottom: 2px solid #bb0; 683 -moz-border-radius: 5px; 684 -khtml-border-radius: 5px; 685 -webkit-border-radius: 5px; 686 border-radius: 5px; 371 687 padding: 8px 8px 8px 28px; 688 clear: both; 689 } 690 691 .success { 692 background-image: url("../images/success.gif"); 693 border: 1px solid #8fc25c; 694 background-color: #d4edc9; 695 } 696 697 .actions { 698 background-image: url("../images/alert.gif"); 699 border: 1px solid #bb0; 372 700 background-color: #ffffe0; 373 clear: both;374 701 } 375 702 376 703 .errors { 377 704 background-image: url("../images/x.gif"); 378 background-repeat: no-repeat; 379 background-position: 5px 8px; 380 margin-right: 5px; 381 margin-bottom: 15px; 382 border-top: 2px solid maroon; 383 border-bottom: 2px solid maroon; 384 padding: 8px 8px 8px 28px; 705 border: 1px solid maroon; 385 706 background-color: #fcc; 386 clear: both;387 707 } 388 708 389 709 .info { 390 margin-right: 5px; 391 margin-bottom: 15px; 392 border-top: 2px solid #d9d9d9; 393 border-bottom: 2px solid #d9d9d9; 394 padding: 8px 8px 8px 28px; 710 border: 1px solid #d9d9d9; 395 711 background-color: #f9f9f9; 396 clear: both; 712 } 713 714 .plugins { 715 border: 1px solid #d9d9d9; 716 background-color: #fff; 397 717 } 398 718 399 719 /* Miscellaneous - used throughout admin panel */ 720 721 .align-left { 722 text-align: left; 723 } 724 725 .align-center { 726 text-align: center; 727 } 728 729 .align-right { 730 text-align: right; 731 } 400 732 401 733 .breadcrumb-header { … … 406 738 } 407 739 408 .box-heading {409 font-family: "Georgia", "Lucida Sans", "Verdana", arial, sans-serif;410 font-size: 15px;411 font-weight: bold;412 color: #333;413 margin:0;414 padding: 0;415 vertical-align: middle;416 position: relative;417 top: 10px;418 }419 420 .box-1 {421 margin: 15px;422 margin-top: 5px;423 margin-left: 0;424 border: 1px solid #264b71;425 padding: 10px;426 padding-top: 0;427 padding-left: 20px;428 background-color: #c4dadb;429 width: 470px;430 }431 432 .box-2 {433 margin: 15px;434 margin-top: 5px;435 margin-left: 0;436 border: 1px solid #cc6;437 padding: 10px;438 padding-top: 0;439 padding-left: 20px;440 background-color: #ffffe0;441 width: 470px;442 }443 444 .box-3 {445 margin: 15px;446 margin-top: 5px;447 margin-bottom: 10px;448 margin-left: 0;449 border: 1px solid #488f62;450 padding: 10px;451 padding-top: 0;452 padding-left: 20px;453 padding-bottom: 18px;454 background-color: #bedebe;455 width: 470px;456 }457 458 740 .img-shadow { 459 float: left;741 float: left; 460 742 background: url("../images/shadowAlpha.png") no-repeat bottom right !important; 461 743 background: url("../images/shadow.gif") no-repeat bottom right; … … 473 755 } 474 756 475 .invert-selection a, .invert-selection a:link, .invert-selection a:visited, .invert-selection a:active, .invert-selection a:hover { 476 font-size: 0.9em; 757 .margin-5 { 758 margin: 5px; 759 } 760 761 .no-margin-top { 762 margin-top: 0; 763 } 764 765 .no-margin-bottom { 766 margin-bottom: 0; 767 } 768 769 .strong { 770 font-weight: bold; 477 771 } 478 772 … … 490 784 491 785 tr.color-1 { 492 background-color: #ccc; 786 background-color: #eaeaea; 787 text-align: left; 493 788 } 494 789 495 790 tr.color-2 { 496 background-color: #efefef; 791 background-color: #f9f9f9; 792 text-align: left; 497 793 } 498 794 … … 513 809 } 514 810 811 tr.footer, tr.footer td { 812 -moz-border-radius: 0 0 8px 8px; 813 -webkit-border-bottom-right-radius: 8px; 814 -webkit-border-bottom-left-radius: 8px; 815 -khtml-border-bottom-right-radius: 8px; 816 -khtml-border-bottom-left-radius: 8px; 817 border-bottom-right-radius: 8px; 818 border-bottom-left-radius: 8px; 819 } 820 515 821 tr.footer { 516 822 background-color: #264e75; … … 518 824 519 825 tr.footer td { 520 padding: 6px; 826 padding: 5px; 827 } 828 829 tr.footer td.invert-selection a, tr.footer td.invert-selection a:link, tr.footer td.invert-selection a:visited, tr.footer td.invert-selection a:active { 830 font-size: 0.9em; 831 font-weight: normal; 832 color: #fff; 833 text-decoration: none; 834 margin-left: 10px; 835 } 836 837 tr.footer td.invert-selection a:hover { 838 color: #ddd; 521 839 } 522 840 523 841 .thumbselect { 524 height: 80px;525 padding-left: 90px;842 height: 100px; 843 padding-left: 100px; 526 844 background-repeat: no-repeat; 527 845 background-position: center left; … … 529 847 530 848 .thumboption { 531 padding-left: 90px;532 height: 40px;849 height: 50px; 850 padding-left: 100px; 533 851 margin-bottom: 2px; 534 background-position: center left; 852 background-repeat: no-repeat; 853 background-position: top left; 535 854 } 536 855 … … 539 858 text-decoration: none; 540 859 } 860 861 .vertical-top { 862 vertical-align: top; 863 } 864 865 .width-15 { 866 width: 15px; 867 } 868 869 .width-50 { 870 width: 50px; 871 } 872 873 .width-75 { 874 width: 75px; 875 } 876 877 .width-100 { 878 width: 100px; 879 } 880 881 .width-125 { 882 width: 125px; 883 } 884 885 .width-150 { 886 width: 150px; 887 } 888 889 .width-175 { 890 width: 175px; 891 } 892 893 .width-200 { 894 width: 200px; 895 } 896 897 .width-275 { 898 width: 275px; 899 } 900 901 .width-400 { 902 width: 400px; 903 } 904 905 .width-450 { 906 width: 450px; 907 } 908 909 .width-500 { 910 width: 500px; 911 } 912 913 .width-600 { 914 width: 600px; 915 } 916 917 .width-700 { 918 width: 700px; 919 } 920 921 .width-750 { 922 width: 750px; 923 } 924 925 td.width-15, td.width-50, td.width-75, td.width-100, td.width-125, td.width-150, td.width-175, td.width-200, td.width-275, td.width-400, td.width-450 { 926 vertical-align: top; 927 } -
trunk/plog-admin/css/lightbox.css
r550 r590 1 1 #lightbox { 2 background-color: #eee;2 background-color: #eee; 3 3 padding: 10px; 4 border-right: 2px solid #666; 4 5 border-bottom: 2px solid #666; 5 border-right: 2px solid #666;6 6 } 7 7 -
trunk/plog-admin/css/login.css
r586 r590 31 31 32 32 input.submit { 33 border: 3px double #999; 34 border-top-color: #ccc; 35 border-left-color: #ccc; 36 background-color: #fff; 37 background-image: url("../images/button-bg.gif"); 33 border: none; 34 background-color: #369; 35 background-image: url("../images/blue-button-bg.gif"); 38 36 background-repeat: repeat-x; 39 color: #333; 40 font-family: "Lucida Sans Unicode", verdana, arial, sans-serif; 41 font-size: 13px; 42 font-weight: normal; 43 padding: 0.25em; 37 -moz-border-radius: 5px; 38 -khtml-border-radius: 5px; 39 -webkit-border-radius: 5px; 40 border-radius: 5px; 41 -moz-box-sizing: content-box; 42 -webkit-box-sizing: content-box; 43 -khtml-box-sizing: content-box; 44 box-sizing: content-box; 45 color: #fff; 46 font-family: verdana, arial, sans-serif; 47 font-size: 12px !important; 48 font-weight: bold; 49 padding: 3px 8px; 50 cursor: pointer; 44 51 margin-left: 0; 45 52 width: auto; 53 } 54 55 input.submit:hover { 56 color: #a0cca0; 46 57 } 47 58 … … 64 75 background-color: #f9f9f9; 65 76 border: 1px solid #d9d9d9; 77 -moz-border-radius: 5px; 78 -khtml-border-radius: 5px; 79 -webkit-border-radius: 5px; 80 border-radius: 5px; 66 81 padding: 20px 15px 5px; 67 82 margin: 10px auto; … … 74 89 margin: 15px auto; 75 90 border: 1px solid maroon; 91 -moz-border-radius: 5px; 92 -khtml-border-radius: 5px; 93 -webkit-border-radius: 5px; 94 border-radius: 5px; 76 95 padding: 10px 15px; 77 96 background-color: #fcc; … … 84 103 margin: 15px auto; 85 104 border: 1px solid #bb0; 105 -moz-border-radius: 5px; 106 -khtml-border-radius: 5px; 107 -webkit-border-radius: 5px; 108 border-radius: 5px; 86 109 padding: 10px 15px; 87 110 background-color: #ffffe0; -
trunk/plog-admin/includes/install-form-setup.php
r587 r590 17 17 } 18 18 19 $init_vars = array('db_user', 'db_pass','db_name','gallery_name','admin_email','ftp_user','ftp_pass','ftp_path');19 $init_vars = array('db_user', 'db_pass', 'db_name', 'gallery_name', 'admin_username', 'admin_password', 'admin_email', 'ftp_user', 'ftp_pass', 'ftp_path'); 20 20 foreach($init_vars as $var) { 21 21 if (empty($form[$var])) { 22 $form[$var] = "";22 $form[$var] = ''; 23 23 } 24 24 } … … 26 26 <h1><?php echo plog_tr('Plogger Configuration Setup') ?></h1> 27 27 28 <p><?php echo plog_tr('To install, simply fill out the following form. If there are any problems, you will be notified and asked to fix them before the installation will continue. After the installation has finished, you will be redirected to the Plogger admin page.') ?></p>28 <p><?php echo plog_tr('To install, simply fill out the following form. If there are any problems, you will be notified and asked to fix them before the installation will continue. After the installation is complete, you will be redirected to the Plogger Gallery Admin page.') ?></p> 29 29 30 30 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> … … 54 54 } // end Database Setup 55 55 56 if (!isset($config['gallery_name']) || !isset($config['admin_email'])) { 56 if ( 57 !isset($config['gallery_name']) || 58 !isset($config['admin_email']) || 59 !isset($config['admin_username']) || 60 !isset($config['admin_password']) 61 ) { 57 62 ?> 58 63 <tr> … … 66 71 <?php 67 72 } 68 if (!isset($config['admin_email'])) { ?> 73 if (!isset($config['admin_email'])) { 74 ?> 69 75 <tr> 70 <td class="form_label"><label for="admin_email"><?php echo plog_tr('Your e-mail') ?>:</label></td>76 <td class="form_label"><label for="admin_email"><?php echo plog_tr('Your Email') ?>:</label></td> 71 77 <td class="form_input"><input type="text" name="admin_email" id="admin_email" value="<?php echo $form['admin_email']; ?>" /></td> 78 </tr> 79 <?php 80 } 81 if (!isset($config['admin_username'])) { 82 ?> 83 <tr> 84 <td class="form_label"><label for="admin_username"><?php echo plog_tr('Username') ?>:</label></td> 85 <td class="form_input"><input type="text" name="admin_username" id="admin_username" value="<?php echo $form['admin_username']; ?>" /></td> 86 </tr> 87 <?php 88 } 89 if (!isset($config['admin_password'])) { 90 ?> 91 <tr> 92 <td class="form_label"><label for="admin_password"><?php echo plog_tr('Password') ?>:</label></td> 93 <td class="form_input"><input type="text" name="admin_password" id="admin_password" value="<?php echo $form['admin_password']; ?>" /></td> 72 94 </tr> 73 95 <?php … … 108 130 <td colspan="2"> 109 131 <h2><?php echo plog_tr('Safe_mode Detected') ?></h2> 110 <p><?php echo plog_tr("Safe mode has been detected on your server and your server is missing PHP's FTP commands. Plogger cannot function correctly with safe_mode enabled and without FTP access.") ?></p>132 <p><?php echo plog_tr("Safe_mode has been detected on your server and your server is missing PHP's FTP commands. Plogger cannot function correctly with safe_mode enabled and without FTP access.") ?></p> 111 133 </td> 112 134 </tr> 113 135 <?php 114 136 } 115 } //end Safe_mode FTP Workaround ?> 137 } //end Safe_mode FTP Workaround 138 ?> 116 139 <tr> 117 140 <td class="submitButtonRow" colspan="2"><input type="submit" class="submit" name="submit" id="submit" value="<?php echo plog_tr('Proceed') ?>" /></td> -
trunk/plog-admin/includes/install-functions.php
r588 r590 9 9 /**** Common Functions ****/ 10 10 11 function maybe_add_column($table, $column,$add_sql) {11 function maybe_add_column($table, $column, $add_sql) { 12 12 $sql = "DESCRIBE $table"; 13 13 $res = mysql_query($sql); 14 14 $found = false; 15 while($row = mysql_fetch_array($res, MYSQL_NUM)) {15 while($row = mysql_fetch_array($res, MYSQL_NUM)) { 16 16 if ($row[0] == $column) $found = true; 17 17 } 18 18 if (!$found) { 19 mysql_query("ALTER TABLE $table ADD `$column` ". $add_sql);19 mysql_query("ALTER TABLE $table ADD `$column` ".$add_sql); 20 20 return plog_tr('Added new field to database').': '.$column; 21 21 } else { 22 22 if (defined('PLOGGER_DEBUG')) { 23 return 'Field `'.$column.'` already exists, ignoring.'; 24 } 25 } 26 } 27 28 function maybe_drop_column($table,$column) { 23 // return plog_tr('Field').' <strong>'.$column.'</strong> .'plog_tr('already exists, ignoring.').''; 24 return 'Field <strong>'.$column.'</strong> already exists, ignoring.'; 25 } 26 } 27 } 28 29 function maybe_drop_column($table, $column) { 29 30 $sql = "DESCRIBE $table"; 30 31 $res = mysql_query($sql); 31 32 $found = false; 32 while($row = mysql_fetch_array($res, MYSQL_NUM)) {33 while($row = mysql_fetch_array($res, MYSQL_NUM)) { 33 34 if ($row[0] == $column) $found = true; 34 35 } … … 39 40 } else { 40 41 if (defined('PLOGGER_DEBUG')) { 42 // return $column.' '.plog_tr('does not exist').''; 41 43 return $column.' does not exist'; 42 44 } … … 44 46 } 45 47 46 function maybe_add_table($table, $add_sql,$options = "") {48 function maybe_add_table($table, $add_sql, $options = '') { 47 49 $sql = "DESCRIBE $table"; 48 50 $res = mysql_query($sql); … … 57 59 } else { 58 60 if (defined('PLOGGER_DEBUG')) { 59 return 'Table `'.$table.'` already exists, ignoring.'; 61 // return plog_tr('Table').' <strong>'.$table.'</strong> .'plog_tr('already exists, ignoring.').''; 62 return 'Table <strong>'.$table.'</strong> already exists, ignoring.'; 60 63 } 61 64 } … … 71 74 $errors = array(); 72 75 73 // check that session.save_path is set (not set by default on PHP5) 74 $save_path = ini_get('session.save_path'); 75 if (empty($save_path)) { 76 $errors[] = sprintf( plog_tr('The PHP %s variable is not set in your php.ini file. Please contact your webhost on how to set this system variable.'), '<strong>session.save_path</strong>'); 77 } else if (!isset($_SESSION['plogger_session'])) { 78 // check that the session variable can be read 79 $errors[] = plog_tr('PHP session cookies are not being set. Please check that session cookies are enabled on your browser.'); 76 // check that the session variable can be read 77 if (!isset($_SESSION['plogger_session'])) { 78 $save_path = ini_get('session.save_path'); 79 // check that session.save_path is set (not set by default on PHP5) 80 if (empty($save_path)) { 81 if (!defined('SESSION_SAVE_PATH')) { 82 $sample_text = ' ('.sprintf(plog_tr('see %s if your %s does not contain this variable'), 'plog-config-sample.php', 'plog-config.php').')'; 83 } else { 84 $sample_text = ''; 85 } 86 $errors[] = sprintf( plog_tr('The PHP %s variable is not set in your php.ini file.'), '<strong>session.save_path</strong>').' '.sprintf(plog_tr('You can attempt to set this by adding a writable directory path to the %s variable in %s or contact your webhost on how to set this system variable.'), '<strong>SESSION_SAVE_PATH</strong>', 'plog-config.php'.$sample_text); 87 } else { 88 $errors[] = sprintf(plog_tr('PHP session cookies are not being set. Please check that session cookies are enabled on your browser or verify that your %s variable is set up correctly.'), '<strong>session.save_path</strong>').' '.sprintf(plog_tr('You can attempt to set this by adding a writable directory path to the %s variable in %s or contact your webhost on how to set this system variable.'), '<strong>SESSION_SAVE_PATH</strong>', 'plog-config.php'.$sample_text); 89 } 80 90 } 81 91 … … 90 100 } 91 101 92 // make sure we have permission to read these folders / files 93 $files_to_read = array("./","./plog-admin","./plog-admin/css","./plog-admin/images","./plog-content/images","./plog-content/thumbs","./plog-content/uploads","./plog-includes","./plog-includes/lib"); 94 foreach($files_to_read as $file){ 95 if (!is_readable(PLOGGER_DIR . $file)){ 96 $errors[] = sprintf( plog_tr("The path %s is not readable by the web server."), '<strong>'.realpath(PLOGGER_DIR . $file).'</strong>'); 97 } 98 } 99 100 // make sure we have permission to write to these folders 101 $files_to_write = array("./plog-content/images","./plog-content/thumbs", "./plog-content/uploads"); 102 foreach($files_to_write as $file){ 103 if (!is_writable(PLOGGER_DIR . $file)){ 104 $errors[] = sprintf( plog_tr("The path %s is not writable by the web server."), '<strong>'.realpath(PLOGGER_DIR . $file).'</strong>'); 102 // make sure we have permission to read these folders/files 103 $files_to_read = array('./plog-admin', './plog-admin/css', './plog-admin/images', './plog-content/images', './plog-content/thumbs', './plog-content/uploads', './plog-includes', './plog-includes/lib'); 104 foreach($files_to_read as $file) { 105 if (!is_readable(PLOGGER_DIR.$file)) { 106 $errors[] = sprintf(plog_tr('The path %s is not readable by the web server.'), '<strong>'.realpath(PLOGGER_DIR.$file).'</strong>'); 107 } 108 } 109 110 // workaround for upgrading from beta1 since there are conflicting function in plog-functions.php and beta1 plog-connect.php 111 if (function_exists('is_safe_mode')) { 112 // if safe mode enabled, we will use the FTP workarounds to deal with folder permissions 113 if (!is_safe_mode()) { 114 // make sure we have permission to write to these folders 115 $files_to_write = array('./plog-content/images', './plog-content/thumbs'); 116 $i = 0; 117 foreach($files_to_write as $file) { 118 if (!is_writable(PLOGGER_DIR.$file)) { 119 $errors[] = sprintf(plog_tr('The path %s is not writable by the web server.'), '<strong>'.realpath(PLOGGER_DIR.$file).'</strong>'); 120 } else if (is_open_perms(realpath(PLOGGER_DIR.$file))) { 121 $_SESSION['plogger_close_perms'][basename($file)] = realpath(PLOGGER_DIR.$file); 122 } 123 } 124 if (isset($_SESSION['plogger_close_perms'])) { 125 if (!is_writable(PLOGGER_DIR.'plog-content/')) { 126 $errors[] = sprintf(plog_tr('Please temporarily CHMOD the %s directory to 0777 to allow Plogger to create initial directories for increased security. You will be prompted to CHMOD the directory back to 0755 after installation is complete.'), '<strong>plog-content/</strong>'); 127 } 128 } 105 129 } 106 130 } 107 131 108 132 return $errors; 109 }110 111 function is_plogger_installed() {112 global $config;113 $installed = false;114 115 if (defined('PLOGGER_DB_HOST')) {116 $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME);117 if (empty($mysql)) {118 $sql = "DESCRIBE `".TABLE_PREFIX."config`";119 $result = mysql_query($sql);120 if ($result) {121 $installed = '<p>'.plog_tr('Plogger is already installed!').'</p>';122 $config_sql = "SELECT * FROM `".TABLE_PREFIX."config`";123 $config_result = mysql_query($config_sql);124 $config = mysql_fetch_assoc($config_result);125 }126 }127 }128 return $installed;129 133 } 130 134 … … 140 144 } 141 145 142 if (empty($form['db_pass'])) {143 $errors[] = plog_tr('Please enter the MySQL password.');144 }145 146 146 if (empty($form['db_name'])) { 147 147 $errors[] = plog_tr('Please enter the MySQL database name.'); … … 151 151 } 152 152 153 function check_mysql($host, $user, $pass, $database) {154 $errors = array();155 if (function_exists('mysql_connect')) {156 $connection = @mysql_connect($host,$user,$pass);157 if (!$connection) {158 $errors[] = plog_tr('Cannot connect to MySQL with the information provided. MySQL error: ')159 . mysql_error();160 }161 }162 $select = @mysql_select_db($database);163 if (!$select) {164 $errors[] = sprintf( plog_tr("Cannot find the database %s. MySQL error: "), '<strong>'.$database.'</strong>') . mysql_error();165 }166 return $errors;167 }168 169 153 function check_ftp_form($form) { 170 154 $errors = array(); … … 183 167 184 168 if (!empty($form['ftp_path'])) { 185 if (substr($form['ftp_path'], 0,1)!="/"){186 $form['ftp_path'] = "/".$form['ftp_path'];187 } 188 if (substr($form['ftp_path'], -1)!="/"){189 $form['ftp_path'] = $form['ftp_path']. "/";169 if (substr($form['ftp_path'], 0, 1) != '/'){ 170 $form['ftp_path'] = '/'.$form['ftp_path']; 171 } 172 if (substr($form['ftp_path'], -1) != '/'){ 173 $form['ftp_path'] = $form['ftp_path'].'/'; 190 174 } 191 175 } … … 199 183 $connection = @ftp_connect($host); 200 184 if (!$connection) { 201 $errors[] = sprintf( plog_tr("Cannot connect to FTP host %s. Please check your FTP Host:"), '<strong>'.$host.'</strong>');185 $errors[] = sprintf(plog_tr('Cannot connect to FTP host %s. Please check your FTP Host:'), '<strong>'.$host.'</strong>'); 202 186 } else { 203 187 $login = @ftp_login($connection, $user, $pass); 204 188 if (!$login) { 205 $errors[] = sprintf( plog_tr( "Cannot login to FTP host %s with username '%s' and password %s. Please check your FTP Username: and FTP Password:"), '<strong>'.$host.'</strong>', '<strong>'.$user.'</strong>', '<strong>'.$pass.'</strong>');189 $errors[] = sprintf( plog_tr('Cannot login to FTP host %s with username %s and password %s. Please check your FTP Username: and FTP Password:'), '<strong>'.$host.'</strong>', '<strong>'.$user.'</strong>', '<strong>'.$pass.'</strong>'); 206 190 } else { 207 $checkdir = @ftp_chdir($connection, $path. "plog-content/images/"); // check to see if the plog-content/images/ folder is accessible191 $checkdir = @ftp_chdir($connection, $path.'plog-content/images/'); // check to see if the plog-content/images/ folder is accessible 208 192 if (!$checkdir) { 209 $errors[] = sprintf( plog_tr("Cannot find the Plogger %s directory along the path %s. Please check your FTP path to Plogger base folder (from FTP login):"), 'plog-content/images/', '<strong>'.$path.'</strong>');193 $errors[] = sprintf(plog_tr('Cannot find the Plogger %s directory along the path %s. Please check your FTP path to Plogger base folder (from FTP login):'), '<strong>plog-content/images/</strong>', '<strong>'.$path.'</strong>'); 210 194 } 211 195 } … … 215 199 } 216 200 217 function recursive_rmdir($path) {218 // great function originally named advancedRmdir() by kisgabo94 at freemail dot hu219 $origipath = $path;220 $handler = opendir($path);221 while (true) {222 $item = readdir($handler);223 if ($item == "." or $item == "..") {224 continue;225 } elseif (gettype($item) == "boolean") {226 closedir($handler);227 if (!@rmdir($path)) {228 return false;229 }230 if ($path == $origipath) {231 break;232 }233 $path = substr($path, 0, strrpos($path, "/"));234 $handler = opendir($path);235 } elseif (is_dir($path."/".$item)) {236 closedir($handler);237 $path = $path."/".$item;238 $handler = opendir($path);239 } else {240 unlink($path."/".$item);241 }242 }243 return true;244 }245 246 201 /**** Install Functions ****/ 247 202 248 203 function do_install($form) { 249 $form = array_map('stripslashes', $form);250 $form = array_map('trim', $form);204 $form = array_map('stripslashes', $form); 205 $form = array_map('trim', $form); 251 206 252 207 // first check the requirements 253 208 $errors = check_requirements(); 254 209 if (sizeof($errors) > 0) { 255 echo "\t" .'<p class="errors">'.plog_tr('Plogger cannot be installed until the following problems are resolved').':</p>';256 echo "\n\n\t\t" .'<ul class="info">';210 echo "\t" . '<p class="errors">'.plog_tr('Plogger cannot be installed until the following problems are resolved').':</p>'; 211 echo "\n\n\t\t" . '<ul class="info">'; 257 212 foreach($errors as $error) { 258 echo "\n\t\t\t" .'<li>' . $error .'</li>';259 } 260 echo "\n\t\t" .'</ul>';261 echo "\n\n\t" .'<form method="get" action="'.$_SERVER['REQUEST_URI'].'">213 echo "\n\t\t\t" . '<li class="margin-5">'.$error.'</li>'; 214 } 215 echo "\n\t\t" . '</ul>'; 216 echo "\n\n\t" . '<form method="get" action="'.$_SERVER['REQUEST_URI'].'"> 262 217 <p><input class="submit" type="submit" value="'.plog_tr('Try again').'" /></p> 263 </form>' ."\n";218 </form>' . "\n"; 264 219 return false; 265 220 } … … 291 246 } 292 247 293 if ( !empty($form['action']) && $form['action'] == 'install') {248 if (isset($form['action']) && $form['action'] == 'install') { 294 249 if (!defined('PLOGGER_DB_HOST') || isset($mysql_fail)) { 295 250 $mysql_form_check = check_mysql_form($form); … … 304 259 305 260 if (empty($form['admin_email'])) { 306 $errors[] = plog_tr('Please enter your e-mail address.'); 307 } 308 309 if (ini_get('safe_mode') && function_exists('ftp_connect')) { 261 $errors[] = plog_tr('Please enter your email address.'); 262 } 263 264 if (empty($form['admin_username'])) { 265 $errors[] = plog_tr('Please enter a username.'); 266 } 267 268 if (empty($form['admin_password'])) { 269 $errors[] = plog_tr('Please enter a password.'); 270 } 271 272 if (is_safe_mode()) { 310 273 //if safe_mode enabled, check the FTP information form inputs 311 274 $ftp_form_check = check_ftp_form($form); … … 318 281 if (empty($errors)) { 319 282 $mysql_errors = check_mysql($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']); 320 if (i ni_get('safe_mode') && function_exists('ftp_connect')) {283 if (is_safe_mode()) { 321 284 $ftp_errors = check_ftp($form['ftp_host'], $form['ftp_user'], $form['ftp_pass'], $form['ftp_path']); 322 } else{285 } else { 323 286 $ftp_errors = array(); 324 287 } … … 328 291 329 292 if (!$ok) { 330 echo "<ul class=\"errors\" style=\"background-image: none;\">\n\t<li>";331 echo join("</li>\n\t<li >",$errors);293 echo '<ul class="errors" style="background-image: none;">' . "\n\t" . '<li class="margin-5">'; 294 echo join("</li>\n\t<li class=\"margin-5\">", $errors); 332 295 echo "</li>\n</ul>\n\n"; 333 296 } else { 334 $password = generate_password();335 297 $_SESSION['install_values'] = array( 336 298 'gallery_name' => $form['gallery_name'], 337 299 'admin_email' => $form['admin_email'], 338 'admin_password' => $ password,339 'admin_username' => 'admin'300 'admin_password' => $form['admin_password'], 301 'admin_username' => $form['admin_username'] 340 302 ); 341 if (i ni_get('safe_mode') && function_exists('ftp_connect')) {303 if (is_safe_mode()) { 342 304 $_SESSION['ftp_values'] = array( 343 305 'ftp_host' => $form['ftp_host'], … … 349 311 350 312 if (!defined('PLOGGER_DB_HOST') || isset($mysql_fail)) { 351 $conf = create_config_file($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']);352 313 // serve the config file and ask user to upload it to webhost 353 $_SESSION['plogger_config'] = $conf; 354 } 355 356 include(PLOGGER_DIR . 'plog-admin/includes/install-form-setup-complete.php'); 314 $_SESSION['plogger_config'] = create_config_file($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']); 315 } 357 316 return true; 358 317 } 359 318 } 360 319 361 include(PLOGGER_DIR . 'plog-admin/includes/install-form-setup.php'); 320 include(PLOGGER_DIR.'plog-admin/includes/install-form-setup.php'); 321 return false; 362 322 } 363 323 … … 367 327 // we are running on and to the right thing 368 328 $mysql_version = mysql_get_server_info(); 369 $mysql_charset_support = "4.1";370 $default_charset = "";371 372 if (1 == version_compare($mysql_version, $mysql_charset_support)) {373 $default_charset = "DEFAULT CHARACTER SET UTF8";329 $mysql_charset_support = '4.1'; 330 $default_charset = ''; 331 332 if (1 == version_compare($mysql_version, $mysql_charset_support)) { 333 $default_charset = 'DEFAULT CHARACTER SET UTF8'; 374 334 } 375 335 376 336 maybe_add_table( 377 TABLE_PREFIX .'collections'337 PLOGGER_TABLE_PREFIX.'collections' 378 338 ,"`name` varchar(128) NOT NULL default '', 379 339 `description` varchar(255) NOT NULL default '', … … 381 341 `id` int(11) NOT NULL auto_increment, 382 342 `thumbnail_id` int(11) NOT NULL DEFAULT '0', 383 PRIMARY KEY (id)"343 PRIMARY KEY (id)" 384 344 ,"Type=MyISAM $default_charset"); 385 345 386 346 maybe_add_table( 387 TABLE_PREFIX .'albums'347 PLOGGER_TABLE_PREFIX.'albums' 388 348 ," `name` varchar(128) NOT NULL default '', 389 349 `id` int(11) NOT NULL auto_increment, … … 392 352 `parent_id` int(11) NOT NULL default '0', 393 353 `thumbnail_id` int(11) NOT NULL default '0', 394 PRIMARY KEY (id),354 PRIMARY KEY (id), 395 355 INDEX pid_idx (parent_id)" 396 356 ," Type=MyISAM $default_charset"); 397 357 398 358 maybe_add_table( 399 TABLE_PREFIX .'pictures'359 PLOGGER_TABLE_PREFIX.'pictures' 400 360 ,"`path` varchar(255) NOT NULL default '', 401 361 `parent_album` int(11) NOT NULL default '0', … … 414 374 `EXIF_iso` varchar(64) NOT NULL default '', 415 375 `allow_comments` int(11) NOT NULL default '1', 416 PRIMARY KEY (id),376 PRIMARY KEY (id), 417 377 INDEX pa_idx (parent_album), 418 378 INDEX pc_idx (parent_collection)" … … 420 380 421 381 maybe_add_table( 422 TABLE_PREFIX .'comments'382 PLOGGER_TABLE_PREFIX.'comments' 423 383 ,"`id` int(11) NOT NULL auto_increment, 424 384 `parent_id` int(11) NOT NULL default '0', … … 430 390 `ip` char(64), 431 391 `approved` tinyint default '1', 432 PRIMARY KEY (id),392 PRIMARY KEY (id), 433 393 INDEX pid_idx (parent_id), 434 394 INDEX approved_idx (approved)" … … 436 396 437 397 maybe_add_table( 438 TABLE_PREFIX .'config'398 PLOGGER_TABLE_PREFIX.'config' 439 399 ,"`max_thumbnail_size` int(11) NOT NULL default '0', 440 400 `max_display_size` int(11) NOT NULL default '0', … … 470 430 `enable_thumb_nav` tinyint default '0', 471 431 `allow_fullpic` tinyint default '1', 472 PRIMARY KEY (`thumb_num`)"432 PRIMARY KEY (`thumb_num`)" 473 433 ,"Type=MyISAM $default_charset"); 474 434 475 435 maybe_add_table( 476 TABLE_PREFIX .'thumbnail_config'436 PLOGGER_TABLE_PREFIX.'thumbnail_config' 477 437 ,"`id` int(10) unsigned NOT NULL auto_increment, 478 438 `update_timestamp` int(10) unsigned default NULL, 479 439 `max_size` int(10) unsigned default NULL, 480 440 `disabled` tinyint default 0, 481 PRIMARY KEY (`id`)"441 PRIMARY KEY (`id`)" 482 442 ,"Type=MyISAM $default_charset"); 483 443 484 444 /*maybe_add_table( 485 TABLE_PREFIX .'tag2picture'445 PLOGGER_TABLE_PREFIX.'tag2picture' 486 446 ,"`tag_id` bigint(20) unsigned NOT NULL default '0', 487 447 `picture_id` bigint(20) unsigned NOT NULL default '0', … … 492 452 493 453 maybe_add_table( 494 TABLE_PREFIX .'tags'454 PLOGGER_TABLE_PREFIX.'tags' 495 455 ,"`id` bigint(20) unsigned NOT NULL auto_increment, 496 456 `tag` char(50) NOT NULL default '', … … 516 476 517 477 foreach($thumbnail_sizes as $key => $size) { 518 $sql = "INSERT INTO `". TABLE_PREFIX."thumbnail_config` (id,update_timestamp,max_size)519 VALUES('$key', '$long_ago','$size')";478 $sql = "INSERT INTO `".PLOGGER_TABLE_PREFIX."thumbnail_config` (id, update_timestamp, max_size) 479 VALUES('$key', '$long_ago', '$size')"; 520 480 mysql_query($sql); 521 481 } 522 482 523 $config['gallery_url'] = "http://".$_SERVER["SERVER_NAME"]. dirname(dirname($_SERVER["PHP_SELF"]));483 $config['gallery_url'] = 'http://'.$_SERVER['SERVER_NAME'].dirname(dirname($_SERVER['PHP_SELF'])); 524 484 // remove plog-admin/ from the end, if present .. is there a better way to determine the full url? 525 if (strpos($config['gallery_url'], "plog-admin/")) {526 $config['gallery_url'] = substr($config['gallery_url'], 0,strpos($config['gallery_url'], "plog-admin/"));485 if (strpos($config['gallery_url'], 'plog-admin/')) { 486 $config['gallery_url'] = substr($config['gallery_url'], 0, strpos($config['gallery_url'], 'plog-admin/')); 527 487 } 528 488 // verify that gallery URL contains a trailing slash. if not, add one. 529 if ($config['gallery_url']{strlen($config['gallery_url'])-1} != '/'){489 if ($config['gallery_url']{strlen($config['gallery_url'])-1} != '/') { 530 490 $config['gallery_url'] .= '/'; 531 491 } 532 492 // verify that the gallery URL begins with 'http://' for mod_rewrite 301 redirects 533 if (strpos($config['gallery_url'], 'http://') === false) {493 if (strpos($config['gallery_url'], 'http://') === false) { 534 494 $config['gallery_url'] = 'http://'.$config['gallery_url']; 535 495 } 536 $config['admin_username'] = 'admin';496 $config['admin_username'] = $form['admin_username']; 537 497 $config['admin_password'] = $form['admin_password']; 538 498 $config['admin_email'] = $form['admin_email']; 539 499 $config['gallery_name'] = $form['gallery_name']; 540 500 541 $config = array_map('mysql_real_escape_string', $config);542 543 $row_exist = mysql_query("SELECT * FROM `". TABLE_PREFIX."config`");501 $config = array_map('mysql_real_escape_string', $config); 502 503 $row_exist = mysql_query("SELECT * FROM `".PLOGGER_TABLE_PREFIX."config`"); 544 504 $row_exist_num = mysql_num_rows($row_exist); 545 505 546 506 if ($row_exist_num == 0) { 547 $query = "INSERT INTO `". TABLE_PREFIX."config`507 $query = "INSERT INTO `".PLOGGER_TABLE_PREFIX."config` 548 508 (`theme_dir`, 549 509 `compression`, … … 572 532 '${config['gallery_url']}')"; 573 533 } else { 574 $query = "UPDATE `". TABLE_PREFIX."config` SET534 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET 575 535 `theme_dir` = 'default', 576 536 `compression` = 75, … … 589 549 590 550 // create the FTP columns in the config table if safe_mode enabled/ 591 if (i ni_get('safe_mode') && isset($_SESSION['ftp_values'])) {551 if (is_safe_mode() && isset($_SESSION['ftp_values'])) { 592 552 configure_ftp($_SESSION['ftp_values']); 593 553 } … … 599 559 $config['admin_email'], 600 560 plog_tr('[Plogger] Your new gallery'), 601 plog_tr('You have successfully installed your new Plogger gallery.') ."\n\n".sprintf( plog_tr('You can log in and manage it at %s'), $config['gallery_url'].'plog-admin/')."\n\n".plog_tr('Username').': '.$config['admin_username']."\n".plog_tr('Password').': '.$config['admin_password'],561 plog_tr('You have successfully installed your new Plogger gallery.') . "\n\n" .sprintf(plog_tr('You can log in and manage it at %s'), $config['gallery_url'].'plog-admin/') . "\n\n" .plog_tr('Username').': '.$config['admin_username']. "\n" .plog_tr('Password').': '.$config['admin_password'], 602 562 'From: Plogger <noreply@'.$from.'>' 603 563 ); … … 605 565 606 566 function configure_ftp($form) { 607 maybe_add_column( TABLE_PREFIX.'config','ftp_host',"varchar(64) NOT NULL default ''");608 maybe_add_column( TABLE_PREFIX.'config','ftp_user',"varchar(64) NOT NULL default ''");609 maybe_add_column( TABLE_PREFIX.'config','ftp_pass',"varchar(64) NOT NULL default ''");610 maybe_add_column( TABLE_PREFIX.'config','ftp_path',"varchar(255) NOT NULL default ''");611 $query = "UPDATE `". TABLE_PREFIX."config` SET567 maybe_add_column(PLOGGER_TABLE_PREFIX.'config', 'ftp_host', "varchar(64) NOT NULL default ''"); 568 maybe_add_column(PLOGGER_TABLE_PREFIX.'config', 'ftp_user', "varchar(64) NOT NULL default ''"); 569 maybe_add_column(PLOGGER_TABLE_PREFIX.'config', 'ftp_pass', "varchar(64) NOT NULL default ''"); 570 maybe_add_column(PLOGGER_TABLE_PREFIX.'config', 'ftp_path', "varchar(255) NOT NULL default ''"); 571 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET 612 572 `ftp_host` = '".$form['ftp_host']."', 613 573 `ftp_user` = '".$form['ftp_user']."', … … 617 577 } 618 578 579 function fix_open_perms($dirs, $action = 'rename') { 580 if (!empty($dirs)) { 581 foreach ($dirs as $key => $dir) { 582 if ($action == 'delete') { 583 kill_dir(PLOGGER_DIR.'plog-content/'.$key); 584 } else { 585 @rename(PLOGGER_DIR.'plog-content/'.$key, PLOGGER_DIR.'plog-content/'.$key.'-old'); 586 } 587 makeDirs(PLOGGER_DIR.'plog-content/'.$key); 588 } 589 } 590 } 591 619 592 function create_config_file($db_host, $db_user, $db_pass, $db_name) { 620 593 $cfg_file = "<?php\n"; 621 $cfg_file .= '// this is the file used to connect to your database.'."\n"; 622 $cfg_file .= '// you must change these values in order to run the gallery.'."\n"; 623 $cfg_file .= 'define("PLOGGER_DB_HOST","'.$db_host.'");'."\n"; 624 $cfg_file .= 'define("PLOGGER_DB_USER","'.$db_user.'");'."\n"; 625 $cfg_file .= 'define("PLOGGER_DB_PW","'.addcslashes($db_pass, '\\$"').'");'."\n"; // escape certain password characters stored in double quotes (\) ($) (") 626 $cfg_file .= 'define("PLOGGER_DB_NAME","'.$db_name.'");'."\n"; 627 $cfg_file .= ''."\n"; 628 $cfg_file .= '// define("PLOGGER_EMBEDDED",""); // 1/0 (True/False) if set will overrule automatic check'."\n"; 629 $cfg_file .= '// define("PLOGGER_LOCALE",""); // da_DK de et fr pl ro_RO tr ...etc.'."\n"; 594 $cfg_file .= "/* You can manually modify this file before installing (renaming this file as plog-config.php before\n"; 595 $cfg_file .= " * installation) or you can let Plogger generate the file automatically by running the installation\n"; 596 $cfg_file .= " * script (run plog-admin/_install.php in your browser).\n\n"; 597 $cfg_file .= " * If you want to change the database connection information, you may also edit this file manually\n"; 598 $cfg_file .= " * after Plogger has been installed. */\n\n"; 599 $cfg_file .= "/* MySQL hostname */\n"; 600 $cfg_file .= "define('PLOGGER_DB_HOST', '".$db_host."');\n\n"; 601 $cfg_file .= "/* MySQL database username */\n"; 602 $cfg_file .= "define('PLOGGER_DB_USER', '".$db_user."');\n\n"; 603 $cfg_file .= "/* MySQL database password */\n"; 604 $cfg_file .= "define('PLOGGER_DB_PW', '".addcslashes($db_pass, "\\'")."');\n\n"; // escape certain password characters stored in single quotes (\) (') 605 $cfg_file .= "/* The name of the database for Plogger */\n"; 606 $cfg_file .= "define('PLOGGER_DB_NAME', '".$db_name."');\n\n"; 607 $cfg_file .= "/* Define the Plogger Database Table prefix. You can have multiple installations in one database\n"; 608 $cfg_file .= " * if you give each a unique prefix. Only numbers, letters, and underscores are permitted (i.e., plogger_). */\n"; 609 $cfg_file .= "define('PLOGGER_TABLE_PREFIX', 'plogger_');\n\n"; 610 $cfg_file .= "/* Define the Plogger directory permissions. Change permissions if you are having issues with images or sub-directories\n"; 611 $cfg_file .= " * being saved, moved, or deleted from the Plogger-created directories (i.e. Collections or Albums) */\n"; 612 $cfg_file .= "define('PLOGGER_CHMOD_DIR', 0755);\n\n"; 613 $cfg_file .= "/* Define the Plogger file permissions. Change permissions if you are having issues with\n"; 614 $cfg_file .= " * viewing, deleting, or moving images within Plogger (i.e. Pictures) */\n"; 615 $cfg_file .= "define('PLOGGER_CHMOD_FILE', 0644);\n\n"; 616 $cfg_file .= "/* Is Plogger embedded in another program, like WordPress?\n"; 617 $cfg_file .= " * 1/0 (True/False) if set will overrule automatic check */\n"; 618 $cfg_file .= "define('PLOGGER_EMBEDDED', '');\n\n"; 619 $cfg_file .= "/* Define a directory path to save session variables if you are having trouble\n"; 620 $cfg_file .= " * logging in or Plogger is telling you that you have session.save_path issues\n"; 621 $cfg_file .= " * and/or if your server php.ini setup has a blank session.save_path php.ini variable */\n"; 622 $cfg_file .= "define('PLOGGER_SESSION_SAVE_PATH', '');\n\n"; 623 $cfg_file .= "/* Plogger localized language, defaults to English. Change this to localize Plogger.\n"; 624 $cfg_file .= " * A corresponding MO file for the chosen language must be installed in /plog-content/translations/.\n"; 625 $cfg_file .= " * For example, upload de.mo to /plog-content/translations/ and set PLOGGER_LOCALE to 'de' to\n"; 626 $cfg_file .= " * enable German language support.\n"; 627 $cfg_file .= " * Example language codes: da, de, et, fr, pl, ro, tr, en-CA (for Canadian English) */\n"; 628 $cfg_file .= "define('PLOGGER_LOCALE', '');\n\n"; 630 629 $cfg_file .= "?>"; 631 630 return $cfg_file; … … 638 637 $output = array(); 639 638 640 /** plogger_thum nail_config **/639 /** plogger_thumbnail_config **/ 641 640 $thumb_table = maybe_add_table( 642 TABLE_PREFIX .'thumbnail_config'641 PLOGGER_TABLE_PREFIX.'thumbnail_config' 643 642 ,"`id` int(10) unsigned NOT NULL auto_increment, 644 643 `update_timestamp` int(10) unsigned default NULL, 645 644 `max_size` int(10) unsigned default NULL, 646 645 `disabled` tinyint default 0, 647 PRIMARY KEY (`id`)"646 PRIMARY KEY (`id`)" 648 647 ); 649 648 650 649 if ($thumb_table === true) { 651 $output[] = plog_tr('Added new table').': '. TABLE_PREFIX .'thumbnail_config';650 $output[] = plog_tr('Added new table').': '.PLOGGER_TABLE_PREFIX.'thumbnail_config'; 652 651 // use a random timestamp from the past to keep the existing thumbnails 653 652 $long_ago = 1096396500; … … 657 656 } 658 657 if (!isset($thumbnail_config[THUMB_SMALL]) || empty($thumbnail_config[THUMB_SMALL]['size'])) { 659 $sql = "INSERT INTO `". TABLE_PREFIX."thumbnail_config` (id,update_timestamp,max_size)660 VALUES('".THUMB_SMALL."', '".$long_ago."','".$config['max_thumbnail_size']."')";658 $sql = "INSERT INTO `".PLOGGER_TABLE_PREFIX."thumbnail_config` (id, update_timestamp, max_size) 659 VALUES('".THUMB_SMALL."', '".$long_ago."', '".$config['max_thumbnail_size']."')"; 661 660 mysql_query($sql); 662 661 } … … 666 665 } 667 666 if (!isset($thumbnail_config[THUMB_LARGE]) || empty($thumbnail_config[THUMB_LARGE]['size'])) { 668 $sql = "INSERT INTO `". TABLE_PREFIX."thumbnail_config` (id,update_timestamp,max_size)669 VALUES('".THUMB_LARGE."', '".$long_ago."','".$config['max_display_size']."')";667 $sql = "INSERT INTO `".PLOGGER_TABLE_PREFIX."thumbnail_config` (id, update_timestamp, max_size) 668 VALUES('".THUMB_LARGE."', '".$long_ago."', '".$config['max_display_size']."')"; 670 669 mysql_query($sql); 671 670 } … … 675 674 } 676 675 if (!isset($thumbnail_config[THUMB_RSS]) || empty($thumbnail_config[THUMB_RSS]['size'])) { 677 $sql = "INSERT INTO `". TABLE_PREFIX."thumbnail_config` (id,update_timestamp,max_size)678 VALUES('".THUMB_RSS."', '".$long_ago."','".$config['rss_thumbsize']."')";676 $sql = "INSERT INTO `".PLOGGER_TABLE_PREFIX."thumbnail_config` (id, update_timestamp, max_size) 677 VALUES('".THUMB_RSS."', '".$long_ago."', '".$config['rss_thumbsize']."')"; 679 678 mysql_query($sql); 680 679 } … … 684 683 } 685 684 if (!isset($thumbnail_config[THUMB_NAV]) || empty($thumbnail_config[THUMB_NAV]['size'])) { 686 $sql = "INSERT INTO `". TABLE_PREFIX."thumbnail_config` (id,update_timestamp,max_size)687 VALUES('".THUMB_NAV."', '".$long_ago."','".$config['nav_thumbsize']."')";685 $sql = "INSERT INTO `".PLOGGER_TABLE_PREFIX."thumbnail_config` (id, update_timestamp, max_size) 686 VALUES('".THUMB_NAV."', '".$long_ago."', '".$config['nav_thumbsize']."')"; 688 687 mysql_query($sql); 689 688 } … … 694 693 ); 695 694 foreach ($thumbnail_add_list as $key => $value) { 696 $result = maybe_add_column( TABLE_PREFIX.'thumbnail_config', $key, $value);695 $result = maybe_add_column(PLOGGER_TABLE_PREFIX.'thumbnail_config', $key, $value); 697 696 if (!empty($result)) { 698 697 $output[] = $result; … … 707 706 ); 708 707 foreach ($config_drop_list as $value) { 709 $result = maybe_drop_column( TABLE_PREFIX.'config', $value);708 $result = maybe_drop_column(PLOGGER_TABLE_PREFIX.'config', $value); 710 709 if (!empty($result)) { 711 710 $output[] = $result; … … 724 723 'default_sortdir' => "varchar(5) NOT NULL", 725 724 'default_sortby' => "varchar(20) NOT NULL", 726 // add field for admin e -mail725 // add field for admin email 727 726 'admin_email' => "varchar(50) NOT NULL", 728 727 // disable link to full size pic … … 748 747 ); 749 748 foreach ($config_add_list as $key => $value) { 750 $result = maybe_add_column( TABLE_PREFIX.'config', $key, $value);749 $result = maybe_add_column(PLOGGER_TABLE_PREFIX.'config', $key, $value); 751 750 if (!empty($result)) { 752 751 $output[] = $result; … … 756 755 // insert the gallery_url if not already set 757 756 if (!isset($config['gallery_url']) || empty($config['gallery_url'])) { 758 $config['baseurl'] = "http://".$_SERVER['HTTP_HOST'].dirname(dirname($_SERVER['PHP_SELF'])).'/';757 $config['baseurl'] = 'http://'.$_SERVER['HTTP_HOST'].dirname(dirname($_SERVER['PHP_SELF'])).'/'; 759 758 $output[] = plog_tr('Setting gallery url to ').$config['baseurl']; 760 $sql = "UPDATE `". TABLE_PREFIX."config` SET gallery_url = '" . $config['baseurl'] ."'";759 $sql = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET gallery_url = '".$config['baseurl']."'"; 761 760 mysql_query($sql); 762 761 } … … 764 763 // insert default theme directory if not already set 765 764 if (!isset($config['theme_dir']) || empty($config['theme_dir'])) { 766 $output[] = plog_tr( "Setting default theme directory to 'default'");767 $sql = "UPDATE ". TABLE_PREFIX."config SET `theme_dir` = 'default' WHERE 1";765 $output[] = plog_tr('Setting default theme directory to \'default\''); 766 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."config SET `theme_dir` = 'default' WHERE 1"; 768 767 mysql_query($sql); 769 768 } … … 777 776 ); 778 777 foreach ($collections_add_list as $key => $value) { 779 $result = maybe_add_column( TABLE_PREFIX.'collections', $key, $value);778 $result = maybe_add_column(PLOGGER_TABLE_PREFIX.'collections', $key, $value); 780 779 if (!empty($result)) { 781 780 $output[] = $result; … … 791 790 ); 792 791 foreach ($albums_add_list as $key => $value) { 793 $result = maybe_add_column( TABLE_PREFIX.'albums', $key, $value);792 $result = maybe_add_column(PLOGGER_TABLE_PREFIX.'albums', $key, $value); 794 793 if (!empty($result)) { 795 794 $output[] = $result; … … 804 803 ); 805 804 foreach ($pictures_add_list as $key => $value) { 806 $result = maybe_add_column( TABLE_PREFIX.'pictures', $key, $value);805 $result = maybe_add_column(PLOGGER_TABLE_PREFIX.'pictures', $key, $value); 807 806 if (!empty($result)) { 808 807 $output[] = $result; … … 817 816 ); 818 817 foreach ($comments_add_list as $key => $value) { 819 $result = maybe_add_column( TABLE_PREFIX.'comments', $key, $value);818 $result = maybe_add_column(PLOGGER_TABLE_PREFIX.'comments', $key, $value); 820 819 if (!empty($result)) { 821 820 $output[] = $result; … … 823 822 } 824 823 825 /*$output[] = maybe_add_table( TABLE_PREFIX.'tag2picture',"824 /*$output[] = maybe_add_table(PLOGGER_TABLE_PREFIX.'tag2picture'," 826 825 `tag_id` bigint(20) unsigned NOT NULL default '0', 827 826 `picture_id` bigint(20) unsigned NOT NULL default '0', … … 831 830 "); 832 831 833 $output[] = maybe_add_table( TABLE_PREFIX.'tags',"832 $output[] = maybe_add_table(PLOGGER_TABLE_PREFIX.'tags'," 834 833 `id` bigint(20) unsigned NOT NULL auto_increment, 835 834 `tag` char(50) NOT NULL default '', … … 841 840 ");*/ 842 841 843 $sql = 'ALTER TABLE '. TABLE_PREFIX.'comments ADD INDEX approved_idx (`approved`)';842 $sql = 'ALTER TABLE '.PLOGGER_TABLE_PREFIX.'comments ADD INDEX approved_idx (`approved`)'; 844 843 mysql_query($sql); 845 844 846 845 // add ip and approved fields to comments table 847 $sql = 'ALTER TABLE '. TABLE_PREFIX.'comments CHANGE `date` `date` datetime';846 $sql = 'ALTER TABLE '.PLOGGER_TABLE_PREFIX.'comments CHANGE `date` `date` datetime'; 848 847 mysql_query($sql); 849 848 … … 853 852 // we are running on and to the right hting 854 853 $mysql_version = mysql_get_server_info(); 855 $mysql_charset_support = "4.1";856 $default_charset = "";854 $mysql_charset_support = '4.1'; 855 $default_charset = ''; 857 856 858 857 if (1 == version_compare($mysql_version,$mysql_charset_support)) { 859 $charset = "utf8";860 $tables = array('collections', 'albums','pictures','comments','config','thumbnail_config');858 $charset = 'utf8'; 859 $tables = array('collections', 'albums', 'pictures', 'comments', 'config', 'thumbnail_config'); 861 860 foreach($tables as $table) { 862 $tablename = TABLE_PREFIX .$table;861 $tablename = PLOGGER_TABLE_PREFIX.$table; 863 862 $sql = "ALTER TABLE $tablename DEFAULT CHARACTER SET $charset"; 864 863 if (!mysql_query($sql)) { … … 876 875 877 876 // strip 'images/' prefix from pictures table 878 $sql = "UPDATE ". TABLE_PREFIX."pictures SET path = SUBSTRING(path,8) WHERE SUBSTRING(path,1,7) = 'images/'";877 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET path = SUBSTRING(path,8) WHERE SUBSTRING(path,1,7) = 'images/'"; 879 878 mysql_query($sql); 880 879 881 880 // update 'path' for collections table 882 $sql = "SELECT id,name FROM ". TABLE_PREFIX."collections";881 $sql = "SELECT id,name FROM ".PLOGGER_TABLE_PREFIX."collections"; 883 882 $result = mysql_query($sql); 884 883 while($row = mysql_fetch_assoc($result)) { 885 $sql = "UPDATE ". TABLE_PREFIX."collections SET path = '" . strtolower(sanitize_filename($row['name'])) . "' WHERE id = " .$row['id'];884 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."collections SET path = '".strtolower(sanitize_filename($row['name']))."' WHERE id = ".$row['id']; 886 885 mysql_query($sql); 886 if (!file_exists(PLOGGER_DIR.'plog-content/images/'.strtolower(sanitize_filename($row['name'])))) { 887 $list[$total] = array('container' => 1, 'new_path' => 'plog-content/images/'.strtolower(sanitize_filename($row['name']))); 888 $total++; 889 } 887 890 } 888 891 889 892 // update 'path' for albums table 890 $sql = "SELECT id,name FROM ".TABLE_PREFIX."albums"; 893 $sql = "SELECT a.id AS id, a.name AS name, c.path AS collection_path 894 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 895 WHERE a.parent_id = c.id"; 891 896 $result = mysql_query($sql); 892 897 while($row = mysql_fetch_assoc($result)) { 893 $sql = "UPDATE ". TABLE_PREFIX."albums SET path = '" . strtolower(sanitize_filename($row['name'])) . "' WHERE id = " .$row['id'];898 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET path = '".strtolower(sanitize_filename($row['name']))."' WHERE id = ".$row['id']; 894 899 mysql_query($sql); 900 if (!file_exists(PLOGGER_DIR.'plog-content/images/'.$row['collection_path'].'/'.strtolower(sanitize_filename($row['name'])))) { 901 $list[$total] = array('container' => 1, 'new_path' => 'plog-content/images/'.$row['collection_path'].'/'.strtolower(sanitize_filename($row['name']))); 902 $total++; 903 } 895 904 } 896 905 897 906 // loop through each image from the pictures table, get its parent album name and parent collection 898 907 $sql = "SELECT p.path AS path, p.id AS pid,c.path AS collection_path, a.path AS album_path 899 FROM ". TABLE_PREFIX."albums a, ".TABLE_PREFIX."pictures p, ".TABLE_PREFIX."collections c908 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."pictures p, ".PLOGGER_TABLE_PREFIX."collections c 900 909 WHERE p.parent_album = a.id AND p.parent_collection = c.id"; 901 910 $result = mysql_query($sql); … … 908 917 // if the file exists, grab the information and add to the total 909 918 if (!file_exists(PLOGGER_DIR.'plog-content/images/'.$new_path)) { 919 // first see if it's in the old directory structure 910 920 if (file_exists(PLOGGER_DIR.'images/'.$row['path'])) { 911 921 $path = 'images/'; 922 // next check the temporary folder location for closing folder permissions 923 } else if (file_exists(PLOGGER_DIR.'plog-content/images-old/'.$row['path'])) { 924 $path = 'plog-content/images-old/'; 925 // otherwise check if it's in the new structure, but set up without new sanitized paths 912 926 } else if (file_exists(PLOGGER_DIR.'plog-content/images/'.$row['path'])) { 913 927 $path = 'plog-content/images/'; … … 923 937 // add any photos from the uploads directory 924 938 if (file_exists(PLOGGER_DIR.'uploads/')) { 925 $old_uploads = get_files( PLOGGER_DIR.'uploads/', false, false, dirname(dirname(dirname(__FILE__))).'/uploads/');926 $new_uploads = get_files( PLOGGER_DIR.'plog-content/uploads/', false, false, dirname(dirname(dirname(__FILE__))).'/plog-content/uploads/');939 $old_uploads = get_files(PLOGGER_DIR.'uploads/', false, false, dirname(dirname(dirname(__FILE__))).'/uploads/'); 940 $new_uploads = get_files(PLOGGER_DIR.'plog-content/uploads/', false, false, dirname(dirname(dirname(__FILE__))).'/plog-content/uploads/'); 927 941 928 942 // compare the two paths for differences … … 948 962 if (!empty($image['id'])) { 949 963 // work on the images - move physical file, create directory if necessary and update path in database 950 if (!makeDirs(PLOGGER_DIR.'plog-content/images/'.dirname($image['new_path'].'/') , 0777)) {964 if (!makeDirs(PLOGGER_DIR.'plog-content/images/'.dirname($image['new_path'].'/'))) { 951 965 $errors[] = plog_tr('Could not create directory').': '.PLOGGER_DIR.'plog-content/images/'.$image['new_path']; 952 966 } else { 953 if (! @rename(PLOGGER_DIR.$image['old_path'], PLOGGER_DIR.'plog-content/images/'.$image['new_path'])) {967 if (!move_this(PLOGGER_DIR.$image['old_path'], PLOGGER_DIR.'plog-content/images/'.$image['new_path'])) { 954 968 $errors[] = plog_tr('Could not move file').': '.PLOGGER_DIR.$image['old_path']; 955 969 } else { 956 @chmod(PLOGGER_DIR.$new_path, 0755);957 $output[] = sprintf( plog_tr('Moved file %s -> %s'), '<strong>'.$image['old_path'].'</strong>', '<strong>'.'plog-content/images/'.$image['new_path'].'</strong>');970 @chmod(PLOGGER_DIR.$new_path, PLOGGER_CHMOD_DIR); 971 $output[] = sprintf(plog_tr('Moved file %s -> %s'), '<strong>'.$image['old_path'].'</strong>', '<strong>'.'plog-content/images/'.$image['new_path'].'</strong>'); 958 972 // generate a new small thumbnail 959 973 $thumbpath = generate_thumb(PLOGGER_DIR.'plog-content/images/'.$image['new_path'], $image['id'], THUMB_SMALL); 960 974 // update database 961 $sql = "UPDATE ". TABLE_PREFIX."pictures SET path = '".mysql_real_escape_string($image['new_path'])."' WHERE id = '".$image['id']."'";975 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET path = '".mysql_real_escape_string($image['new_path'])."' WHERE id = '".$image['id']."'"; 962 976 run_query($sql); 963 977 $count++; … … 966 980 } else if (!empty($image['uploads'])) { 967 981 // work on the uploads - move physical file and create directory in the uploads folder if necessary and update path in database 968 if (!makeDirs(PLOGGER_DIR.dirname($image['new_path'].'/') , 0777)) {982 if (!makeDirs(PLOGGER_DIR.dirname($image['new_path'].'/'))) { 969 983 $errors[] = plog_tr('Could not create directory').': '.PLOGGER_DIR.$image['new_path']; 970 984 } else { 971 if (! @rename(PLOGGER_DIR.$image['old_path'], PLOGGER_DIR.$image['new_path'])) {985 if (!move_this(PLOGGER_DIR.$image['old_path'], PLOGGER_DIR.$image['new_path'])) { 972 986 $errors[] = plog_tr('Could not move file').': '.PLOGGER_DIR.$image['old_path']; 973 987 } else { 974 @chmod(PLOGGER_DIR.$new_path, 0755);975 $output[] = sprintf( plog_tr('Moved file %s -> %s'), '<strong>'.$image['old_path'].'</strong>', '<strong>'.$image['new_path'].'</strong>');988 @chmod(PLOGGER_DIR.$new_path, PLOGGER_CHMOD_DIR); 989 $output[] = sprintf(plog_tr('Moved file %s -> %s'), '<strong>'.$image['old_path'].'</strong>', '<strong>'.$image['new_path'].'</strong>'); 976 990 $count++; 977 991 } 992 } 993 } else if (!empty($image['container'])) { 994 // create the collection and album directory structure 995 if (!makeDirs(PLOGGER_DIR.$image['new_path'].'/')) { 996 $errors[] = plog_tr('Could not create directory').': '.PLOGGER_DIR.$image['new_path']; 997 } else { 998 $output[] = sprintf(plog_tr('Created directory %s'), '<strong>'.$image['new_path'].'</strong>'); 999 $count++; 978 1000 } 979 1001 } … … 1002 1024 1003 1025 // see if there are any old translations 1004 if (file_exists(PLOGGER_DIR.'plog-tran lations/')) {1026 if (file_exists(PLOGGER_DIR.'plog-translations/')) { 1005 1027 $translations_old = get_files(PLOGGER_DIR.'plog-translations/', true, false, dirname(dirname(dirname(__FILE__))).'/plog-translations/'); 1006 1028 if (!empty($translations_old)) { … … 1025 1047 '_upgrade.php', 1026 1048 'plog-captcha.php', 1027 'plog-comment.php',1028 1049 'plog-connect.php', 1029 1050 'plog-functions.php', … … 1033 1054 'dynamics.js', 1034 1055 'slideshow.js', 1035 'captcha.ttf' 1056 'captcha.ttf', 1057 'plog-includes/plog-comment.php', 1058 'plog-includes/plog-tag-functions.php' 1036 1059 ); 1037 1060 foreach ($file_list as $file) { … … 1051 1074 'thumbs/', 1052 1075 'uploads/', 1053 'summary/' 1076 'summary/', 1077 'plog-content/images-old/', 1078 'plog-content/thumbs-old/' 1054 1079 ); 1055 1080 foreach ($folder_list as $folder) { … … 1070 1095 foreach ($files as $file) { 1071 1096 if (file_exists($file)) { 1072 @chmod($file, 0777); 1073 if (@unlink($file)) { 1074 $output[] = plog_tr('Plogger found and deleted the file').": ".$file; 1097 if (kill_file($file)) { 1098 $output[] = plog_tr('Plogger found and deleted the file').': '.$file; 1075 1099 } else { 1076 $errors[] = plog_tr('Plogger could not delete the file'). ": ".$file;1100 $errors[] = plog_tr('Plogger could not delete the file').': '.$file; 1077 1101 } 1078 1102 } … … 1082 1106 foreach ($folders as $folder) { 1083 1107 if (file_exists($folder)) { 1084 @chmod($file, 0777); 1085 if (@recursive_rmdir($folder)) { 1086 $output[] = plog_tr('Plogger found and deleted the folder').": ".$folder; 1108 if (kill_dir($folder)) { 1109 $output[] = plog_tr('Plogger found and deleted the folder').': '.$folder; 1087 1110 } else { 1088 $errors[] = plog_tr('Plogger could not delete the folder'). ": ".$folder;1111 $errors[] = plog_tr('Plogger could not delete the folder').': '.$folder; 1089 1112 } 1090 1113 } -
trunk/plog-admin/index.php
r588 r590 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 3 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");3 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 4 4 5 5 // if we're already logged in, redirect to the upload page 6 6 if (isset($_SESSION['plogger_logged_in']) && $_SESSION['plogger_logged_in'] === true) { 7 header( "Location: plog-upload.php");7 header('Location: plog-upload.php'); 8 8 exit; 9 9 } … … 21 21 // logout message 22 22 if (isset($_REQUEST['loggedout'])) { 23 $output .= "\t" . '<div id="login-action">' . plog_tr('You have been successfully logged out') .'</div>' . "\n\n";23 $output .= "\t" . '<div id="login-action">'.plog_tr('You have been successfully logged out').'</div>' . "\n\n"; 24 24 } 25 25 … … 29 29 30 30 case 1: // Reset password request completed, check email for confirmation link 31 $output .= "\t" . '<div id="login-action">' . plog_tr('Please check your email for the confirmation link.') . '</div>' . "\n\n";31 $output .= "\t" . '<div id="login-action">'.plog_tr('Please check your email for the confirmation link').'.</div>' . "\n\n"; 32 32 break; 33 33 34 34 case 2: // Verification successful, password has been reset, check email 35 $output .= "\t" . '<div id="login-action">' . plog_tr('Verification successful. Please check your email for the new password.') . '</div>' . "\n\n";35 $output .= "\t" . '<div id="login-action">'.plog_tr('Verification successful. Please check your email for the new password').'.</div>' . "\n\n"; 36 36 break; 37 37 38 38 case 3: // Password has been reset, login and reset password to permanent one 39 $output .= "\t" . '<div id="login-action">' . plog_tr('Please change your password after logging in.') . '</div>' . "\n\n";39 $output .= "\t" . '<div id="login-action">'.plog_tr('Please change your password after logging in').'.</div>' . "\n\n"; 40 40 break; 41 41 … … 47 47 if (isset($_REQUEST['loginerror'])) { 48 48 // Invalid login info, either username or password didn't match 49 $output .= "\t" . '<div id="login-error">' . plog_tr('Invalid username or password') .'</div>' . "\n\n";49 $output .= "\t" . '<div id="login-error">'.plog_tr('Invalid username or password').'</div>' . "\n\n"; 50 50 } 51 51 … … 55 55 56 56 case 1: // Password reset - invalid username or email address 57 $output .= "\t" . '<div id="login-error">' . plog_tr('Invalid admin username or email address') .'</div>' . "\n\n";57 $output .= "\t" . '<div id="login-error">'.plog_tr('Invalid admin username or email address').'</div>' . "\n\n"; 58 58 break; 59 59 60 60 case 2: // Password reset - Verification link is invalid or expired 61 $output .= "\t" . '<div id="login-error">' . plog_tr('Sorry, that verification key does not appear to be valid.') . '</div>' . "\n\n";61 $output .= "\t" . '<div id="login-error">'.plog_tr('Sorry, that verification key does not appear to be valid').'.</div>' . "\n\n"; 62 62 break; 63 63 64 64 case 3: // Password reset - email could not be sent 65 $output .= "\t" . '<div id="login-error">' . plog_tr('The email could not be sent. Possible reason: your host may have disabled the mail() function.') .'</div>' . "\n\n";65 $output .= "\t" . '<div id="login-error">'.plog_tr('The email could not be sent. Possible reason: your host may have disabled the mail() function.').'</div>' . "\n\n"; 66 66 break; 67 67 } … … 70 70 // create the form information 71 71 if(isset($_REQUEST['resetpassword'])) { 72 $output .= "\t" . '<div id="login-action">'.plog_tr('Please enter your username or email address and you will be notified via email the password reset process.').'</div>' . "\n\n"; 72 73 $form_content = '<p><label for="admin_email">'.plog_tr('Username or Email').'</label></p> 73 74 <p><input type="text" name="admin_email" id="admin_email" tabindex="10" /></p> … … 80 81 $link = '<a title="'.plog_tr('Reset password').'" href="'.$config['gallery_url'].'plog-admin/index.php?resetpassword">'.plog_tr('Reset password').'</a>' . "\n"; 81 82 } 82 83 close_db(); 83 84 ?> 84 85 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" … … 86 87 <html xmlns="http://www.w3.org/1999/xhtml"> 87 88 <head> 88 <title> <?php echo plog_tr('Plogger AdministrativeLogin') ?></title>89 <title>Plogger <?php echo plog_tr('Gallery Admin | Login') ?></title> 89 90 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 90 91 <link rel="stylesheet" href="<?php echo $config['gallery_url'] ?>plog-admin/css/login.css" type="text/css" media="all" /> -
trunk/plog-admin/js/plogger.js
r585 r590 1 function checkAll(form){ 2 for (i = 0, n = form.elements.length; i < n; i++) { 3 if(form.elements[i].type == "checkbox") { 4 if(form.elements[i].checked == true){ 5 form.elements[i].checked = false; 6 } 7 else{ 8 form.elements[i].checked = true; 1 function checkAll(form) { 2 for (var i=0;i<form.elements.length;i++) { 3 var e = form.elements[i]; 4 if ( (e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled) && (e.name.substr(0,14) != 'allow_comments')) { 5 e.checked = form.allbox.checked; 6 } 7 } 8 } 9 10 function checkToggle(form) { 11 for (var i=0;i<form.elements.length;i++) { 12 var e = form.elements[i]; 13 if ( (e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled) && (e.name.substr(0,14) != 'allow_comments')) { 14 if (e.checked == true) { 15 e.checked = false; 16 } else { 17 e.checked = true; 9 18 } 10 19 } … … 73 82 document.getElementById('caption').style.background = "#fafafa"; 74 83 document.getElementById('description').style.background = "#fafafa"; 75 } 76 else { 84 } else { 77 85 document.getElementById('caption').disabled = false; 78 86 document.getElementById('description').disabled = false; … … 84 92 85 93 function toggle(obj) { 86 var el = document.getElementById(obj); 87 if ( el.style.display != 'none' ) { 88 el.style.display = 'none'; 89 } 90 else { 91 el.style.display = ''; 94 var objarray = obj.split(', '); 95 while (objarray.length > 0) { 96 var el = document.getElementById(objarray.shift()); 97 if ( el.style.display != 'none' ) { 98 el.style.display = 'none'; 99 } else { 100 el.style.display = ''; 101 } 92 102 } 93 103 94 } 104 }; -
trunk/plog-admin/plog-admin-functions.php
r588 r590 1 1 <?php 2 2 3 function generate_password() { 4 $salt = md5(time().crypt("abcdefghkmnpqrstuvwxyz23456789")); 5 $src = preg_split("//", $salt, -1, PREG_SPLIT_NO_EMPTY); 6 shuffle($src); 7 $num = rand(5,8); 8 return join("", array_slice($src, 0, $num)); 3 if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) { 4 // ignorance is bliss 5 exit(); 9 6 } 10 7 … … 22 19 while($file = readdir($dir)) { 23 20 // Make sure the file exists 24 if($file != "." && $file != "..") {21 if($file != '.' && $file != '..') { 25 22 if (!$get_folders) { 26 23 if ($file[0] == '.') { … … 29 26 } 30 27 // If it's a directory, list all files within it 31 if (is_dir($directory . $sep .$file)) {32 $tmp2 = get_files($directory . $sep .$file, $get_all_files, $get_folders, $relative_path);28 if (is_dir($directory.$sep.$file)) { 29 $tmp2 = get_files($directory.$sep.$file, $get_all_files, $get_folders, $relative_path); 33 30 if (is_array($tmp2)) { 34 31 if (!isset($tmp2['files'])) { … … 41 38 if ($get_folders) { 42 39 if (!$relative_path) { 43 $tmp_folders[] = $directory . $sep .$file;40 $tmp_folders[] = $directory.$sep.$file; 44 41 } else { 45 $tmp_folders[] = str_replace($relative_path, '', $directory . $sep .$file);42 $tmp_folders[] = str_replace($relative_path, '', $directory.$sep.$file); 46 43 } 47 44 } 48 } else if (is_readable($directory . $sep .$file)) {45 } else if (is_readable($directory.$sep.$file)) { 49 46 $filename = basename(stripslashes($file)); 50 47 $pi = pathinfo($file); 51 48 if (is_allowed_extension($pi['extension']) || $get_all_files) { 52 49 if (!$relative_path) { 53 $tmp[] = $directory . $sep .$file;50 $tmp[] = $directory.$sep.$file; 54 51 } else { 55 $tmp[] = str_replace($relative_path, '', $directory . $sep .$file);52 $tmp[] = str_replace($relative_path, '', $directory.$sep.$file); 56 53 } 57 54 } … … 64 61 if ($get_folders) { 65 62 $return = array(); 66 67 63 // reverse the order of folders so subfolders come first 68 64 krsort($tmp_folders); 69 70 65 $return['files'] = $tmp; 71 66 $return['folders'] = $tmp_folders; … … 74 69 return $tmp; 75 70 } 76 71 } 72 73 function move_this($item, $destination) { 74 // if safe_mode enabled, open the permissions first 75 if (is_safe_mode()) { 76 $old_parent_path = dirname($item).'/'; 77 $new_parent_path = dirname($destination).'/'; 78 chmod_ftp($old_parent_path, 0777); 79 chmod_ftp($new_parent_path, 0777); 80 } 81 $move = @rename($item, $destination); 82 // if safe_mode enabled, close the permissions back down to the default 83 if (is_safe_mode()) { 84 chmod_ftp($old_parent_path); 85 chmod_ftp($new_parent_path); 86 } 87 if (!$move) { 88 return false; 89 } 90 return true; 91 } 92 93 function kill_dir($path) { 94 // great removal function originally named advancedRmdir() by kisgabo94 at freemail dot hu 95 $origipath = $path; 96 $handler = opendir($path); 97 while (true) { 98 $item = readdir($handler); 99 if ($item == '.' or $item == '..') { 100 continue; 101 } elseif (gettype($item) == 'boolean') { 102 closedir($handler); 103 // if safe_mode enabled, open the permissions first 104 if (is_safe_mode() && !is_writable(dirname($path).'/')) { 105 $parent_path = dirname($path).'/'; 106 chmod_ftp($parent_path, 0777); 107 } 108 $remove = @rmdir($path); 109 // if safe_mode enabled, close the permissions back down to the default 110 if (is_safe_mode()) { 111 chmod_ftp($parent_path); 112 } 113 if (!$remove) { 114 return false; 115 } 116 if ($path == $origipath) { 117 break; 118 } 119 $path = substr($path, 0, strrpos($path, '/')); 120 $handler = opendir($path); 121 } elseif (is_dir($path.'/'.$item)) { 122 closedir($handler); 123 $path = $path.'/'.$item; 124 $handler = opendir($path); 125 } else { 126 // if safe_mode enabled, open the permissions first 127 if (is_safe_mode() && !is_writable($path)) { 128 chmod_ftp($path.'/', 0777); 129 } 130 @unlink($path.'/'.$item); 131 } 132 } 133 return true; 134 } 135 136 function kill_file($file) { 137 // check if it's an uploaded file 138 $uploaded = is_uploaded_file($file); 139 // if safe_mode enabled, open the permissions first 140 if (is_safe_mode() && !$uploaded) { 141 $parent_path = dirname($file).'/'; 142 chmod_ftp($parent_path, 0777); 143 } 144 $remove = @unlink($file); 145 // if safe_mode enabled, close the permissions back down to the default 146 if (is_safe_mode() && !$uploaded) { 147 chmod_ftp($parent_path); 148 } 149 if (!$remove) { 150 return false; 151 } 152 return true; 153 } 154 155 function is_win() { 156 if (strtolower(substr(PHP_OS, 0, 3)) == 'win') { 157 return true; 158 } 159 return false; 160 } 161 162 function is_open_perms($file) { 163 if (!is_win()) { 164 clearstatcache(); 165 $perm = substr(decoct(fileperms($file)),2); 166 return ($perm == '0777'); 167 } 168 return false; 77 169 } 78 170 79 171 function generate_pagination_view_menu() { 80 $url_query = "?";172 $url_query = '?'; 81 173 $url_parts = parse_url($_SERVER['REQUEST_URI']); 82 174 if (isset($url_parts['query'])) { 83 175 // if entries_per_page is already present in URL, remove it 84 if (strpos($url_parts['query'], "entries_per_page") !== false || strpos($url_parts['query'], "plog_page") !== false) {176 if (strpos($url_parts['query'], 'entries_per_page') !== false || strpos($url_parts['query'], 'plog_page') !== false) { 85 177 parse_str($url_parts['query'], $query_parts); 86 178 foreach ($query_parts as $qkey => $qval) { 87 if ($qkey != "entries_per_page" && $qkey != "plog_page") {88 $url_query .= $qkey. "=".$qval."&";179 if ($qkey != 'entries_per_page' && $qkey != 'plog_page') { 180 $url_query .= $qkey.'='.$qval.'&'; 89 181 } 90 182 } 91 183 } else { 92 $url_query .= $url_parts['query']."&";93 } 94 } 95 96 $java = 'document.location.href =\''.$url_parts['path'].$url_query.'entries_per_page=\'+this.options[this.selectedIndex].value';97 98 $possible_values = array( "1"=>1, "5"=>5, "10"=>10, "20"=>20, "50"=>50, "100"=>100, "250"=>250, "500"=>500);99 $output= "\n\t\t\t" . '<label accesskey="e" for="entries_per_page">' .plog_tr('<em>E</em>ntries per page') .'</label>100 <select class="entries-page" onchange="'.$java.'" name="entries_per_page" id="entries_per_page" style="width: 60px;">';184 $url_query .= str_replace('&', '&', $url_parts['query']).'&'; 185 } 186 } 187 188 $java = 'document.location.href=\''.$url_parts['path'].$url_query.'entries_per_page=\'+this.options[this.selectedIndex].value'; 189 190 $possible_values = array('1'=>1, '5'=>5, '10'=>10, '20'=>20, '50'=>50, '100'=>100, '250'=>250, '500'=>500); 191 $output= "\n\t\t\t" . '<label accesskey="e" for="entries_per_page">'.plog_tr('<em>E</em>ntries per page').'</label> 192 <select class="entries-page" onchange="'.$java.'" name="entries_per_page" id="entries_per_page">'; 101 193 foreach ($possible_values as $key => $value) { 102 194 if ($_SESSION['entries_per_page'] == $key) { 103 $output .= "\n\t\t\t\t" .'<option value="'.$value.'" selected="selected">'.$key.'</option>';195 $output .= "\n\t\t\t\t" . '<option value="'.$value.'" selected="selected">'.$key.'</option>'; 104 196 } else { 105 $output .= "\n\t\t\t\t" .'<option value="'.$value.'">'.$key.'</option>';106 } 107 } 108 $output.= "\n\t\t\t" .'</select>';109 $output.= "\n\t\t\t" .'<input id="pagination-go" class="submit" type="submit" value="' . plog_tr('Go') .'" />';110 $output.= "\n\t\t\t<script type=\"text/javascript\">toggle('pagination-go');</script> \n";;197 $output .= "\n\t\t\t\t" . '<option value="'.$value.'">'.$key.'</option>'; 198 } 199 } 200 $output.= "\n\t\t\t" . '</select>'; 201 $output.= "\n\t\t\t" . '<input id="pagination-go" class="submit" type="submit" value="'.plog_tr('Go').'" />'; 202 $output.= "\n\t\t\t<script type=\"text/javascript\">toggle('pagination-go');</script>"; 111 203 return $output; 112 204 } 113 205 114 function add_picture($album_id, $tmpname,$filename,$caption,$desc) {206 function add_picture($album_id, $tmpname, $filename, $caption, $desc, $allow_comm = 1) { 115 207 global $config; 116 208 117 $filename_parts = explode( ".",strrev($filename),2);209 $filename_parts = explode('.', strrev($filename), 2); 118 210 $filename_base = strrev($filename_parts[1]); 119 211 $filename_ext = strrev($filename_parts[0]); … … 130 222 131 223 // now get the name of the collection 132 133 224 $sql = "SELECT c.path AS collection_path, c.id AS collection_id, 134 225 a.path AS album_path, a.id AS album_id 135 FROM ". TABLE_PREFIX."albums a, ".TABLE_PREFIX."collections c226 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 136 227 WHERE c.id = a.parent_id AND a.id = '$album_id'"; 137 228 … … 145 236 } 146 237 147 $dest_album_name = SmartStripSlashes($albumdata[ "album_path"]);148 $dest_collection_name = SmartStripSlashes($albumdata[ "collection_path"]);149 150 $create_path = $dest_collection_name. "/".$dest_album_name;151 152 while (is_file($config['basedir'].'plog-content/images/'.$create_path. "/".$unique_filename_base.".".$filename_ext)){153 $unique_filename_base = SmartStripSlashes($filename_base). "(" . ++$i .")";154 } 155 156 $final_filename = sanitize_filename($unique_filename_base) . "." .$filename_ext;157 158 // final fully qualified file name238 $dest_album_name = SmartStripSlashes($albumdata['album_path']); 239 $dest_collection_name = SmartStripSlashes($albumdata['collection_path']); 240 241 $create_path = $dest_collection_name.'/'.$dest_album_name; 242 243 while (is_file($config['basedir'].'plog-content/images/'.$create_path.'/'.$unique_filename_base.'.'.$filename_ext)) { 244 $unique_filename_base = SmartStripSlashes($filename_base).'('.++$i.')'; 245 } 246 247 $final_filename = sanitize_filename($unique_filename_base).'.'.$filename_ext; 248 249 // final fully qualified filename 159 250 $final_fqfn = $config['basedir'].'plog-content/images/'.$create_path.'/'.$final_filename; 160 251 161 if (!makeDirs($config['basedir'].'plog-content/images/'.$create_path , 0777)) {162 $result['errors'] .= sprintf(plog_tr('Could not create directory %s!'), $create_path);252 if (!makeDirs($config['basedir'].'plog-content/images/'.$create_path)) { 253 $result['errors'] .= sprintf(plog_tr('Could not create directory %s!'), '<strong>'.$create_path.'</strong>'); 163 254 return $result; 164 255 } 165 256 166 257 if (is_uploaded_file($tmpname)) { 167 if (!move_uploaded_file($tmpname,$final_fqfn)) { 168 $result['errors'] .= sprintf(plog_tr('Could not move uploaded file! %s to %s'),$tmpname,$final_fqfn); 169 return $result; 170 } 171 } 172 else 173 if (!rename($tmpname,$final_fqfn)) { 174 $result['errors'] .= sprintf(plog_tr('Could not move file! %s to %s'),$tmpname,$final_fqfn); 175 return $result; 176 } 177 178 if (is_file($tmpname)){ 179 @unlink($tmpname); 180 } 181 $res = @chmod($final_fqfn, 0777); 182 183 // Get the EXIF data. 184 require_once(PLOGGER_DIR . "plog-includes/lib/exifer1_7/exif.php"); 185 $exif_raw = read_exif_data_raw($final_fqfn,false); 186 $exif = array(); 187 188 $exif["date_taken"] = (isset($exif_raw["SubIFD"]["DateTimeOriginal"])) ? trim($exif_raw["SubIFD"]["DateTimeOriginal"]) : ''; 189 $exif["camera"] = (isset($exif_raw["IFD0"]["Make"]) && isset($exif_raw["IFD0"]["Model"])) ? trim($exif_raw["IFD0"]["Make"]) . " " . trim($exif_raw["IFD0"]["Model"]) : ''; 190 $exif["shutter_speed"] = (isset($exif_raw["SubIFD"]["ExposureTime"])) ? $exif_raw["SubIFD"]["ExposureTime"] : ''; 191 $exif["focal_length"] = (isset($exif_raw["SubIFD"]["FocalLength"])) ? $exif_raw["SubIFD"]["FocalLength"] : ''; 192 $exif["flash"] = (isset($exif_raw["SubIFD"]["Flash"])) ? $exif_raw["SubIFD"]["Flash"] : ''; 193 $exif["aperture"] = (isset($exif_raw["SubIFD"]["FNumber"])) ? $exif_raw["SubIFD"]["FNumber"] : ''; 194 $exif["iso"] = (isset($exif_raw["SubIFD"]["ISOSpeedRatings"])) ? $exif_raw["SubIFD"]["ISOSpeedRatings"] : ''; 195 196 $picture_path = $create_path . "/" . $final_filename; 197 198 $query = "INSERT INTO `".TABLE_PREFIX."pictures` 199 (`parent_collection`, 200 `parent_album`, 201 `path`, 202 `date_modified`, 203 `date_submitted`, 204 `allow_comments`, 205 `EXIF_date_taken`, 206 `EXIF_camera`, 207 `EXIF_shutterspeed`, 208 `EXIF_focallength`, 209 `EXIF_flash`, 210 `EXIF_aperture`, 211 `EXIF_iso`, 212 `caption`, 213 `description`) 214 VALUES 215 ('".$albumdata['collection_id']."', 216 '".$albumdata['album_id']."', 217 '".mysql_real_escape_string($picture_path)."', 218 NOW(), 219 NOW(), 220 1, 221 '".mysql_real_escape_string($exif["date_taken"])."', 222 '".mysql_real_escape_string($exif["camera"])."', 223 '".mysql_real_escape_string($exif["shutter_speed"])."', 224 '".mysql_real_escape_string($exif["focal_length"])."', 225 '".mysql_real_escape_string($exif["flash"])."', 226 '".mysql_real_escape_string($exif["aperture"])."', 227 '".mysql_real_escape_string($exif["iso"])."', 228 '".mysql_real_escape_string($caption)."', 229 '".mysql_real_escape_string($desc)."')"; 230 231 $sql_result = run_query($query); 232 233 $result['output'] .= sprintf(plog_tr('Your photo (%s) was uploaded successfully.'),$filename); 234 $result['picture_id'] = mysql_insert_id(); 235 236 // let's generate the thumbnail and the large thumbnail right away. 237 // this way, the user won't see any latency from the thumbnail generation 238 // when viewing the gallery for the first time 239 // this also helps with the image pre-loading problem introduced 240 // by a javascript slideshow. 241 242 $thumbpath = generate_thumb($picture_path, $result['picture_id'], THUMB_SMALL); 243 #$thumbpath = generate_thumb($picture_path, $result['picture_id'],THUMB_LARGE); 258 // if safe_mode enabled, open the permissions if the destination path 259 if (is_safe_mode()) { 260 $parent_path = $config['basedir'].'plog-content/images/'.$create_path; 261 chmod_ftp($parent_path, 0777); 262 } 263 if (!move_uploaded_file($tmpname, $final_fqfn)) { 264 $result['errors'] .= sprintf(plog_tr('Could not move uploaded file: %s to %s'), '<strong>'.$tmpname.'</strong>', '<strong>'.$final_fqfn.'</strong>'); 265 } 266 // if safe_mode enabled, close the permissions back down to the default 267 if (is_safe_mode()) { 268 chmod_ftp($parent_path); 269 } 270 } else { 271 if (!move_this($tmpname, $final_fqfn)) { 272 $result['errors'] .= sprintf(plog_tr('Could not move file: %s to %s'), '<strong>'.$tmpname.'</strong>', '<strong>'.$final_fqfn.'</strong>'); 273 } 274 } 275 276 if (empty($result['errors'])) { 277 if (is_file($tmpname)) { 278 kill_file($tmpname); 279 } 280 $res = @chmod($final_fqfn, PLOGGER_CHMOD_FILE); 281 282 // Get the EXIF data. 283 require_once(PLOGGER_DIR.'plog-includes/lib/exifer1_7/exif.php'); 284 $exif_raw = read_exif_data_raw($final_fqfn, false); 285 $exif = array(); 286 287 $exif['date_taken'] = (isset($exif_raw['SubIFD']['DateTimeOriginal'])) ? trim($exif_raw['SubIFD']['DateTimeOriginal']) : ''; 288 $exif['camera'] = (isset($exif_raw['IFD0']['Make']) && isset($exif_raw['IFD0']['Model'])) ? trim($exif_raw['IFD0']['Make']).' '.trim($exif_raw['IFD0']['Model']) : ''; 289 $exif['shutter_speed'] = (isset($exif_raw['SubIFD']['ExposureTime'])) ? $exif_raw['SubIFD']['ExposureTime'] : ''; 290 $exif['focal_length'] = (isset($exif_raw['SubIFD']['FocalLength'])) ? $exif_raw['SubIFD']['FocalLength'] : ''; 291 $exif['flash'] = (isset($exif_raw['SubIFD']['Flash'])) ? $exif_raw['SubIFD']['Flash'] : ''; 292 $exif['aperture'] = (isset($exif_raw['SubIFD']['FNumber'])) ? $exif_raw['SubIFD']['FNumber'] : ''; 293 $exif['iso'] = (isset($exif_raw['SubIFD']['ISOSpeedRatings'])) ? $exif_raw['SubIFD']['ISOSpeedRatings'] : ''; 294 295 $picture_path = $create_path.'/'.$final_filename; 296 297 $query = "INSERT INTO `".PLOGGER_TABLE_PREFIX."pictures` 298 (`parent_collection`, 299 `parent_album`, 300 `path`, 301 `date_modified`, 302 `date_submitted`, 303 `allow_comments`, 304 `EXIF_date_taken`, 305 `EXIF_camera`, 306 `EXIF_shutterspeed`, 307 `EXIF_focallength`, 308 `EXIF_flash`, 309 `EXIF_aperture`, 310 `EXIF_iso`, 311 `caption`, 312 `description`) 313 VALUES 314 ('".$albumdata['collection_id']."', 315 '".$albumdata['album_id']."', 316 '".mysql_real_escape_string($picture_path)."', 317 NOW(), 318 NOW(), 319 ".intval($allow_comm).", 320 '".mysql_real_escape_string($exif['date_taken'])."', 321 '".mysql_real_escape_string($exif['camera'])."', 322 '".mysql_real_escape_string($exif['shutter_speed'])."', 323 '".mysql_real_escape_string($exif['focal_length'])."', 324 '".mysql_real_escape_string($exif['flash'])."', 325 '".mysql_real_escape_string($exif['aperture'])."', 326 '".mysql_real_escape_string($exif['iso'])."', 327 '".mysql_real_escape_string($caption)."', 328 '".mysql_real_escape_string($desc)."')"; 329 330 $sql_result = run_query($query); 331 332 $result['output'] .= sprintf(plog_tr('Your image %s was uploaded successfully.'), '<strong>'.$filename.'</strong>'); 333 $result['picture_id'] = mysql_insert_id(); 334 335 // let's generate the thumbnail and the large thumbnail right away. 336 // this way, the user won't see any latency from the thumbnail generation 337 // when viewing the gallery for the first time 338 // this also helps with the image pre-loading problem introduced 339 // by a javascript slideshow. 340 341 $thumbpath = generate_thumb($picture_path, $result['picture_id'], THUMB_SMALL); 342 //$thumbpath = generate_thumb($picture_path, $result['picture_id'],THUMB_LARGE); 343 } 244 344 245 345 return $result; 246 } ;346 } 247 347 248 348 function update_picture($id, $caption, $allow_comments, $description) { … … 251 351 $description = mysql_real_escape_string($description); 252 352 $allow_comments = intval($allow_comments); 253 $query = "UPDATE ". TABLE_PREFIX."pictures SET353 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET 254 354 caption = '$caption', 255 355 description = '$description', … … 265 365 266 366 function update_picture_field($picture_id, $field, $value) { 267 $fields = array('caption', 'description');268 if (!in_array($field, $fields)) {367 $fields = array('caption', 'description'); 368 if (!in_array($field, $fields)) { 269 369 return array('errors' => plog_tr('Invalid action')); 270 } ;271 272 $errors = $output = "";370 } 371 372 $errors = $output = ''; 273 373 274 374 $picture_id = intval($picture_id); 275 375 $value = mysql_real_escape_string(trim($value)); 276 376 277 $query = "UPDATE ". TABLE_PREFIX."pictures SET $field = '$value' WHERE id='$picture_id'";377 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET $field = '$value' WHERE id='$picture_id'"; 278 378 279 379 $result = mysql_query($query); … … 281 381 return array('output' => plog_tr('You have successfully modified the selected picture.')); 282 382 } else { 283 return array('errors' => plog_tr('Could not modify selected picture '));284 } 285 286 } 287 288 function move_picture($pic_id, $to_album) {383 return array('errors' => plog_tr('Could not modify selected picture.')); 384 } 385 386 } 387 388 function move_picture($pic_id, $to_album) { 289 389 global $config; 290 390 // we need the parent_id from the album we're changing to … … 292 392 $pic_id = intval($pic_id); 293 393 294 $query = "SELECT * FROM ". TABLE_PREFIX."albums WHERE `id` = '".$to_album."'";394 $query = "SELECT * FROM ".PLOGGER_TABLE_PREFIX."albums WHERE `id` = '".$to_album."'"; 295 395 $result = run_query($query); 296 396 $row = mysql_fetch_assoc($result); 297 397 298 398 if (!is_array($row)) { 299 return array('errors' => sprintf(plog_tr('There is no album with id % d'),$to_album));399 return array('errors' => sprintf(plog_tr('There is no album with id %s.'), '<strong>'.$to_album.'</strong>')); 300 400 } 301 401 … … 306 406 307 407 $picture = get_picture_by_id($pic_id); 408 //if attempting to move within the same album, abort 409 if ($picture['parent_album'] == $to_album) { 410 return; 411 } 308 412 $album = get_album_by_id($to_album); 309 413 310 414 $filename = SmartStripSlashes(basename($picture['path'])); 311 $target_path = SmartStripSlashes($album['collection_path']). "/".SmartStripSlashes($album['album_path']);312 313 $filename_parts = explode( ".",strrev($filename),2);415 $target_path = SmartStripSlashes($album['collection_path']).'/'.SmartStripSlashes($album['album_path']); 416 417 $filename_parts = explode('.', strrev($filename), 2); 314 418 $filename_base = strrev($filename_parts[1]); 315 419 $filename_ext = strrev($filename_parts[0]); … … 317 421 318 422 $i = 0; 319 while ($to_album != $picture['parent_album'] && is_file($config['basedir'].'plog-content/images/'.$target_path. "/".$unique_filename_base.".".$filename_ext)){320 $unique_filename_base = $filename_base. "(" . ++$i . ")";423 while ($to_album != $picture['parent_album'] && is_file($config['basedir'].'plog-content/images/'.$target_path.'/'.$unique_filename_base.'.'.$filename_ext)) { 424 $unique_filename_base = $filename_base.'('.++$i.')'; 321 425 } 322 426 323 427 // final fully qualified file name 324 $picture_path = $target_path.'/'.sanitize_filename($unique_filename_base). ".".$filename_ext;428 $picture_path = $target_path.'/'.sanitize_filename($unique_filename_base).'.'.$filename_ext; 325 429 $final_fqfn = $config['basedir'].'plog-content/images/'.$picture_path; 326 430 327 if (!rename($config['basedir']."plog-content/images/".SmartStripSlashes($picture['path']), $final_fqfn)) { 328 return array('errors' => sprintf(plog_tr("Could not move file! %s to %s"),$picture['path'],$final_fqfn)); 431 $rename = move_this($config['basedir'].'plog-content/images/'.SmartStripSlashes($picture['path']), $final_fqfn); 432 @chmod($final_fqfn, PLOGGER_CHMOD_FILE); 433 434 if (!$rename) { 435 return array('errors' => sprintf(plog_tr('Could not move file: %s to %s'), '<strong>'.$picture['path'].'</strong>', '<strong>'.$final_fqfn.'</strong>')); 436 } 437 438 // check if collection thumbnail = picture moved to different collection and set to default if so 439 if ($picture['parent_collection'] != $new_collection) { 440 $collection = get_collection_by_id($picture['parent_collection']); 441 if ($collection['thumbnail_id'] == $picture['id']) { 442 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."collections SET `thumbnail_id`='0' WHERE id='".$collection['id']."'"; 443 run_query($query); 444 } 445 } 446 // check if album thumbnail = deleted picture and set to default if so 447 $album = get_album_by_id($picture['parent_album']); 448 if ($album['thumbnail_id'] == $picture['id']) { 449 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET `thumbnail_id`='0' WHERE id='".$album['id']."'"; 450 run_query($query); 329 451 } 330 452 331 453 // update database 332 $sql = "UPDATE ". TABLE_PREFIX."pictures SET454 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET 333 455 path = '".mysql_real_escape_string($picture_path)."', 334 456 parent_album = '".$to_album."', … … 342 464 343 465 function delete_picture($del_id) { 344 global $config ;466 global $config, $thumbnail_config; 345 467 $del_id = intval($del_id); 346 global $thumbnail_config;347 468 $picture = get_picture_by_id($del_id); 348 469 if ($picture) { 349 350 $query = "DELETE FROM ".TABLE_PREFIX."pictures WHERE `id`= '" . $picture['id'] . "'"; 470 // check if collection thumbnail = deleted picture and set to default if so 471 $collection = get_collection_by_id($picture['parent_collection']); 472 if ($collection['thumbnail_id'] == $picture['id']) { 473 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."collections SET `thumbnail_id`='0' WHERE id='".$collection['id']."'"; 474 run_query($query); 475 } 476 // check if album thumbnail = deleted picture and set to default if so 477 $album = get_album_by_id($picture['parent_album']); 478 if ($album['thumbnail_id'] == $picture['id']) { 479 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET `thumbnail_id`='0' WHERE id='".$album['id']."'"; 480 run_query($query); 481 } 482 483 $query = "DELETE FROM ".PLOGGER_TABLE_PREFIX."pictures WHERE `id`= '".$picture['id']."'"; 351 484 run_query($query); 352 485 353 486 // delete all comments for the picture 354 $query = "DELETE FROM ". TABLE_PREFIX."comments WHERE `parent_id`= '" . $picture['id'] ."'";487 $query = "DELETE FROM ".PLOGGER_TABLE_PREFIX."comments WHERE `parent_id`= '".$picture['id']."'"; 355 488 run_query($query); 356 489 357 490 // make sure that the file is actually located inside our 'plog-content/images/' directory 358 $full_path = realpath($config['basedir'] . 'plog-content/images/' . SmartStripSlashes($picture['path']));491 $full_path = $config['basedir'].'plog-content/images/'.SmartStripSlashes($picture['path']); 359 492 // also check whether this image is in the correct folder 360 $relative_path = substr($full_path, 0,strlen($config['basedir']));493 $relative_path = substr($full_path, 0, strlen($config['basedir'])); 361 494 $basename = SmartStripSlashes(basename($picture['path'])); 362 495 if ($relative_path == $config['basedir']) { … … 364 497 $thumbpath = $config['basedir'].'plog-content/thumbs/'.$tval['filename_prefix'].$picture['id'].'-'.$basename; 365 498 if (file_exists($thumbpath) && is_writable($thumbpath)) { 366 //print "deleting $thumbpath<br />"; 367 @chmod($thumbpath, 0777); 368 unlink($thumbpath); 369 }; 370 }; 499 //print 'deleting $thumbpath<br />'; 500 kill_file($thumbpath); 501 } 502 } 371 503 if (is_file($full_path)) { 372 // print "deleting $full_path<br />"; 373 @chmod($full_path, 0777); 374 375 if (!unlink($full_path)) 376 return array('errors' => plog_tr('Could not physically delete file from disk!')); 377 }; 504 if (!kill_file($full_path)) { 505 $errors = plog_tr('Could not physically delete file from disk!'); 506 } 507 } 378 508 } else { 379 return array('errors' => plog_tr('Picture has invalid path, ignoring delete request'));380 } ;509 $errors = plog_tr('Picture has invalid path, ignoring delete request.'); 510 } 381 511 } else { 382 return array('errors' => sprintf(plog_tr('There is no picture with id %d'),$del_id)); 383 }; 384 }; 512 $errors = sprintf(plog_tr('There is no picture with id %s.'), '<strong>'.$del_id.'</strong>'); 513 } 514 if (isset($errors)) { 515 return array('errors' => $errors); 516 } 517 return true; 518 } 385 519 386 520 function add_collection($collection_name, $description) { 387 521 global $config; 388 $output = $errors = "";522 $output = $errors = ''; 389 523 $id = 0; 390 524 $collection_name = trim(SmartStripSlashes($collection_name)); 391 525 if (empty($collection_name)) { 392 return array( "errors" => plog_tr("Please enter a valid name for the collection"));526 return array('errors' => plog_tr('Please enter a valid name for the collection.')); 393 527 } 394 528 395 529 $collection_folder = strtolower(sanitize_filename($collection_name)); 396 // first try to create the directory, and only if that succeeds, then insert 397 // a new row into collections table, otherwise the collection will not be usable398 // anyway399 $create_path = $config[ "basedir"] . "plog-content/images/".$collection_folder;530 531 // first try to create the directory, and only if that succeeds, then insert a new 532 // row into collections table, otherwise the collection will not be usable anyway 533 $create_path = $config['basedir'].'plog-content/images/'.$collection_folder; 400 534 401 535 // do not allow collections with duplicate names, otherwise mod_rewritten links will start … … 404 538 // if there is already a directory, check to see if it's in the database 405 539 $collection_data = get_collection_by_name($collection_name); 406 if ($collection_data) {540 if ($collection_data) { 407 541 // it's in the database, so throw duplicate collection error 408 return array( "errors" => sprintf(plog_tr('New collection could not be created, because there already is one named `%s`!'), $collection_name));409 } else {542 return array('errors' => sprintf(plog_tr('New collection could not be created, because there is already one named %s!'), '<strong>'.$collection_name.'</strong>')); 543 } else { 410 544 // it's not in the database so attempt to delete the directory 411 if (! @rmdir($create_path)){545 if (!kill_dir($create_path)) { 412 546 // could not delete the directory, so prompt the user to delete it manually 413 return array( "errors" => sprintf(plog_tr('Collection directory `%s` exists, but no collection exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $create_path));547 return array('errors' => sprintf(plog_tr('Collection directory %s exists, but no collection exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), '<strong>'.$create_path.'</strong>')); 414 548 } 415 549 } … … 417 551 418 552 // create directory 419 if (!makeDirs($create_path , 0777)) {420 $errors .= sprintf(plog_tr( "Could not create directory %s!"),$create_path);553 if (!makeDirs($create_path)) { 554 $errors .= sprintf(plog_tr('Could not create directory %s!'), '<strong>'.$create_path.'</strong>'); 421 555 } else { 422 556 $sql_name = mysql_real_escape_string($collection_name); 423 557 $description = mysql_real_escape_string($description); 424 558 $collection_folder = mysql_real_escape_string($collection_folder); 425 $query = "INSERT INTO ". TABLE_PREFIX."collections(`name`,`description`,`path`) VALUES ('$sql_name', '$description', '$collection_folder')";559 $query = "INSERT INTO ".PLOGGER_TABLE_PREFIX."collections (`name`,`description`,`path`) VALUES ('$sql_name', '$description', '$collection_folder')"; 426 560 $result = run_query($query); 427 561 $id = mysql_insert_id(); 428 562 429 $output .= sprintf(plog_tr('You have successfully created the collection <strong>%s</strong>'),$collection_name);563 $output .= sprintf(plog_tr('You have successfully created the collection %s.'), '<strong>'.$collection_name.'</strong>'); 430 564 } 431 565 … … 434 568 // as it needs 435 569 $result = array( 436 "output"=> $output,437 "errors"=> $errors,438 "id"=> $id,570 'output' => $output, 571 'errors' => $errors, 572 'id' => $id, 439 573 ); 440 574 return $result; … … 442 576 } 443 577 444 function update_collection($collection_id, $name,$description,$thumbnail_id = 0) {578 function update_collection($collection_id, $name, $description, $thumbnail_id = 0) { 445 579 global $config; 446 580 447 $errors = $output = "";581 $errors = $output = ''; 448 582 449 583 $name = trim(SmartStripSlashes($name)); 450 584 if (empty($name)) { 451 return array( "errors" => plog_tr("Please enter a valid name for the collection"));585 return array('errors' => plog_tr('Please enter a valid name for the collection.')); 452 586 } 453 587 454 588 $target_name = strtolower(sanitize_filename($name)); 455 589 456 $errors = $output = "";590 $errors = $output = ''; 457 591 458 592 $collection_id = intval($collection_id); … … 464 598 // rename the directory 465 599 // first, get the collection name of our source collection 466 $sql = "SELECT c.path as collection_path, name467 FROM ". TABLE_PREFIX."collections c600 $sql = "SELECT c.path as collection_path, name 601 FROM ".PLOGGER_TABLE_PREFIX."collections c 468 602 WHERE c.id = '$collection_id'"; 469 603 … … 471 605 $row = mysql_fetch_assoc($result); 472 606 473 $source_collection_name = SmartStripSlashes($row[ "collection_path"]);474 $source_path = $config[ "basedir"] . "plog-content/images/".$source_collection_name;475 $target_path = $config[ "basedir"] . "plog-content/images/".$target_name;476 477 // check for self-re -naming collection instance607 $source_collection_name = SmartStripSlashes($row['collection_path']); 608 $source_path = $config['basedir'].'plog-content/images/'.$source_collection_name; 609 $target_path = $config['basedir'].'plog-content/images/'.$target_name; 610 611 // check for self-renaming collection instance 478 612 if ($source_path != $target_path) { 479 613 // do not allow collections with duplicate names, otherwise mod_rewritten links will start … … 482 616 // if there is already a directory, check to see if it's in the database 483 617 $collection_data = get_collection_by_name($name); 484 if ($collection_data) {618 if ($collection_data) { 485 619 // it's in the database, so throw duplicate collection error 486 return array( "errors" => sprintf(plog_tr('Collection `%s` could not be renamed to `%s`, because there is another collection with that name'),$row['name'],$name));487 } else {620 return array('errors' => sprintf(plog_tr('Collection %s could not be renamed to %s, because there is another collection with that name.'), '<strong>'.$row['name'].'</strong>', '<strong>'.$name.'</strong>')); 621 } else { 488 622 // it's not in the database so attempt to delete the directory 489 if (! @rmdir($target_path)){623 if (!kill_dir($target_path)) { 490 624 // could not delete the directory, so prompt the user to delete it manually 491 return array( "errors" => sprintf(plog_tr('Collection directory `%s` exists, but no collection exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $target_path));625 return array('errors' => sprintf(plog_tr('Collection directory %s exists, but no collection exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), '<strong>'.$target_path.'</strong>')); 492 626 } 493 627 } … … 495 629 496 630 // perform the rename on the directory 497 if (! rename($source_path, $target_path)) {498 return array( "errors" => sprintf(plog_tr("Error renaming directory! (%s to %s)"),$source_path,$target_path));631 if (!move_this($source_path, $target_path)) { 632 return array('errors' => sprintf(plog_tr('Error renaming directory: %s to %s'), '<strong>'.$source_path.'</strong>', '<strong>'.$target_path.'</strong>')); 499 633 } 500 634 } … … 502 636 $target_name = mysql_real_escape_string($target_name); 503 637 504 $query = "UPDATE ". TABLE_PREFIX."collections SET name = '$name', path = '$target_name', description = '$description', thumbnail_id = '$thumbnail_id' WHERE id='$collection_id'";638 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."collections SET name = '$name', path = '$target_name', description = '$description', thumbnail_id = '$thumbnail_id' WHERE id='$collection_id'"; 505 639 $result = mysql_query($query); 506 640 if (!$result) { 507 return array( "errors"=> mysql_error());641 return array('errors' => mysql_error()); 508 642 } 509 643 … … 514 648 // update the path field for all pictures within that collection 515 649 // now we need to update the database paths of all pictures within source album 516 $sql = "SELECT p.id AS id, p.path AS path, c.name AS collection_name, a.path AS album_path517 FROM ". TABLE_PREFIX."albums a, ".TABLE_PREFIX."pictures p, ".TABLE_PREFIX."collections c650 $sql = "SELECT p.id AS id, p.path AS path, c.name AS collection_name, a.path AS album_path 651 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."pictures p, ".PLOGGER_TABLE_PREFIX."collections c 518 652 WHERE p.parent_album = a.id AND p.parent_collection = c.id AND p.parent_collection = '$collection_id'"; 519 653 … … 525 659 $album_path = $row['album_path']; 526 660 527 $new_path = mysql_real_escape_string(SmartStripSlashes($target_name. "/".$album_path."/".$filename));661 $new_path = mysql_real_escape_string(SmartStripSlashes($target_name.'/'.$album_path.'/'.$filename)); 528 662 529 663 // update database 530 $sql = "UPDATE ". TABLE_PREFIX."pictures SET path = '$new_path' WHERE id = '$row[id]'";664 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET path = '$new_path' WHERE id = '$row[id]'"; 531 665 mysql_query($sql) or ($output .= mysql_error()); 532 666 } 533 667 534 668 return array( 535 "errors"=> $errors,536 "output"=> $output,669 'errors' => $errors, 670 'output' => $output, 537 671 ); 538 672 } 539 673 540 674 function update_collection_field($collection_id, $field, $value) { 541 $fields = array('name', 'description');542 if (!in_array($field, $fields)) {675 $fields = array('name', 'description'); 676 if (!in_array($field, $fields)) { 543 677 return array('errors' => plog_tr('Invalid action')); 544 } ;545 546 $errors = $output = "";678 } 679 680 $errors = $output = ''; 547 681 548 682 $collection_id = intval($collection_id); 549 683 $value = mysql_real_escape_string(trim($value)); 550 684 551 $query = "UPDATE ". TABLE_PREFIX."collections SET $field = '$value' WHERE id='$collection_id'";685 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."collections SET $field = '$value' WHERE id='$collection_id'"; 552 686 553 687 $result = mysql_query($query); … … 555 689 return array('output' => plog_tr('You have successfully modified the selected collection.')); 556 690 } else { 557 return array('errors' => plog_tr('Could not modify selected collection '));691 return array('errors' => plog_tr('Could not modify selected collection.')); 558 692 } 559 693 … … 563 697 global $config; 564 698 $sql = "SELECT c.name AS collection_name, c.path AS collection_path, c.id AS collection_id 565 FROM ". TABLE_PREFIX."collections c699 FROM ".PLOGGER_TABLE_PREFIX."collections c 566 700 WHERE c.id = '$del_id'"; 567 701 … … 570 704 571 705 if (!$collection) { 572 return array('errors' => plog_tr('No such collection '));706 return array('errors' => plog_tr('No such collection.')); 573 707 } 574 708 575 709 // first delete all albums registered with this album 576 $sql = 'SELECT * FROM '. TABLE_PREFIX.'albums WHERE parent_id = ' .$collection['collection_id'];710 $sql = 'SELECT * FROM '.PLOGGER_TABLE_PREFIX.'albums WHERE parent_id = '.$collection['collection_id']; 577 711 $result = run_query($sql); 578 712 while ($row = mysql_fetch_assoc($result)) { … … 581 715 582 716 // XXX: un-register collection 583 $query = "DELETE FROM ". TABLE_PREFIX."collections WHERE `id`= '" . $collection['collection_id'] ."'";717 $query = "DELETE FROM ".PLOGGER_TABLE_PREFIX."collections WHERE `id`= '".$collection['collection_id']."'"; 584 718 run_query($query); 585 719 … … 587 721 // if there are then .. how did they get there? Probably not through plogger and in this case do we 588 722 // really want to delete those? 589 $source_collection_name = SmartStripSlashes($collection[ "collection_path"]);590 591 $collection_directory = realpath($config['basedir'] . 'plog-content/images/'.$source_collection_name);723 $source_collection_name = SmartStripSlashes($collection['collection_path']); 724 725 $collection_directory = $config['basedir'].'plog-content/images/'.$source_collection_name; 592 726 // check to see if the collection_directory is a real directory and then try to delete it 593 if (is_dir($collection_directory)){ 594 @chmod($collection_directory,0777); 595 $delete_result = rmdir($collection_directory); 596 if (!$delete_result) { 727 if (is_dir($collection_directory)) { 728 if (!kill_dir($collection_directory)) { 597 729 return array('errors' => plog_tr('Collection directory still contains files after all albums have been deleted.')); 598 730 } 599 600 731 } else { 601 return array('errors' => plog_tr('Collection has invalid path, not deleting directory '));732 return array('errors' => plog_tr('Collection has invalid path, not deleting directory.')); 602 733 } 603 734 return array(); … … 606 737 function add_album($album_name, $description, $pid) { 607 738 global $config; 608 $output = $errors = "";739 $output = $errors = ''; 609 740 $id = 0; 610 741 $album_name = trim(SmartStripSlashes($album_name)); 611 742 if (empty($album_name)) { 612 return array( "errors" => plog_tr("Please enter a valid name for the album"));743 return array('errors' => plog_tr('Please enter a valid name for the album.')); 613 744 } 614 745 // get the parent collection name 615 $query = "SELECT c.path as collection_path FROM ". TABLE_PREFIX."collections c WHERE id = '$pid'";746 $query = "SELECT c.path as collection_path FROM ". PLOGGER_TABLE_PREFIX."collections c WHERE id = '$pid'"; 616 747 617 748 $result = run_query($query); … … 620 751 // this shouldn't happen 621 752 if (empty($row)) { 622 return array( "errors" => plog_tr("No such collection"));753 return array('errors' => plog_tr('No such collection.')); 623 754 } 624 755 … … 627 758 // first try to create the directory to hold the images, if that fails, then the album 628 759 // will be unusable anyway 629 $create_path = $config['basedir'] . "plog-content/images/".SmartStripSlashes($row['collection_path'])."/".$album_folder;760 $create_path = $config['basedir'].'plog-content/images/'.SmartStripSlashes($row['collection_path']).'/'.$album_folder; 630 761 631 762 // check path so we are not creating duplicate albums within the same collection 632 if (is_dir($create_path)) {763 if (is_dir($create_path)) { 633 764 // if there is already a directory, check to see if it's in the database 634 765 $album_data = get_album_by_name($album_name, $pid); 635 766 if ($album_data) { 636 767 // it's in the database, so throw duplicate album error 637 return array( "output" => "existing", "id" => $album_data['id'], "errors" => sprintf(plog_tr('New album could not be created, because there already is one named `%s` in the collection `%s`!'), $album_folder, SmartStripSlashes($row['collection_path'])));768 return array('output' => 'existing', 'id' => $album_data['id'], 'errors' => sprintf(plog_tr('New album could not be created, because there is already one named %s in the collection %s'), '<strong>'.$album_folder.'</strong>', '<strong>'.ucfirst(SmartStripSlashes($row['collection_path']).'</strong>'))); 638 769 } else { 639 770 // it's not in the database so attempt to delete the directory 640 if (! @rmdir($create_path)){771 if (!kill_dir($create_path)) { 641 772 // could not delete the directory, so prompt the user to delete it manually 642 return array( "errors" => sprintf(plog_tr('Album directory `%s` exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $create_path));773 return array('errors' => sprintf(plog_tr('Album directory %s exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), '<strong>'.$create_path.'</strong>')); 643 774 } 644 775 } 645 776 } 646 777 647 if (!makeDirs($create_path , 0777)) {648 $errors .= sprintf(plog_tr( "Could not create directory %s!"),$path);778 if (!makeDirs($create_path)) { 779 $errors .= sprintf(plog_tr('Could not create directory %s!'), '<strong>'.$path.'</strong>'); 649 780 } else { 650 781 $sql_name = mysql_real_escape_string($album_name); 651 782 $description = mysql_real_escape_string($description); 652 783 $album_folder = mysql_real_escape_string($album_folder); 653 $query = "INSERT INTO ". TABLE_PREFIX."albums (`name`,`description`,`parent_id`,`path`) VALUES ('$sql_name', '$description', '$pid','$album_folder')";784 $query = "INSERT INTO ".PLOGGER_TABLE_PREFIX."albums (`name`,`description`,`parent_id`,`path`) VALUES ('$sql_name', '$description', '$pid', '$album_folder')"; 654 785 $result = run_query($query); 655 786 $id = mysql_insert_id(); 656 787 657 $output .= sprintf(plog_tr('You have successfully created the album <strong>%s</strong>'),$album_name);788 $output .= sprintf(plog_tr('You have successfully created the album %s.'), '<strong>'.$album_name.'</strong>'); 658 789 } 659 790 // caller can check the value of id, if it is zero, then album creation failed … … 661 792 // as it needs 662 793 $result = array( 663 "output"=> $output,664 "errors"=> $errors,665 "id"=> $id,794 'output' => $output, 795 'errors' => $errors, 796 'id' => $id, 666 797 ); 667 798 return $result; … … 670 801 function update_album($album_id, $name, $description, $thumbnail_id = 0) { 671 802 global $config; 672 $errors = $output = "";673 803 $errors = $output = ''; 804 674 805 $album_id = intval($album_id); 675 806 $thumbnail_id = intval($thumbnail_id); … … 677 808 $description = mysql_real_escape_string(SmartStripSlashes($description)); 678 809 if (empty($name)) { 679 return array( "errors" => plog_tr("Please enter a valid name for the album"));810 return array('errors' => plog_tr('Please enter a valid name for the album.')); 680 811 } 681 812 682 813 $target_name = strtolower(sanitize_filename(SmartStripSlashes($name))); 683 814 684 // first, get the album name and collection name of our source album815 // first, get the album name and collection name of our source album 685 816 $sql = "SELECT c.path AS collection_path, a.path AS album_path, a.parent_id AS collection_id 686 FROM ". TABLE_PREFIX."albums a, ".TABLE_PREFIX."collections c817 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 687 818 WHERE c.id = a.parent_id AND a.id = ".$album_id; 688 819 … … 691 822 692 823 $source_album_name = SmartStripSlashes($row['album_path']); 693 $source_collection_name = SmartStripSlashes($row['collection_path']); 694 695 $source_path = $config['basedir'] . "plog-content/images/".$source_collection_name."/".$source_album_name;696 $target_path = $config['basedir'] . "plog-content/images/".$source_collection_name."/".$target_name;824 $source_collection_name = SmartStripSlashes($row['collection_path']); 825 826 $source_path = $config['basedir'].'plog-content/images/'.$source_collection_name.'/'.$source_album_name; 827 $target_path = $config['basedir'].'plog-content/images/'.$source_collection_name.'/'.$target_name; 697 828 698 829 // check for self-re-naming album instance … … 704 835 if ($album_data) { 705 836 // it's in the database, so throw duplicate album error 706 return array( "errors" => sprintf(plog_tr('New album could not be created, because there already is one named `%s` in the collection `%s`!'), $target_name, $source_collection_name));837 return array('errors' => sprintf(plog_tr('New album could not be created, because there is already one named %s in the collection %s'), '<strong>'.$target_name.'</strong>', '<strong>'.$source_collection_name.'</strong>')); 707 838 } else { 708 839 // it's not in the database so attempt to delete the directory 709 if (! @rmdir($target_path)){840 if (!kill_dir($target_path)) { 710 841 // could not delete the directory, so prompt the user to delete it manually 711 return array( "errors" => sprintf(plog_tr('Album directory `%s` exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $target_path));842 return array('errors' => sprintf(plog_tr('Album directory %s exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), '<strong>'.$target_path.'</strong>')); 712 843 } 713 844 } … … 715 846 716 847 // perform the rename on the directory 717 if (!rename($source_path, $target_path)) 718 { 848 if (!move_this($source_path, $target_path)) { 719 849 return array( 720 "errors" => sprintf(plog_tr("Error renaming directory! (%s to %s)"),$source_path,$target_path));850 'errors' => sprintf(plog_tr('Error renaming directory: %s to %s'), '<strong>'.$source_path.'</strong>', '<strong>'.$target_path.'</strong>')); 721 851 } 722 852 } … … 725 855 726 856 // proceed only if rename succeeded 727 $query = "UPDATE ". TABLE_PREFIX."albums SET857 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET 728 858 name = '$name', 729 859 description = '$description', 730 860 thumbnail_id = '$thumbnail_id', 731 861 path = '$target_name' 732 WHERE id='$album_id'";862 WHERE id='$album_id'"; 733 863 734 864 $result = mysql_query($query); 735 865 if (!$result) { 736 return array( "errors"=> mysql_error());866 return array('errors' => mysql_error()); 737 867 } 738 868 … … 740 870 741 871 // update the path field for all pictures within that album 742 $sql = "SELECT p.path AS path, p.id AS id, c.name AS collection_name, a.name AS album_name743 FROM ". TABLE_PREFIX."albums a, ".TABLE_PREFIX."pictures p, ".TABLE_PREFIX."collections c872 $sql = "SELECT p.path AS path, p.id AS id, c.name AS collection_name, a.name AS album_name 873 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."pictures p, ".PLOGGER_TABLE_PREFIX."collections c 744 874 WHERE p.parent_album = a.id AND p.parent_collection = c.id AND p.parent_album = '$album_id'"; 745 875 … … 749 879 750 880 $filename = basename($row['path']); 751 $new_path = mysql_real_escape_string(SmartStripSlashes($source_collection_name. "/".$target_name."/".$filename));881 $new_path = mysql_real_escape_string(SmartStripSlashes($source_collection_name.'/'.$target_name.'/'.$filename)); 752 882 753 883 // update database 754 $sql = "UPDATE ". TABLE_PREFIX."pictures SET path = '$new_path' WHERE id = '$row[id]'";884 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET path = '$new_path' WHERE id = '$row[id]'"; 755 885 mysql_query($sql) or ($errors .= mysql_error()); 756 886 } 757 887 758 888 return array( 759 "errors"=> $errors,760 "output"=> $output,889 'errors' => $errors, 890 'output' => $output, 761 891 ); 762 892 } 763 893 764 894 function update_album_field($album_id, $field, $value) { 765 $fields = array('name', 'description');766 if (!in_array($field, $fields)) {895 $fields = array('name', 'description'); 896 if (!in_array($field, $fields)) { 767 897 return array('errors' => plog_tr('Invalid action')); 768 } ;898 } 769 899 770 900 $value = mysql_real_escape_string(trim(SmartStripSlashes($value))); 771 $errors = $output = "";901 $errors = $output = ''; 772 902 $album_id = intval($album_id); 773 903 774 904 // proceed only if rename succeeded 775 $query = "UPDATE ". TABLE_PREFIX."albums SET905 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET 776 906 $field = '$value' 777 WHERE id='$album_id'";907 WHERE id='$album_id'"; 778 908 779 909 $result = mysql_query($query); … … 782 912 return array('output' => plog_tr('You have successfully modified the selected album.')); 783 913 } else { 784 return array('errors' => plog_tr('Could not modify selected album '));785 } ;914 return array('errors' => plog_tr('Could not modify selected album.')); 915 } 786 916 } 787 917 … … 797 927 $to_collection = intval($to_collection); 798 928 799 $sql = "SELECT c.path as collection_path, a.path as album_path 800 FROM ".TABLE_PREFIX."albums a, ".TABLE_PREFIX."collections c 929 $sql = "SELECT 930 c.path as collection_path, 931 c.thumbnail_id as collection_thumb, 932 c.id as collection_id, 933 a.path as album_path 934 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 801 935 WHERE c.id = a.parent_id AND a.id = '$album_id'"; 802 936 … … 804 938 $row = mysql_fetch_assoc($result); 805 939 806 $source_album_name = SmartStripSlashes($row["album_path"]); 807 $source_collection_name = SmartStripSlashes($row["collection_path"]); 940 $source_album_name = SmartStripSlashes($row['album_path']); 941 $source_collection_name = SmartStripSlashes($row['collection_path']); 942 $source_collection_thumb = $row['collection_thumb']; 943 $source_collection_id = $row['collection_id']; 944 945 // if moving to same collection, abort 946 if ($to_collection == $source_collection_id) { 947 return; 948 } 808 949 809 950 // next, get the collection name of our destination collection 810 $sql = "SELECT c.path as collection_path 811 FROM ".TABLE_PREFIX."collections c 812 WHERE c.id = '$to_collection'"; 951 $sql = "SELECT c.path as collection_path FROM ".PLOGGER_TABLE_PREFIX."collections c WHERE c.id = '$to_collection'"; 813 952 814 953 $result = run_query($sql); 815 954 $row = mysql_fetch_assoc($result); 816 955 817 $target_collection_name = SmartStripSlashes($row[ "collection_path"]);818 $source_path = $config['basedir']. "plog-content/images/".$source_collection_name."/".$source_album_name;819 $target_path = $config['basedir']. "plog-content/images/".$target_collection_name."/".$source_album_name;956 $target_collection_name = SmartStripSlashes($row['collection_path']); 957 $source_path = $config['basedir'].'plog-content/images/'.$source_collection_name.'/'.$source_album_name.'/'; 958 $target_path = $config['basedir'].'plog-content/images/'.$target_collection_name.'/'.$source_album_name.'/'; 820 959 821 960 // check path so we are not creating duplicate albums within the same collection 822 if (is_dir($target_path)) {961 if (is_dir($target_path)) { 823 962 // if there is already a directory, check to see if it's in the database 824 963 $album_data = get_album_by_name($source_album_name, $to_collection); 825 964 if ($album_data) { 826 965 // it's in the database, so throw duplicate album error 827 return array( "errors" => sprintf(plog_tr('New album could not be created, because there already is one named `%s` in the collection `%s`!'), $source_album_name, $target_collection_name));966 return array('errors' => sprintf(plog_tr('New album could not be created, because there is already one named %s in the collection %s'), '<strong>'.$source_album_name.'</strong>', '<strong>'.$target_collection_name.'</strong>')); 828 967 } else { 829 968 // it's not in the database so attempt to delete the directory 830 if (! @rmdir($target_path)){969 if (!kill_dir($target_path)) { 831 970 // could not delete the directory, so prompt the user to delete it manually 832 return array( "errors" => sprintf(plog_tr('Album directory `%s` exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), $target_path));971 return array('errors' => sprintf(plog_tr('Album directory %s exists, but no album exists in the database. Attempt to delete automatically failed. Please delete folder via FTP manually and try again.'), '<strong>'.$target_path.'</strong>')); 833 972 } 834 973 } … … 836 975 837 976 // attempt to make new album directory in target collection 838 if (!makeDirs($target_path, 0777)) { 839 return array("errors" => sprintf(plog_tr('Could not create directory `%s`!'),$target_path)); 840 } 841 842 //if (!rename($source_path, $target_path)) 843 // $output .= '<p class="errors">Could not rename directory!</p>'; 977 if (!makeDirs($target_path)) { 978 return array('errors' => sprintf(plog_tr('Could not create directory %s!'), '<strong>'.$target_path.'</strong>')); 979 } 844 980 845 981 // now we need to update the database paths of all pictures within source album 846 982 $sql = "SELECT p.path as path, p.id as picture_id, c.name as collection_name, a.name as album_name 847 FROM ". TABLE_PREFIX."albums a, ".TABLE_PREFIX."pictures p, ".TABLE_PREFIX."collections c983 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."pictures p, ".PLOGGER_TABLE_PREFIX."collections c 848 984 WHERE p.parent_album = a.id AND p.parent_collection = c.id AND p.parent_album = '$album_id'"; 849 985 850 986 $result = run_query($sql); 987 $pic_ids = array(); 851 988 852 989 while($row = mysql_fetch_assoc($result)) { 853 990 $filename = SmartStripSlashes(basename($row['path'])); 854 855 $old_path = $source_path."/".$filename; 856 $new_path = $target_path."/".$filename; 857 858 if (!rename($old_path, $new_path)) 859 $res['errors'] .= sprintf(plog_tr("Could not move file! `%s` to `%s`"),$old_path,$new_path); 860 861 $path_insert = mysql_real_escape_string($target_collection_name."/".$source_album_name."/".$filename); 862 863 $sql = "UPDATE ".TABLE_PREFIX."pictures SET 991 $pic_ids[] = $row['picture_id']; 992 $old_path = $source_path.$filename; 993 $new_path = $target_path.$filename; 994 995 if (!move_this($old_path, $new_path)) { 996 $res['errors'] .= sprintf(plog_tr('Could not move file: %s to %s'), '<strong>'.$old_path.'</strong>', '<strong>'.$new_path.'</strong>'); 997 } else { 998 @chmod($new_path, PLOGGER_CHMOD_FILE); 999 } 1000 1001 $path_insert = mysql_real_escape_string($target_collection_name.'/'.$source_album_name.'/'.$filename); 1002 1003 $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET 864 1004 parent_collection = '$to_collection', 865 1005 path = '$path_insert' … … 868 1008 } 869 1009 1010 // check if collection thumbnail = picture moved to different collection and set to default if so 1011 if (in_array($source_collection_thumb, $pic_ids)) { 1012 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."collections SET `thumbnail_id`='0' WHERE id='".$source_collection_id."'"; 1013 run_query($query); 1014 } 1015 870 1016 // update the parent id of the moved album 871 $query = "UPDATE ". TABLE_PREFIX."albums SET `parent_id` = '$to_collection' WHERE `id`='$album_id'";1017 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET `parent_id` = '$to_collection' WHERE `id`='$album_id'"; 872 1018 $result = run_query($query); 873 1019 874 1020 // attempt to delete the old folder if there were no errors moving the files 875 if ($res['errors'] == ''){ 876 @chmod($source_path,0777); 877 if (!rmdir($source_path)) { 878 return array("errors" => sprintf(plog_tr('Could not remove album from collection `%s`. Album still contains files after all pictures have been moved.'), $source_collection_name)); 879 } 880 } 881 1021 if ($res['errors'] == '') { 1022 $remove = kill_dir($source_path); 1023 if (!$remove) { 1024 $res['errors'] .= sprintf(plog_tr('Could not remove album from collection %s. Album still contains files after all pictures have been moved.'), '<strong>'.$source_collection_name.'</strong>'); 1025 } 1026 } 882 1027 return $res; 883 1028 } … … 886 1031 global $config; 887 1032 $sql = "SELECT c.name AS collection_name, a.name AS album_name, a.id AS album_id, c.path AS collection_path, a.path AS album_path 888 FROM ". TABLE_PREFIX."albums a, ".TABLE_PREFIX."collections c1033 FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 889 1034 WHERE c.id = a.parent_id AND a.id = '$del_id'"; 890 1035 … … 897 1042 898 1043 // first delete all pictures registered with this album 899 $sql = 'SELECT * FROM '. TABLE_PREFIX.'pictures WHERE parent_album = ' .$album['album_id'];1044 $sql = 'SELECT * FROM '.PLOGGER_TABLE_PREFIX.'pictures WHERE parent_album = '.$album['album_id']; 900 1045 $result = run_query($sql); 901 1046 while ($row = mysql_fetch_assoc($result)) { … … 904 1049 905 1050 // XXX: un-register album 906 $query = "DELETE FROM ". TABLE_PREFIX."albums WHERE `id`= '" . $album['album_id'] ."'";1051 $query = "DELETE FROM ".PLOGGER_TABLE_PREFIX."albums WHERE `id`= '".$album['album_id']."'"; 907 1052 run_query($query); 908 1053 … … 910 1055 // if there are then .. how did they get there? Probably not through plogger and in this case do we 911 1056 // really want to delete those? 912 $source_album_name = SmartStripSlashes($album[ "album_path"]);913 $source_collection_name = SmartStripSlashes($album[ "collection_path"]);914 915 $album_directory = realpath($config['basedir'] . 'plog-content/images/'.$source_collection_name."/".$source_album_name);1057 $source_album_name = SmartStripSlashes($album['album_path']); 1058 $source_collection_name = SmartStripSlashes($album['collection_path']); 1059 1060 $album_directory = $config['basedir'].'plog-content/images/'.$source_collection_name.'/'.$source_album_name; 916 1061 // check to see if the album_directory is a real directory and then try to delete it 917 if (is_dir($album_directory)){ 918 @chmod($album_directory,0777); 919 $delete_result = rmdir($album_directory); 920 if (!$delete_result) { 1062 if (is_dir($album_directory)) { 1063 if (!kill_dir($album_directory)) { 921 1064 return array('errors' => plog_tr('Album directory still contains files after all pictures have been deleted.')); 922 1065 } 923 1066 924 1067 } else { 925 return array('errors' => plog_tr('Album has invalid path, not deleting directory '));1068 return array('errors' => plog_tr('Album has invalid path, not deleting directory.')); 926 1069 } 927 1070 return array(); 928 1071 } 929 1072 930 function update_comment($id, $author,$email,$url,$comment) {1073 function update_comment($id, $author, $email, $url, $comment) { 931 1074 $id = intval($id); 932 1075 $author = mysql_real_escape_string($author); … … 935 1078 $comment = mysql_real_escape_string(trim($comment)); 936 1079 937 $query = "UPDATE ".TABLE_PREFIX."comments SET author = '$author', comment = '$comment', 938 url = '$url', email = '$email' WHERE id='$id'"; 1080 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."comments SET author = '$author', comment = '$comment', url = '$url', email = '$email' WHERE id='$id'"; 939 1081 $result = mysql_query($query); 940 1082 if ($result) { 941 1083 return array('output' => plog_tr('You have successfully modified the selected comment.')); 942 1084 } else { 943 return array('errors' => plog_tr('Could not modify selected comment '));944 } ;1085 return array('errors' => plog_tr('Could not modify selected comment.')); 1086 } 945 1087 } 946 1088 947 1089 function update_comment_field($id, $field, $value) { 948 $allowed_fields = array('author', 'email','url','comment');949 if (!in_array($field, $allowed_fields)) {1090 $allowed_fields = array('author', 'email', 'url', 'comment'); 1091 if (!in_array($field, $allowed_fields)) { 950 1092 return array('errors' => plog_tr('Invalid action')); 951 } ;1093 } 952 1094 953 1095 $id = intval($id); 954 1096 $value = mysql_real_escape_string($value); 955 1097 956 $query = "UPDATE ". TABLE_PREFIX."comments SET $field = '$value' WHERE id='$id'";1098 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."comments SET $field = '$value' WHERE id='$id'"; 957 1099 $result = mysql_query($query); 958 1100 if ($result) { 959 1101 return array('output' => plog_tr('You have successfully modified the selected comment.')); 960 1102 } else { 961 return array('errors' => plog_tr('Could not modify selected comment '));962 } ;1103 return array('errors' => plog_tr('Could not modify selected comment.')); 1104 } 963 1105 } 964 1106 965 1107 function count_albums($parent_id = 0) { 966 1108 if (!$parent_id) 967 $numquery = "SELECT COUNT(*) AS `num_albums` FROM `". TABLE_PREFIX."albums`";1109 $numquery = "SELECT COUNT(*) AS `num_albums` FROM `".PLOGGER_TABLE_PREFIX."albums`"; 968 1110 else 969 $numquery = "SELECT COUNT(*) AS `num_albums` FROM `". TABLE_PREFIX."albums` WHERE parent_id = '$parent_id'";1111 $numquery = "SELECT COUNT(*) AS `num_albums` FROM `".PLOGGER_TABLE_PREFIX."albums` WHERE parent_id = '$parent_id'"; 970 1112 971 1113 $numresult = run_query($numquery); … … 976 1118 function count_collections() { 977 1119 978 $numquery = "SELECT COUNT(*) AS `num_collections` FROM `". TABLE_PREFIX."collections`";1120 $numquery = "SELECT COUNT(*) AS `num_collections` FROM `".PLOGGER_TABLE_PREFIX."collections`"; 979 1121 980 1122 $numresult = run_query($numquery); … … 985 1127 function count_pictures($parent_id = 0) { 986 1128 if (!$parent_id) 987 $numquery = "SELECT COUNT(*) AS `num_pics` FROM `". TABLE_PREFIX."pictures`";1129 $numquery = "SELECT COUNT(*) AS `num_pics` FROM `".PLOGGER_TABLE_PREFIX."pictures`"; 988 1130 else 989 $numquery = "SELECT COUNT(*) AS `num_pics` FROM `". TABLE_PREFIX."pictures` WHERE parent_album = '$parent_id'";1131 $numquery = "SELECT COUNT(*) AS `num_pics` FROM `".PLOGGER_TABLE_PREFIX."pictures` WHERE parent_album = '$parent_id'"; 990 1132 991 1133 $numresult = run_query($numquery); … … 994 1136 } 995 1137 996 function count_comments($parent_id = 0) {997 if (!$parent_id)998 $numquery = "SELECT COUNT(*) AS `num_comments` FROM `".TABLE_PREFIX."comments`";999 else1000 $numquery = "SELECT COUNT(*) AS `num_comments` FROM `".TABLE_PREFIX."comments` WHERE parent_id = '$parent_id'";1138 function count_comments($parent_id = false) { 1139 $numquery = "SELECT COUNT(*) AS `num_comments` FROM `".PLOGGER_TABLE_PREFIX."comments` WHERE approved = 1"; 1140 if ($parent_id !== false) { 1141 $numquery .= " AND parent_id = '".$parent_id."'"; 1142 } 1001 1143 1002 1144 $numresult = run_query($numquery); … … 1008 1150 $output = ''; 1009 1151 $comment_id = intval($comment_id); 1010 $sql = "SELECT * FROM ". TABLE_PREFIX."comments c WHERE c.id = '$comment_id'";1152 $sql = "SELECT * FROM ".PLOGGER_TABLE_PREFIX."comments c WHERE c.id = '$comment_id'"; 1011 1153 $result = run_query($sql); 1012 1154 $comment = mysql_fetch_assoc($result); 1013 if (!is_array($comment)) 1014 { 1155 if (!is_array($comment)) { 1015 1156 // XXX: return an error message instead 1016 1157 return false; 1017 1158 } 1018 $query = "";1019 if (strpos($_SERVER['PHP_SELF'], "plog-manage") !== false) {1020 $query = "?level=comments&id=".$comment['parent_id'];1021 } 1022 1023 $output .= "\n\t" . '<form class="edit " action="'.$_SERVER['PHP_SELF'].$query.'" method="post">';1159 $query = ''; 1160 if (strpos($_SERVER['PHP_SELF'], 'plog-manage') !== false) { 1161 $query = '?level=comments&id='.$comment['parent_id']; 1162 } 1163 1164 $output .= "\n\t" . '<form class="edit width-700" action="'.$_SERVER['PHP_SELF'].$query.'" method="post">'; 1024 1165 1025 1166 // get the thumbnail 1026 1167 $photo = get_picture_by_id($comment['parent_id']); 1027 $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'],THUMB_SMALL); 1028 $output .= "\n\t\t" . '<div style="float: right;"><img src="'.$thumbpath.'" alt="" /></div>'; 1029 1030 $output .= "\n\t\t<table>"; 1031 $output .= "\n\t\t\t" . '<tr> 1032 <td>' . plog_tr('Author:') . '<br /><input size="30" name="author" id="author" value="'.SmartStripSlashes($comment['author']).'" /></td> 1033 <td>' . plog_tr('Email:') . '<br /><input size="30" name="email" id="email" value="'.SmartStripSlashes($comment['email']).'" /></td> 1034 <td>' . plog_tr('Website:') . '<br /><input size="30" name="url" id="url" value="'.SmartStripSlashes($comment['url']).'" /></td> 1035 </tr> 1036 <tr> 1037 <td colspan="3">' . plog_tr('Comment:') . '<br /><textarea cols="70" rows="4" name="comment" id="comment">'.SmartStripSlashes($comment['comment']).'</textarea></td> 1038 </tr> 1039 </table>'; 1040 1041 $output .= "\n\t\t" . '<div> 1168 $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'], THUMB_SMALL); 1169 $output .= "\n\t\t" . '<div style="float: right;"><img src="'.$thumbpath.'" alt="" /></div> 1170 <div> 1171 <div class="strong">'.plog_tr('Edit Comment').'</div> 1172 <p> 1173 <label class="strong" accesskey="a" for="author">'.plog_tr('Author').':</label><br /> 1174 <input size="65" name="author" id="author" value="'.SmartStripSlashes($comment['author']).'" /> 1175 </p> 1176 <p> 1177 <label class="strong" accesskey="e" for="email">'.plog_tr('Email').':</label><br /> 1178 <input size="65" name="email" id="email" value="'.SmartStripSlashes($comment['email']).'" /> 1179 </p> 1180 <p> 1181 <label class="strong" accesskey="u" for="url">'.plog_tr('Website').':</label><br /> 1182 <input size="65" name="url" id="url" value="'.SmartStripSlashes($comment['url']).'" /> 1183 </p> 1184 <p> 1185 <label class="strong" accesskey="c" for="comment">'.plog_tr('Comment').':</label><br /> 1186 <textarea cols="62" rows="4" name="comment" id="comment">'.SmartStripSlashes($comment['comment']).'</textarea> 1187 </p> 1042 1188 <input type="hidden" name="pid" value="'.$comment['id'].'" /> 1043 1189 <input type="hidden" name="action" value="update-comment" /> 1044 <input class="submit" name="update" value="' . plog_tr('Update') .'" type="submit" />1045 <input class="submit " name="cancel" value="' . plog_tr('Cancel') .'" type="submit" />1046 </div> ';1047 $output .= "\n\t" . '</form>';1190 <input class="submit" name="update" value="'.plog_tr('Update').'" type="submit" /> 1191 <input class="submit-cancel" name="cancel" value="'.plog_tr('Cancel').'" type="submit" /> 1192 </div> 1193 </form>' . "\n"; 1048 1194 return $output; 1049 1195 } 1050 1196 1051 function makeDirs($strPath, $mode = 0777) //creates directory tree recursively 1052 { 1053 if (ini_get('safe_mode') && function_exists('ftp_connect')){ 1054 return is_dir($strPath) or ( makeDirs(dirname($strPath), $mode) and FTP_makeDirs($strPath) ); 1055 }else{ 1056 return is_dir($strPath) or ( makeDirs(dirname($strPath), $mode) and mkdir($strPath, $mode) and chmod($strPath, $mode)); 1057 } 1058 } 1059 1060 function FTP_makeDirs($strPath){ 1061 global $config; 1062 1063 $ftpserver = $config['ftp_host']; 1064 $ftpuser = $config['ftp_user']; 1065 $ftppass = $config['ftp_pass']; 1066 1067 $ftppath = str_replace($config['basedir'], '', $strPath); 1068 $ftpDir = dirname($ftppath); 1069 $ftpnewDir = str_replace($ftpDir."/", '', $ftppath); 1070 1197 function makeDirs($path, $mode = PLOGGER_CHMOD_DIR) { //creates directory tree recursively 1198 if (is_safe_mode()) { 1199 return is_dir($path) or (makeDirs(dirname($path), $mode) and makeDirs_ftp($path)); 1200 } else { 1201 return is_dir($path) or (makeDirs(dirname($path), $mode) and mkdir($path, $mode) and configure_blank_index($path) and chmod($path, $mode)); 1202 } 1203 } 1204 1205 1206 /** These functions are for safe_mode enabled servers **/ 1207 function connect_ftp() { 1208 global $config, $PLOGGER_FTP; 1209 1210 $ftp_server = $config['ftp_host']; 1211 $ftp_user = $config['ftp_user']; 1212 $ftp_pass = $config['ftp_pass']; 1213 1071 1214 // create connection 1072 $ ftpconnection = ftp_connect($ftpserver);1215 $PLOGGER_FTP = ftp_connect($ftp_server); 1073 1216 // login to ftp server 1074 $ftp result = ftp_login($ftpconnection, $ftpuser, $ftppass);1217 $ftp_result = ftp_login($PLOGGER_FTP, $ftp_user, $ftp_pass); 1075 1218 1076 1219 // check if connection was made 1077 if ((!$ ftpconnection) || (!$ftpresult)) {1220 if ((!$PLOGGER_FTP) || (!$ftp_result)) { 1078 1221 return false; 1079 }else{ 1080 ftp_chdir($ftpconnection, $config['ftp_path'].$ftpDir); // go to destination dir 1081 $ftpcreatedir = @ftp_mkdir($ftpconnection, $ftpnewDir); // create directory 1082 if ($ftpcreatedir == true){ 1083 $ftpexecdir = @ftp_site($ftpconnection, 'chmod 0777 '.$ftpnewDir.'/'); 1084 }else{ 1085 return false; 1086 } 1087 if ($ftpexecdir == true){ 1088 return true; 1089 }else{ 1090 return false; 1091 } 1092 ftp_close($ftpconnection); // close connection 1093 } 1094 } 1095 1096 // 1222 } 1223 return true; 1224 } 1225 1226 function close_ftp() { 1227 global $PLOGGER_FTP; 1228 1229 if (isset($PLOGGER_FTP)) { 1230 ftp_close($PLOGGER_FTP); 1231 } 1232 } 1233 1234 function makeDirs_ftp($path) { 1235 global $config, $PLOGGER_FTP; 1236 $return = false; 1237 1238 $ftp_path = str_replace($config['basedir'], '', $path); 1239 $ftp_dir = dirname($ftp_path); 1240 $ftp_new_dir = str_replace($ftp_dir.'/', '', $ftp_path); 1241 1242 if (!isset($PLOGGER_FTP)) { 1243 // check if connection was made 1244 $ftp_connection = connect_ftp(); 1245 if ($ftp_connection === false) { 1246 return $return; 1247 } 1248 } 1249 ftp_chdir($PLOGGER_FTP, $config['ftp_path'].$ftp_dir); // go to destination dir 1250 $ftp_create_dir = ftp_mkdir($PLOGGER_FTP, $ftp_new_dir); // create directory 1251 if ($ftp_create_dir) { 1252 chmod_ftp($path, 0777); 1253 configure_blank_index($path); 1254 $chmod = decoct(PLOGGER_CHMOD_DIR); 1255 $ftp_exec_dir = ftp_site($PLOGGER_FTP, 'CHMOD '.$chmod.' '.$ftp_new_dir.'/'); 1256 } 1257 if ($ftp_exec_dir) { 1258 $return = true; 1259 } else { 1260 echo 'could not chmod!'; 1261 } 1262 return $return; 1263 } 1264 1265 function chmod_ftp($path, $mode = PLOGGER_CHMOD_DIR) { 1266 global $config, $PLOGGER_FTP; 1267 $return = false; 1268 1269 $ftp_chmod_dir = str_replace($config['basedir'], $config['ftp_path'], $path); 1270 1271 if (!isset($PLOGGER_FTP)) { 1272 // check if connection was made 1273 $ftp_connection = connect_ftp(); 1274 if ($ftp_connection === false) { 1275 return $return; 1276 } 1277 } 1278 $chmod = decoct($mode); 1279 $ftp_exec_dir = @ftp_site($PLOGGER_FTP, 'CHMOD '.$chmod.' '.$ftp_chmod_dir); 1280 if ($ftp_exec_dir) { 1281 $return = true; 1282 } 1283 return $return; 1284 } 1285 /** END functions for safe_mode enabled servers **/ 1286 1097 1287 function configure_htaccess_fullpic($allow = false) { 1098 $cfg = "";1099 $placeholder_start = "# BEGIN Plogger";1100 $placeholder_end = "# END Plogger";1101 $thisfile = "/plog-admin/" .basename(__FILE__);1102 $adm = strpos($_SERVER[ "PHP_SELF"],"/plog-admin");1103 $rewritebase = substr($_SERVER[ "PHP_SELF"],0,$adm);1288 $cfg = ''; 1289 $placeholder_start = '# BEGIN Plogger'; 1290 $placeholder_end = '# END Plogger'; 1291 $thisfile = '/plog-admin/'.basename(__FILE__); 1292 $adm = strpos($_SERVER['PHP_SELF'], '/plog-admin'); 1293 $rewritebase = substr($_SERVER['PHP_SELF'], 0, $adm); 1104 1294 if (!$allow) { 1105 1295 $cfg .= "deny from all\n"; … … 1107 1297 // read the file 1108 1298 global $config; 1109 $fpath = $config[ "basedir"] . "plog-content/images/.htaccess";1299 $fpath = $config['basedir'].'plog-content/images/.htaccess'; 1110 1300 $htaccess_lines = (is_file($fpath)) ? @file($fpath) : array(); 1111 1301 1112 $output = "";1302 $output = ''; 1113 1303 $configuration_placed = false; 1114 1304 $between_placeholders = false; … … 1117 1307 if ($placeholder_start == $tline) { 1118 1308 $between_placeholders = true; 1119 $output .= $line .$cfg;1309 $output .= $line.$cfg; 1120 1310 $configuration_placed = true; 1121 1311 continue; … … 1129 1319 1130 1320 $output .= $line; 1131 } ;1321 } 1132 1322 1133 1323 // no placeholders? append to the end 1134 1324 if (!$configuration_placed) { 1135 $output .= "\n\n" . $placeholder_start . "\n" . $cfg . $placeholder_end. "\n";1136 }; 1137 1138 $fh = @fopen($fpath, "w");1325 $output .= "\n\n" .$placeholder_start. "\n" .$cfg.$placeholder_end. "\n"; 1326 } 1327 1328 $fh = @fopen($fpath, 'w'); 1139 1329 // write changes out if the file can be opened. 1140 1330 // XXX: perhaps plog-options.php should check whether settings can be written and warn the user if not? … … 1142 1332 if ($fh) { 1143 1333 $success = true; 1144 fwrite($fh, $output);1334 fwrite($fh, $output); 1145 1335 fclose($fh); 1146 } ;1336 } 1147 1337 return $success; 1148 1338 } … … 1151 1341 global $config; 1152 1342 1153 if (file_exists($config['basedir'] . ".htaccess") && is_writable($config['basedir'] . ".htaccess")) {1154 $cfg = "";1155 $placeholder_start = "# BEGIN Plogger";1156 $placeholder_end = "# END Plogger";1157 $thisfile = "/plog-admin/" .basename(__FILE__);1158 $adm = strpos($_SERVER['PHP_SELF'], "/plog-admin");1159 $rewritebase = substr($_SERVER['PHP_SELF'], 0,$adm);1343 if (file_exists($config['basedir'].'.htaccess') && is_writable($config['basedir'].'.htaccess')) { 1344 $cfg = ''; 1345 $placeholder_start = '# BEGIN Plogger'; 1346 $placeholder_end = '# END Plogger'; 1347 $thisfile = '/plog-admin/'.basename(__FILE__); 1348 $adm = strpos($_SERVER['PHP_SELF'], '/plog-admin'); 1349 $rewritebase = substr($_SERVER['PHP_SELF'], 0, $adm); 1160 1350 if ($enable) { 1161 if (empty($rewritebase)) 1162 { 1163 $rewritebase = "/"; 1351 if (empty($rewritebase)) { 1352 $rewritebase = '/'; 1164 1353 } 1165 1354 $cfg .= "<IfModule mod_rewrite.c>\n"; 1166 1355 $cfg .= "RewriteEngine on\n"; 1167 $cfg .= "RewriteBase ".$rewritebase."\n";1356 $cfg .= "RewriteBase $rewritebase\n"; 1168 1357 $cfg .= "RewriteCond %{REQUEST_URI} !(\.|/\$)\n"; 1169 1358 $cfg .= "RewriteRule ^.*\$ http://".parse_url($config['gallery_url'], PHP_URL_HOST)."%{REQUEST_URI}/ [R=301,L]\n"; … … 1178 1367 $cfg .= "RewriteRule ^.*$ index.php?path=%{REQUEST_URI} [L]\n"; 1179 1368 $cfg .= "</IfModule>\n"; 1180 } ;1369 } 1181 1370 // read the file 1182 1371 global $config; 1183 $fpath = $config[ "basedir"] . ".htaccess";1372 $fpath = $config['basedir'].'.htaccess'; 1184 1373 $htaccess_lines = @file($fpath); 1185 1374 1186 $output = "";1375 $output = ''; 1187 1376 $configuration_placed = false; 1188 1377 $between_placeholders = false; … … 1191 1380 if ($placeholder_start == $tline) { 1192 1381 $between_placeholders = true; 1193 $output .= $line .$cfg;1382 $output .= $line.$cfg; 1194 1383 $configuration_placed = true; 1195 1384 continue; … … 1203 1392 1204 1393 $output .= $line; 1205 } ;1394 } 1206 1395 1207 1396 // no placeholders? append to the end 1208 1397 if (!$configuration_placed) { 1209 $output .= "\n\n" . $placeholder_start . "\n" . $cfg . $placeholder_end. "\n";1210 } ;1211 1212 $fh = @fopen($fpath, "w");1398 $output .= "\n\n" .$placeholder_start. "\n" .$cfg.$placeholder_end. "\n"; 1399 } 1400 1401 $fh = @fopen($fpath, 'w'); 1213 1402 // write changes out if the file can be opened. 1214 1403 // XXX: perhaps plog-options.php should check whether settings can be written and warn the user if not? … … 1216 1405 if ($fh) { 1217 1406 $success = true; 1218 fwrite($fh, $output);1407 fwrite($fh, $output); 1219 1408 fclose($fh); 1220 } ;1409 } 1221 1410 return $success; 1222 1411 } else { … … 1225 1414 } 1226 1415 1416 function configure_blank_index($fpath = '') { 1417 if (substr($fpath, -1) !== '/') { 1418 $fpath = $fpath.'/'; 1419 } 1420 // write out the default blank index.php 1421 if (!empty($fpath) && !file_exists($fpath.'index.php') && is_writable($fpath)) { 1422 $output = "<?php\n// Ignorance is bliss\n?>"; 1423 $fh = @fopen($fpath.'index.php', 'w'); 1424 if ($fh) { 1425 fwrite($fh, $output); 1426 fclose($fh); 1427 } 1428 } 1429 // always return true because a blank index is not required 1430 return true; 1431 } 1432 1227 1433 // makes sure that argument does not contain characters that cannot be allowed, like . or /, which 1228 // could be used to point to directory or file names outside the Plogger directory1434 // could be used to point to directory or filenames outside the Plogger directory 1229 1435 function is_valid_directory($str) 1230 1436 { 1231 // allow only alfanumeric characters, hyphen, [, ], dot, apostrophe and space in collection names1232 return !preg_match("/[^\w|\.|'|\-|\[|\] ]/", $str);1437 // allow only alfanumeric characters, hyphen, [, ], dot, apostrophe and space in collection names 1438 return !preg_match("/[^\w|\.|'|\-|\[|\] ]/", $str); 1233 1439 } 1234 1440 … … 1236 1442 // so plugins could add new fields to all those forms. 1237 1443 function plog_add_collection_form() { 1238 $output = "\n\t\t" . '<input type="button" class="submit" id="show-collection" onclick="toggle(\'create-collection\'); toggle(\'show-collection\')" value="' . plog_tr('Create a Collection') . '" style="display: none;" />'; 1239 $output .= "\n\t\t" . '<form action="'.$_SERVER["PHP_SELF"].'" method="post"> 1240 <div id="create-collection" class="cssbox-green" style="width: 385px !important;"> 1241 <div class="cssbox_head-green"><h2>' . plog_tr('Create a Collection') . '</h2></div> 1242 <div class="cssbox_body-green"> 1243 <label accesskey="n" for="name">' . plog_tr('<em>N</em>ame') . ':</label><br /> 1244 <input name="name" id="name" /><br /> 1245 <label accesskey="d" for="description">' . plog_tr('<em>D</em>escription') . ':</label><br /> 1246 <input name="description" id="description" size="47" /> 1247 <input name="action" type="hidden" value="add-collection" /> 1248 <input class="submit" type="submit" value="' . plog_tr('Add Collection') . '" /> 1249 </div> 1250 </div> 1251 </form>' . "\n"; 1252 $output .= "\n\t\t<script type=\"text/javascript\">toggle('create-collection'); toggle('show-collection');</script>\n"; 1444 $output = "\n\t\t" . '<input type="button" class="submit-create" id="show-collection" onclick="toggle(\'create-collection\'); toggle(\'show-collection\')" value="'.plog_tr('Create Collection').'" style="display: none;" /> 1445 <form action="'.$_SERVER['PHP_SELF'].'" method="post"> 1446 <div id="create-collection" class="cssbox-green"> 1447 <div class="cssbox-head-green" onclick="toggle(\'create-collection\'); toggle(\'show-collection\')"> 1448 <h2 class="manage">'.plog_tr('Create Collection').'</h2> 1449 </div><!-- /cssbox-head-green --> 1450 <div class="cssbox-body-green"> 1451 <label accesskey="n" for="name">'.plog_tr('<em>N</em>ame').':</label><br /> 1452 <input name="name" id="name" /><br /> 1453 <label accesskey="d" for="description">'.plog_tr('<em>D</em>escription').':</label><br /> 1454 <input name="description" id="description" size="47" style="width: 95%;" /> 1455 <input name="action" type="hidden" value="add-collection" /> 1456 <input class="submit" type="submit" value="'.plog_tr('Add Collection').'" /> 1457 </div><!-- /cssbox-body-green --> 1458 </div><!-- /create-collection cssbox-green --> 1459 </form> 1460 <script type="text/javascript">toggle(\'create-collection\'); toggle(\'show-collection\');</script>' . "\n"; 1253 1461 return $output; 1254 1462 } … … 1256 1464 function plog_add_album_form($parent_collection) { 1257 1465 $parent_collection = intval($parent_collection); 1258 $output = "\n\t\t" . '<input type="button" class="submit" id="show-album" onclick="toggle(\'create-album\'); toggle(\'show-album\')" value="' . plog_tr('Create an Album') . '" style="display: none;" />'; 1259 $output .= "\n\t\t" . '<form action="'.$_SERVER["REQUEST_URI"].'" method="post"> 1260 <div id="create-album" class="cssbox-green" style="width: 385px !important;"> 1261 <div class="cssbox_head-green"><h2>' . plog_tr('Create an Album') . '</h2></div> 1262 <div class="cssbox_body-green"> 1263 <label accesskey="n" for="name">' . plog_tr('<em>N</em>ame') . ':</label><br /> 1264 <input name="name" id="name" /><br /> 1265 <label accesskey="d" for="description">' . plog_tr('<em>D</em>escription') . ':</label><br /> 1266 <input name="description" id="description" size="47" /> 1267 <input name="action" type="hidden" value="add-album" /> 1268 <input type="hidden" name="parent_collection" value="' . $parent_collection . '" /> 1269 <input class="submit" type="submit" value="' . plog_tr('Add Album') . '" /> 1270 </div> 1271 </div> 1272 </form>' . "\n"; 1273 $output .= "\n\t\t<script type=\"text/javascript\">toggle('create-album'); toggle('show-album');</script>\n"; 1274 return $output; 1466 $output = "\n\t\t" . '<input type="button" class="submit-create" id="show-album" onclick="toggle(\'create-album\'); toggle(\'show-album\')" value="'.plog_tr('Create Album').'" style="display: none;" /> 1467 <form action="'.$_SERVER['PHP_SELF'].'?level=albums&id='.$parent_collection.'" method="post"> 1468 <div id="create-album" class="cssbox-green"> 1469 <div class="cssbox-head-green" onclick="toggle(\'create-album\'); toggle(\'show-album\')"> 1470 <h2 class="manage">'.plog_tr('Create Album').'</h2> 1471 </div><!-- /cssbox-head-green --> 1472 <div class="cssbox-body-green"> 1473 <label accesskey="n" for="name">'.plog_tr('<em>N</em>ame').':</label><br /> 1474 <input name="name" id="name" /><br /> 1475 <label accesskey="d" for="description">'.plog_tr('<em>D</em>escription').':</label><br /> 1476 <input name="description" id="description" size="47" style="width: 95%;" /> 1477 <input name="action" type="hidden" value="add-album" /> 1478 <input type="hidden" name="parent_collection" value="'.$parent_collection.'" /> 1479 <input class="submit" type="submit" value="'.plog_tr('Add Album').'" /> 1480 </div><!-- /cssbox-body-green --> 1481 </div><!-- /create-album cssbox-green --> 1482 </form> 1483 <script type="text/javascript">toggle(\'create-album\'); toggle(\'show-album\');</script>' . "\n"; 1484 return $output; 1275 1485 } 1276 1486 … … 1279 1489 $output = ''; 1280 1490 $collection_id = intval($collection_id); 1281 $output .= "\n\t\t" . '<form class="edit" action="'.$_SERVER['PHP_SELF'].'" method="post">'; 1491 1492 $output .= "\n\t\t" . '<form class="edit width-700" action="'.$_SERVER['PHP_SELF'].'" method="post">'; 1282 1493 $collection = get_collection_by_id($collection_id); 1283 1494 1284 $auto_graphic = $config['gallery_url']."plog-admin/images/auto.gif"; 1285 1286 $images = "\n\t\t\t\t\t" . '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url('.$auto_graphic.'); background-repeat: no-repeat;">' . plog_tr('automatic') . '</option>'; 1287 1288 // create a list of all pictures in the collection. Should I create a separate 1289 // function for this as well? 1290 $sql = "SELECT p.id AS id,caption,p.path AS path,a.name AS album_name 1291 FROM ".TABLE_PREFIX."pictures p 1292 LEFT JOIN " . TABLE_PREFIX . "albums AS a ON p.parent_album = a.id 1293 WHERE p.parent_collection = '" . $collection_id . "' 1294 ORDER BY a.name,p.date_submitted"; 1495 $auto_graphic = $config['gallery_url'].'plog-admin/images/auto.gif'; 1496 $images = "\n\t\t\t\t\t" . '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url('.$auto_graphic.');">'.plog_tr('automatic').'</option>'; 1497 1498 // create a list of all pictures in the collection. Should I create a separate function for this as well? 1499 $sql = "SELECT p.id AS id, caption, p.path AS path, a.name AS album_name 1500 FROM ".PLOGGER_TABLE_PREFIX."pictures p 1501 LEFT JOIN ".PLOGGER_TABLE_PREFIX."albums AS a ON p.parent_album = a.id 1502 WHERE p.parent_collection = '".$collection_id."' 1503 ORDER BY a.name, p.date_submitted"; 1295 1504 1296 1505 $result = run_query($sql); 1297 1506 while($row = mysql_fetch_assoc($result)) { 1298 $selected = ($row["id"] == $collection["thumbnail_id"]) ? " selected='selected'" : ""; 1299 $style = 'class="thumboption" style="padding-left: '.($thumbnail_config[THUMB_SMALL]["size"] + 5).'px; background-image: url('.generate_thumb(SmartStripSlashes($row["path"]), $row["id"]).'); background-repeat: no-repeat;"'; 1300 $images .= "\n\t\t\t\t\t<option $style value='" . $row["id"] . "'" . $selected . ">"; 1301 $images .= SmartStripSlashes($row["album_name"]) . ": "; 1302 $images .= !empty($row["caption"]) ? SmartStripSlashes($row["caption"]) : SmartStripSlashes(basename($row["path"])); 1507 $selected = ($row['id'] == $collection['thumbnail_id']) ? ' selected="selected"' : ''; 1508 $style = 'class="thumboption" style="padding-left: '.($thumbnail_config[THUMB_SMALL]['size'] + 5).'px; background-image: url('.generate_thumb(SmartStripSlashes($row['path']), $row['id']).');"'; 1509 1510 $images .= "\n\t\t\t\t\t" . '<option '.$style.' value="'.$row['id'].'"'.$selected.'>'; 1511 $images .= SmartStripSlashes($row['album_name']).": "; 1512 $images .= !empty($row['caption']) ? SmartStripSlashes($row['caption']) : SmartStripSlashes(basename($row['path'])); 1303 1513 $images .= "</option>"; 1304 } ;1514 } 1305 1515 1306 1516 $output .= "\n\t\t\t" . '<div> 1307 <label accesskey="n" for="name">' . plog_tr('<em>N</em>ame') . ':</label><br /> 1308 <input size="30" name="name" id="name" value="'.htmlspecialchars(SmartStripSlashes($collection['name'])).'" /><br /> 1309 <label accesskey="d" for="description">' . plog_tr('<em>D</em>escription') . ':</label><br /> 1310 <input size="80" name="description" id="description" value="'.htmlspecialchars(SmartStripSlashes($collection['description'])).'" /><br /> 1311 Thumbnail:<br /> 1312 <select name="thumbnail_id" onchange="updateThumbPreview(this)" class="thumbselect" id="thumbselect"> 1313 ' . $images . ' 1314 </select> 1315 <script type="text/javascript">updateThumbPreview(document.getElementById(\'thumbselect\'));</script> 1517 <div class="strong">'.plog_tr('Edit Collection Properties').'</div> 1518 <p> 1519 <label class="strong" accesskey="n" for="name">'.plog_tr('<em>N</em>ame').':</label><br /> 1520 <input size="68" name="name" id="name" value="'.htmlspecialchars(SmartStripSlashes($collection['name'])).'" /> 1521 </p> 1522 <p> 1523 <label class="strong" accesskey="d" for="description">'.plog_tr('<em>D</em>escription').':</label><br /> 1524 <input size="68" name="description" id="description" value="'.htmlspecialchars(SmartStripSlashes($collection['description'])).'" /> 1525 </p> 1526 <p> 1527 <span class="strong">Thumbnail:</span><br /> 1528 <select name="thumbnail_id" onchange="updateThumbPreview(this)" class="thumbselect width-500" id="thumbselect">'.$images.' 1529 </select> 1530 <script type="text/javascript">updateThumbPreview(document.getElementById(\'thumbselect\'));</script> 1531 </p> 1316 1532 <input type="hidden" name="pid" value="'.$collection_id.'" /> 1317 1533 <input type="hidden" name="action" value="update-collection" /> 1318 <br /> 1319 <input class="submit" name="update" value="' . plog_tr('Update') . '" type="submit" /> 1320 <input class="submit" name="cancel" value="' . plog_tr('Cancel') . '" type="submit" /> 1321 </div>'; 1322 1323 $output .= "\n\t\t" . '</form>' . "\n"; 1534 <input class="submit" name="update" value="'.plog_tr('Update').'" type="submit" /> 1535 <input class="submit-cancel" name="cancel" value="'.plog_tr('Cancel').'" type="submit" /> 1536 </div> 1537 </form>' . "\n"; 1324 1538 return $output; 1325 1539 } … … 1331 1545 1332 1546 $album = get_album_by_id($album_id); 1333 $auto_graphic = $config['gallery_url']."plog-admin/images/auto.gif"; 1334 1335 $output = "\n\t\t" . '<form class="edit" action="'.$_SERVER['PHP_SELF'].'?level=albums&id='.$album['parent_id'].'" method="post">'; 1336 1337 $images = '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url('.$auto_graphic.'); background-repeat: no-repeat;">' . plog_tr('automatic') . '</option>'; 1338 1339 $sql = "SELECT id,caption,path FROM ".TABLE_PREFIX."pictures p WHERE p.parent_album = '" . $album_id . "'"; 1547 $auto_graphic = $config['gallery_url'].'plog-admin/images/auto.gif'; 1548 1549 $page = isset($_GET['plog_page']) ? '&plog_page='.intval($_GET['plog_page']) : ''; 1550 1551 $output = "\n\t\t" . '<form class="edit width-700" action="'.$_SERVER['PHP_SELF'] .'?level=albums&id='.$album['parent_id'].$page .'" method="post">'; 1552 1553 $images = '<option class="thumboption" value="0" style="padding-left: 100px; background-image: url('.$auto_graphic.');">'.plog_tr('automatic').'</option>'; 1554 1555 $sql = "SELECT id, caption, path FROM ".PLOGGER_TABLE_PREFIX."pictures p WHERE p.parent_album = '".$album_id."'"; 1340 1556 1341 1557 $result = run_query($sql); 1342 1558 while($row = mysql_fetch_assoc($result)) { 1343 $selected = ($row["id"] == $album["thumbnail_id"]) ? " selected='selected'" : ""; 1344 $style = 'class="thumboption" style="padding-left: '.($thumbnail_config[THUMB_SMALL]["size"] + 5).'px; background-image: url('.generate_thumb(SmartStripSlashes($row["path"]), $row["id"]).'); background-repeat: no-repeat;"'; 1345 1346 $images .= "\n\t\t\t\t<option ".$style." value='" . $row["id"] . "'" . $selected . ">"; 1347 $images .= !empty($row["caption"]) ? SmartStripSlashes($row["caption"]) : SmartStripSlashes(basename($row["path"])); 1559 $selected = ($row['id'] == $album['thumbnail_id']) ? ' selected="selected"' : ''; 1560 $style = 'class="thumboption" style="padding-left: '.($thumbnail_config[THUMB_SMALL]['size'] + 5).'px; background-image: url('.generate_thumb(SmartStripSlashes($row['path']), $row['id']).');"'; 1561 $images .= "\n\t\t\t\t" . '<option '.$style.' value="'.$row['id'].'"'.$selected.'>'; 1562 $images .= !empty($row['caption']) ? SmartStripSlashes($row['caption']) : SmartStripSlashes(basename($row['path'])); 1348 1563 $images .= "</option>"; 1349 } ;1564 } 1350 1565 1351 1566 $output .= "\n\t\t\t" . '<div> 1352 <label for="name" accesskey="n">' . plog_tr('<em>N</em>ame') . ':</label><br /> 1353 <input size="30" name="name" id="name" value="'.htmlspecialchars(SmartStripSlashes($album['name'])).'" /><br /> 1354 <label for="description" accesskey="d">' . plog_tr('<em>D</em>escription') . ':</label><br /> 1355 <input size="80" name="description" id="description" value="'.htmlspecialchars(SmartStripSlashes($album['description'])).'" /><br /> 1356 Thumbnail:<br /> 1357 <select name="thumbnail_id" class="thumbselect" id="thumbselect" onchange="updateThumbPreview(this)"> 1358 ' . $images . ' 1359 </select> 1360 <script type="text/javascript">updateThumbPreview(document.getElementById(\'thumbselect\'));</script>'; 1361 $output .= "\n\t\t\t\t" . '<input type="hidden" name="pid" value="'.$album_id.'" /> 1567 <div class="strong">'.plog_tr('Edit Album Properties').'</div> 1568 <p> 1569 <label class="strong" for="name" accesskey="n">'.plog_tr('<em>N</em>ame').':</label><br /> 1570 <input size="61" name="name" id="name" value="'.htmlspecialchars(SmartStripSlashes($album['name'])).'" /> 1571 </p> 1572 <p> 1573 <label class="strong" for="description" accesskey="d">'.plog_tr('<em>D</em>escription').':</label><br /> 1574 <input size="61" name="description" id="description" value="'.htmlspecialchars(SmartStripSlashes($album['description'])).'" /> 1575 </p> 1576 <p> 1577 <span class="strong">Thumbnail:</span><br /> 1578 <select name="thumbnail_id" class="thumbselect width-450" id="thumbselect" onchange="updateThumbPreview(this)">'.$images.' 1579 </select> 1580 <script type="text/javascript">updateThumbPreview(document.getElementById(\'thumbselect\'));</script> 1581 </p> 1582 <input type="hidden" name="pid" value="'.$album_id.'" /> 1362 1583 <input type="hidden" name="action" value="update-album" /> 1363 <br /> 1364 <input class="submit" name="update" value="' . plog_tr('Update') . '" type="submit" /> 1365 <input class="submit" name="cancel" value="' . plog_tr('Cancel') . '" type="submit" /> 1366 </div>'; 1367 $output .= "\n\t\t" . '</form>' . "\n"; 1584 <input class="submit" name="update" value="'.plog_tr('Update').'" type="submit" /> 1585 <input class="submit-cancel" name="cancel" value="'.plog_tr('Cancel').'" type="submit" /> 1586 </div> 1587 </form>' . "\n"; 1368 1588 return $output; 1369 1589 } 1370 1590 1371 function plog_picture_manager($id, $from,$limit) {1372 global $config ;1591 function plog_picture_manager($id, $from, $limit) { 1592 global $config, $empty; 1373 1593 $output = ''; 1374 1594 1375 1595 plogger_init_pictures(array( 1376 'type' => 'album',1377 'value' => $id,1378 'from' => $from,1379 'limit' => $limit,1380 'sortby' => !empty($config['default_sortby']) ? $config['default_sortby'] : 'id',1381 'sortdir' => !empty($config['default_sortdir']) ? $config['default_sortdir'] : 'ASC'1596 'type' => 'album', 1597 'value' => $id, 1598 'from' => $from, 1599 'limit' => $limit, 1600 'sortby' => !empty($config['default_sortby']) ? $config['default_sortby'] : 'id', 1601 'sortdir' => !empty($config['default_sortdir']) ? $config['default_sortdir'] : 'ASC' 1382 1602 )); 1383 1603 … … 1385 1605 if (plogger_has_pictures()) { 1386 1606 $output .= "\n\t\t" . '<script type="text/javascript">'; 1387 $output .= " Event.observe(window, 'load', init, false);";1388 $output .= " function init() {";1607 $output .= "\n\t\t\t" . 'Event.observe(window, \'load\', init, false);'; 1608 $output .= "\n\t\t\t" . 'function init() {' . "\n"; 1389 1609 1390 1610 while(plogger_has_pictures()) { 1391 1611 plogger_load_picture(); 1392 $output .= "makeEditable('picture-description-".plogger_get_picture_id()."'); makeEditable('picture-caption-".plogger_get_picture_id()."');"; 1393 } 1394 $output .= "}"; 1395 $output .= '</script>'; 1612 $output .= "\t\t\t\tmakeEditable('picture-description-".plogger_get_picture_id()."'); 1613 makeEditable('picture-caption-".plogger_get_picture_id()."');\n"; 1614 } 1615 $output .= "\t\t\t" . '}'; 1616 $output .= "\n\t\t" . '</script>'; 1396 1617 } 1397 1618 … … 1407 1628 1408 1629 if (plogger_has_pictures()) { 1409 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="4"> 1630 $allow_comment = ($config['allow_comments']) ? plog_tr('Allow Comments') : ' '; 1631 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> 1410 1632 <col style="width: 15px;" /> 1411 1633 <tr class="header"> 1412 <th class="table-header-left"> </th> 1413 <th class="table-header-middle">' . plog_tr('Thumb') . '</th> 1414 <th class="table-header-middle">' . plog_tr('Filename') . '</th> 1415 <th class="table-header-middle">' . plog_tr('Caption') . '</th> 1416 <th class="table-header-middle">' . plog_tr('Description') . '</th> 1417 <th class="table-header-middle">' . plog_tr('Allow comments') . '</th> 1418 <th class="table-header-right">' . plog_tr('Actions') . '</th> 1634 <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkToggle(document.getElementById(\'contentList\'));" /></th> 1635 <th class="table-header-middle align-center width-150">'.plog_tr('Thumb').'</th> 1636 <th class="table-header-middle align-left width-175">'.plog_tr('Filename').'</th> 1637 <th class="table-header-middle align-left">'.plog_tr('Caption').'/'.plog_tr('Description').'</th> 1638 <th class="table-header-middle align-center width-125">'.$allow_comment.'</th> 1639 <th class="table-header-right align-center width-100">'.plog_tr('Actions').'</th> 1419 1640 </tr>'; 1420 1641 $counter = 0; 1642 1421 1643 while(plogger_has_pictures()) { 1422 if ($counter%2 == 0) $table_row_color = "color-1";1423 else $table_row_color = "color-2";1644 if ($counter%2 == 0) $table_row_color = 'color-1'; 1645 else $table_row_color = 'color-2'; 1424 1646 $counter++; 1425 1647 plogger_load_picture(); 1648 1426 1649 $id = plogger_get_picture_id(); 1427 $output .= "\n\t\t\t<tr class=\"$table_row_color\">"; 1428 $output .= "\n\t\t\t\t<td><input type='checkbox' name='selected[]' value='" . $id . "' /></td>"; 1429 1650 $output .= "\n\t\t\t" . '<tr class="'.$table_row_color.'">'; 1651 $output .= "\n\t\t\t\t" . '<td class="width-15 align-center"><p class="margin-5"><input type="checkbox" name="selected[]" value="'.$id.'" /></p></td>'; 1430 1652 $thumbpath = plogger_get_picture_thumb(); 1431 1432 $imgtag = '<img src="'.$thumbpath.'" title="'.plogger_get_picture_caption().'" alt="'.plogger_get_picture_caption().'" />'; 1433 $output .= "\n\t\t\t\t" . '<td><div class="img-shadow"><a href="'.plogger_get_picture_thumb(THUMB_LARGE).'" rel="lightbox" title="'.plogger_get_picture_caption().'">'.$imgtag.'</a></div></td>'; 1434 $output .= "\n\t\t\t\t".'<td><strong><a class="folder" href="'.$_SERVER['PHP_SELF'].'?level=comments&id=' . $id . '">' . basename(plogger_get_source_picture_path()) . '</a></strong><br /><span style="margin-left: 20px;">' . sprintf(plog_tr('Comments: %d'), plogger_picture_comment_count()) . '</span></td>'; 1435 $output .= "\n\t\t\t\t<td><p id=\"picture-caption-" . plogger_get_picture_id() ."\">" . plogger_get_picture_caption() . "</p></td>"; 1436 $output .= "\n\t\t\t\t<td><p id=\"picture-description-" . plogger_get_picture_id() ."\">" . plogger_get_picture_description() . "</p></td>"; 1437 $allow_comments = (1 == plogger_picture_allows_comments()) ? plog_tr("Yes") : plog_tr("No"); 1438 $output .= "\n\t\t\t\t<td style=\"text-align: center;\">" . $allow_comments . "</td>"; 1439 $output .= "\n\t\t\t\t" . '<td style="text-align: center;"><a href="?action=edit-picture&id=' . $id; 1440 if (isset($_GET["entries_per_page"])) $output .= '&entries_per_page=' . intval($_GET["entries_per_page"]); 1441 if (isset($_GET["plog_page"])) $output .= '&plog_page=' . intval($_GET["plog_page"]); 1442 $output .= '"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; 1443 1444 $parent_id = $_REQUEST["id"]; 1445 $output .= ' <a href="?action=move-delete&selected%5B%5D=' . $id . '&level=pictures&delete_checked=1&id='.$parent_id; 1446 if (isset($_GET['plog_page'])) $output .= '&plog_page=' . intval($_GET['plog_page']); 1447 $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 1448 $output .= "\n\t\t\t</tr>"; 1449 1450 }; 1653 $imgtag = '<img src="'.$thumbpath.'" title="'.plogger_get_picture_caption('clean').'" alt="'.plogger_get_picture_caption('clean').'" />'; 1654 $output .= "\n\t\t\t\t" . '<td class="align-center width-150"><div class="img-shadow"><a href="'.plogger_get_picture_thumb(THUMB_LARGE).'" rel="lightbox" title="'.plogger_get_picture_caption('code').'">'.$imgtag.'</a></div></td>'; 1655 $output .= "\n\t\t\t\t" . '<td class="align-left width-175"><p class="margin-5"><strong><a href="'.$_SERVER['PHP_SELF'].'?level=comments&id='.$id.'">'.basename(plogger_get_source_picture_path()).'</a></strong><br /><br /><span>'.sprintf(plog_tr('Comments: %d'), plogger_picture_comment_count()).'</span></p></td>'; 1656 $output .= "\n\t\t\t\t" . '<td class="align-left vertical-top"> 1657 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Caption').':</strong></p> 1658 <p class="margin-5 no-margin-top" id="picture-caption-'.plogger_get_picture_id().'">'.plogger_get_picture_caption().'</p> 1659 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Description').':</strong></p> 1660 <p class="margin-5 no-margin-top" id="picture-description-'.plogger_get_picture_id().'">'.plogger_get_picture_description().'</p> 1661 </td>'; 1662 if ($config['allow_comments']) { 1663 $allow_comments = (1 == plogger_picture_allows_comments()) ? plog_tr('Yes') : plog_tr('No'); 1664 } else { 1665 $allow_comments = ' '; 1666 } 1667 $output .= "\n\t\t\t\t" . '<td class="align-center width-125"><p class="margin-5">'.$allow_comments.'</p></td>'; 1668 $output .= "\n\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="?action=edit-picture&id='.$id; 1669 if (isset($_GET['entries_per_page'])) $output .= '&entries_per_page='.intval($_GET['entries_per_page']); 1670 if (isset($_GET['plog_page'])) $output .= '&plog_page='.intval($_GET['plog_page']); 1671 $output .= '"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a>'; 1672 $parent_id = $_REQUEST['id']; 1673 $output .= ' <a href="?action=move-delete&selected%5B%5D='.$id.'&level=pictures&delete_checked=1&id='.$parent_id; 1674 if (isset($_GET['plog_page'])) $output .= '&plog_page='.intval($_GET['plog_page']); 1675 $output .= '" onclick="return confirm(\''.plog_tr('Are you sure you want to delete this item?').'\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="'.plog_tr('Delete').'" title="'.plog_tr('Delete').'" /></a></p></td>'; 1676 $output .= "\n\t\t\t" . '</tr>'; 1677 } 1678 1451 1679 $output .= "\n\t\t\t" . '<tr class="footer"> 1452 <td c olspan="7"></td>1680 <td class="align-left invert-selection" colspan="6"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">'.plog_tr('Toggle Checkbox Selection').'</a></td> 1453 1681 </tr> 1454 1682 </table>' . "\n"; 1455 1683 } else { 1456 $output .= "\n\n\t\t" . '<p class="actions">' . sprintf(plog_tr('Sadly, there are no pictures yet. Why don\'t you <a href="%s">upload some?</a>'),'plog-upload.php') . '</p>' . "\n"; 1457 }; 1684 $output .= "\n\n\t\t" . '<p class="actions">'.sprintf(plog_tr('Sadly, there are no pictures yet. Why don\'t you <a title="upload images" href="%s" style="font-weight: bold;">upload some</a>?'), 'plog-upload.php').'</p>' . "\n"; 1685 $empty = true; 1686 } 1458 1687 return $output; 1459 1688 } 1460 1689 1461 function plog_album_manager($id, $from,$limit) {1462 global $config ;1690 function plog_album_manager($id, $from, $limit) { 1691 global $config, $empty; 1463 1692 $output = ''; 1464 1693 … … 1475 1704 if (plogger_has_albums()) { 1476 1705 $output .= "\n\t\t" . '<script type="text/javascript">'; 1477 $output .= "Event.observe(window, 'load', init, false);"; 1478 $output .= "function init() {"; 1479 1706 $output .= "\n\t\t\t" . 'Event.observe(window, \'load\', init, false);'; 1707 $output .= "\n\t\t\t" . 'function init() {' . "\n"; 1480 1708 while(plogger_has_albums()) { 1481 1709 plogger_load_album(); 1482 1710 // makeEditable('album-name-".plogger_get_album_id()."'); 1483 $output .= " makeEditable('album-description-".plogger_get_album_id()."');";1484 } 1485 $output .= " }";1486 $output .= '</script>';1711 $output .= "\t\t\t\tmakeEditable('album-description-".plogger_get_album_id()."');\n"; 1712 } 1713 $output .= "\t\t\t" . '}'; 1714 $output .= "\n\t\t" . '</script>'; 1487 1715 } 1488 1716 … … 1497 1725 1498 1726 if (plogger_has_albums()) { 1499 1500 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="4"> 1501 <col style="width: 15px;"/> 1727 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> 1728 <col style="width: 15px;" /> 1502 1729 <tr class="header"> 1503 <th class="table-header-left "> </th>1504 <th class="table-header-middle ">' . plog_tr('Name') .'</th>1505 <th class="table-header-middle ">' . plog_tr('Description') .'</th>1506 <th class="table-header-right ">' . plog_tr('Actions') .'</th>1730 <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'contentList\'));" /></th> 1731 <th class="table-header-middle align-left width-275">'.plog_tr('Name').'</th> 1732 <th class="table-header-middle align-left">'.plog_tr('Description').'</th> 1733 <th class="table-header-right align-center width-100">'.plog_tr('Actions').'</th> 1507 1734 </tr>'; 1508 1735 $counter = 0; … … 1511 1738 plogger_load_album(); 1512 1739 $id = plogger_get_album_id(); 1513 if ($counter%2 == 0) $table_row_color = "color-1";1514 else $table_row_color = "color-2";1740 if ($counter%2 == 0) $table_row_color = 'color-1'; 1741 else $table_row_color = 'color-2'; 1515 1742 $counter++; 1516 1743 1517 $output .= "\n\t\t\t".'<tr class="'.$table_row_color.'">'; 1518 $output .= "\n\t\t\t\t".'<td><input type="checkbox" name="selected[]" value="'.$id.'" /></td>'; 1519 $output .= "\n\t\t\t\t".'<td><a class="folder" href="'.$_SERVER['PHP_SELF'].'?level=pictures&id='.$id.'"><span id="album-name-'.plogger_get_album_id().'"><strong>'.plogger_get_album_name().'</strong></span></a> — ' . sprintf(plog_tr('contains %d picture(s)'), plogger_album_picture_count()) . '</td>'; 1520 $output .= "\n\t\t\t\t".'<td><p id="album-description-'.plogger_get_album_id().'">'.plogger_get_album_description().'</p></td>'; 1521 $output .= "\n\t\t\t\t".'<td style="text-align: center;"><a href="'.$_SERVER['PHP_SELF'].'?action=edit-album&id='.$id.'"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; 1522 $output .= ' <a href="'.$_SERVER['PHP_SELF'].'?action=move-delete&selected%5B%5D='.$id.'&level=albums&delete_checked=1&id='.$_REQUEST['id']; 1523 if (isset($_GET['plog_page'])) { $output .= '&plog_page='.intval($_GET['plog_page']); } 1524 $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 1525 $output .= "\n\t\t\t</tr>"; 1526 1527 } 1528 $output .= "\n\t\t\t".'<tr class="footer"> 1529 <td colspan="7"></td> 1744 $text = (plogger_album_picture_count() == 1) ? plog_tr('image') : plog_tr('images'); 1745 $output .= "\n\t\t\t" . '<tr class="'.$table_row_color.'">'; 1746 $output .= "\n\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="'.$id.'" /></p></td>'; 1747 $output .= "\n\t\t\t\t" . '<td class="align-left width-275"><p class="margin-5"><a class="folder" href="'.$_SERVER['PHP_SELF'].'?level=pictures&id='.$id.'"><span id="album-name-'.plogger_get_album_id().'"><strong>'.plogger_get_album_name().'</strong></span></a> - '.sprintf(plog_tr('%d'), plogger_album_picture_count()).' '.$text.'</p></td>'; 1748 $output .= "\n\t\t\t\t" . '<td class="align-left vertical-top"><p class="margin-5" id="album-description-'.plogger_get_album_id().'">'.plogger_get_album_description().'</p></td>'; 1749 $page = (isset($_GET['plog_page'])) ? '&plog_page='.intval($_GET['plog_page']) : ''; 1750 $output .= "\n\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="'.$_SERVER['PHP_SELF'].'?action=edit-album&id='.$id.$page.'"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a>'; 1751 $output .= ' <a href="'.$_SERVER['PHP_SELF'].'?action=move-delete&selected%5B%5D='.$id.'&level=albums&delete_checked=1&id='.$_REQUEST['id'].$page; 1752 $output .= '" onclick="return confirm(\''.plog_tr('Are you sure you want to delete this item?').'\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="'.plog_tr('Delete').'" title="'.plog_tr('Delete').'" /></a></p></td>'; 1753 $output .= "\n\t\t\t" . '</tr>'; 1754 } 1755 1756 $output .= "\n\t\t\t" . '<tr class="footer"> 1757 <td class="align-left invert-selection" colspan="7"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">'.plog_tr('Toggle Checkbox Selection').'</a></td> 1530 1758 </tr> 1531 </table>' ."\n";1759 </table>' . "\n"; 1532 1760 } else { 1533 $output .= "\n\n\t\t<p class=\"actions\">" . plog_tr("There are no albums in this collection yet, why don't you create one?") . "</p>\n"; 1761 $output .= "\n\n\t\t" . '<p class="actions">'.plog_tr('There are no albums in this collection yet, why don\'t you create one?').'</p>' . "\n"; 1762 $empty = true; 1534 1763 } 1535 1764 return $output; 1536 1537 } 1538 1539 function plog_collection_manager($from,$limit) { 1540 global $config; 1765 } 1766 1767 function plog_collection_manager($from, $limit) { 1768 global $config, $empty; 1541 1769 $output = ''; 1542 1770 … … 1552 1780 if (plogger_has_collections()) { 1553 1781 $output .= "\n\t\t" . '<script type="text/javascript">'; 1554 $output .= "Event.observe(window, 'load', init, false);"; 1555 $output .= "function init() {"; 1556 1782 $output .= "\n\t\t\t" . 'Event.observe(window, \'load\', init, false);'; 1783 $output .= "\n\t\t\t" . 'function init() {' . "\n"; 1557 1784 while(plogger_has_collections()) { 1558 1785 plogger_load_collection(); 1559 1786 // makeEditable('collection-name-".plogger_get_collection_id()."'); 1560 $output .= " makeEditable('collection-description-".plogger_get_collection_id()."');";1561 } 1562 $output .= " }";1563 $output .= '</script>';1787 $output .= "\t\t\t\tmakeEditable('collection-description-".plogger_get_collection_id()."');\n"; 1788 } 1789 $output .= "\t\t\t" . '}'; 1790 $output .= "\n\t\t" . '</script>'; 1564 1791 } 1565 1792 … … 1573 1800 1574 1801 if (plogger_has_collections()) { 1575 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding=" 4">1802 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> 1576 1803 <col style="width: 15px;" /> 1577 1804 <tr class="header"> 1578 <th class="table-header-left "></th>1579 <th class="table-header-middle ">' . plog_tr('Name') .'</th>1580 <th class="table-header-middle ">' . plog_tr('Description') .'</th>1581 <th class="table-header-right ">' . plog_tr('Actions') .'</th>1805 <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'contentList\'));" /></th> 1806 <th class="table-header-middle align-left width-275">'.plog_tr('Name').'</th> 1807 <th class="table-header-middle align-left">'.plog_tr('Description').'</th> 1808 <th class="table-header-right align-center width-100">'.plog_tr('Actions').'</th> 1582 1809 </tr>'; 1583 1810 $counter = 0; 1811 1584 1812 while(plogger_has_collections()) { 1585 1813 plogger_load_collection(); 1586 if ($counter%2 == 0) $table_row_color = "color-1";1587 else $table_row_color = "color-2";1814 if ($counter%2 == 0) $table_row_color = 'color-1'; 1815 else $table_row_color = 'color-2'; 1588 1816 $counter++; 1817 1589 1818 $id = plogger_get_collection_id(); 1590 $output .= "\n\t\t\t<tr class=\"$table_row_color\">"; 1591 $output .= "\n\t\t\t\t<td><input type='checkbox' name='selected[]' value='" . $id . "' /></td>"; 1592 $output .= "\n\t\t\t\t<td><a class='folder' href='?level=albums&id=" .$id . "'><span id='collection-name-" . plogger_get_collection_id()."'><strong>".plogger_get_collection_name()."</strong></span></a> — " . sprintf(plog_tr('contains %d albums'), plogger_collection_album_count()) . "</td>"; 1593 $output .= "\n\t\t\t\t<td><p id='collection-description-" . plogger_get_collection_id() . "'>" . plogger_get_collection_description()."</p></td>"; 1594 $output .= "\n\t\t\t\t" . '<td style="text-align: center;"><a href="?action=edit-collection&id=' . $id . '"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; 1595 $output .= ' <a href="?action=move-delete&selected%5B%5D=' . $id . '&level=collections&delete_checked=1&'; 1819 $text = (plogger_collection_album_count() == 1) ? plog_tr('album') : plog_tr('albums'); 1820 $output .= "\n\t\t\t" . '<tr class="'.$table_row_color.'">'; 1821 $output .= "\n\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="'.$id.'" /></p></td>'; 1822 $output .= "\n\t\t\t\t" . '<td class="align-left width-275"><p class="margin-5"><a class="folder" href="?level=albums&id='.$id.'"><span id="collection-name-'.plogger_get_collection_id().'"><strong>'.plogger_get_collection_name().'</strong></span></a> - '.sprintf(plog_tr('%d'), plogger_collection_album_count()).' '.$text.'</p></td>'; 1823 $output .= "\n\t\t\t\t" . '<td class="align-left vertical-top"><p class="margin-5" id="collection-description-'.plogger_get_collection_id().'">'.plogger_get_collection_description().'</p></td>'; 1824 $output .= "\n\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="?action=edit-collection&id='.$id.'"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a>'; 1825 $output .= ' <a href="?action=move-delete&selected%5B%5D='.$id.'&level=collections&delete_checked=1&'; 1596 1826 if (isset($_REQUEST['id'])) { $output .= 'id='.intval($_REQUEST['id']); } 1597 if (isset($_GET['plog_page'])) { $output .= '&plog_page=' . intval($_GET['plog_page']); } 1598 $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 1599 $output .= "\n\t\t\t</tr>"; 1600 } 1827 if (isset($_GET['plog_page'])) { $output .= '&plog_page='.intval($_GET['plog_page']); } 1828 $output .= '" onclick="return confirm(\''.plog_tr('Are you sure you want to delete this item?').'\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="'.plog_tr('Delete').'" title="'.plog_tr('Delete').'" /></a></p></td>'; 1829 $output .= "\n\t\t\t" . '</tr>'; 1830 } 1831 1601 1832 $output .= "\n\t\t\t" . '<tr class="footer"> 1602 <td c olspan="7"></td>1833 <td class="align-left invert-selection" colspan="7"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">'.plog_tr('Toggle Checkbox Selection').'</a></td> 1603 1834 </tr> 1604 1835 </table>' . "\n"; 1605 1836 } else { 1606 $output .= "\n\n\t\t<p class=\"actions\">" . plog_tr('There are no collections yet') . "</p>\n"; 1837 $output .= "\n\n\t\t" . '<p class="actions">'.plog_tr('There are no collections yet').'.</p>' . "\n"; 1838 $empty = true; 1607 1839 } 1608 1840 return $output; 1609 1841 } 1610 1842 1611 function plog_comment_manager($id,$from,$limit) { 1612 global $config; 1613 1843 function plog_comment_manager($id, $from, $limit) { 1844 global $config, $empty; 1614 1845 $output = ''; 1615 1846 1616 1847 plogger_init_picture(array( 1617 'id' => $id, 1848 'id' => $id, 1849 'from' => $from, 1850 'limit' => $limit 1618 1851 )); 1619 1852 … … 1621 1854 if (plogger_picture_has_comments()) { 1622 1855 $output .= "\n\t\t" . '<script type="text/javascript">'; 1623 $output .= "Event.observe(window, 'load', init, false);"; 1624 $output .= "function init() {"; 1625 1856 $output .= "\n\t\t\t" . 'Event.observe(window, \'load\', init, false);'; 1857 $output .= "\n\t\t\t" . 'function init() {'; 1626 1858 while(plogger_picture_has_comments()) { 1627 1859 plogger_load_comment(); 1628 // makeEditable('collection-name-".plogger_get_collection_id()."'); 1629 $output .= "makeEditable('comment-comment-".plogger_get_comment_id()."'); 1630 makeEditable('comment-author-".plogger_get_comment_id()."'); 1631 makeEditable('comment-url-".plogger_get_comment_id()."'); 1632 makeEditable('comment-email-".plogger_get_comment_id()."');"; 1633 } 1634 $output .= "}"; 1635 $output .= '</script>'; 1860 // makeEditable('picture".plogger_get_picture_id()."'); 1861 $output .= " 1862 makeEditable('comment-comment-".plogger_get_comment_id()."'); 1863 makeEditable('comment-author-".plogger_get_comment_id()."'); 1864 makeEditable('comment-url-".plogger_get_comment_id()."'); 1865 makeEditable('comment-email-".plogger_get_comment_id()."');"; 1866 } 1867 $output .= "\n\t\t\t" . '}'; 1868 $output .= "\n\t\t" . '</script>'; 1636 1869 } 1637 1870 1638 1871 plogger_init_picture(array( 1639 'id' => $id, 1872 'id' => $id, 1873 'from' => $from, 1874 'limit' => $limit 1640 1875 )); 1641 1876 1642 1877 if (plogger_picture_has_comments()) { 1643 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="4"> 1644 <col style="width: 15px;"/> 1645 <tr class="header"> 1646 <td class="table-header-left"> </td> 1647 <td class="table-header-middle">' . plog_tr('Author') . '</td> 1648 <td class="table-header-middle">' . plog_tr('E-mail') . '</td> 1649 <td class="table-header-middle">' . plog_tr('URL') . '</td> 1650 <td class="table-header-middle">' . plog_tr('Date') . '</td> 1651 <td class="table-header-middle">' . plog_tr('Comment') . '</td> 1652 <td class="table-header-right">' . plog_tr('Actions') . '</td> 1653 </tr>'; 1878 $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> 1879 <col style="width: 15px;" /> 1880 <tbody> 1881 <tr class="header"> 1882 <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'contentList\'));" /></th> 1883 <th class="table-header-middle align-left width-175">'.plog_tr('Author').'/'.plog_tr('Email').'/'.plog_tr('Website').'</th> 1884 <th class="table-header-middle align-left width-150">'.plog_tr('Date').'</th> 1885 <th class="table-header-middle align-left">'.plog_tr('Comment').'</th> 1886 <th class="table-header-right align-center width-100">'.plog_tr('Actions').'</th> 1887 </tr>'; 1654 1888 $counter = 0; 1889 1655 1890 while(plogger_picture_has_comments()) { 1656 1891 plogger_load_comment(); 1657 if ($counter%2 == 0) $table_row_color = "color-1"; 1658 else $table_row_color = "color-2"; 1892 if ($counter%2 == 0) $table_row_color = 'color-1'; 1893 else $table_row_color = 'color-2'; 1894 $counter++; 1659 1895 1660 1896 $id = plogger_get_comment_id(); 1661 $output .= "\n\t\t\t<tr class=\"$table_row_color\">"; 1662 $output .= "\n\t\t\t\t<td><input type=\"checkbox\" name=\"selected%5B%5D\" value=\"' . $id . '\" /></td>"; 1663 $output .= "\n\t\t\t\t<td><p id=\"comment-author-" . $id ."\">" . plogger_get_comment_author() . "</p></td>"; 1664 $output .= "\n\t\t\t\t<td><p id=\"comment-email-" . $id ."\">" . plogger_get_comment_email() . "</p></td>"; 1665 $output .= "\n\t\t\t\t<td><p id=\"comment-url-" . $id ."\">" . plogger_get_comment_url() . "</p></td>"; 1666 $output .= "\n\t\t\t\t<td>" . plogger_get_comment_date("n.j.Y H:i:s") . "</td>"; 1667 $output .= "\n\t\t\t\t<td><p id=\"comment-comment-" . $id ."\">" . plogger_get_comment_text() . "</p></td>"; 1668 $output .= "\n\t\t\t\t" . '<td style="text-align: center;"><a href="?action=edit-comment&id=' . $id . '"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; 1669 $output .= ' <a href="?action=delete-comment&id=' . $id . '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></td>'; 1670 $output .= "\n\t\t\t</tr>"; 1671 1672 }; 1673 $output .= "\n\t\t\t" . '<tr class="footer"> 1674 <td colspan="7"></td> 1675 </tr> 1897 $output .= "\n\t\t\t\t" . '<tr class="'.$table_row_color.'">'; 1898 $output .= "\n\t\t\t\t\t" .'<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="'.$id.'" /></p></td>'; 1899 $output .= "\n\t\t\t\t\t" . '<td class="align-left width-175"> 1900 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Author').':</strong></p> 1901 <p class="margin-5 no-margin-top" id="comment-author-'.$id.'">'.plogger_get_comment_author().'</p> 1902 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Email').':</strong></p> 1903 <p class="margin-5 no-margin-top" id="comment-email-'.$id.'">'.plogger_get_comment_email().'</p> 1904 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Website').':</strong></p> 1905 <p class="margin-5 no-margin-top" id="comment-url-'.$id.'">'.plogger_get_comment_url().'</p> 1906 </td>'; 1907 $output .= "\n\t\t\t\t\t" . '<td class="align-left width-150"><p class="margin-5">'.plogger_get_comment_date('n/j/Y g:i a').'</p></td>'; 1908 $output .= "\n\t\t\t\t\t" . '<td class="align-left vertical-top"><p class="margin-5" id="comment-comment-'.$id.'">'.plogger_get_comment_text().'</p></td>'; 1909 $output .= "\n\t\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="?action=edit-comment&id='.$id.'"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a>'; 1910 $output .= ' <a href="?action=delete-comment&id='.$id.'" onclick="return confirm(\''.plog_tr('Are you sure you want to delete this item?').'\');"><img style="display: inline;" src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="'.plog_tr('Delete').'" title="'.plog_tr('Delete').'" /></a></p></td>'; 1911 $output .= "\n\t\t\t\t" . '</tr>'; 1912 } 1913 1914 $output .= "\n\t\t\t\t" . '<tr class="footer"> 1915 <td class="align-left invert-selection" colspan="5"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">'.plog_tr('Toggle Checkbox Selection').'</a></td> 1916 </tr> 1917 </tbody> 1676 1918 </table>' . "\n"; 1677 1919 } else { 1678 $output .= "\n\n\t\t <p class=\"actions\">" . plog_tr('This picture has no comments on it.') . "</p>\n";1679 };1680 1920 $output .= "\n\n\t\t" . '<p class="actions">'.plog_tr('This picture has no comments.').'</p>' . "\n"; 1921 $empty = true; 1922 } 1681 1923 return $output; 1682 1924 } 1683 1925 1684 1926 function generate_ajax_picture_editing_init() { 1685 1686 1927 $output = '<script type="text/javascript">'; 1687 1928 } 1929 1930 function plogger_show_server_info_link() { 1931 if ($_SESSION['plogger_logged_in']) { 1932 return '<a id="show_server_info" accesskey="s" href="#" style="display: inline;" onclick="toggle(\'server-info, hide_server_info, show_server_info\');">'.plog_tr('Show server info').'</a><a id="hide_server_info" accesskey="s" href="#" style="display: none;" onclick="toggle(\'server-info, hide_server_info, show_server_info\');">'.plog_tr('Hide server info').'</a>'; 1933 } 1934 return false; 1935 } 1936 1937 function plogger_generate_server_info() { 1938 global $config; 1939 1940 if ($_SESSION['plogger_logged_in']) { 1941 $server_data = '<div id="server-info" style="display: none;">'; 1942 } 1943 1944 $arg = split('[/ ]',$_SERVER['SERVER_SOFTWARE']); 1945 $software_type = $arg[0]; 1946 $software_version = $arg[1]; 1947 $software_distro = $arg[2]; 1948 1949 $server_data .= "\n\t\t\t" . '<strong>'.plog_tr('Server Software').':</strong> '.$software_type.'/'.$software_version.' '.$software_distro.'<br /> 1950 <strong>'.plog_tr('PHP Version').':</strong> '.phpversion().' ('.strtoupper(php_sapi_name()).')<br /> 1951 <strong>'.plog_tr('MySQL Version').':</strong> '.mysql_get_server_info().'<br /> 1952 <strong>'.plog_tr('GD Version').':</strong>'; 1953 1954 /* Thanks to the Pixelpost Crew for the gd_info code below */ 1955 if(function_exists('gd_info')) { 1956 $gd_info1 = gd_info(); 1957 $gd_info = $gd_info1['GD Version']; 1958 if($gd_info == "") { 1959 $gd_info = plog_tr('Not installed'); 1960 } else if ($gd_info1["JPG Support"]) { 1961 $gd_info .= plog_tr(' with JPEG support'); 1962 } 1963 } 1964 // determine the limiting setting for upload sizes 1965 $max_upload = intval(ini_get('upload_max_filesize')); 1966 $max_post = intval(ini_get('post_max_size')) * 0.75; 1967 $file_limit = ($max_upload < $max_post) ? $max_upload.'MB' : $max_post.'MB'; 1968 1969 $server_data .= ' '.$gd_info.'<br /> 1970 <strong>'.plog_tr('Session Save Path').':</strong> '.session_save_path().'<br /> 1971 <strong>'.plog_tr('File Upload Size Limit').':</strong> '.$file_limit.'<br /> 1972 <strong>'.plog_tr('Temporary Memory Limit').':</strong> '.ini_get('memory_limit').'<br /> 1973 <strong>'.plog_tr('Code Run Time Limit').':</strong> '.ini_get('max_execution_time').'s<br />'; 1974 if (is_safe_mode()) { 1975 $server_data .= "\n\t\t\t" . '<strong>safe_mode enabled</strong><br />'; 1976 } 1977 $server_data .= "\n\t\t" . '</div><!-- /server-info -->'; 1978 1979 return $server_data; 1980 } 1981 1688 1982 ?> -
trunk/plog-admin/plog-admin.php
r588 r590 1 1 <?php 2 header( "Content-Type: text/html; charset=utf-8");2 header('Content-Type: text/html; charset=utf-8'); 3 3 global $inHead; 4 4 5 //session_register ("entries_per_page");6 7 5 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 8 require_once(dirname(dirname(__FILE__))."/plog-load-config.php"); 9 require_once(PLOGGER_DIR."plog-admin/plog-admin-functions.php"); 6 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 10 7 11 8 // Login/logout/reset password functions … … 14 11 case 'log_in': 15 12 // check the username and password 16 if ( (isset($_REQUEST['plog_username']) && $_REQUEST['plog_username'] == $config['admin_username']) && (isset($_REQUEST['plog_password']) && md5($_REQUEST['plog_password']) == $config['admin_password']) ){13 if ((isset($_POST['plog_username']) && $_POST['plog_username'] == $config['admin_username']) && (isset($_POST['plog_password']) && md5($_POST['plog_password']) == $config['admin_password'])) { 17 14 $_SESSION['plogger_logged_in'] = true; 18 15 // clear out the activation key on login if set 19 16 if (isset($config['activation_key']) && !empty($config['activation_key'])) { 20 $query = "UPDATE `".TABLE_PREFIX."config` 21 SET `activation_key` = ''"; 17 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET `activation_key` = ''"; 22 18 $result = run_query($query); 23 19 } … … 25 21 // handle error for wrong username / password 26 22 $redirect = basename($_SERVER['PHP_SELF']); 27 header( "Location: index.php?loginerror&r=$redirect");23 header('Location: index.php?loginerror&r='.$redirect); 28 24 exit; 29 25 } … … 33 29 $_SESSION = array(); 34 30 session_destroy(); 35 header( "Location: index.php?loggedout");31 header('Location: index.php?loggedout'); 36 32 exit; 37 33 case 'password_reset': … … 41 37 // handle default password reset error: invalid usename or email address 42 38 $reset_output = 'resetpassword&reseterror=1'; 43 if ( isset($_POST['admin_email']) && ($_POST['admin_email'] == $config['admin_email'] || $_POST['admin_email'] == $config['admin_username'])) {39 if (isset($_POST['admin_email']) && ($_POST['admin_email'] == $config['admin_email'] || $_POST['admin_email'] == $config['admin_username'])) { 44 40 // change output to handle email sent success message 45 41 $reset_output = 'checkemail=1'; … … 49 45 if (!@mail( $config['admin_email'], 50 46 '[Plogger] '.plog_tr('Reset Password'), 51 plog_tr('Someone has requested Plogger to reset the password for the following website and username.'). "\n\n".52 plog_tr('Website').': '.$config['gallery_url']. "\n".53 plog_tr('Username').': '.$config['admin_username']. "\n\n".54 plog_tr('Follow the link below to reset your password; otherwise, just ignore this email and nothing will happen.'). "\n\n".47 plog_tr('Someone has requested Plogger to reset the password for the following website and username.'). "\n\n". 48 plog_tr('Website').': '.$config['gallery_url']. "\n". 49 plog_tr('Username').': '.$config['admin_username']. "\n\n". 50 plog_tr('Follow the link below to reset your password; otherwise, just ignore this email and nothing will happen.'). "\n\n". 55 51 $config['gallery_url'].'plog-admin/plog-admin.php?action=password_reset&key='.$key, 56 52 'From: Plogger <noreply@'.$from.'>' … … 60 56 } else { 61 57 // only update the activation key if an email is sent 62 $query = "UPDATE `".TABLE_PREFIX."config` 63 SET `activation_key` = '${key}'"; 58 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET `activation_key` = '${key}'"; 64 59 $result = run_query($query); 65 60 } … … 73 68 ini_set('sendmail_from', 'noreply@'.$from); // set for windows machines 74 69 if (!@mail( $config['admin_email'], 75 "[Plogger] ".plog_tr('New Password'),76 plog_tr('Plogger has reset your password for the following website and username.')."\n\n".77 plog_tr('Website').': '.$config['gallery_url']."\n".78 plog_tr('Username').': '.$config['admin_username']."\n\n".79 plog_tr('Your new password is').': '.$password."\n\n".80 plog_tr('Log in').': '.$config['gallery_url'].'plog-admin/?checkemail=3',81 'From: Plogger <noreply@'.$from.'>'82 )) {70 '[Plogger] '.plog_tr('New Password'), 71 plog_tr('Plogger has reset your password for the following website and username.'). "\n\n". 72 plog_tr('Website').': '.$config['gallery_url']. "\n". 73 plog_tr('Username').': '.$config['admin_username']. "\n\n". 74 plog_tr('Your new password is').': '.$password. "\n\n". 75 plog_tr('Log in').': '.$config['gallery_url'].'plog-admin/?checkemail=3', 76 'From: Plogger <noreply@'.$from.'>' 77 )) { 83 78 // change output to handle error with mail() function 84 79 $reset_output = 'reseterror=3'; 85 80 } else { 86 81 // only update the password if an email is sent 87 $query = "UPDATE `".TABLE_PREFIX."config` 88 SET `admin_password` = MD5('${password}')"; 82 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET `admin_password` = MD5('${password}')"; 89 83 $result = run_query($query); 90 84 } … … 94 88 } 95 89 } 96 header( "Location: index.php?$reset_output");90 header('Location: index.php?'.$reset_output); 97 91 exit; 98 92 } 99 93 } 100 94 101 if (!isset($_SESSION['plogger_logged_in']) || $_SESSION['plogger_logged_in'] !== true){ 95 // load the admin functions only after the login has been determined 96 require_once(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 97 98 if (!isset($_SESSION['plogger_logged_in']) || $_SESSION['plogger_logged_in'] !== true) { 102 99 $redirect = basename($_SERVER['PHP_SELF']); 103 header( "Location: index.php?r=$redirect");100 header('Location: index.php?r='.$redirect); 104 101 exit; 105 102 } 106 103 107 104 // Display admin tabs 108 function display($string, $current){ 109 105 function display($string, $current) { 110 106 global $inHead; 111 107 global $config; 112 108 113 109 $tabs = array(); 114 $tabs['upload'] = array('url' => 'plog-upload.php','caption' => plog_tr('<em>U</em>pload')); 115 $tabs['import'] = array('url' => 'plog-import.php?nojs=1','caption' => plog_tr('<em>I</em>mport'), 'onclick' => "window.location='plog-import.php'; return false;"); 116 $tabs['manage'] = array('url' => 'plog-manage.php','caption' => plog_tr('<em>M</em>anage')); 117 $tabs['feedback'] = array('url' => 'plog-feedback.php','caption' => plog_tr('<em>F</em>eedback')); 118 $tabs['options'] = array('url' => 'plog-options.php','caption' => plog_tr('<em>O</em>ptions')); 119 $tabs['themes'] = array('url' => 'plog-themes.php','caption' => plog_tr('<em>T</em>hemes')); 120 $tabs['view'] = array('url' => $config['gallery_url'],'caption' => plog_tr('<em>V</em>iew'), 'target' => '_blank'); 121 $tabs['support'] = array('url' => 'http://www.plogger.org/forum/','caption' => plog_tr('<em>S</em>upport'), 'target' => '_blank'); 122 $tabs['logout'] = array('url' => $_SERVER["PHP_SELF"].'?action=log_out','caption' => plog_tr('<em>L</em>og out')); 110 $tabs['upload'] = array('url' => 'plog-upload.php', 'caption' => plog_tr('<em>U</em>pload')); 111 $tabs['import'] = array('url' => 'plog-import.php?nojs=1', 'caption' => plog_tr('<em>I</em>mport'), 'onclick' => "window.location='plog-import.php'; return false;"); 112 $tabs['manage'] = array('url' => 'plog-manage.php', 'caption' => plog_tr('<em>M</em>anage')); 113 $tabs['feedback'] = array('url' => 'plog-feedback.php', 'caption' => plog_tr('<em>F</em>eedback')); 114 $tabs['options'] = array('url' => 'plog-options.php', 'caption' => plog_tr('<em>O</em>ptions')); 115 $tabs['themes'] = array('url' => 'plog-themes.php', 'caption' => plog_tr('<em>T</em>hemes')); 116 $tabs['plugins'] = array('url' => 'plog-plugins.php', 'caption' => plog_tr('<em>P</em>lugins')); 117 $tabs['view'] = array('url' => $config['gallery_url'], 'caption' => plog_tr('<em>V</em>iew'), 'onclick' => "window.open('".$config['gallery_url']."'); return false;"); 118 $tabs['support'] = array('url' => 'http://www.plogger.org/forum/', 'caption' => plog_tr('<em>S</em>upport'), 'onclick' => "window.open('http://www.plogger.org/forum/'); return false;"); 119 $tabs['logout'] = array('url' => $_SERVER['PHP_SELF'].'?action=log_out', 'caption' => plog_tr('<em>L</em>og out')); 123 120 // get the accesskey from the localization - it should be surrounded by <em> tags 124 121 foreach($tabs as $key => $data) { 125 if (preg_match( "|<em>(.*)</em>|",$data["caption"],$matches)) {122 if (preg_match('|<em>(.*)</em>|', $data['caption'], $matches)) { 126 123 $tabs[$key]['accesskey'] = $matches[1]; 127 }; 128 129 }; 124 } 125 } 130 126 131 127 $output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" … … 133 129 <html xmlns="http://www.w3.org/1999/xhtml"> 134 130 <head> 135 <title>Plogger Administration</title>131 <title>Plogger '.plog_tr('Gallery Admin').'</title> 136 132 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 137 133 <link rel="stylesheet" href="'.$config['gallery_url'].'plog-admin/css/admin.css" type="text/css" media="all" /> 138 <link rel="stylesheet" href="'.$config['gallery_url'].'plog-admin/css/tabs.css" type="text/css" media="all" />139 134 <link rel="stylesheet" href="'.$config['gallery_url'].'plog-admin/css/lightbox.css" type="text/css" media="all" /> 140 135 <script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/prototype.js"></script> … … 147 142 148 143 <div id="header"> 149 <img src="'.$config['gallery_url'].'plog-admin/images/plogger.gif" width="393" height="90" alt="Plogger" /> 150 <span id="plogger-version">'.$config['version'].'</span> 144 145 <div id="logo"> 146 <img src="'.$config['gallery_url'].'plog-admin/images/plogger.gif" width="393" height="90" alt="Plogger" /> 147 </div><!-- /logo --> 148 149 <div id="plogger-version"> 150 <div class="align-right"> 151 '.$config['version'].' ['.plogger_show_server_info_link().'] 152 </div><!-- /align-right --> 153 '.plogger_generate_server_info().' 154 </div><!-- /plogger-version --> 155 156 <div style="clear: both; height: 15px;"> </div> 151 157 152 158 <div id="tab-nav"> … … 159 165 if (!empty($data['onclick'])) $output .= ' onclick="'.$data['onclick'].'"'; 160 166 if (!empty($data['accesskey'])) $output .= ' accesskey="'.$data['accesskey'].'"'; 161 if (!empty($data['target'])) $output .= ' target="'.$data['target'].'"'; 162 $output .= ' href="' . $data['url'] . '">' . $data['caption'] . '</a></li>'; 163 }; 167 $output .= ' href="'.$data['url'].'">'.$data['caption'].'</a></li>'; 168 } 164 169 $output .= ' 165 170 </ul> 166 171 </div><!-- /tab-nav --> 172 167 173 </div><!-- /header --> 168 174 … … 179 185 } 180 186 181 $output .= "\n\n" .'</body>187 $output .= "\n\n" . '</body> 182 188 </html>'; 183 189 184 190 echo $output; 191 close_db(); 192 close_ftp(); 185 193 exit; 186 194 } -
trunk/plog-admin/plog-feedback.php
r588 r590 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 3 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");4 require(PLOGGER_DIR. "plog-admin/plog-admin.php");3 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 4 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 5 5 6 6 global $inHead; … … 8 8 $inHead = '<script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/ajax_editing.js"></script>'; 9 9 10 $output = "\n\t" . '<h1>'. plog_tr("Manage Feedback") .'</h1>' . "\n";10 $output = "\n\t" . '<h1>'.plog_tr('Manage Feedback').'</h1>' . "\n"; 11 11 12 12 if (isset($_REQUEST['action'])) { 13 if ($_REQUEST['action'] == "approve-delete") {13 if ($_REQUEST['action'] == 'approve-delete') { 14 14 // here we will determine if we need to perform an approved or delete action. 15 15 $num_items = 0; … … 19 19 if (isset($_REQUEST['selected'])) { 20 20 foreach($_REQUEST['selected'] as $del_id) { 21 // let s build the query string21 // let's build the query string 22 22 $del_id = intval($del_id); 23 24 $query = "DELETE FROM ".TABLE_PREFIX."comments WHERE `id`= '".$del_id."'"; 23 $query = "DELETE FROM ".PLOGGER_TABLE_PREFIX."comments WHERE `id`= '".$del_id."'"; 25 24 $result = run_query($query); 26 27 25 $num_items++; 28 26 } 29 30 $output .= "\n\t".'<p class="actions">'.sprintf(plog_tr('You have deleted %d comment(s) successfully.'),$num_items).'</p>'; 31 32 } else{ 33 $output .= "\n\t".'<p class="errors">'.plog_tr('Nothing selected to delete!').'</p>'; 34 } 27 if ($num_items > 0) { 28 $text = ($num_items == 1) ? plog_tr('comment') : plog_tr('comments'); 29 $output .= "\n\t" . '<p class="success">'.sprintf(plog_tr('You have deleted %s successfully'), '<strong>'.$num_items.'</strong> '.$text).'.</p>' . "\n"; 30 } else { 31 $output .= "\n\t" . '<p class="errors">'.plog_tr('Nothing selected to delete').'!</p>' . "\n"; 32 } 33 } 34 35 35 } else if (isset($_REQUEST['approve_checked'])) { 36 36 // set the approval bit to 1 for all selected comments 37 38 37 if (isset($_REQUEST['selected'])) { 39 38 foreach($_REQUEST['selected'] as $appr_id) { 40 // let s build the query string39 // let's build the query string 41 40 $appr_id = intval($appr_id); 42 43 $query = "UPDATE ".TABLE_PREFIX."comments SET `approved` = 1 WHERE `id`= '".$appr_id."'"; 41 $query = "UPDATE ".PLOGGER_TABLE_PREFIX."comments SET `approved` = 1 WHERE `id`= '".$appr_id."'"; 44 42 $result = run_query($query); 45 46 43 $num_items++; 47 44 } 48 49 $output .= "\n\t<p class=\"actions\">" . sprintf(plog_tr('You have approved %d comment(s) successfully.'),$num_items) . "</p>"; 50 } else { 51 $output .= "\n\t<p class=\"errors\">". plog_tr('Nothing selected to approve!') . "</p>"; 52 } 53 } 54 } else if ($_REQUEST['action'] == "edit-comment") { 45 if ($num_items > 0) { 46 $text = ($num_items == 1) ? plog_tr('comment') : plog_tr('comments'); 47 $output .= "\n\t" . '<p class="success">'.sprintf(plog_tr('You have approved %s successfully'), '<strong>'.$num_items.'</strong> '.$text).'.</p>' . "\n"; 48 } else { 49 $output .= "\n\t" . '<p class="errors">'.plog_tr('Nothing selected to approve').'!</p>' . "\n"; 50 } 51 } 52 } 53 54 } else if ($_REQUEST['action'] == 'edit-comment') { 55 55 // show the edit form 56 56 $output .= plog_edit_comment_form($_REQUEST['pid']); 57 57 $edit_page = 1; 58 } else if ($_REQUEST['action'] == "update-comment") { 58 59 } else if ($_REQUEST['action'] == 'update-comment') { 59 60 if (!isset($_REQUEST['cancel'])) { 60 61 // update comment in database 61 $result = update_comment($_POST['pid'], $_POST['author'],$_POST['email'],$_POST['url'],$_POST['comment']);62 $result = update_comment($_POST['pid'], $_POST['author'], $_POST['email'], $_POST['url'], $_POST['comment']); 62 63 if (isset($result['errors'])) { 63 $output .= "\n\t" . '<p class="errors">' . $result['errors'] . '</p>';64 $output .= "\n\t" . '<p class="errors">'.$result['errors'].'</p>' . "\n"; 64 65 } else if (isset($result['output'])) { 65 $output .= "\n\t" . '<p class=" actions">' . $result['output'] . '</p>';66 $output .= "\n\t" . '<p class="success">'.$result['output'].'</p>' . "\n"; 66 67 } 67 68 } … … 70 71 71 72 if (!isset($edit_page)) { 72 // let s iterate through all the content and build a table73 // let's iterate through all the content and build a table 73 74 // set the default level if nothing is specified 74 75 75 76 // handle pagination 76 // let s determine the limit filter based on current page and number of results per page77 // let's determine the limit filter based on current page and number of results per page 77 78 if (isset($_REQUEST['entries_per_page'])) { 78 79 $_SESSION['entries_per_page'] = $_REQUEST['entries_per_page']; 79 } else if (!isset($_SESSION['entries_per_page'])) {80 } else if (!isset($_SESSION['entries_per_page'])) { 80 81 $_SESSION['entries_per_page'] = 20; 81 82 } … … 89 90 $limit = "LIMIT ".$first_item.", ".$_SESSION['entries_per_page']; 90 91 91 // let s generate the pagination menu as well92 $recordCount = "SELECT count(*) AS num_comments FROM ". TABLE_PREFIX."comments WHERE `approved` = 1";92 // let's generate the pagination menu as well 93 $recordCount = "SELECT count(*) AS num_comments FROM ".PLOGGER_TABLE_PREFIX."comments WHERE `approved` = 1"; 93 94 $totalRowsResult = mysql_query($recordCount); 94 $num_comments = mysql_result($totalRowsResult, "num_comments");95 96 $query = "SELECT COUNT(*) as in_moderation from ".TABLE_PREFIX."comments WHERE `approved` = 0";95 $num_comments = mysql_result($totalRowsResult, 'num_comments'); 96 97 $query = "SELECT count(*) AS in_moderation FROM ".PLOGGER_TABLE_PREFIX."comments WHERE `approved` = 0"; 97 98 $mod_result = run_query($query); 98 $num_comments_im = mysql_result($mod_result, "in_moderation");99 $num_comments_im = mysql_result($mod_result, 'in_moderation'); 99 100 100 101 // filter based on whether were looking at approved comments or unmoderated comments … … 106 107 $moderate = 0; 107 108 } 108 $output .= "\n\t \t" . '<form id="contentList" action="'.$_SERVER['PHP_SELF'].'?moderate='.$moderate.'" method="post">';109 $output .= "\n\t" . '<form id="contentList" action="'.$_SERVER['PHP_SELF'].'?moderate='.$moderate.'" method="post">'; 109 110 110 111 if ($approved) { 111 $pagination_menu = generate_pagination( "admin", "feedback", $plog_page, $num_comments, $_SESSION['entries_per_page']);112 $pagination_menu = generate_pagination('admin', 'feedback', $plog_page, $num_comments, $_SESSION['entries_per_page']); 112 113 } else { 113 $pagination_menu = generate_pagination( "admin", "feedback", $plog_page, $num_comments_im, $_SESSION['entries_per_page'], array("moderate"=> 1));114 $pagination_menu = generate_pagination('admin', 'feedback', $plog_page, $num_comments_im, $_SESSION['entries_per_page'], array('moderate' => 1)); 114 115 } 115 116 $pagination_menu = "\n\t\t" . '<div class="pagination">'.$pagination_menu.'</div>'; 116 117 117 118 // generate javascript init function for ajax editing 118 $query = "SELECT *, UNIX_TIMESTAMP(`date`) AS ` unix_date` from ".TABLE_PREFIX."comments WHERE `approved` = ".$approved." ORDER BY `id` DESC ".$limit;119 $query = "SELECT *, UNIX_TIMESTAMP(`date`) AS `date` from ".PLOGGER_TABLE_PREFIX."comments WHERE `approved` = ".$approved." ORDER BY `id` DESC ".$limit; 119 120 $result = run_query($query); 120 121 121 if (mysql_num_rows($result) > 0) { 122 122 $output .= "\n\t\t" . '<script type="text/javascript">'; 123 $output .= "\n\t\t\tEvent.observe(window, 'load', init, false);"; 124 $output .= "\n\t\t\tfunction init() {"; 125 123 $output .= "\n\t\t\t" . 'Event.observe(window, \'load\', init, false);'; 124 $output .= "\n\t\t\t" . 'function init() {' . "\n"; 126 125 while($row = mysql_fetch_assoc($result)) { 127 $output .= "\ n\t\t\tmakeEditable('comment-comment-".$row['id']."');126 $output .= "\t\t\t\tmakeEditable('comment-comment-".$row['id']."'); 128 127 makeEditable('comment-author-".$row['id']."'); 129 128 makeEditable('comment-url-".$row['id']."'); 130 makeEditable('comment-email-".$row['id']."');"; 131 } 132 133 $output .= "\n\t\t\t}"; 134 $output .= "\n\t\t</script>"; 135 } 136 137 $query = "SELECT *, UNIX_TIMESTAMP(`date`) AS `unix_date` from ".TABLE_PREFIX."comments WHERE `approved` = ".$approved." ORDER BY `id` DESC ".$limit; 129 makeEditable('comment-email-".$row['id']."');\n"; 130 } 131 $output .= "\t\t\t" . '}'; 132 $output .= "\n\t\t" . '</script>'; 133 } 134 135 $query = "SELECT *, UNIX_TIMESTAMP(`date`) AS `date` from ".PLOGGER_TABLE_PREFIX."comments WHERE `approved` = ".$approved." ORDER BY `id` DESC ".$limit; 138 136 $result = run_query($query); 139 137 140 138 $empty = 0; 141 $allowedCommentKeys = array("unix_date", "author", "email", "url", "comment"); 139 142 140 if ($result) { 143 141 if (mysql_num_rows($result) == 0) { 144 142 if ($approved) { 145 $output .= "\n\ t\t" . '<p class="actions">' . plog_tr('You have no user comments on your gallery.') . '</p>';143 $output .= "\n\n\t\t" . '<p class="stats-info">'.plog_tr('You have no comments on your gallery').'.</p>' . "\n"; 146 144 } else { 147 $output .= "\n\ t\t" . '<p class="actions">' . plog_tr('You have no comments waiting for approval.') . '</p>';145 $output .= "\n\n\t\t" . '<p class="stats-info">'.plog_tr('You have no comments waiting for approval').'.</p>' . "\n"; 148 146 } 149 147 $empty = 1; … … 151 149 if ($approved) { 152 150 if ($num_comments_im > 0) { 153 $output.= "\n\t\t" . '<p class="actions">' . sprintf(plog_tr('You have %d comment(s) waiting for approval.'),$num_comments_im) . ' <a href="plog-feedback.php?moderate=1">' . plog_tr('Click here') . '</a> to review and approve/delete the moderated comment(s).</p>'; 151 $text = ($num_comments_im == 1) ? plog_tr('comment') : plog_tr('comments'); 152 $output.= "\n\n\t\t" . '<p class="actions">'.sprintf(plog_tr('You have %s waiting for approval.'), '<strong>'.$num_comments_im.'</strong> '.$text).' <a href="plog-feedback.php?moderate=1"><strong>'.plog_tr('Click here').'</strong></a> '.plog_tr('to review and approve/delete the moderated').' '.$text.'.</p>'; 154 153 } 155 154 } 156 155 157 156 $counter = 0; 158 $allowedCommentKeys = array("unix_date", "author", "email", "url", "comment"); 159 160 $output .= "\n\n\t\t" . '<div class="entries-page">'.generate_pagination_view_menu().' 161 </div>' . "\n"; 162 163 if (!$empty) { $output .= $pagination_menu; } 157 158 if (!$empty) { 159 $output .= "\n\n\t\t" . '<div class="entries-page">'.generate_pagination_view_menu().' 160 </div><!-- /entries-page -->' . "\n"; 161 162 $output .= $pagination_menu; 163 } 164 164 165 165 while($row = mysql_fetch_assoc($result)) { … … 167 167 if ($counter == 0) { 168 168 if ($approved) { 169 170 $output .= "\n\n\t\t" . '<div id="comment-count">' . sprintf(plog_tr('You have <strong>%d</strong> user comment(s).'),$num_comments) . '</div>'; 171 169 if ($num_comments > 0) { 170 $text = ($num_comments == 1) ? plog_tr('comment') : plog_tr('comments'); 171 $output .= "\n\n\t\t" . '<div id="comment-count">'.sprintf(plog_tr('You have %s'), '<strong>'.$num_comments.'</strong> '.$text).'.</div>'; 172 } 172 173 } else { 173 174 $output .= "\n\n\t\t" . '<div id="comment-count">' . sprintf(plog_tr('You have <strong>%d</strong> user comment(s) awaiting approval.'),$num_comments_im) . '</div>'; 175 176 } 177 178 $output .= "\n\n\t\t" . '<table style="width: 100%;" cellpadding="4"> 174 if ($num_comments_im > 0) { 175 $text = ($num_comments_im == 1) ? plog_tr('comment') : plog_tr('comments'); 176 $output .= "\n\n\t\t" . '<div id="comment-count">'.sprintf(plog_tr('You have %s awaiting approval'), '<strong>'.$num_comments_im.'</strong> '.$text).'.</div>'; 177 } 178 } 179 180 $output .= "\n\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> 179 181 <tr class="header"> 180 <th class="table-header-left"></th> 181 <th class="table-header-middle">' . plog_tr('Thumb') . '</th>'; 182 183 foreach ($row as $name => $value) { 184 if (in_array($name, $allowedCommentKeys)) { 185 $output .= "\n\t\t\t\t<th class=\"table-header-middle\">". plog_tr(ucfirst($name)) ."</th>"; 186 } 187 } 188 189 $output .= "\n\t\t\t\t" . '<th class="table-header-right">' . plog_tr('Actions') . '</th> 182 <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'contentList\'));" /></th> 183 <th class="table-header-middle align-left width-150">'.plog_tr('Thumb').'</th> 184 <th class="table-header-middle align-left width-175">'.plog_tr('Author').'/'.plog_tr('Email').'/'.plog_tr('Website').'</th> 185 <th class="table-header-middle align-left width-150">'.plog_tr('Date').'</th> 186 <th class="table-header-middle align-left">'.plog_tr('Comment').'</th> 187 <th class="table-header-right align-center width-100">'.plog_tr('Actions').'</th> 190 188 </tr>'; 191 189 } 192 190 191 foreach ($row as $key => $value) { 192 $value = SmartStripSlashes(htmlspecialchars($value)); 193 if ($value == '') { 194 $row[$key] = ' '; 195 } 196 } 197 193 198 if ($counter%2 == 0) { 194 $table_row_color = "color-1";199 $table_row_color = 'color-1'; 195 200 } else { 196 $table_row_color = "color-2";201 $table_row_color = 'color-2'; 197 202 } 198 203 199 204 // start a new table row (alternating colors) 200 $output .= "\n\t\t\t" .'<tr class="'.$table_row_color.'">';205 $output .= "\n\t\t\t" . '<tr class="'.$table_row_color.'">'; 201 206 202 207 // give the row a checkbox 203 $output .= "\n\t\t\t\t" . '<td ><input type="checkbox" name="selected[]" value="'.$row['id'].'" /></td>';208 $output .= "\n\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="'.$row['id'].'" /></p></td>'; 204 209 205 210 // give the row a thumbnail, we need to look up the parent picture for the comment … … 208 213 209 214 // generate XHTML with thumbnail and link to picture view. 210 $imgtag = '<img src="'.$thumbpath.'" title="'.$picture['caption'].'" alt="'.$picture['caption'].'" />'; 211 $output .= "\n\t\t\t\t" . '<td><div class="img-shadow"><a href="'.generate_thumb($picture['path'], $picture['id'], THUMB_LARGE).'" rel="lightbox" title="'.plogger_get_picture_caption().'">'.$imgtag.'</a></div></td>'; 212 213 foreach ($row as $key => $value) { 214 $value = SmartStripSlashes(htmlspecialchars($value)); 215 if ($value == '') { 216 $value = ' '; 217 } 218 219 if ($key == "unix_date") { 220 $output .= "\n\t\t\t\t" . '<td>'.date($config['date_format'], $value).'</td>'; 221 } else if ($key == "allow_comments") { 222 if ($value) { 223 $output .= "\n\t\t\t\t<td>". plog_tr('Yes') . "</td>"; 224 } else { 225 $output .= "\n\t\t\t\t<td>" . plog_tr('No') . "</td>"; 226 } 227 } 228 //else if ($key == "ip") { 229 // $output .= "<td>" . @gethostbyaddr($value) . "</td>"; 230 //} 231 else { 232 if (in_array($key, $allowedCommentKeys)) 233 $output .= "\n\t\t\t\t".'<td><p id="comment-'.$key.'-'.$row['id'].'">'.$value.'</p></td>'; 234 } 235 } 236 237 // $output .= our actions panel 215 $imgtag = '<img src="'.$thumbpath.'" title="'.htmlspecialchars(strip_tags($picture['caption']), ENT_QUOTES).'" alt="'.htmlspecialchars(strip_tags($picture['caption']), ENT_QUOTES).'" />'; 216 $output .= "\n\t\t\t\t" . '<td class="align-center width-150"><div class="img-shadow"><a href="'.generate_thumb($picture['path'], $picture['id'], THUMB_LARGE).'" rel="lightbox" title="'.htmlspecialchars($picture['caption'], ENT_QUOTES).'">'.$imgtag.'</a></div></td>'; 217 218 // Author / Email / Website 219 $output .= "\n\t\t\t\t" . '<td class="align-left width-175"> 220 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Author').':</strong></p> 221 <p class="margin-5 no-margin-top" id="comment-author-'.$row['id'].'">'.$row['author'].'</p> 222 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Email').':</strong></p> 223 <p class="margin-5 no-margin-top" id="comment-email-'.$row['id'].'">'.$row['email'].'</p> 224 <p class="margin-5 no-margin-bottom"><strong>'.plog_tr('Website').':</strong></p> 225 <p class="margin-5 no-margin-top" id="comment-url-'.$row['id'].'">'.$row['url'].'</p> 226 </td>'; 227 228 // Date 229 $output .= "\n\t\t\t\t" . '<td class="align-left width-150"><p class="margin-5">'.date($config['date_format'], $row['date']).'</p></td>'; 230 231 // Comment 232 $output .= "\n\t\t\t\t" . '<td class="align-left vertical-top"><p class="margin-5" id="comment-comment-'.$row['id'].'">'.$row['comment'].'</p></td>'; 233 234 // Actions panel 238 235 $query = "?action=edit-comment&pid=$row[id]"; 239 $output .= "\n\t\t\t\t" . '<td> 240 <div style="text-align: center;"> 241 <a href="'.$_SERVER['PHP_SELF'].$query.'&entries_per_page='.$_SESSION['entries_per_page'].'&moderate='.$moderate.'"><img src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a> 242 <a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&delete_checked=1&selected[]='.$row['id'].'&moderate='.$moderate.'" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this comment?') . '\');"><img src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="'.plog_tr('Delete').'" title="'.plog_tr('Delete').'" /></a>'; 243 244 if (!$approved){ 245 $output .= "\n\t\t\t\t\t\t".' <a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&approve_checked=1&selected[]='.$row['id'].'&moderate=1" onclick="return confirm(\''.plog_tr('Are you sure you want to approve this comment?').'\');"><img src="'.$config['gallery_url'].'plog-admin/images/new_file.gif" alt="'.plog_tr('Approve').'" title="'.plog_tr('Approve').'" /></a>'; 246 } 247 248 $output .= "\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>"; 236 $output .= "\n\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="'.$_SERVER['PHP_SELF'].$query.'&entries_per_page='.$_SESSION['entries_per_page'].'&moderate='.$moderate.'"><img src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a>'; 237 $output .= ' <a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&delete_checked=1&selected[]='.$row['id'].'&moderate='.$moderate.'" onclick="return confirm(\''.plog_tr('Are you sure you want to delete this comment?').'\');"><img src="'.$config['gallery_url'].'plog-admin/images/x.gif" alt="'.plog_tr('Delete').'" title="'.plog_tr('Delete').'" /></a>'; 238 239 if (!$approved) { 240 $output .= "\n\t\t\t\t\t" . ' <a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&approve_checked=1&selected[]='.$row['id'].'&moderate=1" onclick="return confirm(\''.plog_tr('Are you sure you want to approve this comment?').'\');"><img src="'.$config['gallery_url'].'plog-admin/images/new_file.gif" alt="'.plog_tr('Approve').'" title="'.plog_tr('Approve').'" /></a>'; 241 } 242 243 $output .= '</p></td>' . "\n\t\t\t" . '</tr>'; 249 244 $counter++; 250 245 } … … 252 247 if ($counter > 0) { 253 248 $output .= "\n\t\t\t" . '<tr class="footer"> 254 <td c olspan="9"></td>249 <td class="invert-selection" colspan="9"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">'.plog_tr('Toggle Checkbox Selection').'</a></td> 255 250 </tr> 256 251 </table>'; … … 259 254 260 255 if (!$empty) { 261 $output .= "\n\n\t\t" . '<div class="invert-selection"><a href="#" onclick="checkAll(document.getElementById(\'contentList\')); return false;">' . plog_tr('Invert Checkbox Selection') . '</a></div> 262 '.$pagination_menu; 263 } 264 265 $output .= "\n\n\t\t" . '<div> 256 $output .= "\n\t\t\t" . ''.$pagination_menu; 257 258 $output .= "\n\n\t\t" . '<div id="approve-delete"> 266 259 <input type="hidden" name="action" value="approve-delete" /> 267 <input class="submit" type="submit" name="delete_checked" onclick="return confirm(\''. plog_tr('Are you sure you want to delete the selected comments?') . '\');" value="' . plog_tr('Delete Checked') . '" />'; 268 269 if (!$approved) { 270 $output .= "\n\t\t\t" . '<input class="submit" type="submit" name="approve_checked" onclick="return confirm(\'' . plog_tr('Are you sure you want to approve the selected comments?') . '\');" value="' . plog_tr('Approve Checked') . '" />'; 271 } 272 273 $output .= "\n\t\t" . '</div>' . "\n\t\t" . '</form>'. "\n"; 260 <input class="submit-delete" type="submit" name="delete_checked" onclick="return confirm(\''.plog_tr('Are you sure you want to delete the selected comments?').'\');" value="'.plog_tr('Delete Checked').'" />'; 261 } 262 if (!$approved && !$empty) { 263 $output .= "\n\t\t\t" . '<input class="submit" type="submit" name="approve_checked" onclick="return confirm(\''.plog_tr('Are you sure you want to approve the selected comments?').'\');" value="'.plog_tr('Approve Checked').'" />'; 264 } 265 if (!$empty) { 266 $output .= "\n\t\t" . '</div><!-- /approve-delete -->'; 267 } 268 $output .= "\n\t" . '</form>'. "\n"; 274 269 } 275 270 276 display($output, "feedback");271 display($output, 'feedback'); 277 272 278 273 ?> -
trunk/plog-admin/plog-import.php
r588 r590 1 1 <?php 2 // Code by Mike Johnson -- mike@solanosystems.com October 23rd, 2004. 3 // This is the main administrative interface code. To change the look of the interface, change /plog-admin/css/admin.css. 4 5 // The initial tab is UPLOAD function. 2 /* Code by Mike Johnson -- mike@solanosystems.com October 23rd, 2004. 3 This is the main administrative interface code. To change the look of the interface, change /plog-admin/css/admin.css. 4 The initial tab is UPLOAD function. */ 6 5 7 6 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 8 require_once(dirname(dirname(__FILE__))."/plog-load-config.php"); 9 require(PLOGGER_DIR."plog-admin/plog-admin.php"); 10 11 global $inHead; 12 13 function generate_albums_menu($albums,$type = "multiple", $preselect) { 7 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 8 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 9 10 function generate_albums_menu($albums, $type = 'multiple', $preselect) { 14 11 $output = ''; 15 12 16 if ($type == "multiple")13 if ($type == 'multiple') 17 14 $output .= '<select name="destinations[]" onclick="var k=document.getElementsByName(\'destination_radio\');k[0].checked=true;" >'; 18 15 else … … 20 17 foreach($albums as $album_id => $album_data) { 21 18 if ($preselect == $album_id) 22 $selected = " selected='selected'"; else $selected = "";23 $output .= "\n\t\t\t\t\t <option value=\"".$album_id."\"$selected>".$album_data['collection_name'].": ".$album_data['album_name']."</option>";19 $selected = ' selected="selected"'; else $selected = ''; 20 $output .= "\n\t\t\t\t\t" . '<option value="'.$album_id.'"'.$selected.'>'.$album_data['collection_name'].': '.$album_data['album_name'].'</option>'; 24 21 } 25 22 $output .= "\n\t\t\t\t</select>"; … … 32 29 $output = '<select name="collections_menu" id="collections_menu" onclick="var k=document.getElementsByName(\'destination_radio\');k[1].checked=true;" >'; 33 30 foreach($collections as $collection) { 34 $output .= "\n\t\t\t\t\t <option value=\"".$collection['id']."\">".$collection['name']."</option>";31 $output .= "\n\t\t\t\t\t" . '<option value="'.$collection['id'].'">'.$collection['name'].'</option>'; 35 32 } 36 33 $output .= "\n\t\t\t\t</select>"; … … 40 37 41 38 $output = ''; 39 42 40 $counter = $imported = 0; 43 41 44 42 // see if the 'nojs' flag has been set if javascript disabled and create query & separator strings for URLs 45 $query = (isset($_GET['nojs'])) ? "?nojs=".$_GET['nojs'] : '';46 $sep = (isset($_GET['nojs'])) ? "&": '?';43 $query = (isset($_GET['nojs'])) ? '?nojs='.$_GET['nojs'] : ''; 44 $sep = (isset($_GET['nojs'])) ? '&' : '?'; 47 45 48 46 // Check if update has been clicked, handle erroneous conditions, or upload … … 54 52 $captions = $_POST['captions']; 55 53 $descriptions = $_POST['descriptions']; 54 $allow_comments = isset($_POST['allow_comments']) ? $_POST['allow_comments'] : array(); 56 55 $files = isset($_POST['files']) ? $_POST['files'] : ''; 57 56 $selected = $_POST['selected']; … … 59 58 global $config; 60 59 61 $files = get_files($config['basedir'] .'plog-content/uploads');62 63 if ($_POST['destination_radio'] == "new" && $_POST["new_album_name"] == "") {64 $output .= "\n\t" . '<p class="errors">' . plog_tr('New album name not specified!') . '</p>' . "\n";60 $files = get_files($config['basedir'].'plog-content/uploads'); 61 62 if ($_POST['destination_radio'] == 'new' && $_POST['new_album_name'] == '') { 63 $output .= "\n\t" . '<p class="errors">'.plog_tr('New album name not specified').'!</p>' . "\n"; 65 64 } else { 66 65 67 if ($_POST[ "destination_radio"] == "new"){66 if ($_POST['destination_radio'] == 'new') { 68 67 // Create the new album 69 68 $result = add_album($_POST['new_album_name'], NULL, $_POST['collections_menu']); … … 73 72 } else { 74 73 // errors exist, let's find out what they are 75 if (isset($result['output']) && $result['output'] == "existing"&& isset($result['id'])) {76 // album already exists so try insert images into the existing album77 // and alert the user that their "new" album is already existing74 if (isset($result['output']) && $result['output'] == 'existing' && isset($result['id'])) { 75 // album already exists so try to insert images into the existing album 76 // and alert the user that their "new" album already exists 78 77 $album_id = $result['id']; 79 78 // get the collection name for display 80 $sql = "SELECT `name` FROM ". TABLE_PREFIX."collections WHERE id = ".intval($_REQUEST['collections_menu']);79 $sql = "SELECT `name` FROM ".PLOGGER_TABLE_PREFIX."collections WHERE id = ".intval($_REQUEST['collections_menu']); 81 80 $result = run_query($sql); 82 81 $row = mysql_fetch_assoc($result); 83 $output .= "\n\t" . '<p class="actions">'.sprintf(plog_tr('Album already exists. Uploading file to existing album `%s` in collection `%s`'), $_REQUEST['new_album_name'], $row['name']).'</p>' . "\n";82 $output .= "\n\t" . '<p class="actions">'.sprintf(plog_tr('Album already exists. Uploading file to existing album %s in collection %s'), '<strong>'.$_REQUEST['new_album_name'].'</strong>', '<strong>'.$row['name'].'</strong>').'</p>' . "\n"; 84 83 } else { 85 84 // error has nothing to do with an existing album, show the returned error 86 85 $album_id = ''; 87 $output .= "\n\t" . '<p class="errors">' . $result['errors'] .'</p>' . "\n";86 $output .= "\n\t" . '<p class="errors">'.$result['errors'].'</p>' . "\n"; 88 87 } 89 88 } 90 89 } else { 91 90 // use an existing album 92 $album_id = $_POST[ "destination"];91 $album_id = $_POST['destination']; 93 92 } 94 93 … … 96 95 foreach($files as $file) { 97 96 $file_key = md5($file); 98 if (in_array($file_key, $selected)) {97 if (in_array($file_key, $selected)) { 99 98 100 99 $file_name = SmartStripSlashes($file); 101 100 // fully qualified file name 102 //$fqfn = $config[ "basedir"] . "plog-content/uploads/".$file_name;101 //$fqfn = $config['basedir'].'plog-content/uploads/'.$file_name; 103 102 $fqfn = $file; 104 103 105 // attempt to chmod the pictures directory before moving them106 @chmod(dirname($fqfn), 0777);107 108 104 if (is_file($fqfn)) { 109 $result = add_picture($album_id,$fqfn,basename($file_name),$captions[$file_key], $descriptions[$file_key]); 110 if ($result["picture_id"] != false) { 105 if (in_array($file_key, $allow_comments)) { 106 $allow_comment = 1; 107 } else { 108 $allow_comment = 0; 109 } 110 $result = add_picture($album_id,$fqfn, basename($file_name), $captions[$file_key], $descriptions[$file_key], $allow_comment); 111 if ($result['picture_id'] !== false) { 111 112 $imported++; 112 113 // delete thumbnail file if it exists 113 $thumbpath = $config['basedir'] . 'plog-content/thumbs/import-'.substr($file_key,0,2).'-'.basename($file_name);114 if ( is_file($thumbpath) && is_readable($thumbpath)) {115 unlink($thumbpath);114 $thumbpath = $config['basedir'].'plog-content/thumbs/uploads/import-'.substr($file_key, 0, 2).'-'.basename($file_name); 115 if (file_exists($thumbpath) && is_readable($thumbpath)) { 116 kill_file($thumbpath); 116 117 } 117 118 } … … 124 125 125 126 // get album name for display 126 $sql = "SELECT name FROM ". TABLE_PREFIX."albums WHERE id = $album_id";127 $sql = "SELECT name FROM ".PLOGGER_TABLE_PREFIX."albums WHERE id = $album_id"; 127 128 $result = run_query($sql); 128 129 $row = mysql_fetch_assoc($result); 129 130 130 $output .= "\n\t" . '<p class="actions">'.sprintf(plog_tr('%d picture(s) were successfully imported to album <strong>%s</strong>'),$imported,$row['name']). '</p>' . "\n"; 131 $output .= "\n\t" . '<h1>'.plog_tr('Import').'</h1>'; 132 133 if ($imported > 0) { 134 $text = ($imported == 1) ? plog_tr('image was') : plog_tr('images were'); 135 $output.= "\n\n\t" . '<p class="success width-700">'.sprintf(plog_tr('%s successfully imported to album %s'), '<strong>'.$imported.'</strong> '.$text, '<strong>'.$row['name'].'</strong>').'.</p>'. "\n"; 136 } 131 137 132 138 if ($imported == 0) { 133 $output .= "\n\t" . '<p class="errors">' . plog_tr('Make sure to CHMOD 777 your newly created folders within the <strong>plog-content/uploads/</strong> directory or else Plogger cannot access them. Plogger cannot CHMOD the directory for you while PHP is in safe mode.') . '</p>' . "\n"; 139 $output .= "\n\t" . '<h1>'.plog_tr('Import').'</h1> 140 141 <p class="errors">'.plog_tr('Use your FTP client to CHMOD your newly created folders within the <strong>plog-content/uploads/</strong> directory with the proper permissions, or else Plogger cannot access them. Plogger cannot CHMOD the directory for you while PHP is in safe_mode.').'</p>' . "\n"; 134 142 } 135 143 /* what is this for? … … 141 149 142 150 // read the list again, so any newly created directories show up 143 $files = get_files($config['basedir'] .'plog-content/uploads');151 $files = get_files($config['basedir'].'plog-content/uploads'); 144 152 145 153 // build a list of unique directories from the filenames … … 156 164 // here we will check which group of pictures we are editing, grouped by directory 157 165 if (count($directories) > 0) { 158 $output .= "\n\t" . '<div class="actions ">' .plog_tr('Would you like to import anything else?');159 160 $output .= "\n\t\t <ul>";166 $output .= "\n\t" . '<div class="actions width-700">'.plog_tr('Would you like to import anything else?'); 167 168 $output .= "\n\t\t" . '<ul style="list-style-type: none;">'; 161 169 162 170 foreach ($directories as $dirkey => $group) { 163 $output .= "\n\t\t\t" . '<li ><a class="folder" href="'.$_SERVER['PHP_SELF'].$query.$sep.'directory='.$dirkey.'">'.basename($group).'</a></li>';164 } 165 166 $upload_directory = $config['basedir'] .'plog-content/uploads';171 $output .= "\n\t\t\t" . '<li class="margin-5"><a class="folder" href="'.$_SERVER['PHP_SELF'].$query.$sep.'directory='.$dirkey.'">'.basename($group).'</a></li>'; 172 } 173 174 $upload_directory = $config['basedir'].'plog-content/uploads'; 167 175 $dirkey = md5($upload_directory); 168 $output .= "\n\t\t\t" . '<li ><a class="folder" href="'.$_SERVER['PHP_SELF'].$query.$sep.'directory='.$dirkey.'">' . plog_tr('All Pictures') .'</a></li>';176 $output .= "\n\t\t\t" . '<li class="margin-5"><a class="folder" href="'.$_SERVER['PHP_SELF'].$query.$sep.'directory='.$dirkey.'">'.plog_tr('All Pictures').'</a></li>'; 169 177 $output .= "\n\t\t</ul>\n\t</div>\n"; 170 178 … … 172 180 173 181 } else { 174 $output .= "\n\t" . '<h1>' . plog_tr('Import Photos') . '</h1>'; 175 176 $upload_directory = $config['basedir'] . 'plog-content/uploads'; 177 if (!is_writable($upload_directory)) 178 $output .= "\n\n\t" . '<p class="errors">' . plog_tr('Your <strong>plog-content/uploads/</strong> directory is NOT WRITABLE! Use your FTP client to CHMOD the directory with the proper permissions or your import may fail!') . '</p>' . "\n"; 182 $output .= "\n\t" . '<h1>'.plog_tr('Import Images').'</h1>'; 183 184 $upload_directory = $config['basedir'].'plog-content/uploads'; 185 if (!is_safe_mode() && !is_writable($upload_directory)) { 186 $output .= "\n\n\t" . '<p class="errors">'.plog_tr('Your <strong>plog-content/uploads/</strong> directory is NOT WRITABLE! Use your FTP client to CHMOD the directory with the proper permissions or your import may fail!').'</p>' . "\n"; 187 } else if (is_open_perms($upload_directory)) { 188 $output .= "\n\n\t" . '<p class="actions">'.plog_tr('Your <strong>plog-content/uploads/</strong> directory has open permissions (0777). Once you are done importing your images, we recommend that you CHMOD the directory to 0755 to increase security on your Plogger install.').'</p>' . "\n"; 189 } 179 190 180 191 $files = get_files($upload_directory); … … 196 207 197 208 if (count($files) == 0) { 198 $output .= "\n\n\t\t" . '<div class="actions ">' . plog_tr('No images found in the <strong>plog-content/uploads/</strong> directory. To mass import pictures into your gallery, simply:209 $output .= "\n\n\t\t" . '<div class="actions width-700">'.plog_tr('No images found in the <strong>plog-content/uploads/</strong> directory. To mass import pictures into your gallery, simply:').' 199 210 <ul> 200 <li><strong> Open an FTP connection</strong> to your website</li>201 <li> Transfer photos you wish to publish to the <strong>plog-content/uploads/</strong> directory</li>202 <li> Optionally, you can create folders within that directory to import in groups</li>203 </ul> ') . '211 <li><strong>'.plog_tr('Open an FTP connection</strong> to your website').'</li> 212 <li>'.plog_tr('Transfer images you wish to publish to the <strong>plog-content/uploads/</strong> directory').'</li> 213 <li>'.plog_tr('Optionally, you can create folders within that directory to import in groups').'</li> 214 </ul> 204 215 </div>' . "\n"; 205 216 } 206 217 207 218 // here we will check which group of pictures we are editing, grouped by directory 208 if (!isset($_GET[ "directory"]) && count($directories) > 0) {209 $output .= "\n\n\t\t" . '<div class="actions ">' . plog_tr('Choose a directory you wish to import from:') . '';210 $output .= "\n\t\t\t <ul>";219 if (!isset($_GET['directory']) && count($directories) > 0) { 220 $output .= "\n\n\t\t" . '<div class="actions width-700"><strong>'.plog_tr('Choose a directory you wish to import from').':</strong>'; 221 $output .= "\n\t\t\t" . '<ul style="list-style-type: none;">'; 211 222 foreach ($directories as $dirkey => $group) { 212 $output .= "\n\t\t\t\t" . '<li ><a class="folder" href="'.$_SERVER['PHP_SELF'].$query.$sep.'directory='.$dirkey.'">'.basename($group).'</a></li>';223 $output .= "\n\t\t\t\t" . '<li class="margin-5"><a class="folder" href="'.$_SERVER['PHP_SELF'].$query.$sep.'directory='.$dirkey.'">'.basename($group).'</a></li>'; 213 224 } 214 225 //$dirkey = md5($upload_directory); 215 226 // $output .= '<li><a class="folder" href="'.$_SERVER['PHP_SELF'].$query.$sep.'directory='.$dirkey.'">All pictures</a></li>'; 216 $output .= "\n\t\t\t</ul>\n\t\t</div> \n";227 $output .= "\n\t\t\t</ul>\n\t\t</div><!-- /actions width-700 -->\n"; 217 228 218 229 } else { … … 220 231 // show_directory is what the user sees, it's relative so the directory structure of the server 221 232 // is not exposed 222 $show_directory = "plog-content/uploads"; 223 if (isset($_GET["directory"]) && isset($directories[$_GET["directory"]])) { 224 $real_directory = $directories[$_GET["directory"]]; 225 $show_directory .= substr($real_directory,strlen($upload_directory)); 226 } 227 else { 233 $show_directory = 'plog-content/uploads'; 234 if (isset($_GET['directory']) && isset($directories[$_GET['directory']])) { 235 $real_directory = $directories[$_GET['directory']]; 236 $show_directory .= substr($real_directory, strlen($upload_directory)); 237 } else { 228 238 $real_directory = $upload_directory; 229 239 } … … 233 243 if (count($files) > 0) { 234 244 $percent = (isset($_GET['nojs'])) ? '100%': '0%'; 235 $output .= "\n\n\t\t" . '<p class="actions">' . sprintf(plog_tr('You are currently looking at <strong>%d</strong> image(s) within the <strong>%s</strong> directory.<br /><br />' . "\n\t\t" . 'Creating thumbnails: %s done.'), count($files), $show_directory, '<span id="progress">'.$percent.'</span>') . '</p>' . "\n"; 245 if (count($files) > 0) { 246 $text = (count($files) == 1) ? plog_tr('image') : plog_tr('images'); 247 $output .= "\n\n\t\t" . '<p class="actions">'.sprintf(plog_tr('You are currently looking at %s within the %s directory.'), '<strong>'.count($files).'</strong> '.$text, '<strong>'.$show_directory.'</strong>').'<br /><br />'; 248 $output .= "\n\t\t" . sprintf(plog_tr('Creating thumbnails: %s done.'), '<span id="progress" class="strong">'.$percent.'</span>').'</p>' . "\n"; 249 } 236 250 } 237 251 238 252 // check to make sure album is writable and readable, and issue warning 239 if (!is_writable($real_directory) || !is_readable($real_directory)) 240 $output .= "\n\n\t\t" . '<p class="actions">' . plog_tr('Warning: this directory does not have the proper permissions settings! You must CHMOD 777 on this directory using your FTP software or import may fail.') . "\n"; 253 if (!is_safe_mode() && (!is_writable($real_directory) || !is_readable($real_directory))) { 254 $output .= "\n\n\t\t" . '<p class="errors">'.plog_tr('Warning: This directory does not have the proper permissions settings! You must make this directory writable (CHMOD) using your FTP software, or import may fail.').'</p>'; 255 } 241 256 242 257 $albums = get_albums(); 243 $queue_func = "";258 $queue_func = ''; 244 259 $keys = array(); 260 if ($config['allow_comments']) { 261 $comment = plog_tr('Allow Comments').'?'; 262 $comment_type = 'checkbox" checked="checked'; 263 } else { 264 $comment = ' '; 265 $comment_type = 'hidden'; 266 } 245 267 sort($files); 246 for($i =0; $i<count($files); $i++) {268 for($i = 0; $i<count($files); $i++) { 247 269 $file_key = md5($files[$i]); 248 270 $keys[] = "'$file_key'"; 249 $relative_name = substr($files[$i], strlen($upload_directory)+1);271 $relative_name = substr($files[$i], strlen($upload_directory)+1); 250 272 if ($i == 0) 251 $output .= "\n\t\t\t" . '<form id="uploadForm" action="'.$_SERVER["PHP_SELF"].$query.'" method="post" enctype="multipart/form-data">252 <table style="width: 100%;" cellpadding=" 4">273 $output .= "\n\n\t\t\t" . '<form id="uploadForm" action="'.$_SERVER["PHP_SELF"].$query.'" method="post" enctype="multipart/form-data"> 274 <table style="width: 100%;" cellpadding="3" cellspacing="0"> 253 275 <tr class="header"> 254 <th class="table-header-left "> </th>255 <th class="table-header-middle " style="text-align: left;">' . plog_tr('Thumbnail') .'</th>256 <th class="table-header-middle " style="text-align: left;">' . plog_tr('Filename') .'</th>257 <th class="table-header-middle " style="text-align: left;">' . plog_tr('Caption & Description (optional)') .'</th>258 <th class="table-header-right "> </th>276 <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'uploadForm\'));" checked="checked" /></th> 277 <th class="table-header-middle align-left width-175" style="text-indent: 40px;">'.plog_tr('Thumb').'</th> 278 <th class="table-header-middle align-left width-200" style="text-align: left;">'.plog_tr('Filename').'</th> 279 <th class="table-header-middle align-left">'.plog_tr('Caption & Description (optional)').'</th> 280 <th class="table-header-right width-125">'.$comment.'</th> 259 281 </tr>'; 260 282 261 // For each file within upload directory, list check mark, thumbnail, caption box, albumbox283 // For each file within upload directory, list checkbox, thumbnail, caption box, description box, allow comments checkbox 262 284 263 285 // new loop code - it works - yea! 264 $table_row_color = ($counter%2) ? "color-1" : "color-2";286 $table_row_color = ($counter%2) ? 'color-1' : 'color-2'; 265 287 if (isset($_GET['nojs'])) { 266 $thumbpath = generate_thumb($upload_directory.'/'.$relative_name, "import-".substr($file_key,0,2),THUMB_SMALL);288 $thumbpath = generate_thumb($upload_directory.'/'.$relative_name, 'import-'.substr($file_key, 0, 2), THUMB_SMALL); 267 289 } else { 268 290 $thumbpath = $config['gallery_url'].'plog-admin/images/ajax-loader.gif'; … … 270 292 // start a new table row (alternating colors) and generate XHTML with thumbnail and link to picture view. 271 293 $output .= "\n\t\t\t\t" . '<tr class="'.$table_row_color.'"> 272 <td ><input type="checkbox" name="selected[]" value="'.$file_key.'" checked="checked" /></td>273 <td ><div class="img-shadow" id="pic_'.$file_key .'"><img src="'.$thumbpath.'" alt="thumbnail" /></div></td>274 <td >'.basename($files[$i]).'</td>275 <td >276 <input type="text" size="6 6" name="captions[' . $file_key .']" /><br />277 <textarea name="descriptions[' . $file_key . ']" rows="4" cols="64"></textarea>294 <td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="'.$file_key.'" checked="checked" /></p></td> 295 <td class="align-left width-175"><div class="img-shadow" id="pic_'.$file_key.'"><img src="'.$thumbpath.'" alt="thumbnail" /></div></td> 296 <td class="align-left width-200 vertical-top">'.basename($files[$i]).'</td> 297 <td class="align-left vertical-top"> 298 <input type="text" size="60" style="width: 95%;" name="captions['.$file_key.']" /><br /> 299 <textarea name="descriptions['.$file_key.']" rows="4" cols="60" style="width: 95%;"></textarea> 278 300 </td> 279 <td > </td>301 <td class="align-center width-125"><input type="'.$comment_type.'" name="allow_comments[]" value="'.$file_key.'" /></td> 280 302 </tr>'; 281 303 $counter++; … … 285 307 if (count($files) != 0) { 286 308 $output .= "\n\t\t\t\t" . '<tr class="footer"> 287 <td c olspan="5"></td>309 <td class="align-left invert-selection" colspan="5"><a href="#" onclick="checkToggle(document.getElementById(\'uploadForm\')); return false; ">'.plog_tr('Toggle Checkbox Selection').'</a></td> 288 310 </tr>' . "\n"; 289 311 $output .= "\n\t\t\t" . '</table>' . "\n"; 290 $output .= "\n\t\t\t" . '<div class="invert-selection"><a href="#" onclick="checkAll(document.getElementById(\'uploadForm\')); return false; ">' . plog_tr('Invert Checkbox Selection') . '</a></div>' . "\n";291 312 292 313 // here we can preselect some default options based on the structure of the import directory … … 297 318 298 319 // break up directory name into parts 299 $directory_parts = explode( "/", $show_directory);320 $directory_parts = explode('/', $show_directory); 300 321 301 322 if (isset($_REQUEST['collection_name']) && isset($_REQUEST['album_name'])) { 302 323 $collection_name = $_REQUEST['collection_name']; 303 324 $album_name = $_REQUEST['album_name']; 304 } 305 else { 325 } else { 306 326 $collection_name = @$directory_parts[2]; 307 327 $album_name = @$directory_parts[3]; … … 310 330 // check if album exists 311 331 if (is_null($album_name)) // file is only one level deep, assume folder name is album name 312 $sql = "SELECT id FROM ". TABLE_PREFIX."albums WHERE name = '".$collection_name."'";332 $sql = "SELECT id FROM ".PLOGGER_TABLE_PREFIX."albums WHERE name = '".mysql_real_escape_string($collection_name)."'"; 313 333 else 314 $sql = "SELECT id FROM ". TABLE_PREFIX."albums WHERE name = '".$album_name."'";334 $sql = "SELECT id FROM ".PLOGGER_TABLE_PREFIX."albums WHERE name = '".mysql_real_escape_string($album_name)."'"; 315 335 316 336 $result = run_query($sql); 317 337 $row = mysql_fetch_assoc($result); 338 $new_album_name = ''; 318 339 319 340 if(!isset($row['id'])) { // album doesn't exist, place in new album box 320 $existing = "";321 $new_album = "checked=\"checked\"";322 if (is_null($album_name)) 323 $new_album_name = $collection_name;324 else325 $new_album_name = $album_name;326 }327 else {328 $existing = "checked=\"checked\"";329 $new_album = "";330 } 331 332 $output .= "\n\t" . '<h1>' . plog_tr('Destination:') .'</h1>333 334 <div >335 <p >341 $existing = ''; 342 $new_album = 'checked="checked"'; 343 if (is_null($album_name)) { 344 $new_album_name = $collection_name; 345 } else { 346 $new_album_name = $album_name; 347 } 348 } else { 349 $existing = 'checked="checked"'; 350 $new_album = ''; 351 } 352 353 $output .= "\n\t" . '<h1>'.plog_tr('Destination:').'</h1> 354 355 <div class="import"> 356 <p class="no-margin-top"> 336 357 <input accesskey="a" type="radio" name="destination_radio" id="destination_radio" value="existing" '.$existing.' style="margin-bottom: -1px;" /> 337 <label for="destination_radio" style="display: inline; font-weight: bold;">' . plog_tr('Existing <em>A</em>lbum') .'</label><br /><br />338 '.generate_albums_menu($albums, "single", $row['id']).'358 <label for="destination_radio" class="strong" style="display: inline;">'.plog_tr('Existing <em>A</em>lbum').'</label><br /><br /> 359 '.generate_albums_menu($albums, 'single', $row['id']).' 339 360 </p> 340 361 341 <h3 style="text-indent: 10px;">' . plog_tr('-- OR --') .'</h3>342 343 <p >344 <input accesskey="b" onclick="var k=document.getElementsByName(\'new_album_name\');k[0].focus()" type="radio" name="destination_radio" id="destination_radio"value="new" '.$new_album.' style="margin-bottom: -1px;" />345 <label for="destination_radio" style="display: inline; font-weight: bold;">' . plog_tr('Create a New Al<em>b</em>um') .'</label>346 <label for="new_album_name">' . plog_tr('New Album Name:') .'</label>347 <input type="text" name="new_album_name" id="new_album_name" value="'. $new_album_name.'" onclick="var k=document.getElementsByName(\'destination_radio\');k[1].checked=true;" />348 <label for="collections_menu">' . plog_tr('In collection:') .'</label>362 <h3 class="no-margin-top" style="text-indent: 10px;">'.plog_tr('-- OR --').'</h3> 363 364 <p class="no-margin-top"> 365 <input accesskey="b" onclick="var k=document.getElementsByName(\'new_album_name\');k[0].focus()" type="radio" name="destination_radio" value="new" '.$new_album.' style="margin-bottom: -1px;" /> 366 <label for="destination_radio" class="strong" style="display: inline;">'.plog_tr('Create a New Al<em>b</em>um').'</label> 367 <label for="new_album_name">'.plog_tr('New Album Name:').'</label> 368 <input type="text" name="new_album_name" id="new_album_name" value="'.ucfirst($new_album_name).'" onclick="var k=document.getElementsByName(\'destination_radio\');k[1].checked=true;" /> 369 <label for="collections_menu">'.plog_tr('In collection:').'</label> 349 370 '.generate_collections_menu().' 350 371 </p> 351 372 352 <p ><input class="submit" type="submit" name="upload" value="' . plog_tr('Import') .'" /></p>373 <p class="no-margin-bottom"><input class="submit" type="submit" name="upload" value="'.plog_tr('Import').'" /></p> 353 374 </div>'; 354 375 355 376 $output .= "\n\t</form>"; 356 377 if (!isset($_GET['nojs'])) { 357 $key_arr = join(",\n\t\t",$keys); 358 359 $output .= "\n\n\t<script type=\"text/javascript\">\n\tvar importThumbs=[\n\t\t"; 378 $key_arr = join(",\n\t\t\t", $keys); 379 380 $output .= "\n\n\t" . '<script type="text/javascript">'; 381 $output .= "\n\t\t" . 'var importThumbs=[' . "\n\t\t\t"; 360 382 $output .= $key_arr; 361 $output .= " ];\n";362 $output .="\ trequestImportThumb();\n\t</script>\n";383 $output .= "\n\t\t" . '];'; 384 $output .="\n\t\t" . 'requestImportThumb();' . "\n\t</script>\n"; 363 385 } 364 386 } … … 366 388 } 367 389 368 $output_error = "\n\t" . '<h1>' . plog_tr('Import') .'</h1>369 370 <p class="actions ">' . sprintf(plog_tr('Before you can begin importing photos to your gallery, you must create at least <strong>one collection</strong> AND <strong>one album</strong> within that collection. Move over to the <a href="%s">"Manage"</a> tab to begin creating your organizational structure'),'plog-manage.php') .'</p>';390 $output_error = "\n\t" . '<h1>'.plog_tr('Import').'</h1> 391 392 <p class="actions width-700">'.sprintf(plog_tr('Before you can begin importing images to your gallery, you must create at least <strong>one collection</strong> AND <strong>one album</strong> within that collection. Move over to the <a title="Manage" style="font-weight: bold;" href="%s">Manage</a> tab to begin creating your organizational structure'), 'plog-manage.php').'</p>'; 371 393 372 394 $num_albums = count_albums(); 373 395 374 396 if ($num_albums > 0) 375 display($output, "import");397 display($output, 'import'); 376 398 else 377 display($output_error, "import");399 display($output_error, 'import'); 378 400 379 401 ?> -
trunk/plog-admin/plog-manage.php
r588 r590 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 3 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");4 require(PLOGGER_DIR. "plog-admin/plog-admin.php");3 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 4 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 5 5 6 6 global $inHead; … … 9 9 10 10 function generate_move_menu($level) { 11 if ($level == "albums") { $parent = "collections"; }12 if ($level == "pictures") { $parent = "albums"; }13 $output = "\n\t\t\t" .'<input class="submit" type="submit" name="move_checked" value="' . plog_tr("Move Checked To") .'" />';14 15 if ($level == "pictures") {11 if ($level == 'albums') { $parent = 'collections'; } 12 if ($level == 'pictures') { $parent = 'albums'; } 13 $output = "\n\t\t\t" . '<input class="submit" type="submit" name="move_checked" value="'.plog_tr('Move Checked To').'" />'; 14 15 if ($level == 'pictures') { 16 16 $albums = get_albums(); 17 17 $output .= generate_albums_menu($albums); 18 18 } else { 19 $output .= "\n\t\t\t \t".'<select class="move-del-manage" id="group_id" name="group_id">';19 $output .= "\n\t\t\t" . '<select class="move-del-manage" id="group_id" name="group_id">'; 20 20 $collections = get_collections(); 21 21 foreach($collections as $collection) { 22 $output .= "\n\t\t\t\t\t".'<option value="'.$collection['id'].'">'.SmartStripSlashes($collection['name']); 23 $output .= '</option>'; 22 $output .= "\n\t\t\t\t" . '<option value="'.$collection['id'].'">'.SmartStripSlashes($collection['name']).'</option>'; 24 23 } 25 $output .= "\n\t\t\t \t".'</select>';24 $output .= "\n\t\t\t" . '</select>'; 26 25 } 27 26 … … 30 29 31 30 function generate_albums_menu($albums) { 32 $output = "\n\t\t\t" .'<select id="group_id" name="group_id">';31 $output = "\n\t\t\t" . '<select id="group_id" name="group_id">'; 33 32 foreach($albums as $album_id => $album) { 34 33 $selected = ''; … … 36 35 if (isset($_REQUEST['albums_menu']) && isset($_REQUEST['new_album_name'])) { 37 36 if ($albums_menu == $album_id || $new_album_name == $album['album_name']) { 38 $selected = " selected=\"selected\"";37 $selected = ' selected="selected"'; 39 38 } 40 39 } 41 40 42 $output .= "\n\t\t\t\t".'<option value="'.$album_id.'"'.$selected.'>'.SmartStripSlashes($album['collection_name']).': '.SmartStripSlashes($album['album_name']); 43 $output .= "</option>"; 41 $output .= "\n\t\t\t\t" . '<option value="'.$album_id.'"'.$selected.'>'.SmartStripSlashes($album['collection_name']).': '.SmartStripSlashes($album['album_name']).'</option>'; 44 42 } 45 43 … … 49 47 50 48 function generate_breadcrumb_admin($level, $id = 0) { 51 switch ($level) {49 switch ($level) { 52 50 case 'collections': 53 $breadcrumbs = '<strong>' . plog_tr('Collections') .'</strong>';51 $breadcrumbs = '<strong>'.plog_tr('Collections').'</strong>'; 54 52 break; 55 53 case 'albums': 56 54 $collection = get_collection_by_id($id); 57 55 $collection_name = SmartStripSlashes($collection['name']); 58 $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">' . plog_tr('Collections') . '</a> » ' . "<strong>".$collection_name."</strong>";56 $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">'.plog_tr('Collections').'</a> » <strong>'.$collection_name.'</strong>'; 59 57 break; 60 58 case 'pictures': … … 62 60 $album_link = SmartStripSlashes($album['name']); 63 61 $collection_link = '<a href="'.$_SERVER['PHP_SELF'].'?level=albums&id='.$album['parent_id'].'">'.SmartStripSlashes($album['collection_name']).'</a>'; 64 $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">' . plog_tr('Collections') . '</a> » ' . $collection_link . ' » ' .'<strong>'.$album_link.'</strong>';62 $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">'.plog_tr('Collections').'</a> » '.$collection_link.' » '.'<strong>'.$album_link.'</strong>'; 65 63 break; 66 64 case 'comments': 67 $query = "SELECT * FROM `". TABLE_PREFIX."pictures` WHERE `id`='".$id."'";65 $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."pictures` WHERE `id`='".$id."'"; 68 66 $result = run_query($query); 69 67 $row = mysql_fetch_assoc($result); … … 73 71 $collection_id = $row['parent_collection']; 74 72 75 $query = "SELECT * FROM `". TABLE_PREFIX."albums` WHERE `id`='".$album_id."'";73 $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."albums` WHERE `id`='".$album_id."'"; 76 74 $result = run_query($query); 77 75 $row = mysql_fetch_assoc($result); … … 79 77 $album_link = '<a href="'.$_SERVER['PHP_SELF'].'?level=pictures&id='.$album_id.'">'.SmartStripSlashes($row['name']).'</a>'; 80 78 81 $query = "SELECT * FROM `". TABLE_PREFIX."collections` WHERE `id`='".$collection_id."'";79 $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."collections` WHERE `id`='".$collection_id."'"; 82 80 $result = run_query($query); 83 81 $row = mysql_fetch_assoc($result); … … 85 83 $collection_link = '<a href="'.$_SERVER['PHP_SELF'].'?level=albums&id='.$collection_id.'">'.SmartStripSlashes($row['name']).'</a>'; 86 84 87 $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">' . plog_tr('Collections') .' </a> » ' . $collection_link . ' » ' 88 .$album_link. ' » '.$picture_link . ' »' . " " . plog_tr('Comments'); 85 $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">'.plog_tr('Collections').'</a> » '.$collection_link.' » '.$album_link.' » '.$picture_link.' - '.'<strong>'.plog_tr('Comments').':</strong>'; 89 86 break; 90 87 default: 91 $breadcrumbs = '<strong>' . plog_tr('Collections') .'</strong>';88 $breadcrumbs = '<strong>'.plog_tr('Collections').'</strong>'; 92 89 } 93 90 … … 96 93 97 94 $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; 98 $level = (isset($_REQUEST['level']) && $_REQUEST['level'] != '') ? $_REQUEST['level'] : "collections"; 99 100 $output = "\n\t" . '<h1>' . plog_tr('Manage Content') . '</h1>' . "\n"; 101 102 /*if ($level == "collections") { // display some high level statistics on the main page. 103 $output .= "\n\t" . '<p class="highlight">You have a total of <strong>'. count_pictures().'</strong> images within <strong>'.count_albums() .'</strong> album(s). Users have posted <strong>'. count_comments().'</strong> comment(s) to your gallery</p>' . "\n"; } */ 95 $level = (isset($_REQUEST['level']) && $_REQUEST['level'] != '') ? $_REQUEST['level'] : 'collections'; 96 97 $output = "\n\t" . '<h1>'.plog_tr('Manage Content').'</h1>' . "\n"; 104 98 105 99 global $config; … … 117 111 if (isset($_REQUEST['selected'])) { 118 112 foreach($_REQUEST['selected'] as $del_id) { 119 if ($level == "pictures") {113 if ($level == 'pictures') { 120 114 $rv = delete_picture($del_id); 121 115 } 122 if ($level == "collections") {116 if ($level == 'collections') { 123 117 $rv = delete_collection($del_id); 124 118 } 125 if ($level == "albums") {119 if ($level == 'albums') { 126 120 $rv = delete_album($del_id); 127 121 } 128 122 129 123 if (isset($rv['errors'])) { 130 $output .= "\n\t" . '<p class="errors">' . $rv['errors'] .'</p>' ."\n";124 $output .= "\n\t" . '<p class="errors">'.$rv['errors'].'</p>' ."\n"; 131 125 } else { 132 126 $num_items++; … … 135 129 136 130 if ($num_items > 0) { 137 $output .= "\n\t<p class=\"actions\">"; 138 if ($num_items > 1) { 139 $output .= sprintf(plog_tr('You have deleted %d entries successfully'),$num_items); 140 } else { 141 $output .= sprintf(plog_tr('You have deleted %d entry successfully'),$num_items); 142 } 143 $output .= "</p>\n"; 144 131 $text = ($num_items == 1) ? plog_tr('entry') : plog_tr('entries'); 132 $output .= "\n\t" . '<p class="success">'.sprintf(plog_tr('You have deleted %s successfully'), '<strong>'.$num_items.'</strong> '.$text).'.</p>' . "\n"; 145 133 } 146 134 } else { 147 $output .= "\n\t <p class=\"errors\">" . plog_tr('Nothing selected to delete!') . "</p>\n";135 $output .= "\n\t" . '<p class="errors">'.plog_tr('Nothing selected to delete').'!</p>' . "\n"; 148 136 } 149 } else if (isset($_REQUEST['move_checked'])) { 150 if ($level == "albums") { $parent = "parent_id"; } 151 if ($level == "pictures") { $parent = "parent_album"; } 137 138 } else if (isset($_REQUEST['move_checked'])) { 139 if ($level == 'albums') { $parent = 'parent_id'; } 140 if ($level == 'pictures') { $parent = 'parent_album'; } 152 141 153 142 // perform the move function on the selected items … … 158 147 159 148 // if we are using pictures we need to update the parent_collection as well 160 if ($level == "pictures") {149 if ($level == 'pictures') { 161 150 $result = move_picture($mov_id, $pid); 162 151 if (empty($result['errors'])) { 163 152 $num_items++; 164 153 } else { 165 $output .= "\n\t" . '<p class="errors">' . $result['errors'] .'</p>' . "\n";154 $output .= "\n\t" . '<p class="errors">'.$result['errors'].'</p>' . "\n"; 166 155 } 167 } else if ($level == "albums") {156 } else if ($level == 'albums') { 168 157 // if we are moving entire albums then we need to rename the folder 169 158 // $pid is our target collection id, $mov_id is our source album 170 159 171 $result = move_album($mov_id, $pid);160 $result = move_album($mov_id, $pid); 172 161 if (empty($result['errors'])) { 173 162 $num_items++; 174 163 } else { 175 $output .= "\n\t" . '<p class="errors">' . $result['errors'] .'</p>' . "\n";164 $output .= "\n\t" . '<p class="errors">'.$result['errors'].'</p>' . "\n"; 176 165 } 177 166 } … … 179 168 } 180 169 181 $output .= "\n\t<p class=\"actions\">" . sprintf(plog_tr('You have moved %d entry(s) successfully.'),$num_items) . "</p>\n"; 170 if ($num_items > 0) { 171 $text = ($num_items == 1) ? plog_tr('entry') : plog_tr('entries'); 172 $output .= "\n\t" . '<p class="success">'.sprintf(plog_tr('You have moved %s successfully'), '<strong>'.$num_items.'</strong> '.$text).'.</p>' . "\n"; 173 } 182 174 } else { 183 $output .= "\n\t <p class=\"errors\">" . plog_tr('Nothing selected to move!') . "</p>\n";175 $output .= "\n\t" . '<p class="errors">'.plog_tr('Nothing selected to move').'!</p>' . "\n"; 184 176 } 185 177 } 186 178 break; 187 case "edit-picture":179 case 'edit-picture': 188 180 $level = 'picture'; 189 181 // show the edit picture form 190 182 $photo = get_picture_by_id($id); 191 if ($photo['allow_comments'] == 1) $state = "checked=\"checked\""; else $state = ""; 192 193 $output .= "\n\t\t" . '<form class="edit" action="'.$_SERVER['PHP_SELF'].'?level=pictures&id='.$photo['parent_album'].'" method="post">'; 194 195 $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'],THUMB_SMALL); 196 $output .= "\n\t\t\t" . '<div style="float: right;"><img src="'.$thumbpath.'" alt="" /></div>'; 197 198 $output .= "\n\t\t\t" . '<div> 199 <label accesskey="c" for="caption">' . plog_tr('<em>C</em>aption') . ':</label><br /> 200 <input size="80" name="caption" id="caption" value="'.htmlspecialchars(SmartStripSlashes($photo['caption'])).'" /><br /> 201 <label for="description">' . plog_tr('Description') . ':</label><br /> 202 <textarea name="description" id="description" cols="60" rows="5">'.htmlspecialchars(SmartStripSlashes($photo['description'])).'</textarea><br /> 203 <label for="allow_comments" accesskey="w">' . plog_tr('Allo<em>w</em> Comments') . '?</label> <input type="checkbox" id="allow_comments" name="allow_comments" value="1"'." $state /><br /><br />"; 183 if ($photo['allow_comments'] == 1) $state = 'checked="checked"'; else $state = ''; 184 185 $output .= "\n\t\t" . '<form class="edit width-700" action="'.$_SERVER['PHP_SELF'].'?level=pictures&id='.$photo['parent_album'].'" method="post">'; 186 187 $thumbpath = generate_thumb(SmartStripSlashes($photo['path']), $photo['id'], THUMB_SMALL); 188 $output .= "\n\t\t\t" . '<div style="float: right;"><img src="'.$thumbpath.'" alt="" /></div> 189 <div> 190 <div class="strong">'.plog_tr('Edit Image Properties').'</div> 191 <p> 192 <label class="strong" accesskey="c" for="caption">'.plog_tr('<em>C</em>aption').':</label><br /> 193 <input size="62" name="caption" id="caption" value="'.htmlspecialchars(SmartStripSlashes($photo['caption'])).'" /> 194 </p> 195 <p> 196 <label class="strong" for="description">'.plog_tr('Description').':</label><br /> 197 <textarea name="description" id="description" cols="60" rows="5">'.htmlspecialchars(SmartStripSlashes($photo['description'])).'</textarea> 198 </p> 199 <p><input type="checkbox" id="allow_comments" name="allow_comments" value="1" '.$state.' /><label class="strong" for="allow_comments" accesskey="w">'.plog_tr('Allo<em>w</em> Comments').'?</label></p>'; 204 200 $output .= "\n\t\t\t\t" . '<input type="hidden" name="pid" value="'.$photo['id'].'" /> 205 201 <input type="hidden" name="action" value="update-picture" /> 206 <input class="submit" name="update" value="' . plog_tr('Update') .'" type="submit" />207 <input class="submit " name="cancel" value="' . plog_tr('Cancel') .'" type="submit" />208 </div> ';209 $output .= "\n\t\t" . '</form>' . "\n";202 <input class="submit" name="update" value="'.plog_tr('Update').'" type="submit" /> 203 <input class="submit-cancel" name="cancel" value="'.plog_tr('Cancel').'" type="submit" /> 204 </div> 205 </form>' . "\n"; 210 206 $edit_page = 1; 211 207 break; 212 case "edit-album":208 case 'edit-album': 213 209 // show the edit album form 214 210 $output .= plog_edit_album_form($id); 215 211 $edit_page = 1; 216 212 break; 217 case "edit-collection":213 case 'edit-collection': 218 214 // show the edit collection form 219 215 $output .= plog_edit_collection_form($id); 220 216 $edit_page = 1; 221 217 break; 222 case "edit-comment":218 case 'edit-comment': 223 219 // show the edit comment form 224 220 $output .= plog_edit_comment_form($id); 225 221 $edit_page = 1; 226 222 break; 227 case "update-picture":223 case 'update-picture': 228 224 // update the picture information 229 225 if (!isset($_REQUEST['cancel'])) { 230 $action_result = update_picture($_REQUEST['pid'], $_REQUEST['caption'], $_REQUEST['allow_comments'], $_REQUEST['description']); 231 } 232 break; 233 case "update-album": 226 $allow_comments = (isset($_REQUEST['allow_comments'])) ? $_REQUEST['allow_comments'] : ''; 227 $action_result = update_picture($_REQUEST['pid'], $_REQUEST['caption'], $allow_comments, $_REQUEST['description']); 228 } 229 break; 230 case 'update-album': 234 231 // update the album information 235 232 if (!isset($_REQUEST['cancel'])) { … … 237 234 } 238 235 break; 239 case "update-collection":236 case 'update-collection': 240 237 // update the collection information 241 238 if (!isset($_REQUEST['cancel'])) { … … 243 240 } 244 241 break; 245 case "update-comment":242 case 'update-comment': 246 243 // update the comment information 247 244 if (!isset($_REQUEST['cancel'])) { … … 249 246 } 250 247 break; 251 case "add-collection":248 case 'add-collection': 252 249 // add a new collection 253 250 $action_result = add_collection($_POST['name'], $_POST['description']); 254 251 break; 255 case "add-album":252 case 'add-album': 256 253 // add a new album 257 254 $action_result = add_album($_POST['name'], $_POST['description'], $_POST['parent_collection']); … … 261 258 if (!empty($action_result['errors'])) { 262 259 // if there are any errors from the actions above, display the errors for the user 263 $output .= "\n\t" . '<p class="errors">' . $action_result['errors'] .'</p>' . "\n";260 $output .= "\n\t" . '<p class="errors">'.$action_result['errors'].'</p>' . "\n"; 264 261 } elseif (!empty($action_result['output'])) { 265 262 // else if no errors, display the successful output 266 $output .= "\n\t" . '<p class=" actions">' . $action_result['output'] .'</p>' . "\n";263 $output .= "\n\t" . '<p class="success">'.$action_result['output'].'</p>' . "\n"; 267 264 } 268 265 … … 270 267 271 268 if (!isset($edit_page)) { 272 // here we will generate a "add collection/album" header form 273 if ($level == "collections") { 269 // Display the gallery statistics on the main page 270 if ($level == 'collections') { 271 $output .= "\n\t" . '<p class="stats"><strong>'.plog_tr('Gallery Stats:').'</strong> '.plog_tr('You have').' <strong>'.count_collections().'</strong> '.plog_tr('collections, which contain').' <strong>'.count_albums().'</strong> '.plog_tr('albums and').' <strong>'.count_pictures().'</strong> '.plog_tr('images. Users have posted').' <strong>'.count_comments().'</strong> '.plog_tr('comments to your gallery.').'</p>' . "\n"; 272 } 273 274 // here we will generate an 'add collection/album' header form 275 if ($level == 'collections') { 274 276 $output .= plog_add_collection_form(); 275 } 276 else if ($level == "albums") { 277 } else if ($level == 'albums') { 277 278 $output .= plog_add_album_form($id); 278 279 } 279 280 280 // let s iterate through all the content and build a table281 // let's iterate through all the content and build a table 281 282 // set the default level if nothing is specified 282 283 283 284 // handle pagination 284 // let s determine the limit filter based on current page and number of results per page285 // let's determine the limit filter based on current page and number of results per page 285 286 if (isset($_REQUEST['entries_per_page'])) { 286 287 $_SESSION['entries_per_page'] = $_REQUEST['entries_per_page']; 287 } else if (!isset($_SESSION['entries_per_page'])) {288 } else if (!isset($_SESSION['entries_per_page'])) { 288 289 $_SESSION['entries_per_page'] = 20; 289 290 } 290 291 291 $cond = "";292 $cond = ''; 292 293 293 294 // determine the filtering conditional based on the level and id number 294 if ($level == "albums" || $level == "comments"){295 if ($level == 'albums' || $level == 'comments') { 295 296 $cond = "WHERE `parent_id` = '".intval($id)."'"; 296 } else if ($level == "pictures"){297 } else if ($level == 'pictures') { 297 298 $cond = "WHERE `parent_album` = '".intval($id)."'"; 298 299 } … … 305 306 $limit = "LIMIT ".$first_item.", ".$_SESSION['entries_per_page']; 306 307 307 // let s generate the pagination menu as well308 $recordCount = "SELECT COUNT(*) AS num_items FROM ". TABLE_PREFIX."$level $cond";308 // let's generate the pagination menu as well 309 $recordCount = "SELECT COUNT(*) AS num_items FROM ".PLOGGER_TABLE_PREFIX."$level $cond"; 309 310 $totalRowsResult = mysql_query($recordCount); 310 $totalRows = mysql_result($totalRowsResult, 'num_items');311 $totalRows = mysql_result($totalRowsResult, 'num_items'); 311 312 312 313 $pagination_menu = "\n\t\t" . '<div class="entries-page">'.generate_pagination_view_menu().' 313 </div> 314 <div class="pagination">'.generate_pagination( "admin", "manage", $plog_page, $totalRows, $_SESSION['entries_per_page'], array("level" => $level, "id" => $id)).'</div>';314 </div><!-- /entries-page --> 315 <div class="pagination">'.generate_pagination('admin', 'manage', $plog_page, $totalRows, $_SESSION['entries_per_page'], array('level' => $level, 'id' => $id)).'</div><!-- /pagination -->'; 315 316 316 317 $output .= "\n\t\t" . '<form id="contentList" action="'.$_SERVER['PHP_SELF'].'" method="post">'; 317 318 319 $empty = false; 320 318 321 switch ($level) { 319 case "comments":320 $output .= $pagination_menu.generate_breadcrumb_admin( "comments", $id);321 $output .= plog_comment_manager($id, $first_item,$_SESSION['entries_per_page']);322 break; 323 case "pictures":324 $output .= $pagination_menu.generate_breadcrumb_admin( "pictures", $id);325 $output .= plog_picture_manager($id, $first_item,$_SESSION['entries_per_page']);326 break; 327 case "albums":328 $output .= $pagination_menu.generate_breadcrumb_admin( "albums", $id);329 $output .= plog_album_manager($id, $first_item,$_SESSION['entries_per_page']);330 break; 331 case "collections":322 case 'comments': 323 $output .= $pagination_menu.generate_breadcrumb_admin('comments', $id); 324 $output .= plog_comment_manager($id, $first_item, $_SESSION['entries_per_page']); 325 break; 326 case 'pictures': 327 $output .= $pagination_menu.generate_breadcrumb_admin('pictures', $id); 328 $output .= plog_picture_manager($id, $first_item, $_SESSION['entries_per_page']); 329 break; 330 case 'albums': 331 $output .= $pagination_menu.generate_breadcrumb_admin('albums', $id); 332 $output .= plog_album_manager($id, $first_item, $_SESSION['entries_per_page']); 333 break; 334 case 'collections': 332 335 default: 333 $output .= $pagination_menu.generate_breadcrumb_admin( "");334 $output .= plog_collection_manager($first_item, $_SESSION['entries_per_page']);335 break; 336 } 337 338 $output .= "\n\t\t" . '<div class="invert-selection"><a href="#" onclick="checkAll(document.getElementById(\'contentList\')); return false; ">' . plog_tr('Invert Checkbox Selection') . '</a></div>339 <div class="pagination">'.generate_pagination("admin", "manage", $plog_page, $totalRows, $_SESSION['entries_per_page'], array("level" => $level, "id" => $id, "entries_per_page" => $_SESSION['entries_per_page'])).'</div>336 $output .= $pagination_menu.generate_breadcrumb_admin(''); 337 $output .= plog_collection_manager($first_item, $_SESSION['entries_per_page']); 338 break; 339 } 340 341 if (!$empty) { 342 $output .= "\t\t" . '<div class="pagination">'.generate_pagination('admin', 'manage', $plog_page, $totalRows, $_SESSION['entries_per_page'], array('level' => $level, 'id' => $id, 'entries_per_page' => $_SESSION['entries_per_page'])).'</div><!-- /pagination --> 340 343 <div class="move-del-manage"> 341 344 <input type="hidden" name="level" value="'.$level.'" /> 342 345 <input type="hidden" name="id" value="'.$id.'" /> 343 346 <input type="hidden" name="action" value="move-delete" /> 344 <input class="submit" type="submit" name="delete_checked" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete selected items?') . '\');" value="' . plog_tr('Delete Checked') . '" />'; 345 if (!empty($level) && $level != "collections" && $level != "comments"){ 346 $output .= generate_move_menu($level); 347 } 348 $output .= "\n\t\t</div>\n\t\t</form>\n"; 349 } 350 351 display($output, "manage"); 347 <input class="submit-delete" type="submit" name="delete_checked" onclick="return confirm('.plog_tr('Are you sure you want to delete selected items?').');" value="'.plog_tr('Delete Checked').'" />'; 348 if (!empty($level) && $level != 'collections' && $level != 'comments') { 349 $output .= generate_move_menu($level); 350 } 351 $output .= "\n\t\t" . '</div><!-- /move-del-manage -->'; 352 } 353 $output .= "\n\t\t" . '</form>' . "\n"; 354 } 355 356 display($output, 'manage'); 352 357 353 358 ?> -
trunk/plog-admin/plog-options.php
r588 r590 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 3 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");4 require(PLOGGER_DIR. "plog-admin/plog-admin.php");3 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 4 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 5 5 6 6 $output = ''; 7 if (isset($_POST["submit"])){ 8 9 if (isset($_POST["allow_dl"])) $allow_dl = 1; else $allow_dl = 0; 10 if (isset($_POST["allow_comments"])) $allow_comments = 1; else $allow_comments = 0; 11 if (isset($_POST["allow_print"])) $allow_print = 1; else $allow_print = 0; 12 if (isset($_POST["square_thumbs"])) $square_thumbs = 1; else $square_thumbs = 0; 13 if (isset($_POST["generate_intermediate"])) $generate_intermediate = 1; else $generate_intermediate = 0; 14 if (isset($_POST["comments_moderate"])) $comments_moderate = 1; else $comments_moderate = 0; 15 if (isset($_POST["allow_fullpic"])) $allow_fullpic = 1; else $allow_fullpic = 0; 7 8 if (isset($_POST['submit'])) { 9 10 if (isset($_POST['allow_dl'])) $allow_dl = 1; else $allow_dl = 0; 11 if (isset($_POST['allow_comments'])) $allow_comments = 1; else $allow_comments = 0; 12 if (isset($_POST['allow_print'])) $allow_print = 1; else $allow_print = 0; 13 if (isset($_POST['square_thumbs'])) $square_thumbs = 1; else $square_thumbs = 0; 14 if (isset($_POST['generate_intermediate'])) $generate_intermediate = 1; else $generate_intermediate = 0; 15 if (isset($_POST['comments_moderate'])) $comments_moderate = 1; else $comments_moderate = 0; 16 if (isset($_POST['allow_fullpic'])) $allow_fullpic = 1; else $allow_fullpic = 0; 16 17 configure_htaccess_fullpic($allow_fullpic); 17 18 $disable_intermediate = ($generate_intermediate == 1) ? 0 : 1; 18 19 19 20 // verify that gallery URL contains a trailing slash. if not, add one. 20 if ($_POST['gallery_url']{ strlen($_POST['gallery_url'])-1} != '/'){21 if ($_POST['gallery_url']{ strlen($_POST['gallery_url'])-1} != '/') { 21 22 $_POST['gallery_url'] .= '/'; 22 23 } 23 24 // verify that the gallery URL begins with 'http://' for mod_rewrite 301 redirects 24 if (strpos($_POST['gallery_url'], 'http://') === false) {25 if (strpos($_POST['gallery_url'], 'http://') === false) { 25 26 $_POST['gallery_url'] = 'http://'.$_POST['gallery_url']; 26 27 } 27 28 28 $query = "UPDATE `".TABLE_PREFIX."config` SET 29 `truncate`='".intval($_POST["truncate"])."', 30 `feed_title`='".mysql_real_escape_string($_POST["feed_title"])."', 31 `feed_language`='".mysql_real_escape_string($_POST["feed_language"])."', 32 `feed_num_entries`='".intval($_POST["feed_num_entries"])."', 33 `allow_dl`='".intval($allow_dl)."', 34 `allow_comments`='".intval($allow_comments)."', 35 `allow_print`='".intval($allow_print)."', 36 `default_sortby`='".mysql_real_escape_string($_POST["default_sortby"])."', 37 `default_sortdir`='".mysql_real_escape_string($_POST["default_sortdir"])."', 38 `album_sortby`='".mysql_real_escape_string($_POST["album_sortby"])."', 39 `album_sortdir`='".mysql_real_escape_string($_POST["album_sortdir"])."', 40 `collection_sortby`='".mysql_real_escape_string($_POST["collection_sortby"])."', 41 `collection_sortdir`='".mysql_real_escape_string($_POST["collection_sortdir"])."', 42 `thumb_num`='".intval($_POST["thumb_num"])."', 43 `compression`='".intval($_POST["image_quality"])."', 44 `admin_username`='".mysql_real_escape_string($_POST["admin_username"])."', 45 `admin_email`='".mysql_real_escape_string($_POST["admin_email"])."', 46 `date_format`='".mysql_real_escape_string($_POST["date_format"])."', 47 `use_mod_rewrite`='".intval(@$_POST["use_mod_rewrite"])."', 48 `square_thumbs`='".intval($square_thumbs)."', 49 `comments_notify`='".intval(@$_POST["comments_notify"])."', 50 `comments_moderate`='".intval($comments_moderate)."', 51 `gallery_url`='".mysql_real_escape_string($_POST["gallery_url"])."', 52 `gallery_name`='".mysql_real_escape_string($_POST["gallery_name"])."', 53 `thumb_nav_range`='".intval($_POST["thumb_nav_range"])."', 54 `enable_thumb_nav`='".intval(@$_POST["enable_thumb_nav"])."', 55 `allow_fullpic`='".intval($allow_fullpic)."'"; 56 57 if (trim($_POST["admin_password"]) != ''){ 58 if (trim($_POST["admin_password"]) == trim($_POST["confirm_admin_password"])){ 59 $query .= ", `admin_password`='".md5(mysql_real_escape_string(trim($_POST["admin_password"])))."'"; 29 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET 30 `truncate`= '".intval($_POST['truncate'])."', 31 `feed_title`= '".mysql_real_escape_string($_POST['feed_title'])."', 32 `feed_language`= '".mysql_real_escape_string($_POST['feed_language'])."', 33 `feed_num_entries`= '".intval($_POST['feed_num_entries'])."', 34 `allow_dl`= '".intval($allow_dl)."', 35 `allow_comments`= '".intval($allow_comments)."', 36 `allow_print`= '".intval($allow_print)."', 37 `default_sortby`= '".mysql_real_escape_string($_POST['default_sortby'])."', 38 `default_sortdir`= '".mysql_real_escape_string($_POST['default_sortdir'])."', 39 `album_sortby`= '".mysql_real_escape_string($_POST['album_sortby'])."', 40 `album_sortdir`= '".mysql_real_escape_string($_POST['album_sortdir'])."', 41 `collection_sortby`= '".mysql_real_escape_string($_POST['collection_sortby'])."', 42 `collection_sortdir`= '".mysql_real_escape_string($_POST['collection_sortdir'])."', 43 `thumb_num`= '".intval($_POST['thumb_num'])."', 44 `compression`= '".intval($_POST['image_quality'])."', 45 `admin_username`= '".mysql_real_escape_string($_POST['admin_username'])."', 46 `admin_email`= '".mysql_real_escape_string($_POST['admin_email'])."', 47 `date_format`= '".mysql_real_escape_string($_POST['date_format'])."', 48 `use_mod_rewrite`= '".intval(@$_POST['use_mod_rewrite'])."', 49 `square_thumbs`= '".intval($square_thumbs)."', 50 `comments_notify`= '".intval(@$_POST['comments_notify'])."', 51 `comments_moderate`= '".intval($comments_moderate)."', 52 `gallery_url`= '".mysql_real_escape_string($_POST['gallery_url'])."', 53 `gallery_name`= '".mysql_real_escape_string($_POST['gallery_name'])."', 54 `thumb_nav_range`= '".intval($_POST['thumb_nav_range'])."', 55 `enable_thumb_nav`= '".intval(@$_POST['enable_thumb_nav'])."', 56 `allow_fullpic`= '".intval($allow_fullpic)."'"; 57 58 if (trim($_POST['admin_password']) != '') { 59 if (trim($_POST['admin_password']) == trim($_POST['confirm_admin_password'])) { 60 $query .= ", `admin_password`= '".md5(mysql_real_escape_string(trim($_POST['admin_password'])))."'"; 61 } else { 62 $error_flag = true; 63 $output .= '<p class="errors">'.plog_tr('The passwords you entered did not match').'.</p>'; 64 $output .= '<p class="success">'.plog_tr('Other changes have been applied successfully').'.</p>'; 60 65 } 61 else{62 $error_flag = true;63 $output .= '<p class="errors">' . plog_tr('The passwords you entered did not match.') . '</p>';64 $output .= '<p class="actions">' . plog_tr('Other changes have been applied successfully.') . '</p>';65 }66 66 } 67 67 68 68 run_query($query); 69 69 70 $max_thumbnail_size = intval($_POST[ "max_thumbnail_size"]);71 $max_display_size = intval($_POST[ "max_display_size"]);72 $rss_thumbsize = intval($_POST[ "rss_thumbsize"]);73 $nav_thumbsize = intval($_POST[ "nav_thumbsize"]);70 $max_thumbnail_size = intval($_POST['max_thumbnail_size']); 71 $max_display_size = intval($_POST['max_display_size']); 72 $rss_thumbsize = intval($_POST['rss_thumbsize']); 73 $nav_thumbsize = intval($_POST['nav_thumbsize']); 74 74 $time = time(); 75 75 76 if ($thumbnail_config[THUMB_SMALL]['size'] != $max_thumbnail_size || 77 $config['square_thumbs'] != $square_thumbs) { 78 79 $query = "UPDATE `".TABLE_PREFIX."thumbnail_config` 80 SET max_size = '$max_thumbnail_size',update_timestamp = '$time' 81 WHERE id = " . THUMB_SMALL; 76 if ($thumbnail_config[THUMB_SMALL]['size'] != $max_thumbnail_size || $config['square_thumbs'] != $square_thumbs) { 77 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."thumbnail_config` 78 SET max_size = '$max_thumbnail_size', update_timestamp = '$time' 79 WHERE id = ".THUMB_SMALL; 82 80 mysql_query($query); 83 81 } 84 82 85 83 if ($thumbnail_config[THUMB_LARGE]['size'] != $max_display_size) { 86 87 $query = "UPDATE `".TABLE_PREFIX."thumbnail_config` 88 SET max_size = '$max_display_size',update_timestamp = '$time' 89 WHERE id = " . THUMB_LARGE; 84 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."thumbnail_config` 85 SET max_size = '$max_display_size', update_timestamp = '$time' 86 WHERE id = ".THUMB_LARGE; 90 87 mysql_query($query); 91 88 } 92 89 93 $query = "UPDATE `". TABLE_PREFIX."thumbnail_config`90 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."thumbnail_config` 94 91 SET disabled = '$disable_intermediate' 95 WHERE id = " .THUMB_LARGE;92 WHERE id = ".THUMB_LARGE; 96 93 mysql_query($query); 97 94 98 95 if ($thumbnail_config[THUMB_RSS]['size'] != $rss_thumbsize) { 99 100 $query = "UPDATE `".TABLE_PREFIX."thumbnail_config` 101 SET max_size = '$rss_thumbsize',update_timestamp = '$time' 102 WHERE id = " . THUMB_RSS; 96 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."thumbnail_config` 97 SET max_size = '$rss_thumbsize', update_timestamp = '$time' 98 WHERE id = ".THUMB_RSS; 103 99 mysql_query($query); 104 100 } 105 101 106 if ($thumbnail_config[THUMB_NAV]['size'] != $nav_thumbsize ) {107 $query = "UPDATE `". TABLE_PREFIX."thumbnail_config`108 SET max_size = '$nav_thumbsize', update_timestamp = '$time'109 WHERE id = " .THUMB_NAV;102 if ($thumbnail_config[THUMB_NAV]['size'] != $nav_thumbsize ) { 103 $query = "UPDATE `".PLOGGER_TABLE_PREFIX."thumbnail_config` 104 SET max_size = '$nav_thumbsize', update_timestamp = '$time' 105 WHERE id = ".THUMB_NAV; 110 106 mysql_query($query); 111 107 } 112 108 113 // `max_thumbnail_size`= '".intval($_POST["max_thumbnail_size"])."',114 // `max_display_size`= '".intval($_POST["max_display_size"])."',115 // `rss_thumbsize`= '".intval($_POST["rss_thumbsize"])."',109 // `max_thumbnail_size`= '".intval($_POST['max_thumbnail_size'])."', 110 // `max_display_size`= '".intval($_POST['max_display_size'])."', 111 // `rss_thumbsize`= '".intval($_POST['rss_thumbsize'])."', 116 112 117 113 // and read the configuration back again 118 114 $config['gallery_url'] = $_POST['gallery_url']; 119 $config[ "use_mod_rewrite"] = intval(@$_POST["use_mod_rewrite"]);120 configure_mod_rewrite($config[ "use_mod_rewrite"]);121 122 if (!isset($error_flag)) $output .= "\n\t" . '<p class=" actions">' . plog_tr("You have updated your settings successfully.") . '</p>' . "\n";123 124 $_SESSION[ "msg"] = $output;125 header( "Location: plog-options.php");115 $config['use_mod_rewrite'] = intval(@$_POST['use_mod_rewrite']); 116 configure_mod_rewrite($config['use_mod_rewrite']); 117 118 if (!isset($error_flag)) $output .= "\n\t" . '<p class="success">'.plog_tr('You have updated your settings successfully').'.</p>' . "\n"; 119 120 $_SESSION['msg'] = $output; 121 header('Location: plog-options.php'); 126 122 exit; 127 123 128 124 } 129 125 130 if (isset($_SESSION[ "msg"])) {131 $output .= $_SESSION[ "msg"];132 unset($_SESSION[ "msg"]);133 } ;126 if (isset($_SESSION['msg'])) { 127 $output .= $_SESSION['msg']; 128 unset($_SESSION['msg']); 129 } 134 130 135 131 $date_formats = array( 136 "n.j.Y", // i.e., 6.29.2008137 "j.n.Y", // i.e., 29.6.2008138 "j-m-y", // i.e., 29-6-2008139 "m.d.Y", // i.e., 6.29.2008140 "m-d-Y", // i.e., 6-29-2008141 "m/d/Y", // i.e., 6/29/2008142 "Ymd", // i.e., 20080629143 "F j, Y", // i.e., June 29, 2008144 "d F Y", // i.e., 29 June 2008145 "D, F j, Y", // i.e., Fri, June 29, 2008132 'n.j.Y', // i.e., 6.29.2008 133 'j.n.Y', // i.e., 29.6.2008 134 'j-m-y', // i.e., 29-6-2008 135 'm.d.Y', // i.e., 6.29.2008 136 'm-d-Y', // i.e., 6-29-2008 137 'm/d/Y', // i.e., 6/29/2008 138 'Ymd', // i.e., 20080629 139 'F j, Y', // i.e., June 29, 2008 140 'd F Y', // i.e., 29 June 2008 141 'D, F j, Y', // i.e., Fri, June 29, 2008 146 142 ); 147 143 148 $output .= "\n\t" . '<h1>' . plog_tr("General") .'</h1>149 150 <form action="'.$_SERVER[ "PHP_SELF"].'" method="post">151 <div id="options _section">152 <table class="option-table" >153 <tr class="alt"> 154 <td class="left"><label for="gallery_name">' . plog_tr("Gallery Name:") . '</label><br />' . plog_tr("(optional)") .'</td>144 $output .= "\n\t" . '<h1>'.plog_tr('General').'</h1> 145 146 <form action="'.$_SERVER['PHP_SELF'].'" method="post"> 147 <div id="options-section"> 148 <table class="option-table" cellspacing="0"> 149 <tr class="alt"> 150 <td class="left"><label for="gallery_name">'.plog_tr('Gallery Name').':</label><br />'.plog_tr('(optional)').'</td> 155 151 <td class="right"><input size="40" type="text" id="gallery_name" name="gallery_name" value="'.stripslashes($config['gallery_name']).'" /></td> 156 152 </tr> 157 153 <tr> 158 <td class="left"><label for="gallery_url">' . plog_tr('Gallery URL:') . '</label></td>154 <td class="left"><label for="gallery_url">'.plog_tr('Gallery URL').':</label></td> 159 155 <td class="right"><input size="40" type="text" id="gallery_url" name="gallery_url" value="'.stripslashes($config['gallery_url']).'" /></td> 160 156 </tr> 161 157 <tr class="alt"> 162 <td class="left"><label for="admin_username">' . plog_tr('Administrator Username:') . '</label></td>158 <td class="left"><label for="admin_username">'.plog_tr('Admin Username').':</label></td> 163 159 <td class="right"><input size="40" type="text" id="admin_username" name="admin_username" value="'.$config['admin_username'].'" /></td> 164 160 </tr> 165 161 <tr> 166 <td class="left"><label for="admin_email">' . plog_tr('Administrator E-mail Address:') . '</label></td>162 <td class="left"><label for="admin_email">'.plog_tr('Admin Email Address').':</label></td> 167 163 <td class="right"><input size="40" type="text" id="admin_email" name="admin_email" value="'.$config['admin_email'].'" /></td> 168 164 </tr> 169 165 </table> 170 166 171 <h1>' . plog_tr("Language") .'</h1>172 173 <table class="option-table" >174 <tr class="alt"> 175 <td class="left"><label for="feed_language">' . plog_tr('RSS Language:') . '</label> <a href="http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes">' . plog_tr('(language codes)') .'</a></td>167 <h1>'.plog_tr('Language').'</h1> 168 169 <table class="option-table" cellspacing="0"> 170 <tr class="alt"> 171 <td class="left"><label for="feed_language">'.plog_tr('RSS Language').':</label> <a href="http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes">'.plog_tr('(language codes)').'</a></td> 176 172 <td class="right"><input size="40" type="text" id="feed_language" name="feed_language" value="'.$config['feed_language'].'" /></td> 177 173 </tr> 178 174 </table> 179 175 180 <h1>' . plog_tr("Change Password") .'</h1>181 182 <table class="option-table" >183 <tr> 184 <td class="left"><label for="admin_password">' . plog_tr("New Administrator Password:") . '</label></td>185 <td class="right"><input size="40" type="password" id="admin_password" name="admin_password" /></td>186 </tr> 187 <tr class="alt"> 188 <td class="left"><label for="confirm_admin_password">' . plog_tr('Confirm New Administrator Password:') . '</label></td>189 <td class="right"><input size="40" type="password" id="confirm_admin_password" name="confirm_admin_password" /></td>190 </tr> 191 </table> 192 193 <h1>' . plog_tr("Comments") .'</h1>194 195 <table class="option-table" >196 <tr> 197 <td class="left"><label for="allow_comments">' . plog_tr('Allow User Comments:') . '</label><br />' .plog_tr('(will override individual settings)') .'</td>198 <td class="right">'; 199 if ($config['allow_comments'] == 1) $checked = "checked='checked'"; else $checked = "";176 <h1>'.plog_tr("Change Admin Password").'</h1> 177 178 <table class="option-table" cellspacing="0"> 179 <tr> 180 <td class="left"><label for="admin_password">'.plog_tr('New Password').':</label></td> 181 <td class="right"><input size="40" type="password" id="admin_password" name="admin_password" value="" /></td> 182 </tr> 183 <tr class="alt"> 184 <td class="left"><label for="confirm_admin_password">'.plog_tr('Confirm New Password').':</label></td> 185 <td class="right"><input size="40" type="password" id="confirm_admin_password" name="confirm_admin_password" value="" /></td> 186 </tr> 187 </table> 188 189 <h1>'.plog_tr('Comments').'</h1> 190 191 <table class="option-table" cellspacing="0"> 192 <tr> 193 <td class="left"><label for="allow_comments">'.plog_tr('Allow User Comments').':</label><br />'.plog_tr('(will override individual settings if unchecked)').'</td> 194 <td class="right">'; 195 if ($config['allow_comments'] == 1) $checked = 'checked="checked"'; else $checked = ''; 200 196 $output .='<input type="checkbox" id="allow_comments" name="allow_comments" value="1" '.$checked.' /></td> 201 197 </tr> 202 198 <tr class="alt"> 203 <td class="left"><label for="comments_notify" style="white-space: nowrap;">' . plog_tr('Send E-mail Notification for Comments:') . '</label><br />' . plog_tr('(requires valid e-mail address)') .'</td>204 <td class="right">'; 205 if ($config['comments_notify'] == 1) $checked = "checked='checked'"; else $checked = "";199 <td class="left"><label for="comments_notify" style="white-space: nowrap;">'.plog_tr('Send Email Notification for Comments').':</label><br />'.plog_tr('(requires valid email address)').'</td> 200 <td class="right">'; 201 if ($config['comments_notify'] == 1) $checked = 'checked="checked"'; else $checked = ''; 206 202 $output .= '<input type="checkbox" id="comments_notify" name="comments_notify" value="1" '.$checked.' /></td> 207 203 </tr> 208 204 <tr> 209 <td class="left"><label for="comments_moderate">' . plog_tr('Place New Comments Into Moderation:') . '</label></td>210 <td class="right">'; 211 if ($config['comments_moderate'] == 1) $checked = "checked='checked'"; else $checked = "";205 <td class="left"><label for="comments_moderate">'.plog_tr('Place New Comments Into Moderation').':</label></td> 206 <td class="right">'; 207 if ($config['comments_moderate'] == 1) $checked = 'checked="checked"'; else $checked = ''; 212 208 $output .= '<input type="checkbox" id="comments_moderate" name="comments_moderate" value="1" '.$checked.' /></td> 213 209 </tr> 214 210 </table> 215 211 216 <h1>' . plog_tr("Sort Order") .'</h1>217 218 <table class="option-table" >219 <tr class="alt"> 220 <td class="left"><label for="default_sortby">' . plog_tr('Image Sort Order:') . '</label></td>212 <h1>'.plog_tr('Sort Order').'</h1> 213 214 <table class="option-table" cellspacing="0"> 215 <tr class="alt"> 216 <td class="left"><label for="default_sortby">'.plog_tr('Image Sort Order').':</label></td> 221 217 <td class="right">'; 222 218 $sort_by_fields = array( … … 238 234 ); 239 235 240 $output .= "\n\t\t\t\t\t\t\t" . '<select style="width: 145px;" id="default_sortby" name="default_sortby">';241 foreach($sort_by_fields as $sort_key => $sort_caption) {242 $selected = ($config['default_sortby'] == $sort_key) ? 'selected="selected" ': '';243 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>';244 }; 245 $output .= "\n\t\t\t\t\t\t\t" . '</select>';246 $output .= "\n\t\t\t\t\t\t\t" . '<select id="default_sortdir" name="default_sortdir">';247 foreach($sort_dir_fields as $sort_key => $sort_caption) {248 $selected = ($config['default_sortdir'] == $sort_key) ? 'selected="selected" ': '';249 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>';250 }; 251 $output .= "\n\t\t\t\t\t\t\t" . '</select>';252 $output .= "\n\t\t\t\t\t\t" . '</td>253 </tr> 254 <tr> 255 <td class="left"><label for="album_sortby">' . plog_tr('Album Sort Order:') . '</label></td>256 <td class="right">'; 257 $output .= "\n\t\t\t\t\t\t\t" . '<select style="width: 145px;" id="album_sortby" name="album_sortby">';258 foreach($sort_by_fields_collection as $sort_key => $sort_caption) {259 $selected = ($config['album_sortby'] == $sort_key) ? 'selected="selected" ': '';260 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>';261 }; 262 $output .= "\n\t\t\t\t\t\t\t" . '</select>';263 $output .= "\n\t\t\t\t\t\t\t" . '<select id="album_sortdir" name="album_sortdir">';264 foreach($sort_dir_fields as $sort_key => $sort_caption) {265 $selected = ($config['album_sortdir'] == $sort_key) ? 'selected="selected" ': '';266 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>';267 }; 268 $output .= "\n\t\t\t\t\t\t\t" . '</select>';269 $output .= "\n\t\t\t\t\t\t" . '</td>270 </tr> 271 <tr class="alt"> 272 <td class="left"><label for="collection_sortby">' . plog_tr('Collection Sort Order:') . '</label></td>273 <td class="right">'; 274 $output .= "\n\t\t\t\t\t\t\t" . '<select style="width: 145px;" id="collection_sortby" name="collection_sortby">';275 foreach($sort_by_fields_collection as $sort_key => $sort_caption) {276 $selected = ($config['collection_sortby'] == $sort_key) ? 'selected="selected" ': '';277 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>';278 }; 279 $output .= "\n\t\t\t\t\t\t\t" . '</select>';280 $output .= "\n\t\t\t\t\t\t\t" . '<select id="collection_sortdir" name="collection_sortdir">';281 foreach($sort_dir_fields as $sort_key => $sort_caption) {282 $selected = ($config['collection_sortdir'] == $sort_key) ? 'selected="selected" ': '';283 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>';284 }; 285 $output .= "\n\t\t\t\t\t\t\t" . '</select>';286 $output .= "\n\t\t\t\t\t\t" . '</td>287 </tr> 288 </table> 289 290 <h1>' . plog_tr("Front-End Options") .'</h1>291 292 <table class="option-table" >293 <tr> 294 <td class="left"><label for="date_format">' . plog_tr('Date Format:') . '</label></td>236 $output .= "\n\t\t\t\t\t\t\t" . '<select style="width: 145px;" id="default_sortby" name="default_sortby">'; 237 foreach($sort_by_fields as $sort_key => $sort_caption) { 238 $selected = ($config['default_sortby'] == $sort_key) ? 'selected="selected" ': ''; 239 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>'; 240 } 241 $output .= "\n\t\t\t\t\t\t\t" . '</select>'; 242 $output .= "\n\t\t\t\t\t\t\t" . '<select id="default_sortdir" name="default_sortdir">'; 243 foreach($sort_dir_fields as $sort_key => $sort_caption) { 244 $selected = ($config['default_sortdir'] == $sort_key) ? 'selected="selected" ': ''; 245 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>'; 246 } 247 $output .= "\n\t\t\t\t\t\t\t" . '</select>'; 248 $output .= "\n\t\t\t\t\t\t" . '</td> 249 </tr> 250 <tr> 251 <td class="left"><label for="album_sortby">'.plog_tr('Album Sort Order').':</label></td> 252 <td class="right">'; 253 $output .= "\n\t\t\t\t\t\t\t" . '<select style="width: 145px;" id="album_sortby" name="album_sortby">'; 254 foreach($sort_by_fields_collection as $sort_key => $sort_caption) { 255 $selected = ($config['album_sortby'] == $sort_key) ? 'selected="selected" ': ''; 256 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>'; 257 } 258 $output .= "\n\t\t\t\t\t\t\t" . '</select>'; 259 $output .= "\n\t\t\t\t\t\t\t" . '<select id="album_sortdir" name="album_sortdir">'; 260 foreach($sort_dir_fields as $sort_key => $sort_caption) { 261 $selected = ($config['album_sortdir'] == $sort_key) ? 'selected="selected" ': ''; 262 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>'; 263 } 264 $output .= "\n\t\t\t\t\t\t\t" . '</select>'; 265 $output .= "\n\t\t\t\t\t\t" . '</td> 266 </tr> 267 <tr class="alt"> 268 <td class="left"><label for="collection_sortby">'.plog_tr('Collection Sort Order').':</label></td> 269 <td class="right">'; 270 $output .= "\n\t\t\t\t\t\t\t" . '<select style="width: 145px;" id="collection_sortby" name="collection_sortby">'; 271 foreach($sort_by_fields_collection as $sort_key => $sort_caption) { 272 $selected = ($config['collection_sortby'] == $sort_key) ? 'selected="selected" ': ''; 273 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>'; 274 } 275 $output .= "\n\t\t\t\t\t\t\t" . '</select>'; 276 $output .= "\n\t\t\t\t\t\t\t" . '<select id="collection_sortdir" name="collection_sortdir">'; 277 foreach($sort_dir_fields as $sort_key => $sort_caption) { 278 $selected = ($config['collection_sortdir'] == $sort_key) ? 'selected="selected" ': ''; 279 $output .= "\n\t\t\t\t\t\t\t\t" . '<option '.$selected.'value="'.$sort_key.'">'.$sort_caption.'</option>'; 280 } 281 $output .= "\n\t\t\t\t\t\t\t" . '</select>'; 282 $output .= "\n\t\t\t\t\t\t" . '</td> 283 </tr> 284 </table> 285 286 <h1>'.plog_tr('Front-End Options').'</h1> 287 288 <table class="option-table" cellspacing="0"> 289 <tr> 290 <td class="left"><label for="date_format">'.plog_tr('Date Format').':</label></td> 295 291 <td class="right"> 296 292 <select id="date_format" name="date_format">'; 297 foreach ($date_formats as $format) {293 foreach ($date_formats as $format) { 298 294 $output .= "\n\t\t\t\t\t\t\t\t" . '<option value="'.$format.'"'; 299 if ($config[ "date_format"] == $format) $output .= ' selected="selected"';295 if ($config['date_format'] == $format) $output .= ' selected="selected"'; 300 296 $output .= '>'.translate_date(date($format)).'</option>'; 301 297 } … … 304 300 </tr> 305 301 <tr class="alt"> 306 <td class="left"><label for="allow_dl" style="white-space: nowrap;">' . plog_tr('Allow Compressed Downloads:') . '</label></td>307 <td class="right">'; 308 if ($config['allow_dl'] == 1) $checked = "checked='checked'"; else $checked = "";302 <td class="left"><label for="allow_dl" style="white-space: nowrap;">'.plog_tr('Allow Compressed Downloads').':</label></td> 303 <td class="right">'; 304 if ($config['allow_dl'] == 1) $checked = 'checked="checked"'; else $checked = ''; 309 305 $output .= '<input type="checkbox" id="allow_dl" name="allow_dl" value="1" '.$checked.' /></td> 310 306 </tr> 311 307 <tr> 312 <td class="left"><label for="allow_print">' . plog_tr('Allow Auto Print:') . '</label></td>313 <td class="right">'; 314 if ($config['allow_print'] == 1) $checked = "checked='checked'"; else $checked = "";308 <td class="left"><label for="allow_print">'.plog_tr('Allow Auto Print').':</label></td> 309 <td class="right">'; 310 if ($config['allow_print'] == 1) $checked = 'checked="checked"'; else $checked = ''; 315 311 $output .= '<input type="checkbox" id="allow_print" name="allow_print" value="1" '.$checked.' /></td> 316 312 </tr> 317 313 <tr class="alt"> 318 <td class="left"><label for="use_mod_rewrite">' . plog_tr('Generate Cruft-Free URLs:') . '</label><br />' . plog_tr('(requires mod_rewrite)') .'</td>319 <td class="right">'; 320 $htaccess_file = $config[ "basedir"] . ".htaccess";321 if ($config['use_mod_rewrite'] == 1) $checked = "checked='checked'"; else $checked = "";314 <td class="left"><label for="use_mod_rewrite">'.plog_tr('Generate Cruft-Free URLs').':</label><br />'.plog_tr('(requires mod_rewrite)').'</td> 315 <td class="right">'; 316 $htaccess_file = $config['basedir'].'.htaccess'; 317 if ($config['use_mod_rewrite'] == 1) $checked = 'checked="checked"'; else $checked = ''; 322 318 if (is_writable($htaccess_file)) { 323 319 $output .= '<input type="checkbox" id="use_mod_rewrite" name="use_mod_rewrite" value="1" '.$checked.' />'; 324 320 } else { 325 $output .= plog_tr( ".htaccess is not writable, please check permissions");326 } ;321 $output .= plog_tr('.htaccess is not writable, please check permissions'); 322 } 327 323 $output .= '</td> 328 324 </tr> 329 325 </table> 330 326 331 <h1>' . plog_tr("Images") .'</h1>332 333 <table class="option-table" >334 <tr> 335 <td class="left"><label for="image_quality">' . plog_tr('JPEG Image Quality:') . '</label><br />' . plog_tr("(1=worst, 95=best, 75=default)") .'</td>327 <h1>'.plog_tr('Images').'</h1> 328 329 <table class="option-table" cellspacing="0"> 330 <tr> 331 <td class="left"><label for="image_quality">'.plog_tr('JPEG Image Quality').':</label><br />'.plog_tr('(1=worst, 95=best, 75=default)').'</td> 336 332 <td class="right"><input size="5" type="text" id="image_quality" name="image_quality" value="'.$config['compression'].'" /></td> 337 333 </tr> 338 334 <tr class="alt"> 339 <td class="left"><label for="allow_fullpic">' . plog_tr('Allow Full Picture Access:') . '</label><br />' . plog_tr("(must be enabled if intermediate thumbnails are disabled)") .'</td>340 <td class="right">'; 341 if (!empty($config['allow_fullpic'])) $checked = "checked='checked'"; else $checked = "";335 <td class="left"><label for="allow_fullpic">'.plog_tr('Allow Full Image Access').':</label><br />'.plog_tr('(must be enabled if intermediate images are disabled)').'</td> 336 <td class="right">'; 337 if (!empty($config['allow_fullpic'])) $checked = 'checked="checked"'; else $checked = ''; 342 338 $output .= '<input type="checkbox" id="allow_fullpic" name="allow_fullpic" value="1" '.$checked.' /></td> 343 339 </tr> 344 340 <tr> 345 <td class="left"><label for="truncate">' . plog_tr('Truncate Long Filenames - Length:') . '</label><br />' . plog_tr('(use zero for no truncation)') .'</td>341 <td class="left"><label for="truncate">'.plog_tr('Truncate Long Filenames - Length').':</label><br />'.plog_tr('(use zero for no truncation)').'</td> 346 342 <td class="right"><input size="5" type="text" id="truncate" name="truncate" value="'.$config['truncate'].'" /></td> 347 343 </tr> 348 344 </table> 349 345 350 <h1>' . plog_tr("Small Thumbnails") .'</h1>351 352 <table class="option-table" >';353 if ($config['square_thumbs']) $dim = plog_tr( "Small Thumbnail Width:"); else $dim = plog_tr("Small Thumbnail Height:");346 <h1>'.plog_tr('Small Thumbnails').'</h1> 347 348 <table class="option-table" cellspacing="0">'; 349 if ($config['square_thumbs']) $dim = plog_tr('Small Thumbnail Width'); else $dim = plog_tr('Small Thumbnail Height'); 354 350 $output.=' 355 351 <tr class="alt"> 356 <td class="left"><label for="max_thumbnail_size">'.$dim.' </label><br />' . plog_tr("(pixels)").'</td>352 <td class="left"><label for="max_thumbnail_size">'.$dim.':</label><br />'.plog_tr('(pixels)').'</td> 357 353 <td class="right"><input size="5" type="text" id="max_thumbnail_size" name="max_thumbnail_size" value="'.$thumbnail_config[THUMB_SMALL]['size'].'" /></td> 358 354 </tr> 359 355 <tr> 360 <td class="left"><label for="square_thumbs">' . plog_tr('Use Cropped Square Thumbnails:') .'</label></td>361 <td class="right">'; 362 if ($config['square_thumbs'] == 1) $checked = "checked='checked'"; else $checked = "";356 <td class="left"><label for="square_thumbs">'.plog_tr('Use Cropped Square Thumbnails').':</label></td> 357 <td class="right">'; 358 if ($config['square_thumbs'] == 1) $checked = 'checked="checked"'; else $checked = ''; 363 359 $output .= '<input type="checkbox" id="square_thumbs" name="square_thumbs" value="1" '.$checked.' /></td> 364 360 </tr> 365 361 <tr class="alt"> 366 <td class="left"><label for="thumb_num">' . plog_tr('Number of Thumbnails Per Page:') . '</label></td>362 <td class="left"><label for="thumb_num">'.plog_tr('Number of Thumbnails Per Page').':</label></td> 367 363 <td class="right"><input size="5" type="text" id="thumb_num" name="thumb_num" value="'.$config['thumb_num'].'" /></td> 368 364 </tr> 369 365 <tr> 370 <td class="left"><label for="enable_thumb_nav">' . plog_tr('Thumbnail Navigation Enabled:') . '</label></td>371 <td class="right">'; 372 if (!empty($config['enable_thumb_nav'])) $checked = "checked='checked'"; else $checked = "";366 <td class="left"><label for="enable_thumb_nav">'.plog_tr('Thumbnail Navigation Enabled').':</label></td> 367 <td class="right">'; 368 if (!empty($config['enable_thumb_nav'])) $checked = 'checked="checked"'; else $checked = ''; 373 369 $output .= '<input type="checkbox" id="enable_thumb_nav" name="enable_thumb_nav" value="1" '.$checked.' /></td> 374 370 </tr> 375 371 <tr class="alt"> 376 <td class="left"><label for="thumb_nav_range">' . plog_tr('Thumbnail Navigation Range:') . '</label><br />' . plog_tr('(0 for whole album)') .'</td>372 <td class="left"><label for="thumb_nav_range">'.plog_tr('Thumbnail Navigation Range').':</label><br />'.plog_tr('(0 for whole album)').'</td> 377 373 <td class="right"><input size="5" type="text" id="thumb_nav_range" name="thumb_nav_range" value="'.$config['thumb_nav_range'].'" /></td> 378 374 </tr> 379 375 <tr> 380 <td class="left"><label for="nav_thumbsize">' . plog_tr('Thumbnail Navigation Size:') . '</label></td>376 <td class="left"><label for="nav_thumbsize">'.plog_tr('Thumbnail Navigation Size').':</label></td> 381 377 <td class="right"><input size="5" type="text" id="nav_thumbsize" name="nav_thumbsize" value="'.$thumbnail_config[THUMB_NAV]['size'].'" /></td> 382 378 </tr> 383 379 </table> 384 380 385 <h1>' . plog_tr("Intermediate Thumbnails") .'</h1>386 387 <table class="option-table" >388 <tr class="alt"> 389 <td class="left"><label for="generate_intermediate">' . plog_tr('Generate Intermediate Pictures:') . '</label></td>381 <h1>'.plog_tr('Intermediate Thumbnails').'</h1> 382 383 <table class="option-table" cellspacing="0"> 384 <tr class="alt"> 385 <td class="left"><label for="generate_intermediate">'.plog_tr('Generate Intermediate Images').':</label></td> 390 386 <td class="right">'; 391 387 $generate_intermediate = ($thumbnail_config[THUMB_LARGE]['disabled'] == 0) ? "checked='checked'" : ""; … … 393 389 </tr> 394 390 <tr> 395 <td class="left"><label for="max_display_size">' . plog_tr('Intermediate Picture Width:') . '</label><br />' . plog_tr("(pixels)").'</td>391 <td class="left"><label for="max_display_size">'.plog_tr('Intermediate Image Width').':</label><br />'.plog_tr('(pixels)').'</td> 396 392 <td class="right"><input size="5" type="text" id="max_display_size" name="max_display_size" value="'.$thumbnail_config[THUMB_LARGE]['size'].'" /></td> 397 393 </tr> 398 394 </table> 399 395 400 <h1>' . plog_tr("RSS Syndication Options") .'</h1>401 402 <table class="option-table" >403 <tr class="alt"> 404 <td class="left"><label for="feed_title">' . plog_tr('RSS Feed Title:') . '</label></td>396 <h1>'.plog_tr('RSS Syndication Options').'</h1> 397 398 <table class="option-table" cellspacing="0"> 399 <tr class="alt"> 400 <td class="left"><label for="feed_title">'.plog_tr('RSS Feed Title').':</label></td> 405 401 <td class="right"><input size="40" type="text" id="feed_title" name="feed_title" value="'.stripslashes($config['feed_title']).'" /></td> 406 402 </tr> 407 403 <tr> 408 <td class="left"><label for="rss_thumbsize">' . plog_tr('RSS Image Thumbnail Width:') . '</label><br />' . plog_tr("(pixels)").'</td>409 <td class="right"><input size="5" type="text" id="rss_thumbsize" name="rss_thumbsize" value="'.$thumbnail_config[THUMB_RSS][ "size"].'" /></td>410 </tr> 411 <tr class="alt"> 412 <td class="left"><label for="feed_num_entries">' . plog_tr('Number of Images Per Feed:') . '</label></td>404 <td class="left"><label for="rss_thumbsize">'.plog_tr('RSS Image Thumbnail Width').':</label><br />'.plog_tr('(pixels)').'</td> 405 <td class="right"><input size="5" type="text" id="rss_thumbsize" name="rss_thumbsize" value="'.$thumbnail_config[THUMB_RSS]['size'].'" /></td> 406 </tr> 407 <tr class="alt"> 408 <td class="left"><label for="feed_num_entries">'.plog_tr('Number of Images Per Feed').':</label></td> 413 409 <td class="right"><input size="5" type="text" id="feed_num_entries" name="feed_num_entries" value="'.$config['feed_num_entries'].'" /></td> 414 410 </tr> 415 411 <tr> 416 412 <td class="left"></td> 417 <td class="right"><input class="submit" type="submit" name="submit" value="' . plog_tr('Update Options') .'" /></td>413 <td class="right"><input class="submit" type="submit" name="submit" value="'.plog_tr('Update Options').'" /></td> 418 414 </tr> 419 415 </table> … … 422 418 </form>' . "\n"; 423 419 424 display($output, "options");420 display($output, 'options'); 425 421 426 422 ?> -
trunk/plog-admin/plog-rpc.php
r585 r590 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 3 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");4 require(PLOGGER_DIR. "plog-admin/plog-admin.php");5 require_once(PLOGGER_DIR. "plog-admin/plog-admin-functions.php");3 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 4 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 5 require_once(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 6 6 7 7 $output = ''; … … 9 9 $action_result = array(); 10 10 11 if ($_POST['action'] == "update") {11 if ($_POST['action'] == 'update') { 12 12 13 13 // What field are we updating? … … 19 19 20 20 // Now we parse the field to be updated and the id number from the field variable 21 $var = split( "-", $field);21 $var = split('-', $field); 22 22 $type = $var[0]; 23 23 $field = $var[1]; 24 24 $id = $var[2]; 25 25 26 //print "debug: field = " . $field . ", content = " . $content . ", id = " .$id;26 //print "debug: field = ".$field.", content = ".$content.", id = ".$id; 27 27 28 if ($type == "picture") {28 if ($type == 'picture') { 29 29 $result = update_picture_field($id, $field, $content); 30 30 if ($result['output']) { … … 32 32 $content = ' '; 33 33 } 34 printstripslashes($content);34 echo stripslashes($content); 35 35 } else { 36 print "error: " .$result['errors'];37 } ;36 echo plog_tr('Error').": ".$result['errors']; 37 } 38 38 } 39 elseif ($type == "album") {39 elseif ($type == 'album') { 40 40 $result = update_album_field($id, $field, $content); 41 41 if ($result['output']) { … … 43 43 $content = ' '; 44 44 } 45 printstripslashes($content);45 echo stripslashes($content); 46 46 } else { 47 print "error: " .$result['errors'];48 } ;47 echo plog_tr('Error').": ".$result['errors']; 48 } 49 49 } 50 elseif ($type == "collection") {50 elseif ($type == 'collection') { 51 51 $result = update_collection_field($id, $field, $content); 52 52 if ($result['output']) { … … 54 54 $content = ' '; 55 55 } 56 printstripslashes($content);56 echo stripslashes($content); 57 57 } else { 58 print "error: " .$result['errors'];59 } ;58 echo plog_tr('Error').": ".$result['errors']; 59 } 60 60 } 61 elseif ($type == "comment") {61 elseif ($type == 'comment') { 62 62 $result = update_comment_field($id, $field, $content); 63 63 if ($result['output']) { … … 65 65 $content = ' '; 66 66 } 67 printstripslashes($content);67 echo stripslashes($content); 68 68 } else { 69 print "error: " .$result['errors'];70 } ;69 echo plog_tr('Error').": ".$result['errors']; 70 } 71 71 } 72 72 } 73 73 74 if ($_POST['action'] == "add-collection") {75 $action_result = add_collection($_POST[ "name"],$_POST["description"]);74 if ($_POST['action'] == 'add-collection') { 75 $action_result = add_collection($_POST['name'], $_POST['description']); 76 76 if (empty($action_result['errors'])) { 77 77 $output .= "<script type='text/javascript'>Element.show('add_item_link');Element.hide('add_item_form');Form.reset('add_form');</script>"; 78 } ;79 } ;78 } 79 } 80 80 81 if ($_POST['action'] == "list-collections") {82 $output .= plog_collection_manager($_POST[ "page"],$_SESSION['entries_per_page']);83 } ;81 if ($_POST['action'] == 'list-collections') { 82 $output .= plog_collection_manager($_POST['page'], $_SESSION['entries_per_page']); 83 } 84 84 85 85 if (!empty($action_result['errors'])) { 86 $output .= "\n\t" . '<p class="errors" id="rpc_message">' . $action_result['errors'] .'</p>' . "\n";86 $output .= "\n\t" . '<p class="errors" id="rpc_message">'.$action_result['errors'].'</p>' . "\n"; 87 87 } elseif (!empty($action_result['output'])) { 88 $output .= "\n\t" . '<p class="actions" id="rpc_message">' . $action_result['output'] . '</p>' . "\n"; 89 }; 90 91 print $output; 88 $output .= "\n\t" . '<p class="actions" id="rpc_message">'.$action_result['output'].'</p>' . "\n"; 89 } 90 close_db(); 91 close_ftp(); 92 echo $output; 92 93 93 94 ?> -
trunk/plog-admin/plog-themes.php
r588 r590 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 3 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");4 require(PLOGGER_DIR. "plog-admin/plog-admin.php");3 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 4 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 5 5 6 global $ inHead, $config, $thumbnail_config;6 global $config, $thumbnail_config; 7 7 8 function read_dir($path){ 9 10 static $dir_arr = array () ; 11 8 function read_dir($path) { 9 static $dir_arr = array (); 12 10 $handle = opendir($path); 13 11 14 12 while ($file = readdir($handle)) { 15 if (is_dir($path.$file) && substr($file, 0,1) != '.') {16 $dir_arr[] = $path . $file . "/";17 } ;13 if (is_dir($path.$file) && substr($file, 0, 1) != '.') { 14 $dir_arr[] = $path.$file.'/' ; 15 } 18 16 } 19 17 20 return $dir_arr ;18 return $dir_arr; 21 19 22 20 } 23 21 24 $output = "\n\t<h1>" . plog_tr("Manage Themes") . "</h1>"; 22 function check_theme_token($theme) { 23 global $config; 24 $content = ''; 25 25 26 // what is this? 27 //$output.= "<p>$theme_url</p>"; 26 $comment_file = $config['basedir'].'plog-content/themes/'.$theme.'/comments.php'; 27 $content = implode('', file($comment_file)); 28 if (strpos($content, 'plogger_get_form_token') === false) { 29 return false; 30 } 31 return true; 32 } 28 33 29 $theme_dir = $config['basedir'] . 'plog-content/themes/'; 34 $output = "\n\t" . '<h1>'.plog_tr('Manage Themes').'</h1>'; 35 36 $theme_dir = $config['basedir'].'plog-content/themes/'; 30 37 31 38 // scan list of folders within theme directory 32 39 $theme_list = read_dir($theme_dir); 40 sort($theme_list); 33 41 34 42 // activate new theme by setting configuration dir 35 43 if (isset($_REQUEST['activate'])) { 36 44 // insert into database 37 $new_theme_dir = basename($_REQUEST["activate"]); 38 $metafile = $config['basedir'] . 'plog-content/themes/' . $new_theme_dir . '/meta.php'; 45 $new_theme_dir = basename($_REQUEST['activate']); 46 $metafile = $config['basedir'].'plog-content/themes/'.$new_theme_dir.'/meta.php'; 47 39 48 if (file_exists($metafile)) { 40 49 include($metafile); 41 $sql = 'UPDATE '. TABLE_PREFIX.'config SET `theme_dir` = \''.$new_theme_dir.'\'';42 $name = $theme_name . ' ' .$version;50 $sql = 'UPDATE '.PLOGGER_TABLE_PREFIX.'config SET `theme_dir` = \''.$new_theme_dir.'\''; 51 $name = $theme_name.' '.$version; 43 52 if (mysql_query($sql)) { 44 $output .= "\n\n\t\t" . '<p class=" actions">' . sprintf(plog_tr("Activated New Theme <strong>%s</strong>"),$name).'</p>';53 $output .= "\n\n\t\t" . '<p class="success">'.sprintf(plog_tr('Activated new theme %s'), '<strong>'.$name.'</strong>').'</p>'; 45 54 } else { 46 $output .= "\n\n\t\t" . '<p class="errors">' . plog_tr("Error Activating Theme!") . '</p>';55 $output .= "\n\n\t\t" . '<p class="errors">'.plog_tr('Error activating theme').'!</p>'; 47 56 } 48 57 49 58 // update config variable if page doesn't refresh 50 $config[ "theme_dir"] = $new_theme_dir;59 $config['theme_dir'] = $new_theme_dir; 51 60 } else { 52 $output .= "\n\n\t\t" . '<p class="errors">' . plog_tr("No such theme") .'</p>';61 $output .= "\n\n\t\t" . '<p class="errors">'.plog_tr('No such theme').'</p>'; 53 62 } 54 63 } 55 64 65 $output .= "\n\n\t\t" . '<div class="info"> 66 67 <p class="no-margin-top">'.plog_tr('Themes allow you to change the appearance of your Plogger gallery. New themes should be uploaded to the <span style="color: #800; font-weight: bold;">/plog-content/themes/</span> directory.').'</p> 68 69 <p class="no-margin-bottom">'.plog_tr('To switch to a different theme, click the <span style="color: #800; font-weight: bold;">Activate</span> link in the <strong>Status</strong> column. You will need to reload your gallery page to see the changes.').'</p> 70 71 </div><!-- /info-->'; 72 56 73 // Output table header 57 $output .= "\n\n\t\t" . '<table id="theme-table" cellpadding=" 1" width="100%">74 $output .= "\n\n\t\t" . '<table id="theme-table" cellpadding="3" cellspacing="0" width="100%"> 58 75 <tr class="header"> 59 <th class="table-header-left ">' . plog_tr("Preview") .'</th>60 <th class="table-header-middle ">' . plog_tr("Theme") .'</th>61 <th class="table-header-middle ">' . plog_tr("Description") .'</th>62 <th class="table-header-middle ">' . plog_tr("Author") .'</th>63 <th class="table-header-right ">' . plog_tr("Status") .'</th>64 </tr>' . "\n";76 <th class="table-header-left align-center width-175">'.plog_tr('Preview').'</th> 77 <th class="table-header-middle align-left width-100">'.plog_tr('Theme').'</th> 78 <th class="table-header-middle align-left">'.plog_tr('Description').'</th> 79 <th class="table-header-middle align-left width-100">'.plog_tr('Author').'</th> 80 <th class="table-header-right align-left width-100">'.plog_tr('Status').'</th> 81 </tr>'; 65 82 $counter = 0; 66 83 67 84 foreach($theme_list as $theme_folder_name) { 68 $meta_file = $theme_folder_name . "meta.php";85 $meta_file = $theme_folder_name.'meta.php'; 69 86 70 87 $theme_folder_basename = basename($theme_folder_name); … … 72 89 // only display theme as available if meta information exists for it 73 90 if (is_file($meta_file)) { 74 75 91 // pull in meta information 76 92 include($meta_file); 77 93 78 if ($counter%2 == 0) $table_row_color = "color-1"; 79 else $table_row_color = "color-2"; 94 if ($counter%2 == 0) { 95 $table_row_color = 'color-1'; 96 } else { 97 $table_row_color = 'color-2'; 98 } 80 99 81 100 // generate small preview thumb, update thumb if preview.png has been updated 82 $timestamp = @filemtime($theme_dir . $theme_folder_basename . "/preview.png");101 $timestamp = @filemtime($theme_dir.$theme_folder_basename.'/preview.png'); 83 102 $thumbnail_config[THUMB_THEME]['timestamp'] = $timestamp; 84 $preview_thumb = generate_thumb($theme_folder_name . "preview.png", $theme_name, THUMB_THEME);103 $preview_thumb = generate_thumb($theme_folder_name.'preview.png', $theme_name, THUMB_THEME); 85 104 86 105 // generate large Lightbox preview thumb, update thumb if preview.png has been updated 87 106 $thumbnail_config[THUMB_LARGE]['timestamp'] = $timestamp; 88 107 $thumbnail_config[THUMB_LARGE]['disabled'] = 0; 89 $preview_thumb_large = generate_thumb($theme_folder_name . "preview.png", $theme_name, THUMB_LARGE);108 $preview_thumb_large = generate_thumb($theme_folder_name.'preview.png', $theme_name, THUMB_LARGE); 90 109 91 110 // start a new table row (alternating colors) 92 if ($config["theme_dir"] == $theme_folder_basename) 93 $output .= "\t\t\t<tr class=\"activated\">\n"; 94 else 95 $output .= "\t\t\t<tr class=\"$table_row_color\">\n"; 111 if ($config['theme_dir'] == $theme_folder_basename) { 112 $table_class = 'activated'; 113 } else { 114 $table_class = $table_row_color; 115 } 116 $output .= "\n\t\t\t" . '<tr class="'.$table_class.'">'; 96 117 97 $output .= "\ t\t\t\t<td>";118 $output .= "\n\t\t\t\t" . '<td class="width-175">'; 98 119 99 if ($preview_thumb) 100 $output .= "<div class=\"img-shadow\"><a rel=\"lightbox\" href=\"$preview_thumb_large\"><img src=\"$preview_thumb\" alt=\"$theme_name\" /></a></div>"; 120 if ($preview_thumb) { 121 $output .= '<div class="img-shadow"><a rel="lightbox" href="'.$preview_thumb_large.'"><img src="'.$preview_thumb.'" alt="'.$theme_name.'" /></a></div>'; 122 } 101 123 102 $output .= "</td>103 <td ><strong>$theme_name</strong><br /> Version $version</td>104 <td >$description</td>105 <td ><a href=\"$url\">$author</a></td>\n";124 $output .= '</td> 125 <td class="align-left width-100"><strong>'.$theme_name.'</strong><br />Version '.$version.'</td> 126 <td style="padding-right: 50px;">'.$description.'<br />• '.plog_tr('Released under the').' '.$license.'.</td> 127 <td class="align-left width-100"><a href="'.$url.'">'.$author.'</a></td>'; 106 128 107 if ($config["theme_dir"] == $theme_folder_basename) 108 $output .= "\t\t\t\t<td>" .plog_tr("Active Theme") . "</td>\n"; 109 else 110 $output .= "\t\t\t\t<td><a href=\"${_SERVER['PHP_SELF']}?activate=$theme_folder_basename\">" . plog_tr('Activate') . "</a></td>\n"; 129 if ($config['theme_dir'] == $theme_folder_basename) { 130 $output .= "\n\t\t\t\t" . '<td class="active width-100">'.plog_tr('Current').'</td>'; 131 } else { 132 $output .= "\n\t\t\t\t" . '<td class="width-100"><a href="'.$config['gallery_url'].'plog-admin/plog-themes.php?activate='.$theme_folder_basename.'">'.plog_tr('Activate').'</a></td>'; 133 } 111 134 112 $output .= "\t\t\t</tr>\n"; 135 $output .= "\n\t\t\t" . '</tr>'; 136 137 if (!check_theme_token($theme_folder_basename)) { 138 $output .= "\n\t\t\t" . '<tr class="'.$table_class.'" id="'.$theme_folder_basename.'-error"> 139 <td class="align-left" colspan="5"> 140 <div class="errors"> 141 <p class="no-margin-top no-margin-bottom">'.sprintf(plog_tr('The spam token could not be found in this theme. Please include the code %s between the opening %s tag and the closing %s tag in the theme file %s'), ' <span style="color: #264e75; font-weight: bold;"><?php plogger_get_spam_token(); ?></span>', '<form>', '</form>', '<strong>'.'plog-content/themes/'.$theme_folder_basename.'/comments.php</strong>').'</p> 142 </div> 143 </td> 144 </tr>'; 145 } 113 146 114 147 $counter++; … … 117 150 } 118 151 119 $output .= "\ t\t\t<tr class=\"footer\">120 <td colspan= \"5\" style=\"padding: 6px;\"></td>152 $output .= "\n\t\t\t" . '<tr class="footer"> 153 <td colspan="5" style="padding: 1px;"> </td> 121 154 </tr> 122 </table> \n";155 </table>' . "\n"; 123 156 124 display($output, "themes");157 display($output, 'themes'); 125 158 126 159 ?> -
trunk/plog-admin/plog-thumb.php
r570 r590 3 3 // first it will be used for import only. 4 4 5 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 6 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 7 require_once(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 8 9 // set up the default error message 10 $found = plog_tr('No such image'); 11 5 12 if (empty($_GET['img'])) { 6 return "No such image";13 exit($found); 7 14 } 8 15 9 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 10 require_once(dirname(dirname(__FILE__))."/plog-load-config.php"); 11 require_once(PLOGGER_DIR."plog-admin/plog-admin-functions.php"); 16 $files = get_files(PLOGGER_DIR.'plog-content/uploads'); 12 17 13 $files = get_files($config['basedir'] . "plog-content/uploads"); 14 15 $found = false; 16 17 $up_dir = $config['basedir'] . "plog-content/uploads"; 18 $up_dir = PLOGGER_DIR.'plog-content/uploads'; 18 19 19 20 foreach($files as $file) { 20 21 if (md5($file) == $_GET['img']) { 21 $found = true; 22 $rname = substr($file,strlen($up_dir)+1); 22 $rname = substr($file, strlen($up_dir)+1); 23 23 24 $thumbpath = generate_thumb($up_dir.'/'.$rname, "import-".substr(md5($file),0,2),THUMB_SMALL);25 print'<img src="'.$thumbpath.'" alt="" /></div>';26 // print"found $relative_name!";24 $thumbpath = generate_thumb($up_dir.'/'.$rname, 'import-'.substr(md5($file), 0, 2),THUMB_SMALL); 25 $found = '<img src="'.$thumbpath.'" alt="" /></div>'; 26 //echo "found $relative_name!"; 27 27 break; 28 28 } 29 29 } 30 close_db(); 31 close_ftp(); 32 echo $found; 30 33 31 34 ?> -
trunk/plog-admin/plog-thumbpopup.php
r585 r590 1 1 <?php 2 2 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 3 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");4 require(PLOGGER_DIR. "plog-admin/plog-admin.php");5 require_once(PLOGGER_DIR. "plog-admin/plog-admin-functions.php");3 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 4 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 5 require_once(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 6 6 7 7 // this script will just show a small preview of the thumbnail in admin view if … … 17 17 $src = $_REQUEST['src']; 18 18 $picture = get_picture_by_id($src); 19 $id = $picture[ "id"];20 $thumbpath = generate_thumb($picture[ "path"],$picture["id"],THUMB_LARGE);21 $thumbdir = $config[ "basedir"] . "plog-content/thumbs/lrg-$id-".basename($picture["path"]);19 $id = $picture['id']; 20 $thumbpath = generate_thumb($picture['path'], $picture['id'], THUMB_LARGE); 21 $thumbdir = $config['basedir'].'plog-content/thumbs/lrg-$id-'.basename($picture['path']); 22 22 list($width, $height, $type, $attr) = getimagesize($thumbdir); 23 23 -
trunk/plog-admin/plog-upload.php
r588 r590 1 1 <?php 2 // Code by Mike Johnson -- mike@solanosystems.com October 23rd, 2004. 3 // This is the main administrative interface code. To change the look of the interface, change /plog-admin/css/admin.css. 4 5 // The initial tab is UPLOAD function. 2 /* Code by Mike Johnson -- mike@solanosystems.com October 23rd, 2004. 3 This is the main administrative interface code. To change the look of the interface, change /plog-admin/css/admin.css. 4 The initial tab is UPLOAD function. */ 6 5 7 6 // load configuration variables from database, plog-globals, & plog-includes/plog-functions 8 require_once(dirname(dirname(__FILE__)). "/plog-load-config.php");9 require(PLOGGER_DIR. "plog-admin/plog-admin.php");7 require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 8 require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 10 9 11 10 function generate_albums_menu($albums) { 12 $albums_menu = isset($_REQUEST['albums_menu']) ? $_REQUEST['albums_menu'] : '';13 $new_album_name = isset($_REQUEST['new_album_name']) ? $_REQUEST['new_album_name'] : '';14 $output = "\n\t\t\t\t\t\t<select name=\"albums_menu\" onclick=\"var k=document.getElementsByName('destination_radio');k[0].checked=true;\">";11 $albums_menu = isset($_REQUEST['albums_menu']) ? $_REQUEST['albums_menu'] : ''; 12 $new_album_name = isset($_REQUEST['new_album_name']) ? $_REQUEST['new_album_name'] : ''; 13 $output = '<select tabindex="50" style="width: 80%;" name="albums_menu" onclick="var k=document.getElementsByName(\'destination_radio\');k[0].checked=true;">'; 15 14 foreach($albums as $album_id => $album) { 16 15 17 16 if ($albums_menu == $album_id || $new_album_name == $album['album_name']) { 18 $selected = " selected='selected'";17 $selected = ' selected="selected"'; 19 18 } else { 20 $selected = "";19 $selected = ''; 21 20 } 22 21 23 $output .= "\n\t\t\t\t\t\t \t<option value=\"".$album_id."\"$selected>".SmartStripSlashes($album['collection_name']).": ".SmartStripSlashes($album['album_name'])."</option>";22 $output .= "\n\t\t\t\t\t\t" . '<option value="'.$album_id.'"'.$selected.'>'.SmartStripSlashes($album['collection_name']).': '.SmartStripSlashes($album['album_name']).'</option>'; 24 23 } 25 $output .= "\n\t\t\t\t\t \t</select>";24 $output .= "\n\t\t\t\t\t</select>"; 26 25 27 26 return $output; … … 30 29 function generate_collections_menu() { 31 30 $collections = get_collections(); 32 $output = "<select name=\"collections_menu\">";31 $output = '<select class="no-margin-top" tabindex="80" style="width: 80%;" name="collections_menu" id="collections_menu">'; 33 32 foreach($collections as $collection) { 34 $output .= "\n\t\t\t\t\t\t\t\t\t\t<option value=\"".$collection['id']."\">".SmartStripSlashes($collection['name'])."</option>"; 33 34 $output .= "\n\t\t\t\t\t\t" . '<option value="'.$collection['id'].'">'.SmartStripSlashes($collection['name']).'</option>'; 35 35 } 36 $output .= "\n\t\t\t\t\t \t\t\t\t</select>";36 $output .= "\n\t\t\t\t\t</select>"; 37 37 38 38 return $output; 39 39 } 40 40 41 $output = '';41 $output = "\n\t" . '<h1>'.plog_tr('Upload Images').'</h1>' . "\n"; 42 42 43 43 // Check if update has been clicked, handle erroneous conditions, or upload 44 if (isset($_REQUEST['upload'])) {44 if (isset($_REQUEST['upload'])) { 45 45 foreach($_REQUEST as $key => $val) $_REQUEST[$key] = stripslashes($val); 46 46 47 47 $pi = pathinfo($_FILES['userfile']['name']); 48 48 49 if ($_FILES["userfile"]["name"] == ""){ 50 $output .= "\n\t" . '<p class="errors">' . plog_tr("No file name specified!") . '</p>' . "\n"; 51 } else if (strtolower($pi["extension"]) == "zip") { 52 // let's decompress the zip file into the 'plog-content/uploads/' folder and then redirect 53 // the user to plog-import.php 54 55 include(PLOGGER_DIR . 'plog-includes/lib/pclzip-2-4/pclzip.lib.php'); 49 if ($_FILES['userfile']['name'] == '') { 50 $output .= "\n\t" . '<p class="errors">'.plog_tr('No filename specified').'!</p>' . "\n"; 51 } else if (strtolower($pi['extension']) == 'zip') { 52 // let's decompress the zip file into the 'plog-content/uploads/' folder and then redirect the user to plog-import.php 53 include(PLOGGER_DIR.'plog-includes/lib/pclzip-2-4/pclzip.lib.php'); 56 54 //zip file to extract 57 $archive = new PclZip($_FILES[ "userfile"]["tmp_name"]);55 $archive = new PclZip($_FILES['userfile']['tmp_name']); 58 56 59 57 //create a temporary folder in 'plog-content/uploads/' based on the .zip file name 60 $zipname = strtolower(sanitize_filename(substr($_FILES[ "userfile"]["name"], 0, -4)));61 $zipdir = $config[ "basedir"]."plog-content/uploads/".$zipname;58 $zipname = strtolower(sanitize_filename(substr($_FILES['userfile']['name'], 0, -4))); 59 $zipdir = $config['basedir'].'plog-content/uploads/'.$zipname; 62 60 $zipdirkey = md5($zipdir); 63 $zipresult = makeDirs($zipdir , 0777);61 $zipresult = makeDirs($zipdir); 64 62 65 63 //extract to 'plog-content/uploads/' folder 66 67 64 $results = $archive->extract(PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH, $zipdir); 68 65 69 if ($results == 0) {66 if ($results == 0) { 70 67 //failed 71 $output .= "\n\t" . '<p class="errors">' . plog_tr('Error: ') .$archive->errorInfo(true).'</p>' . "\n";68 $output .= "\n\t" . '<p class="errors">'.plog_tr('Error').': '.$archive->errorInfo(true).'</p>' . "\n"; 72 69 } else { 73 // unzip succeeded 74 // Doesn't necessarily mean that saving the images succeeded. 75 70 // unzip succeeded - doesn't necessarily mean that saving the images succeeded
