Changeset 590


Ignore:
Timestamp:
02/18/09 14:09:39 (3 years ago)
Author:
sidtheduck
Message:

Large commit based on work with Kim Parsell and myself
Should be ready for a release candidate after this commit.
Items worked on:

  • Large overhaul for code cleanup and syntax standardization
  • Security fixes for folder permissions on all server environments (now all directories should be set to 0755 and all files set to 0644)
  • Works compeletely with safe_mode restrictions using FTP commands
  • Beginnings of plugin usage (no architecture yet, but start of code standardization and addon code)
  • Fixing comments and adding security
  • More error messages
  • Minor fixes to upgrade and install process
  • Should fix tickets #188, #206, #194, #195, #197, #201, #203, #204, #89, #174, #200
  • Many other minor edits that I can't remember now (hopefully future commits will be much smaller and deal with individual issues, enhancements, or bugs)
Location:
trunk
Files:
22 added
6 deleted
84 edited
1 moved

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 
     4Copyright (C) 1989, 1991 
     5Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 
     6 
     7Everyone is permitted to copy and distribute verbatim copies of this license document, but 
     8changing it is not allowed. 
     9 
     10Preamble 
     11 
     12The licenses for most software are designed to take away your freedom to share and change it. 
     13By contrast, the GNU General Public License is intended to guarantee your freedom to share and 
     14change free software--to make sure the software is free for all its users. This General Public License 
     15applies to most of the Free Software Foundation's software and to any other program whose authors 
     16commit to using it. (Some other Free Software Foundation software is covered by the GNU Library 
     17General Public License instead.) You can apply it to your programs, too. 
     18 
     19When we speak of free software, we are referring to freedom, not price. Our General Public Licenses 
     20are designed to make sure that you have the freedom to distribute copies of free software (and charge 
     21for this service if you wish), that you receive source code or can get it if you want it, that you can 
     22change the software or use pieces of it in new free programs; and that you know you can do these 
     23things. 
     24 
     25To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to 
     26ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you 
    3127distribute copies of the software, or if you modify it. 
    3228 
    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. 
     29For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the 
     30recipients all the rights that you have. You must make sure that they, too, receive or can get the 
     31source code. And you must show them these terms so they know their rights. 
     32 
     33We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which 
     34gives you legal permission to copy, distribute and/or modify the software. 
     35 
     36Also, for each author's protection and ours, we want to make certain that everyone understands that 
     37there is no warranty for this free software. If the software is modified by someone else and passed on, 
     38we want its recipients to know that what they have is not the original, so that any problems introduced 
     39by others will not reflect on the original authors' reputations. 
     40 
     41Finally, any free program is threatened constantly by software patents. We wish to avoid the danger 
     42that redistributors of a free program will individually obtain patent licenses, in effect making the program 
     43proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free 
     44use or not licensed at all. 
     45 
     46The precise terms and conditions for copying, distribution and modification follow. 
     47 
     48GNU GENERAL PUBLIC LICENSE 
     49 
     50TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 
     51 
     520. This License applies to any program or other work which contains a notice placed by the copyright 
     53holder saying it may be distributed under the terms of this General Public License. The "Program", below, 
     54refers to any such program or work, and a "work based on the Program" means either the Program or 
     55any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, 
     56either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is 
     57included without limitation in the term "modification".) Each licensee is addressed as "you". 
     58 
     59Activities other than copying, distribution and modification are not covered by this License; they are 
     60outside its scope. The act of running the Program is not restricted, and the output from the Program 
     61is covered only if its contents constitute a work based on the Program (independent of having been 
     62made by running the Program). Whether that is true depends on what the Program does. 
     63 
     641. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any 
     65medium, provided that you conspicuously and appropriately publish on each copy an appropriate copy- 
     66right notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the 
     67absence of any warranty; and give any other recipients of the Program a copy of this License along with 
     68the Program. 
    5869 
    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.) 
     70You may charge a fee for the physical act of transferring a copy, and you may at your option offer 
     71warranty protection in exchange for a fee. 
     72 
     732. You may modify your copy or copies of the Program or any portion of it, thus forming a work based 
     74on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, 
     75provided 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 
     92These requirements apply to the modified work as a whole. If identifiable sections of that work are not 
     93derived from the Program, and can be reasonably considered independent and separate works in themselves, 
     94then this License, and its terms, do not apply to those sections when you distribute them as separate works. 
     95But when you distribute the same sections as part of a whole which is a work based on the Program, the 
     96distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to 
     97the entire whole, and thus to each and every part regardless of who wrote it. 
     98 
     99Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; 
     100rather, the intent is to exercise the right to control the distribution of derivative or collective works based on 
     101the Program. 
     102 
     103In addition, mere aggregation of another work not based on the Program with the Program (or with a work 
     104based on the Program) on a volume of a storage or distribution medium does not bring the other work under 
     105the scope of this License. 
     106 
     1073. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or 
     108executable 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 
     123The source code for a work means the preferred form of the work for making modifications to it. For an execu- 
     124table work, complete source code means all the source code for all modules it contains, plus any associated 
     125interface definition files, plus the scripts used to control compilation and installation of the executable. However, 
     126as a special exception, the source code distributed need not include anything that is normally distributed (in 
     127either source or binary form) with the major components (compiler, kernel, and so on) of the operating system 
     128on which the executable runs, unless that component itself accompanies the executable. 
     129 
     130If distribution of executable or object code is made by offering access to copy from a designated place, then 
     131offering equivalent access to copy the source code from the same place counts as distribution of the source 
     132code, even though third parties are not compelled to copy the source along with the object code. 
     133 
     1344. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this 
     135License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will auto- 
     136matically terminate your rights under this License. However, parties who have received copies, or rights, from 
     137you under this License will not have their licenses terminated so long as such parties remain in full compliance. 
    113138 
    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. 
     1395. You are not required to accept this License, since you have not signed it. However, nothing else grants 
     140you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law 
     141if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on 
     142the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for 
     143copying, distributing or modifying the Program or works based on it. 
     144 
     1456. Each time you redistribute the Program (or any work based on the Program), the recipient automatically 
     146receives a license from the original licensor to copy, distribute or modify the Program subject to these terms 
     147and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted 
     148herein. You are not responsible for enforcing compliance by third parties to this License. 
     149 
     1507. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not 
     151limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that 
     152contradict the conditions of this License, they do not excuse you from the conditions of this License. If you 
     153cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent 
     154obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license 
     155would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly 
     156through you, then the only way you could satisfy both it and this License would be to refrain entirely from 
     157distribution of the Program. 
     158 
     159If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance 
     160of the section is intended to apply and the section as a whole is intended to apply in other circumstances. 
     161 
     162It is not the purpose of this section to induce you to infringe any patents or other property right claims or to 
     163contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free 
     164software distribution system, which is implemented by public license practices. Many people have made generous 
     165contributions to the wide range of software distributed through that system in reliance on consistent application 
     166of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any 
     167other system and a licensee cannot impose that choice. 
     168 
     169This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this 
     170License. 
     171 
     1728. If the distribution and/or use of the Program is restricted in certain countries either by patents or by 
     173copyrighted interfaces, the original copyright holder who places the Program under this License may add an 
     174explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or 
     175among countries not thus excluded. In such case, this License incorporates the limitation as if written in the 
     176body of this License. 
     177 
     1789. The Free Software Foundation may publish revised and/or new versions of the General Public License from 
     179time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address 
     180new problems or concerns. 
     181 
     182Each version is given a distinguishing version number. If the Program specifies a version number of this License 
     183which applies to it and "any later version", you have the option of following the terms and conditions either of 
     184that version or of any later version published by the Free Software Foundation. If the Program does not specify 
     185a version number of this License, you may choose any version ever published by the Free Software Foundation. 
     186 
     18710. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are 
     188different, write to the author to ask for permission. For software which is copyrighted by the Free Software 
     189Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will 
     190be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting 
     191the sharing and reuse of software generally. 
     192 
     193NO WARRANTY 
     194 
     19511. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO 
     196THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 
     197HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     198EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
     199AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 
     200PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY 
     201SERVICING, REPAIR OR CORRECTION. 
    171202 
    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. 
     20312. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT 
     204HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, 
     205BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 
     206ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA 
     207OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE 
     208PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN 
     209ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 
     210 
     211END OF TERMS AND CONDITIONS 
  • trunk/gallery.php

    r588 r590  
    11<?php 
    22/* This is a backwords compatible file to make old installations work correctly */ 
    3 include_once(dirname(__FILE__)."/plogger.php"); 
     3include_once(dirname(__FILE__).'/plogger.php'); 
    44 
    55function the_gallery_head() { 
  • trunk/index.php

    r573 r590  
    1919 */ 
    2020?> 
    21 <?php require("plogger.php"); ?> 
     21<?php require('plogger.php'); ?> 
    2222<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    2323        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
  • trunk/plog-admin/_install.php

    r588 r590  
    11<?php 
     2if (is_file(dirname(dirname(__FILE__)).'/plog-config.php')) { 
     3        require_once(dirname(dirname(__FILE__)).'/plog-config.php'); 
     4} 
    25include_once(dirname(dirname(__FILE__)).'/plog-globals.php'); 
    3 @include_once(PLOGGER_DIR.'plog-config.php'); 
    46include_once(PLOGGER_DIR.'plog-includes/plog-functions.php'); 
    57include_once(PLOGGER_DIR.'plog-admin/includes/install-functions.php'); 
     
    1315        header('Content-type: application/octet-stream'); 
    1416        header('Content-Disposition: attachment; filename="plog-config.php"'); 
    15         print $_SESSION['plogger_config']; 
     17        echo $_SESSION['plogger_config']; 
    1618        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_values 
    26                 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 installs 
    29                 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 first 
    35                 header("Location: index.php?r=plog-options.php"); 
    36                 exit; 
    37         } else { 
    38                 echo "There was an error with the MySQL connection!"; 
    39         } 
    4019} 
    4120?> 
     
    4423<html xmlns="http://www.w3.org/1999/xhtml"> 
    4524<head> 
    46         <title>Install Plogger</title> 
     25        <title>Plogger <?php echo plog_tr('Gallery | Install') ?></title> 
    4726        <meta http-equiv="Content-Type" content="txt/html; charset=utf-8" /> 
    4827        <link rel="stylesheet" type="text/css" href="css/admin.css" /> 
     
    6039// if not installed, do the installation 
    6140if (!$installed) { 
     41        // if not told to proceed, do the configuration setup 
    6242        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                } 
    6695        } 
    6796} else { 
    68         echo $installed; 
     97        // otherwise it's installed 
     98        echo '<p>'.plog_tr('Plogger is already installed').'</p>'; 
    6999} 
     100close_db(); 
     101close_ftp(); 
    70102?> 
    71103 
  • trunk/plog-admin/_upgrade.php

    r588 r590  
    11<?php 
     2if (is_file(dirname(dirname(__FILE__)).'/plog-config.php')) { 
     3        require_once(dirname(dirname(__FILE__)).'/plog-config.php'); 
     4} 
    25include(dirname(dirname(__FILE__)).'/plog-globals.php'); 
    3 @include(PLOGGER_DIR.'plog-config.php'); 
    4 include(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 
    56include(PLOGGER_DIR.'plog-admin/includes/install-functions.php'); 
    67error_reporting(E_ALL); 
     
    2829// if we are upgrading from 1.0beta1, we do not yet have a valid plog-config.php file 
    2930if (!$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 
    3132        include(PLOGGER_DIR.'plog-includes/plog-functions.php'); 
    3233        // make sure Plogger is installed first 
    3334        if (!is_plogger_installed()) { 
    3435                // if Plogger does not seem to be installed, redirect to _install.php 
    35                 header("Location: _install.php"); 
     36                header('Location: _install.php'); 
    3637        } else { 
    3738                // if installed, check for safe_mode and if enabled, check for FTP workaround 
    38                 if (ini_get('safe_mode') && function_exists('ftp_connect')) { 
     39                if (is_safe_mode()) { 
    3940                        //set up the FTP workaround information if prompted 
    4041                        if (isset($_POST['ftp_host'])) { 
     
    9091$errors = check_requirements(); 
    9192if (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">'; 
    9495        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>'; 
    9697        } 
    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'].'"> 
    99100                        <p><input class="submit" type="submit" value="'.plog_tr('Try again').'" /></p> 
    100                 </form>'."\n"; 
     101                </form>' . "\n"; 
    101102} else { // end of requirement check 
    102103        $errors = ""; 
    103104 
    104         echo "\n".'<h1>'.plog_tr('Upgrading Plogger').'</h1>'; 
     105        echo "\n" . '<h1>'.plog_tr('Upgrading Plogger').'</h1>'; 
    105106 
    106107        switch ($step) { 
     
    109110                        if ($beta1) { 
    110111                                // 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'); 
    112113                                $conf = create_config_file($DB_HOST, $DB_USER, $DB_PW, $DB_NAME); 
    113114                                // serve the config file and ask user to upload it to webhost 
    114115                                $_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"; 
    121122                                break; 
    122123                        } else if ($needs_ftp) { 
     
    124125                                // handle errors and include the information form 
    125126                                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;">'; 
    127128                                        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>'; 
    131132                                } 
    132133                                include(PLOGGER_DIR.'plog-admin/includes/install-form-setup.php'); 
     
    138139                        $return = upgrade_database(); 
    139140                        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">'; 
    142143                                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').' &raquo;" /></p>'; 
    149                                 echo "\n\t".'</form>'."\n"; 
    150                                 break; 
    151                         } 
    152  
    153                 // step 2 - move images and uploads to new locations 
     144                                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').' &raquo;" /></p>'; 
     150                                echo "\n\t" . '</form>' . "\n"; 
     151                                break; 
     152                        } 
     153 
     154                // step 2 - move images, albums, collections, and uploads to new locations 
    154155                case 2: 
    155156                        // load the config file 
    156157                        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                        } 
    157162                        $upgrade_images = upgrade_image_list(); 
    158163                        if ($upgrade_images['total'] > 0 || isset($_POST['upgrade-images'])) { 
    159164                                $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>'; 
    161166                                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">'; 
    164169                                        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">'; 
    166171                                        foreach ($selects as $key => $value) { 
    167172                                                $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 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>'; 
    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"; 
    176181                                } else { 
    177182                                        $num_images = (isset($_POST['num-images']) && $_POST['num-images'] > 0) ? $_POST['num-images'] : $upgrade_images['total']; 
    178183                                        $return = upgrade_images($num_images, $upgrade_images); 
    179184                                        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">'; 
    182187                                                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>'; 
    186191                                        } 
    187192                                        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">'; 
    190195                                                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>'; 
    194199                                        } 
    195200                                        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').' &raquo;" /></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').' &raquo;" /></p>'; 
     204                                                echo "\n\t" . '</form>' . "\n"; 
     205                                                if (isset($_SESSION['plogger_close_perms'])) { 
     206                                                        unset($_SESSION['plogger_close_perms']); 
     207                                                } 
    200208                                        } 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">'; 
    203211                                                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">'; 
    205213                                                foreach ($selects as $key => $value) { 
    206214                                                        $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"; 
    214222                                        } 
    215223                                } 
     
    222230                        if (!empty($check_list['themes']) || !empty($check_list['translations'])) { 
    223231                                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">'; 
    226234                                        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>'; 
    230238                                } 
    231239                                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">'; 
    234242                                        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').' &raquo;" /></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').' &raquo;" /></p>'; 
     249                                echo "\n\t" . '</form>' . "\n"; 
    242250                                break; 
    243251                        } 
     
    249257                        $cleanup_list = cleanup_list(); 
    250258                        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>'; 
    252260                                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">'; 
    256264                                        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>'; 
    258266                                        } 
    259267                                        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>'; 
    266274                                } else { 
    267275                                        $return = cleanup_files($cleanup_list['files'], $cleanup_list['folders']); 
    268276                                        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">'; 
    271279                                                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>'; 
    275283                                        } 
    276284                                        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">'; 
    279287                                                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>'; 
    283291                                        } 
    284292                                        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"; 
    289297                                        } 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').' &raquo;" /></p>'; 
    295                                 echo "\n\t".'</form>'. "\n"; 
    296                                 echo "\n\t".'<p>&nbsp;</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').' &raquo;" /></p>'; 
     303                                echo "\n\t" . '</form>'. "\n"; 
     304                                echo "\n\t" . '<p>&nbsp;</p>'. "\n"; 
    297305                                break; 
    298306                        } 
     
    300308                // Finished! 
    301309                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"; 
    307318                        break; 
    308319        } 
    309320} 
     321if (!$beta1) { 
     322        close_db(); 
     323        close_ftp(); 
     324} 
    310325?> 
    311326 
  • trunk/plog-admin/css/admin.css

    r587 r590  
    1 /* Plogger admin stylesheet */ 
     1/* Plogger gallery admin UI stylesheet */ 
    22 
    33/* Body and general styles */ 
    44 
    55html { 
    6         padding: 15px; 
    7         border-bottom: 10px solid #369; 
    8         border-top: 10px solid #369; 
     6        margin: 0; 
     7        padding: 0 15px 15px 15px; 
     8        border-top: 10px solid #365d95; 
    99} 
    1010 
     
    1212        font-family: tahoma, verdana, arial, sans-serif; 
    1313        font-size: 14px; 
     14        color: #333; 
    1415} 
    1516 
    1617a:link, a:visited, a:active { 
    17         color: maroon; 
     18        color: #24496c; 
    1819        text-decoration: none; 
    1920} 
    2021 
    2122a:hover { 
    22         color: navy; 
     23        color: #800; 
    2324        text-decoration: underline; 
    2425} 
     
    2627a:focus { 
    2728        outline: none; 
    28         -moz-outline:none; 
     29        -moz-outline: none; 
     30} 
     31 
     32acronym, abbr { 
     33        cursor: help; 
    2934} 
    3035 
    3136h1 { 
    3237        font-family: verdana, arial, sans-serif; 
    33         font-size: 1.4em; 
    34         margin-top: 25px; 
     38        font-size: 1.3em; 
     39        margin-top: 20px; 
    3540        margin-bottom: 15px; 
    3641        font-weight: bold; 
     
    4045h2 { 
    4146        font-family: verdana, arial, sans-serif; 
    42         font-size: 1.2em; 
     47        font-size: 1.1em; 
    4348        margin-top: 20px; 
    4449        margin-bottom: 15px; 
     
    6469        font-size: 13px; 
    6570        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 
     74input.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 
     93input.submit, input.submit-delete, input.submit-cancel { 
     94        background-color: #369; 
     95        background-image: url("../images/blue-button-bg.gif"); 
    7496        background-repeat: repeat-x; 
    75         color: #333; 
    76         font-size: 90%; 
    77         font-weight: normal; 
    78         padding: 0.25em; 
    7997        margin-left: 0; 
     98} 
     99 
     100input.submit[type="submit"]:hover { 
     101        color: #a0cca0; 
     102} 
     103 
     104input.submit-delete[type="submit"]:hover, input.submit-cancel[type="submit"]:hover { 
     105        color: #f00; 
     106} 
     107 
     108input.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 
     115input.submit-create[type="button"]:hover { 
     116        color: #24496c; 
    80117} 
    81118 
     
    88125        margin: 0; 
    89126        padding: 0; 
     127        border: 0 none; 
    90128        cursor: pointer; 
    91129} 
     
    104142} 
    105143 
     144ul { 
     145        margin-bottom: 5px; 
     146} 
     147 
    106148/* Header elements */ 
    107149 
     150#logo { 
     151        float: left; 
     152        margin-top: -3px; 
     153        padding: 0; 
     154} 
     155 
     156#logo img { 
     157        border: 0 none; 
     158} 
     159 
    108160#plogger-version { 
     161        float: right; 
     162        width: 375px; 
    109163        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; 
    115261} 
    116262 
    117263/* Upload page elements */ 
     264 
     265#uploadForm form { 
     266        margin: 0; 
     267        padding: 0; 
     268} 
    118269 
    119270#uploadForm label { 
     
    128279        background-repeat: no-repeat; 
    129280        background-position: left 1px; 
    130         padding-left: 20px; 
     281        padding-left: 25px; 
    131282} 
    132283 
     
    140291} 
    141292 
     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 
    142308/* Manage and Feedback page elements */ 
    143309 
     
    153319        font-size: 0.9em; 
    154320        margin-right: 5px; 
    155         padding: 3px; 
    156         font-weight: bold; 
     321        padding: 10px 3px 0 3px; 
     322        font-weight: normal; 
    157323        text-align: right; 
    158324} 
    159325 
    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 { 
    161373        font-weight: normal; 
    162374} 
     
    166378} 
    167379 
    168 #contentList .entries-page label, select { 
     380#contentList .entries-page label, #contentList .entries-page select { 
    169381        display: block inline; 
    170382        margin-bottom: auto; 
    171383} 
    172384 
    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 { 
    174390        display: block inline; 
    175391        margin-bottom: auto; 
     
    177393        font-size: 13px; 
    178394        letter-spacing: normal; 
     395        clear: both; 
    179396} 
    180397 
     
    200417        margin: 15px; 
    201418        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; 
    204425        width: auto; 
    205426        clear: both; 
     
    207428 
    208429.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; 
    210435        padding: 3px; 
    211436        background-color: #fff; 
     
    218443        border: 1px solid #efefef; 
    219444        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; 
    232463} 
    233464 
    234465/* Options page elements */ 
    235466 
    236 #options_section label { 
     467#options-section label { 
    237468        font-weight: bold; 
    238469} 
     
    258489} 
    259490 
    260 tr.alt td { 
    261         background: #fafafa; 
    262         border-bottom: 1px solid #efefef; 
    263 } 
    264  
    265 /* Themes page elements */ 
    266  
    267 #theme-table td { 
     491tr.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 
     503tr.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 { 
    268518        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 { 
    272523        padding: 8px; 
    273524} 
    274525 
    275 tr.activated td { 
    276         background: #bedebe; 
    277         border-bottom: 1px solid #519e51; 
     526tr.activated td, tr.enabled td { 
     527        background: #bed6d7; 
     528} 
     529 
     530td.active, td.on { 
     531        color: #000; 
     532        font-weight: bold; 
    278533} 
    279534 
    280535/* Upload and Manage page elements */ 
    281536 
    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 
     539table.cssbox-upload { 
     540        width: 750px; 
     541        margin: 0; 
    289542        padding: 0; 
    290         margin: 0; 
    291         font-weight: bold; 
     543} 
     544 
     545td.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 
     552th.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 
     573th.cssbox-upload-head-blue h2 { 
     574        background: transparent url("../images/blue-button-bg.gif") repeat-x top left; 
     575} 
     576 
     577th.cssbox-upload-head-green h2 { 
     578        background: transparent url("../images/green-button-bg.gif") repeat-x top left; 
     579} 
     580 
     581td.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; 
    292602        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 */ 
    300607 
    301608.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; 
    306612} 
    307613 
     
    311617} 
    312618 
    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 { 
    342620        color: #fff; 
    343621        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; 
    347624        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 { 
    351673        margin: 0 0 20px; 
    352674} 
    353675 
    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  
    361676/* Action/Error messages */ 
    362677 
    363 .actions { 
    364         background-image: url("../images/alert.gif"); 
     678.success, .actions, .errors, .info, .plugins { 
    365679        background-repeat: no-repeat; 
    366680        background-position: 5px 8px; 
    367681        margin-right: 5px; 
    368682        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; 
    371687        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; 
    372700        background-color: #ffffe0; 
    373         clear: both; 
    374701} 
    375702 
    376703.errors { 
    377704        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; 
    385706        background-color: #fcc; 
    386         clear: both; 
    387707} 
    388708 
    389709.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; 
    395711        background-color: #f9f9f9; 
    396         clear: both; 
     712} 
     713 
     714.plugins { 
     715        border: 1px solid #d9d9d9; 
     716        background-color: #fff; 
    397717} 
    398718 
    399719/* 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} 
    400732 
    401733.breadcrumb-header { 
     
    406738} 
    407739 
    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  
    458740.img-shadow { 
    459         float:left; 
     741        float: left; 
    460742        background: url("../images/shadowAlpha.png") no-repeat bottom right !important; 
    461743        background: url("../images/shadow.gif") no-repeat bottom right; 
     
    473755} 
    474756 
    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; 
    477771} 
    478772 
     
    490784 
    491785tr.color-1 { 
    492         background-color: #ccc; 
     786        background-color: #eaeaea; 
     787        text-align: left; 
    493788} 
    494789 
    495790tr.color-2 { 
    496         background-color: #efefef; 
     791        background-color: #f9f9f9; 
     792        text-align: left; 
    497793} 
    498794 
     
    513809} 
    514810 
     811tr.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 
    515821tr.footer { 
    516822        background-color: #264e75; 
     
    518824 
    519825tr.footer td { 
    520         padding: 6px; 
     826        padding: 5px; 
     827} 
     828 
     829tr.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 
     837tr.footer td.invert-selection a:hover { 
     838        color: #ddd; 
    521839} 
    522840 
    523841.thumbselect { 
    524         height: 80px; 
    525         padding-left: 90px; 
     842        height: 100px; 
     843        padding-left: 100px; 
    526844        background-repeat: no-repeat; 
    527845        background-position: center left; 
     
    529847 
    530848.thumboption { 
    531         padding-left: 90px; 
    532         height: 40px; 
     849        height: 50px; 
     850        padding-left: 100px; 
    533851        margin-bottom: 2px; 
    534         background-position: center left; 
     852        background-repeat: no-repeat; 
     853        background-position: top left; 
    535854} 
    536855 
     
    539858        text-decoration: none; 
    540859} 
     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 
     925td.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  
    11#lightbox { 
    2         background-color:#eee; 
     2        background-color: #eee; 
    33        padding: 10px; 
     4        border-right: 2px solid #666; 
    45        border-bottom: 2px solid #666; 
    5         border-right: 2px solid #666; 
    66} 
    77 
  • trunk/plog-admin/css/login.css

    r586 r590  
    3131 
    3232input.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"); 
    3836        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; 
    4451        margin-left: 0; 
    4552        width: auto; 
     53} 
     54 
     55input.submit:hover { 
     56        color: #a0cca0; 
    4657} 
    4758 
     
    6475        background-color: #f9f9f9; 
    6576        border: 1px solid #d9d9d9; 
     77        -moz-border-radius: 5px; 
     78        -khtml-border-radius: 5px; 
     79        -webkit-border-radius: 5px; 
     80        border-radius: 5px; 
    6681        padding: 20px 15px 5px; 
    6782        margin: 10px auto; 
     
    7489        margin: 15px auto; 
    7590        border: 1px solid maroon; 
     91        -moz-border-radius: 5px; 
     92        -khtml-border-radius: 5px; 
     93        -webkit-border-radius: 5px; 
     94        border-radius: 5px; 
    7695        padding: 10px 15px; 
    7796        background-color: #fcc; 
     
    84103        margin: 15px auto; 
    85104        border: 1px solid #bb0; 
     105        -moz-border-radius: 5px; 
     106        -khtml-border-radius: 5px; 
     107        -webkit-border-radius: 5px; 
     108        border-radius: 5px; 
    86109        padding: 10px 15px; 
    87110        background-color: #ffffe0; 
  • trunk/plog-admin/includes/install-form-setup.php

    r587 r590  
    1717} 
    1818 
    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'); 
    2020foreach($init_vars as $var) { 
    2121        if (empty($form[$var])) { 
    22                 $form[$var] = ""; 
     22                $form[$var] = ''; 
    2323        } 
    2424} 
     
    2626<h1><?php echo plog_tr('Plogger Configuration Setup') ?></h1> 
    2727 
    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> 
    2929 
    3030        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 
     
    5454} // end Database Setup 
    5555 
    56 if (!isset($config['gallery_name']) || !isset($config['admin_email'])) { 
     56if ( 
     57        !isset($config['gallery_name']) || 
     58        !isset($config['admin_email']) || 
     59        !isset($config['admin_username']) || 
     60        !isset($config['admin_password']) 
     61) { 
    5762?> 
    5863                <tr> 
     
    6671<?php 
    6772        } 
    68         if (!isset($config['admin_email'])) { ?> 
     73        if (!isset($config['admin_email'])) { 
     74?> 
    6975                <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> 
    7177                        <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> 
    7294                </tr> 
    7395<?php 
     
    108130                        <td colspan="2"> 
    109131                                <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> 
    111133                        </td> 
    112134                </tr> 
    113135<?php 
    114136        } 
    115 } //end Safe_mode FTP Workaround ?> 
     137} //end Safe_mode FTP Workaround 
     138?> 
    116139                <tr> 
    117140                        <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  
    99/**** Common Functions ****/ 
    1010 
    11 function maybe_add_column($table,$column,$add_sql) { 
     11function maybe_add_column($table, $column, $add_sql) { 
    1212        $sql = "DESCRIBE $table"; 
    1313        $res = mysql_query($sql); 
    1414        $found = false; 
    15         while($row = mysql_fetch_array($res,MYSQL_NUM)) { 
     15        while($row = mysql_fetch_array($res, MYSQL_NUM)) { 
    1616                if ($row[0] == $column) $found = true; 
    1717        } 
    1818        if (!$found) { 
    19                 mysql_query("ALTER TABLE $table ADD `$column` ". $add_sql); 
     19                mysql_query("ALTER TABLE $table ADD `$column` ".$add_sql); 
    2020                return plog_tr('Added new field to database').': '.$column; 
    2121        } else { 
    2222                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 
     29function maybe_drop_column($table, $column) { 
    2930        $sql = "DESCRIBE $table"; 
    3031        $res = mysql_query($sql); 
    3132        $found = false; 
    32         while($row = mysql_fetch_array($res,MYSQL_NUM)) { 
     33        while($row = mysql_fetch_array($res, MYSQL_NUM)) { 
    3334                if ($row[0] == $column) $found = true; 
    3435        } 
     
    3940        } else { 
    4041                if (defined('PLOGGER_DEBUG')) { 
     42//                      return $column.' '.plog_tr('does not exist').''; 
    4143                        return $column.' does not exist'; 
    4244                } 
     
    4446} 
    4547 
    46 function maybe_add_table($table,$add_sql,$options = "") { 
     48function maybe_add_table($table, $add_sql, $options = '') { 
    4749        $sql = "DESCRIBE $table"; 
    4850        $res = mysql_query($sql); 
     
    5759        } else { 
    5860                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.'; 
    6063                } 
    6164        } 
     
    7174        $errors = array(); 
    7275 
    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                } 
    8090        } 
    8191 
     
    90100        } 
    91101 
    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                        } 
    105129                } 
    106130        } 
    107131 
    108132        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; 
    129133} 
    130134 
     
    140144        } 
    141145 
    142         if (empty($form['db_pass'])) { 
    143                 $errors[] = plog_tr('Please enter the MySQL password.'); 
    144         } 
    145  
    146146        if (empty($form['db_name'])) { 
    147147                $errors[] = plog_tr('Please enter the MySQL database name.'); 
     
    151151} 
    152152 
    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  
    169153function check_ftp_form($form) { 
    170154        $errors = array(); 
     
    183167 
    184168        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'].'/'; 
    190174                } 
    191175        } 
     
    199183        $connection = @ftp_connect($host); 
    200184        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>'); 
    202186        } else { 
    203187                $login = @ftp_login($connection, $user, $pass); 
    204188                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>'); 
    206190                } else { 
    207                         $checkdir = @ftp_chdir($connection, $path."plog-content/images/"); // check to see if the plog-content/images/ folder is accessible 
     191                        $checkdir = @ftp_chdir($connection, $path.'plog-content/images/'); // check to see if the plog-content/images/ folder is accessible 
    208192                        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>'); 
    210194                        } 
    211195                } 
     
    215199} 
    216200 
    217 function recursive_rmdir($path) { 
    218 // great function originally named advancedRmdir() by kisgabo94 at freemail dot hu 
    219         $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  
    246201/**** Install Functions ****/ 
    247202 
    248203function 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); 
    251206 
    252207        // first check the requirements 
    253208        $errors = check_requirements(); 
    254209        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">'; 
    257212                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'].'"> 
    262217                <p><input class="submit" type="submit" value="'.plog_tr('Try again').'" /></p> 
    263         </form>'."\n"; 
     218        </form>' . "\n"; 
    264219                return false; 
    265220        } 
     
    291246        } 
    292247 
    293         if (!empty($form['action']) && $form['action'] == 'install') { 
     248        if (isset($form['action']) && $form['action'] == 'install') { 
    294249                if (!defined('PLOGGER_DB_HOST') || isset($mysql_fail)) { 
    295250                        $mysql_form_check = check_mysql_form($form); 
     
    304259 
    305260                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()) { 
    310273                        //if safe_mode enabled, check the FTP information form inputs 
    311274                        $ftp_form_check = check_ftp_form($form); 
     
    318281                if (empty($errors)) { 
    319282                        $mysql_errors = check_mysql($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']); 
    320                         if (ini_get('safe_mode') && function_exists('ftp_connect')) { 
     283                        if (is_safe_mode()) { 
    321284                                $ftp_errors = check_ftp($form['ftp_host'], $form['ftp_user'], $form['ftp_pass'], $form['ftp_path']); 
    322                         }else{ 
     285                        } else { 
    323286                                $ftp_errors = array(); 
    324287                        } 
     
    328291 
    329292                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); 
    332295                        echo "</li>\n</ul>\n\n"; 
    333296                } else { 
    334                         $password = generate_password(); 
    335297                        $_SESSION['install_values'] = array( 
    336298                                'gallery_name' => $form['gallery_name'], 
    337299                                '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'] 
    340302                        ); 
    341                         if (ini_get('safe_mode') && function_exists('ftp_connect')) { 
     303                        if (is_safe_mode()) { 
    342304                                $_SESSION['ftp_values'] = array( 
    343305                                        'ftp_host' => $form['ftp_host'], 
     
    349311 
    350312                        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']); 
    352313                                // 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                        } 
    357316                        return true; 
    358317                } 
    359318        } 
    360319 
    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; 
    362322} 
    363323 
     
    367327        // we are running on and to the right thing 
    368328        $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'; 
    374334        } 
    375335 
    376336        maybe_add_table( 
    377         TABLE_PREFIX . 'collections' 
     337        PLOGGER_TABLE_PREFIX.'collections' 
    378338        ,"`name` varchar(128) NOT NULL default '', 
    379339        `description` varchar(255) NOT NULL default '', 
     
    381341        `id` int(11) NOT NULL auto_increment, 
    382342        `thumbnail_id` int(11) NOT NULL DEFAULT '0', 
    383         PRIMARY KEY  (id)" 
     343        PRIMARY KEY (id)" 
    384344        ,"Type=MyISAM $default_charset"); 
    385345 
    386346        maybe_add_table( 
    387         TABLE_PREFIX . 'albums' 
     347        PLOGGER_TABLE_PREFIX.'albums' 
    388348        ," `name` varchar(128) NOT NULL default '', 
    389349        `id` int(11) NOT NULL auto_increment, 
     
    392352        `parent_id` int(11) NOT NULL default '0', 
    393353        `thumbnail_id` int(11) NOT NULL default '0', 
    394         PRIMARY KEY  (id), 
     354        PRIMARY KEY (id), 
    395355        INDEX pid_idx (parent_id)" 
    396356        ," Type=MyISAM $default_charset"); 
    397357 
    398358        maybe_add_table( 
    399         TABLE_PREFIX . 'pictures' 
     359        PLOGGER_TABLE_PREFIX.'pictures' 
    400360        ,"`path` varchar(255) NOT NULL default '', 
    401361        `parent_album` int(11) NOT NULL default '0', 
     
    414374        `EXIF_iso` varchar(64) NOT NULL default '', 
    415375        `allow_comments` int(11) NOT NULL default '1', 
    416         PRIMARY KEY  (id), 
     376        PRIMARY KEY (id), 
    417377        INDEX pa_idx (parent_album), 
    418378        INDEX pc_idx (parent_collection)" 
     
    420380 
    421381        maybe_add_table( 
    422         TABLE_PREFIX . 'comments' 
     382        PLOGGER_TABLE_PREFIX.'comments' 
    423383        ,"`id` int(11) NOT NULL auto_increment, 
    424384        `parent_id` int(11) NOT NULL default '0', 
     
    430390        `ip` char(64), 
    431391        `approved` tinyint default '1', 
    432         PRIMARY KEY  (id), 
     392        PRIMARY KEY (id), 
    433393        INDEX pid_idx (parent_id), 
    434394        INDEX approved_idx (approved)" 
     
    436396 
    437397        maybe_add_table( 
    438         TABLE_PREFIX . 'config' 
     398        PLOGGER_TABLE_PREFIX.'config' 
    439399        ,"`max_thumbnail_size` int(11) NOT NULL default '0', 
    440400        `max_display_size` int(11) NOT NULL default '0', 
     
    470430        `enable_thumb_nav` tinyint default '0', 
    471431        `allow_fullpic` tinyint default '1', 
    472         PRIMARY KEY  (`thumb_num`)" 
     432        PRIMARY KEY (`thumb_num`)" 
    473433        ,"Type=MyISAM $default_charset"); 
    474434 
    475435        maybe_add_table( 
    476         TABLE_PREFIX . 'thumbnail_config' 
     436        PLOGGER_TABLE_PREFIX.'thumbnail_config' 
    477437        ,"`id` int(10) unsigned NOT NULL auto_increment, 
    478438        `update_timestamp` int(10) unsigned default NULL, 
    479439        `max_size` int(10) unsigned default NULL, 
    480440        `disabled` tinyint default 0, 
    481         PRIMARY KEY  (`id`)" 
     441        PRIMARY KEY (`id`)" 
    482442        ,"Type=MyISAM $default_charset"); 
    483443 
    484444        /*maybe_add_table( 
    485         TABLE_PREFIX . 'tag2picture' 
     445        PLOGGER_TABLE_PREFIX.'tag2picture' 
    486446        ,"`tag_id` bigint(20) unsigned NOT NULL default '0', 
    487447        `picture_id` bigint(20) unsigned NOT NULL default '0', 
     
    492452 
    493453        maybe_add_table( 
    494         TABLE_PREFIX . 'tags' 
     454        PLOGGER_TABLE_PREFIX.'tags' 
    495455        ,"`id` bigint(20) unsigned NOT NULL auto_increment, 
    496456        `tag` char(50) NOT NULL default '', 
     
    516476 
    517477        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')"; 
    520480                mysql_query($sql); 
    521481        } 
    522482 
    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'])); 
    524484        // 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/')); 
    527487        } 
    528488        // 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} != '/') { 
    530490                $config['gallery_url'] .= '/'; 
    531491        } 
    532492        // 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) { 
    534494                $config['gallery_url'] = 'http://'.$config['gallery_url']; 
    535495        } 
    536         $config['admin_username'] = 'admin'; 
     496        $config['admin_username'] = $form['admin_username']; 
    537497        $config['admin_password'] = $form['admin_password']; 
    538498        $config['admin_email'] = $form['admin_email']; 
    539499        $config['gallery_name'] = $form['gallery_name']; 
    540500 
    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`"); 
    544504        $row_exist_num = mysql_num_rows($row_exist); 
    545505 
    546506        if ($row_exist_num == 0) { 
    547                 $query = "INSERT INTO `".TABLE_PREFIX."config` 
     507                $query = "INSERT INTO `".PLOGGER_TABLE_PREFIX."config` 
    548508                        (`theme_dir`, 
    549509                        `compression`, 
     
    572532                        '${config['gallery_url']}')"; 
    573533        } else { 
    574                 $query = "UPDATE `".TABLE_PREFIX."config` SET 
     534                $query = "UPDATE `".PLOGGER_TABLE_PREFIX."config` SET 
    575535                        `theme_dir` = 'default', 
    576536                        `compression` = 75, 
     
    589549 
    590550        // create the FTP columns in the config table if safe_mode enabled/ 
    591         if (ini_get('safe_mode') && isset($_SESSION['ftp_values'])) { 
     551        if (is_safe_mode() && isset($_SESSION['ftp_values'])) { 
    592552                configure_ftp($_SESSION['ftp_values']); 
    593553        } 
     
    599559                $config['admin_email'], 
    600560                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'], 
    602562                'From: Plogger <noreply@'.$from.'>' 
    603563        ); 
     
    605565 
    606566function 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` SET 
     567        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 
    612572                `ftp_host` = '".$form['ftp_host']."', 
    613573                `ftp_user` = '".$form['ftp_user']."', 
     
    617577} 
    618578 
     579function 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 
    619592function create_config_file($db_host, $db_user, $db_pass, $db_name) { 
    620593        $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"; 
    630629        $cfg_file .= "?>"; 
    631630        return $cfg_file; 
     
    638637        $output = array(); 
    639638 
    640 /** plogger_thumnail_config **/ 
     639/** plogger_thumbnail_config **/ 
    641640        $thumb_table = maybe_add_table( 
    642                 TABLE_PREFIX . 'thumbnail_config' 
     641                PLOGGER_TABLE_PREFIX.'thumbnail_config' 
    643642                ,"`id` int(10) unsigned NOT NULL auto_increment, 
    644643                `update_timestamp` int(10) unsigned default NULL, 
    645644                `max_size` int(10) unsigned default NULL, 
    646645                `disabled` tinyint default 0, 
    647                 PRIMARY KEY  (`id`)" 
     646                PRIMARY KEY (`id`)" 
    648647                ); 
    649648 
    650649        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'; 
    652651                // use a random timestamp from the past to keep the existing thumbnails 
    653652                $long_ago = 1096396500; 
     
    657656                } 
    658657                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']."')"; 
    661660                        mysql_query($sql); 
    662661                } 
     
    666665                } 
    667666                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']."')"; 
    670669                        mysql_query($sql); 
    671670                } 
     
    675674                } 
    676675                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']."')"; 
    679678                        mysql_query($sql); 
    680679                } 
     
    684683                } 
    685684                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']."')"; 
    688687                        mysql_query($sql); 
    689688                } 
     
    694693        ); 
    695694        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); 
    697696                if (!empty($result)) { 
    698697                        $output[] = $result; 
     
    707706        ); 
    708707        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); 
    710709                if (!empty($result)) { 
    711710                        $output[] = $result; 
     
    724723                'default_sortdir' => "varchar(5) NOT NULL", 
    725724                'default_sortby' => "varchar(20) NOT NULL", 
    726                 // add field for admin e-mail 
     725                // add field for admin email 
    727726                'admin_email' => "varchar(50) NOT NULL", 
    728727                // disable link to full size pic 
     
    748747        ); 
    749748        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); 
    751750                if (!empty($result)) { 
    752751                        $output[] = $result; 
     
    756755        // insert the gallery_url if not already set 
    757756        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'])).'/'; 
    759758                $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']."'"; 
    761760                mysql_query($sql); 
    762761        } 
     
    764763        // insert default theme directory if not already set 
    765764        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"; 
    768767                mysql_query($sql); 
    769768        } 
     
    777776        ); 
    778777        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); 
    780779                if (!empty($result)) { 
    781780                        $output[] = $result; 
     
    791790        ); 
    792791        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); 
    794793                if (!empty($result)) { 
    795794                        $output[] = $result; 
     
    804803        ); 
    805804        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); 
    807806                if (!empty($result)) { 
    808807                        $output[] = $result; 
     
    817816        ); 
    818817        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); 
    820819                if (!empty($result)) { 
    821820                        $output[] = $result; 
     
    823822        } 
    824823 
    825                 /*$output[] = maybe_add_table(TABLE_PREFIX.'tag2picture'," 
     824                /*$output[] = maybe_add_table(PLOGGER_TABLE_PREFIX.'tag2picture'," 
    826825                `tag_id` bigint(20) unsigned NOT NULL default '0', 
    827826                `picture_id` bigint(20) unsigned NOT NULL default '0', 
     
    831830        "); 
    832831 
    833         $output[] = maybe_add_table(TABLE_PREFIX.'tags'," 
     832        $output[] = maybe_add_table(PLOGGER_TABLE_PREFIX.'tags'," 
    834833                `id` bigint(20) unsigned NOT NULL auto_increment, 
    835834                `tag` char(50) NOT NULL default '', 
     
    841840        ");*/ 
    842841 
    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`)'; 
    844843        mysql_query($sql); 
    845844 
    846845        // 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'; 
    848847        mysql_query($sql); 
    849848 
     
    853852        // we are running on and to the right hting 
    854853        $mysql_version = mysql_get_server_info(); 
    855         $mysql_charset_support = "4.1"; 
    856         $default_charset = ""; 
     854        $mysql_charset_support = '4.1'; 
     855        $default_charset = ''; 
    857856 
    858857        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'); 
    861860                foreach($tables as $table) { 
    862                         $tablename = TABLE_PREFIX . $table; 
     861                        $tablename = PLOGGER_TABLE_PREFIX.$table; 
    863862                        $sql = "ALTER TABLE $tablename DEFAULT CHARACTER SET $charset"; 
    864863                        if (!mysql_query($sql)) { 
     
    876875 
    877876        // 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/'";  
    879878        mysql_query($sql); 
    880879 
    881880        // update 'path' for collections table 
    882         $sql = "SELECT id,name FROM ".TABLE_PREFIX."collections"; 
     881        $sql = "SELECT id,name FROM ".PLOGGER_TABLE_PREFIX."collections"; 
    883882        $result = mysql_query($sql); 
    884883        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']; 
    886885                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                } 
    887890        } 
    888891 
    889892        // 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"; 
    891896        $result = mysql_query($sql); 
    892897        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']; 
    894899                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                } 
    895904        } 
    896905 
    897906        // loop through each image from the pictures table, get its parent album name and parent collection 
    898907        $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 c  
     908                        FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."pictures p, ".PLOGGER_TABLE_PREFIX."collections c  
    900909                        WHERE p.parent_album = a.id AND p.parent_collection = c.id"; 
    901910        $result = mysql_query($sql); 
     
    908917                // if the file exists, grab the information and add to the total 
    909918                if (!file_exists(PLOGGER_DIR.'plog-content/images/'.$new_path)) { 
     919                        // first see if it's in the old directory structure 
    910920                        if (file_exists(PLOGGER_DIR.'images/'.$row['path'])) { 
    911921                                $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 
    912926                        } else if (file_exists(PLOGGER_DIR.'plog-content/images/'.$row['path'])) { 
    913927                                $path = 'plog-content/images/'; 
     
    923937        // add any photos from the uploads directory 
    924938        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/'); 
    927941 
    928942                // compare the two paths for differences 
     
    948962                if (!empty($image['id'])) { 
    949963                        // 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'].'/'))) { 
    951965                                $errors[] = plog_tr('Could not create directory').': '.PLOGGER_DIR.'plog-content/images/'.$image['new_path']; 
    952966                        } 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'])) { 
    954968                                        $errors[] = plog_tr('Could not move file').': '.PLOGGER_DIR.$image['old_path'];  
    955969                                } 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>'); 
    958972                                        // generate a new small thumbnail 
    959973                                        $thumbpath = generate_thumb(PLOGGER_DIR.'plog-content/images/'.$image['new_path'], $image['id'], THUMB_SMALL); 
    960974                                        // 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']."'"; 
    962976                                        run_query($sql); 
    963977                                        $count++; 
     
    966980                } else if (!empty($image['uploads'])) { 
    967981                        // 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'].'/'))) { 
    969983                                $errors[] = plog_tr('Could not create directory').': '.PLOGGER_DIR.$image['new_path']; 
    970984                        } 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'])) { 
    972986                                        $errors[] = plog_tr('Could not move file').': '.PLOGGER_DIR.$image['old_path'];  
    973987                                } 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>'); 
    976990                                        $count++; 
    977991                                } 
     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++; 
    9781000                        } 
    9791001                } 
     
    10021024 
    10031025        // see if there are any old translations 
    1004         if (file_exists(PLOGGER_DIR.'plog-tranlations/')) { 
     1026        if (file_exists(PLOGGER_DIR.'plog-translations/')) { 
    10051027                $translations_old = get_files(PLOGGER_DIR.'plog-translations/', true, false, dirname(dirname(dirname(__FILE__))).'/plog-translations/'); 
    10061028                if (!empty($translations_old)) { 
     
    10251047                '_upgrade.php', 
    10261048                'plog-captcha.php', 
    1027                 'plog-comment.php', 
    10281049                'plog-connect.php', 
    10291050                'plog-functions.php', 
     
    10331054                'dynamics.js', 
    10341055                'slideshow.js', 
    1035                 'captcha.ttf' 
     1056                'captcha.ttf', 
     1057                'plog-includes/plog-comment.php', 
     1058                'plog-includes/plog-tag-functions.php' 
    10361059        ); 
    10371060        foreach ($file_list as $file) { 
     
    10511074                'thumbs/', 
    10521075                'uploads/', 
    1053                 'summary/' 
     1076                'summary/', 
     1077                'plog-content/images-old/', 
     1078                'plog-content/thumbs-old/' 
    10541079        ); 
    10551080        foreach ($folder_list as $folder) { 
     
    10701095        foreach ($files as $file) { 
    10711096                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; 
    10751099                        } else { 
    1076                                 $errors[] = plog_tr('Plogger could not delete the file').": ".$file; 
     1100                                $errors[] = plog_tr('Plogger could not delete the file').': '.$file; 
    10771101                        } 
    10781102                } 
     
    10821106        foreach ($folders as $folder) { 
    10831107                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; 
    10871110                        } else { 
    1088                                 $errors[] = plog_tr('Plogger could not delete the folder').": ".$folder; 
     1111                                $errors[] = plog_tr('Plogger could not delete the folder').': '.$folder; 
    10891112                        } 
    10901113                } 
  • trunk/plog-admin/index.php

    r588 r590  
    11<?php 
    22// load configuration variables from database, plog-globals, & plog-includes/plog-functions 
    3 require_once(dirname(dirname(__FILE__))."/plog-load-config.php"); 
     3require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
    44 
    55// if we're already logged in, redirect to the upload page 
    66if (isset($_SESSION['plogger_logged_in']) && $_SESSION['plogger_logged_in'] === true) { 
    7         header("Location: plog-upload.php"); 
     7        header('Location: plog-upload.php'); 
    88        exit; 
    99} 
     
    2121// logout message 
    2222if (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"; 
    2424} 
    2525 
     
    2929 
    3030                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"; 
    3232                break; 
    3333 
    3434                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"; 
    3636                break; 
    3737 
    3838                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"; 
    4040                break; 
    4141 
     
    4747if (isset($_REQUEST['loginerror'])) { 
    4848        // 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"; 
    5050} 
    5151 
     
    5555 
    5656                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"; 
    5858                break; 
    5959 
    6060                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"; 
    6262                break; 
    6363 
    6464                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"; 
    6666                break; 
    6767        } 
     
    7070// create the form information 
    7171if(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"; 
    7273        $form_content = '<p><label for="admin_email">'.plog_tr('Username or Email').'</label></p> 
    7374                <p><input type="text" name="admin_email" id="admin_email" tabindex="10" /></p> 
     
    8081        $link = '<a title="'.plog_tr('Reset password').'" href="'.$config['gallery_url'].'plog-admin/index.php?resetpassword">'.plog_tr('Reset password').'</a>' . "\n"; 
    8182} 
    82  
     83close_db(); 
    8384?> 
    8485<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     
    8687<html xmlns="http://www.w3.org/1999/xhtml"> 
    8788<head> 
    88         <title><?php echo plog_tr('Plogger Administrative Login') ?></title> 
     89        <title>Plogger <?php echo plog_tr('Gallery Admin | Login') ?></title> 
    8990        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    9091        <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; 
     1function 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 
     10function 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; 
    918                        } 
    1019                } 
     
    7382                document.getElementById('caption').style.background = "#fafafa"; 
    7483                document.getElementById('description').style.background = "#fafafa"; 
    75         } 
    76         else { 
     84        } else { 
    7785                document.getElementById('caption').disabled = false; 
    7886                document.getElementById('description').disabled = false; 
     
    8492 
    8593function 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                } 
    92102        } 
    93103 
    94 } 
     104}; 
  • trunk/plog-admin/plog-admin-functions.php

    r588 r590  
    11<?php 
    22 
    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)); 
     3if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) { 
     4        // ignorance is bliss 
     5        exit(); 
    96} 
    107 
     
    2219                while($file = readdir($dir)) { 
    2320                        // Make sure the file exists 
    24                         if($file != "." && $file != "..") { 
     21                        if($file != '.' && $file != '..') { 
    2522                                if (!$get_folders) { 
    2623                                        if ($file[0] == '.') { 
     
    2926                                } 
    3027                                // 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); 
    3330                                        if (is_array($tmp2)) { 
    3431                                                if (!isset($tmp2['files'])) { 
     
    4138                                        if ($get_folders) { 
    4239                                                if (!$relative_path) { 
    43                                                         $tmp_folders[] = $directory . $sep . $file; 
     40                                                        $tmp_folders[] = $directory.$sep.$file; 
    4441                                                } else { 
    45                                                         $tmp_folders[] = str_replace($relative_path, '', $directory . $sep . $file); 
     42                                                        $tmp_folders[] = str_replace($relative_path, '', $directory.$sep.$file); 
    4643                                                } 
    4744                                        } 
    48                                 } else if (is_readable($directory . $sep . $file)) { 
     45                                } else if (is_readable($directory.$sep.$file)) { 
    4946                                        $filename = basename(stripslashes($file)); 
    5047                                        $pi = pathinfo($file); 
    5148                                        if (is_allowed_extension($pi['extension']) || $get_all_files) { 
    5249                                                if (!$relative_path) { 
    53                                                         $tmp[] = $directory . $sep . $file; 
     50                                                        $tmp[] = $directory.$sep.$file; 
    5451                                                } else { 
    55                                                         $tmp[] = str_replace($relative_path, '', $directory . $sep . $file); 
     52                                                        $tmp[] = str_replace($relative_path, '', $directory.$sep.$file); 
    5653                                                } 
    5754                                        } 
     
    6461                if ($get_folders) { 
    6562                        $return = array(); 
    66                          
    6763                        // reverse the order of folders so subfolders come first  
    6864                        krsort($tmp_folders); 
    69                          
    7065                        $return['files'] = $tmp; 
    7166                        $return['folders'] = $tmp_folders; 
     
    7469                return $tmp; 
    7570        } 
    76  
     71} 
     72 
     73function 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 
     93function 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 
     136function 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 
     155function is_win() { 
     156        if (strtolower(substr(PHP_OS, 0, 3)) == 'win') { 
     157                return true; 
     158        } 
     159        return false; 
     160} 
     161 
     162function 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; 
    77169} 
    78170 
    79171function generate_pagination_view_menu() { 
    80         $url_query = "?"; 
     172        $url_query = '?'; 
    81173        $url_parts = parse_url($_SERVER['REQUEST_URI']); 
    82174        if (isset($url_parts['query'])) { 
    83175                // 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) { 
    85177                        parse_str($url_parts['query'], $query_parts); 
    86178                        foreach ($query_parts as $qkey => $qval) { 
    87                                 if ($qkey != "entries_per_page" && $qkey != "plog_page") { 
    88                                         $url_query .= $qkey."=".$qval."&amp;"; 
     179                                if ($qkey != 'entries_per_page' && $qkey != 'plog_page') { 
     180                                        $url_query .= $qkey.'='.$qval.'&amp;'; 
    89181                                } 
    90182                        } 
    91183                } else { 
    92                         $url_query .= $url_parts['query']."&amp;"; 
    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('&', '&amp;', $url_parts['query']).'&amp;'; 
     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">'; 
    101193        foreach ($possible_values as $key => $value) { 
    102194                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>'; 
    104196                } 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>"; 
    111203        return $output; 
    112204} 
    113205 
    114 function add_picture($album_id,$tmpname,$filename,$caption,$desc) { 
     206function add_picture($album_id, $tmpname, $filename, $caption, $desc, $allow_comm = 1) { 
    115207        global $config; 
    116208 
    117         $filename_parts = explode(".",strrev($filename),2); 
     209        $filename_parts = explode('.', strrev($filename), 2); 
    118210        $filename_base = strrev($filename_parts[1]); 
    119211        $filename_ext = strrev($filename_parts[0]); 
     
    130222 
    131223        // now get the name of the collection 
    132  
    133224        $sql = "SELECT c.path AS collection_path, c.id AS collection_id, 
    134225                        a.path AS album_path, a.id AS album_id 
    135                         FROM ".TABLE_PREFIX."albums a, ".TABLE_PREFIX."collections c 
     226                        FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 
    136227                        WHERE c.id = a.parent_id AND a.id = '$album_id'"; 
    137228 
     
    145236        } 
    146237 
    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 name 
     238        $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 
    159250        $final_fqfn = $config['basedir'].'plog-content/images/'.$create_path.'/'.$final_filename; 
    160251 
    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>'); 
    163254                return $result; 
    164255        } 
    165256 
    166257        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        } 
    244344 
    245345        return $result; 
    246 }; 
     346} 
    247347 
    248348function update_picture($id, $caption, $allow_comments, $description) { 
     
    251351        $description = mysql_real_escape_string($description); 
    252352        $allow_comments = intval($allow_comments); 
    253         $query = "UPDATE ".TABLE_PREFIX."pictures SET 
     353        $query = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET 
    254354                        caption = '$caption', 
    255355                        description = '$description', 
     
    265365 
    266366function 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)) { 
    269369                return array('errors' => plog_tr('Invalid action')); 
    270         }; 
    271  
    272         $errors = $output = ""; 
     370        } 
     371 
     372        $errors = $output = ''; 
    273373 
    274374        $picture_id = intval($picture_id); 
    275375        $value = mysql_real_escape_string(trim($value)); 
    276376 
    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'"; 
    278378 
    279379        $result = mysql_query($query); 
     
    281381                return array('output' => plog_tr('You have successfully modified the selected picture.')); 
    282382        } 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 
     388function move_picture($pic_id, $to_album) { 
    289389        global $config; 
    290390        // we need the parent_id from the album we're changing to 
     
    292392        $pic_id = intval($pic_id); 
    293393 
    294         $query = "SELECT * FROM ".TABLE_PREFIX."albums WHERE `id` = '".$to_album."'"; 
     394        $query = "SELECT * FROM ".PLOGGER_TABLE_PREFIX."albums WHERE `id` = '".$to_album."'"; 
    295395        $result = run_query($query); 
    296396        $row = mysql_fetch_assoc($result); 
    297397 
    298398        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>')); 
    300400        } 
    301401 
     
    306406 
    307407        $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        } 
    308412        $album = get_album_by_id($to_album); 
    309413 
    310414        $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); 
    314418        $filename_base = strrev($filename_parts[1]); 
    315419        $filename_ext = strrev($filename_parts[0]); 
     
    317421 
    318422        $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.')'; 
    321425        } 
    322426 
    323427        // 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; 
    325429        $final_fqfn = $config['basedir'].'plog-content/images/'.$picture_path; 
    326430 
    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); 
    329451        } 
    330452 
    331453        // update database 
    332         $sql = "UPDATE ".TABLE_PREFIX."pictures SET 
     454        $sql = "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET 
    333455                        path = '".mysql_real_escape_string($picture_path)."', 
    334456                        parent_album = '".$to_album."', 
     
    342464 
    343465function delete_picture($del_id) { 
    344         global $config; 
     466        global $config, $thumbnail_config; 
    345467        $del_id = intval($del_id); 
    346         global $thumbnail_config; 
    347468        $picture = get_picture_by_id($del_id); 
    348469        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']."'"; 
    351484                run_query($query); 
    352485 
    353486                // 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']."'"; 
    355488                run_query($query); 
    356489 
    357490                // 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']); 
    359492                // 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'])); 
    361494                $basename = SmartStripSlashes(basename($picture['path'])); 
    362495                if ($relative_path == $config['basedir']) { 
     
    364497                                $thumbpath = $config['basedir'].'plog-content/thumbs/'.$tval['filename_prefix'].$picture['id'].'-'.$basename; 
    365498                                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                        } 
    371503                        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                        } 
    378508                } 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                } 
    381511        } 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} 
    385519 
    386520function add_collection($collection_name, $description) { 
    387521        global $config; 
    388         $output = $errors = ""; 
     522        $output = $errors = ''; 
    389523        $id = 0; 
    390524        $collection_name = trim(SmartStripSlashes($collection_name)); 
    391525        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.')); 
    393527        } 
    394528 
    395529        $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 usable 
    398         // anyway 
    399         $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; 
    400534 
    401535        // do not allow collections with duplicate names, otherwise mod_rewritten links will start 
     
    404538                // if there is already a directory, check to see if it's in the database 
    405539                $collection_data = get_collection_by_name($collection_name); 
    406                 if ($collection_data){ 
     540                if ($collection_data) { 
    407541                        // 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 { 
    410544                        // it's not in the database so attempt to delete the directory 
    411                         if (!@rmdir($create_path)){ 
     545                        if (!kill_dir($create_path)) { 
    412546                                // 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>')); 
    414548                        } 
    415549                } 
     
    417551 
    418552        // 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>'); 
    421555        } else { 
    422556                $sql_name = mysql_real_escape_string($collection_name); 
    423557                $description = mysql_real_escape_string($description); 
    424558                $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')"; 
    426560                $result = run_query($query); 
    427561                $id = mysql_insert_id(); 
    428562 
    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>'); 
    430564        } 
    431565 
     
    434568        // as it needs 
    435569        $result = array( 
    436                 "output" => $output, 
    437                 "errors" => $errors, 
    438                 "id" => $id, 
     570                'output' => $output, 
     571                'errors' => $errors, 
     572                'id' => $id, 
    439573        ); 
    440574        return $result; 
     
    442576} 
    443577 
    444 function update_collection($collection_id,$name,$description,$thumbnail_id = 0) { 
     578function update_collection($collection_id, $name, $description, $thumbnail_id = 0) { 
    445579        global $config; 
    446580 
    447         $errors = $output = ""; 
     581        $errors = $output = ''; 
    448582 
    449583        $name = trim(SmartStripSlashes($name)); 
    450584        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.')); 
    452586        } 
    453587 
    454588        $target_name = strtolower(sanitize_filename($name)); 
    455589 
    456         $errors = $output = ""; 
     590        $errors = $output = ''; 
    457591 
    458592        $collection_id = intval($collection_id); 
     
    464598        // rename the directory 
    465599        // first, get the collection name of our source collection 
    466         $sql = "SELECT c.path as collection_path,name 
    467                         FROM ".TABLE_PREFIX."collections c 
     600        $sql = "SELECT c.path as collection_path, name 
     601                        FROM ".PLOGGER_TABLE_PREFIX."collections c 
    468602                        WHERE c.id = '$collection_id'"; 
    469603 
     
    471605        $row = mysql_fetch_assoc($result); 
    472606 
    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 instance 
     607        $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 
    478612        if ($source_path != $target_path) { 
    479613                // do not allow collections with duplicate names, otherwise mod_rewritten links will start 
     
    482616                        // if there is already a directory, check to see if it's in the database 
    483617                        $collection_data = get_collection_by_name($name); 
    484                         if ($collection_data){ 
     618                        if ($collection_data) { 
    485619                                // 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 { 
    488622                                // it's not in the database so attempt to delete the directory 
    489                                 if (!@rmdir($target_path)){ 
     623                                if (!kill_dir($target_path)) { 
    490624                                        // 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>')); 
    492626                                } 
    493627                        } 
     
    495629 
    496630                // 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>')); 
    499633                } 
    500634        } 
     
    502636        $target_name = mysql_real_escape_string($target_name); 
    503637 
    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'"; 
    505639        $result = mysql_query($query); 
    506640        if (!$result) { 
    507                 return array("errors" => mysql_error()); 
     641                return array('errors' => mysql_error()); 
    508642        } 
    509643 
     
    514648        // update the path field for all pictures within that collection 
    515649        // 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_path 
    517                 FROM ".TABLE_PREFIX."albums a, ".TABLE_PREFIX."pictures p, ".TABLE_PREFIX."collections c 
     650        $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 
    518652                WHERE p.parent_album = a.id AND p.parent_collection = c.id AND p.parent_collection = '$collection_id'"; 
    519653 
     
    525659                $album_path = $row['album_path']; 
    526660 
    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)); 
    528662 
    529663                // 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]'"; 
    531665                mysql_query($sql) or ($output .= mysql_error()); 
    532666        } 
    533667 
    534668        return array( 
    535                 "errors" => $errors, 
    536                 "output" => $output, 
     669                'errors' => $errors, 
     670                'output' => $output, 
    537671        ); 
    538672} 
    539673 
    540674function 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)) { 
    543677                return array('errors' => plog_tr('Invalid action')); 
    544         }; 
    545  
    546         $errors = $output = ""; 
     678        } 
     679 
     680        $errors = $output = ''; 
    547681 
    548682        $collection_id = intval($collection_id); 
    549683        $value = mysql_real_escape_string(trim($value)); 
    550684 
    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'"; 
    552686 
    553687        $result = mysql_query($query); 
     
    555689                return array('output' => plog_tr('You have successfully modified the selected collection.')); 
    556690        } else { 
    557                 return array('errors' => plog_tr('Could not modify selected collection')); 
     691                return array('errors' => plog_tr('Could not modify selected collection.')); 
    558692        } 
    559693 
     
    563697        global $config; 
    564698        $sql = "SELECT c.name AS collection_name, c.path AS collection_path, c.id AS collection_id 
    565                 FROM ".TABLE_PREFIX."collections c 
     699                FROM ".PLOGGER_TABLE_PREFIX."collections c 
    566700                WHERE c.id = '$del_id'"; 
    567701 
     
    570704 
    571705        if (!$collection) { 
    572                 return array('errors' => plog_tr('No such collection')); 
     706                return array('errors' => plog_tr('No such collection.')); 
    573707        } 
    574708 
    575709        // 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']; 
    577711        $result = run_query($sql); 
    578712        while ($row = mysql_fetch_assoc($result)) { 
     
    581715 
    582716        // 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']."'"; 
    584718        run_query($query); 
    585719 
     
    587721        // if there are then .. how did they get there? Probably not through plogger and in this case do we  
    588722        // 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; 
    592726        // 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)) { 
    597729                        return array('errors' => plog_tr('Collection directory still contains files after all albums have been deleted.')); 
    598730                } 
    599  
    600731        } 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.')); 
    602733        } 
    603734        return array(); 
     
    606737function add_album($album_name, $description, $pid) { 
    607738        global $config; 
    608         $output = $errors = ""; 
     739        $output = $errors = ''; 
    609740        $id = 0; 
    610741        $album_name = trim(SmartStripSlashes($album_name)); 
    611742        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.')); 
    613744        } 
    614745        // 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'"; 
    616747 
    617748        $result = run_query($query); 
     
    620751        // this shouldn't happen 
    621752        if (empty($row)) { 
    622                 return array("errors" => plog_tr("No such collection")); 
     753                return array('errors' => plog_tr('No such collection.')); 
    623754        } 
    624755 
     
    627758        // first try to create the directory to hold the images, if that fails, then the album 
    628759        // 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; 
    630761 
    631762        // 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)) { 
    633764                // if there is already a directory, check to see if it's in the database 
    634765                $album_data = get_album_by_name($album_name, $pid); 
    635766                if ($album_data) { 
    636767                        // 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>'))); 
    638769                } else { 
    639770                        // it's not in the database so attempt to delete the directory 
    640                         if (!@rmdir($create_path)){ 
     771                        if (!kill_dir($create_path)) { 
    641772                                // 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>')); 
    643774                        } 
    644775                } 
    645776        } 
    646777 
    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>'); 
    649780        } else { 
    650781                $sql_name = mysql_real_escape_string($album_name); 
    651782                $description = mysql_real_escape_string($description); 
    652783                $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')"; 
    654785                $result = run_query($query); 
    655786                $id = mysql_insert_id(); 
    656787 
    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>'); 
    658789        } 
    659790        // caller can check the value of id, if it is zero, then album creation failed 
     
    661792        // as it needs 
    662793        $result = array( 
    663                 "output" => $output, 
    664                 "errors" => $errors, 
    665                 "id" => $id, 
     794                'output' => $output, 
     795                'errors' => $errors, 
     796                'id' => $id, 
    666797        ); 
    667798        return $result; 
     
    670801function update_album($album_id, $name, $description, $thumbnail_id = 0) { 
    671802        global $config; 
    672         $errors = $output = ""; 
    673          
     803        $errors = $output = ''; 
     804 
    674805        $album_id = intval($album_id); 
    675806        $thumbnail_id = intval($thumbnail_id); 
     
    677808        $description = mysql_real_escape_string(SmartStripSlashes($description)); 
    678809        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.')); 
    680811        } 
    681812 
    682813        $target_name = strtolower(sanitize_filename(SmartStripSlashes($name))); 
    683814 
    684          // first, get the album name and collection name of our source album 
     815        // first, get the album name and collection name of our source album 
    685816        $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 c 
     817                        FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 
    687818                        WHERE c.id = a.parent_id AND a.id = ".$album_id; 
    688819 
     
    691822 
    692823        $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; 
    697828 
    698829        // check for self-re-naming album instance 
     
    704835                        if ($album_data) { 
    705836                                // 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>')); 
    707838                        } else { 
    708839                                // it's not in the database so attempt to delete the directory 
    709                                 if (!@rmdir($target_path)){ 
     840                                if (!kill_dir($target_path)) { 
    710841                                        // 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>')); 
    712843                                } 
    713844                        } 
     
    715846 
    716847                // perform the rename on the directory 
    717                 if (!rename($source_path, $target_path)) 
    718                 { 
     848                if (!move_this($source_path, $target_path)) { 
    719849                        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>')); 
    721851                } 
    722852        } 
     
    725855 
    726856        // proceed only if rename succeeded 
    727         $query = "UPDATE ".TABLE_PREFIX."albums SET 
     857        $query = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET 
    728858                        name = '$name', 
    729859                        description = '$description', 
    730860                        thumbnail_id = '$thumbnail_id', 
    731861                        path = '$target_name' 
    732                  WHERE id='$album_id'"; 
     862                WHERE id='$album_id'"; 
    733863 
    734864        $result = mysql_query($query); 
    735865        if (!$result) { 
    736                 return array("errors" => mysql_error()); 
     866                return array('errors' => mysql_error()); 
    737867        } 
    738868 
     
    740870 
    741871        // 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_name 
    743                         FROM ".TABLE_PREFIX."albums a, ".TABLE_PREFIX."pictures p, ".TABLE_PREFIX."collections c 
     872        $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 
    744874                        WHERE p.parent_album = a.id AND p.parent_collection = c.id AND p.parent_album = '$album_id'"; 
    745875 
     
    749879 
    750880                $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)); 
    752882 
    753883                // 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]'"; 
    755885                mysql_query($sql) or ($errors .= mysql_error()); 
    756886        } 
    757887 
    758888        return array( 
    759                 "errors" => $errors, 
    760                 "output" => $output, 
     889                'errors' => $errors, 
     890                'output' => $output, 
    761891        ); 
    762892} 
    763893 
    764894function 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)) { 
    767897                return array('errors' => plog_tr('Invalid action')); 
    768         }; 
     898        } 
    769899 
    770900        $value = mysql_real_escape_string(trim(SmartStripSlashes($value))); 
    771         $errors = $output = ""; 
     901        $errors = $output = ''; 
    772902        $album_id = intval($album_id); 
    773903 
    774904        // proceed only if rename succeeded 
    775         $query = "UPDATE ".TABLE_PREFIX."albums SET 
     905        $query = "UPDATE ".PLOGGER_TABLE_PREFIX."albums SET 
    776906                        $field = '$value' 
    777                  WHERE id='$album_id'"; 
     907                WHERE id='$album_id'"; 
    778908 
    779909        $result = mysql_query($query); 
     
    782912                return array('output' => plog_tr('You have successfully modified the selected album.')); 
    783913        } 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        } 
    786916} 
    787917 
     
    797927        $to_collection = intval($to_collection); 
    798928 
    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 
    801935                        WHERE c.id = a.parent_id AND a.id = '$album_id'"; 
    802936 
     
    804938        $row = mysql_fetch_assoc($result); 
    805939 
    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        } 
    808949 
    809950        // 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'"; 
    813952 
    814953        $result = run_query($sql); 
    815954        $row = mysql_fetch_assoc($result); 
    816955 
    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.'/'; 
    820959 
    821960        // 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)) { 
    823962                // if there is already a directory, check to see if it's in the database 
    824963                $album_data = get_album_by_name($source_album_name, $to_collection); 
    825964                if ($album_data) { 
    826965                        // 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>')); 
    828967                } else { 
    829968                        // it's not in the database so attempt to delete the directory 
    830                         if (!@rmdir($target_path)){ 
     969                        if (!kill_dir($target_path)) { 
    831970                                // 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>')); 
    833972                        } 
    834973                } 
     
    836975 
    837976        // 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        } 
    844980 
    845981        // now we need to update the database paths of all pictures within source album 
    846982        $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 c 
     983                FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."pictures p, ".PLOGGER_TABLE_PREFIX."collections c 
    848984                WHERE p.parent_album = a.id AND p.parent_collection = c.id AND p.parent_album = '$album_id'"; 
    849985 
    850986        $result = run_query($sql); 
     987        $pic_ids = array(); 
    851988 
    852989        while($row = mysql_fetch_assoc($result)) { 
    853990                $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 
    8641004                                parent_collection = '$to_collection', 
    8651005                                path = '$path_insert' 
     
    8681008        } 
    8691009 
     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 
    8701016        // 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'"; 
    8721018        $result = run_query($query); 
    8731019 
    8741020        // 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        } 
    8821027        return $res; 
    8831028} 
     
    8861031        global $config; 
    8871032        $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 c 
     1033                FROM ".PLOGGER_TABLE_PREFIX."albums a, ".PLOGGER_TABLE_PREFIX."collections c 
    8891034                WHERE c.id = a.parent_id AND a.id = '$del_id'"; 
    8901035 
     
    8971042 
    8981043        // 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']; 
    9001045        $result = run_query($sql); 
    9011046        while ($row = mysql_fetch_assoc($result)) { 
     
    9041049 
    9051050        // 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']."'"; 
    9071052        run_query($query); 
    9081053 
     
    9101055        // if there are then .. how did they get there? Probably not through plogger and in this case do we  
    9111056        // 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; 
    9161061        // 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)) { 
    9211064                        return array('errors' => plog_tr('Album directory still contains files after all pictures have been deleted.')); 
    9221065                } 
    9231066 
    9241067        } 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.')); 
    9261069        } 
    9271070        return array(); 
    9281071} 
    9291072 
    930 function update_comment($id,$author,$email,$url,$comment) { 
     1073function update_comment($id, $author, $email, $url, $comment) { 
    9311074        $id = intval($id); 
    9321075        $author = mysql_real_escape_string($author); 
     
    9351078        $comment = mysql_real_escape_string(trim($comment)); 
    9361079 
    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'"; 
    9391081        $result = mysql_query($query); 
    9401082        if ($result) { 
    9411083                return array('output' => plog_tr('You have successfully modified the selected comment.')); 
    9421084        } 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        } 
    9451087} 
    9461088 
    9471089function 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)) { 
    9501092                return array('errors' => plog_tr('Invalid action')); 
    951         }; 
     1093        } 
    9521094 
    9531095        $id = intval($id); 
    9541096        $value = mysql_real_escape_string($value); 
    9551097 
    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'"; 
    9571099        $result = mysql_query($query); 
    9581100        if ($result) { 
    9591101                return array('output' => plog_tr('You have successfully modified the selected comment.')); 
    9601102        } 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        } 
    9631105} 
    9641106 
    9651107function count_albums($parent_id = 0) { 
    9661108        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`"; 
    9681110        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'"; 
    9701112 
    9711113        $numresult = run_query($numquery); 
     
    9761118function count_collections() { 
    9771119 
    978         $numquery = "SELECT COUNT(*) AS `num_collections` FROM `".TABLE_PREFIX."collections`"; 
     1120        $numquery = "SELECT COUNT(*) AS `num_collections` FROM `".PLOGGER_TABLE_PREFIX."collections`"; 
    9791121 
    9801122        $numresult = run_query($numquery); 
     
    9851127function count_pictures($parent_id = 0) { 
    9861128        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`"; 
    9881130        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'"; 
    9901132 
    9911133        $numresult = run_query($numquery); 
     
    9941136} 
    9951137 
    996 function count_comments($parent_id = 0) { 
    997         if (!$parent_id) 
    998                 $numquery = "SELECT COUNT(*) AS `num_comments` FROM `".TABLE_PREFIX."comments`"; 
    999         else 
    1000                 $numquery = "SELECT COUNT(*) AS `num_comments` FROM `".TABLE_PREFIX."comments` WHERE parent_id = '$parent_id'"; 
     1138function 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        } 
    10011143 
    10021144        $numresult = run_query($numquery); 
     
    10081150        $output = ''; 
    10091151        $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'"; 
    10111153        $result = run_query($sql); 
    10121154        $comment = mysql_fetch_assoc($result); 
    1013         if (!is_array($comment)) 
    1014         { 
     1155        if (!is_array($comment)) { 
    10151156                // XXX: return an error message instead 
    10161157                return false; 
    10171158        } 
    1018         $query = ""; 
    1019         if (strpos($_SERVER['PHP_SELF'], "plog-manage") !== false) { 
    1020                 $query = "?level=comments&amp;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&amp;id='.$comment['parent_id']; 
     1162        } 
     1163 
     1164        $output .= "\n\t" . '<form class="edit width-700" action="'.$_SERVER['PHP_SELF'].$query.'" method="post">'; 
    10241165 
    10251166        // get the thumbnail 
    10261167        $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> 
    10421188                        <input type="hidden" name="pid" value="'.$comment['id'].'" /> 
    10431189                        <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"; 
    10481194                return $output; 
    10491195} 
    10501196 
    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  
     1197function 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 **/ 
     1207function 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         
    10711214        // create connection 
    1072         $ftpconnection = ftp_connect($ftpserver);  
     1215        $PLOGGER_FTP = ftp_connect($ftp_server);  
    10731216        // login to ftp server 
    1074         $ftpresult = ftp_login($ftpconnection, $ftpuser, $ftppass); 
     1217        $ftp_result = ftp_login($PLOGGER_FTP, $ftp_user, $ftp_pass); 
    10751218 
    10761219        // check if connection was made 
    1077         if ((!$ftpconnection) || (!$ftpresult)) { 
     1220        if ((!$PLOGGER_FTP) || (!$ftp_result)) { 
    10781221                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 
     1226function close_ftp() { 
     1227        global $PLOGGER_FTP; 
     1228         
     1229        if (isset($PLOGGER_FTP)) { 
     1230                ftp_close($PLOGGER_FTP); 
     1231        } 
     1232} 
     1233 
     1234function 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 
     1265function 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 
    10971287function 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); 
    11041294        if (!$allow) { 
    11051295                $cfg .= "deny from all\n"; 
     
    11071297        // read the file 
    11081298        global $config; 
    1109         $fpath = $config["basedir"] . "plog-content/images/.htaccess"; 
     1299        $fpath = $config['basedir'].'plog-content/images/.htaccess'; 
    11101300        $htaccess_lines = (is_file($fpath)) ? @file($fpath) : array(); 
    11111301 
    1112         $output = ""; 
     1302        $output = ''; 
    11131303        $configuration_placed = false; 
    11141304        $between_placeholders = false; 
     
    11171307                if ($placeholder_start == $tline) { 
    11181308                        $between_placeholders = true; 
    1119                         $output .= $line . $cfg; 
     1309                        $output .= $line.$cfg; 
    11201310                        $configuration_placed = true; 
    11211311                        continue; 
     
    11291319 
    11301320                $output .= $line; 
    1131         }; 
     1321        } 
    11321322 
    11331323        // no placeholders? append to the end 
    11341324        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'); 
    11391329        // write changes out if the file can be opened. 
    11401330        // XXX: perhaps plog-options.php should check whether settings can be written and warn the user if not? 
     
    11421332        if ($fh) { 
    11431333                $success = true; 
    1144                 fwrite($fh,$output); 
     1334                fwrite($fh, $output); 
    11451335                fclose($fh); 
    1146         }; 
     1336        } 
    11471337        return $success; 
    11481338} 
     
    11511341        global $config; 
    11521342 
    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); 
    11601350                if ($enable) { 
    1161                         if (empty($rewritebase)) 
    1162                         { 
    1163                                 $rewritebase = "/"; 
     1351                        if (empty($rewritebase)) { 
     1352                                $rewritebase = '/'; 
    11641353                        } 
    11651354                        $cfg .= "<IfModule mod_rewrite.c>\n"; 
    11661355                        $cfg .= "RewriteEngine on\n"; 
    1167                         $cfg .= "RewriteBase ".$rewritebase."\n"; 
     1356                        $cfg .= "RewriteBase $rewritebase\n"; 
    11681357                        $cfg .= "RewriteCond %{REQUEST_URI} !(\.|/\$)\n"; 
    11691358                        $cfg .= "RewriteRule ^.*\$ http://".parse_url($config['gallery_url'], PHP_URL_HOST)."%{REQUEST_URI}/ [R=301,L]\n"; 
     
    11781367                        $cfg .= "RewriteRule ^.*$ index.php?path=%{REQUEST_URI} [L]\n"; 
    11791368                        $cfg .= "</IfModule>\n"; 
    1180                 }; 
     1369                } 
    11811370                // read the file 
    11821371                global $config; 
    1183                 $fpath = $config["basedir"] . ".htaccess";  
     1372                $fpath = $config['basedir'].'.htaccess';  
    11841373                $htaccess_lines = @file($fpath); 
    11851374 
    1186                 $output = ""; 
     1375                $output = ''; 
    11871376                $configuration_placed = false; 
    11881377                $between_placeholders = false; 
     
    11911380                        if ($placeholder_start == $tline) { 
    11921381                                $between_placeholders = true; 
    1193                                 $output .= $line . $cfg; 
     1382                                $output .= $line.$cfg; 
    11941383                                $configuration_placed = true; 
    11951384                                continue; 
     
    12031392 
    12041393                        $output .= $line; 
    1205                 }; 
     1394                } 
    12061395 
    12071396                // no placeholders? append to the end 
    12081397                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'); 
    12131402                // write changes out if the file can be opened. 
    12141403                // XXX: perhaps plog-options.php should check whether settings can be written and warn the user if not? 
     
    12161405                if ($fh) { 
    12171406                        $success = true; 
    1218                         fwrite($fh,$output); 
     1407                        fwrite($fh, $output); 
    12191408                        fclose($fh); 
    1220                 }; 
     1409                } 
    12211410                return $success; 
    12221411        } else { 
     
    12251414} 
    12261415 
     1416function 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 
    12271433// 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 directory 
     1434// could be used to point to directory or filenames outside the Plogger directory 
    12291435function is_valid_directory($str)  
    12301436{ 
    1231         // allow only alfanumeric characters, hyphen, [, ], dot, apostrophe  and space in collection names 
    1232         return !preg_match("/[^\w|\.|'|\-|\[|\] ]/",$str); 
     1437        // allow only alfanumeric characters, hyphen, [, ], dot, apostrophe and space in collection names 
     1438        return !preg_match("/[^\w|\.|'|\-|\[|\] ]/", $str); 
    12331439} 
    12341440 
     
    12361442// so plugins could add new fields to all those forms. 
    12371443function 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"; 
    12531461        return $output; 
    12541462} 
     
    12561464function plog_add_album_form($parent_collection) { 
    12571465        $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&amp;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; 
    12751485} 
    12761486 
     
    12791489        $output = ''; 
    12801490        $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">'; 
    12821493        $collection = get_collection_by_id($collection_id); 
    12831494 
    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"; 
    12951504 
    12961505        $result = run_query($sql); 
    12971506        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'])); 
    13031513                $images .= "</option>"; 
    1304         }; 
     1514        } 
    13051515 
    13061516        $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> 
    13161532                                <input type="hidden" name="pid" value="'.$collection_id.'" /> 
    13171533                                <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"; 
    13241538                return $output; 
    13251539} 
     
    13311545 
    13321546        $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&amp;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']) ? '&amp;plog_page='.intval($_GET['plog_page']) : ''; 
     1550 
     1551        $output = "\n\t\t" . '<form class="edit width-700" action="'.$_SERVER['PHP_SELF'] .'?level=albums&amp;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."'"; 
    13401556 
    13411557        $result = run_query($sql); 
    13421558        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'])); 
    13481563                        $images .= "</option>"; 
    1349                 }; 
     1564                } 
    13501565 
    13511566                $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.'" /> 
    13621583                                <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"; 
    13681588                return $output; 
    13691589} 
    13701590 
    1371 function plog_picture_manager($id,$from,$limit) { 
    1372         global $config; 
     1591function plog_picture_manager($id, $from, $limit) { 
     1592        global $config, $empty; 
    13731593        $output = ''; 
    13741594 
    13751595        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' 
    13821602        )); 
    13831603 
     
    13851605        if (plogger_has_pictures()) { 
    13861606                $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"; 
    13891609 
    13901610                while(plogger_has_pictures()) { 
    13911611                        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>'; 
    13961617        } 
    13971618 
     
    14071628 
    14081629        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') : '&nbsp;'; 
     1631                $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> 
    14101632                        <col style="width: 15px;" /> 
    14111633                        <tr class="header"> 
    1412                                 <th class="table-header-left">&nbsp;</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> 
    14191640                        </tr>'; 
    14201641                $counter = 0; 
     1642 
    14211643                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'; 
    14241646                        $counter++; 
    14251647                        plogger_load_picture(); 
     1648 
    14261649                        $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>'; 
    14301652                        $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&amp;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&amp;id=' . $id; 
    1440                         if (isset($_GET["entries_per_page"])) $output .= '&amp;entries_per_page=' . intval($_GET["entries_per_page"]); 
    1441                         if (isset($_GET["plog_page"])) $output .= '&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="?action=move-delete&amp;selected%5B%5D=' . $id . '&amp;level=pictures&amp;delete_checked=1&amp;id='.$parent_id; 
    1446                         if (isset($_GET['plog_page'])) $output .= '&amp;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&amp;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 = '&nbsp;'; 
     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&amp;id='.$id; 
     1669                        if (isset($_GET['entries_per_page'])) $output .= '&amp;entries_per_page='.intval($_GET['entries_per_page']); 
     1670                        if (isset($_GET['plog_page'])) $output .= '&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="?action=move-delete&amp;selected%5B%5D='.$id.'&amp;level=pictures&amp;delete_checked=1&amp;id='.$parent_id; 
     1674                        if (isset($_GET['plog_page'])) $output .= '&amp;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 
    14511679                $output .= "\n\t\t\t" . '<tr class="footer"> 
    1452                                 <td colspan="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> 
    14531681                        </tr> 
    14541682                </table>' . "\n"; 
    14551683        } 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        } 
    14581687        return $output; 
    14591688} 
    14601689 
    1461 function plog_album_manager($id,$from,$limit) { 
    1462         global $config; 
     1690function plog_album_manager($id, $from, $limit) { 
     1691        global $config, $empty; 
    14631692        $output = ''; 
    14641693 
     
    14751704        if (plogger_has_albums()) { 
    14761705                $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"; 
    14801708                while(plogger_has_albums()) { 
    14811709                        plogger_load_album(); 
    14821710                        // 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>'; 
    14871715        } 
    14881716 
     
    14971725 
    14981726        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;" /> 
    15021729                        <tr class="header"> 
    1503                                 <th class="table-header-left">&nbsp;</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> 
    15071734                        </tr>'; 
    15081735                $counter = 0; 
     
    15111738                        plogger_load_album(); 
    15121739                        $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'; 
    15151742                        $counter++; 
    15161743 
    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&amp;id='.$id.'"><span id="album-name-'.plogger_get_album_id().'"><strong>'.plogger_get_album_name().'</strong></span></a> &#8212; ' . 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&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=move-delete&amp;selected%5B%5D='.$id.'&amp;level=albums&amp;delete_checked=1&amp;id='.$_REQUEST['id']; 
    1523                         if (isset($_GET['plog_page'])) { $output .= '&amp;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&amp;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'])) ? '&amp;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&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=move-delete&amp;selected%5B%5D='.$id.'&amp;level=albums&amp;delete_checked=1&amp;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> 
    15301758                        </tr> 
    1531                 </table>'."\n"; 
     1759                </table>' . "\n"; 
    15321760        } 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; 
    15341763        } 
    15351764        return $output; 
    1536  
    1537 } 
    1538  
    1539 function plog_collection_manager($from,$limit) { 
    1540         global $config; 
     1765} 
     1766 
     1767function plog_collection_manager($from, $limit) { 
     1768        global $config, $empty; 
    15411769        $output = ''; 
    15421770 
     
    15521780        if (plogger_has_collections()) { 
    15531781                $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"; 
    15571784                while(plogger_has_collections()) { 
    15581785                        plogger_load_collection(); 
    15591786                        // 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>'; 
    15641791        } 
    15651792 
     
    15731800 
    15741801        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"> 
    15761803                        <col style="width: 15px;" /> 
    15771804                        <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> 
    15821809                        </tr>'; 
    15831810                $counter = 0; 
     1811 
    15841812                while(plogger_has_collections()) { 
    15851813                        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'; 
    15881816                        $counter++; 
     1817 
    15891818                        $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&amp;id=" .$id . "'><span id='collection-name-" . plogger_get_collection_id()."'><strong>".plogger_get_collection_name()."</strong></span></a> &#8212; " . 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&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="?action=move-delete&amp;selected%5B%5D=' . $id . '&amp;level=collections&amp;delete_checked=1&amp;'; 
     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&amp;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&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="?action=move-delete&amp;selected%5B%5D='.$id.'&amp;level=collections&amp;delete_checked=1&amp;'; 
    15961826                        if (isset($_REQUEST['id'])) { $output .= 'id='.intval($_REQUEST['id']); } 
    1597                         if (isset($_GET['plog_page'])) { $output .= '&amp;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 .= '&amp;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 
    16011832                $output .= "\n\t\t\t" . '<tr class="footer"> 
    1602                                 <td colspan="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> 
    16031834                        </tr> 
    16041835                </table>' . "\n"; 
    16051836        } 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; 
    16071839        } 
    16081840        return $output; 
    16091841} 
    16101842 
    1611 function plog_comment_manager($id,$from,$limit) { 
    1612         global $config; 
    1613  
     1843function plog_comment_manager($id, $from, $limit) { 
     1844        global $config, $empty; 
    16141845        $output = ''; 
    16151846 
    16161847        plogger_init_picture(array( 
    1617                         'id' => $id, 
     1848                'id' => $id, 
     1849                'from' => $from, 
     1850                'limit' => $limit 
    16181851        )); 
    16191852 
     
    16211854        if (plogger_picture_has_comments()) { 
    16221855                $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() {'; 
    16261858                while(plogger_picture_has_comments()) { 
    16271859                        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>'; 
    16361869        } 
    16371870 
    16381871        plogger_init_picture(array( 
    1639                         'id' => $id, 
     1872                'id' => $id, 
     1873                'from' => $from, 
     1874                'limit' => $limit 
    16401875        )); 
    16411876 
    16421877        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">&nbsp;</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>'; 
    16541888                $counter = 0; 
     1889 
    16551890                while(plogger_picture_has_comments()) { 
    16561891                        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++; 
    16591895 
    16601896                        $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&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="?action=delete-comment&amp;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&amp;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 .= '&nbsp;&nbsp;&nbsp;<a href="?action=delete-comment&amp;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> 
    16761918                </table>' . "\n"; 
    16771919        } 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        } 
    16811923        return $output; 
    16821924} 
    16831925 
    16841926function generate_ajax_picture_editing_init() { 
    1685  
    16861927        $output = '<script type="text/javascript">'; 
    16871928} 
     1929 
     1930function 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 
     1937function 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 
    16881982?> 
  • trunk/plog-admin/plog-admin.php

    r588 r590  
    11<?php 
    2 header("Content-Type: text/html; charset=utf-8"); 
     2header('Content-Type: text/html; charset=utf-8'); 
    33global $inHead; 
    44 
    5 //session_register ("entries_per_page"); 
    6  
    75// 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"); 
     6require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
    107 
    118// Login/logout/reset password functions 
     
    1411                case 'log_in': 
    1512                        // 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'])) { 
    1714                                $_SESSION['plogger_logged_in'] = true; 
    1815                                // clear out the activation key on login if set 
    1916                                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` = ''"; 
    2218                                        $result = run_query($query); 
    2319                                } 
     
    2521                                // handle error for wrong username / password 
    2622                                $redirect = basename($_SERVER['PHP_SELF']); 
    27                                 header("Location: index.php?loginerror&r=$redirect"); 
     23                                header('Location: index.php?loginerror&r='.$redirect); 
    2824                                exit; 
    2925                        } 
     
    3329                        $_SESSION = array(); 
    3430                        session_destroy(); 
    35                         header("Location: index.php?loggedout"); 
     31                        header('Location: index.php?loggedout'); 
    3632                        exit; 
    3733                case 'password_reset': 
     
    4137                        // handle default password reset error: invalid usename or email address 
    4238                        $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'])) { 
    4440                                // change output to handle email sent success message 
    4541                                $reset_output = 'checkemail=1'; 
     
    4945                                if (!@mail( $config['admin_email'], 
    5046                                                                                '[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". 
    5551                                                                                $config['gallery_url'].'plog-admin/plog-admin.php?action=password_reset&key='.$key, 
    5652                                                                                'From: Plogger <noreply@'.$from.'>' 
     
    6056                                } else { 
    6157                                        // 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}'"; 
    6459                                        $result = run_query($query); 
    6560                                } 
     
    7368                                        ini_set('sendmail_from', 'noreply@'.$from); // set for windows machines 
    7469                                        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                                                                        )) { 
    8378                                                // change output to handle error with mail() function 
    8479                                                $reset_output = 'reseterror=3'; 
    8580                                        } else { 
    8681                                                // 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}')"; 
    8983                                                $result = run_query($query); 
    9084                                        } 
     
    9488                                } 
    9589                        } 
    96                         header("Location: index.php?$reset_output"); 
     90                        header('Location: index.php?'.$reset_output); 
    9791                        exit; 
    9892        } 
    9993} 
    10094 
    101 if (!isset($_SESSION['plogger_logged_in']) || $_SESSION['plogger_logged_in'] !== true){ 
     95// load the admin functions only after the login has been determined 
     96require_once(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 
     97 
     98if (!isset($_SESSION['plogger_logged_in']) || $_SESSION['plogger_logged_in'] !== true) { 
    10299        $redirect = basename($_SERVER['PHP_SELF']); 
    103         header("Location: index.php?r=$redirect"); 
     100        header('Location: index.php?r='.$redirect); 
    104101        exit; 
    105102} 
    106103 
    107104// Display admin tabs 
    108 function display($string, $current){ 
    109  
     105function display($string, $current) { 
    110106        global $inHead; 
    111107        global $config; 
    112108 
    113109        $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')); 
    123120        // get the accesskey from the localization - it should be surrounded by <em> tags 
    124121        foreach($tabs as $key => $data) { 
    125                 if (preg_match("|<em>(.*)</em>|",$data["caption"],$matches)) { 
     122                if (preg_match('|<em>(.*)</em>|', $data['caption'], $matches)) { 
    126123                        $tabs[$key]['accesskey'] = $matches[1]; 
    127                 }; 
    128  
    129         }; 
     124                } 
     125        } 
    130126 
    131127$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     
    133129<html xmlns="http://www.w3.org/1999/xhtml"> 
    134130<head> 
    135         <title>Plogger Administration</title> 
     131        <title>Plogger '.plog_tr('Gallery Admin').'</title> 
    136132        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    137133        <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" /> 
    139134        <link rel="stylesheet" href="'.$config['gallery_url'].'plog-admin/css/lightbox.css" type="text/css" media="all" /> 
    140135        <script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/prototype.js"></script> 
     
    147142 
    148143<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'].'&nbsp;&nbsp;&nbsp;['.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;">&nbsp;</div> 
    151157 
    152158        <div id="tab-nav"> 
     
    159165                        if (!empty($data['onclick'])) $output .= ' onclick="'.$data['onclick'].'"'; 
    160166                        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                } 
    164169                $output .= ' 
    165170                </ul> 
    166171        </div><!-- /tab-nav --> 
     172 
    167173</div><!-- /header --> 
    168174 
     
    179185} 
    180186 
    181 $output .= "\n\n".'</body> 
     187$output .= "\n\n" . '</body> 
    182188</html>'; 
    183189 
    184190echo $output; 
     191close_db(); 
     192close_ftp(); 
    185193exit; 
    186194} 
  • trunk/plog-admin/plog-feedback.php

    r588 r590  
    11<?php 
    22// 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"); 
     3require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     4require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
    55 
    66global $inHead; 
     
    88$inHead = '<script type="text/javascript" src="'.$config['gallery_url'].'plog-admin/js/ajax_editing.js"></script>'; 
    99 
    10 $output = "\n\t" . '<h1>'. plog_tr("Manage Feedback") . '</h1>' . "\n"; 
     10$output = "\n\t" . '<h1>'.plog_tr('Manage Feedback').'</h1>' . "\n"; 
    1111 
    1212if (isset($_REQUEST['action'])) { 
    13         if ($_REQUEST['action'] == "approve-delete") { 
     13        if ($_REQUEST['action'] == 'approve-delete') { 
    1414                // here we will determine if we need to perform an approved or delete action. 
    1515                $num_items = 0; 
     
    1919                        if (isset($_REQUEST['selected'])) { 
    2020                                foreach($_REQUEST['selected'] as $del_id) { 
    21                                         // lets build the query string 
     21                                        // let's build the query string 
    2222                                        $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."'"; 
    2524                                        $result = run_query($query); 
    26  
    2725                                        $num_items++; 
    2826                                } 
    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 
    3535                } else if (isset($_REQUEST['approve_checked'])) { 
    3636                        // set the approval bit to 1 for all selected comments 
    37  
    3837                        if (isset($_REQUEST['selected'])) { 
    3938                                foreach($_REQUEST['selected'] as $appr_id) { 
    40                                         // lets build the query string 
     39                                        // let's build the query string 
    4140                                        $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."'"; 
    4442                                        $result = run_query($query); 
    45  
    4643                                        $num_items++; 
    4744                                } 
    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') { 
    5555                // show the edit form 
    5656                $output .= plog_edit_comment_form($_REQUEST['pid']); 
    5757                $edit_page = 1; 
    58         } else if ($_REQUEST['action'] == "update-comment") { 
     58 
     59        } else if ($_REQUEST['action'] == 'update-comment') { 
    5960                if (!isset($_REQUEST['cancel'])) { 
    6061                        // 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']); 
    6263                        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"; 
    6465                        } 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"; 
    6667                        } 
    6768                } 
     
    7071 
    7172if (!isset($edit_page)) { 
    72         // lets iterate through all the content and build a table 
     73        // let's iterate through all the content and build a table 
    7374        // set the default level if nothing is specified 
    7475 
    7576        // handle pagination 
    76         // lets determine the limit filter based on current page and number of results per page 
     77        // let's determine the limit filter based on current page and number of results per page 
    7778        if (isset($_REQUEST['entries_per_page'])) { 
    7879                $_SESSION['entries_per_page'] = $_REQUEST['entries_per_page']; 
    79         } else if (!isset($_SESSION['entries_per_page'])){ 
     80        } else if (!isset($_SESSION['entries_per_page'])) { 
    8081                $_SESSION['entries_per_page'] = 20; 
    8182        } 
     
    8990        $limit = "LIMIT ".$first_item.", ".$_SESSION['entries_per_page']; 
    9091 
    91         // lets generate the pagination menu as well 
    92         $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"; 
    9394        $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"; 
    9798        $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'); 
    99100 
    100101        // filter based on whether were looking at approved comments or unmoderated comments 
     
    106107                $moderate = 0; 
    107108        } 
    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">'; 
    109110 
    110111        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']); 
    112113        } 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)); 
    114115        } 
    115116        $pagination_menu = "\n\t\t" . '<div class="pagination">'.$pagination_menu.'</div>'; 
    116117 
    117118        // 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; 
    119120        $result = run_query($query); 
    120  
    121121        if (mysql_num_rows($result) > 0) { 
    122122                $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"; 
    126125                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']."'); 
    128127                                makeEditable('comment-author-".$row['id']."'); 
    129128                                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; 
    138136        $result = run_query($query); 
    139137 
    140138        $empty = 0; 
    141         $allowedCommentKeys = array("unix_date", "author", "email", "url", "comment"); 
     139 
    142140        if ($result) { 
    143141                if (mysql_num_rows($result) == 0) { 
    144142                        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"; 
    146144                        } 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"; 
    148146                        } 
    149147                        $empty = 1; 
     
    151149                if ($approved) { 
    152150                        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>'; 
    154153                        } 
    155154                } 
    156155 
    157156                $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                } 
    164164 
    165165                while($row = mysql_fetch_assoc($result)) { 
     
    167167                        if ($counter == 0) { 
    168168                                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                                        } 
    172173                                } 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"> 
    179181                        <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> 
    190188                        </tr>'; 
    191189                        } 
    192190 
     191                        foreach ($row as $key => $value) { 
     192                                $value = SmartStripSlashes(htmlspecialchars($value)); 
     193                                if ($value == '') { 
     194                                        $row[$key] = '&nbsp;'; 
     195                                } 
     196                        } 
     197 
    193198                        if ($counter%2 == 0) { 
    194                                 $table_row_color = "color-1"; 
     199                                $table_row_color = 'color-1'; 
    195200                        } else { 
    196                                 $table_row_color = "color-2"; 
     201                                $table_row_color = 'color-2'; 
    197202                        } 
    198203 
    199204                        // 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.'">'; 
    201206 
    202207                        // 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>'; 
    204209 
    205210                        // give the row a thumbnail, we need to look up the parent picture for the comment 
     
    208213 
    209214                        // 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 = '&nbsp;'; 
    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 
    238235                        $query = "?action=edit-comment&amp;pid=$row[id]"; 
    239                         $output .= "\n\t\t\t\t" . '<td> 
    240                                         <div style="text-align: center;"> 
    241                                                 <a href="'.$_SERVER['PHP_SELF'].$query.'&amp;entries_per_page='.$_SESSION['entries_per_page'].'&amp;moderate='.$moderate.'"><img src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a> 
    242                                                 &nbsp;&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&amp;delete_checked=1&amp;selected[]='.$row['id'].'&amp;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".'&nbsp;&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&amp;approve_checked=1&amp;selected[]='.$row['id'].'&amp;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.'&amp;entries_per_page='.$_SESSION['entries_per_page'].'&amp;moderate='.$moderate.'"><img src="'.$config['gallery_url'].'plog-admin/images/edit.gif" alt="'.plog_tr('Edit').'" title="'.plog_tr('Edit').'" /></a>'; 
     237                        $output .= '&nbsp;&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&amp;delete_checked=1&amp;selected[]='.$row['id'].'&amp;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" . '&nbsp;&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=approve-delete&amp;approve_checked=1&amp;selected[]='.$row['id'].'&amp;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>'; 
    249244                        $counter++; 
    250245                } 
     
    252247                if ($counter > 0) { 
    253248                        $output .= "\n\t\t\t" . '<tr class="footer"> 
    254                                 <td colspan="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> 
    255250                        </tr> 
    256251                </table>'; 
     
    259254 
    260255        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"> 
    266259                        <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"; 
    274269} 
    275270 
    276 display($output, "feedback"); 
     271display($output, 'feedback'); 
    277272 
    278273?> 
  • trunk/plog-admin/plog-import.php

    r588 r590  
    11<?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. */ 
    65 
    76// 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) { 
     7require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     8require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
     9 
     10function generate_albums_menu($albums, $type = 'multiple', $preselect) { 
    1411        $output = ''; 
    1512 
    16         if ($type == "multiple") 
     13        if ($type == 'multiple') 
    1714        $output .= '<select name="destinations[]" onclick="var k=document.getElementsByName(\'destination_radio\');k[0].checked=true;" >'; 
    1815        else 
     
    2017        foreach($albums as $album_id => $album_data) { 
    2118                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>'; 
    2421        } 
    2522        $output .= "\n\t\t\t\t</select>"; 
     
    3229        $output = '<select name="collections_menu" id="collections_menu" onclick="var k=document.getElementsByName(\'destination_radio\');k[1].checked=true;" >'; 
    3330        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>'; 
    3532        } 
    3633        $output .= "\n\t\t\t\t</select>"; 
     
    4037 
    4138$output = ''; 
     39 
    4240$counter = $imported = 0; 
    4341 
    4442// 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'])) ? "&amp;" : '?'; 
     43$query = (isset($_GET['nojs'])) ? '?nojs='.$_GET['nojs'] : ''; 
     44$sep = (isset($_GET['nojs'])) ? '&amp;' : '?'; 
    4745 
    4846// Check if update has been clicked, handle erroneous conditions, or upload 
     
    5452        $captions = $_POST['captions']; 
    5553        $descriptions = $_POST['descriptions']; 
     54        $allow_comments = isset($_POST['allow_comments']) ? $_POST['allow_comments'] : array(); 
    5655        $files = isset($_POST['files']) ? $_POST['files'] : ''; 
    5756        $selected = $_POST['selected']; 
     
    5958        global $config; 
    6059 
    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"; 
    6564        } else { 
    6665 
    67                 if ($_POST["destination_radio"] == "new"){ 
     66                if ($_POST['destination_radio'] == 'new') { 
    6867                        // Create the new album 
    6968                        $result = add_album($_POST['new_album_name'], NULL, $_POST['collections_menu']); 
     
    7372                        } else { 
    7473                                // 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 album 
    77                                         // and alert the user that their "new" album is already existing 
     74                                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 
    7877                                        $album_id = $result['id']; 
    7978                                        // 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']); 
    8180                                        $result = run_query($sql); 
    8281                                        $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"; 
    8483                                } else { 
    8584                                        // error has nothing to do with an existing album, show the returned error 
    8685                                        $album_id = ''; 
    87                                         $output .= "\n\t" . '<p class="errors">' . $result['errors'] . '</p>' . "\n"; 
     86                                        $output .= "\n\t" . '<p class="errors">'.$result['errors'].'</p>' . "\n"; 
    8887                                } 
    8988                        } 
    9089                } else { 
    9190                        // use an existing album 
    92                         $album_id = $_POST["destination"]; 
     91                        $album_id = $_POST['destination']; 
    9392                } 
    9493 
     
    9695                        foreach($files as $file) { 
    9796                                $file_key = md5($file); 
    98                                 if (in_array($file_key,$selected)) { 
     97                                if (in_array($file_key, $selected)) { 
    9998 
    10099                                        $file_name = SmartStripSlashes($file); 
    101100                                        // fully qualified file name 
    102                                         //$fqfn = $config["basedir"] . "plog-content/uploads/".$file_name; 
     101                                        //$fqfn = $config['basedir'].'plog-content/uploads/'.$file_name; 
    103102                                        $fqfn = $file; 
    104103 
    105                                         // attempt to chmod the pictures directory before moving them 
    106                                         @chmod(dirname($fqfn), 0777); 
    107  
    108104                                        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) { 
    111112                                                        $imported++; 
    112113                                                        // 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); 
    116117                                                        } 
    117118                                                } 
     
    124125 
    125126                        // 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"; 
    127128                        $result = run_query($sql); 
    128129                        $row = mysql_fetch_assoc($result); 
    129130 
    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                        } 
    131137 
    132138                        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"; 
    134142                        } 
    135143                        /* what is this for? 
     
    141149 
    142150        // 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'); 
    144152 
    145153        // build a list of unique directories from the filenames 
     
    156164        // here we will check which group of pictures we are editing, grouped by directory 
    157165        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;">'; 
    161169 
    162170                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'; 
    167175                $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>'; 
    169177                $output .= "\n\t\t</ul>\n\t</div>\n"; 
    170178 
     
    172180 
    173181} 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        } 
    179190 
    180191        $files = get_files($upload_directory); 
     
    196207 
    197208        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:').' 
    199210                        <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> 
    204215                </div>' . "\n"; 
    205216        } 
    206217 
    207218        // 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;">'; 
    211222                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>'; 
    213224                } 
    214225                //$dirkey = md5($upload_directory); 
    215226                // $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"; 
    217228 
    218229        } else { 
     
    220231                // show_directory is what the user sees, it's relative so the directory structure of the server 
    221232                // 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 { 
    228238                        $real_directory = $upload_directory; 
    229239                } 
     
    233243                if (count($files) > 0) { 
    234244                        $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                        } 
    236250                } 
    237251 
    238252                // 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                } 
    241256 
    242257                $albums = get_albums(); 
    243                 $queue_func = ""; 
     258                $queue_func = ''; 
    244259                $keys = array(); 
     260                if ($config['allow_comments']) { 
     261                        $comment = plog_tr('Allow Comments').'?'; 
     262                        $comment_type = 'checkbox" checked="checked'; 
     263                } else { 
     264                        $comment = '&nbsp;'; 
     265                        $comment_type = 'hidden'; 
     266                } 
    245267                sort($files); 
    246                 for($i=0; $i<count($files); $i++) { 
     268                for($i = 0; $i<count($files); $i++) { 
    247269                        $file_key = md5($files[$i]); 
    248270                        $keys[] = "'$file_key'"; 
    249                         $relative_name = substr($files[$i],strlen($upload_directory)+1); 
     271                        $relative_name = substr($files[$i], strlen($upload_directory)+1); 
    250272                        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"> 
    253275                                <tr class="header"> 
    254                                         <th class="table-header-left">&nbsp;</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 &amp; Description (optional)') . '</th> 
    258                                         <th class="table-header-right">&nbsp;</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 &amp; Description (optional)').'</th> 
     280                                        <th class="table-header-right width-125">'.$comment.'</th> 
    259281                                </tr>'; 
    260282 
    261                         // For each file within upload directory, list checkmark, thumbnail, caption box, album box 
     283                        // For each file within upload directory, list checkbox, thumbnail, caption box, description box, allow comments checkbox 
    262284 
    263285// 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'; 
    265287                        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); 
    267289                        } else { 
    268290                                $thumbpath = $config['gallery_url'].'plog-admin/images/ajax-loader.gif'; 
     
    270292                        // start a new table row (alternating colors) and generate XHTML with thumbnail and link to picture view. 
    271293                        $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="66" 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> 
    278300                                        </td> 
    279                                         <td>&nbsp;</td> 
     301                                        <td class="align-center width-125"><input type="'.$comment_type.'" name="allow_comments[]" value="'.$file_key.'" /></td> 
    280302                                </tr>'; 
    281303                        $counter++; 
     
    285307                if (count($files) != 0) { 
    286308                        $output .= "\n\t\t\t\t" . '<tr class="footer"> 
    287                                         <td colspan="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> 
    288310                                </tr>' . "\n"; 
    289311                        $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"; 
    291312 
    292313                        // here we can preselect some default options based on the structure of the import directory 
     
    297318 
    298319                        // break up directory name into parts 
    299                         $directory_parts = explode("/", $show_directory); 
     320                        $directory_parts = explode('/', $show_directory); 
    300321 
    301322                        if (isset($_REQUEST['collection_name']) && isset($_REQUEST['album_name'])) { 
    302323                                $collection_name = $_REQUEST['collection_name']; 
    303324                                $album_name = $_REQUEST['album_name']; 
    304                         } 
    305                         else { 
     325                        } else { 
    306326                                $collection_name = @$directory_parts[2]; 
    307327                                $album_name = @$directory_parts[3]; 
     
    310330                        // check if album exists 
    311331                        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)."'"; 
    313333                        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)."'"; 
    315335 
    316336                        $result = run_query($sql); 
    317337                        $row = mysql_fetch_assoc($result); 
     338                        $new_album_name = ''; 
    318339 
    319340                        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                                 else 
    325                                 $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"> 
    336357                                <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']).' 
    339360                        </p> 
    340361 
    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> 
    349370                                '.generate_collections_menu().' 
    350371                        </p> 
    351372 
    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> 
    353374                </div>'; 
    354375 
    355376                        $output .= "\n\t</form>"; 
    356377                        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"; 
    360382                                $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"; 
    363385                        } 
    364386                } 
     
    366388} 
    367389 
    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>'; 
    371393 
    372394$num_albums = count_albums(); 
    373395 
    374396if ($num_albums > 0) 
    375 display($output, "import"); 
     397        display($output, 'import'); 
    376398else 
    377 display($output_error, "import"); 
     399        display($output_error, 'import'); 
    378400 
    379401?> 
  • trunk/plog-admin/plog-manage.php

    r588 r590  
    11<?php 
    22// 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"); 
     3require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     4require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
    55 
    66global $inHead; 
     
    99 
    1010function 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') { 
    1616                $albums = get_albums(); 
    1717                $output .= generate_albums_menu($albums); 
    1818        } 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">'; 
    2020                $collections = get_collections(); 
    2121                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>'; 
    2423                } 
    25                 $output .= "\n\t\t\t\t".'</select>'; 
     24                $output .= "\n\t\t\t" . '</select>'; 
    2625        } 
    2726 
     
    3029 
    3130function 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">'; 
    3332        foreach($albums as $album_id => $album) { 
    3433                $selected = ''; 
     
    3635                if (isset($_REQUEST['albums_menu']) && isset($_REQUEST['new_album_name'])) { 
    3736                        if ($albums_menu == $album_id || $new_album_name == $album['album_name']) { 
    38                                 $selected = " selected=\"selected\""; 
     37                                $selected = ' selected="selected"'; 
    3938                        } 
    4039                } 
    4140 
    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>'; 
    4442        } 
    4543 
     
    4947 
    5048function generate_breadcrumb_admin($level, $id = 0) { 
    51         switch ($level){ 
     49        switch ($level) { 
    5250                case 'collections': 
    53                         $breadcrumbs = '<strong>' . plog_tr('Collections') . '</strong>'; 
     51                        $breadcrumbs = '<strong>'.plog_tr('Collections').'</strong>'; 
    5452                        break; 
    5553                case 'albums': 
    5654                        $collection = get_collection_by_id($id); 
    5755                        $collection_name = SmartStripSlashes($collection['name']); 
    58                         $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">' . plog_tr('Collections') . '</a> &raquo; ' . "<strong>".$collection_name."</strong>"; 
     56                        $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">'.plog_tr('Collections').'</a> &raquo; <strong>'.$collection_name.'</strong>'; 
    5957                        break; 
    6058                case 'pictures': 
     
    6260                        $album_link = SmartStripSlashes($album['name']); 
    6361                        $collection_link = '<a href="'.$_SERVER['PHP_SELF'].'?level=albums&amp;id='.$album['parent_id'].'">'.SmartStripSlashes($album['collection_name']).'</a>'; 
    64                         $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">' . plog_tr('Collections') . '</a> &raquo; ' . $collection_link . ' &raquo; ' . '<strong>'.$album_link.'</strong>'; 
     62                        $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">'.plog_tr('Collections').'</a> &raquo; '.$collection_link.' &raquo; '.'<strong>'.$album_link.'</strong>'; 
    6563                        break; 
    6664                case 'comments': 
    67                         $query = "SELECT * FROM `".TABLE_PREFIX."pictures` WHERE `id`='".$id."'"; 
     65                        $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."pictures` WHERE `id`='".$id."'"; 
    6866                        $result = run_query($query); 
    6967                        $row = mysql_fetch_assoc($result); 
     
    7371                        $collection_id = $row['parent_collection']; 
    7472 
    75                         $query = "SELECT * FROM `".TABLE_PREFIX."albums` WHERE `id`='".$album_id."'"; 
     73                        $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."albums` WHERE `id`='".$album_id."'"; 
    7674                        $result = run_query($query); 
    7775                        $row = mysql_fetch_assoc($result); 
     
    7977                        $album_link = '<a href="'.$_SERVER['PHP_SELF'].'?level=pictures&amp;id='.$album_id.'">'.SmartStripSlashes($row['name']).'</a>'; 
    8078 
    81                         $query = "SELECT * FROM `".TABLE_PREFIX."collections` WHERE `id`='".$collection_id."'"; 
     79                        $query = "SELECT * FROM `".PLOGGER_TABLE_PREFIX."collections` WHERE `id`='".$collection_id."'"; 
    8280                        $result = run_query($query); 
    8381                        $row = mysql_fetch_assoc($result); 
     
    8583                        $collection_link = '<a href="'.$_SERVER['PHP_SELF'].'?level=albums&amp;id='.$collection_id.'">'.SmartStripSlashes($row['name']).'</a>'; 
    8684 
    87                         $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">' . plog_tr('Collections') .' </a> &raquo; ' . $collection_link . ' &raquo; ' 
    88                         .$album_link. ' &raquo; '.$picture_link . ' &raquo;' . " " . plog_tr('Comments'); 
     85                        $breadcrumbs = '<a href="'.$_SERVER['PHP_SELF'].'">'.plog_tr('Collections').'</a> &raquo; '.$collection_link.' &raquo; '.$album_link.' &raquo; '.$picture_link.' - '.'<strong>'.plog_tr('Comments').':</strong>'; 
    8986                        break; 
    9087                default: 
    91                         $breadcrumbs = '<strong>' . plog_tr('Collections') . '</strong>'; 
     88                        $breadcrumbs = '<strong>'.plog_tr('Collections').'</strong>'; 
    9289        } 
    9390 
     
    9693 
    9794$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"; 
    10498 
    10599global $config; 
     
    117111                                if (isset($_REQUEST['selected'])) { 
    118112                                        foreach($_REQUEST['selected'] as $del_id) { 
    119                                                 if ($level == "pictures") { 
     113                                                if ($level == 'pictures') { 
    120114                                                        $rv = delete_picture($del_id); 
    121115                                                } 
    122                                                 if ($level == "collections") { 
     116                                                if ($level == 'collections') { 
    123117                                                        $rv = delete_collection($del_id); 
    124118                                                } 
    125                                                 if ($level == "albums") { 
     119                                                if ($level == 'albums') { 
    126120                                                        $rv = delete_album($del_id); 
    127121                                                } 
    128122 
    129123                                                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"; 
    131125                                                } else { 
    132126                                                        $num_items++; 
     
    135129 
    136130                                        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"; 
    145133                                        } 
    146134                                } 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"; 
    148136                                } 
    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'; } 
    152141 
    153142                                // perform the move function on the selected items 
     
    158147 
    159148                                                // if we are using pictures we need to update the parent_collection as well 
    160                                                 if ($level == "pictures") { 
     149                                                if ($level == 'pictures') { 
    161150                                                        $result = move_picture($mov_id, $pid); 
    162151                                                        if (empty($result['errors'])) { 
    163152                                                                $num_items++; 
    164153                                                        } else { 
    165                                                                 $output .= "\n\t" . '<p class="errors">' . $result['errors'] . '</p>' . "\n"; 
     154                                                                $output .= "\n\t" . '<p class="errors">'.$result['errors'].'</p>' . "\n"; 
    166155                                                        } 
    167                                                 } else if ($level == "albums") { 
     156                                                } else if ($level == 'albums') { 
    168157                                                        // if we are moving entire albums then we need to rename the folder 
    169158                                                        // $pid is our target collection id, $mov_id is our source album 
    170159 
    171                                                         $result = move_album($mov_id,$pid); 
     160                                                        $result = move_album($mov_id, $pid); 
    172161                                                        if (empty($result['errors'])) { 
    173162                                                                $num_items++; 
    174163                                                        } else { 
    175                                                                 $output .= "\n\t" . '<p class="errors">' . $result['errors'] . '</p>' . "\n"; 
     164                                                                $output .= "\n\t" . '<p class="errors">'.$result['errors'].'</p>' . "\n"; 
    176165                                                        } 
    177166                                                } 
     
    179168                                        } 
    180169 
    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                                        } 
    182174                                } 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"; 
    184176                                } 
    185177                        } 
    186178                        break; 
    187                 case "edit-picture": 
     179                case 'edit-picture': 
    188180                        $level = 'picture'; 
    189181                        // show the edit picture form 
    190182                        $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&amp;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>'; 
    204200                        $output .= "\n\t\t\t\t" . '<input type="hidden" name="pid" value="'.$photo['id'].'" /> 
    205201                                <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"; 
    210206                        $edit_page = 1; 
    211207                        break; 
    212                 case "edit-album": 
     208                case 'edit-album': 
    213209                        // show the edit album form 
    214210                        $output .= plog_edit_album_form($id); 
    215211                        $edit_page = 1; 
    216212                        break; 
    217                 case "edit-collection": 
     213                case 'edit-collection': 
    218214                        // show the edit collection form 
    219215                        $output .= plog_edit_collection_form($id); 
    220216                        $edit_page = 1; 
    221217                        break; 
    222                 case "edit-comment": 
     218                case 'edit-comment': 
    223219                        // show the edit comment form 
    224220                        $output .= plog_edit_comment_form($id); 
    225221                        $edit_page = 1; 
    226222                        break; 
    227                 case "update-picture": 
     223                case 'update-picture': 
    228224                        // update the picture information 
    229225                        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': 
    234231                        // update the album information 
    235232                        if (!isset($_REQUEST['cancel'])) { 
     
    237234                        } 
    238235                        break; 
    239                 case "update-collection": 
     236                case 'update-collection': 
    240237                        // update the collection information 
    241238                        if (!isset($_REQUEST['cancel'])) { 
     
    243240                        } 
    244241                        break; 
    245                 case "update-comment": 
     242                case 'update-comment': 
    246243                        // update the comment information 
    247244                        if (!isset($_REQUEST['cancel'])) { 
     
    249246                        } 
    250247                        break; 
    251                 case "add-collection": 
     248                case 'add-collection': 
    252249                        // add a new collection 
    253250                        $action_result = add_collection($_POST['name'], $_POST['description']); 
    254251                        break; 
    255                 case "add-album": 
     252                case 'add-album': 
    256253                        // add a new album 
    257254                        $action_result = add_album($_POST['name'], $_POST['description'], $_POST['parent_collection']); 
     
    261258        if (!empty($action_result['errors'])) { 
    262259                // 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"; 
    264261        } elseif (!empty($action_result['output'])) { 
    265262                // 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"; 
    267264        } 
    268265 
     
    270267 
    271268if (!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') { 
    274276                $output .= plog_add_collection_form(); 
    275         } 
    276         else if ($level == "albums") { 
     277        } else if ($level == 'albums') { 
    277278                $output .= plog_add_album_form($id); 
    278279        } 
    279280 
    280         // lets iterate through all the content and build a table 
     281        // let's iterate through all the content and build a table 
    281282        // set the default level if nothing is specified 
    282283 
    283284        // handle pagination 
    284         // lets determine the limit filter based on current page and number of results per page 
     285        // let's determine the limit filter based on current page and number of results per page 
    285286        if (isset($_REQUEST['entries_per_page'])) { 
    286287                $_SESSION['entries_per_page'] = $_REQUEST['entries_per_page']; 
    287         } else if (!isset($_SESSION['entries_per_page'])){ 
     288        } else if (!isset($_SESSION['entries_per_page'])) { 
    288289                $_SESSION['entries_per_page'] = 20; 
    289290        } 
    290291 
    291         $cond = ""; 
     292        $cond = ''; 
    292293 
    293294        // determine the filtering conditional based on the level and id number 
    294         if ($level == "albums" || $level == "comments"){ 
     295        if ($level == 'albums' || $level == 'comments') { 
    295296                $cond = "WHERE `parent_id` = '".intval($id)."'"; 
    296         } else if ($level == "pictures"){ 
     297        } else if ($level == 'pictures') { 
    297298                $cond = "WHERE `parent_album` = '".intval($id)."'"; 
    298299        } 
     
    305306        $limit = "LIMIT ".$first_item.", ".$_SESSION['entries_per_page']; 
    306307 
    307         // lets generate the pagination menu as well 
    308         $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"; 
    309310        $totalRowsResult = mysql_query($recordCount); 
    310         $totalRows = mysql_result($totalRowsResult,'num_items'); 
     311        $totalRows = mysql_result($totalRowsResult, 'num_items'); 
    311312 
    312313        $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 -->'; 
    315316 
    316317        $output .= "\n\t\t" . '<form id="contentList" action="'.$_SERVER['PHP_SELF'].'" method="post">'; 
    317318 
     319        $empty = false; 
     320 
    318321        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': 
    332335                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 --> 
    340343                <div class="move-del-manage"> 
    341344                        <input type="hidden" name="level" value="'.$level.'" /> 
    342345                        <input type="hidden" name="id" value="'.$id.'" /> 
    343346                        <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 
     356display($output, 'manage'); 
    352357 
    353358?> 
  • trunk/plog-admin/plog-options.php

    r588 r590  
    11<?php 
    22// 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"); 
     3require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     4require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
    55 
    66$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 
     8if (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; 
    1617        configure_htaccess_fullpic($allow_fullpic); 
    1718        $disable_intermediate = ($generate_intermediate == 1) ? 0 : 1; 
    1819 
    1920        // 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} != '/') { 
    2122                $_POST['gallery_url'] .= '/'; 
    2223        } 
    2324        // 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) { 
    2526                $_POST['gallery_url'] = 'http://'.$_POST['gallery_url']; 
    2627        } 
    2728 
    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>'; 
    6065                } 
    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                 } 
    6666        } 
    6767 
    6868        run_query($query); 
    6969 
    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']); 
    7474        $time = time(); 
    7575 
    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; 
    8280                mysql_query($query); 
    8381        } 
    8482 
    8583        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; 
    9087                mysql_query($query); 
    9188        } 
    9289 
    93         $query = "UPDATE `".TABLE_PREFIX."thumbnail_config` 
     90        $query = "UPDATE `".PLOGGER_TABLE_PREFIX."thumbnail_config` 
    9491        SET disabled = '$disable_intermediate' 
    95         WHERE id = " . THUMB_LARGE; 
     92        WHERE id = ".THUMB_LARGE; 
    9693        mysql_query($query); 
    9794 
    9895        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; 
    10399                mysql_query($query); 
    104100        } 
    105101 
    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; 
    110106                mysql_query($query); 
    111107        } 
    112108 
    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'])."', 
    116112 
    117113        // and read the configuration back again 
    118114        $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'); 
    126122        exit; 
    127123 
    128124} 
    129125 
    130 if (isset($_SESSION["msg"])) { 
    131         $output .= $_SESSION["msg"]; 
    132         unset($_SESSION["msg"]); 
    133 }; 
     126if (isset($_SESSION['msg'])) { 
     127        $output .= $_SESSION['msg']; 
     128        unset($_SESSION['msg']); 
     129} 
    134130 
    135131$date_formats = array( 
    136         "n.j.Y", // i.e., 6.29.2008 
    137         "j.n.Y", // i.e., 29.6.2008 
    138         "j-m-y", // i.e., 29-6-2008 
    139         "m.d.Y", // i.e., 6.29.2008 
    140         "m-d-Y", // i.e., 6-29-2008 
    141         "m/d/Y", // i.e., 6/29/2008 
    142         "Ymd", // i.e., 20080629 
    143         "F j, Y", // i.e., June 29, 2008 
    144         "d F Y", // i.e., 29 June 2008 
    145         "D, F j, Y", // i.e., Fri, June 29, 2008 
     132        '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 
    146142        ); 
    147143 
    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> 
    155151                                                <td class="right"><input size="40" type="text" id="gallery_name" name="gallery_name" value="'.stripslashes($config['gallery_name']).'" /></td> 
    156152                                        </tr> 
    157153                                        <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> 
    159155                                                <td class="right"><input size="40" type="text" id="gallery_url" name="gallery_url" value="'.stripslashes($config['gallery_url']).'" /></td> 
    160156                                        </tr> 
    161157                                        <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> 
    163159                                                <td class="right"><input size="40" type="text" id="admin_username" name="admin_username" value="'.$config['admin_username'].'" /></td> 
    164160                                        </tr> 
    165161                                        <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> 
    167163                                                <td class="right"><input size="40" type="text" id="admin_email" name="admin_email" value="'.$config['admin_email'].'" /></td> 
    168164                                        </tr> 
    169165                                </table> 
    170166 
    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> 
    176172                                                <td class="right"><input size="40" type="text" id="feed_language" name="feed_language" value="'.$config['feed_language'].'" /></td> 
    177173                                        </tr> 
    178174                                </table> 
    179175 
    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 = ''; 
    200196                                                $output .='<input type="checkbox" id="allow_comments" name="allow_comments" value="1" '.$checked.' /></td> 
    201197                                        </tr> 
    202198                                        <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 = ''; 
    206202                                                $output .= '<input type="checkbox" id="comments_notify" name="comments_notify" value="1" '.$checked.' /></td> 
    207203                                        </tr> 
    208204                                        <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 = ''; 
    212208                                                $output .= '<input type="checkbox" id="comments_moderate" name="comments_moderate" value="1" '.$checked.' /></td> 
    213209                                        </tr> 
    214210                                </table> 
    215211 
    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> 
    221217                                                <td class="right">'; 
    222218                                                $sort_by_fields = array( 
     
    238234                                                ); 
    239235 
    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> 
    295291                                                <td class="right"> 
    296292                                                        <select id="date_format" name="date_format">'; 
    297                                                         foreach ($date_formats as $format){ 
     293                                                        foreach ($date_formats as $format) { 
    298294                                                        $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"'; 
    300296                                                                $output .= '>'.translate_date(date($format)).'</option>'; 
    301297                                                        } 
     
    304300                                        </tr> 
    305301                                        <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 = ''; 
    309305                                                $output .= '<input type="checkbox" id="allow_dl" name="allow_dl" value="1" '.$checked.' /></td> 
    310306                                        </tr> 
    311307                                        <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 = ''; 
    315311                                                $output .= '<input type="checkbox" id="allow_print" name="allow_print" value="1" '.$checked.' /></td> 
    316312                                        </tr> 
    317313                                        <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 = ''; 
    322318                                                if (is_writable($htaccess_file)) { 
    323319                                                $output .= '<input type="checkbox" id="use_mod_rewrite" name="use_mod_rewrite" value="1" '.$checked.' />'; 
    324320                                                } 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                                                } 
    327323                                        $output .= '</td> 
    328324                                        </tr> 
    329325                                </table> 
    330326 
    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> 
    336332                                                <td class="right"><input size="5" type="text" id="image_quality" name="image_quality" value="'.$config['compression'].'" /></td> 
    337333                                        </tr> 
    338334                                        <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 = ''; 
    342338                                                $output .= '<input type="checkbox" id="allow_fullpic" name="allow_fullpic" value="1" '.$checked.' /></td> 
    343339                                        </tr> 
    344340                                        <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> 
    346342                                                <td class="right"><input size="5" type="text" id="truncate" name="truncate" value="'.$config['truncate'].'" /></td> 
    347343                                        </tr> 
    348344                                </table> 
    349345 
    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'); 
    354350                                        $output.=' 
    355351                                        <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> 
    357353                                                <td class="right"><input size="5" type="text" id="max_thumbnail_size" name="max_thumbnail_size" value="'.$thumbnail_config[THUMB_SMALL]['size'].'" /></td> 
    358354                                        </tr> 
    359355                                        <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 = ''; 
    363359                                                $output .= '<input type="checkbox" id="square_thumbs" name="square_thumbs" value="1" '.$checked.' /></td> 
    364360                                        </tr> 
    365361                                        <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> 
    367363                                                <td class="right"><input size="5" type="text" id="thumb_num" name="thumb_num" value="'.$config['thumb_num'].'" /></td> 
    368364                                        </tr> 
    369365                                        <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 = ''; 
    373369                                                $output .= '<input type="checkbox" id="enable_thumb_nav" name="enable_thumb_nav" value="1" '.$checked.' /></td> 
    374370                                        </tr> 
    375371                                        <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> 
    377373                                                <td class="right"><input size="5" type="text" id="thumb_nav_range" name="thumb_nav_range" value="'.$config['thumb_nav_range'].'" /></td> 
    378374                                        </tr> 
    379375                                        <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> 
    381377                                                <td class="right"><input size="5" type="text" id="nav_thumbsize" name="nav_thumbsize" value="'.$thumbnail_config[THUMB_NAV]['size'].'" /></td> 
    382378                                        </tr> 
    383379                                </table> 
    384380 
    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> 
    390386                                                <td class="right">'; 
    391387                                                $generate_intermediate = ($thumbnail_config[THUMB_LARGE]['disabled'] == 0) ? "checked='checked'" : ""; 
     
    393389                                        </tr> 
    394390                                        <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> 
    396392                                                <td class="right"><input size="5" type="text" id="max_display_size" name="max_display_size" value="'.$thumbnail_config[THUMB_LARGE]['size'].'" /></td> 
    397393                                        </tr> 
    398394                                </table> 
    399395 
    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> 
    405401                                                <td class="right"><input size="40" type="text" id="feed_title" name="feed_title" value="'.stripslashes($config['feed_title']).'" /></td> 
    406402                                        </tr> 
    407403                                        <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> 
    413409                                                <td class="right"><input size="5" type="text" id="feed_num_entries" name="feed_num_entries" value="'.$config['feed_num_entries'].'" /></td> 
    414410                                        </tr> 
    415411                                        <tr> 
    416412                                                <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> 
    418414                                        </tr> 
    419415                                </table> 
     
    422418                </form>' . "\n"; 
    423419 
    424 display($output, "options"); 
     420display($output, 'options'); 
    425421 
    426422?> 
  • trunk/plog-admin/plog-rpc.php

    r585 r590  
    11<?php 
    22// 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"); 
     3require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     4require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
     5require_once(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 
    66 
    77$output = ''; 
     
    99$action_result = array(); 
    1010 
    11 if ($_POST['action'] == "update") { 
     11if ($_POST['action'] == 'update') { 
    1212 
    1313        // What field are we updating? 
     
    1919 
    2020        // Now we parse the field to be updated and the id number from the field variable 
    21         $var = split("-", $field); 
     21        $var = split('-', $field); 
    2222        $type = $var[0]; 
    2323        $field = $var[1]; 
    2424        $id = $var[2]; 
    2525 
    26         //print "debug: field = " . $field . ", content = " . $content . ", id = " . $id; 
     26        //print "debug: field = ".$field.", content = ".$content.", id = ".$id; 
    2727 
    28         if ($type == "picture") { 
     28        if ($type == 'picture') { 
    2929                $result = update_picture_field($id, $field, $content); 
    3030                if ($result['output']) { 
     
    3232                                $content = '&nbsp;'; 
    3333                        } 
    34                         print stripslashes($content); 
     34                        echo stripslashes($content); 
    3535                } else { 
    36                         print "error: " . $result['errors']; 
    37                 }; 
     36                        echo plog_tr('Error').": ".$result['errors']; 
     37                } 
    3838        } 
    39         elseif ($type == "album") { 
     39        elseif ($type == 'album') { 
    4040                $result = update_album_field($id, $field, $content); 
    4141                if ($result['output']) { 
     
    4343                                $content = '&nbsp;'; 
    4444                        } 
    45                         print stripslashes($content); 
     45                        echo stripslashes($content); 
    4646                } else { 
    47                         print "error: " . $result['errors']; 
    48                 }; 
     47                        echo plog_tr('Error').": ".$result['errors']; 
     48                } 
    4949        } 
    50         elseif ($type == "collection") { 
     50        elseif ($type == 'collection') { 
    5151                $result = update_collection_field($id, $field, $content); 
    5252                if ($result['output']) { 
     
    5454                                $content = '&nbsp;'; 
    5555                        } 
    56                         print stripslashes($content); 
     56                        echo stripslashes($content); 
    5757                } else { 
    58                         print "error: " . $result['errors']; 
    59                 }; 
     58                        echo plog_tr('Error').": ".$result['errors']; 
     59                } 
    6060        } 
    61         elseif ($type == "comment") { 
     61        elseif ($type == 'comment') { 
    6262                $result = update_comment_field($id, $field, $content); 
    6363                if ($result['output']) { 
     
    6565                                $content = '&nbsp;'; 
    6666                        } 
    67                         print stripslashes($content); 
     67                        echo stripslashes($content); 
    6868                } else { 
    69                         print "error: " . $result['errors']; 
    70                 }; 
     69                        echo plog_tr('Error').": ".$result['errors']; 
     70                } 
    7171        } 
    7272} 
    7373 
    74 if ($_POST['action'] == "add-collection") { 
    75         $action_result = add_collection($_POST["name"],$_POST["description"]); 
     74if ($_POST['action'] == 'add-collection') { 
     75        $action_result = add_collection($_POST['name'], $_POST['description']); 
    7676        if (empty($action_result['errors'])) { 
    7777                $output .= "<script type='text/javascript'>Element.show('add_item_link');Element.hide('add_item_form');Form.reset('add_form');</script>"; 
    78         }; 
    79 }; 
     78        } 
     79} 
    8080 
    81 if ($_POST['action'] == "list-collections") { 
    82         $output .= plog_collection_manager($_POST["page"],$_SESSION['entries_per_page']); 
    83 }; 
     81if ($_POST['action'] == 'list-collections') { 
     82        $output .= plog_collection_manager($_POST['page'], $_SESSION['entries_per_page']); 
     83} 
    8484 
    8585if (!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"; 
    8787} 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} 
     90close_db(); 
     91close_ftp(); 
     92echo $output; 
    9293 
    9394?> 
  • trunk/plog-admin/plog-themes.php

    r588 r590  
    11<?php 
    22// 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"); 
     3require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     4require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
    55 
    6 global $inHead, $config, $thumbnail_config; 
     6global $config, $thumbnail_config; 
    77 
    8 function read_dir($path){ 
    9  
    10         static $dir_arr = array () ; 
    11  
     8function read_dir($path) { 
     9        static $dir_arr = array (); 
    1210        $handle = opendir($path); 
    1311 
    1412        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                } 
    1816        } 
    1917 
    20         return $dir_arr ; 
     18        return $dir_arr; 
    2119 
    2220} 
    2321 
    24 $output = "\n\t<h1>" . plog_tr("Manage Themes") . "</h1>"; 
     22function check_theme_token($theme) { 
     23        global $config; 
     24        $content = ''; 
    2525 
    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} 
    2833 
    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/'; 
    3037 
    3138// scan list of folders within theme directory 
    3239$theme_list = read_dir($theme_dir); 
     40sort($theme_list); 
    3341 
    3442// activate new theme by setting configuration dir 
    3543if (isset($_REQUEST['activate'])) { 
    3644        // 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 
    3948        if (file_exists($metafile)) { 
    4049                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; 
    4352                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>'; 
    4554                } 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>'; 
    4756                } 
    4857 
    4958                // update config variable if page doesn't refresh 
    50                 $config["theme_dir"] = $new_theme_dir; 
     59                $config['theme_dir'] = $new_theme_dir; 
    5160        } 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>'; 
    5362        } 
    5463} 
    5564 
     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 
    5673// 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%"> 
    5875                        <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>'; 
    6582$counter = 0; 
    6683 
    6784foreach($theme_list as $theme_folder_name) { 
    68         $meta_file = $theme_folder_name . "meta.php"; 
     85        $meta_file = $theme_folder_name.'meta.php'; 
    6986 
    7087        $theme_folder_basename = basename($theme_folder_name); 
     
    7289        // only display theme as available if meta information exists for it 
    7390        if (is_file($meta_file)) { 
    74  
    7591                // pull in meta information 
    7692                include($meta_file); 
    7793 
    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                } 
    8099 
    81100                // 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'); 
    83102                $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); 
    85104 
    86105                // generate large Lightbox preview thumb, update thumb if preview.png has been updated 
    87106                $thumbnail_config[THUMB_LARGE]['timestamp'] = $timestamp; 
    88107                $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); 
    90109 
    91110                // 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.'">'; 
    96117 
    97                 $output .= "\t\t\t\t<td>"; 
     118                $output .= "\n\t\t\t\t" . '<td class="width-175">'; 
    98119 
    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                } 
    101123 
    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 />&bull; '.plog_tr('Released under the').' '.$license.'.</td> 
     127                                <td class="align-left width-100"><a href="'.$url.'">'.$author.'</a></td>'; 
    106128 
    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                } 
    111134 
    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;">&lt;?php plogger_get_spam_token(); ?&gt;</span>', '&lt;form&gt;', '&lt;/form&gt;', '<strong>'.'plog-content/themes/'.$theme_folder_basename.'/comments.php</strong>').'</p> 
     142                                        </div> 
     143                                </td> 
     144                        </tr>'; 
     145                } 
    113146 
    114147                $counter++; 
     
    117150} 
    118151 
    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;">&nbsp;</td> 
    121154                        </tr> 
    122                 </table>\n"; 
     155                </table>' . "\n"; 
    123156 
    124 display($output, "themes"); 
     157display($output, 'themes'); 
    125158 
    126159?> 
  • trunk/plog-admin/plog-thumb.php

    r570 r590  
    33// first it will be used for import only. 
    44 
     5// load configuration variables from database, plog-globals, & plog-includes/plog-functions 
     6require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     7require_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 
    512if (empty($_GET['img'])) { 
    6         return "No such image"; 
     13        exit($found); 
    714} 
    815 
    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'); 
    1217 
    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'; 
    1819 
    1920foreach($files as $file) { 
    2021        if (md5($file) == $_GET['img']) { 
    21                 $found = true; 
    22                 $rname = substr($file,strlen($up_dir)+1); 
     22                $rname = substr($file, strlen($up_dir)+1); 
    2323 
    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!"; 
    2727                break; 
    2828        } 
    2929} 
     30close_db(); 
     31close_ftp(); 
     32echo $found; 
    3033 
    3134?> 
  • trunk/plog-admin/plog-thumbpopup.php

    r585 r590  
    11<?php 
    22// 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"); 
     3require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     4require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
     5require_once(PLOGGER_DIR.'plog-admin/plog-admin-functions.php'); 
    66 
    77// this script will just show a small preview of the thumbnail in admin view if 
     
    1717$src = $_REQUEST['src']; 
    1818$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']); 
    2222list($width, $height, $type, $attr) = getimagesize($thumbdir); 
    2323 
  • trunk/plog-admin/plog-upload.php

    r588 r590  
    11<?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. */ 
    65 
    76// 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"); 
     7require_once(dirname(dirname(__FILE__)).'/plog-load-config.php'); 
     8require(PLOGGER_DIR.'plog-admin/plog-admin.php'); 
    109 
    1110function 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;">'; 
    1514        foreach($albums as $album_id => $album) { 
    1615 
    1716                if ($albums_menu == $album_id || $new_album_name == $album['album_name']) { 
    18                         $selected = " selected='selected'"; 
     17                        $selected = ' selected="selected"'; 
    1918                } else { 
    20                         $selected = ""; 
     19                        $selected = ''; 
    2120                } 
    2221 
    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>'; 
    2423        } 
    25         $output .= "\n\t\t\t\t\t\t</select>"; 
     24        $output .= "\n\t\t\t\t\t</select>"; 
    2625 
    2726        return $output; 
     
    3029function generate_collections_menu() { 
    3130        $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">'; 
    3332        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>'; 
    3535        } 
    36         $output .= "\n\t\t\t\t\t\t\t\t\t</select>"; 
     36        $output .= "\n\t\t\t\t\t</select>"; 
    3737 
    3838        return $output; 
    3939} 
    4040 
    41 $output = ''; 
     41$output = "\n\t" . '<h1>'.plog_tr('Upload Images').'</h1>' . "\n"; 
    4242 
    4343// Check if update has been clicked, handle erroneous conditions, or upload 
    44 if (isset($_REQUEST['upload'])){ 
     44if (isset($_REQUEST['upload'])) { 
    4545        foreach($_REQUEST as $key => $val) $_REQUEST[$key] = stripslashes($val); 
    4646 
    4747        $pi = pathinfo($_FILES['userfile']['name']); 
    4848 
    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'); 
    5654                //zip file to extract 
    57                 $archive = new PclZip($_FILES["userfile"]["tmp_name"]); 
     55                $archive = new PclZip($_FILES['userfile']['tmp_name']); 
    5856 
    5957                //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; 
    6260                $zipdirkey = md5($zipdir); 
    63                 $zipresult = makeDirs($zipdir, 0777); 
     61                $zipresult = makeDirs($zipdir); 
    6462 
    6563                //extract to 'plog-content/uploads/' folder 
    66  
    6764                $results = $archive->extract(PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH, $zipdir); 
    6865 
    69                 if ($results == 0){ 
     66                if ($results == 0) { 
    7067                        //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"; 
    7269                } 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