feat(deployed): add JoomGallery 3.3.4 (no-source, vetted live)
JoomGallery 3.3.4, vetted clean from live; no 3.3.4 tag upstream → deployed files. Excluded temp/ update-staging (data). Signed-off-by: LÁZÁR Imre <imre@illusion.hu> Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
parent
6ca5826110
commit
9be7e17536
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<access component="com_joomgallery">
|
||||
<section name="component">
|
||||
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
|
||||
<action name="joom.upload" title="COM_JOOMGALLERY_ACTION_UPLOAD" description="COM_JOOMGALLERY_ACTION_COMPONENT_UPLOAD_DESC" />
|
||||
<action name="joom.upload.inown" title="COM_JOOMGALLERY_ACTION_UPLOAD_INOWN" description="COM_JOOMGALLERY_ACTION_COMPONENT_UPLOAD_INOWN_DESC" />
|
||||
<action name="core.create" title="JACTION_CREATE" description="COM_JOOMGALLERY_ACTION_COMPONENT_CREATE_DESC" />
|
||||
<action name="joom.create.inown" title="COM_JOOMGALLERY_ACTION_CREATE_INOWN" description="COM_JOOMGALLERY_ACTION_COMPONENT_CREATE_INOWN_DESC" />
|
||||
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
|
||||
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
|
||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
|
||||
</section>
|
||||
<section name="category">
|
||||
<action name="joom.upload" title="COM_JOOMGALLERY_ACTION_UPLOAD" description="COM_JOOMGALLERY_ACTION_CATEGORY_UPLOAD_DESC" />
|
||||
<action name="joom.upload.inown" title="COM_JOOMGALLERY_ACTION_UPLOAD_INOWN" description="COM_JOOMGALLERY_ACTION_CATEGORY_UPLOAD_INOWN_DESC" />
|
||||
<action name="core.create" title="JACTION_CREATE" description="COM_JOOMGALLERY_ACTION_CATEGORY_CREATE_DESC" />
|
||||
<action name="joom.create.inown" title="COM_JOOMGALLERY_ACTION_CREATE_INOWN" description="COM_JOOMGALLERY_ACTION_CATEGORY_CREATE_INOWN_DESC" />
|
||||
<action name="core.delete" title="JACTION_DELETE" description="COM_JOOMGALLERY_ACTION_CATEGORY_DELETE_DESC" />
|
||||
<action name="core.edit" title="JACTION_EDIT" description="COM_JOOMGALLERY_ACTION_CATEGORY_EDIT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_JOOMGALLERY_ACTION_CATEGORY_EDITSTATE_DESC" />
|
||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_JOOMGALLERY_ACTION_CATEGORY_EDITOWN_DESC" />
|
||||
</section>
|
||||
<section name="image">
|
||||
<action name="core.delete" title="JACTION_DELETE" description="COM_JOOMGALLERY_ACTION_IMAGE_DELETE_DESC" />
|
||||
<action name="core.edit" title="JACTION_EDIT" description="COM_JOOMGALLERY_ACTION_IMAGE_EDIT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_JOOMGALLERY_ACTION_IMAGE_EDITSTATE_DESC" />
|
||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_JOOMGALLERY_ACTION_IMAGE_EDITOWN_DESC" />
|
||||
</section>
|
||||
</access>
|
||||
@ -0,0 +1,401 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog>
|
||||
<release version="3.3.4" published="20180121">
|
||||
<entries date="20180121">
|
||||
<logentry type="#">Adding a modal header and footer to image selection field popup</logentry>
|
||||
<logentry type="#">Adding a modal header and footer to thumbnail selection field popup</logentry>
|
||||
</entries>
|
||||
<entries date="20171223">
|
||||
<logentry type="#">Fix FTP upload option 'Delete from FTP' not checked by default</logentry>
|
||||
</entries>
|
||||
<entries date="20171201">
|
||||
<logentry type="#">Fix problems in backend views</logentry>
|
||||
</entries>
|
||||
<entries date="20171110">
|
||||
<logentry type="#">Fix misaligned toolbar buttons in the backend views</logentry>
|
||||
</entries>
|
||||
<entries date="20171107">
|
||||
<logentry type="#">Fix PHP Notice / Warning</logentry>
|
||||
</entries>
|
||||
<entries date="20171031">
|
||||
<logentry type="#">Fix SQL Injection Attack Vulnerability via image sorting options</logentry>
|
||||
</entries>
|
||||
<entries date="20171022">
|
||||
<logentry type="#">Fix double scheme in BBcode</logentry>
|
||||
</entries>
|
||||
<entries date="20161201">
|
||||
<logentry type="#">Fix removing an image from the favourites</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.3.3" published="20160814">
|
||||
<entries date="20160807">
|
||||
<logentry type="#">Fix edit button not working correctly in extended configuration manager</logentry>
|
||||
</entries>
|
||||
<entries date="20160803">
|
||||
<logentry type="#">Fix setting of permissions in the backend category and image view</logentry>
|
||||
</entries>
|
||||
<entries date="20160724">
|
||||
<logentry type="#">Allow spaces in uploaded image file names</logentry>
|
||||
<logentry type="#">Fix deprecation warnings in PHP7</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.3.2" published="20160609">
|
||||
<entries date="20160529">
|
||||
<logentry type="#">Fix pagination glitches in the back end image manager</logentry>
|
||||
<logentry type="#">Remove unused and invalid credits</logentry>
|
||||
<logentry type="#">Add missing translation for back end AJAX upload form</logentry>
|
||||
</entries>
|
||||
<entries date="20160521">
|
||||
<logentry type="#">Restore correct collapsing behavior in images tab of MiniJoom</logentry>
|
||||
</entries>
|
||||
<entries date="20160520">
|
||||
<logentry type="#">Fix double translation of some language strings</logentry>
|
||||
<logentry type="#">Add prefix for MiniJoom when selecting category thumbnails to prevent conflicts with other MiniJoom instances</logentry>
|
||||
</entries>
|
||||
<entries date="20160518">
|
||||
<logentry type="#">Restrict valid Itemids based on language</logentry>
|
||||
</entries>
|
||||
<entries date="20160517">
|
||||
<logentry type="#">GitHub logo was not showing and project pages should open in new tabs</logentry>
|
||||
</entries>
|
||||
<entries date="20160515">
|
||||
<logentry type="#">Clean up and sort strings in language files</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.3.1" published="20160509">
|
||||
<entries date="20160509">
|
||||
<logentry type="#">Fix broken thumbnail selection for categories with MiniJoom</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.3.0" published="20160508">
|
||||
<entries date="20160506">
|
||||
<logentry type="+">Pass selected image type to the selectimage method in the MiniJoom</logentry>
|
||||
</entries>
|
||||
<entries date="20160410">
|
||||
<logentry type="#">Fix sending messages via phpmailer</logentry>
|
||||
</entries>
|
||||
<entries date="20160406">
|
||||
<logentry type="#">Fix setting of permissions in the backend category and image view</logentry>
|
||||
</entries>
|
||||
<entries date="20160401">
|
||||
<logentry type="#">Fix form field joomuser popup</logentry>
|
||||
</entries>
|
||||
<entries date="20160322">
|
||||
<logentry type="#">Fix E_STRICT errors in category view</logentry>
|
||||
</entries>
|
||||
<entries date="20160119">
|
||||
<logentry type="+">Featured images</logentry>
|
||||
</entries>
|
||||
<entries date="20151113">
|
||||
<logentry type="+">Proportional watermark</logentry>
|
||||
<logentry type="+">Backend batch edit metadata</logentry>
|
||||
</entries>
|
||||
<entries date="20151005">
|
||||
<logentry type="^">Use different language constant for default ordering entry</logentry>
|
||||
</entries>
|
||||
<entries date="20151001">
|
||||
<logentry type="+">Optimize tables</logentry>
|
||||
</entries>
|
||||
<entries date="20150929">
|
||||
<logentry type="#">Fix links to managers (approval) in JoomGallery control panel</logentry>
|
||||
</entries>
|
||||
<entries date="20150928">
|
||||
<logentry type="+">Owner filter in the back end categories view</logentry>
|
||||
</entries>
|
||||
<entries date="20150927">
|
||||
<logentry type="#">Setting about allowing users to change access level of categories was not applied</logentry>
|
||||
<logentry type="#">Icomoon Icons were missing in the MiniJoom</logentry>
|
||||
</entries>
|
||||
<entries date="20150922">
|
||||
<logentry type="+">New, changed and moved configuration options</logentry>
|
||||
</entries>
|
||||
<entries date="20150910">
|
||||
<logentry type="^">Refactor back end categories view (search tools)</logentry>
|
||||
<logentry type="#">Fix pagination glitches in back end images view</logentry>
|
||||
</entries>
|
||||
<entries date="20150908">
|
||||
<logentry type="^">Refactor back end categories view (search tools)</logentry>
|
||||
</entries>
|
||||
<entries date="20150907">
|
||||
<logentry type="^">Refactor back end images view (search tools)</logentry>
|
||||
<logentry type="^">Use listbox for owner selection up to specified user count</logentry>
|
||||
</entries>
|
||||
<entries date="20150814">
|
||||
<logentry type="#">Fix concealed buttons in the reject popup of the back end images view</logentry>
|
||||
</entries>
|
||||
<entries date="20150814">
|
||||
<logentry type="#">Fix wrong entries for images in maintenance orphans table</logentry>
|
||||
</entries>
|
||||
<entries date="20150812">
|
||||
<logentry type="#">Fix filtering in user panel view</logentry>
|
||||
<logentry type="#">Fix filtering in user categories view</logentry>
|
||||
</entries>
|
||||
<entries date="20150811">
|
||||
<logentry type="^">Clean up member vars in JoomConfig and TableJoomgalleryConfig</logentry>
|
||||
<logentry type="^">Use Bootstrap styled button in report view</logentry>
|
||||
<logentry type="-">Remove unused option jg_showdetailfavourite</logentry>
|
||||
</entries>
|
||||
<entries date="20150606">
|
||||
<logentry type="-">Removal of Cooliris integration</logentry>
|
||||
</entries>
|
||||
<entries date="20150531">
|
||||
<logentry type="+">New responsive motion gallery with touch gesture support</logentry>
|
||||
</entries>
|
||||
<entries date="20150416">
|
||||
<logentry type="+">Quick editing of image data in the userpanel view</logentry>
|
||||
</entries>
|
||||
<entries date="20150405">
|
||||
<logentry type="+">Limit the number of images in the motion bar</logentry>
|
||||
</entries>
|
||||
<entries date="20150803">
|
||||
<logentry type="^">Use of https for retrieving Google Maps, if necessary</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.2.2" published="20150726">
|
||||
<entries date="20150726">
|
||||
<logentry type="#">Fix filename validation in drag'n'drop upload</logentry>
|
||||
</entries>
|
||||
<entries date="20150705">
|
||||
<logentry type="^">Exchange Mootools tooltips with Bootstrap tooltips</logentry>
|
||||
<logentry type="#">Fix close button not always displaying in DHTML box</logentry>
|
||||
</entries>
|
||||
<entries date="20150630">
|
||||
<logentry type="#">Fix E_STRICT errors in gallery view</logentry>
|
||||
</entries>
|
||||
<entries date="20150626">
|
||||
<logentry type="-">Remove unnecessary class 'tip' from button's class attribute</logentry>
|
||||
<logentry type="#">Fix some not working tooltips in the backend</logentry>
|
||||
</entries>
|
||||
<entries date="20150619">
|
||||
<logentry type="#">Added missing language constant</logentry>
|
||||
</entries>
|
||||
<entries date="20150610">
|
||||
<logentry type="#">Delete additional old files and folders during update</logentry>
|
||||
</entries>
|
||||
<entries date="20150608">
|
||||
<logentry type="#">Prevent saving password in the browser</logentry>
|
||||
</entries>
|
||||
<entries date="20150529">
|
||||
<logentry type="^">Remove 'nowrap' from CSS class 'jg_catorderlist'</logentry>
|
||||
<logentry type="#">Wrong ID of select boxes when configuring specific categories in JoomPlu</logentry>
|
||||
<logentry type="+">Also check details tables during migration check</logentry>
|
||||
</entries>
|
||||
<entries date="20150519">
|
||||
<logentry type="^">Create a form field for Fineuploader in order to reduce code redundancy </logentry>
|
||||
<logentry type="^">Use Bootstrap button and modal in Thumbnail form field</logentry>
|
||||
</entries>
|
||||
<entries date="20150517">
|
||||
<logentry type="^">Tooltips should be enabled with default styling for new installations</logentry>
|
||||
</entries>
|
||||
<entries date="20150514">
|
||||
<logentry type="^">Use Bootstrap button and modal in image form field</logentry>
|
||||
<logentry type="^">Use Bootstrap button and modal in Joomuser form field</logentry>
|
||||
<logentry type="#">Small improvements for migration purposes</logentry>
|
||||
</entries>
|
||||
<entries date="20150513">
|
||||
<logentry type="^">Changed context name for batch processing</logentry>
|
||||
</entries>
|
||||
<entries date="20150512">
|
||||
<logentry type="#">Pagination disappeared on phones -> move to Joomla language strings</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.2.1" published="20150512">
|
||||
<entries date="20150512">
|
||||
<logentry type="+">MiniJoom popup could not be used for multiple purposes on the same page</logentry>
|
||||
</entries>
|
||||
<entries date="20150428">
|
||||
<logentry type="^">Use Bootstrap styled buttons in detail view</logentry>
|
||||
</entries>
|
||||
<entries date="20150422">
|
||||
<logentry type="#">Corrected language file download links</logentry>
|
||||
</entries>
|
||||
<entries date="20150420">
|
||||
<logentry type="#">Fatal error when trying to install invalid package</logentry>
|
||||
</entries>
|
||||
<entries date="20150401">
|
||||
<logentry type="#">Delete the corresponding votes if an image is deleted</logentry>
|
||||
</entries>
|
||||
<entries date="20150331">
|
||||
<logentry type="#">Clean table #__modules_menu on component uninstall</logentry>
|
||||
</entries>
|
||||
<entries date="20150326">
|
||||
<logentry type="^">Enable possibility for future direct one-click-update through GitHub</logentry>
|
||||
</entries>
|
||||
<entries date="20150311">
|
||||
<logentry type="+">Improving performance of maintenance manager by adding an index</logentry>
|
||||
</entries>
|
||||
<entries date="20150205">
|
||||
<logentry type="#">Fix /e modified deprecated errors</logentry>
|
||||
</entries>
|
||||
<entries date="20141228">
|
||||
<logentry type="+">Added onJoomAfterUpload event to FTP upload</logentry>
|
||||
</entries>
|
||||
<entries date="20141219">
|
||||
<logentry type="#">Several fixes in language files</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.2.0" published="20141026">
|
||||
<entries date="20141026">
|
||||
<logentry type="^">Links to Transifex languages removed because they don't work anymore</logentry>
|
||||
</entries>
|
||||
<entries date="20140702">
|
||||
<logentry type="^">Images and categories for which the actual files and folders cannot be deleted for any reason are now deleted in the database anyway</logentry>
|
||||
</entries>
|
||||
<entries date="20140626">
|
||||
<logentry type="#">JavaScript errors if language strings contained inverted commas</logentry>
|
||||
</entries>
|
||||
<entries date="20140611">
|
||||
<logentry type="^">Upgrade to FineUploader 4.4.0</logentry>
|
||||
<logentry type="+">Preview in Drag'n'Drop upload</logentry>
|
||||
<logentry type="+">Allow to change file name and image title in Drag'n'Drop upload</logentry>
|
||||
<logentry type="#">Options 'Original filename' and 'Delete original images after upload' didn't work correctly within Drag'n'Drop upload of MiniJoom (JoomPlu)</logentry>
|
||||
<logentry type="#">Javascript errors when using Drag'n'Drop upload</logentry>
|
||||
<logentry type="^">Change Javascript load sequence in MiniJoom (JoomPlu)</logentry>
|
||||
<logentry type="#">Avoid 'ROOT' entry in category drop down list in the case that no category has been created yet</logentry>
|
||||
</entries>
|
||||
<entries date="20140608">
|
||||
<logentry type="^">New JAVA-Applet 5.1.1 Build 1706</logentry>
|
||||
</entries>
|
||||
<entries date="20140511">
|
||||
<logentry type="+">Use of JHtml::_('behavior.tabstate') to remember active tab states</logentry>
|
||||
</entries>
|
||||
<entries date="20140505">
|
||||
<logentry type="#"># Wrong calculation and display of the number of categories created by an owner in the user categories view</logentry>
|
||||
</entries>
|
||||
<entries date="20140509">
|
||||
<logentry type="#">Javascript validation in the 'Editimages' back end view did not work anymore</logentry>
|
||||
</entries>
|
||||
<entries date="20140504">
|
||||
<logentry type="#">Javascript errors in some backend views (Mootools/jQuery issue)</logentry>
|
||||
</entries>
|
||||
<entries date="20140427">
|
||||
<logentry type="#">Configuration setting 'Show owner instead of author if no author exists?' now also used for detail view</logentry>
|
||||
<logentry type="^">Enlarge database field lengths for 'alias' and 'catpath' in table #__joomgallery_catg</logentry>
|
||||
</entries>
|
||||
<entries date="20140227">
|
||||
<logentry type="#">Support long file names up to 255 characters, shorten file names that are longer</logentry>
|
||||
<logentry type="#">The file size limit has not been checked for frontend uploads</logentry>
|
||||
<logentry type="#">Select button in Drag'n'Drop upload view not fully functional</logentry>
|
||||
</entries>
|
||||
<entries date="20140224">
|
||||
<logentry type="^">Deprecated class JRules replaced with class JAccessRules</logentry>
|
||||
<logentry type="^">Now using IcoMoon icon fonts in the backend toolbar titles</logentry>
|
||||
</entries>
|
||||
<entries date="20140217">
|
||||
<logentry type="#">The AJAX category selection did not work for inserting images or categories in an article</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.1.1" published="20140208">
|
||||
<entries date="20140118">
|
||||
<logentry type="#">Inserting categories with JoomBu/JoomPlu not possible in some cases because category select box did not show any categories</logentry>
|
||||
<logentry type="#">Call to undefined method JDate::toFormat() when storing categories or images</logentry>
|
||||
</entries>
|
||||
<entries date="20131122">
|
||||
<logentry type="#">Interface configuration parameters 'hidebackend' and 'showcatlink' not always working correctly</logentry>
|
||||
</entries>
|
||||
<entries date="20131116">
|
||||
<logentry type="#">Password protected categories stopped working with the release of Joomla! 3.2.0</logentry>
|
||||
</entries>
|
||||
<entries date="20131113">
|
||||
<logentry type="#">Motion gallery not moving in Google Chrome</logentry>
|
||||
</entries>
|
||||
<entries date="20131110">
|
||||
<logentry type="^">Strict standards</logentry>
|
||||
<logentry type="^">Ordering form field 'Ordering' renamed to 'Joomordering' due to conflicts with Joomla! form field 'Ordering'</logentry>
|
||||
<logentry type="#">Fatal error in 'Openimage' form field</logentry>
|
||||
<logentry type="#">Fatal errors in frontend models 'edit' and 'editcategory'</logentry>
|
||||
</entries>
|
||||
<entries date="20131103">
|
||||
<logentry type="#">Error with PHP 5.4 and 5.5 when FTP layer is enabled</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.1.0" published="20130915">
|
||||
<entries date="20130908">
|
||||
<logentry type="-">MooRainbow assets removed</logentry>
|
||||
</entries>
|
||||
<entries date="20130904">
|
||||
<logentry type="^">Use only bootstrap tooltips in backend</logentry>
|
||||
</entries>
|
||||
<entries date="20130903">
|
||||
<logentry type="#">Missing import of 'joomla.filesystem.file' in maintenance manager</logentry>
|
||||
<logentry type="#">Problem with 'task' parameter when using it in a system plugin</logentry>
|
||||
</entries>
|
||||
<entries date="20130827">
|
||||
<logentry type="#">Syntax error in database query when creating zip archives of favourites</logentry>
|
||||
</entries>
|
||||
<entries date="20130818">
|
||||
<logentry type="#">Wrong variable used in JoomGallery router</logentry>
|
||||
<logentry type="#">SQL errors when synchronizing votes and nametags</logentry>
|
||||
<logentry type="#">Missing import of 'joomla.filesystem.file' when synchronizing favourites</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.1.0 BETA" published="20130616">
|
||||
<entries date="20130527">
|
||||
<logentry type="+">Improved display of EXIF data for devices with low resolution</logentry>
|
||||
</entries>
|
||||
<entries date="20130523">
|
||||
<logentry type="+">Support of unicode aliases added</logentry>
|
||||
</entries>
|
||||
<entries date="20130510">
|
||||
<logentry type="+">Timespan for upload limit</logentry>
|
||||
</entries>
|
||||
<entries date="20130509">
|
||||
<logentry type="^">Performance optimization for back end image deletion</logentry>
|
||||
</entries>
|
||||
<entries date="20130507">
|
||||
<logentry type="^">Consider only published menu items for Itemid</logentry>
|
||||
</entries>
|
||||
<entries date="20130506">
|
||||
<logentry type="^">Consider settings for image title and description in interface</logentry>
|
||||
</entries>
|
||||
<entries date="20130505">
|
||||
<logentry type="+">Possibility to exclude images from toplists and the search</logentry>
|
||||
</entries>
|
||||
<entries date="20130502">
|
||||
<logentry type="+">Password-protected categories</logentry>
|
||||
<logentry type="+">Possibility to explicitly reject images and to send message about rejection reason</logentry>
|
||||
</entries>
|
||||
<entries date="20130427">
|
||||
<logentry type="^">Colorpickers now using jQuery minicolors.js instead of Mootools mooRainbow.js</logentry>
|
||||
<logentry type="-">JFormField 'color' removed</logentry>
|
||||
</entries>
|
||||
<entries date="20130426">
|
||||
<logentry type="+">Possibility to view the 'Changelog' after extension update and in the 'Help and Information' view</logentry>
|
||||
</entries>
|
||||
<entries date="20130425">
|
||||
<logentry type="#">Error 'JPath::clean: $path is not a string' in FTP Upload view fixed</logentry>
|
||||
</entries>
|
||||
<entries date="20130422">
|
||||
<logentry type="+">Counting image downloads, display statistics and number of downloads in front and back end</logentry>
|
||||
<logentry type="-">Configuration option 'jg_wrongvaluecolor' removed</logentry>
|
||||
</entries>
|
||||
<entries date="20130421">
|
||||
<logentry type="+">Option for selecting whether sent mails should use only the site e-mail address as sender</logentry>
|
||||
<logentry type="^">Recipients of mails sent by JoomGallery are included as BCC from now on</logentry>
|
||||
<logentry type="#">Wrong filters were applied to image and category descriptions</logentry>
|
||||
</entries>
|
||||
<entries date="20130420">
|
||||
<logentry type="#">Number of images and categories were not displayed if only one page exists</logentry>
|
||||
</entries>
|
||||
<entries date="20130416">
|
||||
<logentry type="^">Use of FineUploader in MiniJoom for improved user experience</logentry>
|
||||
<logentry type="+">Quick upload buttons in gallery, category and sub-category view</logentry>
|
||||
<logentry type="#">Image title and description was not always displayed as configured in popup boxes</logentry>
|
||||
</entries>
|
||||
<entries date="20130402">
|
||||
<logentry type="^">Update Fineuploader JS/CSS (AJAX Upload) to version 3.4.1 (now GPLv3)</logentry>
|
||||
</entries>
|
||||
<entries date="20130331">
|
||||
<logentry type="^">Resolving naming conflict between fields 'Hidden' and 'Unpublished' in the german language</logentry>
|
||||
<logentry type="-">JFormFields 'owner' and 'cbowner' deleted because they aren't used anymore</logentry>
|
||||
</entries>
|
||||
<entries date="20130330">
|
||||
<logentry type="#">Error in detail view when option 'Use real paths' is enabled</logentry>
|
||||
</entries>
|
||||
<entries date="20130328">
|
||||
<logentry type="#">Error while sending messages via e-mail</logentry>
|
||||
</entries>
|
||||
</release>
|
||||
<release version="3.0.0 BETA" published="20130314">
|
||||
</release>
|
||||
</changelog>
|
||||
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<fieldset
|
||||
name="permissions"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
description="COM_JOOMGALLERY_PERMISSIONS_DESC"
|
||||
>
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
class="inputbox"
|
||||
validate="rules"
|
||||
filter="rules"
|
||||
component="com_joomgallery"
|
||||
section="component" />
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="extended"
|
||||
label="COM_JOOMGALLERY_ADMENU_EXTENDED_LABEL"
|
||||
description="COM_JOOMGALLERY_ADMENU_EXTENDED_DESC"
|
||||
>
|
||||
<field
|
||||
name="extended_config"
|
||||
type="radio"
|
||||
label="COM_JOOMGALLERY_ADMENU_EXTENDED_CONFIG_LABEL"
|
||||
description="COM_JOOMGALLERY_ADMENU_EXTENDED_CONFIG_DESC"
|
||||
class="btn-group"
|
||||
filter="integer"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="seo"
|
||||
label="COM_JOOMGALLERY_ADMENU_SEO_LABEL"
|
||||
description="COM_JOOMGALLERY_ADMENU_SEO_DESC"
|
||||
>
|
||||
<field
|
||||
name="sef_image"
|
||||
type="radio"
|
||||
label="COM_JOOMGALLERY_ADMENU_SEF_IMAGE_LABEL"
|
||||
description="COM_JOOMGALLERY_ADMENU_SEF_IMAGE_DESC"
|
||||
class="btn-group"
|
||||
filter="integer"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
<option value="2">COM_JOOMGALLERY_ADMENU_SEF_IMAGE_EXTENDED_LABEL</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</config>
|
||||
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controller.php $
|
||||
// $Id: controller.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* JoomGallery Component Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* JApplication object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
#var $_mainframe;
|
||||
|
||||
/**
|
||||
* JoomConfig object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
var $_config;
|
||||
|
||||
/**
|
||||
* JoomAmbit object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
var $_ambit;
|
||||
|
||||
/**
|
||||
* JUser object, holds the current user data
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
#var $_user;
|
||||
|
||||
/**
|
||||
* JDatabase object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
var $_db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->_ambit = JoomAmbit::getInstance();
|
||||
$this->_config = JoomConfig::getInstance();
|
||||
|
||||
/*$this->_mainframe = JFactory::getApplication('site');
|
||||
$this->_user = JFactory::getUser();*/
|
||||
$this->_db = JFactory::getDBO();
|
||||
|
||||
// Uncomment following line to disable update check
|
||||
// $this->_config->set('jg_checkupdate', 0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/ajaxupload.php $
|
||||
// $Id: ajaxupload.php 4074 2013-02-10 22:53:57Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery AJAX Upload Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.0
|
||||
*/
|
||||
class JoomGalleryControllerAjaxupload extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'ajaxupload');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the default upload form
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// Access check
|
||||
if(!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload')))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl('categories'), false), JText::_('No categories found into which you are allowed to upload'), 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/ajaxupload.raw.php $
|
||||
// $Id: ajaxupload.raw.php 4398 2014-06-11 13:39:02Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery AJAX Upload JSON Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.0
|
||||
*/
|
||||
class JoomGalleryControllerAjaxupload extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Uploads the selected images
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$result = array('error' => false);
|
||||
|
||||
require_once JPATH_COMPONENT.'/helpers/upload.php';
|
||||
|
||||
$uploader = new JoomUpload();
|
||||
|
||||
if($image = $uploader->upload(JRequest::getCmd('type', 'ajax')))
|
||||
{
|
||||
$result['success'] = true;
|
||||
if(is_object($image))
|
||||
{
|
||||
$result['id'] = $image->id;
|
||||
$result['imgtitle'] = $image->imgtitle;
|
||||
$result['thumbnailUrl'] = $this->_ambit->getImg('thumb_url', $image);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($error = $uploader->getError())
|
||||
{
|
||||
$result['error'] = $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['error'] = JText::_('COM_JOOMGALLERY_UPLOAD_ERROR_FILE_NOT_UPLOADED');;
|
||||
}
|
||||
}
|
||||
|
||||
if($debug_output = $uploader->getDebugOutput())
|
||||
{
|
||||
$result['debug_output'] = $debug_output;
|
||||
}
|
||||
|
||||
$doc = JFactory::getDocument();
|
||||
$doc->setMimeEncoding('text/plain');
|
||||
|
||||
echo json_encode($result);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/batchupload.php $
|
||||
// $Id: batchupload.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Batch Upload Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerBatchupload extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'batchupload');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the batch upload form
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// Access check
|
||||
if(!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload')))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl('categories'), false), JText::_('No categories found into which you are allowed to upload'), 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads the selected zip archiv
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
require_once JPATH_COMPONENT.'/helpers/upload.php';
|
||||
$uploader = new JoomUpload();
|
||||
if($uploader->upload(JRequest::getCmd('type', 'batch')))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_UPLOAD_MSG_SUCCESSFULL');
|
||||
$url = $this->_ambit->getRedirectUrl();
|
||||
|
||||
// Set custom redirect if we are asked for that
|
||||
if($redirect = JRequest::getVar('redirect', '', '', 'base64'))
|
||||
{
|
||||
$url_decoded = base64_decode($redirect);
|
||||
if(JURI::isInternal($url))
|
||||
{
|
||||
$url = $url_decoded;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect(JRoute::_($url, false), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($error = $uploader->getError())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $error, 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/categories.json.php $
|
||||
// $Id: categories.json.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Categories JSON Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.1
|
||||
*/
|
||||
class JoomGalleryControllerCategories extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Outputs a result set of allowed categories for a certain action in JSON format
|
||||
*
|
||||
* @return void
|
||||
* @since 2.1
|
||||
*/
|
||||
public function getCategories()
|
||||
{
|
||||
require_once JPATH_BASE.'/components/com_languages/helpers/jsonresponse.php';
|
||||
|
||||
$model = $this->getModel('categories');
|
||||
|
||||
$action = JRequest::getCmd('action');
|
||||
$filter = JRequest::getInt('filter');
|
||||
$search = JRequest::getString('searchstring');
|
||||
$limitstart = JRequest::getInt('more');
|
||||
$current = JRequest::getInt('current');
|
||||
|
||||
echo new JJsonResponse($model->getAllowedCategories($action, $filter, $search, $limitstart, $current));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the submitted ordering values for records via AJAX.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function saveOrder()
|
||||
{
|
||||
require_once JPATH_BASE.'/components/com_languages/helpers/jsonresponse.php';
|
||||
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get the arrays from the request
|
||||
$pks = JRequest::getVar('cid', null, 'post', 'array');
|
||||
$order = JRequest::getVar('order', null, 'post', 'array');
|
||||
$originalOrder = explode(',', JRequest::getString('original_order_values'));
|
||||
|
||||
// Make sure something has changed
|
||||
if($order !== $originalOrder)
|
||||
{
|
||||
// Create and load the categories table object
|
||||
$table = JTable::getInstance('joomgallerycategories', 'Table');
|
||||
|
||||
if($table->saveorder($pks, $order))
|
||||
{
|
||||
echo new JJsonResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,531 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/categories.php $
|
||||
// $Id: categories.php 4405 2014-07-02 07:13:31Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Categories Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerCategories extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'categories');
|
||||
|
||||
// Register tasks
|
||||
$this->registerTask('new', 'edit');
|
||||
$this->registerTask('apply', 'save');
|
||||
$this->registerTask('save2new', 'save');
|
||||
$this->registerTask('save2copy', 'save');
|
||||
$this->registerTask('unpublish', 'publish');
|
||||
#$this->registerTask('reject', 'approve');
|
||||
$this->registerTask('accesspublic', 'access');
|
||||
$this->registerTask('accessregistered', 'access');
|
||||
$this->registerTask('accessspecial', 'access');
|
||||
$this->registerTask('orderup', 'order');
|
||||
$this->registerTask('orderdown', 'order');
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes or unpublishes one or more categories
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function publish()
|
||||
{
|
||||
// Initialize variables
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$task = JRequest::getCmd('task');
|
||||
$publish = (int)($task == 'publish');
|
||||
|
||||
if(empty($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_CATEGORIES_SELECTED'));
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$unchanged_categories = 0;
|
||||
foreach($cid as $key => $id)
|
||||
{
|
||||
// Prune categories for which we aren't allowed to change the state
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.category.'.$id))
|
||||
{
|
||||
unset($cid[$key]);
|
||||
$unchanged_categories++;
|
||||
}
|
||||
}
|
||||
|
||||
if($unchanged_categories)
|
||||
{
|
||||
JError::raiseNotice(403, JText::plural('COM_JOOMGALLERY_CATMAN_ERROR_EDITSTATE_NOT_PERMITTED', $unchanged_categories));
|
||||
}
|
||||
|
||||
$model = $this->getModel('categories');
|
||||
if($count = $model->publish($cid, $publish))
|
||||
{
|
||||
if($count != 1)
|
||||
{
|
||||
$msg = JText::sprintf($publish ? 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORIES_PUBLISHED' : 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORIES_UNPUBLISHED', $count);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_($publish ? 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_PUBLISHED' : 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_UNPUBLISHED');
|
||||
}
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_ERROR_PUBLISHING_UNPUBLISHING');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Approves or rejects one or more comments
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function approve()
|
||||
{
|
||||
// Initialize variables
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$task = JRequest::getCmd('task');
|
||||
$publish = ($task == 'approve');
|
||||
|
||||
if(empty($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_CATEGORIES_SELECTED'));
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$unchanged_categories = 0;
|
||||
foreach($cid as $key => $id)
|
||||
{
|
||||
// Prune categories for which we aren't allowed to change the state
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.category.'.$id))
|
||||
{
|
||||
unset($cid[$key]);
|
||||
$unchanged_categories++;
|
||||
}
|
||||
}
|
||||
|
||||
if($unchanged_categories)
|
||||
{
|
||||
JError::raiseNotice(403, JText::plural('COM_JOOMGALLERY_CATMAN_ERROR_EDITSTATE_NOT_PERMITTED', $unchanged_categories));
|
||||
}
|
||||
|
||||
$model = $this->getModel('categories');
|
||||
if($count = $model->publish($cid, $publish, 'approve'))
|
||||
{
|
||||
if($count != 1)
|
||||
{
|
||||
$msg = JText::sprintf($publish ? 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORIES_APPROVED' : 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORIES_REJECTED', $count);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_($publish ? 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_APPROVED' : 'COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_REJECTED');
|
||||
}
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_ERROR_APPROVING_REJECTING');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more categories
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
$ids = JRequest::getVar('cid', array(), '', 'array');
|
||||
|
||||
$model = $this->getModel('categories');
|
||||
try
|
||||
{
|
||||
$count = $model->delete($ids);
|
||||
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_CATMAN_MSG_CATEGORIES_DELETED', $count);
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
catch(RuntimeException $e)
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $e->getMessage(), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more categories even though there
|
||||
* are still images or sub-categories in them.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function deletecompletely()
|
||||
{
|
||||
$mainframe = JFactory::getApplication('administrator');
|
||||
$categories = $mainframe->getUserState('joom.categories.delete.categories');
|
||||
$images = $mainframe->getUserState('joom.categories.delete.images');
|
||||
|
||||
if(!$categories || !is_array($categories) || !count($categories))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_CATEGORIES_SELECTED'), 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once JPATH_COMPONENT.'/helpers/refresher.php';
|
||||
|
||||
$refresher = new JoomRefresher(array('msg' => true));
|
||||
|
||||
$img_count = $mainframe->getUserState('joom.categories.delete.img_count');
|
||||
if(is_null($img_count))
|
||||
{
|
||||
$img_count = 0;
|
||||
}
|
||||
$cat_count = $mainframe->getUserState('joom.categories.delete.cat_count');
|
||||
if(is_null($cat_count))
|
||||
{
|
||||
$cat_count = 0;
|
||||
}
|
||||
|
||||
$error = false;
|
||||
|
||||
if($images && is_array($images) && count($images))
|
||||
{
|
||||
$model = $this->getModel('images');
|
||||
$row = $model->getTable('joomgalleryimages');
|
||||
foreach($images as $key => $image)
|
||||
{
|
||||
// Check whether image still exists.
|
||||
// It may have been deleted before if categories were selected
|
||||
// to delete as well as their sub-categories.
|
||||
if($row->load($image))
|
||||
{
|
||||
try
|
||||
{
|
||||
$model->delete(array($image));
|
||||
}
|
||||
catch(RuntimeException $e)
|
||||
{
|
||||
JLog::add($e->getMessage(), JLog::ERROR, 'jerror');
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$img_count++;
|
||||
}
|
||||
|
||||
unset($images[$key]);
|
||||
|
||||
if(!$refresher->check())
|
||||
{
|
||||
$mainframe->setUserState('joom.categories.delete.images', $images);
|
||||
$mainframe->setUserState('joom.categories.delete.img_count', $img_count);
|
||||
$refresher->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$model = $this->getModel('categories');
|
||||
$row = $model->getTable('joomgallerycategories');
|
||||
|
||||
$categories = $model->getOrderedCategories($categories, 'lft', 'DESC');
|
||||
|
||||
if(!$error)
|
||||
{
|
||||
foreach($categories as $key => $category)
|
||||
{
|
||||
// Check whether category still exists.
|
||||
// It may have been deleted before if categories were selected
|
||||
// to delete as well as their sub-categories.
|
||||
if($row->load($category))
|
||||
{
|
||||
try
|
||||
{
|
||||
$model->delete(array($category));
|
||||
}
|
||||
catch(RuntimeException $e)
|
||||
{
|
||||
JLog::add($e->getMessage(), JLog::ERROR, 'jerror');
|
||||
break;
|
||||
}
|
||||
|
||||
$cat_count++;
|
||||
}
|
||||
|
||||
unset($categories[$key]);
|
||||
|
||||
if(!$refresher->check() && count($categories))
|
||||
{
|
||||
$mainframe->setUserState('joom.categories.delete.images', $images);
|
||||
$mainframe->setUserState('joom.categories.delete.categories', $categories);
|
||||
$mainframe->setUserState('joom.categories.delete.img_count', $img_count);
|
||||
$mainframe->setUserState('joom.categories.delete.cat_count', $cat_count);
|
||||
$refresher->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($img_count)
|
||||
{
|
||||
if($img_count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_CATMAN_MSG_IMAGE_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_CATMAN_MSG_IMAGES_DELETED', $img_count);
|
||||
}
|
||||
$mainframe->enqueueMessage($msg);
|
||||
}
|
||||
|
||||
if($cat_count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_CATMAN_MSG_CATEGORIES_DELETED', $cat_count);
|
||||
}
|
||||
|
||||
// Reset all user states of this task
|
||||
$mainframe->setUserState('joom.categories.delete', null);
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the edit form of a category
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function edit()
|
||||
{
|
||||
JRequest::setVar('view', 'category');
|
||||
JRequest::setVar('layout', 'form');
|
||||
JRequest::setVar('hidemainmenu', 1);
|
||||
|
||||
parent::display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a category
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
$model = $this->getModel('category');
|
||||
|
||||
// Check whether a redirect is requested
|
||||
$redirect = false;
|
||||
if($url = JRequest::getVar('redirect', '', '', 'base64'));
|
||||
{
|
||||
$url = base64_decode($url);
|
||||
if(JURI::isInternal($url))
|
||||
{
|
||||
$redirect = $url;
|
||||
}
|
||||
}
|
||||
|
||||
if(JRequest::getCmd('task') == 'save2copy')
|
||||
{
|
||||
// Reset the ID and then treat the request as for apply.
|
||||
// This way a new category will be created and after that
|
||||
// it will be displayed right away
|
||||
JRequest::setVar('cid', 0);
|
||||
JRequest::setVar('task', 'apply');
|
||||
}
|
||||
|
||||
if($cid = $model->store())
|
||||
{
|
||||
if(!$redirect)
|
||||
{
|
||||
if(JRequest::getCmd('task') == 'save2new')
|
||||
{
|
||||
// Reset the ID after storing so that we
|
||||
// will be redirected to an empty form
|
||||
$cid = 0;
|
||||
JRequest::setVar('task', 'apply');
|
||||
}
|
||||
$redirect = $this->_ambit->getRedirectUrl(null, $cid);
|
||||
}
|
||||
|
||||
$msg = JText::_('COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_SAVED');
|
||||
$this->setRedirect($redirect, $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$redirect)
|
||||
{
|
||||
$redirect = $this->_ambit->getRedirectUrl();
|
||||
}
|
||||
|
||||
$msg = $model->getError();
|
||||
$this->setRedirect($redirect, $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the order of a category
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function order()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
|
||||
// Direction
|
||||
$dir = 1;
|
||||
$task = JRequest::getCmd('task');
|
||||
if($task == 'orderup')
|
||||
{
|
||||
$dir = -1;
|
||||
}
|
||||
|
||||
if(isset($cid[0]))
|
||||
{
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.category.'.$cid[0]))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_CATMAN_ERROR_EDITSTATE_NOT_PERMITTED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$row = JTable::getInstance('joomgallerycategories', 'Table');
|
||||
$row->load((int)$cid[0]);
|
||||
$row->move($dir);
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the order of the categories
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function saveOrder()
|
||||
{
|
||||
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get the arrays from the request
|
||||
$pks = JRequest::getVar('cid', null, 'post', 'array');
|
||||
$order = JRequest::getVar('order', null, 'post', 'array');
|
||||
$originalOrder = explode(',', JRequest::getString('original_order_values'));
|
||||
|
||||
// Make sure something has changed
|
||||
if($order !== $originalOrder)
|
||||
{
|
||||
// Create and load the categories table object
|
||||
$table = JTable::getInstance('joomgallerycategories', 'Table');
|
||||
|
||||
if($table->saveorder($pks, $order))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_NEW_ORDERING_SAVED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $table->getError(), 'error');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing to reorder
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl(), false));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function batch()
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$vars = $this->input->post->get('batch', array(), 'array');
|
||||
$cid = $this->input->post->get('cid', array(), 'array');
|
||||
|
||||
$model = $this->getModel('category');
|
||||
|
||||
// Attempt to run the batch operation
|
||||
if($model->batch($vars, $cid))
|
||||
{
|
||||
$this->setMessage(JText::_('JLIB_APPLICATION_SUCCESS_BATCH'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_FAILED', $model->getError()), 'error');
|
||||
}
|
||||
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel editing or creating a category
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function cancel()
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/changelog.php $
|
||||
// $Id: changelog.php 4232 2013-04-25 21:11:34Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Changelog Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.1
|
||||
*/
|
||||
class JoomGalleryControllerChangelog extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 3.1
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'changelog');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/comments.php $
|
||||
// $Id: comments.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Comments Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerComments extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'comments');
|
||||
|
||||
// Register tasks
|
||||
$this->registerTask('unpublish', 'publish');
|
||||
$this->registerTask('reject', 'approve');
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes or unpublishes one or more comments
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function publish()
|
||||
{
|
||||
// Initialize variables
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$task = JRequest::getCmd('task');
|
||||
$publish = ($task == 'publish');
|
||||
|
||||
if(empty($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMAN_MSG_NO_COMMENTS_SELECTED'));
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$model = $this->getModel('comments');
|
||||
if($count = $model->publish($cid, $publish))
|
||||
{
|
||||
if($count != 1){
|
||||
$msg = JText::sprintf($publish ? 'COM_JOOMGALLERY_COMMAN_MSG_COMMENTS_PUBLISHED' : 'COM_JOOMGALLERY_COMMAN_MSG_COMMENTS_UNPUBLISHED', $count);
|
||||
} else {
|
||||
$msg = JText::_($publish ? 'COM_JOOMGALLERY_COMMAN_MSG_COMMENT_PUBLISHED' : 'COM_JOOMGALLERY_COMMAN_MSG_COMMENT_UNPUBLISHED');
|
||||
}
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_ERROR_PUBLISHING_UNPUBLISHING');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Approves or rejects one or more comments
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function approve()
|
||||
{
|
||||
// Initialize variables
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$task = JRequest::getCmd('task');
|
||||
$publish = ($task == 'approve');
|
||||
|
||||
if(empty($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMAN_MSG_NO_COMMENTS_SELECTED'));
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$model = $this->getModel('comments');
|
||||
if($count = $model->publish($cid, $publish, 'approve'))
|
||||
{
|
||||
if($count != 1){
|
||||
$msg = JText::sprintf($publish ? 'COM_JOOMGALLERY_COMMAN_MSG_COMMENTS_APPROVED' : 'COM_JOOMGALLERY_COMMAN_MSG_COMMENTS_REJECTED', $count);
|
||||
} else {
|
||||
$msg = JText::_($publish ? 'COM_JOOMGALLERY_COMMAN_MSG_COMMENT_APPROVED' : 'COM_JOOMGALLERY_COMMAN_MSG_COMMENT_REJECTED');
|
||||
}
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_ERROR_APPROVING_REJECTING');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more comments
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
$model = $this->getModel('comments');
|
||||
$count = $model->delete();
|
||||
if($count === false){
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMAN_MSG_ERROR_DELETING_COMMENT');
|
||||
} else {
|
||||
if($count == 1){
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMAN_MSG_COMMENT_DELETED');
|
||||
} else {
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_COMMAN_MSG_COMMENTS_DELETED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all comments in the gallery
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
// Delete all comments
|
||||
$query = $this->_db->getQuery(true)
|
||||
->delete()
|
||||
->from(_JOOM_TABLE_COMMENTS);
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
// Redirect to maintenance manager because this task is usually launched there
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=comments'), $this->_db->getErrorMsg(), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Redirect to maintenance manager because this task is usually launched there
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=comments'), JText::_('COM_JOOMGALLERY_MAIMAN_CM_MSG_ALL_COMMENTS_DELETED'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes the comments with users registered and existing images.
|
||||
*
|
||||
* Comments of users that aren't registed any more will be marked as written by guests.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function synchronize()
|
||||
{
|
||||
// Synchronize users-comments-images
|
||||
$query = $this->_db->getQuery(true)
|
||||
->delete('c USING '._JOOM_TABLE_COMMENTS.' AS c')
|
||||
->leftJoin(_JOOM_TABLE_IMAGES.' AS i ON c.cmtpic = i.id')
|
||||
->where('i.id IS NULL');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
// Redirect to maintenance manager because this task is usually launched there
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=comments'), $this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_db->getQuery(true)
|
||||
->update(_JOOM_TABLE_COMMENTS.' AS c')
|
||||
->leftJoin('#__users AS u ON c.userid = u.id')
|
||||
->set('c.userid = 0')
|
||||
->where('u.id IS NULL');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
// Redirect to maintenance manager because this task is usually launched there
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=comments'), $this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Redirect to maintenance manager because this task is usually launched there
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=comments'), JText::_('COM_JOOMGALLERY_MAIMAN_CM_MSG_COMMENTS_SYNCHRONIZED'));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/config.php $
|
||||
// $Id: config.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Configuration Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerConfig extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Access check
|
||||
if(!JFactory::getUser()->authorise('core.admin', _JOOM_OPTION))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl(''), false), 'You are not allowed to configure this component', 'notice');
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
// Register tasks
|
||||
$this->registerTask('new', 'edit');
|
||||
$this->registerTask('apply', 'save');
|
||||
$this->registerTask('orderup', 'order');
|
||||
$this->registerTask('orderdown', 'order');
|
||||
|
||||
// Set view
|
||||
if($this->_config->isExtended())
|
||||
{
|
||||
JRequest::setVar('view', 'configs');
|
||||
}
|
||||
else
|
||||
{
|
||||
JRequest::setVar('view', 'config');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the edit form of a config row
|
||||
*
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$id = JRequest::getInt('id');
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
|
||||
if(!$id && count($cid) && $cid[0])
|
||||
{
|
||||
JRequest::setVar('id', (int) $cid[0]);
|
||||
}
|
||||
|
||||
JRequest::setVar('view', 'config');
|
||||
JRequest::setVar('hidemainmenu', 1);
|
||||
|
||||
parent::display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the configuration
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$config = JoomConfig::getInstance('admin');
|
||||
|
||||
$id = false;
|
||||
$existing_row = 0;
|
||||
$group_id = 0;
|
||||
if($config->isExtended())
|
||||
{
|
||||
$id = JRequest::getInt('id');
|
||||
$existing_row = JRequest::getInt('based_on');
|
||||
|
||||
if(!$id)
|
||||
{
|
||||
$group_id = JRequest::getInt('group_id');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = 1;
|
||||
}
|
||||
|
||||
$post = JRequest::get('post');
|
||||
|
||||
if(!$id = $config->save($post, $id, $existing_row, $group_id))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_CONFIG_MSG_SETTINGS_ERROR'), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$propagate_changes = JRequest::getBool('propagate_changes');
|
||||
|
||||
// The changes have to be propagated to the other config rows
|
||||
// if the default row was changed or if propagation is requested
|
||||
$success = true;
|
||||
if(!$id || $id == 1 || $propagate_changes)
|
||||
{
|
||||
$success = $this->getModel('configs')->propagateChanges($post, $id, $propagate_changes);
|
||||
}
|
||||
|
||||
if($success)
|
||||
{
|
||||
$controller = '';
|
||||
if(!$config->isExtended())
|
||||
{
|
||||
if(JRequest::getCmd('task') == 'apply')
|
||||
{
|
||||
$controller = 'config';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$controller = null;
|
||||
}
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl($controller, $id, 'id'), JText::_('COM_JOOMGALLERY_CONFIG_MSG_SETTINGS_SAVED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $this->getModel('configs')->getError(), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more config rows
|
||||
*
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
$config = JoomConfig::getInstance('admin');
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
|
||||
if(!count($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_CONFIGS_NO_ROWS_SELECTED'), 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach($cid as $config_id)
|
||||
{
|
||||
if($config->delete($config_id))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
JError::raiseWarning(500, $config->getError());
|
||||
}
|
||||
}
|
||||
|
||||
if(!$count)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_CONFIGS_MSG_ERROR_DELETING');
|
||||
$type = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
$msg = JText::plural('COM_JOOMGALLERY_CONFIGS_MSG_ROWS_DELETED', $count);
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the order of a config row
|
||||
*
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function order()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
|
||||
// Direction
|
||||
$dir = 1;
|
||||
$task = JRequest::getCmd('task');
|
||||
if($task == 'orderup')
|
||||
{
|
||||
$dir = -1;
|
||||
}
|
||||
|
||||
if(isset($cid[0]))
|
||||
{
|
||||
$row = JTable::getInstance('joomgalleryconfig', 'Table');
|
||||
$row->load((int)$cid[0]);
|
||||
$row->move($dir);
|
||||
//$row->reorder();
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the order of the config rows
|
||||
*
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function saveOrder()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
|
||||
$order = JRequest::getVar('order', array(0), 'post', 'array');
|
||||
|
||||
// Create and load the categories table object
|
||||
$row = JTable::getInstance('joomgalleryconfig', 'Table');
|
||||
|
||||
// Update the ordering for items in the cid array
|
||||
for($i = 0; $i < count($cid); $i ++)
|
||||
{
|
||||
$row->load((int)$cid[$i]);
|
||||
if($row->ordering != $order[$i])
|
||||
{
|
||||
$row->ordering = $order[$i];
|
||||
$row->check();
|
||||
if(!$row->store())
|
||||
{
|
||||
JError::raiseError( 500, $this->_db->getErrorMsg());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$row->reorder();
|
||||
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_NEW_ORDERING_SAVED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel editing or creating a config row
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
function cancel()
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/control.php $
|
||||
// $Id: control.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Control Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerControl extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
if(JRequest::getCmd('view') != 'mini')
|
||||
{
|
||||
JRequest::setVar('view', 'control');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a passed and dated extension
|
||||
*
|
||||
* The cURL library needs to be installed on the server for this.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function update()
|
||||
{
|
||||
$extension = JRequest::getCmd('extension', 0, 'get');
|
||||
$extensions = JoomExtensions::checkUpdate();
|
||||
|
||||
if(!isset($extensions[$extension]['updatelink']) || !extension_loaded('curl'))
|
||||
{
|
||||
$this->setRedirect('index.php?option='._JOOM_OPTION, JText::_('COM_JOOMGALLERY_ADMENU_MSG_ERROR_FETCHING_ZIP'), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
JoomExtensions::autoUpdate($extensions[$extension]['updatelink']);
|
||||
}
|
||||
|
||||
// Tell JoomGallery to do the update check again after the update
|
||||
$mainframe = JFactory::getApplication();
|
||||
$mainframe->setUserState('joom.update.checked', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs a new extension for JoomGallery
|
||||
*
|
||||
* The cURL library needs to be installed on the server for this.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function install()
|
||||
{
|
||||
$extension = JRequest::getCmd('extension', 0, 'get');
|
||||
$extensions = JoomExtensions::getAvailableExtensions();
|
||||
|
||||
if(!isset($extensions[$extension]['updatelink']) || !extension_loaded('curl'))
|
||||
{
|
||||
$this->setRedirect('index.php?option='._JOOM_OPTION, JText::_('COM_JOOMGALLERY_ADMENU_MSG_ERROR_FETCHING_ZIP'), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
JoomExtensions::autoUpdate($extensions[$extension]['updatelink']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the installer of Joomla! in order to install an extension
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
function doInstallation()
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
|
||||
JFactory::getLanguage()->load('com_installer');
|
||||
|
||||
$installer = JInstaller::getInstance();
|
||||
if(!$installer->install($this->_ambit->get('temp_path').'update'))
|
||||
{
|
||||
// There was an error installing the package
|
||||
$result = false;
|
||||
if(is_object($installer->manifest))
|
||||
{
|
||||
$msg = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_'.strtoupper($installer->manifest->attributes()->type)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Package installed sucessfully
|
||||
$msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_'.strtoupper($installer->manifest->attributes()->type)));
|
||||
$result = true;
|
||||
}
|
||||
|
||||
$mainframe->setUserState('joom.control.message', $installer->message);
|
||||
$mainframe->setUserState('joom.control.extension_message', $installer->get('extension_message'));
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, $result ? 'message' : 'error');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/cssedit.php $
|
||||
// $Id: cssedit.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery CSS Edit Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerCssedit extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Holds the name and the path to the CSS file to edit ('joom_local.css')
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $file;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Access check
|
||||
if(!JFactory::getUser()->authorise('core.admin', _JOOM_OPTION))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl(''), false), 'You are not allowed to configure this component', 'notice');
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'cssedit');
|
||||
|
||||
$this->file = JPATH_ROOT.'/media/joomgallery/css/joom_local.css';
|
||||
|
||||
// Register task
|
||||
$this->registerTask('apply', 'save');
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the CSS file
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$content = stripcslashes(JRequest::getVar('csscontent'));
|
||||
|
||||
if(!$content)
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_CSSMAN_MSG_EMPTY'), 'notice');
|
||||
return;
|
||||
}
|
||||
|
||||
if(JFile::write($this->file, $content))
|
||||
{
|
||||
$controller = '';
|
||||
if(JRequest::getCmd('task') == 'apply')
|
||||
{
|
||||
$controller = 'cssedit';
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl($controller), JText::_('COM_JOOMGALLERY_CSSMAN_MSG_CSS_SAVED'));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_CSSMAN_CSS_ERROR_WRITING').$this->file, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes CSS file
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
if(JFile::delete($this->file))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(''), JText::_('COM_JOOMGALLERY_CSSMAN_MSG_CSS_DELETED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(''), JText::_('COM_JOOMGALLERY_CSSMAN_CSS_ERROR_DELETING').$this->file, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel editing or creating the CSS file
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function cancel()
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(''));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/favourites.php $
|
||||
// $Id: favourites.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Favourites Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JoomGalleryControllerFavourites extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Resets all favourites in the gallery and deletes all created zips of favourites
|
||||
*
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$model = $this->getModel('favourites');
|
||||
if(!$model->reset())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=favourites'), $model->getError(), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=favourites'), JText::_('COM_JOOMGALLERY_MAIMAN_FV_MSG_ALL_FAVOURITES_DELETED'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes the entries in the users table of JoomGallery
|
||||
* with users registered and deletes all zips of favourites.
|
||||
*
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function synchronize()
|
||||
{
|
||||
$model = $this->getModel('favourites');
|
||||
if(!$model->synchronize())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=favourites'), $model->getError(), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=favourites'), JText::_('COM_JOOMGALLERY_MAIMAN_FV_MSG_FAVOURITES_SYNCHRONIZED'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/ftpupload.php $
|
||||
// $Id: ftpupload.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery FTP Upload Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerFtpupload extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'ftpupload');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the FTP upload form
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// Access check
|
||||
if(!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload')))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl('categories'), false), JText::_('No categories found into which you are allowed to upload'), 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads the selected images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
require_once JPATH_COMPONENT.'/helpers/upload.php';
|
||||
$uploader = new JoomUpload();
|
||||
if($uploader->upload(JRequest::getCmd('type', 'ftp')))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_UPLOAD_MSG_SUCCESSFULL');
|
||||
$url = $this->_ambit->getRedirectUrl();
|
||||
|
||||
// Set custom redirect if we are asked for that
|
||||
if($redirect = JRequest::getVar('redirect', '', '', 'base64'))
|
||||
{
|
||||
$url_decoded = base64_decode($redirect);
|
||||
if(JURI::isInternal($url))
|
||||
{
|
||||
$url = $url_decoded;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect(JRoute::_($url, false), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($error = $uploader->getError())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $error, 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/help.php $
|
||||
// $Id: help.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Help and Information Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerHelp extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'help');
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs a new language package for JoomGallery
|
||||
*
|
||||
* The cURL library needs to be installed on the server for this.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function install()
|
||||
{
|
||||
$language = JRequest::getCmd('language', 0, 'get');
|
||||
|
||||
if(!$this->_config->get('jg_checkupdate') || !$language || !extension_loaded('curl'))
|
||||
{
|
||||
$link = base64_decode(JRequest::getCmd('downloadlink'));
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::sprintf('COM_JOOMGALLERY_ADMENU_MSG_ERROR_FETCHING_LANGUAGE_ZIP', $link), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
$extensions = JoomExtensions::getAvailableExtensions();
|
||||
$url = $extensions['JoomGallery']['updatelink'];
|
||||
|
||||
$url = substr($url, 0, strrpos($url, '/') + 1);
|
||||
$url = str_replace('component/', '', $url);
|
||||
$url .= 'languages/'.$language.'.com_joomgallery.zip';
|
||||
|
||||
JoomExtensions::autoUpdate($url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/images.json.php $
|
||||
// $Id: images.json.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Images JSON Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.0
|
||||
*/
|
||||
class JoomGalleryControllerImages extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Method to save the submitted ordering values for records via AJAX.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function saveOrder()
|
||||
{
|
||||
require_once JPATH_BASE.'/components/com_languages/helpers/jsonresponse.php';
|
||||
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$conditions = array();
|
||||
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$order = JRequest::getVar('order', array(), 'post', 'array');
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$row = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
|
||||
// Update the ordering for items in the cid array
|
||||
for($i = 0; $i < count($cid); $i ++)
|
||||
{
|
||||
if(!$user->authorise('core.edit.state', _JOOM_OPTION.'.image.'.$cid[$i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$row->load((int)$cid[$i]);
|
||||
if($row->ordering != $order[$i])
|
||||
{
|
||||
$row->ordering = $order[$i];
|
||||
if(!$row->store())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Remember the categories for reordering
|
||||
$condition = 'catid = '.(int) $row->catid;
|
||||
$found = false;
|
||||
foreach($conditions as $cond)
|
||||
{
|
||||
if($cond == $condition)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$found)
|
||||
{
|
||||
$conditions[] = $condition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Execute reorder for each category
|
||||
foreach($conditions as $cond)
|
||||
{
|
||||
$row->reorder($cond);
|
||||
}
|
||||
|
||||
echo new JJsonResponse();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,797 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/images.php $
|
||||
// $Id: images.php 4405 2014-07-02 07:13:31Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Images Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerImages extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', JRequest::getCmd('view', 'images'));
|
||||
|
||||
// Register tasks
|
||||
$this->registerTask('new', 'edit');
|
||||
$this->registerTask('apply', 'save');
|
||||
$this->registerTask('save2new', 'save');
|
||||
$this->registerTask('save2copy', 'save');
|
||||
$this->registerTask('unpublish', 'publish');
|
||||
$this->registerTask('unfeature', 'feature');
|
||||
$this->registerTask('reject', 'approve');
|
||||
$this->registerTask('accesspublic', 'access');
|
||||
$this->registerTask('accessregistered', 'access');
|
||||
$this->registerTask('accessspecial', 'access');
|
||||
$this->registerTask('orderup', 'order');
|
||||
$this->registerTask('orderdown', 'order');
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes or unpublishes one or more images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function publish()
|
||||
{
|
||||
// Initialize variables
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$task = JRequest::getCmd('task');
|
||||
$publish = (int)($task == 'publish');
|
||||
|
||||
if(empty($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_IMAGES_SELECTED'));
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$unchanged_images = 0;
|
||||
foreach($cid as $key => $id)
|
||||
{
|
||||
// Prune images for which we aren't allowed to change the state
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.image.'.$id))
|
||||
{
|
||||
unset($cid[$key]);
|
||||
$unchanged_images++;
|
||||
}
|
||||
}
|
||||
|
||||
if($unchanged_images)
|
||||
{
|
||||
JError::raiseNotice(403, JText::plural('COM_JOOMGALLERY_IMGMAN_ERROR_EDITSTATE_NOT_PERMITTED', $unchanged_images));
|
||||
}
|
||||
|
||||
$model = $this->getModel('images');
|
||||
if($count = $model->publish($cid, $publish))
|
||||
{
|
||||
if($count != 1)
|
||||
{
|
||||
$msg = JText::sprintf($publish ? 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_PUBLISHED' : 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_UNPUBLISHED', $count);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_($publish ? 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_PUBLISHED' : 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_UNPUBLISHED');
|
||||
}
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_ERROR_PUBLISHING_UNPUBLISHING');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Features or unfeatures one or more images
|
||||
*
|
||||
* @return void
|
||||
* @since 3.3
|
||||
*/
|
||||
public function feature()
|
||||
{
|
||||
// Initialize variables
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$task = JRequest::getCmd('task');
|
||||
$feature = (int)($task == 'feature');
|
||||
|
||||
if(empty($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_IMAGES_SELECTED'));
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$unchanged_images = 0;
|
||||
foreach($cid as $key => $id)
|
||||
{
|
||||
// Prune images for which we aren't allowed to change the state
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.image.'.$id))
|
||||
{
|
||||
unset($cid[$key]);
|
||||
$unchanged_images++;
|
||||
}
|
||||
}
|
||||
|
||||
if($unchanged_images)
|
||||
{
|
||||
JError::raiseNotice(403, JText::plural('COM_JOOMGALLERY_IMGMAN_ERROR_EDITSTATE_NOT_PERMITTED', $unchanged_images));
|
||||
}
|
||||
|
||||
$model = $this->getModel('images');
|
||||
if($count = $model->publish($cid, $feature, 'feature'))
|
||||
{
|
||||
if($count != 1)
|
||||
{
|
||||
$msg = JText::sprintf($feature ? 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_FEATURED' : 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_UNFEATURED', $count);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_($feature ? 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_FEATURED' : 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_UNFEATURED');
|
||||
}
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_ERROR_FEATURING_UNFEATURING');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Approves or rejects one or more images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function approve()
|
||||
{
|
||||
// Initialize variables
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$task = JRequest::getCmd('task');
|
||||
$publish = -1;
|
||||
if($task == 'approve')
|
||||
{
|
||||
$publish = 1;
|
||||
}
|
||||
|
||||
if(empty($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_IMAGES_SELECTED'));
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$unchanged_images = 0;
|
||||
foreach($cid as $key => $id)
|
||||
{
|
||||
// Prune images for which we aren't allowed to change the state
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.image.'.$id))
|
||||
{
|
||||
unset($cid[$key]);
|
||||
$unchanged_images++;
|
||||
}
|
||||
}
|
||||
|
||||
if($unchanged_images)
|
||||
{
|
||||
$this->_mainframe->enqueueMessage(JText::plural('COM_JOOMGALLERY_IMGMAN_ERROR_EDITSTATE_NOT_PERMITTED', $unchanged_images), 'notice');
|
||||
}
|
||||
|
||||
$model = $this->getModel('images');
|
||||
if($count = $model->publish($cid, $publish, 'approve'))
|
||||
{
|
||||
if($count != 1)
|
||||
{
|
||||
$msg = JText::sprintf($publish == 1 ? 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_APPROVED' : 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_REJECTED', $count);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_($publish == 1 ? 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_APPROVED' : 'COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_REJECTED');
|
||||
|
||||
// Send message about rejection if a message was specified
|
||||
if($task == 'reject' && $message = JRequest::getString('message'))
|
||||
{
|
||||
$model->sendRejectionMessage($cid[0], $message);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_ERROR_APPROVING_REJECTING');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
$model = $this->getModel('images');
|
||||
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$unaffected_images = 0;
|
||||
foreach($cid as $key => $id)
|
||||
{
|
||||
// Prune images which we aren't allowed to delete
|
||||
if(!JFactory::getUser()->authorise('core.delete', _JOOM_OPTION.'.image.'.$id))
|
||||
{
|
||||
unset($cid[$key]);
|
||||
$unaffected_images++;
|
||||
}
|
||||
}
|
||||
|
||||
JRequest::setVar('cid', $cid);
|
||||
|
||||
if($unaffected_images)
|
||||
{
|
||||
JLog::add(JText::plural('COM_JOOMGALLERY_IMGMAN_ERROR_DELETE_NOT_PERMITTED', $unaffected_images), JLog::WARNING, 'jerror');
|
||||
}
|
||||
|
||||
if(!count($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$count = $model->delete($cid);
|
||||
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_DELETED', $count);
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
catch(RuntimeException $e)
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $e->getMessage(), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the edit form for one or multiple images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(), '', 'array');
|
||||
if(count($cid) <= 1)
|
||||
{
|
||||
if(count($cid))
|
||||
{
|
||||
$exploded = explode(',', $cid[0]);
|
||||
if(count($exploded) > 1)
|
||||
{
|
||||
JRequest::setVar('cid', $exploded);
|
||||
JRequest::setVar('view', 'editimages');
|
||||
}
|
||||
else
|
||||
{
|
||||
JRequest::setVar('view', 'image');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JRequest::setVar('view', 'image');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JRequest::setVar('view', 'editimages');
|
||||
}
|
||||
|
||||
JRequest::setVar('layout', 'form');
|
||||
JRequest::setVar('hidemainmenu', 1);
|
||||
|
||||
parent::display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves one or more images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$model = $this->getModel('image');
|
||||
|
||||
$data = JRequest::get('post', 2);
|
||||
|
||||
// Editing more than one image?
|
||||
if(isset($data['cids']))
|
||||
{
|
||||
// Selected images
|
||||
$cids_string = $data['cids'];
|
||||
$cids = explode(',', $cids_string);
|
||||
|
||||
// We need selected fields
|
||||
if(!isset($data['change']))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, implode(',', $cids)), JText::_('COM_JOOMGALLERY_IMGMAN_MSG_NO_BOXES_FOR_EDITING_CHECKED'), 'notice');
|
||||
return;
|
||||
}
|
||||
|
||||
// Selected fields to edit
|
||||
$change = $data['change'];
|
||||
|
||||
// Get start counter for consecutive numbering of image title
|
||||
$imgtitlestartcounter = (int) $data['imgtitlestartcounter'];
|
||||
$imgname_separator = JText::_('COM_JOOMGALLERY_IMGMAN_IMAGENAME_SEPARATOR');
|
||||
|
||||
$changeable_fields = array('imgtitle', 'catid', 'access', 'imgtext', 'owner', 'imgauthor', 'clearvotes',
|
||||
'cleardownloads', 'clearhits', 'published', 'approved', 'hidden', 'ordering', 'metakey', 'metadesc');
|
||||
$state_fields = array('published', 'approved', 'hidden', 'ordering');
|
||||
|
||||
// Delete all unselected and unchangeable fields
|
||||
foreach($data as $key => $value)
|
||||
{
|
||||
if(!in_array($key, $change) || !in_array($key, $changeable_fields))
|
||||
{
|
||||
unset($data[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Save each image
|
||||
$return = array();
|
||||
$count = 0;
|
||||
$imgtitle = isset($data['imgtitle']) ? $data['imgtitle'] : '';
|
||||
foreach($cids as $cid)
|
||||
{
|
||||
// Add consecutive number in image title
|
||||
if($imgtitlestartcounter > 0 && !empty($imgtitle))
|
||||
{
|
||||
$data['imgtitle'] = sprintf('%s'.$imgname_separator.'%d', $imgtitle, $imgtitlestartcounter++);
|
||||
}
|
||||
|
||||
$cloned_data = $data;
|
||||
|
||||
// Delete state fields if editing the state is not allowed
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.image.'.$cid))
|
||||
{
|
||||
foreach($state_fields as $field)
|
||||
{
|
||||
if(isset($cloned_data[$field]))
|
||||
{
|
||||
unset($cloned_data[$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether images shall be moved or copied
|
||||
if(isset($cloned_data['catid']) && JRequest::getCmd('movecopy') == 'copy')
|
||||
{
|
||||
$orig_img = (array) $this->_ambit->getImgObject($cid);
|
||||
|
||||
$orig_img['thumb_catid'] = $orig_img['catid'];
|
||||
$orig_img['detail_catid'] = $orig_img['catid'];
|
||||
|
||||
$orig_img['alias'] = '';
|
||||
|
||||
$orig_img['copy_original'] = false;
|
||||
if(is_file($this->_ambit->getImg('orig_path', (object) $orig_img)))
|
||||
{
|
||||
$orig_img['copy_original'] = true;
|
||||
}
|
||||
|
||||
foreach($cloned_data as $key => $value)
|
||||
{
|
||||
$orig_img[$key] = $value;
|
||||
}
|
||||
|
||||
// Set image ID back so that the model creates new images
|
||||
$orig_img['id'] = 0;
|
||||
$orig_img['cid'] = 0;
|
||||
|
||||
$cloned_data = $orig_img;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cloned_data['cid'] = $cid;
|
||||
}
|
||||
|
||||
if($model->store($cloned_data))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
JError::raiseWarning(100, $model->getError());
|
||||
}
|
||||
}
|
||||
|
||||
if($count)
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, implode(',', $cids)), JText::plural('COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_SAVED', $count));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::sprintf('COM_JOOMGALLERY_IMGMAN_MSG_ERROR_SAVING_IMAGES'), 'error');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(JRequest::getCmd('task') == 'save2copy')
|
||||
{
|
||||
// Reset the ID and then treat the request as for apply.
|
||||
// This way a new image will be created and after that
|
||||
// it will be displayed right away
|
||||
JRequest::setVar('cid', 0);
|
||||
JRequest::setVar('task', 'apply');
|
||||
}
|
||||
|
||||
// Editing only one image
|
||||
if($cid = $model->store())
|
||||
{
|
||||
if(JRequest::getCmd('task') == 'save2new')
|
||||
{
|
||||
// Reset the ID after storing so that we
|
||||
// will be redirected to an empty form
|
||||
JRequest::setVar('task', 'apply');
|
||||
$cid = 0;
|
||||
}
|
||||
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_SAVED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, $cid), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = $model->getError();
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the order of an image
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function order()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
|
||||
// Direction
|
||||
$dir = 1;
|
||||
$task = JRequest::getCmd('task');
|
||||
if($task == 'orderup')
|
||||
{
|
||||
$dir = -1;
|
||||
}
|
||||
|
||||
if(isset($cid[0]))
|
||||
{
|
||||
if(!JFactory::getUser()->authorise('core.edit.state', _JOOM_OPTION.'.image.'.$cid[0]))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_ERROR_EDITSTATE_NOT_PERMITTED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$row = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
$row->load((int)$cid[0]);
|
||||
$row->move($dir, 'catid = '.$row->catid);
|
||||
$row->reorder('catid = '.$row->catid);
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the order of the images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function saveOrder()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$order = JRequest::getVar('order', array (0), 'post', 'array');
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Create and load the images table object
|
||||
$row = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
|
||||
// Update the ordering for items in the cid array
|
||||
$unchanged_images = 0;
|
||||
for($i = 0; $i < count($cid); $i ++)
|
||||
{
|
||||
if(!$user->authorise('core.edit.state', _JOOM_OPTION.'.image.'.$cid))
|
||||
{
|
||||
$unchanged_images++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$row->load((int)$cid[$i]);
|
||||
if($row->ordering != $order[$i])
|
||||
{
|
||||
$row->ordering = $order[$i];
|
||||
if(!$row->store())
|
||||
{
|
||||
JError::raiseError(500, $this->_db->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($unchanged_images)
|
||||
{
|
||||
JError::raiseNotice(403, JText::plural('COM_JOOMGALLERY_IMGMAN_ERROR_EDITSTATE_NOT_PERMITTED', $unchanged_images));
|
||||
}
|
||||
|
||||
$row->reorderAll();
|
||||
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_NEW_ORDERING_SAVED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the move form
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function showmove()
|
||||
{
|
||||
JRequest::setVar('view', 'move');
|
||||
JRequest::setVar('hidemainmenu', 1);
|
||||
|
||||
parent::display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves images to another category
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function move()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(), 'post', 'array');
|
||||
$catid = JRequest::getInt('catid');
|
||||
|
||||
if(!count($cid))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_IMAGES_SELECTED'), 'notice');
|
||||
$this->redirect();
|
||||
}
|
||||
if(!$catid)
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_IMGMAN_MSG_NO_CATEGORY_SELECTED'), 'notice');
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$count = 0;
|
||||
$unaffected_images = 0;
|
||||
$model = $this->getModel('image');
|
||||
foreach($cid as $id)
|
||||
{
|
||||
if(!$user->authorise('joom.upload', _JOOM_OPTION.'.category.'.$catid))
|
||||
{
|
||||
$unaffected_images++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if($model->moveImage($id, $catid))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if($unaffected_images)
|
||||
{
|
||||
JError::raiseNotice(403, JText::plural('COM_JOOMGALLERY_IMGMAN_ERROR_MOVE_NOT_PERMITTED', $unaffected_images));
|
||||
}
|
||||
|
||||
if($count)
|
||||
{
|
||||
if($count == 1)
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_IMGMAN_MSG_IMAGE_MOVED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::sprintf('COM_JOOMGALLERY_IMGMAN_MSG_IMAGES_MOVED', $count));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreates thumbnails and detail images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function recreate()
|
||||
{
|
||||
$model = $this->getModel('images');
|
||||
$count = $model->recreate();
|
||||
if(!$count[0])
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count[0] == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_THUMBNAIL_RECREATED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_COMMON_MSG_THUMBNAILS_RECREATED', $count[0]);
|
||||
}
|
||||
if($count[1])
|
||||
{
|
||||
if($count[1] == 1)
|
||||
{
|
||||
$msg .= '</li><li>'.JText::_('COM_JOOMGALLERY_COMMON_MSG_IMAGE_RECREATED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= '</li><li>'.JText::sprintf('COM_JOOMGALLERY_COMMON_MSG_IMAGES_RECREATED', $count[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets hits of an image
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function resetHits()
|
||||
{
|
||||
$id = JRequest::getInt('cid');
|
||||
|
||||
if(!JFactory::getUser()->authorise('core.edit', _JOOM_OPTION.'.image.'.$id))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_ERROR_EDIT_NOT_PERMITTED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, $id), $msg, 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Instantiate and load an image table
|
||||
$row = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
$row->load($id);
|
||||
$row->hits = 0;
|
||||
$row->store();
|
||||
|
||||
JRequest::setVar('task', 'apply');
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_MSG_HITS_RESETED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, $id), $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets downloads of an image
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1
|
||||
*/
|
||||
public function resetDownloads()
|
||||
{
|
||||
$id = JRequest::getInt('cid');
|
||||
|
||||
if(!JFactory::getUser()->authorise('core.edit', _JOOM_OPTION.'.image.'.$id))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_ERROR_EDIT_NOT_PERMITTED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, $id), $msg, 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Instantiate and load an image table
|
||||
$row = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
$row->load($id);
|
||||
$row->downloads = 0;
|
||||
$row->store();
|
||||
|
||||
JRequest::setVar('task', 'apply');
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_MSG_DOWNLOADS_RESETED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, $id), $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets votes of an image
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function resetVotes()
|
||||
{
|
||||
$id = JRequest::getInt('cid');
|
||||
|
||||
if(!JFactory::getUser()->authorise('core.edit', _JOOM_OPTION.'.image.'.$id))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_ERROR_EDIT_NOT_PERMITTED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, $id), $msg, 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Instantiate and load an image table
|
||||
$row = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
$row->load($id);
|
||||
|
||||
// Delete votes for image
|
||||
$row->imgvotes = 0;
|
||||
$row->imgvotesum = 0;
|
||||
$query = $this->_db->getQuery(true)
|
||||
->delete(_JOOM_TABLE_VOTES)
|
||||
->where('picid = '.$row->id);
|
||||
$this->_db->setQuery($query);
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessagge($this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return false;
|
||||
}
|
||||
$row->store();
|
||||
|
||||
JRequest::setVar('task', 'apply');
|
||||
$msg = JText::_('COM_JOOMGALLERY_IMGMAN_MSG_VOTES_RESETED');
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(null, $id), $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel creating, editing or moving images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/jupload.php $
|
||||
// $Id: jupload.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Java Upload Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerJupload extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'jupload');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the Java upload form
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// Access check
|
||||
if(!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload')))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl('categories'), false), JText::_('No categories found into which you are allowed to upload'), 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads the passed images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
require_once JPATH_COMPONENT.'/helpers/upload.php';
|
||||
$uploader = new JoomUpload();
|
||||
$uploader->upload(JRequest::getCmd('type', 'java'));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,828 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/maintenance.php $
|
||||
// $Id: maintenance.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Maintenance Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerMaintenance extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Access check
|
||||
if(!JFactory::getUser()->authorise('core.admin', _JOOM_OPTION))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl(''), false), 'You are not allowed to configure this component', 'notice');
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'maintenance');
|
||||
|
||||
$this->registerTask('parsefolders', 'check');
|
||||
$this->registerTask('checkimages', 'check');
|
||||
$this->registerTask('checkcategories', 'check');
|
||||
$this->registerTask('createfilesuggestions', 'check');
|
||||
$this->registerTask('createfoldersuggestions', 'check');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more images even if some files aren't found
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function remove()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->delete())
|
||||
{
|
||||
$msg = $model->getError();
|
||||
$type = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_IMAGE_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_IMAGES_DELETED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more categories even if some files or
|
||||
* folders aren't found or if there are still sub-categories
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function removeCategory()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->deletecategory())
|
||||
{
|
||||
$msg = $model->getError();
|
||||
$type = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_CATEGORY_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_CATEGORIES_DELETED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=categories', $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more categories even though there
|
||||
* are still images or sub-categories in them.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function deleteCompletely()
|
||||
{
|
||||
$mainframe = JFactory::getApplication('administrator');
|
||||
$categories = $mainframe->getUserState('joom.maintenance.delete.categories');
|
||||
$images = $mainframe->getUserState('joom.maintenance.delete.images');
|
||||
|
||||
if(!$categories || !is_array($categories) || !count($categories))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=categories', JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_CATEGORIES_SELECTED'), 'notice');
|
||||
return;
|
||||
}
|
||||
|
||||
require_once JPATH_COMPONENT.'/helpers/refresher.php';
|
||||
|
||||
$refresher = new JoomRefresher();
|
||||
|
||||
$img_count = $mainframe->getUserState('joom.maintenance.delete.img_count');
|
||||
if(is_null($img_count))
|
||||
{
|
||||
$img_count = 0;
|
||||
}
|
||||
$cat_count = $mainframe->getUserState('joom.maintenance.delete.cat_count');
|
||||
if(is_null($cat_count))
|
||||
{
|
||||
$cat_count = 0;
|
||||
}
|
||||
|
||||
$model = $this->getModel('maintenance');
|
||||
if($images && is_array($images) && count($images))
|
||||
{
|
||||
$row = $model->getTable('joomgalleryimages');
|
||||
foreach($images as $key => $image)
|
||||
{
|
||||
// Check whether image still exists.
|
||||
// It may have been deleted before if categories were selected
|
||||
// to delete as well as their sub-categories.
|
||||
if($row->load($image))
|
||||
{
|
||||
JRequest::setVar('cid', array($image));
|
||||
if($model->delete(false))
|
||||
{
|
||||
$img_count++;
|
||||
}
|
||||
|
||||
unset($images[$key]);
|
||||
}
|
||||
|
||||
if(!$refresher->check())
|
||||
{
|
||||
$mainframe->setUserState('joom.maintenance.delete.images', $images);
|
||||
$mainframe->setUserState('joom.maintenance.delete.img_count', $img_count);
|
||||
$refresher->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$row = $model->getTable('joomgallerycategories');
|
||||
for($i = count($categories) - 1; $i >= 0; $i--)
|
||||
{
|
||||
foreach($categories[$i] as $key => $category)
|
||||
{
|
||||
// Check whether category still exists.
|
||||
// It may have been deleted before if categories were selected
|
||||
// to delete as well as their sub-categories.
|
||||
if($row->load($category))
|
||||
{
|
||||
JRequest::setVar('cid', array($category));
|
||||
if($model->deletecategory(false, false))
|
||||
{
|
||||
$cat_count++;
|
||||
}
|
||||
|
||||
unset($categories[$i][$key]);
|
||||
}
|
||||
|
||||
if(!$refresher->check() && count($categories[0]))
|
||||
{
|
||||
$mainframe->setUserState('joom.maintenance.delete.categories', $categories);
|
||||
$mainframe->setUserState('joom.maintenance.delete.img_count', $img_count);
|
||||
$mainframe->setUserState('joom.maintenance.delete.cat_count', $cat_count);
|
||||
$refresher->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($img_count)
|
||||
{
|
||||
if($img_count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_IMAGE_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_IMAGES_DELETED', $img_count);
|
||||
}
|
||||
$mainframe->enqueueMessage($msg);
|
||||
}
|
||||
|
||||
if($cat_count)
|
||||
{
|
||||
if($cat_count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_CATEGORY_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_CATEGORIES_DELETED', $cat_count);
|
||||
}
|
||||
$mainframe->enqueueMessage($msg);
|
||||
}
|
||||
|
||||
// Reset all user states of this task
|
||||
$mainframe->setUserState('joom.maintenance.delete', null);
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=categories');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets aliases of all images and categories
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function setAlias()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
$count = $model->resetAliases();
|
||||
if(!$count[0])
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_CATEGORIES_ALIAS_RESET');
|
||||
if($count[0])
|
||||
{
|
||||
$msg .= '</li><li>'.JText::_('COM_JOOMGALLERY_MAIMAN_MSG_IMAGES_ALIAS_RESET');
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new user as the owner of the selected images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function setUser()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
$count = $model->setUser();
|
||||
if(!$count)
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_IMAGE_USER_SET');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_IMAGES_USER_SET', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new user as the owner of the selected categories
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function setCategoryUser()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
$count = $model->setCategoryUser();
|
||||
if(!$count)
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_CT_MSG_CATEGORY_USER_SET');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_CT_MSG_CATEGORIES_USER_SET', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=categories', $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves orphaned files to their suggested correct folder
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function addOrphan()
|
||||
{
|
||||
$tab = JRequest::getCmd('tab');
|
||||
|
||||
if($tab == 'orphans')
|
||||
{
|
||||
$tab = '&tab=orphans';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab = '';
|
||||
}
|
||||
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->addOrphan())
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_ORPHAN_SUCCESSFULLY_ADDED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_ORPHANS_SUCCESSFULLY_ADDED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().$tab, $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters selected images and moves all orphaned files to their suggested correct folder
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function addOrphans()
|
||||
{
|
||||
$tab = JRequest::getCmd('tab');
|
||||
|
||||
if($tab == 'orphans')
|
||||
{
|
||||
$tab = '&tab=orphans';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab = '';
|
||||
}
|
||||
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->addOrphans())
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_ORPHAN_SUCCESSFULLY_ADDED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_ORPHANS_SUCCESSFULLY_ADDED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().$tab, $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves orphaned files to their suggested correct folder
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function addOrphanedFolder()
|
||||
{
|
||||
$tab = JRequest::getCmd('tab');
|
||||
|
||||
if($tab == 'folders')
|
||||
{
|
||||
$tab = '&tab=folders';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab = '&tab=categories';
|
||||
}
|
||||
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->addOrphanedFolder())
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDER_SUCCESSFULLY_ADDED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDERS_SUCCESSFULLY_ADDED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().$tab, $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters selected images and moves all orphaned files to their suggested correct folder
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function addOrphanedFolders()
|
||||
{
|
||||
$tab = JRequest::getCmd('tab');
|
||||
|
||||
if($tab == 'folders')
|
||||
{
|
||||
$tab = '&tab=folders';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab = '&tab=categories';
|
||||
}
|
||||
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->addOrphanedFolders())
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDER_SUCCESSFULLY_ADDED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDERS_SUCCESSFULLY_ADDED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().$tab, $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreates thumbnails and detail images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function recreate()
|
||||
{
|
||||
// Load the necessary image IDs
|
||||
$cids = JRequest::getVar('cid', array(), '', 'array');
|
||||
|
||||
if(!count($cids))
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_IMAGES_SELECTED'), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
JArrayHelper::toInteger($cids);
|
||||
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('refid')
|
||||
->from($this->_db->qn(_JOOM_TABLE_MAINTENANCE))
|
||||
->where('id IN ('.implode(',', $cids).')');
|
||||
$this->_db->setQuery($query);
|
||||
if(!$cids = $this->_db->loadColumn())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
JRequest::setVar('cid', $cids);
|
||||
|
||||
// Recreate the images
|
||||
$model = $this->getModel('images');
|
||||
$count = $model->recreate();
|
||||
if(!$count[0] && !$count[1])
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
$msg = '';
|
||||
/*if($count[0])
|
||||
{
|
||||
if($count[0] == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_THUMBNAIL_RECREATED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_COMMON_MSG_THUMBNAILS_RECREATED', $count[0]);
|
||||
}
|
||||
}
|
||||
if($count[1])
|
||||
{
|
||||
if($count[1] == 1)
|
||||
{
|
||||
$msg .= '</li><li>'.JText::_('COM_JOOMGALLERY_COMMON_MSG_IMAGE_RECREATED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= '</li><li>'.JText::sprintf('COM_JOOMGALLERY_COMMON_MSG_IMAGES_RECREATED', $count[1]);
|
||||
}
|
||||
}*/
|
||||
|
||||
foreach($count[2] as $key => $types)
|
||||
{
|
||||
$set = '';
|
||||
if(in_array('thumb', $types))
|
||||
{
|
||||
$set = 'thumb = '.$this->_db->q($this->_ambit->getImg('thumb_url', $key)).', thumborphan = 0';
|
||||
}
|
||||
if(in_array('img', $types))
|
||||
{
|
||||
if($set)
|
||||
{
|
||||
$set .= ', ';
|
||||
}
|
||||
$set .= 'img = '.$this->_db->q($this->_ambit->getImg('img_url', $key)).', imgorphan = 0';
|
||||
}
|
||||
|
||||
if($set)
|
||||
{
|
||||
$query = $this->_db->getQuery(true)
|
||||
->update($this->_db->qn(_JOOM_TABLE_MAINTENANCE))
|
||||
->set($set)
|
||||
->where('refid = '.$key)
|
||||
->where('type = 0');
|
||||
$this->_db->setQuery($query);
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
JError::raiseWarning(500, $this->_db->getErrorMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more orphaned files
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function deleteOrphan()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->deleteOrphan())
|
||||
{
|
||||
$msg = $model->getError();
|
||||
$type = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_FILE_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_FILES_DELETED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=orphans', $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more orphaned files
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function deleteOrphanedFolder()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->deleteOrphanedFolder())
|
||||
{
|
||||
$msg = $model->getError();
|
||||
$type = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDER_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDERS_DELETED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=folders', $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes all suggested tasks on orphaned files.
|
||||
*
|
||||
* Files for which corrupt images were found will be moved.
|
||||
* All other files will be deleted.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function applySuggestions()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
$count = $model->applySuggestions();
|
||||
if(!$count)
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count[0] == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_MSG_ONE_ORPHAN_SUCCESSFULLY_ADDED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_ORPHANS_SUCCESSFULLY_ADDED', $count[0]);
|
||||
}
|
||||
if($count[1] !== false)
|
||||
{
|
||||
if($count[1] == 1)
|
||||
{
|
||||
$msg .= '</li><li>'.JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_ONE_FILE_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= '</li><li>'.JText::sprintf('COM_JOOMGALLERY_MAIMAN_MSG_FILES_DELETED', $count[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=orphans', $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes all suggested tasks on orphaned folders.
|
||||
*
|
||||
* Folders for which corrupt categories were found will be moved.
|
||||
* All other folders will be deleted.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function applyFolderSuggestions()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
$count = $model->applyFolderSuggestions();
|
||||
if(!$count)
|
||||
{
|
||||
$type = 'error';
|
||||
$msg = $model->getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count[0] == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_OF_MSG_ONE_FOLDER_ADDED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDERS_SUCCESSFULLY_ADDED', $count[0]);
|
||||
}
|
||||
if($count[1] !== false)
|
||||
{
|
||||
if($count[1] == 1)
|
||||
{
|
||||
$msg .= '</li><li>'.JText::sprintf('COM_JOOMGALLERY_MAIMAN_OF_MSG_ONE_FOLDER_DELETED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= '</li><li>'.JText::sprintf('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDERS_DELETED', $count[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=folders', $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new folders for categories.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
if(!$count = $model->create())
|
||||
{
|
||||
$msg = $model->getError();
|
||||
$type = 'error';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = 'message';
|
||||
if($count == 1)
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDER_CREATED');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_MAIMAN_OF_MSG_FOLDERS_CREATED', $count);
|
||||
}
|
||||
}
|
||||
|
||||
// Some messages are enqueued by the model
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=categories', $msg, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for corrupt images and orphand files in the filesystem of JoomGallery
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$model = $this->getModel('maintenancecheck');
|
||||
|
||||
$task = JRequest::getCmd('task');
|
||||
|
||||
require_once JPATH_COMPONENT.'/helpers/refresher.php';
|
||||
|
||||
// The model will redirect, too.
|
||||
$model->$task();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes all database tables of JoomGallery
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function optimize()
|
||||
{
|
||||
$model = $this->getModel('maintenance');
|
||||
|
||||
if(!$model->optimize())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=database', JText::_('COM_JOOMGALLERY_MAIMAN_DB_MSG_OPTIMIZATION_NOT_SUCCESSFUL'), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl().'&tab=database', JText::_('COM_JOOMGALLERY_MAIMAN_DB_MSG_OPTIMIZATION_SUCCESSFUL'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/migration.php $
|
||||
// $Id: migration.php 4270 2013-05-21 14:10:18Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Migration Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerMigration extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Require the migration helper class
|
||||
require_once JPATH_COMPONENT.'/helpers/migration.php';
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'migration');
|
||||
|
||||
// Register tasks
|
||||
$this->registerTask('check', 'migrate');
|
||||
$this->registerTask('start', 'migrate');
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates another gallery to JoomGallery
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function migrate()
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$migration = JRequest::getCmd('migration', '');
|
||||
$task = JRequest::getCmd('task');
|
||||
|
||||
if(!JFile::exists(JPATH_COMPONENT.'/helpers/migration/migrate'.$migration.'.php'))
|
||||
{
|
||||
$this->setRedirect('index.php?option='._JOOM_OPTION.'&controller=migration');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once JPATH_COMPONENT.'/helpers/migration/migrate'.$migration.'.php';
|
||||
$classname = 'JoomMigrate'.$migration;
|
||||
$migrateclass = new $classname();
|
||||
|
||||
ob_start();
|
||||
$migrateclass->$task();
|
||||
JFactory::getApplication()->setUserState('joom.migration.output', ob_get_contents());
|
||||
ob_end_clean();
|
||||
|
||||
if($task == 'check')
|
||||
{
|
||||
parent::display();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/nametags.php $
|
||||
// $Id: nametags.php 4318 2013-08-18 07:58:35Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Nametags Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerNametags extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Removes all nametags in the gallery
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
// Delete all nametags
|
||||
$this->_db->truncateTable(_JOOM_TABLE_NAMESHIELDS);
|
||||
|
||||
if($this->_db->getErrorMsg())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=nametags'), $this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=nametags'), JText::_('COM_JOOMGALLERY_MAIMAN_MSG_ALL_NAMETAGS_DELETED'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes the nametags with users registered and existing images.
|
||||
*
|
||||
* Nametags of users that aren't registed any more will be deleted.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function synchronize()
|
||||
{
|
||||
// Synchronize users-nametags-images
|
||||
$query = $this->_db->getQuery(true)
|
||||
->delete('n USING '._JOOM_TABLE_NAMESHIELDS.' AS n')
|
||||
->leftJoin('#__users AS u ON n.nuserid = u.id')
|
||||
->leftJoin(_JOOM_TABLE_IMAGES.' AS i ON n.npicid = i.id')
|
||||
->where('(u.id IS NULL OR i.id IS NULL)');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=nametags'), $this->_db->getErrorMsg(), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=nametags'), JText::_('COM_JOOMGALLERY_MAIMAN_MSG_NAMETAGS_SYNCHRONIZED'));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/upload.php $
|
||||
// $Id: upload.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Single Upload Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerUpload extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Set view
|
||||
JRequest::setVar('view', 'upload');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the default upload form
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// Access check
|
||||
if(!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload')))
|
||||
{
|
||||
$this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl('categories'), false), JText::_('No categories found into which you are allowed to upload'), 'notice');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads the selected images
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
require_once JPATH_COMPONENT.'/helpers/upload.php';
|
||||
$uploader = new JoomUpload();
|
||||
if($uploader->upload(JRequest::getCmd('type', 'single')))
|
||||
{
|
||||
$msg = JText::_('COM_JOOMGALLERY_UPLOAD_MSG_SUCCESSFULL');
|
||||
$url = $this->_ambit->getRedirectUrl();
|
||||
|
||||
// Set custom redirect if we are asked for that
|
||||
if($redirect = JRequest::getVar('redirect', '', '', 'base64'))
|
||||
{
|
||||
$url_decoded = base64_decode($redirect);
|
||||
if(JURI::isInternal($url))
|
||||
{
|
||||
$url = $url_decoded;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect(JRoute::_($url, false), $msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($error = $uploader->getError())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl(), $error, 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/controllers/votes.php $
|
||||
// $Id: votes.php 4318 2013-08-18 07:58:35Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Votes Controller
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryControllerVotes extends JoomGalleryController
|
||||
{
|
||||
/**
|
||||
* Resets all votes of all images in the gallery
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->_db->truncateTable(_JOOM_TABLE_VOTES);
|
||||
|
||||
if($this->_db->getErrorMsg())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=votes'), $this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$query = $this->_db->getQuery(true)
|
||||
->update(_JOOM_TABLE_IMAGES)
|
||||
->set('imgvotes = 0')
|
||||
->set('imgvotesum = 0');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=votes'), $this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=votes'), JText::_('COM_JOOMGALLERY_MAIMAN_MSG_ALL_VOTES_DELETED'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes the votes with users registered and exiting images.
|
||||
*
|
||||
* Votes of users that aren't registed any more will be deleted.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function synchronize()
|
||||
{
|
||||
// Synchronize users-votes-images
|
||||
$query = $this->_db->getQuery(true)
|
||||
->delete('v USING '._JOOM_TABLE_VOTES.' AS v')
|
||||
->leftJoin('#__users AS u ON v.userid = u.id')
|
||||
->leftJoin(_JOOM_TABLE_IMAGES.' AS i ON v.picid = i.id')
|
||||
->where('v.userid != 0')
|
||||
->where('(u.id IS NULL OR i.id IS NULL)');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=votes'), $this->_db->getErrorMsg(), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
$count_subquery = $this->_db->getQuery(true)
|
||||
->select('COUNT(*)')
|
||||
->from(_JOOM_TABLE_VOTES.' as v')
|
||||
->where('v.picid = p.id');
|
||||
|
||||
$sum_subquery = $this->_db->getQuery(true)
|
||||
->select('SUM(v.vote)')
|
||||
->from(_JOOM_TABLE_VOTES.' as v')
|
||||
->where('v.picid = p.id');
|
||||
|
||||
$query->clear()
|
||||
->update(_JOOM_TABLE_IMAGES.' AS p')
|
||||
->set('p.imgvotes = ('.$count_subquery.')')
|
||||
->set('p.imgvotesum = ('.$sum_subquery.')');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=votes'), $this->_db->getErrorMsg(), 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setRedirect($this->_ambit->getRedirectUrl('maintenance&tab=votes'), JText::_('COM_JOOMGALLERY_MAIMAN_MSG_USERVOTES_SYNCHRONIZED'));
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,504 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/ambit.php $
|
||||
// $Id: ambit.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Ambit Class
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomAmbit extends JObject
|
||||
{
|
||||
/**
|
||||
* URL of the folder for the icons
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $icon_url = '';
|
||||
|
||||
/**
|
||||
* URL of the folder for the CSS files
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $css_url = '';
|
||||
|
||||
/**
|
||||
* URL of the folder for the JavaScript files
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $js_url = '';
|
||||
|
||||
/**
|
||||
* URL of the folder for thumbnails
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $thumb_url = '';
|
||||
|
||||
/**
|
||||
* URL of the folder for the detail images
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $img_url = '';
|
||||
|
||||
/**
|
||||
* URL of the folder for the original images
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $orig_url = '';
|
||||
|
||||
/**
|
||||
* Absolute path of the folder for the thumbnails
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $thumb_path = '';
|
||||
|
||||
/**
|
||||
* Absolute path of the folder for the details images
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $img_path = '';
|
||||
|
||||
/**
|
||||
* Absolute path of the folder for the original images
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $orig_path = '';
|
||||
|
||||
/**
|
||||
* Absolute path of the folder for temporary stored files and folders
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $temp_path = '';
|
||||
|
||||
/**
|
||||
* Absolute path of the folder for the FTP upload
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $ftp_path = '';
|
||||
|
||||
/**
|
||||
* Absolute path of the folder for the watermark
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $wtm_path = '';
|
||||
|
||||
/**
|
||||
* Version string of JoomGallery
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $version = '';
|
||||
|
||||
/**
|
||||
* If $_external[$type] is set to true the images of
|
||||
* type $type will be output through the PHP script
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_external = array();
|
||||
|
||||
/**
|
||||
* The structure of the categories
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_categorystructure = null;
|
||||
|
||||
/**
|
||||
* The structure of all categories
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_allcategorystructure = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Presets all variables
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
$config = JoomConfig::getInstance();
|
||||
$mainframe = JFactory::getApplication('administrator');
|
||||
|
||||
// Fill all variables
|
||||
$this->icon_url = JURI::root().'media/joomgallery/images/';
|
||||
$this->css_url = JURI::root().'media/joomgallery/css/';
|
||||
$this->js_url = JURI::root().'media/joomgallery/js/';
|
||||
|
||||
$this->_external['thumb'] = false;
|
||||
$this->thumb_url = JURI::root().$config->get('jg_paththumbs');
|
||||
$this->thumb_path = JPath::clean(JPATH_ROOT.'/'.$config->get('jg_paththumbs'));
|
||||
if(!JFolder::exists($this->thumb_path))
|
||||
{
|
||||
$this->_external['thumb'] = true;
|
||||
$this->thumb_url = '';
|
||||
$this->thumb_path = JPath::clean($config->get('jg_paththumbs'));
|
||||
}
|
||||
|
||||
$this->_external['img'] = false;
|
||||
$this->img_url = JURI::root().$config->get('jg_pathimages');
|
||||
$this->img_path = JPath::clean(JPATH_ROOT.'/'.$config->get('jg_pathimages'));
|
||||
if(!JFolder::exists($this->img_path))
|
||||
{
|
||||
$this->_external['img'] = true;
|
||||
$this->img_url = '';
|
||||
$this->img_path = JPath::clean($config->get('jg_pathimages'));
|
||||
}
|
||||
|
||||
$this->_external['orig'] = false;
|
||||
$this->orig_url = JURI::root().$config->get('jg_pathoriginalimages');
|
||||
$this->orig_path = JPath::clean(JPATH_ROOT.'/'.$config->get('jg_pathoriginalimages'));
|
||||
if(!JFolder::exists($this->orig_path))
|
||||
{
|
||||
$this->_external['orig'] = true;
|
||||
$this->orig_url = '';
|
||||
$this->orig_path = JPath::clean($config->get('jg_pathoriginalimages'));
|
||||
}
|
||||
|
||||
$this->temp_path = JPath::clean(JPATH_ROOT.'/'.$config->get('jg_pathtemp'));
|
||||
if(!JFolder::exists($this->temp_path))
|
||||
{
|
||||
$this->temp_path = JPath::clean($config->get('jg_pathtemp'));
|
||||
}
|
||||
$this->ftp_path = JPath::clean(JPATH_ROOT.'/'.$config->get('jg_pathftpupload'));
|
||||
if(!JFolder::exists($this->ftp_path))
|
||||
{
|
||||
$this->ftp_path = JPath::clean($config->get('jg_pathftpupload'));
|
||||
}
|
||||
$this->wtm_path = JPath::clean(JPATH_ROOT.'/'.$config->get('jg_wmpath'));
|
||||
if(!JFolder::exists($this->wtm_path))
|
||||
{
|
||||
$this->wtm_path = JPath::clean($config->get('jg_wmpath'));
|
||||
}
|
||||
|
||||
if(!$this->version = $mainframe->getUserState('joom.version.string'))
|
||||
{
|
||||
$this->version = JoomExtensions::getGalleryVersion();
|
||||
$mainframe->setUserState('joom.version.string', $this->version);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the global Ambit object, only creating it if it
|
||||
* doesn't already exist.
|
||||
*
|
||||
* This method must be invoked as:
|
||||
* <pre> $ambit = JoomAmbit::getInstance();</pre>
|
||||
*
|
||||
* @return JoomAmbit The Ambit object.
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
static $instance;
|
||||
|
||||
if(!isset($instance))
|
||||
{
|
||||
$instance = new JoomAmbit();
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL to an icon
|
||||
*
|
||||
* @param string $icon The filename of the icon
|
||||
* @return string The URL to the icon
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getIcon($icon)
|
||||
{
|
||||
return $this->get('icon_url').$icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL to a style sheet
|
||||
*
|
||||
* @param string $stylesheet The filename of the style sheet
|
||||
* @return string The URL to the style sheet
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getStyleSheet($stylesheet)
|
||||
{
|
||||
return $this->get('css_url').$stylesheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL to a script file
|
||||
*
|
||||
* @param string $script The filename of the script file
|
||||
* @return string The URL to the script file
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getScript($script)
|
||||
{
|
||||
return $this->get('js_url').$script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL for a redirect
|
||||
*
|
||||
* @param string $controller The controller used in the redirect url
|
||||
* if it is null, we will use the same
|
||||
* controller as in the current request,
|
||||
* if it is an empty string, we will redirect
|
||||
* to the control panel of the gallery
|
||||
* @param int $id The ID of a category or image to redirect to
|
||||
* if the task was 'apply'
|
||||
* @param string $key The parameter name to use in the URL for the ID
|
||||
* @return string The redirect URL
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getRedirectUrl($controller = null, $id = null, $key = 'cid')
|
||||
{
|
||||
$url = 'index.php?option='._JOOM_OPTION;
|
||||
|
||||
if(is_null($controller))
|
||||
{
|
||||
$url .= '&controller='.JRequest::getCmd('controller');
|
||||
if(!is_null($id) && JRequest::getCmd('task') == 'apply')
|
||||
{
|
||||
$url .= '&task=edit&'.$key.'='.$id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($controller)
|
||||
{
|
||||
$url .= '&controller='.$controller;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL or the path to an image
|
||||
*
|
||||
* @param string $type The type of the URL or path
|
||||
* @param string/object/int $img Filename, database object or ID of the image
|
||||
* @param int $catid The ID of the category in which the image is stored
|
||||
* @return string The URL or the path to the image
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getImg($type, $img, $id = 0, $catid = 0)
|
||||
{
|
||||
$types = array('thumb_path', 'thumb_url', 'img_path', 'img_url', 'orig_path', 'orig_url');
|
||||
if(!in_array($type, $types))
|
||||
{
|
||||
JError::raiseError(500, JText::sprintf('Wrong image type: %s', $type));
|
||||
}
|
||||
|
||||
if(!is_object($img))
|
||||
{
|
||||
if(is_numeric($img))
|
||||
{
|
||||
$img = $this->getImgObject($img);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!is_null($id))
|
||||
{
|
||||
$img = $this->getImgObject($id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(is_object($img))
|
||||
{
|
||||
$id = $img->id;
|
||||
$catid = $img->catid;
|
||||
if($type == 'thumb_path' || $type == 'thumb_url')
|
||||
{
|
||||
$img = $img->imgthumbname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$img = $img->imgfilename;
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether the image shall be output through the PHP script or with its real path
|
||||
if( strpos($type, 'url')
|
||||
&&
|
||||
( $this->_external[str_replace('_url','', $type)]
|
||||
#|| $this->_config->get('jg_watermark')
|
||||
|| strpos($type, 'img') !== false
|
||||
|| strpos($type, 'orig') !== false
|
||||
)
|
||||
)
|
||||
{
|
||||
$type = str_replace('_url','', $type);
|
||||
return JRoute::_('index.php?option='._JOOM_OPTION.'&controller=images&view=image&format=raw&type='.$type.'&cid='.$id);
|
||||
}
|
||||
|
||||
$catpath = JoomHelper::getCatPath($catid);
|
||||
|
||||
// Create the complete path
|
||||
$img = $this->$type . $catpath . $img;
|
||||
|
||||
if(strpos($type, 'path'))
|
||||
{
|
||||
$img = JPath::clean($img);
|
||||
}
|
||||
|
||||
return $img;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the database row of a specific image
|
||||
*
|
||||
* @param int $id The ID of the image to load
|
||||
* @return object The database row of the image
|
||||
*/
|
||||
public function getImgObject($id)
|
||||
{
|
||||
static $images = array();
|
||||
static $row;
|
||||
|
||||
if(!isset($images[$id]))
|
||||
{
|
||||
if(!isset($row))
|
||||
{
|
||||
$row = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
}
|
||||
|
||||
if(!$row->load($id))
|
||||
{
|
||||
JError::raiseError(500, JText::sprintf('Image with ID %d not found', $id));
|
||||
}
|
||||
|
||||
$properties = $row->getProperties();
|
||||
$images[$id] = new stdClass();
|
||||
foreach($properties as $key => $value)
|
||||
{
|
||||
$images[$id]->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $images[$id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the category structure of the gallery
|
||||
*
|
||||
* @param boolean True, if a structure with all categories should be constructed.
|
||||
* @return array An array of categories/sub-categories
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getCategoryStructure($all = false)
|
||||
{
|
||||
// Check if already read from database
|
||||
if( (is_null($this->_categorystructure) && !$all)
|
||||
|| (is_null($this->_allcategorystructure) && $all)
|
||||
)
|
||||
{
|
||||
// Creation of array
|
||||
$database = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Read all categories from database
|
||||
$query = $database->getQuery(true)
|
||||
->select('c.cid, c.parent_id, c.name, c.access, c.published, c.hidden, c.owner')
|
||||
->from(_JOOM_TABLE_CATEGORIES.' AS c')
|
||||
->where('lft > 0')
|
||||
->order('c.lft');
|
||||
|
||||
if(!$user->authorise('core.admin') && !$all)
|
||||
{
|
||||
$query->where('c.access IN ('.implode(',', $user->getAuthorisedViewLevels()).')');
|
||||
}
|
||||
|
||||
$database->setQuery($query);
|
||||
$categories = $database->loadObjectList('cid');
|
||||
|
||||
// Get picture count and hits count
|
||||
$query->clear()
|
||||
->select('catid, COUNT(id) as piccount, SUM(hits) as hitcount')
|
||||
->from(_JOOM_TABLE_IMAGES)
|
||||
->group('catid');
|
||||
|
||||
if(!$user->authorise('core.admin') && !$all)
|
||||
{
|
||||
$query->where('access IN ('.implode(',', $user->getAuthorisedViewLevels()).')');
|
||||
}
|
||||
|
||||
$database->setQuery($query);
|
||||
$catcounts = $database->loadObjectList('catid');
|
||||
|
||||
// Merge the arrays
|
||||
foreach($categories as $key => $category)
|
||||
{
|
||||
if($category->parent_id != 1 && !isset($categories[$category->parent_id]))
|
||||
{
|
||||
unset($categories[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Cast to int where needful
|
||||
$categories[$key]->cid = (int) $key;
|
||||
$categories[$key]->parent_id = (int) $categories[$key]->parent_id;
|
||||
|
||||
if(isset($catcounts[$key]))
|
||||
{
|
||||
$categories[$key]->piccount = (int) $catcounts[$key]->piccount;
|
||||
$categories[$key]->hitcount = (int) $catcounts[$key]->hitcount;
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories[$key]->piccount = 0;
|
||||
$categories[$key]->hitcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($all)
|
||||
{
|
||||
$this->_allcategorystructure = $categories;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_categorystructure = $categories;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$all)
|
||||
{
|
||||
return $this->_categorystructure;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_allcategorystructure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,497 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/config.php $
|
||||
// $Id: config.php 4267 2013-05-10 11:41:59Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Configuration Helper
|
||||
*
|
||||
* Provides handling with all configuration settings of the gallery
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomConfig extends JObject
|
||||
{
|
||||
/**
|
||||
* Configuration variables
|
||||
*
|
||||
* @var string, int
|
||||
*/
|
||||
var $jg_pathimages;
|
||||
var $jg_pathoriginalimages;
|
||||
var $jg_paththumbs;
|
||||
var $jg_pathftpupload;
|
||||
var $jg_pathtemp;
|
||||
var $jg_wmpath;
|
||||
var $jg_wmfile;
|
||||
var $jg_use_real_paths;
|
||||
var $jg_checkupdate;
|
||||
var $jg_filenamewithjs;
|
||||
var $jg_filenamereplace;
|
||||
var $jg_thumbcreation;
|
||||
var $jg_fastgd2thumbcreation;
|
||||
var $jg_impath;
|
||||
var $jg_resizetomaxwidth;
|
||||
var $jg_maxwidth;
|
||||
var $jg_picturequality;
|
||||
var $jg_useforresizedirection;
|
||||
var $jg_cropposition;
|
||||
var $jg_thumbwidth;
|
||||
var $jg_thumbheight;
|
||||
var $jg_thumbquality;
|
||||
var $jg_uploadorder;
|
||||
var $jg_useorigfilename;
|
||||
var $jg_filenamenumber;
|
||||
var $jg_delete_original;
|
||||
var $jg_msg_upload_type;
|
||||
var $jg_msg_upload_recipients;
|
||||
var $jg_msg_download_type;
|
||||
var $jg_msg_download_recipients;
|
||||
var $jg_msg_zipdownload;
|
||||
var $jg_msg_comment_type;
|
||||
var $jg_msg_comment_recipients;
|
||||
var $jg_msg_comment_toowner;
|
||||
var $jg_msg_nametag_type;
|
||||
var $jg_msg_nametag_recipients;
|
||||
var $jg_msg_nametag_totaggeduser;
|
||||
var $jg_msg_nametag_toowner;
|
||||
var $jg_msg_report_type;
|
||||
var $jg_msg_report_recipients;
|
||||
var $jg_msg_report_toowner;
|
||||
var $jg_msg_rejectimg_type;
|
||||
var $jg_msg_global_from;
|
||||
var $jg_realname;
|
||||
var $jg_contentpluginsenabled;
|
||||
var $jg_itemid;
|
||||
var $jg_ajaxcategoryselection;
|
||||
var $jg_disableunrequiredchecks;
|
||||
var $jg_use_listbox_max_user_count;
|
||||
var $jg_userspace;
|
||||
var $jg_useruploaddefaultcat;
|
||||
var $jg_approve;
|
||||
var $jg_unregistered_permissions;
|
||||
var $jg_maxusercat;
|
||||
var $jg_maxuserimage;
|
||||
var $jg_maxuserimage_timespan;
|
||||
var $jg_maxfilesize;
|
||||
var $jg_usercatacc;
|
||||
var $jg_usercatthumbalign;
|
||||
var $jg_maxuploadfields;
|
||||
var $jg_useruploadsingle;
|
||||
var $jg_useruploadajax;
|
||||
var $jg_useruploadbatch;
|
||||
var $jg_useruploadjava;
|
||||
var $jg_useruseorigfilename;
|
||||
var $jg_useruploadnumber;
|
||||
var $jg_special_gif_upload;
|
||||
var $jg_delete_original_user;
|
||||
var $jg_newpiccopyright;
|
||||
var $jg_newpicnote;
|
||||
var $jg_redirect_after_upload;
|
||||
var $jg_edit_metadata;
|
||||
var $jg_download;
|
||||
var $jg_download_unreg;
|
||||
var $jg_download_hint;
|
||||
var $jg_showrating;
|
||||
var $jg_maxvoting;
|
||||
var $jg_ratingcalctype;
|
||||
var $jg_ratingdisplaytype;
|
||||
var $jg_ajaxrating;
|
||||
var $jg_votingonlyonce;
|
||||
var $jg_votingonlyreg;
|
||||
var $jg_showcomment;
|
||||
var $jg_anoncomment;
|
||||
var $jg_namedanoncomment;
|
||||
var $jg_anonapprovecom;
|
||||
var $jg_approvecom;
|
||||
var $jg_bbcodesupport;
|
||||
var $jg_smiliesupport;
|
||||
var $jg_anismilie;
|
||||
var $jg_smiliescolor;
|
||||
var $jg_report_images;
|
||||
var $jg_report_unreg;
|
||||
var $jg_report_hint;
|
||||
var $jg_alternative_layout;
|
||||
var $jg_anchors;
|
||||
var $jg_tooltips;
|
||||
var $jg_dyncrop;
|
||||
var $jg_dyncropposition;
|
||||
var $jg_dyncropwidth;
|
||||
var $jg_dyncropheight;
|
||||
var $jg_dyncropbgcol;
|
||||
var $jg_hideemptycats;
|
||||
var $jg_skipcatview;
|
||||
var $jg_imgalign;
|
||||
var $jg_firstorder;
|
||||
var $jg_secondorder;
|
||||
var $jg_thirdorder;
|
||||
var $jg_pagetitle_cat;
|
||||
var $jg_pagetitle_detail;
|
||||
var $jg_showgalleryhead;
|
||||
var $jg_showpathway;
|
||||
var $jg_completebreadcrumbs;
|
||||
var $jg_showallpics;
|
||||
var $jg_showallhits;
|
||||
var $jg_showbacklink;
|
||||
var $jg_suppresscredits;
|
||||
var $jg_showuserpanel;
|
||||
var $jg_showuserpanel_hint;
|
||||
var $jg_showuserpanel_unreg;
|
||||
var $jg_showallpicstoadmin;
|
||||
var $jg_showminithumbs;
|
||||
var $jg_openjs_padding;
|
||||
var $jg_openjs_background;
|
||||
var $jg_dhtml_border;
|
||||
var $jg_show_title_in_popup;
|
||||
var $jg_show_description_in_popup;
|
||||
var $jg_lightbox_speed;
|
||||
var $jg_lightbox_slide_all;
|
||||
var $jg_resize_js_image;
|
||||
var $jg_disable_rightclick_original;
|
||||
var $jg_showgallerysubhead;
|
||||
var $jg_showallcathead;
|
||||
var $jg_colcat;
|
||||
var $jg_catperpage;
|
||||
var $jg_ordercatbyalpha;
|
||||
var $jg_showgallerypagenav;
|
||||
var $jg_showcatcount;
|
||||
var $jg_showcatthumb;
|
||||
var $jg_showrandomcatthumb;
|
||||
var $jg_ctalign;
|
||||
var $jg_showtotalcatimages;
|
||||
var $jg_showtotalcathits;
|
||||
var $jg_showcatasnew;
|
||||
var $jg_catdaysnew;
|
||||
var $jg_showdescriptioningalleryview;
|
||||
var $jg_uploadicongallery;
|
||||
var $jg_showrestrictedcats;
|
||||
var $jg_showrestrictedhint;
|
||||
var $jg_showsubsingalleryview;
|
||||
var $jg_category_rss;
|
||||
var $jg_category_rss_icon;
|
||||
var $jg_uploadiconcategory;
|
||||
var $jg_showcathead;
|
||||
var $jg_usercatorder;
|
||||
var $jg_usercatorderlist;
|
||||
var $jg_showcatdescriptionincat;
|
||||
var $jg_showpagenav;
|
||||
var $jg_showpiccount;
|
||||
var $jg_perpage;
|
||||
var $jg_catthumbalign;
|
||||
var $jg_colnumb;
|
||||
var $jg_detailpic_open;
|
||||
var $jg_lightboxbigpic;
|
||||
var $jg_showtitle;
|
||||
var $jg_showpicasnew;
|
||||
var $jg_daysnew;
|
||||
var $jg_showhits;
|
||||
var $jg_showdownloads;
|
||||
var $jg_showauthor;
|
||||
var $jg_showowner;
|
||||
var $jg_showcatcom;
|
||||
var $jg_showcatrate;
|
||||
var $jg_showcatdescription;
|
||||
var $jg_showcategorydownload;
|
||||
var $jg_showcategoryfavourite;
|
||||
var $jg_category_report_images;
|
||||
var $jg_showcategoryeditorlinks;
|
||||
var $jg_showsubcathead;
|
||||
var $jg_showsubcatcount;
|
||||
var $jg_colsubcat;
|
||||
var $jg_subperpage;
|
||||
var $jg_showpagenavsubs;
|
||||
var $jg_subcatthumbalign;
|
||||
var $jg_showsubthumbs;
|
||||
var $jg_showrandomsubthumb;
|
||||
var $jg_showdescriptionincategoryview;
|
||||
var $jg_ordersubcatbyalpha;
|
||||
var $jg_showtotalsubcatimages;
|
||||
var $jg_showtotalsubcathits;
|
||||
var $jg_uploadiconsubcat;
|
||||
var $jg_showdetailpage;
|
||||
var $jg_disabledetailpage;
|
||||
var $jg_showdetailnumberofpics;
|
||||
var $jg_cursor_navigation;
|
||||
var $jg_disable_rightclick_detail;
|
||||
var $jg_detail_report_images;
|
||||
var $jg_showdetaileditorlinks;
|
||||
var $jg_showdetailtitle;
|
||||
var $jg_showdetail;
|
||||
var $jg_showdetailaccordion;
|
||||
var $jg_accordionduration;
|
||||
var $jg_accordiondisplay;
|
||||
var $jg_accordionopacity;
|
||||
var $jg_accordionalwayshide;
|
||||
var $jg_accordioninitialeffect;
|
||||
var $jg_showdetaildescription;
|
||||
var $jg_showdetaildatum;
|
||||
var $jg_showdetailhits;
|
||||
var $jg_showdetaildownloads;
|
||||
var $jg_showdetailrating;
|
||||
var $jg_showdetailfilesize;
|
||||
var $jg_showdetailauthor;
|
||||
var $jg_showoriginalfilesize;
|
||||
var $jg_showdetaildownload;
|
||||
var $jg_downloadfile;
|
||||
var $jg_downloadwithwatermark;
|
||||
var $jg_watermark;
|
||||
var $jg_watermarkpos;
|
||||
var $jg_watermarkzoom;
|
||||
var $jg_watermarksize;
|
||||
var $jg_bigpic;
|
||||
var $jg_bigpic_unreg;
|
||||
var $jg_bigpic_open;
|
||||
var $jg_bbcodelink;
|
||||
var $jg_showcommentsunreg;
|
||||
var $jg_showcommentsarea;
|
||||
var $jg_send2friend;
|
||||
var $jg_minis;
|
||||
var $jg_motionminis;
|
||||
var $jg_motionminiWidth;
|
||||
var $jg_motionminiHeight;
|
||||
var $jg_motionminiLimit;
|
||||
var $jg_miniWidth;
|
||||
var $jg_miniHeight;
|
||||
var $jg_minisprop;
|
||||
var $jg_nameshields;
|
||||
var $jg_nameshields_others;
|
||||
var $jg_nameshields_unreg;
|
||||
var $jg_show_nameshields_unreg;
|
||||
var $jg_nameshields_height;
|
||||
var $jg_nameshields_width;
|
||||
var $jg_slideshow;
|
||||
var $jg_slideshow_timer;
|
||||
var $jg_slideshow_transition;
|
||||
var $jg_slideshow_transtime;
|
||||
var $jg_slideshow_maxdimauto;
|
||||
var $jg_slideshow_width;
|
||||
var $jg_slideshow_heigth;
|
||||
var $jg_slideshow_infopane;
|
||||
var $jg_slideshow_carousel;
|
||||
var $jg_slideshow_arrows;
|
||||
var $jg_slideshow_repeat;
|
||||
var $jg_showexifdata;
|
||||
var $jg_showgeotagging;
|
||||
var $jg_geotaggingkey;
|
||||
var $jg_subifdtags;
|
||||
var $jg_ifdotags;
|
||||
var $jg_gpstags;
|
||||
var $jg_showiptcdata;
|
||||
var $jg_iptctags;
|
||||
var $jg_showtoplist;
|
||||
var $jg_toplist;
|
||||
var $jg_topthumbalign;
|
||||
var $jg_toptextalign;
|
||||
var $jg_toplistcols;
|
||||
var $jg_whereshowtoplist;
|
||||
var $jg_showrate;
|
||||
var $jg_showlatest;
|
||||
var $jg_showcom;
|
||||
var $jg_showthiscomment;
|
||||
var $jg_showmostviewed;
|
||||
var $jg_showtoplistdownload;
|
||||
var $jg_showtoplistfavourite;
|
||||
var $jg_toplist_report_images;
|
||||
var $jg_showtoplisteditorlinks;
|
||||
var $jg_favourites;
|
||||
var $jg_favouritesshownotauth;
|
||||
var $jg_maxfavourites;
|
||||
var $jg_zipdownload;
|
||||
var $jg_usefavouritesforpubliczip;
|
||||
var $jg_usefavouritesforzip;
|
||||
var $jg_allimagesofcategory;
|
||||
var $jg_showfavouritesdownload;
|
||||
var $jg_showfavouriteseditorlinks;
|
||||
var $jg_search;
|
||||
var $jg_searchcols;
|
||||
var $jg_searchthumbalign;
|
||||
var $jg_searchtextalign;
|
||||
var $jg_showsearchdownload;
|
||||
var $jg_showsearchfavourite;
|
||||
var $jg_search_report_images;
|
||||
var $jg_showsearcheditorlinks;
|
||||
|
||||
/**
|
||||
* The ID of the current config row
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_id = 0;
|
||||
|
||||
/**
|
||||
* Determines whether extended configuration
|
||||
* manager is enabled
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_extended = false;
|
||||
|
||||
/**
|
||||
* Contains all valid ORDER BY clauses for the image sorting
|
||||
* options $jg_firstorder, $jg_secondorder and $jg_thirdorder.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_validImageSortingOrderByClauses = array('ordering ASC', 'ordering DESC', 'imgdate ASC', 'imgdate DESC', 'imgtitle ASC', 'imgtitle DESC');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct($id = null)
|
||||
{
|
||||
if(JComponentHelper::getParams(_JOOM_OPTION)->get('extended_config'))
|
||||
{
|
||||
$this->_extended = true;
|
||||
}
|
||||
|
||||
if(!is_null($id) || !$this->_extended)
|
||||
{
|
||||
if(!$this->_extended)
|
||||
{
|
||||
// If extended configuration manager is
|
||||
// disabled we use the default config row
|
||||
$id = 1;
|
||||
}
|
||||
|
||||
$id = intval($id);
|
||||
|
||||
$this->_id = $id;
|
||||
|
||||
$config = JTable::getInstance('joomgalleryconfig', 'Table');
|
||||
$config->load($this->_id);
|
||||
|
||||
// Get config values
|
||||
$properties = $config->getProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('*')
|
||||
->from(_JOOM_TABLE_CONFIG)
|
||||
->where('group_id IN ('.implode(',', JFactory::getUser()->getAuthorisedGroups()).')')
|
||||
->order('ordering DESC');
|
||||
$db->setQuery($query, 0, 1);
|
||||
if(!$properties = $db->loadAssoc())
|
||||
{
|
||||
JError::raiseError(500, JText::_('Error loading config data'));
|
||||
}
|
||||
|
||||
$this->_id = $properties['id'];
|
||||
}
|
||||
|
||||
// Populate configuration values
|
||||
unset($properties['id']);
|
||||
unset($properties['group_id']);
|
||||
unset($properties['ordering']);
|
||||
foreach($properties as $key => $value)
|
||||
{
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the global Config object, only creating it if it
|
||||
* doesn't already exist.
|
||||
*
|
||||
* This method must be invoked as:
|
||||
* <pre> $config = JoomAmbit::getInstance();</pre>
|
||||
*
|
||||
* @param mixed The ID of the requested configuration row or string 'admin'
|
||||
if additional handling for storing the config is necessary
|
||||
* @return JoomConfig The Config object.
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public static function getInstance($id = null)
|
||||
{
|
||||
static $instances;
|
||||
|
||||
if(!isset($instances))
|
||||
{
|
||||
$instances = array();
|
||||
}
|
||||
|
||||
if(empty($instances[$id]))
|
||||
{
|
||||
if($id == 'admin')
|
||||
{
|
||||
require_once JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION.'/helpers/adminconfig.php';
|
||||
$config = new JoomAdminConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
$config = new JoomConfig($id);
|
||||
}
|
||||
|
||||
$instances[$id] = $config;
|
||||
}
|
||||
|
||||
return $instances[$id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the extended configuration manager is enabled
|
||||
*
|
||||
* @return boolean True if extended configuration manager is enabled, false otherwise
|
||||
* @since 2.0
|
||||
*/
|
||||
public function isExtended()
|
||||
{
|
||||
return $this->_extended;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CSS file name for the current config row or a specific one
|
||||
*
|
||||
* @param int ID of a specific row for which the CSS file name should be returned, 0 if the current one should be used
|
||||
* @return string The CSS file name of the current config row
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getStyleSheetName($id = 0)
|
||||
{
|
||||
if($id)
|
||||
{
|
||||
if($id == 1)
|
||||
{
|
||||
$id = '';
|
||||
}
|
||||
|
||||
return 'joom_settings'.$id.'.css';
|
||||
}
|
||||
|
||||
if($this->_id == 1)
|
||||
{
|
||||
return 'joom_settings.css';
|
||||
}
|
||||
|
||||
return 'joom_settings'.$this->_id.'.css';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string containing a valid image sorting ORDER BY clause for a given index or an
|
||||
* array containing all of them.
|
||||
*
|
||||
* @param mixed $index
|
||||
* @return mixed A string containing a valid image sorting ORDER BY clause or an array
|
||||
* containing all of them.
|
||||
* @since 3.3
|
||||
*/
|
||||
public static function getValidImageSortingOrderByClauses($index = false)
|
||||
{
|
||||
return $index !== false ? self::$_validImageSortingOrderByClauses[$index] : self::$_validImageSortingOrderByClauses;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,342 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/extensions.php $
|
||||
// $Id: extensions.php 4093 2013-02-13 22:06:53Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Extensions Class
|
||||
*
|
||||
* @static
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomExtensions
|
||||
{
|
||||
/**
|
||||
* Returns all downloadable extensions developed by JoomGallery::ProjectTeam
|
||||
* with some additional information like the current version number or a
|
||||
* short description of the extension
|
||||
*
|
||||
* @return array Two-dimensional array with extension information
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static function getAvailableExtensions()
|
||||
{
|
||||
static $extensions;
|
||||
|
||||
if(isset($extensions))
|
||||
{
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
// Check whether the german or the english RSS file should be loaded
|
||||
$subdomain = '';
|
||||
$language = JFactory::getLanguage();
|
||||
if(strpos($language->getTag(), 'de-') === false)
|
||||
{
|
||||
$subdomain = 'en.';
|
||||
}
|
||||
|
||||
$site = 'http://www.'.$subdomain.'joomgallery.net';
|
||||
$site2 = 'http://'.$subdomain.'joomgallery.net';
|
||||
$rssurl = $site.'/components/com_newversion/rss/extensions3.rss';
|
||||
|
||||
// Get RSS parsed object
|
||||
$rssDoc = false;
|
||||
try
|
||||
{
|
||||
$feed = new JFeedFactory;
|
||||
$rssDoc = $feed->getFeed($rssurl);
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
}
|
||||
catch (RunTimeException $e)
|
||||
{
|
||||
}
|
||||
|
||||
$extensions = array();
|
||||
if($rssDoc != false)
|
||||
{
|
||||
for($i = 0; isset($rssDoc[$i]); $i++)
|
||||
{
|
||||
$item = $rssDoc[$i];
|
||||
$name = $item->title;
|
||||
|
||||
// The data type is delivered as the name of the first category
|
||||
$categories = $item->categories;
|
||||
$type = key($categories);
|
||||
switch($type)
|
||||
{
|
||||
case 'general':
|
||||
$description = $item->content;
|
||||
$link = $item->uri;
|
||||
if(!is_null($description) && $description != '')
|
||||
{
|
||||
$extensions[$name]['description'] = $description;
|
||||
}
|
||||
if(!is_null($link) && $link != $site && $link != $site2)
|
||||
{
|
||||
$extensions[$name]['downloadlink'] = $link;
|
||||
}
|
||||
break;
|
||||
case 'version':
|
||||
$version = $item->content;
|
||||
$link = $item->uri;
|
||||
if(!is_null($version) && $version != '')
|
||||
{
|
||||
$extensions[$name]['version'] = $version;
|
||||
}
|
||||
if(!is_null($link) && $link != $site && $link != $site2)
|
||||
{
|
||||
$extensions[$name]['releaselink'] = $link;
|
||||
}
|
||||
break;
|
||||
case 'autoupdate':
|
||||
$xml = $item->content;
|
||||
$link = $item->uri;
|
||||
if(!is_null($xml) && $xml != '')
|
||||
{
|
||||
$extensions[$name]['xml'] = $xml;
|
||||
}
|
||||
if(!is_null($link) && $link != $site && $link != $site2)
|
||||
{
|
||||
$extensions[$name]['updatelink'] = $link;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the extensions in alphabetical order
|
||||
ksort($extensions);
|
||||
}
|
||||
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all installed JoomGallery extensions and JoomGallery itself
|
||||
* with additional information provided by getAvailableExtensions
|
||||
*
|
||||
* @param array $extensions Extensions provided by getAvailableExtensions
|
||||
* @return array Two-dimensional array with extension information
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static function getInstalledExtensions($extensions = null)
|
||||
{
|
||||
static $installed_extensions;
|
||||
|
||||
if(isset($installed_extensions))
|
||||
{
|
||||
return $installed_extensions;
|
||||
}
|
||||
|
||||
if(is_null($extensions))
|
||||
{
|
||||
$extensions = JoomExtensions::getAvailableExtensions();
|
||||
}
|
||||
|
||||
$installed_extensions = array();
|
||||
foreach($extensions as $name => $extension)
|
||||
{
|
||||
if(!isset($extension['xml']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$xml_file = JPath::clean(JPATH_ROOT.'/'.$extension['xml']);
|
||||
if(file_exists($xml_file))
|
||||
{
|
||||
$installed_extensions[$name] = $extension;
|
||||
|
||||
$xml = simplexml_load_file($xml_file);
|
||||
|
||||
$installed_version = (string) $xml->version;
|
||||
$installed_extensions[$name]['installed_version'] = $installed_version;
|
||||
}
|
||||
}
|
||||
|
||||
return $installed_extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares all installed extension versions with the current ones
|
||||
* and returns all dated JoomGallery extensions and JoomGallery itself
|
||||
* with additional information provided by getAvailableExtensions
|
||||
*
|
||||
* @param array $extensions Installed extensions provided by getInstalledExtensions
|
||||
* @return array Two-dimensional array with extension information
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static function checkUpdate($extensions = null)
|
||||
{
|
||||
static $dated_extensions;
|
||||
|
||||
if(isset($dated_extensions))
|
||||
{
|
||||
return $dated_extensions;
|
||||
}
|
||||
|
||||
if(is_null($extensions))
|
||||
{
|
||||
$extensions = JoomExtensions::getInstalledExtensions();
|
||||
}
|
||||
|
||||
$dated_extensions = array();
|
||||
foreach($extensions as $name => $extension)
|
||||
{
|
||||
if(version_compare($extension['version'], $extension['installed_version'], '>'))
|
||||
{
|
||||
$dated_extensions[$name] = $extension;
|
||||
}
|
||||
}
|
||||
|
||||
return $dated_extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently installed version of JoomGallery
|
||||
*
|
||||
* @return string Version
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static function getGalleryVersion()
|
||||
{
|
||||
static $version;
|
||||
|
||||
if(!isset($version))
|
||||
{
|
||||
$config = JoomConfig::getInstance();
|
||||
|
||||
$version_from_xml = true;
|
||||
|
||||
// Do not read RSS file if update check is disabled
|
||||
if($config->get('jg_checkupdate'))
|
||||
{
|
||||
$version_from_xml = false;
|
||||
|
||||
$mainframe = JFactory::getApplication('administrator');
|
||||
if(!$version = $mainframe->getUserState('joom.version.string'))
|
||||
{
|
||||
$extensions = JoomExtensions::getInstalledExtensions();
|
||||
|
||||
if(isset($extensions['JoomGallery']['installed_version']))
|
||||
{
|
||||
$version = $extensions['JoomGallery']['installed_version'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$version_from_xml = true;
|
||||
}
|
||||
|
||||
$mainframe->setUserState('joom.version.string', $version);
|
||||
}
|
||||
}
|
||||
|
||||
if($version_from_xml)
|
||||
{
|
||||
$xml_file = JPATH_ADMINISTRATOR.'/components/com_joomgallery/joomgallery.xml';
|
||||
if(file_exists($xml_file))
|
||||
{
|
||||
$xml = simplexml_load_file($xml_file);
|
||||
|
||||
if(!isset($xml->version))
|
||||
{
|
||||
$version = 'not found';
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = (string) $xml->version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches an update zip file from JoomGallery server and extracts it
|
||||
*
|
||||
* @param string $url The URL to the zip to fetch and extract
|
||||
* @return void
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static function autoUpdate($url)
|
||||
{
|
||||
$mainframe = JFactory::getApplication();
|
||||
|
||||
if(!$url || !extension_loaded('curl'))
|
||||
{
|
||||
$mainframe->redirect('index.php?option='._JOOM_OPTION, JText::_('COM_JOOMGALLERY_ADMENU_MSG_ERROR_FETCHING_ZIP'), 'error');
|
||||
}
|
||||
|
||||
$ambit = JoomAmbit::getInstance();
|
||||
|
||||
// Create curl resource
|
||||
$ch = curl_init(strtolower($url));
|
||||
|
||||
// Some settings for curl
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: JoomGallery v3'));
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
// Create the zip file
|
||||
jimport('joomla.filesystem.file');
|
||||
$config = JoomConfig::getInstance();
|
||||
$output = curl_exec($ch);
|
||||
JFile::write($ambit->get('temp_path').'update.zip', $output);
|
||||
|
||||
// Close curl resource to free up system resources
|
||||
curl_close($ch);
|
||||
|
||||
// Delete files and folders from previous updates
|
||||
$folder = $ambit->get('temp_path').'update';
|
||||
if(JFolder::exists($folder))
|
||||
{
|
||||
JFolder::delete($folder);
|
||||
}
|
||||
|
||||
// Extract the zip file
|
||||
jimport('joomla.filesystem.archive');
|
||||
if(!JArchive::extract($ambit->get('temp_path').'update.zip', $folder))
|
||||
{
|
||||
$mainframe->redirect('index.php?option='._JOOM_OPTION, JText::_('Error extracting the zip'), 'error');
|
||||
}
|
||||
|
||||
// Copy an index.html into the created folder if there isn't already one
|
||||
if(!JFile::exists($folder.'/index.html'))
|
||||
{
|
||||
$src = JPATH_ROOT.'/media/joomgallery/index.html';
|
||||
$dest = $folder.'/index.html';
|
||||
|
||||
JFile::copy($src, $dest);
|
||||
}
|
||||
|
||||
$mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_ADMENU_REDIRECT_NOTE'), 'notice');
|
||||
|
||||
// Let's redirect to do the rest
|
||||
?>
|
||||
<form action="index.php" method="post" name="JoomUpdateForm">
|
||||
<input type="hidden" name="option" value="<?php echo _JOOM_OPTION; ?>" />
|
||||
<input type="hidden" name="controller" value="control" />
|
||||
<input type="hidden" name="task" value="doinstallation" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
document.JoomUpdateForm.submit();
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,750 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/file.php $
|
||||
// $Id: file.php 4339 2013-11-03 18:06:02Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery File Class
|
||||
*
|
||||
* @static
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomFile
|
||||
{
|
||||
/**
|
||||
* Cleaning of file/category name
|
||||
* optionally replace extension if present
|
||||
* replace special chars defined in backend
|
||||
*
|
||||
* @param string $orig The original filename
|
||||
* @param boolean $replace_extension True for stripping the extension
|
||||
* @return string Cleaned name (with or without extension)
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function fixFilename($orig, $replace_extension = false)
|
||||
{
|
||||
$config = JoomConfig::getInstance();
|
||||
|
||||
// Check if multibyte support installed
|
||||
if(in_array ('mbstring', get_loaded_extensions()))
|
||||
{
|
||||
// Get the funcs from mb
|
||||
$funcs = get_extension_funcs('mbstring');
|
||||
if( in_array ('mb_detect_encoding', $funcs)
|
||||
&& in_array ('mb_strtolower', $funcs)
|
||||
)
|
||||
{
|
||||
// Try to check if the name contains UTF-8 characters
|
||||
$isUTF = mb_detect_encoding($orig, 'UTF-8', true);
|
||||
if($isUTF)
|
||||
{
|
||||
// Try to lower the UTF-8 characters
|
||||
$orig = mb_strtolower($orig, 'UTF-8');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to lower the one byte characters
|
||||
$orig = strtolower($orig);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO mbstring loaded but no needed functions
|
||||
// --> server misconfiguration
|
||||
$orig = strtolower($orig);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO no mbstring loaded, appropriate server for Joomla?
|
||||
$orig = strtolower($orig);
|
||||
}
|
||||
|
||||
// Replace special chars
|
||||
$filenamesearch = array();
|
||||
$filenamereplace = array();
|
||||
|
||||
$filenamereplacearr = $config->get('jg_filenamereplace');
|
||||
$items = explode(',', $filenamereplacearr);
|
||||
if($items != FALSE)
|
||||
{
|
||||
// Contains pairs of <specialchar>|<replaced char(s)>
|
||||
foreach($items as $item)
|
||||
{
|
||||
if(!empty($item))
|
||||
{
|
||||
$workarray = explode('|', trim($item));
|
||||
if( $workarray != FALSE
|
||||
&& isset($workarray[0]) && !empty($workarray[0])
|
||||
&& isset($workarray[1]) && !empty($workarray[1])
|
||||
)
|
||||
{
|
||||
array_push($filenamesearch, preg_quote($workarray[0]));
|
||||
array_push($filenamereplace, preg_quote($workarray[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replace whitespace with underscore
|
||||
array_push($filenamesearch, '\s');
|
||||
array_push($filenamereplace, '_');
|
||||
// Replace slash with underscore
|
||||
array_push($filenamesearch, '/');
|
||||
array_push($filenamereplace, '_');
|
||||
// Replace backslash with underscore
|
||||
array_push($filenamesearch, '\\\\');
|
||||
array_push($filenamereplace, '_');
|
||||
// Replace other stuff
|
||||
array_push($filenamesearch, '[^a-z_0-9-]');
|
||||
array_push($filenamereplace, '');
|
||||
|
||||
// Checks for different array-length
|
||||
$lengthsearch = count($filenamesearch);
|
||||
$lengthreplace = count($filenamereplace);
|
||||
if($lengthsearch > $lengthreplace)
|
||||
{
|
||||
while($lengthsearch > $lengthreplace)
|
||||
{
|
||||
array_push($filenamereplace, '');
|
||||
$lengthreplace = $lengthreplace + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($lengthreplace > $lengthsearch)
|
||||
{
|
||||
while($lengthreplace > $lengthsearch)
|
||||
{
|
||||
array_push($filenamesearch, '');
|
||||
$lengthsearch = $lengthsearch + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checks for extension
|
||||
$extensions = array('.jpeg','.jpg','.jpe','.gif','.png');
|
||||
$extension = false;
|
||||
for($i = 0; $i < count($extensions); $i++)
|
||||
{
|
||||
$extensiontrue = substr_count($orig, $extensions[$i]);
|
||||
if($extensiontrue != 0 )
|
||||
{
|
||||
$extension = true;
|
||||
// If extension found, break
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Replace extension if present
|
||||
if($extension)
|
||||
{
|
||||
$fileextension = JFile::getExt($orig);
|
||||
$fileextensionlength = strlen($fileextension);
|
||||
$filenamelength = strlen($orig);
|
||||
$filename = substr($orig, -$filenamelength, -$fileextensionlength - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No extension found (Batchupload)
|
||||
$filename = $orig;
|
||||
}
|
||||
for($i = 0; $i < $lengthreplace; $i++)
|
||||
{
|
||||
$searchstring = '!'.$filenamesearch[$i].'+!i';
|
||||
$filename = preg_replace($searchstring, $filenamereplace[$i], $filename);
|
||||
}
|
||||
if($extension && !$replace_extension)
|
||||
{
|
||||
// Return filename with extension for regular upload
|
||||
return $filename.'.'.$fileextension;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Return filename without extension for batchupload
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check filename if it's valid for the filesystem
|
||||
* @param string $nameb filename before any processing
|
||||
* @param string $namea filename after processing in e.g. fixFilename
|
||||
* @param boolean $checkspecial True if the filename shall be checked for
|
||||
* special characters only
|
||||
* @return boolean True if the filename is valid, false otherwise
|
||||
* @since 2.0
|
||||
*/
|
||||
public static function checkValidFilename($nameb, $namea = '', $checkspecial = false)
|
||||
{
|
||||
// TODO delete this function and the call of them?
|
||||
return true;
|
||||
|
||||
// Check only for special characters
|
||||
if($checkspecial)
|
||||
{
|
||||
$pattern = '/[^0-9A-Za-z -_]/';
|
||||
$check = preg_match($pattern, $nameb);
|
||||
if($check == 0)
|
||||
{
|
||||
// No special characters found
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Remove extension from names
|
||||
$nameb = JFile::stripExt($nameb);
|
||||
$namea = JFile::stripExt($namea);
|
||||
|
||||
// Check the old filename for containing only underscores
|
||||
if(strlen($nameb) - substr_count($nameb, '_') == 0)
|
||||
{
|
||||
$nameb_onlyus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nameb_onlyus = false;
|
||||
}
|
||||
if( empty($namea)
|
||||
|| ( !$nameb_onlyus
|
||||
&& strlen($namea) == substr_count($nameb, '_')
|
||||
)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes the permissions of a directory (or file)
|
||||
* either by the FTP-Layer if enabled
|
||||
* or by JPath::setPermissions (chmod()).
|
||||
*
|
||||
* Not sure but probable: J! 1.6 will use
|
||||
* FTP-Layer automatically in setPermissions
|
||||
* so JoomFile::chmod will become unnecessary.
|
||||
*
|
||||
* @param string $path Directory or file for which the permissions will be changed
|
||||
* @param string $mode Permissions which will be applied to $path
|
||||
* @param boolean $is_dir True if the given path is a directory, false if it is a file
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static function chmod($path, $mode, $is_dir = false)
|
||||
{
|
||||
static $ftpOptions;
|
||||
|
||||
if(!isset($ftpOptions))
|
||||
{
|
||||
// Initialize variables
|
||||
jimport('joomla.client.helper');
|
||||
$ftpOptions = JClientHelper::getCredentials('ftp');
|
||||
}
|
||||
|
||||
if($ftpOptions['enabled'] == 1)
|
||||
{
|
||||
// Connect the FTP client
|
||||
jimport('joomla.client.ftp');
|
||||
$ftp = JFTP::getInstance($ftpOptions['host'], $ftpOptions['port'], array(), $ftpOptions['user'], $ftpOptions['pass']);
|
||||
// Translate path to FTP path
|
||||
$path = JPath::clean(str_replace(JPATH_ROOT, $ftpOptions['root'], $path), '/');
|
||||
|
||||
return $ftp->chmod($path, $mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($is_dir)
|
||||
{
|
||||
return JPath::setPermissions(JPath::clean($path), null, $mode);
|
||||
}
|
||||
|
||||
return JPath::setPermissions(JPath::clean($path), $mode, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize image with functions from gd/gd2/imagemagick
|
||||
*
|
||||
* Cropping function adapted from
|
||||
* 'Resize Image with Different Aspect Ratio'
|
||||
* Author: Nash
|
||||
* Website: http://nashruddin.com/Resize_Image_to_Different_Aspect_Ratio_on_the_fly
|
||||
*
|
||||
* @param &string $debugoutput debug information
|
||||
* @param string $src_file Path to source file
|
||||
* @param string $dest_file Path to destination file
|
||||
* @param int $useforresizedirection Thumbnails only:
|
||||
* Resize to width/height ratio or free setting
|
||||
* @param int $new_width Width to resize
|
||||
* @param int $thumbheight Height to resize
|
||||
* @param int $method 1=gd1, 2=gd2, 3=im
|
||||
* @param int $dest_qual $config->jg_thumbquality/jg_picturequality
|
||||
* @param boolean $max_width true=resize to maxwidth
|
||||
* @param int $cropposition $config->jg_cropposition
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function resizeImage(&$debugoutput, $src_file, $dest_file, $useforresizedirection,
|
||||
$new_width, $thumbheight, $method, $dest_qual, $max_width = false, $cropposition)
|
||||
{
|
||||
$config = JoomConfig::getInstance();
|
||||
|
||||
// Ensure that the pathes are valid and clean
|
||||
$src_file = JPath::clean($src_file);
|
||||
$dest_file = JPath::clean($dest_file);
|
||||
|
||||
// Doing resize instead of thumbnail, copy original and remove it.
|
||||
$imginfo = getimagesize($src_file);
|
||||
|
||||
if(!$imginfo)
|
||||
{
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_FILE_NOT_FOUND').'<br />';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// GD can only handle JPG & PNG images
|
||||
if( $imginfo[2] != IMAGETYPE_JPEG
|
||||
&& $imginfo[2] != IMAGETYPE_PNG
|
||||
&& $imginfo[2] != IMAGETYPE_GIF
|
||||
&& ($method == 'gd1' || $method == 'gd2')
|
||||
)
|
||||
{
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_GD_ONLY_JPG_PNG').'<br />';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$imagetype = array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD',
|
||||
6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2',
|
||||
11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF');
|
||||
|
||||
$imginfo[2] = $imagetype[$imginfo[2]];
|
||||
|
||||
// Height/width
|
||||
$srcWidth = $imginfo[0];
|
||||
$srcHeight = $imginfo[1];
|
||||
|
||||
if( ($max_width && $srcWidth <= $new_width && $srcHeight <= $new_width)
|
||||
|| (!$max_width && $srcWidth <= $new_width && $srcHeight <= $thumbheight)
|
||||
)
|
||||
{
|
||||
// If source image is already of the same size or smaller than the image
|
||||
// which shall be created only copy the source image to destination
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_RESIZE_NOT_NECESSARY').'<br />';
|
||||
if(!JFile::copy($src_file, $dest_file))
|
||||
{
|
||||
$debugoutput .= JText::sprintf('COM_JOOMGALLERY_UPLOAD_OUTPUT_PROBLEM_COPYING', $dest_file).' '.JText::_('COM_JOOMGALLERY_COMMON_CHECK_PERMISSIONS').'<br />';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// For free resizing and cropping the center
|
||||
$offsetx = null;
|
||||
$offsety = null;
|
||||
if($max_width)
|
||||
{
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_RESIZE_TO_MAX').'<br />';
|
||||
|
||||
if($new_width <= 0)
|
||||
{
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_ERROR_NO_VALID_WIDTH_OR_HEIGHT').'<br />';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$ratio = max($srcHeight,$srcWidth) / $new_width ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Resizing to thumbnail
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_CREATE_THUMBNAIL_FROM').' '.$imginfo[2].', '.$imginfo[0].' x '.$imginfo[1].'...<br />';
|
||||
|
||||
if($new_width <= 0 || $thumbheight <= 0)
|
||||
{
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_ERROR_NO_VALID_WIDTH_OR_HEIGHT').'<br />';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
switch($useforresizedirection)
|
||||
{
|
||||
// Convert to height ratio
|
||||
case 0:
|
||||
$ratio = ($srcHeight / $thumbheight);
|
||||
$testwidth = ($srcWidth / $ratio);
|
||||
// If new width exceeds setted max. width
|
||||
if($testwidth > $new_width)
|
||||
{
|
||||
$ratio = ($srcWidth / $new_width);
|
||||
}
|
||||
break;
|
||||
// Convert to width ratio
|
||||
case 1:
|
||||
$ratio = ($srcWidth / $new_width);
|
||||
$testheight = ($srcHeight/$ratio);
|
||||
// If new height exceeds the setted max. height
|
||||
if($testheight>$thumbheight)
|
||||
{
|
||||
$ratio = ($srcHeight/$thumbheight);
|
||||
}
|
||||
break;
|
||||
// Free resizing and cropping the center
|
||||
case 2:
|
||||
if($srcWidth < $new_width)
|
||||
{
|
||||
$new_width = $srcWidth;
|
||||
}
|
||||
if($srcHeight < $thumbheight)
|
||||
{
|
||||
$thumbheight = $srcHeight;
|
||||
}
|
||||
// Expand the thumbnail's aspect ratio
|
||||
// to fit the width/height of the image
|
||||
$ratiowidth = $srcWidth / $new_width;
|
||||
$ratioheight = $srcHeight / $thumbheight;
|
||||
if ($ratiowidth < $ratioheight)
|
||||
{
|
||||
$ratio = $ratiowidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ratio = $ratioheight;
|
||||
}
|
||||
// Calculate the offsets for cropping the source image according
|
||||
// to thumbposition
|
||||
switch($cropposition)
|
||||
{
|
||||
// Left upper corner
|
||||
case 0:
|
||||
$offsetx = 0;
|
||||
$offsety = 0;
|
||||
break;
|
||||
// Right upper corner
|
||||
case 1:
|
||||
$offsetx = floor(($srcWidth - ($new_width * $ratio)));
|
||||
$offsety = 0;
|
||||
break;
|
||||
// Left lower corner
|
||||
case 3:
|
||||
$offsetx = 0;
|
||||
$offsety = floor(($srcHeight - ($thumbheight * $ratio)));
|
||||
break;
|
||||
// Right lower corner
|
||||
case 4:
|
||||
$offsetx = floor(($srcWidth - ($new_width * $ratio)));
|
||||
$offsety = floor(($srcHeight - ($thumbheight * $ratio)));
|
||||
break;
|
||||
// Default center
|
||||
default:
|
||||
$offsetx = floor(($srcWidth - ($new_width * $ratio)) * 0.5);
|
||||
$offsety = floor(($srcHeight - ($thumbheight * $ratio)) * 0.5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(is_null($offsetx) && is_null($offsety))
|
||||
{
|
||||
$ratio = max($ratio, 1.0);
|
||||
|
||||
$destWidth = (int)($srcWidth / $ratio);
|
||||
$destHeight = (int)($srcHeight / $ratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
$destWidth = $new_width;
|
||||
$destHeight = $thumbheight;
|
||||
$srcWidth = (int)($destWidth * $ratio);
|
||||
$srcHeight = (int)($destHeight * $ratio);
|
||||
}
|
||||
|
||||
// Method for creation of the resized image
|
||||
switch($method)
|
||||
{
|
||||
case 'gd1':
|
||||
if(!function_exists('imagecreatefromjpeg'))
|
||||
{
|
||||
$debugoutput.=JText::_('COM_JOOMGALLERY_UPLOAD_GD_LIBARY_NOT_INSTALLED');
|
||||
return false;
|
||||
}
|
||||
if($imginfo[2] == 'JPG')
|
||||
{
|
||||
$src_img = imagecreatefromjpeg($src_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($imginfo[2] == 'PNG')
|
||||
{
|
||||
$src_img = imagecreatefrompng($src_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$src_img = imagecreatefromgif($src_file);
|
||||
}
|
||||
}
|
||||
if(!$src_img)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$dst_img = imagecreate($destWidth, $destHeight);
|
||||
if (!is_null($offsetx) && !is_null($offsety))
|
||||
{
|
||||
imagecopyresized( $dst_img, $src_img, 0, 0, $offsetx, $offsety,
|
||||
$destWidth, (int)$destHeight, $srcWidth, $srcHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
imagecopyresized( $dst_img, $src_img, 0, 0, 0, 0, $destWidth,
|
||||
(int)$destHeight, $srcWidth, $srcHeight);
|
||||
}
|
||||
if(!@imagejpeg($dst_img, $dest_file, $dest_qual))
|
||||
{
|
||||
// Workaround for servers with wwwrun problem
|
||||
$dir = dirname($dest_file);
|
||||
JoomFile::chmod($dir, '0777', true);
|
||||
imagejpeg($dst_img, $dest_file, $dest_qual);
|
||||
JoomFile::chmod($dir, '0755', true);
|
||||
}
|
||||
imagedestroy($src_img);
|
||||
imagedestroy($dst_img);
|
||||
break;
|
||||
case 'gd2':
|
||||
if(!function_exists('imagecreatefromjpeg'))
|
||||
{
|
||||
$debugoutput.=JText::_('COM_JOOMGALLERY_UPLOAD_GD_LIBARY_NOT_INSTALLED');
|
||||
return false;
|
||||
}
|
||||
if(!function_exists('imagecreatetruecolor'))
|
||||
{
|
||||
$debugoutput.=JText::_('COM_JOOMGALLERY_UPLOAD_GD_NO_TRUECOLOR');
|
||||
return false;
|
||||
}
|
||||
if($imginfo[2] == 'JPG')
|
||||
{
|
||||
$src_img = imagecreatefromjpeg($src_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($imginfo[2] == 'PNG')
|
||||
{
|
||||
$src_img = imagecreatefrompng($src_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$src_img = imagecreatefromgif($src_file);
|
||||
}
|
||||
}
|
||||
|
||||
if(!$src_img)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$dst_img = imagecreatetruecolor($destWidth, $destHeight);
|
||||
|
||||
if($config->jg_fastgd2thumbcreation == 0)
|
||||
{
|
||||
if(!is_null($offsetx) && !is_null($offsety))
|
||||
{
|
||||
imagecopyresampled( $dst_img, $src_img, 0, 0, $offsetx, $offsety,
|
||||
$destWidth, (int)$destHeight, $srcWidth, $srcHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
imagecopyresampled( $dst_img, $src_img, 0, 0, 0, 0, $destWidth,
|
||||
(int)$destHeight, $srcWidth, $srcHeight);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!is_null($offsetx) && !is_null($offsety))
|
||||
{
|
||||
JoomFile::fastImageCopyResampled( $dst_img, $src_img, 0, 0, $offsetx, $offsety,
|
||||
$destWidth, (int)$destHeight, $srcWidth, $srcHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
JoomFile::fastImageCopyResampled( $dst_img, $src_img, 0, 0, 0, 0, $destWidth,
|
||||
(int)$destHeight, $srcWidth, $srcHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if(!@imagejpeg($dst_img, $dest_file, $dest_qual))
|
||||
{
|
||||
// Workaround for servers with wwwrun problem
|
||||
$dir = dirname($dest_file);
|
||||
JoomFile::chmod($dir, '0777', true);
|
||||
imagejpeg($dst_img, $dest_file, $dest_qual);
|
||||
JoomFile::chmod($dir, '0755', true);
|
||||
}
|
||||
imagedestroy($src_img);
|
||||
imagedestroy($dst_img);
|
||||
break;
|
||||
case 'im':
|
||||
$disabled_functions = explode(',', ini_get('disabled_functions'));
|
||||
foreach($disabled_functions as $disabled_function)
|
||||
{
|
||||
if(trim($disabled_function) == 'exec')
|
||||
{
|
||||
$debugoutput .= JText::_('COM_JOOMGALLERY_UPLOAD_OUTPUT_EXEC_DISABLED').'<br />';
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($config->jg_impath))
|
||||
{
|
||||
$convert_path=$config->jg_impath.'convert';
|
||||
}
|
||||
else
|
||||
{
|
||||
$convert_path='convert';
|
||||
}
|
||||
$commands = '';
|
||||
// Crop the source image before resiszing if offsets setted before
|
||||
// example of crop: convert input -crop destwidthxdestheight+offsetx+offsety +repage output
|
||||
// +repage needed to delete the canvas
|
||||
if(!is_null($offsetx) && !is_null($offsety))
|
||||
{
|
||||
$commands .= ' -crop "'.$srcWidth.'x'.$srcHeight.'+'.$offsetx.'+'.$offsety.'" +repage';
|
||||
}
|
||||
// Finally the resize
|
||||
$commands .= ' -resize "'.$destWidth.'x'.$destHeight.'" -quality "'.$dest_qual.'" -unsharp "3.5x1.2+1.0+0.10"';
|
||||
$convert = $convert_path.' '.$commands.' "'.$src_file.'" "'.$dest_file.'"';
|
||||
|
||||
$return_var = null;
|
||||
$dummy = null;
|
||||
@exec($convert, $dummy, $return_var);
|
||||
if($return_var != 0)
|
||||
{
|
||||
// Workaround for servers with wwwrun problem
|
||||
$dir = dirname($dest_file);
|
||||
JoomFile::chmod($dir, '0777', true);
|
||||
@exec($convert, $dummy, $return_var);
|
||||
JoomFile::chmod($dir, '0755', true);
|
||||
if($return_var != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
JError::raiseError(500, JText::_('COM_JOOMGALLERY_UPLOAD_UNSUPPORTED_RESIZING_METHOD'));
|
||||
break;
|
||||
}
|
||||
|
||||
// Set mode of uploaded picture
|
||||
JPath::setPermissions($dest_file);
|
||||
|
||||
// We check that the image is valid
|
||||
$imginfo = getimagesize($dest_file);
|
||||
if(!$imginfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast resizing of images with GD2
|
||||
* Notice: need up to 3/4 times more memory
|
||||
* http://de.php.net/manual/en/function.imagecopyresampled.php#77679
|
||||
* Plug-and-Play fastimagecopyresampled function replaces much slower
|
||||
* imagecopyresampled. Just include this function and change all
|
||||
* "imagecopyresampled" references to "fastimagecopyresampled".
|
||||
* Typically from 30 to 60 times faster when reducing high resolution
|
||||
* images down to thumbnail size using the default quality setting.
|
||||
* Author: Tim Eckel - Date: 09/07/07 - Version: 1.1 -
|
||||
* Project: FreeRingers.net - Freely distributable - These comments must remain.
|
||||
*
|
||||
* Optional "quality" parameter (defaults is 3). Fractional values are allowed,
|
||||
* for example 1.5. Must be greater than zero.
|
||||
* Between 0 and 1 = Fast, but mosaic results, closer to 0 increases the mosaic effect.
|
||||
* 1 = Up to 350 times faster. Poor results, looks very similar to imagecopyresized.
|
||||
* 2 = Up to 95 times faster. Images appear a little sharp,
|
||||
* some prefer this over a quality of 3.
|
||||
* 3 = Up to 60 times faster. Will give high quality smooth results very close to
|
||||
* imagecopyresampled, just faster.
|
||||
* 4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.
|
||||
* 5 = No speedup. Just uses imagecopyresampled, no advantage over
|
||||
* imagecopyresampled.
|
||||
*
|
||||
* @param string $dst_image path to destination image
|
||||
* @param string $src_image path to source image
|
||||
* @param int $dst_x destination x point left above
|
||||
* @param int $dst_y destination y point left above
|
||||
* @param int $src_x source x point left above
|
||||
* @param int $src_y source y point left above
|
||||
* @param int $dst_w destination width
|
||||
* @param int $dst_h destination height
|
||||
* @param int $src_w source width
|
||||
* @param int $src_h source height
|
||||
* @param int $quality quality of destination (fix = 3) read instructions above
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function fastImageCopyResampled(&$dst_image, $src_image, $dst_x, $dst_y,
|
||||
$src_x, $src_y, $dst_w, $dst_h,
|
||||
$src_w, $src_h, $quality = 3)
|
||||
{
|
||||
if(empty($src_image) || empty($dst_image) || $quality <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h))
|
||||
{
|
||||
$temp = imagecreatetruecolor($dst_w * $quality + 1, $dst_h * $quality + 1);
|
||||
imagecopyresized ($temp, $src_image, 0, 0, $src_x, $src_y, $dst_w * $quality + 1,
|
||||
$dst_h * $quality + 1, $src_w, $src_h);
|
||||
imagecopyresampled($dst_image, $temp, $dst_x, $dst_y, 0, 0, $dst_w,
|
||||
$dst_h, $dst_w * $quality, $dst_h * $quality);
|
||||
imagedestroy ($temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w,
|
||||
$dst_h, $src_w, $src_h);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies an index.html file into a specified folder
|
||||
*
|
||||
* @param string The folder path to copy the index.html file into
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public static function copyIndexHtml($folder)
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$src = JPATH_ROOT.'/media/joomgallery/index.html';
|
||||
$dest = JPath::clean($folder.'/index.html');
|
||||
|
||||
return JFile::copy($src, $dest);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,517 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/helper.php $
|
||||
// $Id: helper.php 4330 2013-09-08 08:19:39Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* JoomGallery Global Helper for the Backend
|
||||
*
|
||||
* @static
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomHelper
|
||||
{
|
||||
/**
|
||||
* Add managers to the sub-menu
|
||||
*
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public static function addSubmenu()
|
||||
{
|
||||
$current_controller = JRequest::getCmd('controller', 'control');
|
||||
|
||||
$controllers = array( 'control' => JText::_('COM_JOOMGALLERY_CONTROL_PANEL'),
|
||||
'categories' => JText::_('COM_JOOMGALLERY_CATEGORY_MANAGER'),
|
||||
'images' => JText::_('COM_JOOMGALLERY_IMAGE_MANAGER'),
|
||||
'comments' => JText::_('COM_JOOMGALLERY_COMMENTS_MANAGER'),
|
||||
'upload' => JText::_('COM_JOOMGALLERY_IMAGE_UPLOAD'),
|
||||
'ajaxupload' => JText::_('COM_JOOMGALLERY_AJAX_UPLOAD'),
|
||||
'batchupload' => JText::_('COM_JOOMGALLERY_BATCH_UPLOAD'),
|
||||
'ftpupload' => JText::_('COM_JOOMGALLERY_FTP_UPLOAD'),
|
||||
'jupload' => JText::_('COM_JOOMGALLERY_JAVA_UPLOAD'),
|
||||
'config' => JText::_('COM_JOOMGALLERY_CONFIGURATION_MANAGER'),
|
||||
'cssedit' => JText::_('COM_JOOMGALLERY_CUSTOMIZE_CSS'),
|
||||
'migration' => JText::_('COM_JOOMGALLERY_MIGRATION_MANAGER'),
|
||||
'maintenance' => JText::_('COM_JOOMGALLERY_MAINTENANCE_MANAGER'),
|
||||
'help' => JText::_('COM_JOOMGALLERY_HELP')
|
||||
);
|
||||
|
||||
$canDo = self::getActions();
|
||||
|
||||
if(!JoomConfig::getInstance()->get('jg_disableunrequiredchecks') && !$canDo->get('joom.upload') && !count(JoomHelper::getAuthorisedCategories('joom.upload')))
|
||||
{
|
||||
unset($controllers['upload']);
|
||||
unset($controllers['batchupload']);
|
||||
unset($controllers['ftpupload']);
|
||||
unset($controllers['jupload']);
|
||||
unset($controllers['ajaxupload']);
|
||||
}
|
||||
|
||||
if(!$canDo->get('core.admin'))
|
||||
{
|
||||
unset($controllers['config']);
|
||||
unset($controllers['cssedit']);
|
||||
unset($controllers['maintenance']);
|
||||
}
|
||||
|
||||
foreach($controllers as $controller => $title)
|
||||
{
|
||||
JHtmlSidebar::addEntry( $title,
|
||||
'index.php?option='._JOOM_OPTION.'&controller='.$controller,
|
||||
$controller == $current_controller
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of the actions that can be performed
|
||||
*
|
||||
* @param string $type The type of the content to check
|
||||
* @param int $id The ID of the content (category or image)
|
||||
* @return JObject An object holding the results of the check
|
||||
* @since 2.0
|
||||
*/
|
||||
public static function getActions($type = 'component', $id = 0)
|
||||
{
|
||||
static $cache = array();
|
||||
|
||||
// Create a unique key for the this pair of parameters
|
||||
$key = $type.':'.$id;
|
||||
|
||||
if(isset($cache[$key]))
|
||||
{
|
||||
return $cache[$key];
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$result = new JObject();
|
||||
|
||||
$actions = array('core.admin', 'core.manage', 'joom.upload', 'joom.upload.inown', 'core.create', 'joom.create.inown', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete');
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'category':
|
||||
$assetName = _JOOM_OPTION.'.category.'.$id;
|
||||
break;
|
||||
case 'image':
|
||||
$assetName = _JOOM_OPTION.'.image.'.$id;
|
||||
break;
|
||||
default:
|
||||
$assetName = _JOOM_OPTION;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach($actions as $action)
|
||||
{
|
||||
$result->set($action, $user->authorise($action, $assetName));
|
||||
}
|
||||
|
||||
// Store the result for better performance
|
||||
$cache[$key] = $result;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all categories for that a user has permission for a given action
|
||||
*
|
||||
* @param string $action The action to check for
|
||||
* @return array List of category objects for which the current can do the selected action to (empty array if none)
|
||||
* @since 2.0
|
||||
*/
|
||||
public static function getAuthorisedCategories($action)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$cats = JoomAmbit::getInstance()->getCategoryStructure(true);
|
||||
$allowedCategories = array();
|
||||
foreach($cats as $category)
|
||||
{
|
||||
$action2 = false;
|
||||
if($action == 'joom.upload')
|
||||
{
|
||||
$action2 = 'joom.upload.inown';
|
||||
}
|
||||
if($action == 'core.create')
|
||||
{
|
||||
$action2 = 'joom.create.inown';
|
||||
}
|
||||
if($action == 'core.edit')
|
||||
{
|
||||
$action2 = 'core.edit.own';
|
||||
}
|
||||
|
||||
if( $user->authorise($action, _JOOM_OPTION.'.category.'.$category->cid)
|
||||
|| ( $action2
|
||||
&& $category->owner == $user->get('id')
|
||||
&& $user->authorise($action2, _JOOM_OPTION.'.category.'.$category->cid)
|
||||
)
|
||||
)
|
||||
{
|
||||
$allowedCategories[] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
return $allowedCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all parent categories of a specific category
|
||||
*
|
||||
* @param int $category The ID of the specific child category
|
||||
* @param boolean $child True, if category itself shall also be returned, defaults to false
|
||||
* @return array An array of parent category objects with cid,name,parent_id
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public static function getAllParentCategories($category, $child = false)
|
||||
{
|
||||
// Get category structure from ambit
|
||||
$ambit = JoomAmbit::getInstance();
|
||||
$cats = $ambit->getCategoryStructure();
|
||||
$parents = array();
|
||||
|
||||
if(!$category)
|
||||
{
|
||||
return $parents;
|
||||
}
|
||||
|
||||
if($child)
|
||||
{
|
||||
$parents[$category] = new stdClass();
|
||||
$parents[$category]->cid = $cats[$category]->cid;
|
||||
$parents[$category]->name = $cats[$category]->name;
|
||||
$parents[$category]->parent_id = $cats[$category]->parent_id;
|
||||
$parents[$category]->published = $cats[$category]->published;
|
||||
}
|
||||
|
||||
$parentcat = $cats[$category]->parent_id;
|
||||
while($parentcat != 1)
|
||||
{
|
||||
$category = $parentcat;
|
||||
$parents[$category] = new stdClass();
|
||||
$parents[$category]->cid = $cats[$category]->cid;
|
||||
$parents[$category]->name = $cats[$category]->name;
|
||||
$parents[$category]->parent_id = $cats[$category]->parent_id;
|
||||
$parents[$category]->published = $cats[$category]->published;
|
||||
$parentcat = $cats[$category]->parent_id;
|
||||
}
|
||||
|
||||
// Reverse the array to get the right order
|
||||
$parents = array_reverse($parents, true);
|
||||
|
||||
return $parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all categories and their sub-categories with published or no images
|
||||
*
|
||||
* @param int $cat Category ID
|
||||
* @param boolean $rootcat True, if $cat shall also be returned as an
|
||||
* element of the array
|
||||
* @param boolean $noimgcats True if @return shall also include categories
|
||||
* with no images
|
||||
* @param boolean $all True if all categories shall be selected, defaults to true
|
||||
* @param boolean $nohiddencats True, if sub-categories of hidden categories should be
|
||||
* filtered out, defaults to false
|
||||
* @return array An array of found categories
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public static function getAllSubCategories($cat, $rootcat = false, $noimgcats = false, $all = true, $nohiddencats = false)
|
||||
{
|
||||
// Initialise variables
|
||||
$cat = (int) $cat;
|
||||
$parentcats = array();
|
||||
$parentcats[$cat] = true;
|
||||
$branchfound = false;
|
||||
$allsubcats = array();
|
||||
|
||||
// Get category structure from ambit
|
||||
$ambit = JoomAmbit::getInstance();
|
||||
$cats = $ambit->getCategoryStructure($all);
|
||||
|
||||
$stopindex = count($cats);
|
||||
|
||||
$keys = array_keys($cats);
|
||||
$startindex = array_search($cat, $keys);
|
||||
if($startindex === false)
|
||||
{
|
||||
return $allsubcats;
|
||||
}
|
||||
|
||||
// Find all cats which are subcategories of cat
|
||||
$hidden = array();
|
||||
for($j = $startindex + 1; $j < $stopindex; $j++)
|
||||
{
|
||||
$i = $keys[$j];
|
||||
$parentcat = $cats[$i]->parent_id;
|
||||
if(isset($parentcats[$parentcat]))
|
||||
{
|
||||
$parentcats[$i] = true;
|
||||
$branchfound = true;
|
||||
|
||||
// Don't include hidden sub-categories
|
||||
if($nohiddencats)
|
||||
{
|
||||
if($cats[$i]->hidden)
|
||||
{
|
||||
$hidden[$i] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($hidden[$cats[$i]->parent_id]))
|
||||
{
|
||||
$hidden[$i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($hidden[$i]))
|
||||
{
|
||||
if(!$noimgcats)
|
||||
{
|
||||
// Only categories with images
|
||||
if($cats[$i]->piccount > 0)
|
||||
{
|
||||
// Subcategory with images in array
|
||||
$allsubcats[] = $i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$allsubcats[] = $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($branchfound)
|
||||
{
|
||||
// Branch has been processed completely
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add rootcat
|
||||
if($rootcat)
|
||||
{
|
||||
if(!$noimgcats)
|
||||
{
|
||||
// Includes images
|
||||
if($cats[$cat]->piccount > 0)
|
||||
{
|
||||
$allsubcats[] = $cat;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$allsubcats[] = $cat;
|
||||
}
|
||||
}
|
||||
|
||||
return $allsubcats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap text
|
||||
*
|
||||
* @param string $text Text to wrap
|
||||
* @param int $nr Number of chars to wrap
|
||||
* @return string Wrapped text
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function processText($text, $nr = 40)
|
||||
{
|
||||
$mytext = explode(' ', trim($text));
|
||||
$newtext = array();
|
||||
foreach($mytext as $k => $txt)
|
||||
{
|
||||
if(strlen($txt) > $nr)
|
||||
{
|
||||
$txt = wordwrap($txt, $nr, '- ', 1);
|
||||
}
|
||||
$newtext[] = $txt;
|
||||
}
|
||||
|
||||
return implode(' ', $newtext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the category path from array.
|
||||
* If not set read db and add to array.
|
||||
*
|
||||
* @param int $catid The ID of the category
|
||||
* @return string The category path
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getCatPath($catid)
|
||||
{
|
||||
static $catpath = array();
|
||||
|
||||
if(!isset($catpath[$catid]))
|
||||
{
|
||||
$database = JFactory::getDBO();
|
||||
|
||||
$query = $database->getQuery(true)
|
||||
->select('catpath')
|
||||
->from(_JOOM_TABLE_CATEGORIES)
|
||||
->where('cid= '.$catid);
|
||||
|
||||
$database->setQuery($query);
|
||||
if(!$path = $database->loadResult())
|
||||
{
|
||||
$catpath[$catid] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$catpath[$catid] = $path.'/';
|
||||
}
|
||||
}
|
||||
|
||||
return $catpath[$catid];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rating clause for an SQL - query dependent on the
|
||||
* rating calculation method selected.
|
||||
*
|
||||
* @param string $tablealias Table alias
|
||||
* @return string Rating clause
|
||||
* @since 1.5.6
|
||||
*/
|
||||
public static function getSQLRatingClause($tablealias = '')
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$config = JoomConfig::getInstance();
|
||||
static $avgimgvote = 0.0;
|
||||
static $avgimgrating = 0.0;
|
||||
static $avgdone = false;
|
||||
|
||||
$maxvoting = $config->get('jg_maxvoting');
|
||||
$imgvotesum = 'imgvotesum';
|
||||
$imgvotes = 'imgvotes';
|
||||
if($tablealias != '')
|
||||
{
|
||||
$imgvotesum = $tablealias.'.'.$imgvotesum;
|
||||
$imgvotes = $tablealias.'.'.$imgvotes;
|
||||
}
|
||||
|
||||
// Standard rating clause
|
||||
$clause = 'ROUND(LEAST(IF(imgvotes > 0, '.$imgvotesum.'/'.$imgvotes.', 0.0), '.(float)$maxvoting.'), 2)';
|
||||
|
||||
// Advanced (weigthed) rating clause (Bayes)
|
||||
if($config->get('jg_ratingcalctype') == 1)
|
||||
{
|
||||
if(!$avgdone)
|
||||
{
|
||||
// Needed values for weighted rating calculation
|
||||
$query = $db->getQuery(true)
|
||||
->select('count(*) As imgcount')
|
||||
->select('SUM(imgvotes) As sumimgvotes')
|
||||
->select('SUM(imgvotesum/imgvotes) As sumimgratings')
|
||||
->from(_JOOM_TABLE_IMAGES)
|
||||
->where('imgvotes > 0');
|
||||
|
||||
$db->setQuery($query);
|
||||
$row = $db->loadObject();
|
||||
if($row != null)
|
||||
{
|
||||
if($row->imgcount > 0)
|
||||
{
|
||||
$avgimgvote = round($row->sumimgvotes / $row->imgcount, 2 );
|
||||
$avgimgrating = round($row->sumimgratings / $row->imgcount, 2);
|
||||
$avgdone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($avgdone)
|
||||
{
|
||||
$clause = 'ROUND(LEAST(IF(imgvotes > 0, (('.$avgimgvote.'*'.$avgimgrating.') + '.$imgvotesum.') / ('.$avgimgvote.' + '.$imgvotes.'), 0.0), '.(float)$maxvoting.'), 2)';
|
||||
}
|
||||
}
|
||||
|
||||
return $clause;
|
||||
}
|
||||
/**
|
||||
* Returns the rating of an image
|
||||
*
|
||||
* @param string $imgid Image id to get the rating for
|
||||
* @return float Rating
|
||||
* @since 1.5.6
|
||||
*/
|
||||
public static function getRating($imgid)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$rating = 0.0;
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->select(JoomHelper::getSQLRatingClause().' AS rating')
|
||||
->from(_JOOM_TABLE_IMAGES)
|
||||
->where('id = '.$imgid);
|
||||
|
||||
$db->setQuery($query);
|
||||
if(($result = $db->loadResult()) != null)
|
||||
{
|
||||
$rating = $result;
|
||||
}
|
||||
|
||||
return $rating;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given size with units e.g. read from php.ini to bytes.
|
||||
*
|
||||
* @param string $val Value with units (e.g. 8M)
|
||||
* @return int Value in bytes
|
||||
* @since 3.0
|
||||
*/
|
||||
|
||||
public static function iniToBytes($val)
|
||||
{
|
||||
$val = trim($val);
|
||||
|
||||
switch(strtolower(substr($val, -1)))
|
||||
{
|
||||
case 'm':
|
||||
$val = (int)substr($val, 0, -1) * 1048576;
|
||||
break;
|
||||
case 'k':
|
||||
$val = (int)substr($val, 0, -1) * 1024;
|
||||
break;
|
||||
case 'g':
|
||||
$val = (int)substr($val, 0, -1) * 1073741824;
|
||||
break;
|
||||
case 'b':
|
||||
switch(strtolower(substr($val, -2, 1)))
|
||||
{
|
||||
case 'm':
|
||||
$val = (int)substr($val, 0, -2) * 1048576;
|
||||
break;
|
||||
case 'k':
|
||||
$val = (int)substr($val, 0, -2) * 1024;
|
||||
break;
|
||||
case 'g':
|
||||
$val = (int)substr($val, 0, -2) * 1073741824;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/html/joomconfig.php $
|
||||
// $Id: joomconfig.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/******************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\******************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Utility class for creating HTML Grids
|
||||
*
|
||||
* @static
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JHTMLJoomConfig
|
||||
{
|
||||
/**
|
||||
* Displays the start of one table
|
||||
*
|
||||
* @param $id string the name of the id assigned to the div
|
||||
*/
|
||||
public static function start($id = 'page')
|
||||
{
|
||||
?>
|
||||
<div id="<?php echo $id; ?>">
|
||||
<table class="adminlist table table-bordered">
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the end of one table
|
||||
*/
|
||||
public static function end()
|
||||
{
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a row (colspan="3") in the config table for additional informations.
|
||||
* The text will not be translated, so please use JText::_() afore.
|
||||
*
|
||||
* @param $text string the text which will be displayed in the row
|
||||
*/
|
||||
public static function intro($text = ' ')
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3"><div class="alert alert-info"><?php echo $text; ?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the title, the current setting and the description of
|
||||
* one single option of the configuration manager in a table row
|
||||
*
|
||||
* @param $key string the identifier of the configuration option, e.g. 'jg_pathimages'
|
||||
* @param $type string 'text' => textfield, 'yesno' => yes/no selectbox, 'custom' => custom selectbox or textfield
|
||||
* @param $name string language constant for the title and the description (+_LONG) of the option, will be translated
|
||||
* @param $info string/int current setting of the option, if $type = 'custom', we will assume that it holds the complete HTML string
|
||||
* @param $display boolean if set to false, we won't display this option, defaults to true
|
||||
* @param $attribs string additional tag attributes (e.g. size = "50"), for now only effective for type 'text'
|
||||
* @param $text string Alternative description text, if null the default language constant will be used for each option
|
||||
*/
|
||||
public static function row($key, $type, $name, $info, $display = true, $attribs = '', $text = null)
|
||||
{
|
||||
if(!$display)
|
||||
{
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<tr align="center" valign="middle">
|
||||
<td align="left" valign="top"><strong><?php echo JText::_($name); ?></strong></td>
|
||||
<td align="left" valign="top"><?php
|
||||
switch($type) {
|
||||
case 'text':
|
||||
?><input type="text" name="<?php echo $key; ?>" value="<?php echo $info; ?>" <?php echo $attribs; ?>/><?php
|
||||
break;
|
||||
case 'yesno':
|
||||
static $yesno;
|
||||
if(!isset($yesno)){
|
||||
$yesno = array();
|
||||
$yesno[] = JHTML::_('select.option', '0', JText::_('JNO'));
|
||||
$yesno[] = JHTML::_('select.option', '1', JText::_('JYES'));
|
||||
}
|
||||
echo JHTML::_('select.genericlist', $yesno, $key, 'class="inputbox" size="2"', 'value', 'text', $info);
|
||||
break;
|
||||
case 'custom':
|
||||
echo $info;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} ?></td>
|
||||
<td align="left" valign="top"><?php echo $text ? $text : JText::_($name.'_LONG'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,408 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/html/joomselect.php $
|
||||
// $Id: joomselect.php 4398 2014-06-11 13:39:02Z erftralle $
|
||||
/******************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\******************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Utility class for creating HTML select lists
|
||||
*
|
||||
* @static
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
abstract class JHtmlJoomSelect
|
||||
{
|
||||
/**
|
||||
* Number of active users in the system.
|
||||
* This is not set until first call of method users().
|
||||
*
|
||||
* @var int
|
||||
* @since 3.0
|
||||
*/
|
||||
static $count = null;
|
||||
|
||||
/**
|
||||
* Construct HTML List of selectable categories
|
||||
*
|
||||
* @param int $currentcat catid, current cat or parent
|
||||
* @param string $cname Name of the HTML element
|
||||
* @param string $extra Some extra code to add to the element
|
||||
* @param int $orig A category to ignore (its sub-categories will be filtered out, too)
|
||||
* @param string $separator A string with which the categories will be separated in the category paths
|
||||
* @param string $task Null/filter
|
||||
* @param string $action Action to check for each category
|
||||
* @param mixed $idtag String to use as id tag for the select box
|
||||
* @return string The HTML output
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function categoryList($currentcat, $cname = 'catid', $extra = null, $orig = null, $separator = '- ', $task = null, $action = 'core.create', $idtag = false)
|
||||
{
|
||||
$attribs = 'class="inputbox"';
|
||||
if($extra)
|
||||
{
|
||||
// Add the default class only if no class is given by caller
|
||||
if(strpos($extra, 'class=') === false && strpos($extra, 'class =') === false)
|
||||
{
|
||||
$attribs .= ' '.$extra;
|
||||
}
|
||||
else
|
||||
{
|
||||
$attribs = $extra;
|
||||
}
|
||||
}
|
||||
|
||||
if(JoomConfig::getInstance()->get('jg_ajaxcategoryselection'))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
if(!$idtag)
|
||||
{
|
||||
$idtag = $cname;
|
||||
}
|
||||
|
||||
if($currentcat == 1)
|
||||
{
|
||||
$name = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('name')
|
||||
->from(_JOOM_TABLE_CATEGORIES)
|
||||
->where('cid = '.(int) $currentcat);
|
||||
$db->setQuery($query);
|
||||
$name = $db->loadResult();
|
||||
}
|
||||
|
||||
$matches = array();
|
||||
$onchange = '';
|
||||
if(preg_match('/onchange="(.*)"/', $attribs, $matches))
|
||||
{
|
||||
$onchange = $matches[1];
|
||||
$attribs = trim(str_replace($matches[0], '', $attribs));
|
||||
}
|
||||
$attribs = preg_replace('/size="(.*)"/', '', $attribs);
|
||||
|
||||
JText::script('COM_JOOMGALLERY_COMMON_REQUEST_ERROR');
|
||||
JText::script('COM_JOOMGALLERY_COMMON_CATEGORIES_NO_RESULTS');
|
||||
|
||||
JHtml::_('behavior.framework', true);
|
||||
$doc = JFactory::getDocument();
|
||||
if($app->isSite())
|
||||
{
|
||||
$url = JRoute::_('index.php?option='._JOOM_OPTION.'&task=categories.getcategories', false);
|
||||
$doc->addStyleSheet(JoomAmbit::getInstance()->getStyleSheet('joomgallery.css'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$url = JRoute::_('index.php?option='._JOOM_OPTION.'&controller=categories&task=getcategories', false);
|
||||
$doc->addStyleSheet(JoomAmbit::getInstance()->getStyleSheet('admin.joomgallery.css'));
|
||||
}
|
||||
$doc->addScript(JoomAmbit::getInstance()->getScript('categories.js'));
|
||||
$jscript = '
|
||||
<script type="text/javascript">
|
||||
var '.$idtag.'search;
|
||||
window.addEvent(\'domready\', function() {
|
||||
'.$idtag.'search = new JoomGallerySearchCategories({
|
||||
\'inputbox\': \'jg-'.$idtag.'-input\',
|
||||
\'resultbox\': \'jg-'.$idtag.'-results\',
|
||||
\'hiddenbox\': \''.$idtag.'\',
|
||||
\'moreresults\': \'jg-'.$idtag.'-more-results\',
|
||||
\'defaultcontent\': \''.($name ? addslashes($name) : JText::_('COM_JOOMGALLERY_COMMON_ALL', true)).'\',
|
||||
\'variablename\': \''.$idtag.'search\',
|
||||
\'action\': \''.($task ? '' : $action).'\',
|
||||
\'filter\': '.(int) $orig.',
|
||||
\'current\': '.(int) $currentcat.',
|
||||
\'onchange\': \''.str_replace('\'', '\\\'', $onchange).'\',
|
||||
\'url\': \''.$url.'&format=json\'
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
return $jscript . '
|
||||
<input type="hidden" name="'.$cname.'" value="'.$currentcat.'" id="'.$idtag.'" '.$attribs.' />
|
||||
<input type="text" name="jg-input-'.$cname.'" value="'.($name ? addslashes($name) : JText::_('COM_JOOMGALLERY_COMMON_ALL')).'" id="jg-'.$idtag.'-input" '.str_replace('validate-joompositivenumeric', '', $attribs).' />
|
||||
<div id="jg-'.$idtag.'-results" class="jg-category-results">
|
||||
<div id="jg-'.$idtag.'-more-results" class="jg-category-more-results" onclick="'.$idtag.'search.loadMore();return false;">
|
||||
<a href="#" onclick="return false;">
|
||||
'.JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES_MORE_RESULTS').'</a>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$ambit = JoomAmbit::getInstance();
|
||||
$cats = $ambit->getCategoryStructure(true);
|
||||
$options = array();
|
||||
//$filter = ($cname == 'parent_id' && $orig != null) ? true : false;
|
||||
$origfound = false;
|
||||
$filtercatkeys = array();
|
||||
|
||||
$paths = array();
|
||||
|
||||
$action2 = false;
|
||||
if($action == 'joom.upload')
|
||||
{
|
||||
$action2 = 'joom.upload.inown';
|
||||
}
|
||||
if($action == 'core.create')
|
||||
{
|
||||
$action2 = 'joom.create.inown';
|
||||
}
|
||||
if($action == 'core.edit')
|
||||
{
|
||||
$action2 = 'core.edit.own';
|
||||
}
|
||||
|
||||
foreach($cats as $key => $cat)
|
||||
{
|
||||
// Avoid 'ROOT' entry in drop down list in the case that no category has been created yet
|
||||
if($cat->cid === 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check whether a certain category and it's sub-categories
|
||||
// have to be filtered out of the list
|
||||
if($orig)
|
||||
{
|
||||
if(!$origfound)
|
||||
{
|
||||
if($cat->cid == $orig)
|
||||
{
|
||||
$origfound = true;
|
||||
$filtercatkeys[$orig] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($filtercatkeys[$cat->parent_id]))
|
||||
{
|
||||
$filtercatkeys[$key] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($cat->parent_id > 1)
|
||||
{
|
||||
//$paths[$key] = $paths[$cat->parent_id].$separator.$cat->name;
|
||||
$paths[$key] = $paths[$cat->parent_id] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$paths[$key] = 0;
|
||||
}
|
||||
|
||||
if( $task == 'filter'
|
||||
|| $key == $currentcat
|
||||
|| ( !isset($filtercatkeys[$key])
|
||||
&& ( $user->authorise($action, _JOOM_OPTION.'.category.'.$key)
|
||||
|| ( $action2
|
||||
&& $cat->owner == $user->get('id')
|
||||
&& $user->authorise($action2, _JOOM_OPTION.'.category.'.$cat->cid)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
// Build select option for that category
|
||||
$options[$key] = new stdClass();
|
||||
$options[$key]->cid = $cat->cid;
|
||||
$options[$key]->path = str_repeat($separator, $paths[$key]).$cat->name;
|
||||
}
|
||||
}
|
||||
|
||||
if($task == 'filter' || $currentcat == 0 || ($action == 'core.create' && $user->authorise($action, _JOOM_OPTION)))
|
||||
{
|
||||
$rootcat = new stdClass();
|
||||
$rootcat->cid = '';
|
||||
$rootcat->path = ($task == 'filter') ? JText::_('COM_JOOMGALLERY_COMMON_ALL') : '';
|
||||
array_unshift($options, $rootcat);
|
||||
}
|
||||
|
||||
$count = count($options);
|
||||
if(!$count || ($count == 1 && !reset($options)->cid))
|
||||
{
|
||||
// Return a hidden field in order to avoid JavaScript errors
|
||||
return '<input type="hidden" name="'.$cname.'"'.($idtag ? ' id="'.$idtag.'"' : '').' value="" />
|
||||
<input type="text" readonly="readonly" class="readonly" value="-" />';
|
||||
}
|
||||
|
||||
// Sort the array with key pathname if more than one element
|
||||
if($count > 1)
|
||||
{
|
||||
//usort($options, array('JHTMLJoomSelect', 'sortCatArray'));
|
||||
}
|
||||
|
||||
$output = JHTML::_('select.genericlist', $options, $cname, $attribs, 'cid', 'path', $currentcat, $idtag);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct HTML list of users
|
||||
*
|
||||
* @param string $name Name of the HTML select list to use
|
||||
* @param array $active Array of selected users
|
||||
* @param boolean $nouser True, if 'No user' should be included on top of the list
|
||||
* @param array $additional Additional entries to add
|
||||
* @param string $javascript Additional code in the select list
|
||||
* @param int $multiple Size of the box if it shall be a multiple select box, 0 otherwise
|
||||
* @param mixed $idtag String to use as id tag for the select box
|
||||
* @return string The HTML output
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public static function users($name, $active, $nouser = false, $additional = array(), $javascript = null, $multiple = 6, $idtag = false)
|
||||
{
|
||||
static $users = null;
|
||||
|
||||
$config = JoomConfig::getInstance();
|
||||
|
||||
if(is_null($users))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
$type = $config->get('jg_realname') ? 'name' : 'username';
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->select('COUNT(id)')
|
||||
->from('#__users')
|
||||
->where('block = 0');
|
||||
$db->setQuery($query);
|
||||
|
||||
self::$count = $db->loadResult();
|
||||
|
||||
if(self::$count <= $config->get('jg_use_listbox_max_user_count') || !$multiple)
|
||||
{
|
||||
$users = array();
|
||||
|
||||
$query->clear()
|
||||
->select('id AS value')
|
||||
->select($type.' AS text')
|
||||
->from('#__users')
|
||||
->where('block = 0')
|
||||
->order($type.' ASC');
|
||||
$db->setQuery($query);
|
||||
|
||||
$users = $db->loadObjectList();
|
||||
}
|
||||
}
|
||||
|
||||
if(self::$count > $config->get('jg_use_listbox_max_user_count') && $multiple)
|
||||
{
|
||||
return '<input type="text" name="'.$name.'" value="'.implode(',', $active).'" class="inputbox"'.($idtag ? ' id="'.$idtag.'"' : '').'/>';
|
||||
}
|
||||
|
||||
$options = array();
|
||||
|
||||
foreach($additional as $key => $value)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $key, $value);
|
||||
}
|
||||
|
||||
if($nouser)
|
||||
{
|
||||
if(JFactory::getApplication()->isSite())
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '0', JText::_('COM_JOOMGALLERY_DETAIL_NAMETAGS_SELECT_USER'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '0', JText::_('COM_JOOMGALLERY_COMMON_NO_USER'));
|
||||
}
|
||||
}
|
||||
|
||||
$options = array_merge($options, $users);
|
||||
|
||||
$multiple_box = '';
|
||||
if($multiple > 1)
|
||||
{
|
||||
$multiple_box = ' multiple="multiple" size="'.$multiple.'"';
|
||||
}
|
||||
|
||||
if($javascript)
|
||||
{
|
||||
$javascript = ' onchange="'.$javascript.'"';
|
||||
}
|
||||
|
||||
return JHtml::_('select.genericlist', $options, $name, 'class="inputbox"'.$multiple_box.$javascript, 'value', 'text', $active, $idtag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function for sorting an array of objects to assembled names of
|
||||
* categories with alle parent categories
|
||||
*
|
||||
* @param object $a Element one
|
||||
* @param object $b Element two
|
||||
* @return int 0 if names equal, -1 if a < b, 1 if a > b
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function sortCatArray($a, $b)
|
||||
{
|
||||
return strcmp($a->path, $b->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a HMTL select list of OpenImage options
|
||||
*
|
||||
* @param string $name Name of the field
|
||||
* @param string $selected Option that should be preselected.
|
||||
* @param boolean $detail True, if the default detail view shall be an available option, defaults to true
|
||||
* @param boolean $default True, if the 'like in JoomGallery configured' shall be an available option, defaults to false
|
||||
* @param string $lang_prefix Prefix for the language constants of the options, defaults to 'COM_JOOMGALLERY_CONFIG_CV_GS_OPEN'
|
||||
* @param string $attr Optional attributes for the HTML element
|
||||
* @param array $extra Array of additional options for the select list
|
||||
* @return string The HTML select list of OpenImage options
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function openImage($name, $selected = null, $detail = true, $default = false, $lang_prefix = 'COM_JOOMGALLERY_CONFIG_CV_GS_OPEN_', $attr = null, $extra = array())
|
||||
{
|
||||
// Additional options are placed first in the list
|
||||
$options = $extra;
|
||||
|
||||
if($default)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', 'default', JText::_($lang_prefix.'LIKE_IN_JOOMGALLERY'));
|
||||
}
|
||||
|
||||
if($detail)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '0', JText::_($lang_prefix.'DEFAULT'));
|
||||
}
|
||||
|
||||
$options[] = JHtml::_('select.option', '1', JText::_($lang_prefix.'BLANK_WINDOW'));
|
||||
$options[] = JHtml::_('select.option', '2', JText::_($lang_prefix.'JS_WINDOW'));
|
||||
$options[] = JHtml::_('select.option', '3', JText::_($lang_prefix.'DHTML'));
|
||||
#$options[] = JHtml::_('select.option', '4', JText::_('COM_JOOMGALLERY_MODAL'));
|
||||
$options[] = JHtml::_('select.option', '5', JText::_($lang_prefix.'THICKBOX3'));
|
||||
$options[] = JHtml::_('select.option', '6', JText::_($lang_prefix.'SLIMBOX'));
|
||||
|
||||
// Load plugins in order to search for additional OpenImage plugins
|
||||
JPluginHelper::importPlugin('joomgallery');
|
||||
$plugins = JDispatcher::getInstance()->trigger('onJoomOpenImageGetName');
|
||||
|
||||
foreach($plugins as $plugin)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $plugin);
|
||||
}
|
||||
|
||||
if(!$attr)
|
||||
{
|
||||
$attr = 'class="inputbox" size="'.count($options).'"';
|
||||
}
|
||||
|
||||
return JHtml::_('select.genericlist', $options, $name, $attr, 'value', 'text', $selected);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/openimageplugin.php $
|
||||
// $Id: openimageplugin.php 4067 2013-02-07 22:25:32Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
jimport('joomla.plugin.plugin');
|
||||
|
||||
/**
|
||||
* JoomGallery helper class for OpenImage plugins
|
||||
*
|
||||
* Open image plugins can extend this class, so that they only have to set the 'title'
|
||||
* property and to implement the simple methods 'init()' and 'getLinkAttributes()'.
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class JoomOpenImagePlugin extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Name of this popup box
|
||||
*
|
||||
* @var string
|
||||
* @since 3.0
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Initializes the box by adding all necessary JavaScript and CSS files.
|
||||
* This is done only once per page load.
|
||||
*
|
||||
* Please use the document object of Joomla! to add JavaScript and CSS files, e.g.:
|
||||
* <code>
|
||||
* $doc = JFactory::getDocument();
|
||||
* $doc->addStyleSheet(JUri::root().'media/plg_exampleopenimage/css/exampleopenimage.css');
|
||||
* $doc->addScript(JUri::root().'media/plg_exampleopenimage/js/exampleopenimage.js');
|
||||
* $doc->addScriptDeclaration(" jQuery(document).ready(function(){ExampleOpenImage.init()}");
|
||||
* </code>
|
||||
*
|
||||
* or if using Mootools or jQuery the respective JHtml method:
|
||||
* <code>
|
||||
* JHtml::_('jquery.framework');
|
||||
* JHtml::_('behavior.framework');
|
||||
* </code>
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract protected function init();
|
||||
|
||||
/**
|
||||
* OnJoomOpenImage method
|
||||
*
|
||||
* Method is called when an image of JoomGallery shall be opened.
|
||||
* It modifies the given link in order to use the respective box for opening the image.
|
||||
*
|
||||
* @access public
|
||||
* @param string $link The link to modify
|
||||
* @param object $image An object holding the image data
|
||||
* @param string $img_url The URL to the image which shall be openend
|
||||
* @param string $group The name of an image group, most boxes will make an album out of the images of a group
|
||||
* @param string $type 'orig' for original image, 'img' for detail image or 'thumb' for thumbnail
|
||||
* @param string $selected If a specific box was selected it will be delivered in this argument
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
public function onJoomOpenImage(&$link, $image = null, $img_url = null, $group = 'joomgallery', $type = 'orig', $selected = null)
|
||||
{
|
||||
if(!$image)
|
||||
{
|
||||
// Let JoomGallery know that this plugin is enabled (this is for backwards compatibility only)
|
||||
$link = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if($selected && $selected != $this->title)
|
||||
{
|
||||
// If an OpenImage plugin was selected but not this one we don't do anything here
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that the necessary assets are loaded once (if necessary)
|
||||
static $loaded = false;
|
||||
if(!$loaded && !$this->params->get('global_box_existent'))
|
||||
{
|
||||
$this->init();
|
||||
$loaded = true;
|
||||
}
|
||||
|
||||
// Get all the attributes for the link tag
|
||||
$attribs = array('href' => $img_url);
|
||||
$this->getLinkAttributes($attribs, $image, $img_url, $group, $type);
|
||||
|
||||
$href = $img_url;
|
||||
if(isset($attribs['href']))
|
||||
{
|
||||
$href = $attribs['href'];
|
||||
unset($attribs['href']);
|
||||
}
|
||||
|
||||
if(!count($attribs))
|
||||
{
|
||||
$link = $href;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$attribs = JArrayHelper::toString($attribs);
|
||||
|
||||
// Remove the last quotation marks and create the tag
|
||||
$link = $href.'" '.substr($attribs, 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should set an associative array of attributes for the 'a'-Tag (key/value pairs) which opens the image.
|
||||
*
|
||||
* <code>
|
||||
* $attribs['data-rel'] = 'examplebox';
|
||||
* $attribs['data-group'] = $group;
|
||||
* </code>
|
||||
*
|
||||
* The example above will create a link tag like that: <a href="<image URL>" data-rel="examplebox" group="<image group>" ... >
|
||||
*
|
||||
* ($attribs is passed by references and should only be filled)
|
||||
*
|
||||
* By default the attribute 'href' is filled with the URL to the image which shall be opened. You only have to set that
|
||||
* attribute if you want to change that (the image URL is passed in the third argument of this method).
|
||||
*
|
||||
* NOTE!!!: You are not allowed to set the attributes 'title' and 'class' because these are handled internally by JoomGallery.
|
||||
*
|
||||
* @param array $attribs Associative array of HTML attributes which you have to fill
|
||||
* @param object $image An object holding all the relevant data about the image to open
|
||||
* @param string $img_url The URL to the image which shall be openend
|
||||
* @param string $group The name of an image group, most popup boxes are able to group the images with that
|
||||
* @param string $type 'orig' for original image, 'img' for detail image or 'thumb' for thumbnail
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract protected function getLinkAttributes(&$attribs, $image, $img_url, $group, $type);
|
||||
|
||||
/**
|
||||
* onJoomOpenImageGetName method
|
||||
*
|
||||
* Method is called if the popup box name is requested used by this plugin
|
||||
*
|
||||
* @return string The name of the popup box used by this plugin
|
||||
* @since 3.0
|
||||
*/
|
||||
public function onJoomOpenImageGetName()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,343 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/pagination.php $
|
||||
// $Id: pagination.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
jimport('joomla.html.pagination');
|
||||
|
||||
/**
|
||||
* Pagination Class. Provides a common interface for content pagination
|
||||
* for JoomGallery (extends the pagination class of Joomla!)
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JoomPagination extends JPagination
|
||||
{
|
||||
/**
|
||||
* Holds the anchor for URLs if it is enabled
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $anchortag;
|
||||
|
||||
/**
|
||||
* Holds the 'onlick' attribute if there is one given
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $onclick;
|
||||
|
||||
/**
|
||||
* Internal cache for the data object
|
||||
*
|
||||
* @var object
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $store;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $total The total number of items
|
||||
* @param int $limitstart The offset of the item to start at
|
||||
* @param int $limit The number of items to display per page
|
||||
* @param string $prefix The prefix used for request variables
|
||||
* @param string $anchortag The anchor to use for the URLs
|
||||
* @param string $onclick The contents of an optional 'onlick' attribute
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function __construct($total, $limitstart, $limit, $prefix = '', $anchortag = 'category', $onclick = null)
|
||||
{
|
||||
parent::__construct($total, $limitstart, $limit, $prefix);
|
||||
|
||||
$this->anchortag = '';
|
||||
if($anchortag)
|
||||
{
|
||||
$this->anchortag = JHtml::_('joomgallery.anchor', $anchortag);
|
||||
}
|
||||
|
||||
if($onclick)
|
||||
{
|
||||
$this->onclick = '" onclick="'.$onclick;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return the pagination data object
|
||||
*
|
||||
* @return object Pagination data object
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function _buildDataObject()
|
||||
{
|
||||
// Check whether the data object was already created
|
||||
if(!empty($this->store))
|
||||
{
|
||||
return $this->store;
|
||||
}
|
||||
|
||||
// Initialise variables
|
||||
$data = new stdClass;
|
||||
$currentPage = $this->get('pages.current');
|
||||
$pageCount = $this->get('pages.total');
|
||||
|
||||
// Build the additional URL parameters string
|
||||
$params = '';
|
||||
if(!empty($this->additionalUrlParams))
|
||||
{
|
||||
foreach($this->additionalUrlParams as $key => $value)
|
||||
{
|
||||
$params .= '&'.$key.'='.$value;
|
||||
}
|
||||
}
|
||||
|
||||
$data->all = new JPaginationObject(JText::_('JLIB_HTML_VIEW_ALL'), $this->prefix);
|
||||
if(!$this->viewall)
|
||||
{
|
||||
$data->all->base = '0';
|
||||
$data->all->link = JRoute::_($params.'&'.$this->prefix.'limitstart=');
|
||||
}
|
||||
|
||||
// Set the start and previous data objects
|
||||
$data->start = new JPaginationObject(JText::_('JLIB_HTML_START'), $this->prefix);
|
||||
$data->previous = new JPaginationObject(JText::_('JPREV'), $this->prefix);
|
||||
|
||||
if($currentPage > 1)
|
||||
{
|
||||
$previous = $currentPage - 1;
|
||||
|
||||
$data->start->base = 1;
|
||||
$data->start->link = JRoute::_($params.'&'.$this->prefix.'page=1').$this->anchortag.sprintf($this->onclick, 1);
|
||||
$data->previous->base = $previous;
|
||||
$data->previous->link = JRoute::_($params.'&'.$this->prefix.'page='.$previous).$this->anchortag.sprintf($this->onclick, $previous);
|
||||
}
|
||||
|
||||
// Set the next and end data objects
|
||||
$data->next = new JPaginationObject(JText::_('JNEXT'), $this->prefix);
|
||||
$data->end = new JPaginationObject(JText::_('JLIB_HTML_END'), $this->prefix);
|
||||
|
||||
if($currentPage < $pageCount)
|
||||
{
|
||||
$next = $currentPage + 1;
|
||||
|
||||
$data->next->base = $next;
|
||||
$data->next->link = JRoute::_($params.'&'.$this->prefix.'page='.$next).$this->anchortag.sprintf($this->onclick, $next);
|
||||
$data->end->base = $pageCount;
|
||||
$data->end->link = JRoute::_($params.'&'.$this->prefix.'page='.$pageCount).$this->anchortag.sprintf($this->onclick, $pageCount);
|
||||
}
|
||||
|
||||
$data->pages = array();
|
||||
|
||||
$workPage = 2;
|
||||
$placeHolderKey = $pageCount;
|
||||
|
||||
// Variable for current page found and assembled
|
||||
$currItemfound = false;
|
||||
|
||||
// Work on left edge
|
||||
if($currentPage == 1)
|
||||
{
|
||||
$currItemfound = true;
|
||||
$data->pages[1] = new JPaginationObject(1, $this->prefix);
|
||||
$data->pages[1]->base = null;
|
||||
$data->pages[1]->link = JRoute::_($params.'&'.$this->prefix.'page=1').$this->anchortag.sprintf($this->onclick, 1);
|
||||
$data->pages[2] = new JPaginationObject(2, $this->prefix);
|
||||
$data->pages[2]->base = 2;
|
||||
$data->pages[2]->link = JRoute::_($params.'&'.$this->prefix.'page=2').$this->anchortag.sprintf($this->onclick, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Current page not 1
|
||||
$data->pages[1] = new JPaginationObject(1, $this->prefix);
|
||||
$data->pages[1]->base = 1;
|
||||
$data->pages[1]->link = JRoute::_($params.'&'.$this->prefix.'page=1').$this->anchortag.sprintf($this->onclick, 1);
|
||||
|
||||
if($currentPage == 2)
|
||||
{
|
||||
$currItemfound = true;
|
||||
$data->pages[2] = new JPaginationObject(2, $this->prefix);
|
||||
$data->pages[2]->base = null;
|
||||
$data->pages[2]->link = JRoute::_($params.'&'.$this->prefix.'page=2').$this->anchortag.sprintf($this->onclick, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data->pages[2] = new JPaginationObject(2, $this->prefix);
|
||||
$data->pages[2]->base = 2;
|
||||
$data->pages[2]->link = JRoute::_($params.'&'.$this->prefix.'page=2').$this->anchortag.sprintf($this->onclick, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Range left from current page to 1 not assembled yet
|
||||
if(!$currItemfound)
|
||||
{
|
||||
// Construct pages left to current page
|
||||
// according to difference to left implement jumps
|
||||
// If difference to current page too low, output them exactly
|
||||
if($currentPage - $workPage < 6)
|
||||
{
|
||||
$workPage++;
|
||||
for($i = $workPage; $i < $currentPage; $i++)
|
||||
{
|
||||
$data->pages[$i] = new JPaginationObject($i, $this->prefix);
|
||||
$data->pages[$i]->base = $i;
|
||||
$data->pages[$i]->link = JRoute::_($params.'&'.$this->prefix.'page='.$i).$this->anchortag.sprintf($this->onclick, $i);
|
||||
$workPage++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise output of remaining links evt. in steps
|
||||
// and in addition output of 2 left neighbours
|
||||
// completion of range at position 3 to (current page - 3)
|
||||
$endRange = $currentPage - 3;
|
||||
$jump = ceil(($endRange - 5) / 4);
|
||||
if($jump == 0)
|
||||
{
|
||||
$jump = 1;
|
||||
}
|
||||
|
||||
$workPage = $workPage + $jump;
|
||||
for($i = 1; $i < 4; $i++)
|
||||
{
|
||||
if($jump != 1)
|
||||
{
|
||||
$placeHolderKey++;
|
||||
$data->pages[$placeHolderKey] = new JPaginationObject(JText::_('COM_JOOMGALLERY_COMMON_PAGENAVIGATION_ELLIPSIS'), $this->prefix);
|
||||
$data->pages[$placeHolderKey]->base = null;
|
||||
}
|
||||
|
||||
$data->pages[$workPage] = new JPaginationObject($workPage, $this->prefix);
|
||||
$data->pages[$workPage]->base = $workPage;
|
||||
$data->pages[$workPage]->link = JRoute::_($params.'&'.$this->prefix.'page='.$workPage).$this->anchortag.sprintf($this->onclick, $workPage);
|
||||
$workPage = $workPage + $jump;
|
||||
}
|
||||
|
||||
if($workPage != ($currentPage - 2))
|
||||
{
|
||||
$placeHolderKey++;
|
||||
$data->pages[$placeHolderKey] = new JPaginationObject(JText::_('COM_JOOMGALLERY_COMMON_PAGENAVIGATION_ELLIPSIS'), $this->prefix);
|
||||
$data->pages[$placeHolderKey]->base = null;
|
||||
}
|
||||
// Output of 2 pages left beside current page
|
||||
$data->pages[$currentPage - 2] = new JPaginationObject($currentPage - 2, $this->prefix);
|
||||
$data->pages[$currentPage - 2]->base = $currentPage - 2;
|
||||
$data->pages[$currentPage - 2]->link = JRoute::_($params.'&'.$this->prefix.'page='.($currentPage - 2)).$this->anchortag.sprintf($this->onclick, $currentPage - 2);
|
||||
$data->pages[$currentPage - 1] = new JPaginationObject($currentPage - 1, $this->prefix);
|
||||
$data->pages[$currentPage - 1]->base = $currentPage - 1;
|
||||
$data->pages[$currentPage - 1]->link = JRoute::_($params.'&'.$this->prefix.'page='.($currentPage - 1)).$this->anchortag.sprintf($this->onclick, $currentPage - 1);
|
||||
}
|
||||
|
||||
// Current page
|
||||
$data->pages[$currentPage] = new JPaginationObject($currentPage, $this->prefix);
|
||||
$data->pages[$currentPage]->base = null;
|
||||
$data->pages[$currentPage]->link = JRoute::_($params.'&'.$this->prefix.'page='.$currentPage).$this->anchortag.sprintf($this->onclick, $currentPage);
|
||||
$currItemfound = true;
|
||||
$workPage = $currentPage;
|
||||
}
|
||||
|
||||
// Current page found, right beside construct 2 pages
|
||||
// max to end
|
||||
if($pageCount - $workPage < 3)
|
||||
{
|
||||
$endRangecount = $pageCount - $workPage;
|
||||
}
|
||||
else
|
||||
{
|
||||
$endRangecount = 2;
|
||||
}
|
||||
|
||||
$workPage++;
|
||||
for($i = 1; $i <= $endRangecount; $i++)
|
||||
{
|
||||
$data->pages[$workPage] = new JPaginationObject($workPage, $this->prefix);
|
||||
$data->pages[$workPage]->base = $workPage;
|
||||
$data->pages[$workPage]->link = JRoute::_($params.'&'.$this->prefix.'page='.$workPage).$this->anchortag.sprintf($this->onclick, $workPage);
|
||||
$workPage++;
|
||||
}
|
||||
|
||||
if($workPage == $pageCount)
|
||||
{
|
||||
$data->pages[$workPage] = new JPaginationObject($workPage, $this->prefix);
|
||||
$data->pages[$workPage]->base = $workPage;
|
||||
$data->pages[$workPage]->link = JRoute::_($params.'&'.$this->prefix.'page='.$workPage).$this->anchortag.sprintf($this->onclick, $workPage);
|
||||
|
||||
$this->store = $data;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// All ready
|
||||
if($workPage > $pageCount)
|
||||
{
|
||||
$this->store = $data;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// If only 3 pages to end remain
|
||||
if($workPage < $pageCount && ($pageCount - $workPage) < 7)
|
||||
{
|
||||
for($i = $workPage; $i <= $pageCount; $i++)
|
||||
{
|
||||
$data->pages[$workPage] = new JPaginationObject($workPage, $this->prefix);
|
||||
$data->pages[$workPage]->base = $workPage;
|
||||
$data->pages[$workPage]->link = JRoute::_($params.'&'.$this->prefix.'page='.$workPage).$this->anchortag.sprintf($this->onclick, $workPage);
|
||||
$workPage++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Output of remaining pages in steps
|
||||
// and in addition output of last page and the neighbour left
|
||||
// Complete the range (current page + 3) to (last page - 3)
|
||||
$startRange = $workPage;
|
||||
$endRange = $pageCount - 3;
|
||||
$jump = ceil(($endRange - $startRange) / 4);
|
||||
$workPage = $workPage + $jump;
|
||||
for($i = 1; $i < 4; $i++)
|
||||
{
|
||||
if($jump != 1)
|
||||
{
|
||||
$placeHolderKey++;
|
||||
$data->pages[$placeHolderKey] = new JPaginationObject(JText::_('COM_JOOMGALLERY_COMMON_PAGENAVIGATION_ELLIPSIS'), $this->prefix);
|
||||
$data->pages[$placeHolderKey]->base = null;
|
||||
}
|
||||
|
||||
$data->pages[$workPage] = new JPaginationObject($workPage, $this->prefix);
|
||||
$data->pages[$workPage]->base = $workPage;
|
||||
$data->pages[$workPage]->link = JRoute::_($params.'&'.$this->prefix.'page='.$workPage).$this->anchortag.sprintf($this->onclick, $workPage);
|
||||
$workPage = $workPage + $jump;
|
||||
}
|
||||
|
||||
$placeHolderKey++;
|
||||
$data->pages[$placeHolderKey] = new JPaginationObject(JText::_('COM_JOOMGALLERY_COMMON_PAGENAVIGATION_ELLIPSIS'), $this->prefix);
|
||||
$data->pages[$placeHolderKey]->base = null;
|
||||
|
||||
// Output of penultimate and last
|
||||
$data->pages[$pageCount - 1] = new JPaginationObject($pageCount - 1, $this->prefix);
|
||||
$data->pages[$pageCount - 1]->base = $pageCount - 1;
|
||||
$data->pages[$pageCount - 1]->link = JRoute::_($params.'&'.$this->prefix.'page='.($pageCount - 1)).$this->anchortag.sprintf($this->onclick, $pageCount - 1);
|
||||
$data->pages[$pageCount] = new JPaginationObject($pageCount, $this->prefix);
|
||||
$data->pages[$pageCount]->base = $pageCount;
|
||||
$data->pages[$pageCount]->link = JRoute::_($params.'&'.$this->prefix.'page='.$pageCount).$this->anchortag.sprintf($this->onclick, $pageCount);
|
||||
}
|
||||
|
||||
$this->store = $data;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,362 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/helpers/refresher.php $
|
||||
// $Id: refresher.php 4290 2013-05-29 00:02:48Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Helper class which handles refreshes afore script timeouts
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomRefresher extends JObject
|
||||
{
|
||||
/**
|
||||
* Unix timestamp of start time
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_starttime;
|
||||
|
||||
/**
|
||||
* Maximum time for execution in seconds
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_maxtime;
|
||||
|
||||
/**
|
||||
* JApplication object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $_mainframe;
|
||||
|
||||
/**
|
||||
* Controller which will be included
|
||||
* into the URL for redirection by default
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_controller;
|
||||
|
||||
/**
|
||||
* Task which will be included into
|
||||
* the URL for redirection by default
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_task;
|
||||
|
||||
/**
|
||||
* Determines whether a message should
|
||||
* be displayed for each redirect by default
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_msg;
|
||||
|
||||
/**
|
||||
* Holds the number of remaining things to do
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_remaining;
|
||||
|
||||
/**
|
||||
* Holds the total number of things to do
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_total;
|
||||
|
||||
/**
|
||||
* Determines whether the progress bar should be displayed
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_showprogress;
|
||||
|
||||
/**
|
||||
* Holds the name or a short description of the current task
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $params An array with optional parameters
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function __construct($params = array())
|
||||
{
|
||||
$this->_mainframe = JFactory::getApplication('administrator');
|
||||
|
||||
if(isset($params['controller']))
|
||||
{
|
||||
$this->_controller = $params['controller'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_controller = JRequest::getCmd('controller');
|
||||
}
|
||||
|
||||
if(isset($params['task']))
|
||||
{
|
||||
$this->_task = $params['task'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_task = JRequest::getCmd('task');
|
||||
}
|
||||
|
||||
if(isset($params['msg']))
|
||||
{
|
||||
$this->_msg = $params['msg'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_msg = false;
|
||||
}
|
||||
|
||||
if(isset($params['remaining']))
|
||||
{
|
||||
$this->_remaining = $params['remaining'];
|
||||
|
||||
if(isset($params['start']) && $params['start'])
|
||||
{
|
||||
$this->_total = $params['remaining'];
|
||||
$this->_mainframe->setUserState('joom.refresher.total', $this->_total);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_total = $this->_mainframe->getUserState('joom.refresher.total');
|
||||
}
|
||||
|
||||
$this->_showprogress = $this->_total ? true : false;
|
||||
}
|
||||
|
||||
if(isset($params['name']) && $params['name'])
|
||||
{
|
||||
$this->_name = $params['name'];
|
||||
}
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the refresher by storing current time
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
// Check the maximum execution time of the script
|
||||
$max_execution_time = @ini_get('max_execution_time');
|
||||
|
||||
// Set secure setting of the real execution time
|
||||
// Maximum time for the script will be set to 20 seconds
|
||||
// (max_exection_time = 0 means no limit)
|
||||
if($max_execution_time < 25 && $max_execution_time != 0)
|
||||
{
|
||||
$this->_maxtime = (int) $max_execution_time * 0.8;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_maxtime = 20;
|
||||
}
|
||||
|
||||
$this->_starttime = time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the calculated maximum execution time
|
||||
*
|
||||
* @return int The calculated maximum execution time
|
||||
* @since 3.2
|
||||
*/
|
||||
public function getMaxTime()
|
||||
{
|
||||
return $this->_maxtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the progressbar or the name of the current task
|
||||
*
|
||||
* @param int $remaining Number of remaining steps
|
||||
* @param boolean $start Determines whether $remaining holds the total number of steps
|
||||
* @param string $name Name of the task to display
|
||||
* @return void
|
||||
* @since 1.5.6
|
||||
*/
|
||||
public function reset($remaining = null, $start = null, $name = null)
|
||||
{
|
||||
if(!is_null($remaining))
|
||||
{
|
||||
$this->_remaining = $remaining;
|
||||
|
||||
if(!is_null($start) && $start)
|
||||
{
|
||||
$this->_total = $remaining;
|
||||
$this->_mainframe->setUserState('joom.refresher.total', $this->_total);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_total = $this->_mainframe->getUserState('joom.refresher.total');
|
||||
}
|
||||
|
||||
$this->_showprogress = $this->_total ? true : false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_showprogress = false;
|
||||
}
|
||||
|
||||
if(!is_null($name) && $name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the remaining time
|
||||
*
|
||||
* @return boolean True: Time remains, false: No more time left
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$timeleft = -(time() - $this->_starttime - $this->_maxtime);
|
||||
if($timeleft > 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a redirect
|
||||
*
|
||||
* @param int $remaining Number of remaining steps
|
||||
* @param string $task The task which will be called after the redirect
|
||||
* @param string $msg An optional message which will be enqueued (this is currently disabled)
|
||||
* @param string $type Type of the message (one of 'message', 'notice', 'error')
|
||||
* @param string $controller The controller which will be called after the redirect
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function refresh($remaining = null, $task = null, $msg = null, $type = null, $controller = null)
|
||||
{
|
||||
if($remaining)
|
||||
{
|
||||
$this->_remaining = $remaining;
|
||||
}
|
||||
|
||||
if($this->_msg && is_null($task))
|
||||
{
|
||||
$this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_COMMON_REDIRECT'));
|
||||
}
|
||||
if(!$task)
|
||||
{
|
||||
$task = $this->_task;
|
||||
}
|
||||
if(!$controller)
|
||||
{
|
||||
$controller = $this->_controller;
|
||||
}
|
||||
|
||||
if($msg)
|
||||
{
|
||||
$this->_mainframe->enqueueMessage($msg, $type);
|
||||
}
|
||||
|
||||
if(!$this->_msg || $msg)
|
||||
{
|
||||
// Persist messages if they exist
|
||||
$messages = $this->_mainframe->getMessageQueue();
|
||||
if(count($messages))
|
||||
{
|
||||
$session = JFactory::getSession();
|
||||
$session->set('application.queue', $messages);
|
||||
}
|
||||
}
|
||||
|
||||
$url = 'index.php?option='._JOOM_OPTION.'&controller='.$controller.'&task='.$task;
|
||||
$onclick = 'document.location.href=\''.$url.'\';';
|
||||
|
||||
$buffer = '';
|
||||
if($buffer = ob_get_contents())
|
||||
{
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
echo '<?xml version="1.0" encoding="utf-8"?'.'>'; ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<!--<link rel="stylesheet" href="<?php echo JoomAmbit::getInstance()->getStyleSheet('admin.joomgallery.css'); ?>" type="text/css" />
|
||||
<link href="templates/<?php echo $this->_mainframe->getTemplate(); ?>/css/template.css" rel="stylesheet" type="text/css" />-->
|
||||
<link href="<?php echo JUri::root(); ?>media/jui/css/bootstrap.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php echo JUri::root(); ?>media/jui/css/bootstrap-extended.css" rel="stylesheet" type="text/css" />
|
||||
<?php if(JFactory::getLanguage()->isRTL()): ?>
|
||||
<link href="<?php echo JUri::root(); ?>media/jui/css/bootstrap-rtl.css" rel="stylesheet" type="text/css" />
|
||||
<?php endif; ?>
|
||||
<style type="text/css">
|
||||
body{
|
||||
margin-top:30px;
|
||||
}
|
||||
<?php if($this->_showprogress): ?>
|
||||
.bar{
|
||||
width:<?php echo floor((($this->_total - $this->_remaining) / $this->_total) * 100); ?>% !important;
|
||||
}
|
||||
<?php endif; ?>
|
||||
</style>
|
||||
<title><?php echo JText::_('COM_JOOMGALLERY_COMMON_REFRESHER_IN_PROGRESS'); ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="row-fluid">
|
||||
<div class="offset2 span8 well">
|
||||
<div class="alert alert-info">
|
||||
<?php echo JText::_('COM_JOOMGALLERY_COMMON_REFRESHER_PLEASE_WAIT'); ?>
|
||||
<?php if($this->_name): ?>
|
||||
<br />
|
||||
<?php echo JText::sprintf('COM_JOOMGALLERY_COMMON_REFRESHER_CURRENT_TASK', '<span style="color:green;">'.$this->_name.'</span>'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<p class="center"><img src="<?php echo JUri::root(); ?>media/system/images/modal/spinner.gif" alt="Spinner" width="16" height="16" /></p>
|
||||
<?php if($this->_showprogress): ?>
|
||||
<div class="progress progress-striped active" title="<?php echo JText::sprintf('COM_JOOMGALLERY_COMMON_REFRESHER_PROGRESSBAR', $this->_maxtime); ?>">
|
||||
<div class="bar"></div>
|
||||
</div>
|
||||
<div class="small muted center"><?php echo JText::sprintf('COM_JOOMGALLERY_COMMON_REFRESHER_PROGRESSBAR', $this->_maxtime); ?></div>
|
||||
<?php endif;
|
||||
if($this->_msg):
|
||||
$doc = JFactory::getDocument();
|
||||
$renderer = $doc->loadRenderer('message');
|
||||
echo $renderer->render('');
|
||||
endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div><?php echo $buffer; ?></div>
|
||||
<script type="text/javascript"><?php echo $onclick; ?></script>
|
||||
</body>
|
||||
</html><?php
|
||||
$this->_mainframe->close();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/includes/defines.php $
|
||||
// $Id: defines.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
define('_JOOM_OPTION', 'com_joomgallery');
|
||||
define('_JOOM_TABLE_IMAGE_DETAILS', '#__joomgallery_image_details');
|
||||
define('_JOOM_TABLE_IMAGES', '#__joomgallery');
|
||||
define('_JOOM_TABLE_CATEGORIES', '#__joomgallery_catg');
|
||||
define('_JOOM_TABLE_CATEGORY_DETAILS', '#__joomgallery_category_details');
|
||||
define('_JOOM_TABLE_COMMENTS', '#__joomgallery_comments');
|
||||
define('_JOOM_TABLE_CONFIG', '#__joomgallery_config');
|
||||
define('_JOOM_TABLE_COUNTSTOP', '#__joomgallery_countstop');
|
||||
define('_JOOM_TABLE_MAINTENANCE', '#__joomgallery_maintenance');
|
||||
define('_JOOM_TABLE_NAMESHIELDS', '#__joomgallery_nameshields');
|
||||
define('_JOOM_TABLE_ORPHANS', '#__joomgallery_orphans');
|
||||
define('_JOOM_TABLE_USERS', '#__joomgallery_users');
|
||||
define('_JOOM_TABLE_VOTES', '#__joomgallery_votes');
|
||||
@ -0,0 +1,647 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/includes/exifarray.php $
|
||||
// $Id: exifarray.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
$exif_config_array = array
|
||||
(
|
||||
"IFD0" => array
|
||||
(
|
||||
270 => array( 'Attribute' => "ImageDescription",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_IMAGEDESCRIPTION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_IMAGEDESCRIPTION_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
271 => array( 'Attribute' => "Make",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_MAKE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_MAKE_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
272 => array( 'Attribute' => "Model",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_MODEL'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_MODEL_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
274 => array( 'Attribute' => "Orientation",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
1 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_3'),
|
||||
4 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_4'),
|
||||
5 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_5'),
|
||||
6 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_6'),
|
||||
7 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_7'),
|
||||
8 => JText::_('COM_JOOMGALLERY_IFD0_ORIENTATION_8')
|
||||
),
|
||||
282 => array( 'Attribute' => "XResolution",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_XRESOLUTION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_XRESOLUTION_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_IFD0_DOTSPERRESOLUTIONUNIT')
|
||||
),
|
||||
283 => array( 'Attribute' => "YResolution",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_YRESOLUTION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_YRESOLUTION_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_IFD0_DOTSPERRESOLUTIONUNIT')
|
||||
),
|
||||
296 => array( 'Attribute' => "ResolutionUnit",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_RESOLUTIONUNIT'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_RESOLUTIONUNIT_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
1 => JText::_('COM_JOOMGALLERY_IFD0_RESOLUTIONUNIT_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_IFD0_RESOLUTIONUNIT_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_IFD0_RESOLUTIONUNIT_3'),
|
||||
4 => JText::_('COM_JOOMGALLERY_IFD0_RESOLUTIONUNIT_4'),
|
||||
5 => JText::_('COM_JOOMGALLERY_IFD0_RESOLUTIONUNIT_5')
|
||||
),
|
||||
305 => array( 'Attribute' => "Software",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_SOFTWARE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_SOFTWARE_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
306 => array( 'Attribute' => "DateTime",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_DATETIME'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_DATETIME_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
318 => array( 'Attribute' => "WhitePoint",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_WHITEPOINT'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_WHITEPOINT_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
319 => array( 'Attribute' => "PrimaryChromaticities",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_PRIMARYCHROMATICITIES'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_PRIMARYCHROMATICITIES_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
529 => array( 'Attribute' => "YCbCrCoefficients",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_YCBCRCOEFFICIENTS'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_YCBCRCOEFFICIENTS_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
531 => array( 'Attribute' => "YCbCrPositioning",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_YCBCRPOSITIONING'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_YCBCRPOSITIONING_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
1 => JText::_('COM_JOOMGALLERY_IFD0_YCBCRPOSITIONING_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_IFD0_YCBCRPOSITIONING_2')
|
||||
),
|
||||
532 => array( 'Attribute' => "ReferenceBlackWhite",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_REFERENCEBLACKWHITE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_REFERENCEBLACKWHITE_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
315 => array( 'Attribute' => "Artist",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_ARTIST'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_ARTIST_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
33432 => array( 'Attribute' => "Copyright",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IFD0_COPYRIGHT'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IFD0_COPYRIGHT_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
),
|
||||
|
||||
'EXIF' => array
|
||||
(
|
||||
33434 => array( 'Attribute' => "ExposureTime",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSURETIME'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSURETIME_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SECONDS')
|
||||
),
|
||||
33437 => array( 'Attribute' => "FNumber",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FNUMBER'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FNUMBER_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
34850 => array( 'Attribute' => "ExposureProgram",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_3'),
|
||||
4 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_4'),
|
||||
5 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_5'),
|
||||
6 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_6'),
|
||||
7 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_7'),
|
||||
8 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREPROGRAM_8')
|
||||
),
|
||||
34855 => array( 'Attribute' => "ISOSpeedRatings",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_ISOSPEEDRATINGS'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_ISOSPEEDRATINGS_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => ""
|
||||
),
|
||||
36864 => array( 'Attribute' => "ExifVersion",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFVERSION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFVERSION_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Undefined",
|
||||
'Units' => ""
|
||||
),
|
||||
36867 => array( 'Attribute' => "DateTimeOriginal",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_DATETIMEORIGINAL'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_DATETIMEORIGINAL_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
36868 => array( 'Attribute' => "DateTimeDigitized",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_DATETIMEDIGITIZED'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_DATETIMEDIGITIZED_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
37121 => array( 'Attribute' => "ComponentsConfiguration",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_COMPONENTSCONFIGURATION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_COMPONENTSCONFIGURATION_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Undefined",
|
||||
'Units' => ""
|
||||
),
|
||||
37122 => array( 'Attribute' => "CompressedBitsPerPixel",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_COMPRESSEDBITSPERPIXEL'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_COMPRESSEDBITSPERPIXEL_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_COMPRESSEDBITSPERPIXEL_UNIT')
|
||||
),
|
||||
37377 => array( 'Attribute' => "ShutterSpeedValue",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SHUTTERSPEEDVALUE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SHUTTERSPEEDVALUE_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Signed Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_SHUTTERSPEEDVALUE_UNIT')
|
||||
),
|
||||
37378 => array( 'Attribute' => "ApertureValue",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_APERTUREVALUE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_APERTUREVALUE_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_APERTUREVALUE_UNIT')
|
||||
),
|
||||
37379 => array( 'Attribute' => "BrightnessValue",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_BRIGHTNESSVALUE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_BRIGHTNESSVALUE_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Signed Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_BRIGHTNESSVALUE_UNIT')
|
||||
),
|
||||
37380 => array( 'Attribute' => "ExposureBiasValue",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREBIASVALUE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREBIASVALUE_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Signed Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREBIASVALUE_UNIT')
|
||||
),
|
||||
37381 => array( 'Attribute' => "MaxApertureValue",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_MAXAPERTUREVALUE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_MAXAPERTUREVALUE_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_APERTUREVALUE_UNIT')
|
||||
),
|
||||
37382 => array( 'Attribute' => "SubjectDistance",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCE_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Signed Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCE_UNIT')
|
||||
),
|
||||
37383 => array( 'Attribute' => "MeteringMode",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_3'),
|
||||
4 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_4'),
|
||||
5 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_5'),
|
||||
6 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_6'),
|
||||
255 => JText::_('COM_JOOMGALLERY_SUBIFD_METERINGMODE_255')
|
||||
),
|
||||
37384 => array( 'Attribute' => "LightSource",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_3'),
|
||||
4 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_4'),
|
||||
9 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_9'),
|
||||
10 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_10'),
|
||||
11 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_11'),
|
||||
12 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_12'),
|
||||
13 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_13'),
|
||||
14 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_14'),
|
||||
15 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_15'),
|
||||
17 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_17'),
|
||||
18 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_18'),
|
||||
19 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_19'),
|
||||
20 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_20'),
|
||||
21 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_21'),
|
||||
22 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_22'),
|
||||
23 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_23'),
|
||||
24 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_24'),
|
||||
255 => JText::_('COM_JOOMGALLERY_SUBIFD_LIGHTSOURCE_255')
|
||||
),
|
||||
37385 => array( 'Attribute' => "Flash",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_1'),
|
||||
5 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_5'),
|
||||
7 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_7'),
|
||||
8 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_8'),
|
||||
9 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_9'),
|
||||
13 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_13'),
|
||||
15 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_15'),
|
||||
16 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_16'),
|
||||
20 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_20'),
|
||||
24 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_24'),
|
||||
25 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_25'),
|
||||
29 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_29'),
|
||||
31 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_31'),
|
||||
32 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_32'),
|
||||
48 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_48'),
|
||||
65 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_65'),
|
||||
69 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_69'),
|
||||
71 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_71'),
|
||||
73 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_73'),
|
||||
77 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_77'),
|
||||
79 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_79'),
|
||||
80 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_80'),
|
||||
88 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_88'),
|
||||
89 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_89'),
|
||||
93 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_93'),
|
||||
95 => JText::_('COM_JOOMGALLERY_SUBIFD_FLASH_95')
|
||||
),
|
||||
37386 => array( 'Attribute' => "FocalLength",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALLENGTH'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALLENGTH_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALLENGTH_UNIT')
|
||||
),
|
||||
// 37510 => array( 'Attribute' => "UserComment",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_USERCOMMENT'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_USERCOMMENT_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "Undefined",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
// 37520 => array( 'Attribute' => "SubsecTime",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBSECTIME'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBSECTIME_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "ASCII String",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
// 37521 => array( 'Attribute' => "SubsecTimeOriginal",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBSECTIMEORIGINAL'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBSECTIMEORIGINAL_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "ASCII String",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
// 37522 => array( 'Attribute' => "SubsecTimeDigitized",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBSECTIMEDIGITIZED'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBSECTIMEDIGITIZED_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "ASCII String",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
// 40960 => array( 'Attribute' => "FlashPixVersion",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FLASHPIXVERSION'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FLASHPIXVERSION_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "Undefined",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
40961 => array( 'Attribute' => "ColorSpace",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_COLORSPACE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_COLORSPACE_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_COLORSPACE_SRGB'),
|
||||
65535 => JText::_('COM_JOOMGALLERY_SUBIFD_COLORSPACE_65535')
|
||||
),
|
||||
40962 => array( 'Attribute' => "ExifImageWidth",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFIMAGEWIDTH'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFIMAGEWIDTH_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Short/Long",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFIMAGEWIDTHLENGTH_UNIT')
|
||||
),
|
||||
40963 => array( 'Attribute' => "ExifImageLength",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFIMAGELENGTH'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFIMAGELENGTH_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Short/Long",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFIMAGEWIDTHLENGTH_UNIT')
|
||||
),
|
||||
// 40964 => array( 'Attribute' => "RelatedSoundFile",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_RELATEDSOUNDFILE'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_RELATEDSOUNDFILE_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "ASCII String",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
// 40965 => array( 'Attribute' => "ExifInteroperabilityOffset",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFINTEROPERABILITYOFFSET'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXIFINTEROPERABILITYOFFSET_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "Unsigned Long",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
41486 => array( 'Attribute' => "FocalPlaneXResolution",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANEXRESOLUTION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANEXRESOLUTION_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANEXYRESOLUTION_UNIT')
|
||||
),
|
||||
41487 => array( 'Attribute' => "FocalPlaneYResolution",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANEYRESOLUTION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANEYRESOLUTION_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANEXYRESOLUTION_UNIT')
|
||||
),
|
||||
41488 => array( 'Attribute' => "FocalPlaneResolutionUnit",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANERESOLUTIONUNIT'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANERESOLUTIONUNIT_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANERESOLUTIONUNIT_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANERESOLUTIONUNIT_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALPLANERESOLUTIONUNIT_3')
|
||||
),
|
||||
41493 => array( 'Attribute' => "ExposureIndex",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREINDEX'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREINDEX_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
41495 => array( 'Attribute' => "SensingMethod",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_3'),
|
||||
4 => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_4'),
|
||||
5 => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_5'),
|
||||
7 => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_7'),
|
||||
8 => JText::_('COM_JOOMGALLERY_SUBIFD_SENSINGMETHOD_8')
|
||||
),
|
||||
41728 => array( 'Attribute' => "FileSource",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FILESOURCE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FILESOURCE_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Undefined",
|
||||
'Units' => "",
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_FILESOURCE_3')
|
||||
),
|
||||
41729 => array( 'Attribute' => "SceneType",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SCENETYPE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SCENETYPE_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Undefined",
|
||||
'Units' => "",
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_SCENETYPE_1')
|
||||
),
|
||||
41986 => array( 'Attribute' => "ExposureMode",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREMODE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREMODE_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREMODE_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREMODE_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_EXPOSUREMODE_2')
|
||||
),
|
||||
41987 => array( 'Attribute' => "WhiteBalance",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_WHITEBALANCE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_WHITEBALANCE_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_WHITEBALANCE_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_WHITEBALANCE_1')
|
||||
),
|
||||
41988 => array( 'Attribute' => "DigitalZoomRatio",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_DIGITALZOOMRATIO'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_DIGITALZOOMRATIO_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
41989 => array( 'Attribute' => "FocalLengthIn35mmFilm",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALLENGTHIN35MMFILM'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALLENGTHIN35MMFILM_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_SUBIFD_FOCALLENGTHIN35MMFILM_UNIT')
|
||||
),
|
||||
41990 => array( 'Attribute' => "SceneCaptureType",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SCENECAPTURETYPE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SCENECAPTURETYPE_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_SCENECAPTURETYPE_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_SCENECAPTURETYPE_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_SCENECAPTURETYPE_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_SCENECAPTURETYPE_3')
|
||||
),
|
||||
41991 => array( 'Attribute' => "GainControl",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_GAINCONTROL'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_GAINCONTROL_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_GAINCONTROL_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_GAINCONTROL_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_GAINCONTROL_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_GAINCONTROL_3'),
|
||||
4 => JText::_('COM_JOOMGALLERY_SUBIFD_GAINCONTROL_4')
|
||||
),
|
||||
41992 => array( 'Attribute' => "Contrast",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_CONTRAST'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_CONTRAST_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_CONTRAST_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_CONTRAST_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_CONTRAST_2')
|
||||
),
|
||||
41993 => array( 'Attribute' => "Saturation",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SATURATION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SATURATION_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_SATURATION_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_SATURATION_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_SATURATION_2')
|
||||
),
|
||||
41994 => array( 'Attribute' => "Sharpness",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SHARPNESS'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SHARPNESS_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_SHARPNESS_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_SHARPNESS_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_SHARPNESS_2')
|
||||
),
|
||||
// 41995 => array( 'Attribute' => "DeviceSettingDescription",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_DEVICESETTINGDESCRIPTION'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_DEVICESETTINGDESCRIPTION_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "Undefined",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
41996 => array( 'Attribute' => "SubjectDistanceRange",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCERANGE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCERANGE_DESCRIPTION'),
|
||||
'Calculation' => "Array",
|
||||
'Format' => "Unsigned Short",
|
||||
'Units' => "",
|
||||
0 => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCERANGE_0'),
|
||||
1 => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCERANGE_1'),
|
||||
2 => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCERANGE_2'),
|
||||
3 => JText::_('COM_JOOMGALLERY_SUBIFD_SUBJECTDISTANCERANGE_3')
|
||||
),
|
||||
// 42016 => array( 'Attribute' => "ImageUniqueID",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_SUBIFD_IMAGEUNIQUEID'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_SUBIFD_IMAGEUNIQUEID_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "",
|
||||
// 'Units' => ""
|
||||
// )
|
||||
),
|
||||
|
||||
"GPS" => array
|
||||
(
|
||||
// 0 => array( 'Attribute' => "GPSVersionID",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_GPS_GPSVERSIONID'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_GPS_GPSVERSIONID_DESCRIPTION'),
|
||||
// 'Calculation' => "",
|
||||
// 'Format' => "Byte",
|
||||
// 'Units' => ""
|
||||
// ),
|
||||
1 => array( 'Attribute' => "GPSLatitudeRef",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_GPS_GPSLATITUDEREF'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_GPS_GPSLATITUDEREF_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
2 => array( 'Attribute' => "GPSLatitude",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_GPS_GPSLATITUDE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_GPS_GPSLATITUDE_DESCRIPTION'),
|
||||
'Calculation' => "DegMinSec",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
3 => array( 'Attribute' => "GPSLongitudeRef",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_GPS_GPSLONGITUDEREF'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_GPS_GPSLONGITUDEREF_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "ASCII String",
|
||||
'Units' => ""
|
||||
),
|
||||
4 => array( 'Attribute' => "GPSLongitude",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_GPS_GPSLONGITUDE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_GPS_GPSLONGITUDE_DESCRIPTION'),
|
||||
'Calculation' => "DegMinSec",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => ""
|
||||
),
|
||||
5 => array( 'Attribute' => "GPSAltitudeRef",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_GPS_GPSALTITUDEREF'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_GPS_GPSALTITUDEREF_DESCRIPTION'),
|
||||
'Calculation' => "",
|
||||
'Format' => "Byte",
|
||||
'Units' => ""
|
||||
),
|
||||
6 => array( 'Attribute' => "GPSAltitude",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_GPS_GPSALTITUDE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_GPS_GPSALTITUDE_DESCRIPTION'),
|
||||
'Calculation' => "Denum",
|
||||
'Format' => "Unsigned Rational",
|
||||
'Units' => JText::_('COM_JOOMGALLERY_GPS_GPSALTITUDE_UNIT')
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/includes/iptcarray.php $
|
||||
// $Id: iptcarray.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
$iptc_config_array = array
|
||||
(
|
||||
"IPTC" => array
|
||||
(
|
||||
// 204 => array('Attribute' => "Object Attribute Reference",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_IPTC_INTELLECTUALGENRE'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_IPTC_INTELLECTUALGENRE_DEFINITION'),
|
||||
// 'Group' => "Object",
|
||||
// 'IMM' => "2:004",
|
||||
// 'Format' => "Characters",
|
||||
// 'Length' => "256"
|
||||
// ),
|
||||
205 => array('Attribute' => "Object Name",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_TITLE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_TITLE_DEFINITION'),
|
||||
'Group' => "Object",
|
||||
'IMM' => "2:005",
|
||||
'Format' => "Characters",
|
||||
'Length' => "64"
|
||||
),
|
||||
225 => array('Attribute' => "Keywords",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_KEYWORDS'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_KEYWORDS_DEFINITION'),
|
||||
'Group' => "Keywords",
|
||||
'IMM' => "2:025",
|
||||
'Format' => "Characters",
|
||||
'Length' => "each max. 64"
|
||||
),
|
||||
240 => array('Attribute' => "Special Instructions",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_INSTRUCTIONS'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_INSTRUCTIONS_DEFINITION'),
|
||||
'Group' => "Caption",
|
||||
'IMM' => "2:040",
|
||||
'Format' => "Characters",
|
||||
'Length' => "256"
|
||||
),
|
||||
255 => array('Attribute' => "Date Created",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_DATECREATED'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_DATECREATED_DEFINITION'),
|
||||
'Group' => "Object",
|
||||
'IMM' => "2:055",
|
||||
'Format' => "Numeric",
|
||||
'Length' => "8"
|
||||
),
|
||||
// 260 => array('Attribute' => "Time Created",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_IPTC_TIMECREATED'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_IPTC_TIMECREATED_DEFINITION'),
|
||||
// 'Group' => "Object",
|
||||
// 'IMM' => "2:060",
|
||||
// 'Format' => "Characters",
|
||||
// 'Length' => "11"
|
||||
// ),
|
||||
280 => array('Attribute' => "By-line",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_CREATOR'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_CREATOR_DEFINITION'),
|
||||
'Group' => "Contact",
|
||||
'IMM' => "2:080",
|
||||
'Format' => "Characters",
|
||||
'Length' => "32"
|
||||
),
|
||||
285 => array('Attribute' => "By-line Title",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_CREATORSJOBTITLE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_CREATORSJOBTITLE_DEFINITION'),
|
||||
'Group' => "Contact",
|
||||
'IMM' => "2:085",
|
||||
'Format' => "Characters",
|
||||
'Length' => "32"
|
||||
),
|
||||
290 => array('Attribute' => "City",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_CITYLEGACY'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_CITYLEGACY_DEFINITION'),
|
||||
'Group' => "Object",
|
||||
'IMM' => "2:090",
|
||||
'Format' => "Characters",
|
||||
'Length' => "32"
|
||||
),
|
||||
292 => array('Attribute' => "Sublocation",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_SUBLOCATIONLEGACY'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_SUBLOCATIONLEGACY_DEFINITION'),
|
||||
'Group' => "Object",
|
||||
'IMM' => "2:092",
|
||||
'Format' => "Characters",
|
||||
'Length' => "32"
|
||||
),
|
||||
295 => array('Attribute' => "Province/State",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_PROVINCEORSTATELEGACY'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_PROVINCEORSTATELEGACY_DEFINITION'),
|
||||
'Group' => "Object",
|
||||
'IMM' => "2:095",
|
||||
'Format' => "Characters",
|
||||
'Length' => "32"
|
||||
),
|
||||
// 2100 => array('Attribute' => "Country/Primary Location Code",
|
||||
// 'Name' => JText::_('COM_JOOMGALLERY_IPTC_COUNTRYCODELEGACY'),
|
||||
// 'Description' => JText::_('COM_JOOMGALLERY_IPTC_COUNTRYCODELEGACY_DEFINITION'),
|
||||
// 'Group' => "Object",
|
||||
// 'IMM' => "2:100",
|
||||
// 'Format' => "Characters",
|
||||
// 'Length' => "2 or 3"
|
||||
// ),
|
||||
2101 => array('Attribute' => "Country/Primary Location Name",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_COUNTRYLEGACY'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_COUNTRYLEGACY_DEFINITION'),
|
||||
'Group' => "Object",
|
||||
'IMM' => "2:101",
|
||||
'Format' => "Characters",
|
||||
'Length' => "64"
|
||||
),
|
||||
2105 => array('Attribute' => "Headline",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_HEADLINE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_HEADLINE_DEFINITION'),
|
||||
'Group' => "Caption",
|
||||
'IMM' => "2:105",
|
||||
'Format' => "Characters",
|
||||
'Length' => "256"
|
||||
),
|
||||
2110 => array('Attribute' => "Credit",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_CREDITLINE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_CREDITLINE_DEFINITION'),
|
||||
'Group' => "Credit",
|
||||
'IMM' => "2:110",
|
||||
'Format' => "Characters",
|
||||
'Length' => "32"
|
||||
),
|
||||
2115 => array('Attribute' => "Source",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_SOURCE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_SOURCE_DEFINITION'),
|
||||
'Group' => "Credit",
|
||||
'IMM' => "2:115",
|
||||
'Format' => "Characters",
|
||||
'Length' => "32"
|
||||
),
|
||||
2116 => array('Attribute' => "Copyright Notice",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_COPYRIGHTNOTICE'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_COPYRIGHTNOTICE_DEFINITION'),
|
||||
'Group' => "Credit",
|
||||
'IMM' => "2:116",
|
||||
'Format' => "Characters",
|
||||
'Length' => "128"
|
||||
),
|
||||
2118 => array('Attribute' => "Contact",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_CONTACT'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_CONTACT_DEFINITION'),
|
||||
'Group' => "Credit",
|
||||
'IMM' => "2:118",
|
||||
'Format' => "Characters",
|
||||
'Length' => "128"
|
||||
),
|
||||
2120 => array('Attribute' => "Caption/Abstract",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_DESCRIPTION'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_DESCRIPTION_DEFINITION'),
|
||||
'Group' => "Caption",
|
||||
'IMM' => "2:120",
|
||||
'Format' => "Characters",
|
||||
'Length' => "2000"
|
||||
),
|
||||
2122 => array('Attribute' => "Writer/Editor",
|
||||
'Name' => JText::_('COM_JOOMGALLERY_IPTC_DESCRIPTIONWRITER'),
|
||||
'Description' => JText::_('COM_JOOMGALLERY_IPTC_DESCRIPTIONWRITER_DEFINITION'),
|
||||
'Group' => "Caption",
|
||||
'IMM' => "2:122",
|
||||
'Format' => "Characters",
|
||||
'Length' => "128"
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a modal window button
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonPopup extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Popup';
|
||||
|
||||
/**
|
||||
* Fetch the HTML for the button
|
||||
*
|
||||
* @param string $type Unused string, formerly button type.
|
||||
* @param string $name Modal name, used to generate element ID
|
||||
* @param string $text The link text
|
||||
* @param string $url URL for popup
|
||||
* @param integer $width Width of popup
|
||||
* @param integer $height Height of popup
|
||||
* @param integer $top Top attribute. [@deprecated Unused, will be removed in 4.0]
|
||||
* @param integer $left Left attribute. [@deprecated Unused, will be removed in 4.0]
|
||||
* @param string $onClose JavaScript for the onClose event.
|
||||
* @param string $title The title text
|
||||
*
|
||||
* @return string HTML string for the button
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Modal', $name = '', $text = '', $url = '', $width = 640, $height = 480, $top = 0, $left = 0,
|
||||
$onClose = '', $title = '', $id = '', $icon = 'out-2')
|
||||
{
|
||||
// If no $title is set, use the $text element
|
||||
if (strlen($title) == 0)
|
||||
{
|
||||
$title = $text;
|
||||
}
|
||||
|
||||
$text = JText::_($text);
|
||||
$title = JText::_($title);
|
||||
$class = $this->fetchIconClass($icon);
|
||||
|
||||
if ($icon == 'apply' || $icon == 'new')
|
||||
{
|
||||
$btnClass = 'btn btn-small btn-success modal';
|
||||
$iconWhite = ' icon-white';
|
||||
}
|
||||
else
|
||||
{
|
||||
$btnClass = 'btn btn-small modal';
|
||||
$iconWhite = '';
|
||||
}
|
||||
|
||||
// If an ID is given we will display existing content in the popup
|
||||
// otherwise we will use the given URL for fetching content.
|
||||
if ($id)
|
||||
{
|
||||
$html = "<button class=\"" . $btnClass . "\" data-toggle=\"modal\" data-target=\"#" . $id . "\">\n";
|
||||
$html .= "<i class=\"" . $class . $iconWhite . "\">\n";
|
||||
$html .= "</i>\n";
|
||||
$html .= "$text\n";
|
||||
|
||||
$html .= "</button>\n";
|
||||
|
||||
JHtml::_('bootstrap.modal', $id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$doTask = $this->_getCommand($url);
|
||||
|
||||
$html = "<button class=\"" . $btnClass . "\" data-toggle=\"modal\" data-target=\"#modal-" . $name . "\">\n";
|
||||
$html .= "<i class=\"" . $class . $iconWhite . "\">\n";
|
||||
$html .= "</i>\n";
|
||||
$html .= "$text\n";
|
||||
|
||||
$html .= "</button>\n";
|
||||
|
||||
// Build the options array for the modal
|
||||
$params = array();
|
||||
$params['title'] = $title;
|
||||
$params['url'] = $doTask;
|
||||
$params['height'] = $height;
|
||||
$params['width'] = $width;
|
||||
$html .= JHtml::_('bootstrap.renderModal', 'modal-' . $name, $params);
|
||||
|
||||
// If an $onClose event is passed, add it to the modal JS object
|
||||
if (strlen($onClose) >= 1)
|
||||
{
|
||||
$html .= "<script>\n";
|
||||
$html .= "jQuery('#modal-" . $name . "').on('hide', function () {\n";
|
||||
$html .= $onClose . ";\n";
|
||||
$html .= "}";
|
||||
$html .= ");";
|
||||
$html .= "</script>\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button id
|
||||
*
|
||||
* @param string $type Button type
|
||||
* @param string $name Button name
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId($type, $name)
|
||||
{
|
||||
return $this->_parent->getName() . '-' . "popup-$name";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript command for the button
|
||||
*
|
||||
* @param string $url URL for popup
|
||||
*
|
||||
* @return string JavaScript command string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private function _getCommand($url)
|
||||
{
|
||||
if (substr($url, 0, 4) !== 'http')
|
||||
{
|
||||
$url = JURI::base() . $url;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/joomgallery.php $
|
||||
// $Id: joomgallery.php 4385 2014-05-11 11:48:49Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
JHtml::_('behavior.tabstate');
|
||||
|
||||
if(version_compare(JVERSION, '4.0', 'ge') || version_compare(JVERSION, '3.0', 'lt'))
|
||||
{
|
||||
JToolBarHelper::title('JoomGallery');
|
||||
|
||||
return JError::raiseWarning(500, 'JoomGallery 3.x is only compatible to Joomla! 3.x');
|
||||
}
|
||||
|
||||
// Require the base controller and the defines
|
||||
require_once(JPATH_COMPONENT.'/controller.php');
|
||||
require_once(JPATH_COMPONENT.'/includes/defines.php');
|
||||
|
||||
// Access check
|
||||
if(!JFactory::getUser()->authorise('core.manage', _JOOM_OPTION))
|
||||
{
|
||||
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
// Enable JoomGallery plugins
|
||||
JPluginHelper::importPlugin('joomgallery');
|
||||
|
||||
// Require specific controller if requested
|
||||
if($controller = JRequest::getCmd('controller', 'control'))
|
||||
{
|
||||
$format = JRequest::getCmd('format', 'html');
|
||||
$path = JPATH_COMPONENT.'/controllers/'.$controller.(($format != 'html') ? '.'.$format : '').'.php';
|
||||
if(file_exists($path))
|
||||
{
|
||||
require_once $path;
|
||||
}
|
||||
else
|
||||
{
|
||||
$controller = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Register some classes
|
||||
JLoader::register('JoomGalleryModel', JPATH_COMPONENT.'/model.php');
|
||||
JLoader::register('JoomGalleryView', JPATH_COMPONENT.'/view.php');
|
||||
JLoader::register('JoomExtensions', JPATH_COMPONENT.'/helpers/extensions.php');
|
||||
JLoader::register('JoomHelper', JPATH_COMPONENT.'/helpers/helper.php');
|
||||
JLoader::register('JoomConfig', JPATH_COMPONENT.'/helpers/config.php');
|
||||
JLoader::register('JoomAmbit', JPATH_COMPONENT.'/helpers/ambit.php');
|
||||
JLoader::register('JoomFile', JPATH_COMPONENT.'/helpers/file.php');
|
||||
JTable::addIncludePath( JPATH_COMPONENT.'/tables');
|
||||
|
||||
// Create the controller
|
||||
$classname = 'JoomGalleryController'.$controller;
|
||||
$controller = new $classname();
|
||||
|
||||
// Perform the request task
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.0" method="upgrade">
|
||||
<name>JoomGallery</name>
|
||||
<creationDate>2018/01/21</creationDate>
|
||||
<author>JoomGallery::ProjectTeam</author>
|
||||
<copyright>This component is released under the GNU/GPL License</copyright>
|
||||
<authorEmail>team@joomgallery.net</authorEmail>
|
||||
<authorUrl>http://www.joomgallery.net</authorUrl>
|
||||
<version>3.3.4</version>
|
||||
<description>JoomGallery 3 is a native Joomla! 3.x gallery component</description>
|
||||
<files folder="components/com_joomgallery">
|
||||
<folder>controllers</folder>
|
||||
<folder>helpers</folder>
|
||||
<folder>models</folder>
|
||||
<folder>views</folder>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>interface.php</filename>
|
||||
<filename>joomgallery.php</filename>
|
||||
<filename>model.php</filename>
|
||||
<filename>router.php</filename>
|
||||
<filename>view.php</filename>
|
||||
</files>
|
||||
<media destination="joomgallery" folder="media/joomgallery">
|
||||
<filename>index.html</filename>
|
||||
<folder>css</folder>
|
||||
<folder>images</folder>
|
||||
<folder>js</folder>
|
||||
<folder>java</folder>
|
||||
</media>
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB/en-GB.com_joomgallery.ini</language>
|
||||
<language tag="en-GB">en-GB/en-GB.com_joomgallery.exif.ini</language>
|
||||
<language tag="en-GB">en-GB/en-GB.com_joomgallery.iptc.ini</language>
|
||||
</languages>
|
||||
<install>
|
||||
<sql>
|
||||
<file charset="utf8" driver="mysql">sql/install.mysql.utf8.sql</file>
|
||||
</sql>
|
||||
</install>
|
||||
<uninstall>
|
||||
<sql>
|
||||
<file charset="utf8" driver="mysql">sql/uninstall.mysql.utf8.sql</file>
|
||||
</sql>
|
||||
</uninstall>
|
||||
<update>
|
||||
<schemas>
|
||||
<schemapath type="mysql">sql/updates/mysql</schemapath>
|
||||
</schemas>
|
||||
</update>
|
||||
<scriptfile>script.php</scriptfile>
|
||||
<administration>
|
||||
<menu img="../media/joomgallery/images/joom_main.png">COM_JOOMGALLERY</menu>
|
||||
<submenu>
|
||||
<menu img="media/joomgallery/images/joom_categories.png" controller="categories">COM_JOOMGALLERY_CATEGORY_MANAGER</menu>
|
||||
<menu img="media/joomgallery/images/joom_pictures.png" controller="images">COM_JOOMGALLERY_IMAGE_MANAGER</menu>
|
||||
<menu img="media/joomgallery/images/joom_comments.png" controller="comments">COM_JOOMGALLERY_COMMENTS_MANAGER</menu>
|
||||
<menu img="media/joomgallery/images/joom_pictureupload.png" controller="upload">COM_JOOMGALLERY_IMAGE_UPLOAD</menu>
|
||||
<menu img="media/joomgallery/images/joom_ajaxupload.png" controller="ajaxupload">COM_JOOMGALLERY_AJAX_UPLOAD</menu>
|
||||
<menu img="media/joomgallery/images/joom_batchupload.png" controller="batchupload">COM_JOOMGALLERY_BATCH_UPLOAD</menu>
|
||||
<menu img="media/joomgallery/images/joom_ftpupload.png" controller="ftpupload">COM_JOOMGALLERY_FTP_UPLOAD</menu>
|
||||
<menu img="media/joomgallery/images/joom_jupload.png" controller="jupload">COM_JOOMGALLERY_JAVA_UPLOAD</menu>
|
||||
<menu img="media/joomgallery/images/joom_config.png" controller="config">COM_JOOMGALLERY_CONFIGURATION_MANAGER</menu>
|
||||
<menu img="media/joomgallery/images/joom_css.png" controller="cssedit">COM_JOOMGALLERY_CUSTOMIZE_CSS</menu>
|
||||
<menu img="media/joomgallery/images/joom_migration.png" controller="migration">COM_JOOMGALLERY_MIGRATION_MANAGER</menu>
|
||||
<menu img="media/joomgallery/images/joom_maintenance.png" controller="maintenance">COM_JOOMGALLERY_MAINTENANCE_MANAGER</menu>
|
||||
<menu img="media/joomgallery/images/joom_information.png" controller="help">COM_JOOMGALLERY_HELP</menu>
|
||||
</submenu>
|
||||
<files folder="administrator/components/com_joomgallery">
|
||||
<folder>controllers</folder>
|
||||
<folder>helpers</folder>
|
||||
<folder>includes</folder>
|
||||
<folder>layouts</folder>
|
||||
<folder>models</folder>
|
||||
<folder>sql</folder>
|
||||
<folder>tables</folder>
|
||||
<folder>temp</folder>
|
||||
<folder>views</folder>
|
||||
<filename>access.xml</filename>
|
||||
<filename>changelog.xml</filename>
|
||||
<filename>config.xml</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>joomgallery.php</filename>
|
||||
<filename>LICENSE.TXT</filename>
|
||||
<filename>model.php</filename>
|
||||
<filename>view.php</filename>
|
||||
</files>
|
||||
<languages folder="administrator/language">
|
||||
<language tag="en-GB">en-GB/en-GB.com_joomgallery.ini</language>
|
||||
<language tag="en-GB">en-GB/en-GB.com_joomgallery.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
<updateservers>
|
||||
<server type="collection" priority="1" name="JoomGallery Update Service">http://www.en.joomgallery.net/components/com_newversion/xml/extensions3.xml</server>
|
||||
</updateservers>
|
||||
</extension>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,31 @@
|
||||
<?php defined('_JEXEC') or die; ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<hr />
|
||||
<?php if($displayData->ready): ?>
|
||||
<div style="text-align:center;color:#080;padding:1em 0;font:bold 1.2em Verdana;">
|
||||
<?php echo JText::_('COM_JOOMGALLERY_MIGMAN_TRUE'); ?></div>
|
||||
<div style="text-align:center;"><?php echo JText::_('COM_JOOMGALLERY_MIGMAN_TRUE_LONG'); ?></div>
|
||||
<?php else: ?>
|
||||
<div style="text-align:center;color:#f30;padding:1em 0;font:bold 1.2em Verdana;">
|
||||
<?php echo JText::_('COM_JOOMGALLERY_MIGMAN_FALSE'); ?></div>
|
||||
<div style="text-align:center;"><?php echo JText::_('COM_JOOMGALLERY_MIGMAN_FALSE_LONG'); ?></div>
|
||||
<?php endif; ?>
|
||||
<hr />
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($displayData->ready): ?>
|
||||
<tr>
|
||||
<th colspan="3" style="text-align:center;">
|
||||
<form action="<?php echo $displayData->url; ?>" method="post">
|
||||
<div>
|
||||
<input type="hidden" name="migration" value="<?php echo $displayData->migration; ?>">
|
||||
<input type="hidden" name="task" value="start">
|
||||
<button class="btn btn-large btn-primary btn-block"><?php echo JText::_('COM_JOOMGALLERY_MIGMAN_START'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<hr />
|
||||
</th>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
@ -0,0 +1,17 @@
|
||||
<?php defined('_JEXEC') or die; ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<h4><?php echo $displayData->title; ?></h4>
|
||||
</td>
|
||||
</tr>
|
||||
<?php foreach($displayData->checks as $check): ?>
|
||||
<tr>
|
||||
<td width="80%"><?php echo $check['title']; ?></td>
|
||||
<td width="10%" class="center">
|
||||
<?php echo $check['state'] ? JHTML::_('jgrid.published', true, 0, '', false) : ' '; ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo !$check['state'] ? JHTML::_('jgrid.published', false, 0, '', false) : ' '; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;
|
||||
@ -0,0 +1,7 @@
|
||||
<?php defined('_JEXEC') or die; ?>
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th colspan="3" align="center">
|
||||
<h3><?php echo JText::_('COM_JOOMGALLERY_MIGMAN_RESULTS'); ?></h3>
|
||||
</th>
|
||||
</tr>
|
||||
@ -0,0 +1,44 @@
|
||||
<?php defined('_JEXEC') or die; ?>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<h4><?php echo JText::_('FILES_JOOMGALLERY_MIGRATION_'.strtoupper($displayData->migration).'_MIGRATIONCHECK'); ?></h4>
|
||||
</td>
|
||||
<td>
|
||||
<form action="<?php echo $displayData->url; ?>" method="post" class="form-horizontal form-validate">
|
||||
<?php if($displayData->description): ?>
|
||||
<div class="alert alert-info"><?php echo $displayData->description; ?></div>
|
||||
<?php endif;
|
||||
foreach($displayData->fields as $field):
|
||||
if(!$field->hidden): ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $field->input; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div><?php echo $field->input; ?></div>
|
||||
<?php endif;
|
||||
endforeach;
|
||||
if(count($displayData->fields)): ?>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button id="button-<?php echo $displayData->migration; ?>" class="btn btn-primary">
|
||||
<?php echo JText::_('COM_JOOMGALLERY_MIGMAN_CHECK'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" name="migration" value="<?php echo $displayData->migration; ?>" />
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="center">
|
||||
<button id="button-<?php echo $displayData->migration; ?>" class="btn btn-primary">
|
||||
<?php echo JText::_('COM_JOOMGALLERY_MIGMAN_CHECK'); ?>
|
||||
</button>
|
||||
<input type="hidden" name="migration" value="<?php echo $displayData->migration; ?>" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/model.php $
|
||||
// $Id: model.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
jimport( 'joomla.application.component.model');
|
||||
|
||||
/**
|
||||
* JoomGallery Parent Model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModel extends JModelLegacy
|
||||
{
|
||||
/**
|
||||
* JApplication object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
var $_mainframe;
|
||||
|
||||
/**
|
||||
* JoomConfig object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
var $_config;
|
||||
|
||||
/**
|
||||
* JoomAmbit object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
var $_ambit;
|
||||
|
||||
/**
|
||||
* JUser object, holds the current user data
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
var $_user;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @since 1.5.5
|
||||
*/
|
||||
function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->_ambit = JoomAmbit::getInstance();
|
||||
$this->_config = JoomConfig::getInstance();
|
||||
|
||||
$this->_mainframe = JFactory::getApplication('administrator');
|
||||
$this->_user = JFactory::getUser();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/batchupload.php $
|
||||
// $Id: batchupload.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Batch upload model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModelBatchupload extends JoomGalleryModel
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
@ -0,0 +1,940 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/categories.php $
|
||||
// $Id: categories.php 4405 2014-07-02 07:13:31Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Categories model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModelCategories extends JoomGalleryModel
|
||||
{
|
||||
/**
|
||||
* Categories data array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_categories = null;
|
||||
|
||||
/**
|
||||
* Categories number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_total = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array An optional associative array of configuration settings
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->filter_fields = array(
|
||||
'cid', 'c.cid',
|
||||
'name', 'c.name',
|
||||
'alias', 'c.alias',
|
||||
'parent_id', 'c.parent_id',
|
||||
'published', 'c.published',
|
||||
'access', 'c.access', 'access_level',
|
||||
'owner', 'c.owner',
|
||||
'lft', 'c.lft',
|
||||
'rgt', 'c.rgt',
|
||||
'level', 'c.level',
|
||||
'type'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the data of the categories
|
||||
*
|
||||
* @return array Array of objects containing the categories data from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getCategories()
|
||||
{
|
||||
// Let's load the data if it doesn't already exist
|
||||
if(empty($this->_categories))
|
||||
{
|
||||
// Get the data of the categories which will actually be displayed
|
||||
$query = $this->_buildQuery();
|
||||
$this->_db->setQuery($query, $this->getStart(), $this->getState('list.limit'));
|
||||
$current_categories = $this->_db->loadObjectList('cid');
|
||||
|
||||
// Get the complete category structure (containing only
|
||||
// the categories which we are allowed to display)
|
||||
$categories = $this->_ambit->getCategoryStructure();
|
||||
|
||||
$levels = array();
|
||||
$ordering = array();
|
||||
$this->_categories = array();
|
||||
foreach($categories as $key => $category)
|
||||
{
|
||||
// Check whether the current category will be displayed
|
||||
if(isset($current_categories[$key]))
|
||||
{
|
||||
// If yes insert it into the array which will be used later on
|
||||
$this->_categories[$key] = $current_categories[$key];
|
||||
|
||||
// Create an array which will help to organize ordering later on
|
||||
$ordering[$category->parent_id][] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setState('ordering.array', $ordering);
|
||||
|
||||
// Check whether we aren't displaying all categories in default order
|
||||
if($this->getState('list.ordering') != 'c.lft')
|
||||
{
|
||||
$this->_categories = $current_categories;
|
||||
|
||||
foreach($this->_categories as $key => $category)
|
||||
{
|
||||
// Unset all categories which aren't in category structure
|
||||
// because we aren't allowed to display them
|
||||
if(!isset($categories[$key]))
|
||||
{
|
||||
unset($this->_categories[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the active filters
|
||||
*
|
||||
* @return array Associative array in the format: array('filter_published' => 0)
|
||||
*
|
||||
* @since 3.2.3
|
||||
*/
|
||||
public function getActiveFilters()
|
||||
{
|
||||
$activeFilters = array();
|
||||
|
||||
if (!empty($this->filter_fields))
|
||||
{
|
||||
foreach ($this->filter_fields as $filter)
|
||||
{
|
||||
$filterName = 'filter.' . $filter;
|
||||
|
||||
if (property_exists($this->state, $filterName) && (!empty($this->state->{$filterName}) || is_numeric($this->state->{$filterName})))
|
||||
{
|
||||
$activeFilters[$filter] = $this->state->get($filterName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $activeFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the pagination object for the list.
|
||||
* This method uses 'getTotel', 'getStart' and the current
|
||||
* list limit of this view.
|
||||
*
|
||||
* @return object A pagination object
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getPagination()
|
||||
{
|
||||
return new JPagination($this->getTotal(), $this->getStart(), $this->getState('list.limit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the total number of categories
|
||||
*
|
||||
* @return int The total number of categories
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getTotal()
|
||||
{
|
||||
// Let's load the number of categories if it doesn't already exist
|
||||
if(empty($this->_total))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_total = $this->_getListCount($query);
|
||||
}
|
||||
|
||||
return $this->_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the starting number of items for the data set.
|
||||
*
|
||||
* @return int The starting number of items available in the data set.
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getStart()
|
||||
{
|
||||
$start = $this->getState('list.start');
|
||||
$limit = $this->getState('list.limit');
|
||||
$total = $this->getTotal();
|
||||
if($start > $total - $limit)
|
||||
{
|
||||
$start = max(0, (int)(ceil($total / $limit) - 1) * $limit);
|
||||
}
|
||||
|
||||
return $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter form
|
||||
*
|
||||
* @param array $data data
|
||||
* @param boolean $loadData load current data
|
||||
*
|
||||
* @return JForm/false the JForm object or false
|
||||
*
|
||||
* @since 3.2.3
|
||||
*/
|
||||
public function getFilterForm($data = array(), $loadData = true)
|
||||
{
|
||||
return $this->loadForm(_JOOM_OPTION . '.filter_categories', 'filter_categories', array('control' => '', 'load_data' => $loadData));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a form object.
|
||||
*
|
||||
* @param string $name The name of the form.
|
||||
* @param string $source The form source. Can be XML string if file flag is set to false.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
* @param boolean $clear Optional argument to force load a new form.
|
||||
* @param string $xpath An optional xpath to search for the fields.
|
||||
*
|
||||
* @return mixed JForm object on success, False on error.
|
||||
*
|
||||
* @see JForm
|
||||
* @since 3.2.3
|
||||
*/
|
||||
protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false)
|
||||
{
|
||||
// Handle the optional arguments.
|
||||
$options['control'] = JArrayHelper::getValue($options, 'control', false);
|
||||
|
||||
// Get the form.
|
||||
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
|
||||
JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
try
|
||||
{
|
||||
$form = JForm::getInstance($name, $source, $options, false, $xpath);
|
||||
|
||||
$form->setFieldAttribute('owner', 'useListboxMaxUserCount', $this->_config->get('jg_use_listbox_max_user_count'), 'filter');
|
||||
|
||||
if(isset($options['load_data']) && $options['load_data'])
|
||||
{
|
||||
// Get the data for the form.
|
||||
$data = $this->loadFormData();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = array();
|
||||
}
|
||||
|
||||
// Load the data into the form after the plugins have operated.
|
||||
$form->bind($data);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 3.2.3
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('joom.categories', new stdClass);
|
||||
|
||||
// Pre-fill the list options
|
||||
if (!property_exists($data, 'list'))
|
||||
{
|
||||
$data->list = array(
|
||||
'direction' => $this->state->{'list.direction'},
|
||||
'limit' => $this->state->{'list.limit'},
|
||||
'ordering' => $this->state->{'list.ordering'},
|
||||
'start' => $this->state->{'list.start'}
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string An optional ordering field.
|
||||
* @param string An optional direction (asc|desc).
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function populateState($ordering = 'c.lft', $direction = 'ASC')
|
||||
{
|
||||
// Receive & set filters
|
||||
$filters = $this->getUserStateFromRequest('joom.categories.filter', 'filter',
|
||||
array('search' => null, 'access' => '', 'published' => '', 'type' => '', 'owner' => ''), 'array');
|
||||
|
||||
if($filters)
|
||||
{
|
||||
foreach($filters as $name => $value)
|
||||
{
|
||||
$this->setState('filter.' . $name, $value);
|
||||
|
||||
if($value)
|
||||
{
|
||||
$this->setState('filter.inuse', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$limit = 0;
|
||||
|
||||
// Receive & set list options
|
||||
$list = $this->getUserStateFromRequest('joom.categories.list', 'list',
|
||||
array('ordering' => $ordering, 'direction' => $direction, 'fullordering' => $ordering . ' ' . $direction,
|
||||
'limit' => $this->_mainframe->getCfg('list_limit'), 'start' => 0), 'array');
|
||||
|
||||
if($list)
|
||||
{
|
||||
foreach($list as $name => $value)
|
||||
{
|
||||
// Extra validations
|
||||
switch($name)
|
||||
{
|
||||
case 'fullordering':
|
||||
$orderingParts = explode(' ', $value);
|
||||
|
||||
if(count($orderingParts) >= 2)
|
||||
{
|
||||
// Latest part will be considered the direction
|
||||
$fullDirection = end($orderingParts);
|
||||
|
||||
if(in_array(strtoupper($fullDirection), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$this->setState('list.direction', $fullDirection);
|
||||
}
|
||||
|
||||
unset($orderingParts[count($orderingParts) - 1]);
|
||||
|
||||
// The rest will be the ordering
|
||||
$fullOrdering = implode(' ', $orderingParts);
|
||||
|
||||
if(in_array($fullOrdering, $this->filter_fields))
|
||||
{
|
||||
$this->setState('list.ordering', $fullOrdering);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setState('list.ordering', $ordering);
|
||||
$this->setState('list.direction', $direction);
|
||||
}
|
||||
break;
|
||||
case 'ordering':
|
||||
if(!in_array($value, $this->filter_fields))
|
||||
{
|
||||
$value = $ordering;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'direction':
|
||||
if(!in_array(strtoupper($value), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$value = $direction;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'limit':
|
||||
$limit = $value;
|
||||
break;
|
||||
|
||||
// Just to keep the default case
|
||||
default:
|
||||
$value = $value;
|
||||
break;
|
||||
}
|
||||
|
||||
$this->setState('list.' . $name, $value);
|
||||
}
|
||||
|
||||
$value = $this->getUserStateFromRequest('joom.categories.limitstart', 'limitstart', 0);
|
||||
$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
|
||||
|
||||
$this->setState('list.start', $limitstart);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the query for listing the categories
|
||||
*
|
||||
* @return object The query to be used to retrieve the categories data from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
protected function _buildQuery()
|
||||
{
|
||||
// Create a new query object
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table
|
||||
$query->select('c.*')
|
||||
->from(_JOOM_TABLE_CATEGORIES.' AS c');
|
||||
|
||||
// Join over the access levels
|
||||
$query->select('v.title AS access_level')
|
||||
->join('LEFT', '#__viewlevels AS v ON v.id = c.access');
|
||||
|
||||
// Join over the users
|
||||
$query->join('LEFT', '#__users AS u ON u.id = c.owner');
|
||||
|
||||
// ROOT category shouldn't be selected
|
||||
$query->where('parent_id > 0');
|
||||
|
||||
// Filter by allowed access levels
|
||||
if(!$this->_user->authorise('core.admin'))
|
||||
{
|
||||
$query->where('c.access IN ('.implode(',', $this->_user->getAuthorisedViewLevels()).')');
|
||||
}
|
||||
|
||||
// Filter by access level
|
||||
if($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('c.access = '.(int) $access);
|
||||
}
|
||||
|
||||
// Filter by state
|
||||
$published = $this->getState('filter.published');
|
||||
if(is_numeric($published))
|
||||
{
|
||||
switch($published)
|
||||
{
|
||||
case 1:
|
||||
// Published
|
||||
$query->where('published = 1');
|
||||
break;
|
||||
case 0:
|
||||
// Not published
|
||||
$query->where('published = 0');
|
||||
break;
|
||||
default:
|
||||
// No filter by state
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by owner
|
||||
if($owner = $this->getState('filter.owner'))
|
||||
{
|
||||
$query->where('c.owner = '.(int) $owner);
|
||||
}
|
||||
|
||||
// Filter by type
|
||||
$type = $this->getState('filter.type');
|
||||
switch($type)
|
||||
{
|
||||
case 1:
|
||||
// User categories
|
||||
$query->where('c.owner != 0');
|
||||
break;
|
||||
case 2:
|
||||
// Administrator categories
|
||||
$query->where('c.owner = 0');
|
||||
break;
|
||||
default:
|
||||
// No filter by type
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by search
|
||||
$search = $this->getState('filter.search');
|
||||
if(!empty($search))
|
||||
{
|
||||
if(stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('c.cid = '.(int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(stripos($search, 'author:') === 0)
|
||||
{
|
||||
$search = $this->_db->Quote('%'.$this->_db->escape(substr($search, 7), true).'%');
|
||||
$query->where('(u.name LIKE '.$search.' OR u.username LIKE '.$search.')');
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $this->_db->Quote('%'.$this->_db->escape($search, true).'%');
|
||||
$query->where('(c.name LIKE '.$search.' OR c.alias LIKE '.$search.' OR LOWER(c.description) LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the order clause
|
||||
$query->order($this->_db->escape($this->getState('list.ordering', 'c.lft')).' '.$this->_db->escape($this->getState('list.direction', 'ASC')));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more categories
|
||||
*
|
||||
* @param array $ids IDs of categories to delete
|
||||
* @return int Number of successfully deleted categories, boolean false if an error occured
|
||||
* @throws RuntimeException
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function delete($ids)
|
||||
{
|
||||
if(!count($ids))
|
||||
{
|
||||
throw new RuntimeException(JText::_('COM_JOOMGALLERY_COMMON_MSG_NO_CATEGORIES_SELECTED'));
|
||||
}
|
||||
|
||||
$delete_categories = array();
|
||||
$delete_images = array();
|
||||
|
||||
$count = 0;
|
||||
$row = $this->getTable('joomgallerycategories');
|
||||
|
||||
// Loop through selected categories
|
||||
foreach($ids as $cid)
|
||||
{
|
||||
// Check whether we are allowed to delete this category
|
||||
if(!$this->_user->authorise('core.delete', _JOOM_OPTION.'.category.'.$cid))
|
||||
{
|
||||
JLog::add(JText::sprintf('COM_JOOMGALLERY_CATMAN_ERROR_DELETE_NOT_PERMITTED', $cid), JLog::ERROR, 'jerror');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$delete = true;
|
||||
|
||||
// Check whether there are sub-categories
|
||||
// We can't use category structure here because sub-categories may have
|
||||
// already been deleted in the same request, so the structure isn't up-to-date
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('c.cid')
|
||||
->from(_JOOM_TABLE_CATEGORIES.' AS c')
|
||||
->from(_JOOM_TABLE_CATEGORIES.' AS n')
|
||||
->where('c.lft BETWEEN n.lft AND n.rgt')
|
||||
->where('n.cid = '.$cid);
|
||||
$this->_db->setQuery($query);
|
||||
$subcategories = $this->_db->loadColumn();
|
||||
|
||||
if(count($subcategories) > 1)
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_NOT_EMPTY_CATEGORIES', $cid);
|
||||
$this->_mainframe->enqueueMessage($msg, 'notice');
|
||||
|
||||
$delete = false;
|
||||
|
||||
$delete_categories = array_unique(array_merge($delete_categories, $subcategories));
|
||||
}
|
||||
|
||||
// Database query to check assigned images to category
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('id')
|
||||
->from(_JOOM_TABLE_IMAGES)
|
||||
->where('catid IN ('.implode(',', $subcategories).')');
|
||||
$this->_db->setQuery($query);
|
||||
$images = $this->_db->loadColumn();
|
||||
|
||||
if(count($images))
|
||||
{
|
||||
$msg = JText::sprintf('COM_JOOMGALLERY_CATMAN_MSG_CATEGORY_NOT_EMPTY_IMAGES', $cid);
|
||||
$this->_mainframe->enqueueMessage($msg, 'notice');
|
||||
|
||||
$delete = false;
|
||||
|
||||
$delete_images = array_unique(array_merge($delete_images, $images));
|
||||
$delete_categories = array_unique(array_merge($delete_categories, array($cid)));
|
||||
}
|
||||
|
||||
if($delete)
|
||||
{
|
||||
$catpath = JoomHelper::getCatPath($cid);
|
||||
if(!$this->_deleteFolders($catpath))
|
||||
{
|
||||
JLog::add(JText::_('COM_JOOMGALLERY_CATMAN_MSG_ERROR_DELETING_DIRECTORIES'), JLog::WARNING, 'jerror');
|
||||
}
|
||||
|
||||
$row->load($cid);
|
||||
if(!$row->delete())
|
||||
{
|
||||
throw new RuntimeException($row->getError());
|
||||
}
|
||||
|
||||
$this->_mainframe->triggerEvent('onContentAfterDelete', array(_JOOM_OPTION.'.category', $row));
|
||||
|
||||
// Category successfully deleted
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_mainframe->setUserState('joom.categories.delete.categories', $delete_categories);
|
||||
$this->_mainframe->setUserState('joom.categories.delete.images', $delete_images);
|
||||
|
||||
$cat_count = count($delete_categories);
|
||||
$img_count = count($delete_images);
|
||||
|
||||
if($cat_count || $img_count)
|
||||
{
|
||||
$msg = '<br />'.JText::_('COM_JOOMGALLERY_CATMAN_MSG_DELETECOMPLETELY');
|
||||
if($img_count)
|
||||
{
|
||||
if($img_count == 1)
|
||||
{
|
||||
$msg .= '<br />'.JText::_('COM_JOOMGALLERY_CATMAN_MSG_DELETECOMPLETELY_IMAGES_NUMBER_1');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= '<br />'.JText::sprintf('COM_JOOMGALLERY_CATMAN_MSG_DELETECOMPLETELY_IMAGES_NUMBER', $img_count);
|
||||
}
|
||||
}
|
||||
if($cat_count)
|
||||
{
|
||||
if($cat_count == 1)
|
||||
{
|
||||
$msg .= '<br />'.JText::_('COM_JOOMGALLERY_CATMAN_MSG_DELETECOMPLETELY_CATEGORIES_NUMBER_1');
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= '<br />'.JText::sprintf('COM_JOOMGALLERY_CATMAN_MSG_DELETECOMPLETELY_CATEGORIES_NUMBER', $cat_count);
|
||||
}
|
||||
}
|
||||
$msg .= '<br /><br />'.JText::_('COM_JOOMGALLERY_CATMAN_MSG_DELETECOMPLETELY_NOTE').'<p/>
|
||||
<form action="index.php?option='._JOOM_OPTION.'&controller=categories&task=deletecompletely" method="post" onsubmit="if(!this.security_check.checked){return false;}">
|
||||
<span><input type="checkbox" name="security_check" value="1" /> <button class="btn">'.JText::_('COM_JOOMGALLERY_CATMAN_MSG_DELETECOMPLETELY_BUTTON_LABEL').'</button></span>
|
||||
</form><p/>';
|
||||
$this->_mainframe->enqueueMessage($msg, 'notice');
|
||||
}
|
||||
|
||||
// Reset the user state variable 'catid' for filtering in images manager
|
||||
$this->_mainframe->setUserState('joom.images.catid', 0);
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns given category IDs in a specific ordering
|
||||
*
|
||||
* @param array $categories The category IDs to order
|
||||
* @param string $ordering The database table column to use for ordering
|
||||
* @param string $direction The direction to use for ordering
|
||||
* @return array An array with the ordered category IDs
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getOrderedCategories($categories, $ordering = 'lft', $direction = 'ASC')
|
||||
{
|
||||
// Sanitise variables
|
||||
JArrayHelper::toInteger($categories);
|
||||
if(!in_array($ordering, $this->filter_fields))
|
||||
{
|
||||
$ordering = 'lft';
|
||||
}
|
||||
if(!in_array(strtoupper($direction), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$direction = 'ASC';
|
||||
}
|
||||
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('cid')
|
||||
->from(_JOOM_TABLE_CATEGORIES)
|
||||
->where('cid IN ('.implode(',', $categories).')')
|
||||
->order($ordering.' '.$direction);
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
return $this->_db->loadColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes/unpublishes or approves/rejects one or more categories
|
||||
*
|
||||
* @param array $cid An array of category IDs to work with
|
||||
* @param int $publish 1 for publishing and approving, 0 otherwise
|
||||
* @param string $task 'publish' for publishing/unpublishing, anything else otherwise
|
||||
* @return int The number of successfully edited categories, boolean false if an error occured
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function publish($cid, $publish = 1, $task = 'publish')
|
||||
{
|
||||
JArrayHelper::toInteger($cid);
|
||||
$publish = intval($publish);
|
||||
$count = count($cid);
|
||||
|
||||
$row = $this->getTable('joomgallerycategories');
|
||||
|
||||
$column = 'approved';
|
||||
if($task == 'publish')
|
||||
{
|
||||
$column = 'published';
|
||||
}
|
||||
|
||||
foreach($cid as $catid)
|
||||
{
|
||||
$row->load($catid);
|
||||
$row->$column = $publish;
|
||||
if(!$row->check())
|
||||
{
|
||||
$count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$row->store())
|
||||
{
|
||||
$count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// If publishing or unpublishung wasn't successful, decrease the
|
||||
// counter of successfully published or unpublished categories
|
||||
if($row->$column != $publish)
|
||||
{
|
||||
$count--;
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes folders of an existing category
|
||||
*
|
||||
* @param string $catpath The catpath of the category
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 1.5.5
|
||||
*/
|
||||
protected function _deleteFolders($catpath)
|
||||
{
|
||||
if(!$catpath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$orig_path = JPath::clean($this->_ambit->get('orig_path').$catpath);
|
||||
$img_path = JPath::clean($this->_ambit->get('img_path').$catpath);
|
||||
$thumb_path = JPath::clean($this->_ambit->get('thumb_path').$catpath);
|
||||
|
||||
// Delete the folder of the category for the original images
|
||||
if(!JFolder::delete($orig_path))
|
||||
{
|
||||
// If not successfull
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete the folder of the category for the detail images
|
||||
if(!JFolder::delete($img_path))
|
||||
{
|
||||
// If not successful
|
||||
if(JFolder::create($orig_path))
|
||||
{
|
||||
JoomFile::copyIndexHtml($orig_path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete the folder of the category for the thumbnails
|
||||
if(!JFolder::delete($thumb_path))
|
||||
{
|
||||
// If not successful
|
||||
if(JFolder::create($orig_path))
|
||||
{
|
||||
JoomFile::copyIndexHtml($orig_path);
|
||||
}
|
||||
if(JFolder::create($img_path))
|
||||
{
|
||||
JoomFile::copyIndexHtml($img_path);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for retreiving categories allowed for a certain action
|
||||
*
|
||||
* @param string $action Optional action to check the categories against
|
||||
* @param int $filter Optional category ID which will be filtered out together with its sub-categories
|
||||
* @param string $searchstring Optional string for searching specific categories (name of category will be used for searching)
|
||||
* @param int $limitstart Optional limit start parameter for database query
|
||||
* @return array A result set with an array of categories and indicator whether there are more results left on success, Exception object otherwise
|
||||
* @since 2.1
|
||||
*/
|
||||
public function getAllowedCategories($action = null, $filter = null, $searchstring = '', $limitstart = 0, $current = 0)
|
||||
{
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
|
||||
// Initialise variables
|
||||
$results = array('results' => array());
|
||||
|
||||
$action2 = false;
|
||||
if($action == 'joom.upload')
|
||||
{
|
||||
$action2 = 'joom.upload.inown';
|
||||
}
|
||||
if($action == 'core.create')
|
||||
{
|
||||
$action2 = 'joom.create.inown';
|
||||
}
|
||||
if($action == 'core.edit')
|
||||
{
|
||||
$action2 = 'core.edit.own';
|
||||
}
|
||||
|
||||
$filtered = array();
|
||||
if($filter)
|
||||
{
|
||||
$filtered = JoomHelper::getAllSubCategories($filter, true, true, true, false);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Create the search query
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('cid, name, owner')
|
||||
->from($this->_db->qn(_JOOM_TABLE_CATEGORIES))
|
||||
->where('cid != 1')
|
||||
->order('lft');
|
||||
if($searchstring)
|
||||
{
|
||||
$searchstring = $this->_db->q('%'.$searchstring.'%');
|
||||
$query->where('name LIKE '.$searchstring);
|
||||
}
|
||||
|
||||
// Load all results
|
||||
$this->_db->setQuery($query);
|
||||
$result = $this->_db->loadObjectList();
|
||||
|
||||
// Check the results starting from limit start
|
||||
$count = count($result);
|
||||
$j = 0;
|
||||
|
||||
if( !$limitstart
|
||||
&& ($current == 0 || !$action || ($action == 'core.create' && $this->_user->authorise($action, _JOOM_OPTION)))
|
||||
)
|
||||
{
|
||||
$none = new stdclass();
|
||||
$none->cid = 0;
|
||||
$none->name = JText::_('COM_JOOMGALLERY_COMMON_NO_CATEGORY');
|
||||
$none->path = '';
|
||||
$none->none = true;
|
||||
$results['results'][$j] = $none;
|
||||
$j++;
|
||||
}
|
||||
|
||||
for($i = $limitstart; $i < $count; $i++)
|
||||
{
|
||||
if(in_array($result[$i]->cid, $filtered))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $result[$i]->cid != $current
|
||||
&& $action && !$this->_user->authorise($action, _JOOM_OPTION.'.category.'.$result[$i]->cid)
|
||||
&& ( !$action2
|
||||
|| $result[$i]->owner != $this->_user->get('id')
|
||||
|| !$this->_user->authorise($action2, _JOOM_OPTION.'.category.'.$result[$i]->cid)
|
||||
)
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Stop as soon as we have 10 results.
|
||||
// This check is done not earlier than at this point because
|
||||
// we want to know whether there is at least one more result.
|
||||
if($j == 10)
|
||||
{
|
||||
// If 'more' is set a 'More Results' link will be displayed in the view
|
||||
$results['more'] = $i;
|
||||
break;
|
||||
}
|
||||
|
||||
$results['results'][$j] = $result[$i];
|
||||
$results['results'][$j]->path = JHtml::_('joomgallery.categorypath', $result[$i]->cid, false);
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
catch(JDatabaseException $e)
|
||||
{
|
||||
return $e;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of a user state variable and sets it in the session
|
||||
* This is the same as the method in JApplication except that this also can optionally
|
||||
* force you back to the first page when a filter has changed
|
||||
*
|
||||
* @param string $key The key of the user state variable
|
||||
* @param string $request The name of the variable passed in a request
|
||||
* @param string $default The default value for the variable if not found (optional)
|
||||
* @param string $type Filter for the variable, for valid values see {@link JFilterInput::clean()} (optional)
|
||||
* @param boolean $resetPage If true, the limitstart in request is set to zero if the state has changed
|
||||
* @return The requested user state
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getUserStateFromRequest($key, $request, $default = null, $type = 'none', $resetPage = true)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
$old_state = $app->getUserState($key);
|
||||
$cur_state = (!is_null($old_state)) ? $old_state : $default;
|
||||
$new_state = JRequest::getVar($request, null, 'default', $type);
|
||||
|
||||
if($cur_state != $new_state && !is_null($new_state) && !is_null($old_state) && $resetPage)
|
||||
{
|
||||
JRequest::setVar('limitstart', 0);
|
||||
}
|
||||
|
||||
// Save the new value only if it was set in this request.
|
||||
if($new_state !== null)
|
||||
{
|
||||
$app->setUserState($key, $new_state);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_state = $cur_state;
|
||||
}
|
||||
|
||||
return $new_state;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,593 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/comments.php $
|
||||
// $Id: comments.php 4175 2013-04-05 11:13:27Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Comments model
|
||||
*
|
||||
* Saves, removes, publishes, unpublishes, approves,
|
||||
* rejects and loads comments.
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModelComments extends JoomGalleryModel
|
||||
{
|
||||
/**
|
||||
* Comments data array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_comments;
|
||||
|
||||
/**
|
||||
* Comments number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_total = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array An optional associative array of configuration settings
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->filter_fields = array(
|
||||
'cmtid', 'c.cmtid',
|
||||
'user',
|
||||
'cmttext', 'c.cmttext',
|
||||
'published', 'c.published',
|
||||
'approved', 'c.approved',
|
||||
'cmtip', 'c.cmtip',
|
||||
'i.imgtitle',
|
||||
'cmtdate', 'c.cmtdate',
|
||||
'state'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the comments data
|
||||
*
|
||||
* @return array Array of objects containing the comments data from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getComments()
|
||||
{
|
||||
// Lets load the data if it doesn't already exist
|
||||
if(empty($this->_comments))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_comments = $this->_getList($query, $this->getStart(), $this->getState('list.limit'));
|
||||
|
||||
foreach($this->_comments as $key => $comment)
|
||||
{
|
||||
if($comment->userid > 0)
|
||||
{
|
||||
$this->_comments[$key]->cmtname = JHTML::_('joomgallery.displayname', $comment->userid);
|
||||
}
|
||||
|
||||
$this->_comments[$key]->cmttext = JoomHelper::processText($comment->cmttext);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the active filters
|
||||
*
|
||||
* @return array Associative array in the format: array('filter_published' => 0)
|
||||
*
|
||||
* @since 3.2.3
|
||||
*/
|
||||
public function getActiveFilters()
|
||||
{
|
||||
$activeFilters = array();
|
||||
|
||||
if (!empty($this->filter_fields))
|
||||
{
|
||||
foreach ($this->filter_fields as $filter)
|
||||
{
|
||||
$filterName = 'filter.' . $filter;
|
||||
|
||||
if (property_exists($this->state, $filterName) && (!empty($this->state->{$filterName}) || is_numeric($this->state->{$filterName})))
|
||||
{
|
||||
$activeFilters[$filter] = $this->state->get($filterName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $activeFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the pagination object for the list.
|
||||
* This method uses 'getTotel', 'getStart' and the current
|
||||
* list limit of this view.
|
||||
*
|
||||
* @return object A pagination object
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getPagination()
|
||||
{
|
||||
return new JPagination($this->getTotal(), $this->getStart(), $this->getState('list.limit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the total number of comments
|
||||
*
|
||||
* @return int The total number of comments in the gallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getTotal()
|
||||
{
|
||||
// Lets load the comments number if it doesn't already exist
|
||||
if(empty($this->_total))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_total = $this->_getListCount($query);
|
||||
}
|
||||
|
||||
return $this->_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the starting number of items for the data set.
|
||||
*
|
||||
* @return int The starting number of items available in the data set.
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getStart()
|
||||
{
|
||||
$start = $this->getState('list.start');
|
||||
$limit = $this->getState('list.limit');
|
||||
$total = $this->getTotal();
|
||||
if($start > $total - $limit)
|
||||
{
|
||||
$start = max(0, (int)(ceil($total / $limit) - 1) * $limit);
|
||||
}
|
||||
|
||||
return $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter form
|
||||
*
|
||||
* @param array $data data
|
||||
* @param boolean $loadData load current data
|
||||
*
|
||||
* @return JForm/false the JForm object or false
|
||||
*
|
||||
* @since 3.2.3
|
||||
*/
|
||||
public function getFilterForm($data = array(), $loadData = true)
|
||||
{
|
||||
return $this->loadForm(_JOOM_OPTION . '.filter_comments', 'filter_comments', array('control' => '', 'load_data' => $loadData));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a form object.
|
||||
*
|
||||
* @param string $name The name of the form.
|
||||
* @param string $source The form source. Can be XML string if file flag is set to false.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
* @param boolean $clear Optional argument to force load a new form.
|
||||
* @param string $xpath An optional xpath to search for the fields.
|
||||
*
|
||||
* @return mixed JForm object on success, False on error.
|
||||
*
|
||||
* @see JForm
|
||||
* @since 3.2.3
|
||||
*/
|
||||
protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false)
|
||||
{
|
||||
// Handle the optional arguments.
|
||||
$options['control'] = JArrayHelper::getValue($options, 'control', false);
|
||||
|
||||
// Get the form.
|
||||
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
|
||||
JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
try
|
||||
{
|
||||
$form = JForm::getInstance($name, $source, $options, false, $xpath);
|
||||
|
||||
if(isset($options['load_data']) && $options['load_data'])
|
||||
{
|
||||
// Get the data for the form.
|
||||
$data = $this->loadFormData();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = array();
|
||||
}
|
||||
|
||||
// Load the data into the form after the plugins have operated.
|
||||
$form->bind($data);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @since 3.2.3
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('joom.comments', new stdClass);
|
||||
|
||||
// Pre-fill the list options
|
||||
if (!property_exists($data, 'list'))
|
||||
{
|
||||
$data->list = array(
|
||||
'direction' => $this->state->{'list.direction'},
|
||||
'limit' => $this->state->{'list.limit'},
|
||||
'ordering' => $this->state->{'list.ordering'},
|
||||
'start' => $this->state->{'list.start'}
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string An optional ordering field.
|
||||
* @param string An optional direction (asc|desc).
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function populateState($ordering = 'c.cmtdate', $direction = 'desc')
|
||||
{
|
||||
// Receive & set filters
|
||||
$filters = $this->getUserStateFromRequest('joom.comments.filter', 'filter', array('search' => null, 'state' => ''), 'array');
|
||||
|
||||
if($filters)
|
||||
{
|
||||
foreach($filters as $name => $value)
|
||||
{
|
||||
$this->setState('filter.' . $name, $value);
|
||||
|
||||
if($value)
|
||||
{
|
||||
$this->setState('filter.inuse', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$limit = 0;
|
||||
|
||||
// Receive & set list options
|
||||
$list = $this->getUserStateFromRequest('joom.comments.list', 'list',
|
||||
array('ordering' => $ordering, 'direction' => $direction, 'fullordering' => $ordering . ' ' . $direction,
|
||||
'limit' => $this->_mainframe->getCfg('list_limit'), 'start' => 0), 'array');
|
||||
|
||||
if($list)
|
||||
{
|
||||
foreach($list as $name => $value)
|
||||
{
|
||||
// Extra validations
|
||||
switch($name)
|
||||
{
|
||||
case 'fullordering':
|
||||
$orderingParts = explode(' ', $value);
|
||||
|
||||
if(count($orderingParts) >= 2)
|
||||
{
|
||||
// Latest part will be considered the direction
|
||||
$fullDirection = end($orderingParts);
|
||||
|
||||
if(in_array(strtoupper($fullDirection), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$this->setState('list.direction', $fullDirection);
|
||||
}
|
||||
|
||||
unset($orderingParts[count($orderingParts) - 1]);
|
||||
|
||||
// The rest will be the ordering
|
||||
$fullOrdering = implode(' ', $orderingParts);
|
||||
|
||||
if(in_array($fullOrdering, $this->filter_fields))
|
||||
{
|
||||
$this->setState('list.ordering', $fullOrdering);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setState('list.ordering', $ordering);
|
||||
$this->setState('list.direction', $direction);
|
||||
}
|
||||
break;
|
||||
case 'ordering':
|
||||
if(!in_array($value, $this->filter_fields))
|
||||
{
|
||||
$value = $ordering;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'direction':
|
||||
if(!in_array(strtoupper($value), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$value = $direction;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'limit':
|
||||
$limit = $value;
|
||||
break;
|
||||
|
||||
// Just to keep the default case
|
||||
default:
|
||||
$value = $value;
|
||||
break;
|
||||
}
|
||||
|
||||
$this->setState('list.' . $name, $value);
|
||||
}
|
||||
|
||||
$value = $this->getUserStateFromRequest('joom.comments.limitstart', 'limitstart', 0);
|
||||
$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
|
||||
$this->setState('list.start', $limitstart);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the query for loading all comments
|
||||
*
|
||||
* @return string The query to be used to retrieve the rows from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
protected function _buildQuery()
|
||||
{
|
||||
// Create a new query object
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table
|
||||
$query->select('c.*')
|
||||
->from(_JOOM_TABLE_COMMENTS.' AS c');
|
||||
|
||||
// Join over the images
|
||||
$query->select('i.id, i.imgtitle, i.imgthumbname, i.catid, i.owner')
|
||||
->join('LEFT', _JOOM_TABLE_IMAGES.' AS i ON i.id = c.cmtpic');
|
||||
|
||||
// Join over the users
|
||||
$query->select('u.username AS user')
|
||||
->join('LEFT', '#__users AS u ON u.id = c.userid');
|
||||
|
||||
/*// Filter by owner
|
||||
$owner = $this->getState('filter.owner');
|
||||
if($owner !== '')
|
||||
{
|
||||
$query->where('a.owner = '.(int) $owner);
|
||||
}*/
|
||||
|
||||
// Filter by state
|
||||
$published = $this->getState('filter.state');
|
||||
switch($published)
|
||||
{
|
||||
case 1:
|
||||
// Published
|
||||
$query->where('c.published = 1');
|
||||
break;
|
||||
case 2:
|
||||
// Not published
|
||||
$query->where('c.published = 0');
|
||||
break;
|
||||
case 3:
|
||||
// Approved
|
||||
$query->where('c.approved = 1');
|
||||
break;
|
||||
case 4:
|
||||
// Not approved / rejected
|
||||
$query->where('c.approved = 0');
|
||||
break;
|
||||
default:
|
||||
// No filter by state
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by search
|
||||
$search = $this->getState('filter.search');
|
||||
if(!empty($search))
|
||||
{
|
||||
if(stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('c.cmtid = '.(int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(stripos($search, 'author:') === 0)
|
||||
{
|
||||
$search = $this->_db->Quote('%'.$this->_db->escape(substr($search, 7), true).'%');
|
||||
$query->where('(u.name LIKE '.$search.' OR u.username LIKE '.$search.')');
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $this->_db->Quote('%'.$this->_db->escape($search, true).'%');
|
||||
$query->where('LOWER(c.cmttext) LIKE '.$search);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the order clause
|
||||
$query->order($this->_db->escape($this->getState('list.ordering', 'c.cmtdate')).' '.$this->_db->escape($this->getState('list.direction', 'DESC')));
|
||||
|
||||
if($this->getState('list.ordering') == 'user')
|
||||
{
|
||||
$query->order('c.cmtname '.$this->getState('list.direction', 'ASC'));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more comments
|
||||
*
|
||||
* @return int The number of successfully deleted comments, boolean false if an error occured
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$cids = JRequest::getVar('cid', array(0), 'post', 'array');
|
||||
|
||||
$row = $this->getTable('joomgallerycomments');
|
||||
|
||||
if(count($cids))
|
||||
{
|
||||
foreach($cids as $cid)
|
||||
{
|
||||
if (!$row->delete($cid))
|
||||
{
|
||||
$this->setError($row->getErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return count($cids);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to publish, unpublish, approve or reject one or more comments
|
||||
*
|
||||
* @param array $cid Array of comment IDs to perform the task on
|
||||
* @param int $publish 1 for publishing or approving, 0 for unpublishing or rejecting
|
||||
* @param string $task The task to perform ('publish' or 'approve')
|
||||
* @return int The number of successfully processed comments, false otherwise
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function publish($cid, $publish = 1, $task = 'publish')
|
||||
{
|
||||
JArrayHelper::toInteger($cid);
|
||||
$cids = implode(',', $cid);
|
||||
|
||||
$column = 'approved';
|
||||
if($task == 'publish')
|
||||
{
|
||||
$column = 'published';
|
||||
}
|
||||
|
||||
$query = $this->_db->getQuery(true)
|
||||
->update(_JOOM_TABLE_COMMENTS)
|
||||
->set($column.' = '.(int) $publish)
|
||||
->where('cmtid IN ('.$cids.' )');
|
||||
$this->_db->setQuery($query);
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Message about new comment to image owner
|
||||
if($column == 'approved' && $publish && $this->_config->get('jg_msg_comment_toowner'))
|
||||
{
|
||||
require_once(JPATH_COMPONENT_SITE.'/helpers/messenger.php');
|
||||
$messenger = new JoomMessenger();
|
||||
|
||||
foreach($cid as $id)
|
||||
{
|
||||
// Load comment data
|
||||
$comment = $this->getTable('joomgallerycomments');
|
||||
$comment->load($id);
|
||||
|
||||
if(!$name = $comment->cmtname)
|
||||
{
|
||||
$user = JFactory::getUser($comment->userid);
|
||||
$name = $this->_config->get('jg_realname') ? $this->_user->get('name') : $this->_user->get('username');
|
||||
}
|
||||
|
||||
// Load image data
|
||||
$image = $this->getTable('joomgalleryimages');
|
||||
$image->load($comment->cmtpic);
|
||||
|
||||
if($image->owner && $image->owner != $comment->userid)
|
||||
{
|
||||
$mode = $messenger->getModeData('comment');
|
||||
$message = array(
|
||||
'from' => $this->_user->get('id'),
|
||||
'subject' => JText::_('COM_JOOMGALLERY_MESSAGE_NEW_COMMENT_TO_OWNER_SUBJECT'),
|
||||
'body' => JText::sprintf('COM_JOOMGALLERY_MESSAGE_NEW_COMMENT_TO_OWNER_BODY', $name, $image->imgtitle, $image->id),
|
||||
'type' => $mode['type']
|
||||
);
|
||||
|
||||
$message['recipient'] = $image->owner;
|
||||
|
||||
$messenger->send($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count($cid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of a user state variable and sets it in the session
|
||||
* This is the same as the method in JApplication except that this also can optionally
|
||||
* force you back to the first page when a filter has changed
|
||||
*
|
||||
* @param string $key The key of the user state variable
|
||||
* @param string $request The name of the variable passed in a request
|
||||
* @param string $default The default value for the variable if not found (optional)
|
||||
* @param string $type Filter for the variable, for valid values see {@link JFilterInput::clean()} (optional)
|
||||
* @param boolean $resetPage If true, the limitstart in request is set to zero if the state has changed
|
||||
* @return The requested user state
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getUserStateFromRequest($key, $request, $default = null, $type = 'none', $resetPage = true)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
$old_state = $app->getUserState($key);
|
||||
$cur_state = (!is_null($old_state)) ? $old_state : $default;
|
||||
$new_state = JRequest::getVar($request, null, 'default', $type);
|
||||
|
||||
if($cur_state != $new_state && !is_null($new_state) && !is_null($old_state) && $resetPage)
|
||||
{
|
||||
JRequest::setVar('limitstart', 0);
|
||||
}
|
||||
|
||||
// Save the new value only if it was set in this request.
|
||||
if($new_state !== null)
|
||||
{
|
||||
$app->setUserState($key, $new_state);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_state = $cur_state;
|
||||
}
|
||||
|
||||
return $new_state;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/config.php $
|
||||
// $Id: config.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Configuration model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModelConfig extends JoomGalleryModel
|
||||
{
|
||||
/**
|
||||
* Attempts to determine if gd is configured, and if so,
|
||||
* what version is installed
|
||||
*
|
||||
* @return string The result of request
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getGDVersion()
|
||||
{
|
||||
if(!extension_loaded('gd'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$phpver = substr(phpversion(), 0, 3);
|
||||
// gd_info came in at 4.3
|
||||
if($phpver < 4.3)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(function_exists('gd_info'))
|
||||
{
|
||||
$ver_info = gd_info();
|
||||
preg_match('/\d/', $ver_info['GD Version'], $match);
|
||||
$gd_ver = $match[0];
|
||||
return $match[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if exec is disabled in php.ini
|
||||
*
|
||||
* @return boolean true if exec exists in array of disabled fuctions
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDisabledExec()
|
||||
{
|
||||
$disable_functions = explode(',', ini_get('disable_functions'));
|
||||
foreach($disable_functions as $disable_function)
|
||||
{
|
||||
if(trim($disable_function) == 'exec')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to determine if ImageMagick is configured, and if so,
|
||||
* what version is installed
|
||||
*
|
||||
* @return string The result of request
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getIMVersion()
|
||||
{
|
||||
$config = JoomConfig::getInstance();
|
||||
$status = null;
|
||||
$output = array();
|
||||
|
||||
if(!empty($config->jg_impath))
|
||||
{
|
||||
$execstring = $config->get('jg_impath').'convert -version';
|
||||
}
|
||||
else
|
||||
{
|
||||
$execstring = 'convert -version';
|
||||
}
|
||||
|
||||
@exec($execstring, $output, $status);
|
||||
|
||||
if(count($output) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $output[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the current config row
|
||||
*
|
||||
* @return string The title of the current config row
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getConfigTitle()
|
||||
{
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('g.title')
|
||||
->from(_JOOM_TABLE_CONFIG.' AS c')
|
||||
->from('#__usergroups AS g')
|
||||
->where('c.group_id = g.id')
|
||||
->where('c.id = '.JRequest::getInt('id'));
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
return $this->_db->loadResult();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,560 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/configs.php $
|
||||
// $Id: configs.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Configs model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JoomGalleryModelConfigs extends JoomGalleryModel
|
||||
{
|
||||
/**
|
||||
* Configs data array
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
var $_configs = null;
|
||||
|
||||
/**
|
||||
* Configs number
|
||||
*
|
||||
* @access protected
|
||||
* @var int
|
||||
*/
|
||||
var $_total = null;
|
||||
|
||||
/**
|
||||
* Configs data array (holding all config rows, but
|
||||
* only with the most important information)
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
var $_allconfigs = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array An optional associative array of configuration settings
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->filter_fields = array(
|
||||
'id', 'c.id',
|
||||
'title', 'g.title',
|
||||
'lft', 'g.lft',
|
||||
'ordering', 'c.ordering'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the data of the config rows
|
||||
*
|
||||
* @access public
|
||||
* @return array Array of objects containing the config rows from the database
|
||||
* @since 2.0
|
||||
*/
|
||||
function getConfigs()
|
||||
{
|
||||
// Let's load the data if it doesn't already exist
|
||||
if(empty($this->_configs))
|
||||
{
|
||||
// Get the data of the categories which will actually be displayed
|
||||
$query = $this->_buildQuery();
|
||||
$this->_db->setQuery($query, $this->getState('list.start'), $this->getState('list.limit'));
|
||||
$configs = $this->_db->loadObjectList('group_id');
|
||||
|
||||
$this->_configs = array();
|
||||
foreach($configs as $key => $config)
|
||||
{
|
||||
// If there is at least one config row with a higher ordering value which belongs
|
||||
// to a parent user group the current config row can/will never be applied to a user
|
||||
if($this->getActiveParentConfigs($config->group_id, $config->ordering))
|
||||
{
|
||||
$config->usergroups = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// With the following code we want to get all user groups
|
||||
// for which the current config row applies.
|
||||
$subgroups = $this->getTree($config->group_id);
|
||||
$config->usergroups = array();
|
||||
$removing = false;
|
||||
foreach($subgroups as $key => $subgroup)
|
||||
{
|
||||
// If the removing flag is set we won't store user groups
|
||||
// which are children of the group stored in $removing
|
||||
if($removing)
|
||||
{
|
||||
if($subgroup->rgt > $removing)
|
||||
{
|
||||
// If rgt of current group is greater than the
|
||||
// stored one the complete sub-tree was parsed
|
||||
$removing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If there is a config row for the current user group with a higher ordering value
|
||||
// that one will be used for the current user group and all of its sub-groups
|
||||
if(isset($configs[$subgroup->id]) && $configs[$subgroup->id]->ordering > $config->ordering)
|
||||
{
|
||||
$removing = $subgroup->rgt;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we reach this point the current config row will
|
||||
// be applied to the current user group, so store it
|
||||
$config->usergroups[] = $subgroup->title;
|
||||
}
|
||||
|
||||
// Prepend the user group the config row belongs to
|
||||
array_unshift($config->usergroups, $config->title);
|
||||
}
|
||||
|
||||
$this->_configs = $configs;
|
||||
}
|
||||
|
||||
return $this->_configs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the most important data of each of the config rows
|
||||
*
|
||||
* @access public
|
||||
* @return array Array of objects containing the config rows from the database
|
||||
* @since 2.1
|
||||
*/
|
||||
function getAllConfigs()
|
||||
{
|
||||
// Let's load the data if it doesn't already exist
|
||||
if(empty($this->_allconfigs))
|
||||
{
|
||||
// Create a new query object
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table
|
||||
$query->select('c.id, c.group_id, c.ordering')
|
||||
->from(_JOOM_TABLE_CONFIG.' AS c');
|
||||
|
||||
// Join over the user groups
|
||||
$query->select('g.title')
|
||||
->leftJoin('#__usergroups AS g ON g.id = c.group_id');
|
||||
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
$this->_allconfigs = $this->_db->loadObjectList();
|
||||
}
|
||||
|
||||
return $this->_allconfigs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get all available usergroups for which there isn't a config row yet
|
||||
*
|
||||
* @return array Array of all available usergroups without an existing config row
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getUsergroups()
|
||||
{
|
||||
$configs = $this->getAllConfigs();
|
||||
|
||||
$group_ids = array();
|
||||
foreach($configs as $config)
|
||||
{
|
||||
$group_ids[] = $config->group_id;
|
||||
}
|
||||
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level')
|
||||
->from('#__usergroups AS a')
|
||||
->leftJoin('#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt')
|
||||
->where('a.id NOT IN ('.implode(',', $group_ids).')')
|
||||
->group('a.id')
|
||||
->order('a.lft ASC');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$options = $this->_db->loadObjectList();
|
||||
}
|
||||
catch(DatabaseException $e)
|
||||
{
|
||||
$this->setError($this->_db->getErrorMsg());
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
foreach($options as $key => $option)
|
||||
{
|
||||
$option->text = str_repeat('- ', $option->level).$option->text;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of config rows for parent groups of a specific user group
|
||||
* which have a higher ordering value than that user group
|
||||
*
|
||||
* @param int The ID of the user group
|
||||
* @param int The ordering value of the user group
|
||||
* @return int The number of config rows which match the conditions above
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getActiveParentConfigs($group, $ordering)
|
||||
{
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('COUNT(c.id)')
|
||||
->from('#__usergroups AS a')
|
||||
->leftJoin('#__usergroups AS b ON b.lft BETWEEN a.lft AND a.rgt')
|
||||
->leftJoin(_JOOM_TABLE_CONFIG.' AS c ON a.id = c.group_id')
|
||||
->where('b.id = '.(int) $group)
|
||||
->where('c.ordering > '.(int) $ordering)
|
||||
->order('a.lft');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$subgroups = $this->_db->loadResult();
|
||||
}
|
||||
catch(DatabaseException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
return $subgroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sub-tree of groups for a specific user group
|
||||
*
|
||||
* @param int The ID of the user group
|
||||
* @return array The sub-tree of the specified group
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getTree($group)
|
||||
{
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('a.id, a.rgt, a.title, c.id AS config_id, c.ordering')
|
||||
->from('#__usergroups AS a')
|
||||
->leftJoin('#__usergroups AS b ON a.lft > b.lft AND a.lft < b.rgt')
|
||||
->leftJoin(_JOOM_TABLE_CONFIG.' AS c ON a.id = c.group_id')
|
||||
->where('b.id = '.(int) $group)
|
||||
->order('a.lft');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$subgroups = $this->_db->loadObjectList();
|
||||
}
|
||||
catch(DatabaseException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
return $subgroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the pagination object for the list.
|
||||
* This method uses 'getTotel', 'getStart' and the current
|
||||
* list limit of this view.
|
||||
*
|
||||
* @return object A pagination object
|
||||
* @since 2.0
|
||||
*/
|
||||
function getPagination()
|
||||
{
|
||||
jimport('joomla.html.pagination');
|
||||
return new JPagination($this->getTotal(), $this->getStart(), $this->getState('list.limit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the total number of categories
|
||||
*
|
||||
* @access public
|
||||
* @return int The total number of categories
|
||||
* @since 2.0
|
||||
*/
|
||||
function getTotal()
|
||||
{
|
||||
// Let's load the number of categories if it doesn't already exist
|
||||
if(empty($this->_total))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_total = $this->_getListCount($query);
|
||||
}
|
||||
|
||||
return $this->_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the starting number of items for the data set.
|
||||
*
|
||||
* @return int The starting number of items available in the data set.
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getStart()
|
||||
{
|
||||
$start = $this->getState('list.start');
|
||||
$limit = $this->getState('list.limit');
|
||||
$total = $this->getTotal();
|
||||
if($start > $total - $limit)
|
||||
{
|
||||
$start = max(0, (int)(ceil($total / $limit) - 1) * $limit);
|
||||
}
|
||||
|
||||
return $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string An optional ordering field.
|
||||
* @param string An optional direction (asc|desc).
|
||||
* @return void
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function populateState($ordering = 'c.ordering', $direction = 'ASC')
|
||||
{
|
||||
$search = $this->getUserStateFromRequest('joom.configs.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$type = $this->getUserStateFromRequest('joom.configs.filter.type', 'filter_type', '');
|
||||
$this->setState('filter.type', $type);
|
||||
|
||||
$value = $this->getUserStateFromRequest('global.list.limit', 'limit', $this->_mainframe->getCfg('list_limit'));
|
||||
$limit = $value;
|
||||
$this->setState('list.limit', $limit);
|
||||
|
||||
$value = $this->getUserStateFromRequest('joom.configs.limitstart', 'limitstart', 0);
|
||||
$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
|
||||
$this->setState('list.start', $limitstart);
|
||||
|
||||
// Check if the ordering field is in the white list, otherwise use the incoming value
|
||||
$value = $this->getUserStateFromRequest('joom.configs.ordercol', 'filter_order', $ordering);
|
||||
if(!in_array($value, $this->filter_fields))
|
||||
{
|
||||
$value = $ordering;
|
||||
$this->_mainframe->setUserState('joom.configs.ordercol', $value);
|
||||
}
|
||||
|
||||
$this->setState('list.ordering', $value);
|
||||
|
||||
// Check if the ordering direction is valid, otherwise use the incoming value
|
||||
$value = $this->getUserStateFromRequest('joom.configs.orderdirn', 'filter_order_Dir', $direction);
|
||||
if(!in_array(strtoupper($value), array('ASC', 'DESC', '')))
|
||||
{
|
||||
$value = $direction;
|
||||
$this->_mainframe->setUserState('joom.configs.orderdirn', $value);
|
||||
}
|
||||
|
||||
$this->setState('list.direction', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the query for listing the config rows
|
||||
*
|
||||
* @return object The query to be used to retrieve the config rows data from the database
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function _buildQuery()
|
||||
{
|
||||
// Create a new query object
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table
|
||||
$query->select('c.id, c.group_id, c.ordering')
|
||||
->from(_JOOM_TABLE_CONFIG.' AS c');
|
||||
|
||||
// Join over the user groups
|
||||
$query->select('g.title')
|
||||
->leftJoin('#__usergroups AS g ON g.id = c.group_id');
|
||||
|
||||
// Add the level in the tree.
|
||||
$query->select('COUNT(DISTINCT g2.id) AS level')
|
||||
->leftJoin('#__usergroups AS g2 ON g.lft > g2.lft AND g.rgt < g2.rgt')
|
||||
->group('g.id');
|
||||
|
||||
// Filter by search
|
||||
$search = $this->getState('filter.search');
|
||||
if(!empty($search))
|
||||
{
|
||||
if(stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('c.id = '.(int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $this->_db->Quote('%'.$this->_db->escape($search, true).'%');
|
||||
$query->where('LOWER(g.title) LIKE '.$search);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the order clause
|
||||
$query->order($this->_db->escape($this->getState('list.ordering', 'c.ordering')).' '.$this->_db->escape($this->getState('list.direction', 'ASC')));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Propagates changes in settings to all config rows
|
||||
*
|
||||
* @param array Array of changed config settings
|
||||
* @param int ID of the initially changed config row
|
||||
* @param boolean Determines whether all changes shall be propagated (true) or only the global ones (false)
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 2.0
|
||||
*/
|
||||
public function propagateChanges($data, $id = 1, $all = false)
|
||||
{
|
||||
// Sanitise variables
|
||||
$data = (array) $data;
|
||||
if(!$id)
|
||||
{
|
||||
$id = 1;
|
||||
}
|
||||
|
||||
$global_settings = $this->_getGlobalSettings();
|
||||
|
||||
// Unset fields which must not be changed
|
||||
foreach($data as $key => $value)
|
||||
{
|
||||
if( strpos($key, 'jg_') !== 0
|
||||
|| (!$all && !in_array($key, $global_settings)))
|
||||
{
|
||||
unset($data[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!count($data))
|
||||
{
|
||||
// Nothing to do
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the IDs of all config rows except the initially changed one
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('id')
|
||||
->from(_JOOM_TABLE_CONFIG)
|
||||
->where('id != '.$id);
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$ids = $this->_db->loadColumn();
|
||||
}
|
||||
catch(DatabaseException $e)
|
||||
{
|
||||
$this->setError($this->_db->getErrorMsg());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!count($ids))
|
||||
{
|
||||
// Nothing to do
|
||||
return true;
|
||||
}
|
||||
|
||||
$config = JoomConfig::getInstance('admin');
|
||||
|
||||
foreach($ids as $config_id)
|
||||
{
|
||||
if(!$config->save($data, $config_id))
|
||||
{
|
||||
$this->setError($config->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the names of settings which can't be different in different config rows
|
||||
*
|
||||
* @return array An array of global settings
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function _getGlobalSettings()
|
||||
{
|
||||
return array('jg_paththumbs', 'jg_pathimages', 'jg_pathoriginalimages', 'jg_pathtemp',
|
||||
'jg_filenamewithjs', 'jg_filenamereplace',
|
||||
'jg_thumbcreation', 'jg_fastgd2thumbcreation', 'jg_impath', 'jg_resizetomaxwidth', 'jg_maxwidth', 'jg_picturequality', 'jg_useforresizedirection', 'jg_cropposition', 'jg_thumbwidth', 'jg_thumbheight', 'jg_thumbquality',
|
||||
'jg_download_unreg',
|
||||
'jg_anoncomment', 'jg_namedanoncomment', 'jg_anonapprovecom',
|
||||
'jg_report_unreg',
|
||||
'jg_showuserpanel_unreg',
|
||||
'jg_showcommentsunreg',
|
||||
'jg_nameshields_unreg', 'jg_show_nameshields_unreg',
|
||||
'jg_usefavouritesforpubliczip'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of a user state variable and sets it in the session
|
||||
* This is the same as the method in JApplication except that this also can optionally
|
||||
* force you back to the first page when a filter has changed
|
||||
*
|
||||
* @param string The key of the user state variable.
|
||||
* @param string The name of the variable passed in a request.
|
||||
* @param string The default value for the variable if not found. Optional.
|
||||
* @param string Filter for the variable, for valid values see {@link JFilterInput::clean()}. Optional.
|
||||
* @param boolean If true, the limitstart in request is set to zero
|
||||
* @return The requested user state.
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getUserStateFromRequest($key, $request, $default = null, $type = 'none', $resetPage = true)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$old_state = $app->getUserState($key);
|
||||
$cur_state = (!is_null($old_state)) ? $old_state : $default;
|
||||
$new_state = JRequest::getVar($request, null, 'default', $type);
|
||||
|
||||
if (($cur_state != $new_state) && ($resetPage)){
|
||||
JRequest::setVar('limitstart', 0);
|
||||
}
|
||||
|
||||
// Save the new value only if it was set in this request.
|
||||
if ($new_state !== null) {
|
||||
$app->setUserState($key, $new_state);
|
||||
}
|
||||
else {
|
||||
$new_state = $cur_state;
|
||||
}
|
||||
|
||||
return $new_state;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/control.php $
|
||||
// $Id: control.php 4224 2013-04-22 15:46:14Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Control panel model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModelControl extends JoomGalleryModel
|
||||
{
|
||||
/**
|
||||
* Menu data array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_data;
|
||||
|
||||
/**
|
||||
* Returns the query for loading the menu entries
|
||||
*
|
||||
* @return object The query to be used to retrieve the menu entries from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
protected function _buildQuery()
|
||||
{
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('*')
|
||||
->from('#__menu')
|
||||
->where('parent_id != 1')
|
||||
->where("menutype = 'main'");
|
||||
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=images%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=categories%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=comments%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=migration%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=help%'";
|
||||
|
||||
$canDo = JoomHelper::getActions();
|
||||
if($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('joom.upload') || count(JoomHelper::getAuthorisedCategories('joom.upload')))
|
||||
{
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=upload%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=ajaxupload%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=batchupload%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=ftpupload%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=jupload%'";
|
||||
}
|
||||
if($canDo->get('core.admin'))
|
||||
{
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=config%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=cssedit%'";
|
||||
$where[] = "link LIKE 'index.php?option=com_joomgallery&controller=maintenance%'";
|
||||
}
|
||||
|
||||
$query->where('('.implode(' OR ', $where).')')
|
||||
->order('id');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the data of the backend menu entries for JoomGallery
|
||||
*
|
||||
* @return array An array of objects containing the data of the menu entries from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
// Lets load the data if it doesn't already exist
|
||||
if(empty($this->_data))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_data = $this->_getList($query);
|
||||
}
|
||||
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the images data
|
||||
*
|
||||
* @param string $orderby The database ordering clause
|
||||
* @param boolean $approved Flag, if only approved images should queried
|
||||
* @param int $limit Query limit
|
||||
* @param string $where Additional database where clause
|
||||
* @return array Array of objects containing the images data from the database
|
||||
* @since 3.0
|
||||
*/
|
||||
public function getImages($orderby = 'a.hits desc', $approved = true, $limit = 5, $where = null)
|
||||
{
|
||||
// Create a new query object
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table
|
||||
$query->select('a.*')
|
||||
->from(_JOOM_TABLE_IMAGES.' AS a');
|
||||
|
||||
// Join over the categories
|
||||
$query->select('c.cid AS category, c.name AS category_name')
|
||||
->leftJoin(_JOOM_TABLE_CATEGORIES.' AS c ON c.cid = a.catid');
|
||||
|
||||
// Join over the categories again in order to check access levels
|
||||
if(!$this->_user->authorise('core.admin'))
|
||||
{
|
||||
$query->leftJoin(_JOOM_TABLE_CATEGORIES.' AS p ON c.lft BETWEEN p.lft AND p.rgt')
|
||||
->select('c.level')
|
||||
->where('p.access IN ('.implode(',', $this->_user->getAuthorisedViewLevels()).')')
|
||||
->group('a.id')
|
||||
->having('COUNT(p.cid) > c.level')
|
||||
|
||||
// Access level check for the image and the category the image is in
|
||||
->where('a.access IN ('.implode(',', $this->_user->getAuthorisedViewLevels()).')')
|
||||
->where('c.access IN ('.implode(',', $this->_user->getAuthorisedViewLevels()).')');
|
||||
}
|
||||
|
||||
$query->where('a.published = 1');
|
||||
$query->where('a.approved = '.($approved ? '1' : '0'));
|
||||
|
||||
if(!empty($where))
|
||||
{
|
||||
$query->where($where);
|
||||
}
|
||||
|
||||
$query->order($orderby);
|
||||
|
||||
return $this->_getList($query, 0, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the images data
|
||||
*
|
||||
* @param string $orderby The database ordering clause
|
||||
* @param boolean $approved Flag, if only approved comments should queried
|
||||
* @param int $limit Query limit
|
||||
* @return array Array of objects containing the images data from the database
|
||||
* @since 3.0
|
||||
*/
|
||||
public function getComments($orderby = 'c.cmtdate desc', $approved = true, $limit = 5)
|
||||
{
|
||||
// Create a new query object
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table
|
||||
$query->select('c.*')
|
||||
->from(_JOOM_TABLE_COMMENTS.' AS c');
|
||||
|
||||
// Join over the images
|
||||
$query->select('i.id, i.imgtitle, i.imgthumbname, i.catid, i.owner')
|
||||
->join('LEFT', _JOOM_TABLE_IMAGES.' AS i ON i.id = c.cmtpic');
|
||||
|
||||
$query->where('c.published = 1');
|
||||
$query->where('c.approved = '.($approved ? '1' : '0'));
|
||||
|
||||
$query->order($orderby);
|
||||
|
||||
return $this->_getList($query, 0, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$this->setState('message', $this->_mainframe->getUserState('joom.control.message'));
|
||||
$this->setState('extension_message', $this->_mainframe->getUserState('joom.control.extension_message'));
|
||||
$this->_mainframe->setUserState('joom.control.message', null);
|
||||
$this->_mainframe->setUserState('joom.control.extension_message', null);
|
||||
|
||||
parent::populateState();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/cssedit.php $
|
||||
// $Id: cssedit.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* CSS edit model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModelCssedit extends JoomGalleryModel
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/editimages.php $
|
||||
// $Id: editimages.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
jimport('joomla.form.form');
|
||||
|
||||
/**
|
||||
* Edit multiple images model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 1.5.5
|
||||
*/
|
||||
class JoomGalleryModelEditimages extends JoomGalleryModel
|
||||
{
|
||||
/**
|
||||
* Images data array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_images;
|
||||
|
||||
/**
|
||||
* Returns the query for loading the image data
|
||||
*
|
||||
* @return object The query to be used to retrieve the image data from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
protected function _buildQuery()
|
||||
{
|
||||
$cid = JRequest::getVar('cid', array(), '', 'array');
|
||||
|
||||
$query = $this->_db->getQuery(true)
|
||||
->select('a.*, c.cid AS category_id, c.name AS category_name, g.title AS groupname')
|
||||
->from(_JOOM_TABLE_IMAGES.' AS a')
|
||||
->leftJoin(_JOOM_TABLE_CATEGORIES.' AS c ON c.cid = a.id')
|
||||
->leftJoin('#__viewlevels AS g ON g.id = a.access')
|
||||
->where('a.id IN ('.implode(',', $cid).')');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the data of the selected images
|
||||
*
|
||||
* @return array Array of objects containing the images data from the database
|
||||
* @since 1.5.5
|
||||
*/
|
||||
public function getImages()
|
||||
{
|
||||
// Lets load the data if it doesn't already exist
|
||||
if(empty($this->_images))
|
||||
{
|
||||
$query = $this->_buildQuery();
|
||||
$this->_images = $this->_getList($query);
|
||||
}
|
||||
|
||||
return $this->_images;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the 'editimages' form
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
* @since 2.0
|
||||
*/
|
||||
public function getForm()
|
||||
{
|
||||
JForm::addFormPath(JPATH_COMPONENT.'/models/forms');
|
||||
JForm::addFieldPath(JPATH_COMPONENT.'/models/fields');
|
||||
JForm::addRulePath(JPATH_COMPONENT.'/models/rules');
|
||||
|
||||
$form = JForm::getInstance(_JOOM_OPTION.'.editimages', 'editimages');
|
||||
if(empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/favourites.php $
|
||||
// $Id: favourites.php 4318 2013-08-18 07:58:35Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Favourites model
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JoomGalleryModelFavourites extends JoomGalleryModel
|
||||
{
|
||||
/**
|
||||
* Resets all favourites in the gallery and deletes all created zips of favourites
|
||||
*
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 2.0
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
// Delete all users in the database table
|
||||
$query = $this->_db->getQuery(true)
|
||||
->delete(_JOOM_TABLE_USERS);
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
$this->setError($this->_db->getErrorMsg());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete all created zips in component directory
|
||||
if(!$this->deleteArchives())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes the entries in the users table of JoomGallery
|
||||
* with users registered and deletes all zips of favourites.
|
||||
*
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 2.0
|
||||
*/
|
||||
public function synchronize()
|
||||
{
|
||||
// Synchronize users-users
|
||||
$subquery = $this->_db->getQuery(true)
|
||||
->select('id')
|
||||
->from('#__users AS ju')
|
||||
->where('ju.id = uuserid');
|
||||
$query = $this->_db->getQuery(true)
|
||||
->delete(_JOOM_TABLE_USERS)
|
||||
->where('NOT EXISTS ('.$subquery.')');
|
||||
$this->_db->setQuery($query);
|
||||
|
||||
if(!$this->_db->query())
|
||||
{
|
||||
$this->setError($this->_db->getErrorMsg());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete all created zips in component directory
|
||||
if(!$this->deleteArchives())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all created zips of favourites
|
||||
*
|
||||
* @return boolean True on success, false otherwise
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function deleteArchives()
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$archives = JFolder::files(JPATH_COMPONENT_SITE, '.zip', false, true);
|
||||
if(!JFile::delete($archives))
|
||||
{
|
||||
$this->setError(JText::_('COM_JOOMGALLERY_MAIMAN_FV_ERROR_DELETING_ARCHIVES'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/cbaccesslevel.php $
|
||||
// $Id: cbaccesslevel.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('accesslevel');
|
||||
|
||||
/**
|
||||
* Renders a access level form field with checkbox in front of the label
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldCbAccessLevel extends JFormFieldAccessLevel
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
public $type = 'Cbaccesslevel';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup
|
||||
*
|
||||
* @return string The field label markup
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$label = '';
|
||||
|
||||
$cbname = $this->element['cbname'] ? $this->element['cbname'] : 'change[]';
|
||||
$cbvalue = $this->element['cbvalue'] ? $this->element['cbvalue'] : $this->name;
|
||||
$cbid = str_replace(array('[', ']'), array('', ''), $cbname.$cbvalue);
|
||||
$cbhtml = '<input id="'.$cbid.'" type="checkbox" name="'.$cbname.'" value="'.$cbvalue.'" />';
|
||||
$label = parent::getLabel();
|
||||
$insertpos = strpos($label, '>');
|
||||
$label = substr_replace($label, $cbhtml, $insertpos + 1, 0);
|
||||
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/cbcategory.php $
|
||||
// $Id: cbcategory.php 4384 2014-05-09 12:40:47Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('joomcategory');
|
||||
|
||||
/**
|
||||
* Renders a category select box form field with checkbox in front of the label
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldCbcategory extends JFormFieldJoomCategory
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Cbcategory';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup
|
||||
*
|
||||
* @return string The field label markup
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$label = '';
|
||||
|
||||
$cbname = $this->element['cbname'] ? $this->element['cbname'] : 'change[]';
|
||||
$cbvalue = $this->element['cbvalue'] ? $this->element['cbvalue'] : $this->name;
|
||||
$validate = $this->element['validate'] ? (string) $this->element['validate'] : '';
|
||||
$cbid = str_replace(array('[', ']'), array('', ''), $cbname.$cbvalue);
|
||||
|
||||
$cbonclick = '';
|
||||
if(!empty($validate))
|
||||
{
|
||||
$cbonclick = "if(jQuery('#".$cbid."').prop('checked')) { var el = jQuery('#".$this->id."'); el.addClass('validate-".$validate."'); el.attr('aria-required', 'true').attr('required', 'required'); } else { var el = jQuery('#".$this->id."'); el.removeClass('validate-".$validate."'); el.removeAttr('aria-required').removeAttr('required');}";
|
||||
|
||||
$js = "
|
||||
jQuery(document).ready(function() {
|
||||
".$cbonclick."
|
||||
});";
|
||||
$doc = JFactory::getDocument();
|
||||
$doc->addScriptDeclaration($js);
|
||||
}
|
||||
$cbhtml = '<input id="'.$cbid.'" type="checkbox" onclick="'.$cbonclick.'" name="'.$cbname.'" value="'.$cbvalue.'" />';
|
||||
|
||||
$label = parent::getLabel();
|
||||
$insertpos = strpos($label, '>');
|
||||
$label = substr_replace($label, $cbhtml, $insertpos + 1, 0);
|
||||
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/cbeditor.php $
|
||||
// $Id: cbeditor.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('editor');
|
||||
|
||||
/**
|
||||
* Renders a editor form field with checkbox in front of the label
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldCbeditor extends JFormFieldEditor
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
public $type = 'Cbeditor';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup
|
||||
*
|
||||
* @return string The field label markup
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$label = '';
|
||||
|
||||
$cbname = $this->element['cbname'] ? $this->element['cbname'] : 'change[]';
|
||||
$cbvalue = $this->element['cbvalue'] ? $this->element['cbvalue'] : $this->name;
|
||||
|
||||
$cbid = str_replace(array('[', ']'), array('', ''), $cbname.$cbvalue);
|
||||
$cbhtml = '<input id="'.$cbid.'" type="checkbox" name="'.$cbname.'" value="'.$cbvalue.'" />';
|
||||
$label = parent::getLabel();
|
||||
$insertpos = strpos($label, '>');
|
||||
$label = substr_replace($label, $cbhtml, $insertpos + 1, 0);
|
||||
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/cbjoomuser.php $
|
||||
// $Id: cbjoomuser.php 4327 2013-09-07 14:49:38Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('joomuser');
|
||||
|
||||
/**
|
||||
* Renders a form field for user selection with checkbox in front of the label
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldCbjoomuser extends JFormFieldJoomuser
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
public $type = 'Cbjoomuser';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup
|
||||
*
|
||||
* @return string The field label markup
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$label = '';
|
||||
|
||||
$cbname = $this->element['cbname'] ? $this->element['cbname'] : 'change[]';
|
||||
$cbvalue = $this->element['cbvalue'] ? $this->element['cbvalue'] : $this->name;
|
||||
|
||||
$cbid = str_replace(array('[', ']'), array('', ''), $cbname.$cbvalue);
|
||||
$cbhtml = '<input id="'.$cbid.'" type="checkbox" name="'.$cbname.'" value="'.$cbvalue.'" />';
|
||||
$label = $cbhtml . parent::getLabel();
|
||||
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/cblist.php $
|
||||
// $Id: cblist.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Renders a list box form field with checkbox in front of the label
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldCblist extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Cblist';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup
|
||||
*
|
||||
* @return string The field label markup
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$label = '';
|
||||
|
||||
$cbname = $this->element['cbname'] ? $this->element['cbname'] : 'change[]';
|
||||
$cbvalue = $this->element['cbvalue'] ? $this->element['cbvalue'] : $this->name;
|
||||
|
||||
$cbid = str_replace(array('[', ']'), array('', ''), $cbname.$cbvalue);
|
||||
$cbhtml = '<input id="'.$cbid.'" type="checkbox" name="'.$cbname.'" value="'.$cbvalue.'" />';
|
||||
$label = parent::getLabel();
|
||||
$insertpos = strpos($label, '>');
|
||||
$label = substr_replace($label, $cbhtml, $insertpos + 1, 0);
|
||||
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/cbtext.php $
|
||||
// $Id: cbtext.php 4384 2014-05-09 12:40:47Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('text');
|
||||
|
||||
/**
|
||||
* Renders a text form field with checkbox in front of the label
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldCbtext extends JFormFieldText
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Cbtext';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup
|
||||
*
|
||||
* @return string The field label markup
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$label = '';
|
||||
|
||||
$cbname = $this->element['cbname'] ? $this->element['cbname'] : 'change[]';
|
||||
$cbvalue = $this->element['cbvalue'] ? $this->element['cbvalue'] : $this->name;
|
||||
$cbrequired = $this->element['cbrequired'] ? (string) $this->element['cbrequired'] : 'false';
|
||||
$cbid = str_replace(array('[', ']'), array('', ''), $cbname.$cbvalue);
|
||||
|
||||
$cbonclick = '';
|
||||
if($cbrequired == 'true' || $cbrequired == 'required' || $cbrequired == '1')
|
||||
{
|
||||
$cbonclick = "javascript: var el = jQuery('#".$this->id."'); if(jQuery('#".$cbid."').prop('checked')) { el.attr('aria-required', 'true').attr('required', 'required');} else {el.removeAttr('aria-required').removeAttr('required');}";
|
||||
}
|
||||
$cbhtml = '<input id="'.$cbid.'" type="checkbox" onclick="'.$cbonclick.'" name="'.$cbname.'" value="'.$cbvalue.'" />';
|
||||
|
||||
$label = $cbhtml . parent::getLabel();
|
||||
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/cbtextarea.php $
|
||||
// $Id: cbtextarea.php 4384 2015-11-14 12:40:47Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2015 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('textarea');
|
||||
|
||||
/**
|
||||
* Renders a textarea form field with checkbox in front of the label
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.3
|
||||
*/
|
||||
class JFormFieldCbtextarea extends JFormFieldTextarea
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $type = 'Cbtextarea';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup
|
||||
*
|
||||
* @return string The field label markup
|
||||
* @since 3.3
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$label = '';
|
||||
|
||||
$cbname = $this->element['cbname'] ? $this->element['cbname'] : 'change[]';
|
||||
$cbvalue = $this->element['cbvalue'] ? $this->element['cbvalue'] : $this->name;
|
||||
$cbrequired = $this->element['cbrequired'] ? (string) $this->element['cbrequired'] : 'false';
|
||||
$cbid = str_replace(array('[', ']'), array('', ''), $cbname.$cbvalue);
|
||||
|
||||
$cbonclick = '';
|
||||
if($cbrequired == 'true' || $cbrequired == 'required' || $cbrequired == '1')
|
||||
{
|
||||
$cbonclick = "javascript: var el = jQuery('#".$this->id."'); if(jQuery('#".$cbid."').prop('checked')) { el.attr('aria-required', 'true').attr('required', 'required');} else {el.removeAttr('aria-required').removeAttr('required');}";
|
||||
}
|
||||
$cbhtml = '<input id="'.$cbid.'" type="checkbox" onclick="'.$cbonclick.'" name="'.$cbname.'" value="'.$cbvalue.'" />';
|
||||
|
||||
$label = $cbhtml . parent::getLabel();
|
||||
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/files.php $
|
||||
// $Id: files.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders form fields for uploading files
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.1
|
||||
*/
|
||||
class JFormFieldFiles extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.1
|
||||
*/
|
||||
public $type = 'Files';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup for the file fields.
|
||||
* The field attribute 'quantity' allow specification of the number of file fields to display.
|
||||
* All other field attributes are the same as for JFormFieldFile
|
||||
*
|
||||
* @return string The field input markup
|
||||
* @since 2.1
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$count = ((int) $this->element['quantity']) ? (int) $this->element['quantity'] : 10;
|
||||
|
||||
// Initialize some field attributes
|
||||
$accept = $this->element['accept'] ? ' accept="'.(string) $this->element['accept'].'"' : '';
|
||||
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
|
||||
$class = $this->element['class'] ? ' class="'.trim(str_replace('required', '', (string) $this->element['class'])).'"' : '';
|
||||
$fsclass = $this->element['fieldsetclass'] ? ' '.(string) $this->element['fieldsetclass'] : '';
|
||||
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
|
||||
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
|
||||
|
||||
$fields = array();
|
||||
for($i = 0; $i < $count; $i++)
|
||||
{
|
||||
$name = $this->name.'['.$i.']';
|
||||
$id = $this->id.$i;
|
||||
$fields[] = '<input type="file" name="'.$name.'" id="'.$id.'" value=""'.$accept.$disabled.$class.$size.$onchange.' />';
|
||||
}
|
||||
|
||||
return '<fieldset class="validate-joomfiles'.$fsclass.'" id="'.$this->id.'">'.implode('', $fields).'</fieldset>';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,382 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/fineuploader.php $
|
||||
// $Id: fineuploader.php 4076 2015-05-19 10:35:29Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2015 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a FineUploader field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.2
|
||||
*/
|
||||
class JFormFieldFineuploader extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
protected $type = 'fineuploader';
|
||||
|
||||
/**
|
||||
* Returns the HTML for the FineUploader inclusion
|
||||
*
|
||||
* @return string The HTML for the FineUploader inclusion
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$config = JoomConfig::getInstance();
|
||||
|
||||
$url = JRoute::_('index.php?option='._JOOM_OPTION.'&controller=ajaxupload&task=upload', false);
|
||||
if($app->isSite())
|
||||
{
|
||||
$url = JRoute::_('index.php?option='._JOOM_OPTION.'&task=ajaxupload.upload', false);
|
||||
}
|
||||
|
||||
$fileSizeLimit = $app->isSite() ? $config->get('jg_maxfilesize') : 0;
|
||||
$chunkSize = 0;
|
||||
$post_max_size = @ini_get('post_max_size');
|
||||
if(!empty($post_max_size))
|
||||
{
|
||||
$post_max_size = JoomHelper::iniToBytes($post_max_size);
|
||||
$chunkSize = (int) min(500000, (int)(0.8 * $post_max_size));
|
||||
}
|
||||
$upload_max_filesize = @ini_get('upload_max_filesize');
|
||||
if(!empty($upload_max_filesize))
|
||||
{
|
||||
$upload_max_filesize = JoomHelper::iniToBytes($upload_max_filesize);
|
||||
|
||||
if($fileSizeLimit <= 0 || $fileSizeLimit > $upload_max_filesize)
|
||||
{
|
||||
$fileSizeLimit = $upload_max_filesize;
|
||||
}
|
||||
}
|
||||
|
||||
$editFilename = $app->isSite() ? $config->get('jg_useruseorigfilename') : $config->get('jg_useorigfilename');
|
||||
$prefix = $this->element['field_id_prefix'];
|
||||
$isMini = $this->element['mini'] && $this->element['mini'] != 'false';
|
||||
$redirect = $this->element['redirect'];
|
||||
$insertOptions = $this->element['insert_options'] && $this->element['insert_options'] != 'false';
|
||||
$formId = $this->element['form_id'];
|
||||
$catidField = $this->element['catid_field'] ? $this->element['catid_field'] : 'catid';
|
||||
|
||||
if(!$formId)
|
||||
{
|
||||
throw new RuntimeException('Attribute \'form_id\' is required for the fineuploader field.');
|
||||
}
|
||||
|
||||
ob_start(); ?>
|
||||
<div id="fine-uploader"></div>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
var uploader = new qq.FineUploader({
|
||||
element: jQuery('#fine-uploader')[0],
|
||||
request: {
|
||||
endpoint: '<?php echo $url.'&format=raw'; ?>',
|
||||
paramsInBody: true
|
||||
},
|
||||
chunking: {
|
||||
enabled: true,
|
||||
partSize: <?php echo $chunkSize; ?>
|
||||
},
|
||||
autoUpload: false,
|
||||
display: {
|
||||
fileSizeOnSubmit: true
|
||||
},
|
||||
text: {
|
||||
failUpload: '<?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_UPLOAD_FAILED', true); ?>',
|
||||
formatProgress: '{percent}% ' + '<?php echo JText::_('COM_JOOMGALLERY_COMMON_OF', true); ?>' +' {total_size}',
|
||||
waitingForResponse: '<?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_PROCESSING', true); ?>'
|
||||
},
|
||||
failedUploadTextDisplay: {
|
||||
mode: 'custom'
|
||||
},
|
||||
dragAndDrop: {
|
||||
extraDropzones: []
|
||||
},
|
||||
fileTemplate: 'qq-template',
|
||||
classes: {
|
||||
success: 'alert-success',
|
||||
fail: 'alert-error',
|
||||
debugText: 'qq-upload-debug-text',
|
||||
thumb: 'qq-upload-thumb',
|
||||
options: 'qq-upload-options',
|
||||
note: 'qq-upload-note'
|
||||
},
|
||||
validation: {
|
||||
allowedExtensions: ['jpg', 'jpeg', 'jpe', 'gif', 'png'],
|
||||
acceptFiles: 'image/*',
|
||||
sizeLimit: <?php echo $fileSizeLimit; ?>
|
||||
},
|
||||
messages: {
|
||||
typeError: '{file}: ' + '<?php echo JText::_('COM_JOOMGALLERY_COMMON_ALERT_WRONG_EXTENSION', true); ?>',
|
||||
sizeError: '{file}: ' + '<?php echo JText::sprintf('COM_JOOMGALLERY_UPLOAD_OUTPUT_MAX_ALLOWED_FILESIZE', $fileSizeLimit, array('jsSafe' => true)) ?>',
|
||||
fileNameError: '{file}: ' + '<?php echo JText::_('COM_JOOMGALLERY_COMMON_ALERT_WRONG_FILENAME', true); ?>',
|
||||
fileNameDouble: '{file}: ' + '<?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_ALERT_FILENAME_DOUBLE', true); ?>',
|
||||
minSizeError: '{file}: ' + '<?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_ALERT_FILE_TOO_SMALL', true); ?>' + ' {minSizeLimit}.',
|
||||
emptyError: '{file} : ' + '<?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_ALERT_FILE_EMPTY', true); ?>',
|
||||
noFilesError: '<?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_ALERT_NO_FILES', true); ?>',
|
||||
onLeave: '<?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_ALERT_ON_LEAVE', true); ?>'
|
||||
},
|
||||
debug: true,
|
||||
maxConnections: 1,
|
||||
disableCancelForFormUploads: true,
|
||||
callbacks: {
|
||||
onComplete: function(id, fileName, response) {
|
||||
var item = this.getItemByFileId(id);
|
||||
<?php if($isMini):
|
||||
if($insertOptions): ?>
|
||||
// Display options if the upload was successful and if the image is published
|
||||
if(response.success && !document.id('published0').checked) {
|
||||
displayInsertOptions(this, item, fileName, response);
|
||||
}
|
||||
<?php else: ?>
|
||||
// Reload the page if published images were uploaded (so the user can see them instantly on the page)
|
||||
if(response.success && !document.id('published0').checked) {
|
||||
window.parent.SqueezeBox.addEvent('onClose', function(){window.parent.location.reload();});
|
||||
}
|
||||
<?php endif;
|
||||
endif; ?>
|
||||
if(response.debug_output) {
|
||||
var element = item.getElementsByClassName("qq-upload-debug-text-selector")[0];
|
||||
element.innerHTML = response.debug_output;
|
||||
}
|
||||
if(this.requestParams.hasOwnProperty("filecounter")) {
|
||||
this.requestParams.filecounter = this.requestParams.filecounter + 1;
|
||||
this.setParams(this.requestParams);
|
||||
}
|
||||
if(jQuery('#<?php echo $prefix; ?>generictitle').length > 0) {
|
||||
if(!jQuery('#<?php echo $prefix; ?>generictitle').prop('checked')) {
|
||||
jQuery('#<?php echo $prefix; ?>imgtitleid-' + id)<?php echo $isMini ? '.remove();' : ".attr('readonly', 'true');"; ?>
|
||||
}
|
||||
}
|
||||
<?php if($redirect): ?>
|
||||
if(response.success) {
|
||||
uploader.fileCount--;
|
||||
var redirect = '<?php echo $redirect; ?>';
|
||||
if(uploader.fileCount == 0 && redirect != '') {
|
||||
// Redirect only if all file uploads were successful
|
||||
location.href = redirect;
|
||||
}
|
||||
}
|
||||
<?php endif; ?>
|
||||
},
|
||||
onValidate: function(fileData) {
|
||||
if(!jg_filenamewithjs) {
|
||||
var searchwrongchars = /[^a-zA-Z0-9 _-]/;
|
||||
if(searchwrongchars.test(fileData.name.substr(0, fileData.name.lastIndexOf('.')))) {
|
||||
this._itemError('fileNameError', fileData.name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < this._storedIds.length; i++) {
|
||||
var fileName = this.getName(this._storedIds[i]);
|
||||
if(fileName && fileName == fileData.name) {
|
||||
this._itemError('fileNameDouble', fileData.name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
onSubmitted: function(id, fileName) {
|
||||
if(jQuery('#<?php echo $prefix; ?>generictitle').length > 0) {
|
||||
if(!jQuery('#<?php echo $prefix; ?>generictitle').prop('checked')) {
|
||||
var fileItemContainer = this.getItemByFileId(id);
|
||||
jQuery(fileItemContainer).find('.qq-upload-cancel').after('<input id="<?php echo $prefix; ?>imgtitleid-' + id +'" class="qq-edit-imgtitle qq-editing" tabindex="0" type="text" value="" placeholder="' + '<?php echo JText::_('COM_JOOMGALLERY_COMMON_ENTER_IMAGE_TITLE', true); ?>' + '" required aria-required="true">');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitleid-' + id).change(function() {
|
||||
if(jQuery(this).val().trim() != '') {
|
||||
jQuery(this).removeClass('invalid').attr('aria-invalid', 'false');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onUpload: function(id, fileName) {
|
||||
if(jQuery('#<?php echo $prefix; ?>generictitle').length > 0) {
|
||||
if(!jQuery('#<?php echo $prefix; ?>generictitle').prop('checked')) {
|
||||
this.requestParams.imgtitle = jQuery('#<?php echo $prefix; ?>imgtitleid-' + id).val();
|
||||
this.setParams(this.requestParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
jQuery('#triggerClearUploadList').click(function() {
|
||||
uploader.reset();
|
||||
jQuery('#triggerClearUploadList').addClass('hidden');
|
||||
});
|
||||
jQuery('#triggerUpload').click(function() {
|
||||
Joomla.removeMessages();
|
||||
|
||||
if(uploader._storedIds.length == 0) {
|
||||
alert('<?php echo JText::_('COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_ONE_IMAGE', true); ?>');
|
||||
return false;
|
||||
}
|
||||
var form = document.getElementById('<?php echo $formId; ?>');
|
||||
if(!document.formvalidator.isValid(form)) {
|
||||
var msg = new Array();
|
||||
msg.push('<?php echo JText::_('JGLOBAL_VALIDATION_FORM_FAILED', true);?>');
|
||||
if(form.imgtitle && form.imgtitle.hasClass('invalid')) {
|
||||
msg.push('<?php echo JText::_("COM_JOOMGALLERY_COMMON_ALERT_IMAGE_MUST_HAVE_TITLE", true);?>');
|
||||
}
|
||||
if(form.catid.hasClass('invalid')) {
|
||||
msg.push('<?php echo JText::_("COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_CATEGORY", true);?>');
|
||||
}
|
||||
alert(msg.join('\n'));
|
||||
return false;
|
||||
}
|
||||
|
||||
<?php if($isMini): ?>
|
||||
// For new upload procedure scrolling is allowed for the first image
|
||||
jg_scrolled = false;
|
||||
<?php endif; ?>
|
||||
|
||||
if(jQuery('#<?php echo $prefix; ?>generictitle').length > 0) {
|
||||
if(!jQuery('#<?php echo $prefix; ?>generictitle').prop('checked')) {
|
||||
var valid = true;
|
||||
for(var i = 0; i < uploader._storedIds.length; i++) {
|
||||
if(jQuery('#<?php echo $prefix; ?>imgtitleid-' + uploader._storedIds[i]).val().trim() == '') {
|
||||
valid = false;
|
||||
jQuery('#<?php echo $prefix; ?>imgtitleid-' + uploader._storedIds[i]).addClass('invalid').attr('aria-invalid', 'true');
|
||||
}
|
||||
}
|
||||
if(!valid) {
|
||||
alert('<?php echo JText::_("COM_JOOMGALLERY_COMMON_ALERT_IMAGE_MUST_HAVE_TITLE", true);?>');
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare request parameters
|
||||
uploader.requestParams = new Object();
|
||||
uploader.requestParams.catid = jQuery('#<?php echo $prefix.$catidField; ?>').val();
|
||||
if(jQuery('#<?php echo $prefix; ?>imgtitle').length > 0) {
|
||||
if(jQuery('#<?php echo $prefix; ?>generictitle').prop('checked')) {
|
||||
uploader.requestParams.imgtitle = jQuery('#<?php echo $prefix; ?>imgtitle').val();
|
||||
}
|
||||
}
|
||||
if(jQuery('#<?php echo $prefix; ?>filecounter').length > 0) {
|
||||
var filecounter = parseInt(jQuery('#<?php echo $prefix; ?>filecounter').val());
|
||||
if(!isNaN(filecounter)) {
|
||||
uploader.requestParams.filecounter = filecounter;
|
||||
}
|
||||
}
|
||||
<?php if(!$isMini): ?>
|
||||
uploader.requestParams.imgtext = jQuery('#<?php echo $prefix; ?>imgtext').val();
|
||||
uploader.requestParams.debug = jQuery('#<?php echo $prefix; ?>debug').prop('checked') ? 1 : 0;
|
||||
<?php if($app->isSite()): ?>
|
||||
uploader.requestParams.published = jQuery('#<?php echo $prefix; ?>published').val();
|
||||
<?php else: ?>
|
||||
uploader.requestParams.published = jQuery('#<?php echo $prefix; ?>published0').prop('checked') ? 0 : 1;
|
||||
uploader.requestParams.imgauthor = jQuery('#<?php echo $prefix; ?>imgauthor').val();
|
||||
uploader.requestParams.access = jQuery('#<?php echo $prefix; ?>access').val();
|
||||
<?php endif;
|
||||
else: ?>
|
||||
uploader.requestParams.published = jQuery('#<?php echo $prefix; ?>published0').prop('checked') ? 0 : 1;
|
||||
<?php endif; ?>
|
||||
if(jQuery('#<?php echo $prefix; ?>original_delete').length > 0) {
|
||||
uploader.requestParams.original_delete = jQuery('#<?php echo $prefix; ?>original_delete').prop('checked') ? 1 : 0;
|
||||
}
|
||||
uploader.requestParams.create_special_gif = jQuery('#<?php echo $prefix; ?>create_special_gif').prop('checked') ? 1 : 0;
|
||||
uploader.setParams(uploader.requestParams);
|
||||
uploader.fileCount = uploader._storedIds.length;
|
||||
uploader.uploadStoredFiles();
|
||||
jQuery('#triggerClearUploadList').removeClass('hidden');
|
||||
});
|
||||
if(jQuery('#<?php echo $prefix; ?>generictitle').length > 0) {
|
||||
jQuery('#<?php echo $prefix; ?>generictitle').change(function() {
|
||||
if(jQuery(this).prop('checked')) {
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').addClass('required');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').attr('aria-required', 'true').attr('required', 'required');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle-lbl').attr('aria-invalid', 'false');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').parent().parent().show(750);
|
||||
if(jQuery('#<?php echo $prefix; ?>filecounter').length > 0 ) {
|
||||
jQuery('#<?php echo $prefix; ?>filecounter').val('1');
|
||||
jQuery('#<?php echo $prefix; ?>filecounter').parent().parent().show(750);
|
||||
}
|
||||
for(var i = 0; i < uploader._storedIds.length; i++) {
|
||||
jQuery('#<?php echo $prefix; ?>imgtitleid-' + uploader._storedIds[i]).remove();
|
||||
}
|
||||
}
|
||||
else {
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').val('');
|
||||
if(jQuery('#<?php echo $prefix; ?>filecounter').length > 0 ) {
|
||||
jQuery('#<?php echo $prefix; ?>filecounter').val('');
|
||||
}
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').removeClass('required');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').removeAttr('aria-required').removeAttr('aria-invalid').removeAttr('required');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle-lbl').removeAttr('aria-invalid');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').removeClass('invalid');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle-lbl').removeClass('invalid');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitle').parent().parent().hide(750);
|
||||
if(jQuery('#<?php echo $prefix; ?>filecounter').length > 0 ) {
|
||||
jQuery('#<?php echo $prefix; ?>filecounter').parent().parent().hide(750);
|
||||
}
|
||||
for(var i = 0; i < uploader._storedIds.length; i++) {
|
||||
var fileItemContainer = uploader.getItemByFileId(uploader._storedIds[i]);
|
||||
jQuery(fileItemContainer).find('.qq-upload-cancel').after('<input id="<?php echo $prefix; ?>imgtitleid-' + uploader._storedIds[i] +'" class="qq-edit-imgtitle qq-editing" tabindex="0" type="text" value="" placeholder="' + '<?php echo JText::_('COM_JOOMGALLERY_COMMON_ENTER_IMAGE_TITLE', true); ?>' + '" required aria-required="true">');
|
||||
jQuery('#<?php echo $prefix; ?>imgtitleid-' + uploader._storedIds[i]).change(function() {
|
||||
if(jQuery(this).val().trim() != '') {
|
||||
jQuery(this).removeClass('invalid').attr('aria-invalid', 'false');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/template" id="qq-template">
|
||||
<div class="qq-uploader-selector qq-uploader span12">
|
||||
<div class="qq-upload-drop-area-selector qq-upload-drop-area span12" qq-hide-dropzone>
|
||||
<span><?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_DRAGZONETEXT', true); ?></span>
|
||||
</div>
|
||||
<div class="qq-upload-button-selector qq-upload-button btn btn-large btn-success">
|
||||
<div><i class="icon-plus icon-plus"></i> <?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_SELECT_IMAGES', true); ?></div>
|
||||
</div>
|
||||
<div class="small"><?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_DRAGNDROPHINT'); ?></div>
|
||||
<span class="qq-drop-processing-selector qq-drop-processing">
|
||||
<span><?php echo JText::_('COM_JOOMGALLERY_AJAXUPLOAD_DROPPROCESSINGTEXT', true); ?></span>
|
||||
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
|
||||
</span>
|
||||
<ul class="qq-upload-list-selector qq-upload-list">
|
||||
<li class="alert">
|
||||
<div class="qq-progress-bar-container-selector">
|
||||
<div class="qq-progress-bar-selector qq-progress-bar"></div>
|
||||
</div>
|
||||
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
|
||||
<img class="qq-thumbnail-selector thumbnail" qq-max-size="50" qq-server-scale="<?php echo !$isMini ? 'true' : 'false'; ?>">
|
||||
<?php if($editFilename) echo '<span class="qq-edit-filename-icon-selector qq-edit-filename-icon"></span>'; ?>
|
||||
<span class="qq-upload-file-selector qq-upload-file"></span>
|
||||
<?php if($editFilename) echo '<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">'; ?>
|
||||
<span class="qq-upload-size-selector qq-upload-size badge"></span>
|
||||
<a class="qq-upload-cancel-selector qq-upload-cancel btn btn-mini" href="#"><?php echo JText::_('COM_JOOMGALLERY_COMMON_CANCEL', true); ?></a>
|
||||
<span class="qq-upload-status-text-selector qq-upload-status-text"></span>
|
||||
<span class="qq-upload-debug-text-selector qq-upload-debug-text"></span>
|
||||
<?php if($isMini): ?>
|
||||
<div class="qq-upload-options-selector qq-upload-options form-horizontal hide"></div>
|
||||
<div class="qq-upload-note-selector qq-upload-note hide small center"><?php echo JText::_('COM_JOOMGALLERY_MINI_AJAX_UPLOAD_NOTE', true); ?></div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</script>
|
||||
<?php
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/ftpfiles.php $
|
||||
// $Id: ftpfiles.php 4231 2013-04-25 20:41:10Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a file selection form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.1
|
||||
*/
|
||||
class JFormFieldFtpFiles extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.1
|
||||
*/
|
||||
protected $type = 'ftpfiles';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a file selection form field.
|
||||
*
|
||||
* @return string The field input markup
|
||||
* @since 2.1
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// Get files
|
||||
$directory = (string)$this->element['directory'];
|
||||
if(!is_dir($directory))
|
||||
{
|
||||
$directory = JPATH_ROOT.'/'.$directory;
|
||||
}
|
||||
$files = JFolder::files($directory, '\.bmp$|\.gif$|\.jpg$|\.png$|\.jpeg$|\.jpe$|\.BMP$|\.GIF$|\.JPG$|\.PNG$|\.JPEG$|\.JPE$');
|
||||
if(!$files)
|
||||
{
|
||||
$files = array();
|
||||
}
|
||||
|
||||
// Create attributes
|
||||
$class = $this->element['class'] ? (string) $this->element['class'] : '';
|
||||
if($this->element['required'] && $this->element['required'] == true && strpos($class, 'required') === false)
|
||||
{
|
||||
if(!empty($class))
|
||||
{
|
||||
$class .= ' ';
|
||||
}
|
||||
$class .= 'required';
|
||||
}
|
||||
$attr = !empty($class) ? ' class="'.$class.'"' : '';
|
||||
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
|
||||
$attr .= $this->multiple ? ' multiple="multiple"' : '';
|
||||
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
|
||||
|
||||
// To avoid user's confusion, readonly="true" should imply disabled="true".
|
||||
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true')
|
||||
{
|
||||
$attr .= ' disabled="disabled"';
|
||||
}
|
||||
|
||||
// Create HTML
|
||||
$html = '<select name="'.$this->name.'"'.$attr.'>';
|
||||
foreach($files as $file)
|
||||
{
|
||||
$html .= '
|
||||
<option class="jg-file">'.$file.'</option>';
|
||||
}
|
||||
$html .= '
|
||||
</select>
|
||||
<p>
|
||||
<button onclick="$$(\'.jg-file\').each(function(el) { el.selected = true; });return false;" type="button" class="btn">'.JText::_('JGLOBAL_SELECTION_ALL').'</button>
|
||||
<button onclick="$$(\'.jg-file\').each(function(el) { el.selected = !el.selected; });return false;" type="button" class="btn">'.JText::_('JGLOBAL_SELECTION_INVERT').'</button>
|
||||
</p>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/ftpfolders.php $
|
||||
// $Id: ftpfolders.php 4231 2013-04-25 20:41:10Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a folder selection form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.1
|
||||
*/
|
||||
class JFormFieldFtpFolders extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.1
|
||||
*/
|
||||
protected $type = 'ftpfolders';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a folder selection form field.
|
||||
*
|
||||
* @return string The folder selection form field or empty string if no folder was found
|
||||
* @since 2.1
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// Get files
|
||||
$directory = (string)$this->element['directory'];
|
||||
if(!is_dir($directory))
|
||||
{
|
||||
$directory = JPath::clean(JPATH_ROOT.'/'.$directory);
|
||||
}
|
||||
$folders = JFolder::folders($directory, '.', true, true);
|
||||
|
||||
if(!$folders || !count($folders))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// Create attributes
|
||||
$class = $this->element['class'] ? (string) $this->element['class'] : '';
|
||||
if($this->element['required'] && $this->element['required'] == true && strpos($class, 'required') === false)
|
||||
{
|
||||
if(!empty($class))
|
||||
{
|
||||
$class .= ' ';
|
||||
}
|
||||
$class .= 'required';
|
||||
}
|
||||
$attr = !empty($class) ? ' class="'.$class.'"' : '';
|
||||
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
|
||||
$attr .= $this->multiple ? ' multiple="multiple"' : '';
|
||||
|
||||
if(!$this->element['onchange'])
|
||||
{
|
||||
$attr .= ' onchange="document.adminForm.task.value=\'\';document.adminForm.submit();"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$attr .= ' onchange="' . (string) $this->element['onchange'] . '"';
|
||||
}
|
||||
|
||||
// To avoid user's confusion, readonly="true" should imply disabled="true".
|
||||
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true')
|
||||
{
|
||||
$attr .= ' disabled="disabled"';
|
||||
}
|
||||
|
||||
// Create HTML
|
||||
$html = '<select name="'.$this->name.'"'.$attr.'>';
|
||||
array_unshift($folders, '');
|
||||
foreach($folders as $folder)
|
||||
{
|
||||
$folder = str_replace($directory, '', $folder).'/';
|
||||
$selected = '';
|
||||
if($folder == $this->value)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
|
||||
$html .= '
|
||||
<option'.$selected.'>'.$folder.'</option>';
|
||||
}
|
||||
$html .= '
|
||||
</select>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/image.php $
|
||||
// $Id: image.php 4383 2014-05-07 14:44:33Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders an image selection form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldImage extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Image';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a image select box form field.
|
||||
*
|
||||
* @return object The image select box form field.
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
require_once(JPATH_BASE . '/components/com_joomgallery/includes/defines.php');
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
$required = $this->required ? ' required="required"' : '';
|
||||
$validate = ($this->validate && $this->validate == 'joompositivenumeric') ? true : false;
|
||||
$class = '';
|
||||
$script = array();
|
||||
$html = array();
|
||||
$css = array();
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
if($validate)
|
||||
{
|
||||
$class = 'validate-' . $this->validate;
|
||||
|
||||
// Add a validation script for form validation
|
||||
$script[] = ' jQuery(document).ready(function() {';
|
||||
$script[] = ' document.formvalidator.setHandler("joompositivenumeric", function(value) {';
|
||||
$script[] = ' regex = /^[1-9]+[0-9]*$/;';
|
||||
$script[] = ' return regex.test(value);';
|
||||
$script[] = ' })';
|
||||
$script[] = ' });';
|
||||
}
|
||||
|
||||
// Add script for fetching the selected image in the modal dialog
|
||||
$script[] = ' function joom_selectimage(id, title, object) {';
|
||||
$script[] = ' document.getElementById(object).value = id;';
|
||||
$script[] = ' document.getElementById(object + "_name").value = title;';
|
||||
$script[] = ' jQuery("#modalSelectImage").modal("hide");';
|
||||
if($validate)
|
||||
{
|
||||
$script[] = ' document.formvalidator.validate(document.getElementById(object));';
|
||||
$script[] = ' document.formvalidator.validate(document.getElementById(object + "_name"));';
|
||||
}
|
||||
$script[] = ' }';
|
||||
|
||||
$doc->addScriptDeclaration(implode("\n", $script));
|
||||
|
||||
$doc->addStyleDeclaration(implode("\n", $css));
|
||||
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_joomgallery/tables');
|
||||
$img = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
|
||||
if($this->value)
|
||||
{
|
||||
$img->load($this->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$img->imgtitle = '';
|
||||
}
|
||||
|
||||
$link = 'index.php?option=com_joomgallery&view=mini&extended=0&format=raw&catid=0&object=' . $this->id;
|
||||
$title = htmlspecialchars($img->imgtitle, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$html[] = '<span class="input-append">';
|
||||
$html[] = '<input type="text" class="input-medium" id="' . $this->id . '_name" value="' . $title . '"' . $required . ' readonly="readonly" size="40" />';
|
||||
$html[] = '<a href="#modalSelectImage" class="btn hasTooltip" role="button" data-toggle="modal"'
|
||||
. ' title="' . JHtml::tooltipText('COM_JOOMGALLERY_LAYOUT_COMMON_CHOOSE_IMAGE') . '">'
|
||||
. '<i class="icon-image"></i> ' . JText::_('JSELECT')
|
||||
. '</a>';
|
||||
|
||||
$html[] = '</span>';
|
||||
|
||||
if($this->required)
|
||||
{
|
||||
if(!empty($class))
|
||||
{
|
||||
$class .= ' ';
|
||||
}
|
||||
$class .= 'required';
|
||||
}
|
||||
|
||||
$html[] = '<input class="' . $class . '" type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . (int) $this->value . '"/>';
|
||||
|
||||
$html[] = JHtmlBootstrap::renderModal(
|
||||
'modalSelectImage', array(
|
||||
'url' => $link . '&' . JSession::getFormToken() . '=1"',
|
||||
'title' => JText::_('COM_JOOMGALLERY_LAYOUT_COMMON_CHOOSE_IMAGE'),
|
||||
'width' => '620px',
|
||||
'height' => '390px',
|
||||
'footer' => '<a role="button" class="btn" data-dismiss="modal" aria-hidden="true">' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
|
||||
)
|
||||
);
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/imagepreview.php $
|
||||
// $Id: imagepreview.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a image preview form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldImagepreview extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Imagepreview';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a thumbnail image form field.
|
||||
*
|
||||
* @return object The thumbnail image form field.
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// Create attributes
|
||||
$class = $this->element['class'] ? (string) $this->element['class'] : '';
|
||||
$class = 'class="jg_imgpreview'.(!empty($class) ? ' '.$class : '').'"';
|
||||
|
||||
return '<img '.$class.' src="'.$this->value.'" id="'.$this->id.'" name="'.$this->name.'" border="2" alt="'.JText::_('COM_JOOMGALLERY_IMGMAN_IMAGE_PREVIEW').'">';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/joomcategory.php $
|
||||
// $Id: joomcategory.php 4381 2014-05-04 09:30:44Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a category select box form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldJoomCategory extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'JoomCategory';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a category select box form field.
|
||||
*
|
||||
* @return object The category select box form field.
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_joomgallery/includes/defines.php';
|
||||
JLoader::register('JoomExtensions', JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION.'/helpers/extensions.php');
|
||||
JLoader::register('JoomHelper', JPATH_BASE.'/components/'._JOOM_OPTION.'/helpers/helper.php');
|
||||
JLoader::register('JoomConfig', JPATH_BASE.'/components/'._JOOM_OPTION.'/helpers/config.php');
|
||||
JLoader::register('JoomAmbit', JPATH_BASE.'/components/'._JOOM_OPTION.'/helpers/ambit.php');
|
||||
JTable::addIncludePath(JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION.'/tables');
|
||||
JHTML::addIncludePath(JPATH_BASE.'/components/'._JOOM_OPTION.'/helpers/html');
|
||||
|
||||
$class = $this->element['class'] ? (string) $this->element['class'] : '';
|
||||
if($this->element['required'] && $this->element['required'] == true && strpos($class, 'required') === false)
|
||||
{
|
||||
if(!empty($class))
|
||||
{
|
||||
$class .= ' ';
|
||||
}
|
||||
$class .= 'required';
|
||||
}
|
||||
if($this->element['validate'] && (string) $this->element['validate'] == 'joompositivenumeric')
|
||||
{
|
||||
$doc = JFactory::getDocument();
|
||||
|
||||
// Add a validation script for form validation
|
||||
$js_validate = "
|
||||
jQuery(document).ready(function() {
|
||||
document.formvalidator.setHandler('joompositivenumeric', function(value) {
|
||||
regex=/^[1-9]+[0-9]*$/;
|
||||
return regex.test(value);
|
||||
})
|
||||
});";
|
||||
$doc->addScriptDeclaration($js_validate);
|
||||
// Element class needs attribute validate-...
|
||||
if(!empty($class))
|
||||
{
|
||||
$class .= ' ';
|
||||
}
|
||||
$class .= 'validate-'.(string) $this->element['validate'];
|
||||
|
||||
// Add some style to make the slect box red bordered when invalid
|
||||
$css = '
|
||||
select.invalid {
|
||||
border: 1px solid red;
|
||||
}';
|
||||
$doc->addStyleDeclaration($css);
|
||||
}
|
||||
|
||||
$attr = '';
|
||||
$attr .= !empty($class) ? ' class="'.$class.'"' : '';
|
||||
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
|
||||
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
|
||||
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
|
||||
$action = $this->element['action'] ? (string) $this->element['action'] : 'core.create';
|
||||
$exclude = $this->element['exclude'] ? (int) $this->element['exclude'] : null;
|
||||
$task = $this->element['task'] ? (int) $this->element['task'] : null;
|
||||
|
||||
$html = JHTML::_('joomselect.categorylist', $this->value, $this->name, $attr, $exclude, '- ', $task, $action, $this->id);
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/joomdatabase.php $
|
||||
// $Id: joomdatabase.php 4270 2013-05-21 14:10:18Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
JFormHelper::loadFieldClass('checkbox');
|
||||
|
||||
/**
|
||||
* Form Field class of JoomGallery.
|
||||
*
|
||||
* This renders a checkbox in the form and all remaining fields
|
||||
* for configuring a database connection to the form.
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.1
|
||||
*/
|
||||
class JFormFieldJoomDatabase extends JFormFieldCheckbox
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.1
|
||||
*/
|
||||
public $type = 'JoomDatabase';
|
||||
|
||||
/**
|
||||
* Method to get the field label markup.
|
||||
*
|
||||
* @return string The field label markup.
|
||||
* @since 3.1
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
if(!(string) $this->element['label'])
|
||||
{
|
||||
$this->element['label'] = 'COM_JOOMGALLERY_MIGMAN_FIELD_JOOMDATABASE_LABEL';
|
||||
}
|
||||
|
||||
if(!$this->description)
|
||||
{
|
||||
$this->description = 'COM_JOOMGALLERY_MIGMAN_FIELD_JOOMDATABASE_DESC';
|
||||
}
|
||||
|
||||
return parent::getLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
* Adds the remaining fields for the database connection to the form
|
||||
*
|
||||
* @return string The field input markup
|
||||
* @since 3.1
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$numberOfFields = 6;
|
||||
|
||||
$this->form->loadFile('database');
|
||||
|
||||
// Remove field 'prefix' is required
|
||||
$prefix = (string) $this->element['prefix'];
|
||||
if($prefix == 'false' || $prefix == '0')
|
||||
{
|
||||
$this->form->removeField('prefix', 'db');
|
||||
|
||||
$numberOfFields--;
|
||||
}
|
||||
|
||||
// If second database connection is required remove
|
||||
// checkbox and change 'required' field attributes
|
||||
if($this->required)
|
||||
{
|
||||
$this->form->removeField('database');
|
||||
$this->form->setFieldAttribute('db_type', 'required', 'true', 'db');
|
||||
$this->form->setFieldAttribute('db_host', 'required', 'true', 'db');
|
||||
$this->form->setFieldAttribute('db_user', 'required', 'true', 'db');
|
||||
$this->form->setFieldAttribute('db_name', 'required', 'true', 'db');
|
||||
$this->form->setFieldAttribute('prefix', 'required', 'true', 'db');
|
||||
}
|
||||
|
||||
// Create individual IDs for each of the fields
|
||||
$id = str_replace('database_', '', $this->id);
|
||||
$this->form->setFieldAttribute('enabled', 'id', 'enabled_'.$id, 'db');
|
||||
$this->form->setFieldAttribute('db_type', 'id', 'db_type_'.$id, 'db');
|
||||
$this->form->setFieldAttribute('db_host', 'id', 'db_host_'.$id, 'db');
|
||||
$this->form->setFieldAttribute('db_user', 'id', 'db_user_'.$id, 'db');
|
||||
$this->form->setFieldAttribute('db_pass', 'id', 'db_pass_'.$id, 'db');
|
||||
$this->form->setFieldAttribute('db_name', 'id', 'db_name_'.$id, 'db');
|
||||
$this->form->setFieldAttribute('prefix', 'id', 'prefix_'.$id, 'db');
|
||||
|
||||
$script = 'var group = jQuery(\'#'.$this->id.'\').parent().parent();';
|
||||
$script .= 'for(var i = 0; i < '.$numberOfFields.'; i++){group = group.next();group.toggleClass(\'hide\');}';
|
||||
|
||||
if(!$this->value && !isset($this->form->joomScriptLoaded))
|
||||
{
|
||||
JFactory::getDocument()->addScriptDeclaration('jQuery(document).ready(function(){
|
||||
if(!jQuery(\'#'.$this->id.'\').prop(\'checked\')){jQuery(\'#db_enabled_'.$id.'\').val(\'0\');
|
||||
'.$script.'}else{jQuery(\'#db_enabled_'.$id.'\').val(\'1\');}});');
|
||||
|
||||
$this->form->joomScriptLoaded = true;
|
||||
}
|
||||
|
||||
$this->element['onclick'] = $script.'jQuery(\'#db_enabled_'.$id.'\').val(1 - jQuery(\'#db_enabled_'.$id.'\').val());';
|
||||
|
||||
return parent::getInput();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/joomlist.php $
|
||||
// $Id: joomlist.php 4076 2015-09-02 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2015 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a Joomlist field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.2
|
||||
*/
|
||||
class JFormFieldJoomlist extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
protected $type = 'Joomlist';
|
||||
|
||||
/**
|
||||
* Method to get the field options.
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
foreach($this->element->children() as $option)
|
||||
{
|
||||
// Only add <option /> elements.
|
||||
if($option->getName() != 'option')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Filter requirements
|
||||
if($requires = explode(',', (string) $option['requires']))
|
||||
{
|
||||
// Requires multilanguage
|
||||
if(in_array('multilanguage', $requires) && !JLanguageMultilang::isEnabled())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Requires associations
|
||||
if(in_array('associations', $requires) && !JLanguageAssociations::isEnabled())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$value = (string) $option['value'];
|
||||
|
||||
$disabled = (string) $option['disabled'];
|
||||
$disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');
|
||||
|
||||
$disabled = $disabled || ($this->readonly && $value != $this->value);
|
||||
|
||||
// Create a new option object based on the <option /> element.
|
||||
$optionLabel = "";
|
||||
$optionLabelParts = explode(',', trim((string) $option));
|
||||
|
||||
foreach($optionLabelParts As $optionLabelPart)
|
||||
{
|
||||
$optionLabel .= ' ' . JText::alt(trim($optionLabelPart), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname));
|
||||
}
|
||||
|
||||
$tmp = JHtml::_('select.option', $value, trim($optionLabel), 'value', 'text', $disabled);
|
||||
|
||||
// Set some option attributes.
|
||||
$tmp->class = (string) $option['class'];
|
||||
|
||||
// Set some JavaScript option attributes.
|
||||
$tmp->onclick = (string) $option['onclick'];
|
||||
|
||||
// Add the option object to the result set.
|
||||
$options[] = $tmp;
|
||||
}
|
||||
|
||||
reset($options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/joomordering.php $
|
||||
// $Id: joomordering.php 4384 2014-05-09 12:40:47Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders an ordering select box form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldJoomordering extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Joomordering';
|
||||
|
||||
/**
|
||||
* Returns the HTML for an ordering select box form field
|
||||
*
|
||||
* @return object The ordering select box form field.
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$originalOrder = $this->element['originalOrder'] ? (int) $this->element['originalOrder'] : 0;
|
||||
$originalParent = $this->element['originalParent'] ? (int) $this->element['originalParent'] : 0;
|
||||
$cats = $this->element['orderings'] ? unserialize(base64_decode($this->element['orderings'])) : array();
|
||||
$parent_id = $this->element['parent_id'] ? $this->element['parent_id'] : 'parent_id';
|
||||
|
||||
$disabled = '';
|
||||
if((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true')
|
||||
{
|
||||
$disabled = ' disabled="disabled"';
|
||||
}
|
||||
|
||||
// Create all select options
|
||||
$orderings = array();
|
||||
$ordcount = array();
|
||||
$catcount = count($cats);
|
||||
for($i = 0; $i < $catcount; $i++)
|
||||
{
|
||||
if(!isset($orderings[$cats[$i]->parent_id]))
|
||||
{
|
||||
// Add entry for 'First'
|
||||
$orderings[$cats[$i]->parent_id][] = JHTML::_('select.option', 'first-child', '0 '.JText::_('JOPTION_ORDER_FIRST'));
|
||||
$ordcount[$cats[$i]->parent_id] = 0;
|
||||
}
|
||||
|
||||
$ord = ++$ordcount[$cats[$i]->parent_id];
|
||||
$orderings[$cats[$i]->parent_id][] = JHTML::_('select.option', $cats[$i]->cid, $ord.' ('.addslashes($cats[$i]->name).')');
|
||||
}
|
||||
// Add entry for 'Last'
|
||||
foreach($orderings as $key => $ordering)
|
||||
{
|
||||
$ord = ++$ordcount[$key];
|
||||
$orderings[$key][] = JHTML::_('select.option', 'last-child', $ord.' '.JText::_('JOPTION_ORDER_LAST'));
|
||||
}
|
||||
|
||||
// Create the javascript arrays with all orderings for each category
|
||||
$i = 0;
|
||||
$script = '';
|
||||
foreach($orderings as $k => $items)
|
||||
{
|
||||
foreach($items as $v)
|
||||
{
|
||||
if($k == 1)
|
||||
{
|
||||
// In Nested Sets having category with ID 1
|
||||
// as parent means being a main category
|
||||
$k = 0;
|
||||
}
|
||||
|
||||
$script .= '
|
||||
orders['.$i++.'] = new Array("'.$k.'", "'.$v->value.'", "'.$v->text.'");';
|
||||
}
|
||||
}
|
||||
|
||||
$html = '
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
var originalOrder = '.$originalOrder.';
|
||||
var originalParent = '.$originalParent.';
|
||||
var orders = new Array();'.$script.'
|
||||
writeDynaList( \'class="inputbox" name="'.$this->name.'" id="'.$this->id.'"'.$disabled.' size="1"\', orders, originalParent, originalParent, originalOrder );
|
||||
jQuery(document).ready(function() {
|
||||
document.getElementById(\''.$parent_id.'\').addEvent(\'change\', function() {
|
||||
var catid = document.getElementById(\''.$parent_id.'\').value;
|
||||
if(!catid)
|
||||
{
|
||||
catid = 0;
|
||||
}
|
||||
changeDynaList(\''.$this->name.'\', orders, catid, originalParent, originalOrder);
|
||||
jQuery(\'#'.$this->id.'\').trigger("liszt:updated");
|
||||
});
|
||||
});
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(\'#'.$parent_id.'\').bind(\'change\', function(){
|
||||
var catid = document.getElementById(\''.$parent_id.'\').value;
|
||||
if(!catid)
|
||||
{
|
||||
catid = 0;
|
||||
}
|
||||
changeDynaList(\''.$this->name.'\', orders, catid, originalParent, originalOrder);
|
||||
jQuery(\'#'.$this->id.'\').trigger("liszt:updated");
|
||||
});
|
||||
});
|
||||
//-->
|
||||
</script>
|
||||
';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/joompassword.php $
|
||||
// $Id: joompassword.php 4326 2013-09-03 22:38:43Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
JFormHelper::loadFieldClass('password');
|
||||
|
||||
/**
|
||||
* Renders a form field for encrypted passwords
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.1
|
||||
*/
|
||||
class JFormFieldJoomPassword extends JFormFieldPassword
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 3.1
|
||||
*/
|
||||
public $type = 'Joompassword';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup
|
||||
*
|
||||
* @return string The field input markup
|
||||
* @since 3.1
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
if($this->value)
|
||||
{
|
||||
// Hide password field and change its name
|
||||
$name = $this->name;
|
||||
$this->name = $this->name.'-disabled';
|
||||
$this->value = '';
|
||||
if($this->element['class'])
|
||||
{
|
||||
$this->element['class'] = $this->element['class'].' hidden';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->element['class'] = 'hidden';
|
||||
}
|
||||
|
||||
return '<span id="'.$this->id.'_info">
|
||||
<span class="label label-info hasTooltip" title="'.JText::_('COM_JOOMGALLERY_CATMAN_PASSWORD_PROTECTED_TIP').'">'.JText::_('COM_JOOMGALLERY_CATMAN_PASSWORD_PROTECTED').'</span>
|
||||
<button class="btn btn-mini hasTooltip" title="'.JText::_('COM_JOOMGALLERY_CATMAN_PASSWORD_RESET_TIP').'" onclick="jQuery(\'#'.$this->id.'\').attr(\'name\', \''.$name.'\').removeClass(\'hidden\').focus();jQuery(\'#'.$this->id.'_info\').addClass(\'hide\');return false;">
|
||||
<i class="icon-cancel"></i>
|
||||
</button>
|
||||
</span>'.parent::getInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::getInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,382 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/joomuser.php $
|
||||
// $Id: joomuser.php 4404 2014-06-26 21:23:58Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport('joomla.form.formfield');
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('user');
|
||||
|
||||
/**
|
||||
* Renders a form field for user selection
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldJoomUser extends JFormFieldUser
|
||||
{
|
||||
/**
|
||||
* The form field type
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
public $type = 'Joomuser';
|
||||
|
||||
/**
|
||||
* User count
|
||||
*
|
||||
* @var int
|
||||
* @since 3.2
|
||||
*/
|
||||
protected static $userCount = null;
|
||||
|
||||
/**
|
||||
* User list
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2
|
||||
*/
|
||||
protected static $userList = null;
|
||||
|
||||
/**
|
||||
* Use listbox for user selection until specified maximum number
|
||||
* of system users is reached, otherwise use modal popup
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2
|
||||
*/
|
||||
protected $useListboxMaxUserCount = 0;
|
||||
|
||||
/**
|
||||
* Method to get certain otherwise inaccessible properties from the form field object.
|
||||
*
|
||||
* @param string $name The property name for which to the the value.
|
||||
*
|
||||
* @return mixed The property value or null.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'useListboxMaxUserCount':
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
return parent::__get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set certain otherwise inaccessible properties of the form field object.
|
||||
*
|
||||
* @param string $name The property name for which to the the value.
|
||||
* @param mixed $value The value of the property.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'useListboxMaxUserCount':
|
||||
$this->$name = (int) $value;
|
||||
break;
|
||||
|
||||
default:
|
||||
parent::__set($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to attach a JForm object to the field.
|
||||
*
|
||||
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
|
||||
* @param mixed $value The form field value to validate.
|
||||
* @param string $group The field name group control value. This acts as as an array container for the field.
|
||||
* For example if the field has name="foo" and the group value is set to "bar" then the
|
||||
* full field name would end up being "bar[foo]".
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @see JFormField::setup()
|
||||
* @since 3.2
|
||||
*/
|
||||
public function setup(SimpleXMLElement $element, $value, $group = null)
|
||||
{
|
||||
$return = parent::setup($element, $value, $group);
|
||||
|
||||
if ($return)
|
||||
{
|
||||
$this->useListboxMaxUserCount = (int) $this->element['useListboxMaxUserCount'];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the field input markup
|
||||
*
|
||||
* @return string The field input markup
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
if($this->useListboxMaxUserCount)
|
||||
{
|
||||
// Get the number of not blocked users
|
||||
if(self::$userCount === null)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->select('COUNT(id)')
|
||||
->from('#__users');
|
||||
$db->setQuery($query);
|
||||
|
||||
self::$userCount = $db->loadResult();
|
||||
}
|
||||
|
||||
if(self::$userCount != null && (self::$userCount <= $this->useListboxMaxUserCount))
|
||||
{
|
||||
return $this->getListboxInput();
|
||||
}
|
||||
}
|
||||
|
||||
if(version_compare(JVERSION, '3.5', 'lt'))
|
||||
{
|
||||
return $this->getPopupInput();
|
||||
}
|
||||
|
||||
return parent::getInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the field input markup in the case of
|
||||
* using a listbox for user selection
|
||||
*
|
||||
* @return string The field input markup
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getListboxInput()
|
||||
{
|
||||
$options = array();
|
||||
$attr = '';
|
||||
|
||||
// Initialize some field attributes.
|
||||
$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
|
||||
$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
|
||||
$attr .= $this->multiple ? ' multiple' : '';
|
||||
$attr .= $this->required ? ' required aria-required="true"' : '';
|
||||
$attr .= $this->autofocus ? ' autofocus' : '';
|
||||
|
||||
// Initialize JavaScript field attributes.
|
||||
$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
|
||||
|
||||
if(self::$userList === null)
|
||||
{
|
||||
$config = JoomConfig::getInstance();
|
||||
$type = $config->get('jg_realname') ? 'name' : 'username';
|
||||
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->select('id AS value')
|
||||
->select($type . ' AS text')
|
||||
->from('#__users')
|
||||
->order($type . ' ASC');
|
||||
$db->setQuery($query);
|
||||
|
||||
self::$userList = $db->loadObjectList();
|
||||
}
|
||||
|
||||
$hint = (!empty($this->hint) ? $this->hint : 'COM_JOOMGALLERY_COMMON_NO_USER');
|
||||
|
||||
$options[] = JHtml::_('select.option', '', JText::_($hint));
|
||||
|
||||
if(!empty(self::$userList))
|
||||
{
|
||||
foreach(self::$userList as $user)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $user->value , $user->text);
|
||||
}
|
||||
}
|
||||
|
||||
return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the field input markup in the case of
|
||||
* using a modal popup for user selection
|
||||
*
|
||||
* @return string The field input markup
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getPopupInput()
|
||||
{
|
||||
// Initialize variables.
|
||||
$html = array();
|
||||
$groups = $this->getGroups();
|
||||
$excluded = $this->getExcluded();
|
||||
$link = 'index.php?option=com_users&view=users&layout=modal&tmpl=component&field=' . $this->id
|
||||
. (isset($groups) ? ('&groups='.base64_encode(json_encode($groups))) : '')
|
||||
. (isset($excluded) ? ('&excluded='.base64_encode(json_encode($excluded))) : '');
|
||||
$required = '';
|
||||
$hint = (!empty($this->hint) ? $this->hint : 'COM_JOOMGALLERY_COMMON_NO_USER');
|
||||
|
||||
if($this->required)
|
||||
{
|
||||
$required = ' required';
|
||||
|
||||
if(!empty($this->class))
|
||||
{
|
||||
$this->class .= ' ';
|
||||
}
|
||||
$this->class .= 'validate-SelectUser_' . $this->id;
|
||||
}
|
||||
|
||||
$attr = !empty($this->class) ? ' class="' . $this->class . '"' : '';
|
||||
$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
|
||||
$attr .= $this->required ? ' required' : '';
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
// Build the script.
|
||||
$script = array();
|
||||
|
||||
if ($this->required)
|
||||
{
|
||||
$script[] = ' jQuery(document).ready(function() {';
|
||||
$script[] = ' document.formvalidator.setHandler("SelectUser_' . $this->id . '", function(value) {';
|
||||
$script[] = ' if (value == "" || value == "' . JText::_($hint) . '") {';
|
||||
$script[] = ' return false;';
|
||||
$script[] = ' }';
|
||||
$script[] = ' return true;';
|
||||
$script[] = ' })';
|
||||
$script[] = ' });';
|
||||
}
|
||||
|
||||
$script[] = ' function jSelectUser_' . $this->id . '(id, title) {';
|
||||
$script[] = ' var old_id = document.getElementById("' . $this->id . '").value;';
|
||||
$script[] = ' if (old_id != id) {';
|
||||
$script[] = ' document.getElementById("' . $this->id . '").value = id;';
|
||||
$script[] = ' if (id == "") {';
|
||||
$script[] = ' document.getElementById("' . $this->id . '_name").value = "' . JText::_($hint, true) . '";';
|
||||
$script[] = ' }';
|
||||
$script[] = ' else {';
|
||||
$script[] = ' document.getElementById("' . $this->id . '_name").value = title;';
|
||||
$script[] = ' }';
|
||||
$script[] = ' ' . $this->onchange;
|
||||
|
||||
if ($this->required)
|
||||
{
|
||||
$script[] = ' document.formvalidator.validate(document.getElementById("' . $this->id . '"));';
|
||||
$script[] = ' document.formvalidator.validate(document.getElementById("' . $this->id . '_name"));';
|
||||
}
|
||||
|
||||
$script[] = ' }';
|
||||
$script[] = ' jQuery("#modalJoomuser").modal("hide");';
|
||||
$script[] = ' }';
|
||||
|
||||
// Add the script to the document head.
|
||||
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
|
||||
|
||||
// Create a dummy text field with the user name.
|
||||
$html[] = '<div class="input-append">';
|
||||
$html[] = ' <input type="text" id="' . $this->id . '_name"' . ' value="' . htmlspecialchars($this->loadUser(), ENT_COMPAT, 'UTF-8')
|
||||
. '"' . ' readonly' . $attr . ' />';
|
||||
|
||||
// Create the user select button.
|
||||
if ($this->readonly === false)
|
||||
{
|
||||
$html[] = '<a href="#modalJoomuser" class="btn hasTooltip" role="button" data-toggle="modal"'
|
||||
. ' title="' . JHtml::tooltipText('JLIB_FORM_CHANGE_USER') . '">'
|
||||
. '<i class="icon-user"></i></a>';
|
||||
|
||||
$html[] = JHtmlBootstrap::renderModal(
|
||||
'modalJoomuser', array(
|
||||
'url' => $link . '&' . JSession::getFormToken() . '=1"',
|
||||
'title' => JText::_('JLIB_FORM_CHANGE_USER'),
|
||||
'width' => '800px',
|
||||
'height' => '300px',
|
||||
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
|
||||
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$html[] = '</div>';
|
||||
|
||||
// Create the real field, hidden, that stores the user id.
|
||||
$html[] = '<input type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->value . '"' . $required . ' />';
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data that is going to be passed to the layout
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2
|
||||
*/
|
||||
public function getLayoutData()
|
||||
{
|
||||
// Get the basic field data
|
||||
$data = JFormField::getLayoutData();
|
||||
|
||||
$extraData = array(
|
||||
'userName' => $this->loadUser(),
|
||||
'groups' => $this->getGroups(),
|
||||
'excluded' => $this->getExcluded()
|
||||
);
|
||||
|
||||
if(empty($this->onchange))
|
||||
{
|
||||
$extraData['onchange'] = 'if (this.val() == 0) {'
|
||||
. 'setTimeout(function(){ jQuery("#' . $this->id. '").val("'
|
||||
. JText::_((!empty($this->hint) ? $this->hint : 'COM_JOOMGALLERY_COMMON_NO_USER'))
|
||||
. '"); }, 200);}';
|
||||
}
|
||||
|
||||
return array_merge($data, $extraData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the user if available.
|
||||
*
|
||||
* @return string User's name resp. user's username.
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function loadUser()
|
||||
{
|
||||
// Load the current user name if available.
|
||||
$config = JoomConfig::getInstance();
|
||||
$type = $config->get('jg_realname') ? 'name' : 'username';
|
||||
$table = JTable::getInstance('user');
|
||||
|
||||
if($this->value)
|
||||
{
|
||||
$table->load($this->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->$type = JText::_((!empty($this->hint) ? $this->hint : 'COM_JOOMGALLERY_COMMON_NO_USER'));
|
||||
$this->value = '';
|
||||
}
|
||||
|
||||
return $table->$type;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/jupload.php $
|
||||
// $Id: jupload.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a JUpload applet field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.1
|
||||
*/
|
||||
class JFormFieldJupload extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.1
|
||||
*/
|
||||
protected $type = 'jupload';
|
||||
|
||||
/**
|
||||
* Returns the HTML for the JUpload applet inclusion
|
||||
*
|
||||
* @return string The HTML for the JUpload applet inclusion
|
||||
* @since 2.1
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$config = JoomConfig::getInstance();
|
||||
|
||||
// Check the php.ini setting 'session.cookie_httponly'
|
||||
// If set and = 1 then build the parameter 'readCookieFrom Navigator=false'
|
||||
// in Applet (new since V 4.2.1c)
|
||||
// and provide the cookie with sessionname=token in parameter 'specificHeaders'
|
||||
$cookieNavigator = true;
|
||||
$sesscook = @ini_get('session.cookie_httponly');
|
||||
if(!empty($sesscook) && $sesscook == 1)
|
||||
{
|
||||
$cookieNavigator = false;
|
||||
// Get the current session
|
||||
$currentSession = JSession::getInstance('', array());
|
||||
$sessionname = $currentSession->getName();
|
||||
// Function getToken() delivers wrong token, so get the right one
|
||||
// from $_COOKIE array (since PHP 4.1.0)
|
||||
$sessiontoken = $_COOKIE[$sessionname];
|
||||
}
|
||||
|
||||
ob_start(); ?>
|
||||
<!-- --------------------------------------------------------------------------------------------------- -->
|
||||
<!-- -------- A DUMMY APPLET, THAT ALLOWS THE NAVIGATOR TO CHECK THAT JAVA IS INSTALLED ---------- -->
|
||||
<!-- -------- If no Java: Java installation is prompted to the user. ---------- -->
|
||||
<!-- --------------------------------------------------------------------------------------------------- -->
|
||||
<!--"CONVERTED_APPLET"-->
|
||||
<!-- HTML CONVERTER -->
|
||||
<script language="JavaScript" type="text/javascript"><!--
|
||||
var _info = navigator.userAgent;
|
||||
var _ns = false;
|
||||
var _ns6 = false;
|
||||
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
|
||||
//--></script>
|
||||
<comment>
|
||||
<script language="JavaScript" type="text/javascript"><!--
|
||||
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
|
||||
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
|
||||
//--></script>
|
||||
</comment>
|
||||
|
||||
<script language="JavaScript" type="text/javascript"><!--
|
||||
if (_ie == true) document.writeln('<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "0" HEIGHT = "0" NAME = "JUploadApplet" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=5,0,0,3"><noembed><xmp>');
|
||||
else if (_ns == true && _ns6 == false) document.writeln('<embed ' +
|
||||
'type="application/x-java-applet;version=1.5" \
|
||||
CODE = "wjhk.jupload2.EmptyApplet" \
|
||||
ARCHIVE = "<?php echo JURI::root(); ?>media/joomgallery/java/wjhk.jupload.jar" \
|
||||
NAME = "JUploadApplet" \
|
||||
WIDTH = "0" \
|
||||
HEIGHT = "0" \
|
||||
type ="application/x-java-applet;version=1.6" \
|
||||
scriptable ="false" ' +
|
||||
'scriptable=false ' +
|
||||
'pluginspage="http://java.sun.com/products/plugin/index.html#download"><noembed><xmp>');
|
||||
//--></script>
|
||||
<applet code = "wjhk.jupload2.EmptyApplet" ARCHIVE = "<?php echo JURI::root(); ?>media/joomgallery/java/wjhk.jupload.jar" WIDTH = "0" HEIGHT = "0" NAME = "JUploadApplet"></xmp>
|
||||
<param name = CODE VALUE = "wjhk.jupload2.EmptyApplet" >
|
||||
<param name = ARCHIVE VALUE = "<?php echo JURI::root(); ?>media/joomgallery/java/wjhk.jupload.jar" >
|
||||
<param name = NAME VALUE = "JUploadApplet" >
|
||||
<param name = "type" value="application/x-java-applet;version=1.5">
|
||||
<param name = "scriptable" value="false">
|
||||
<param name = "type" VALUE="application/x-java-applet;version=1.6">
|
||||
<param name = "scriptable" VALUE="false">
|
||||
</xmp>
|
||||
Java 1.5 or higher plugin required.
|
||||
</applet>
|
||||
</noembed>
|
||||
</embed>
|
||||
</object>
|
||||
|
||||
<applet name="JUpload" code="wjhk.jupload2.JUploadApplet" archive="<?php echo JURI::root(); ?>media/joomgallery/java/wjhk.jupload.jar" width="100%" height="400" mayscript>
|
||||
<?php if($app->isSite()): ?>
|
||||
<param name="postURL" value="<?php echo JURI::root(); ?>index.php?option=<?php echo _JOOM_OPTION; ?>&task=upload.upload&type=java">
|
||||
<?php else: ?>
|
||||
<param name="postURL" value="<?php echo JURI::root(); ?>administrator/index.php?option=<?php echo _JOOM_OPTION; ?>&controller=jupload&task=upload">
|
||||
<?php endif; ?>
|
||||
<param name="lookAndFeel" value="system">
|
||||
<param name="showLogWindow" value="false">
|
||||
<param name="showStatusBar" value="true">
|
||||
<?php if($app->isSite()): ?>
|
||||
<param name="formdata" value="JavaUploadForm">
|
||||
<?php else: ?>
|
||||
<param name="formdata" value="adminForm">
|
||||
<?php endif; ?>
|
||||
<param name="debugLevel" value="0">
|
||||
<?php if($app->isSite()): ?>
|
||||
<param name="afterUploadURL" value="<?php echo JRoute::_('index.php?task=upload.concludejavaupload'); ?>">
|
||||
<?php else: ?>
|
||||
<param name="afterUploadURL" value="javascript:alert('<?php echo JText::_('COM_JOOMGALLERY_UPLOAD_OUTPUT_UPLOAD_COMPLETE', true); ?>');">
|
||||
<?php endif; ?>
|
||||
<param name="nbFilesPerRequest" value="1">
|
||||
<param name="stringUploadSuccess" value="JOOMGALLERYUPLOADSUCCESS">
|
||||
<param name="stringUploadError" value="JOOMGALLERYUPLOADERROR (.*)">
|
||||
<param name="uploadPolicy" value="PictureUploadPolicy">
|
||||
<param name="allowedFileExtensions" value="jpg/jpeg/jpe/png/gif">
|
||||
<param name="pictureTransmitMetadata" value="true">
|
||||
<?php if((($app->isSite() && $config->get('jg_delete_original_user') == 1) || ($app->isAdmin() && $config->get('jg_delete_original') == 1)) && $config->get('jg_resizetomaxwidth')): ?>
|
||||
<param name="maxPicHeight" value="<?php echo $config->get('jg_maxwidth'); ?>">
|
||||
<param name="maxPicWidth" value="<?php echo $config->get('jg_maxwidth'); ?>">
|
||||
<param name="pictureCompressionQuality" value="<?php echo ($config->get('jg_picturequality')/100); ?>">
|
||||
<?php else:?>
|
||||
<param name="pictureCompressionQuality" value="0.8">
|
||||
<?php endif; ?>
|
||||
<param name="fileChooserImagePreview" value="false">
|
||||
<param name="fileChooserIconFromFileContent" value="-1">
|
||||
<?php if(!$cookieNavigator): ?>
|
||||
<param name="readCookieFromNavigator" value="false">
|
||||
<param name="specificHeaders" value="Cookie: <?php echo $sessionname.'='.$sessiontoken; ?>">
|
||||
<?php endif; ?>
|
||||
Java 1.5 or higher plugin required.
|
||||
</applet>
|
||||
<?php
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/openimage.php $
|
||||
// $Id: openimage.php 4342 2013-11-10 17:25:31Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Renders a select box form field for choosing an OpenImage method
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 3.0
|
||||
*/
|
||||
class JFormFieldOpenimage extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.0
|
||||
*/
|
||||
protected $type = 'Openimage';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a OpenImage select box form field.
|
||||
*
|
||||
* @return string The OpenImage select box form field.
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
JHtml::addIncludePath(JPATH_BASE.'/components/com_joomgallery/helpers/html');
|
||||
|
||||
$class = $this->element['class'] ? (string) $this->element['class'] : '';
|
||||
if($this->element['required'] && $this->element['required'] == true && strpos($class, 'required') === false)
|
||||
{
|
||||
if(!empty($class))
|
||||
{
|
||||
$class .= ' ';
|
||||
}
|
||||
$class .= 'required';
|
||||
}
|
||||
|
||||
$attr = '';
|
||||
$attr .= !empty($class) ? ' class="'.$class.'"' : '';
|
||||
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
|
||||
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
|
||||
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
|
||||
|
||||
$detail = true;
|
||||
if((string) $this->element['detail'] == 'false')
|
||||
{
|
||||
$detail = false;
|
||||
}
|
||||
|
||||
$default = false;
|
||||
if((string) $this->element['defaultMethod'] == 'true')
|
||||
{
|
||||
$default = true;
|
||||
}
|
||||
|
||||
$prefix = 'COM_JOOMGALLERY_CONFIG_CV_GS_';
|
||||
if($this->element['prefix'])
|
||||
{
|
||||
$prefix = (string) $this->element['prefix'];
|
||||
}
|
||||
|
||||
return JHtml::_('joomselect.openimage', $this->name, $this->value, $detail, $default, $prefix, $attr, parent::getOptions());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/thumbnail.php $
|
||||
// $Id: thumbnail.php 4201 2013-04-15 21:35:52Z chraneco $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a thumbnail selection form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldThumbnail extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Thumbnail';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a thumbnail selection form field.
|
||||
*
|
||||
* @return object The thumbnail selection form field.
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$db = JFactory::getDBO();
|
||||
$doc = JFactory::getDocument();
|
||||
$imagelib_id = $this->element['imagelib_id'] ? $this->element['imagelib_id'] : 'imagelib';
|
||||
$script = array();
|
||||
$html = array();
|
||||
$css = array();
|
||||
$catid = 0;
|
||||
|
||||
if($app->isAdmin())
|
||||
{
|
||||
// Get category id from request
|
||||
$cids = JRequest::getVar('cid', array(), '', 'array');
|
||||
|
||||
if(isset($cids[0]))
|
||||
{
|
||||
$catid = intval($cids[0]);
|
||||
}
|
||||
|
||||
// Prepare the path for the thumbnail preview
|
||||
$path = JRoute::_('index.php?option=' . _JOOM_OPTION . '&controller=images&view=image&format=raw&type=thumb', false) . '&cid=';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get category id from request
|
||||
$catid = JRequest::getInt('catid', 0);
|
||||
|
||||
// Prepare the path for the thumbnail preview
|
||||
$path = JRoute::_('index.php?option=' . _JOOM_OPTION . '&view=image&format=raw&type=thumb', false) . '&id=';
|
||||
}
|
||||
|
||||
$script[] = ' function joom_selectimage(id, title, object, filename) {';
|
||||
$script[] = ' document.getElementById(object + "_id").value = id;';
|
||||
$script[] = ' document.getElementById(object + "_name").value = title;';
|
||||
$script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");';
|
||||
$script[] = ' if(id != "") {';
|
||||
$script[] = ' document.getElementById("' . $imagelib_id . '").src = "' . $path . '" + id';
|
||||
$script[] = ' } else {';
|
||||
$script[] = ' document.getElementById("' . $imagelib_id . '").src = "' . JURI::root(true) . '/media/system/images/blank.png";';
|
||||
$script[] = ' }';
|
||||
$script[] = ' jQuery("#modalSelectThumbnail").modal("hide");';
|
||||
$script[] = ' }';
|
||||
$script[] = ' function joom_clearthumb() {';
|
||||
$script[] = ' jQuery("#' . $this->id . '_clear").addClass("hidden");';
|
||||
$script[] = ' document.getElementById("' . $this->id . '_id").value = 0;';
|
||||
$script[] = ' document.getElementById("' . $this->id . '_name").value = "-";';
|
||||
$script[] = ' document.getElementById("' . $imagelib_id . '").src = "' . JURI::root(true) . '/media/system/images/blank.png";';
|
||||
$script[] = ' return false';
|
||||
$script[] = ' }';
|
||||
|
||||
$doc->addScriptDeclaration(implode("\n", $script));
|
||||
|
||||
$doc->addStyleDeclaration(implode("\n", $css));
|
||||
|
||||
// Get the image title
|
||||
$img = JTable::getInstance('joomgalleryimages', 'Table');
|
||||
|
||||
if(!empty($this->value))
|
||||
{
|
||||
$img->load($this->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$img->imgtitle = '-';
|
||||
}
|
||||
|
||||
$title = htmlspecialchars($img->imgtitle, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$link = 'index.php?option=com_joomgallery&view=mini&extended=0&prefix=joom&format=raw&object='
|
||||
. $this->id . '&type=category&catid=' . $catid;
|
||||
|
||||
$html[] = '<span class="input-append">';
|
||||
$html[] = '<input type="text" class="input-medium" id="' . $this->id . '_name" value="' . $title . '"'
|
||||
. ' readonly="readonly" disabled="disabled" size="35" />';
|
||||
$html[] = '<a href="#modalSelectThumbnail" class="btn hasTooltip" role="button" data-toggle="modal"'
|
||||
. ' title="'
|
||||
. ($app->isAdmin() ? JHtml::tooltipText('COM_JOOMGALLERY_CATMAN_SELECT_THUMBNAIL_TIP') : JHtml::tooltipText('COM_JOOMGALLERY_COMMON_SELECT_THUMBNAIL_TIP')) . '">'
|
||||
. '<i class="icon-image"></i> '
|
||||
. ($app->isAdmin() ? JText::_('COM_JOOMGALLERY_CATMAN_SELECT_THUMBNAIL') : JText::_('COM_JOOMGALLERY_COMMON_SELECT'))
|
||||
. '</a>';
|
||||
|
||||
$html[] = '<button id="' . $this->id . '_clear" class="btn' . ($this->value ? '' : ' hidden') . ' hasTooltip" title="'
|
||||
. ($app->isAdmin() ? JHtml::tooltipText('COM_JOOMGALLERY_CATMAN_REMOVE_CATTHUMB_TIP') : JHtml::tooltipText('COM_JOOMGALLERY_COMMON_REMOVE_CATTHUMB_TIP'))
|
||||
. '" onclick="return joom_clearthumb()"><span class="icon-remove"></span></button>';
|
||||
|
||||
$html[] = '</span>';
|
||||
$html[] = '<input type="hidden" id="' . $this->id . '_id" name="' . $this->name . '" value="' . $this->value . '"/>';
|
||||
|
||||
$html[] = JHtmlBootstrap::renderModal(
|
||||
'modalSelectThumbnail', array(
|
||||
'url' => $link . '&' . JSession::getFormToken() . '=1"',
|
||||
'title' => ($app->isAdmin() ? JText::_('COM_JOOMGALLERY_CATMAN_SELECT_THUMBNAIL_TIP') : JText::_('COM_JOOMGALLERY_COMMON_SELECT_THUMBNAIL_TIP')),
|
||||
'width' => '620px',
|
||||
'height' => '390px',
|
||||
'footer' => '<a role="button" class="btn" data-dismiss="modal" aria-hidden="true">' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
|
||||
)
|
||||
);
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// $HeadURL: https://joomgallery.org/svn/joomgallery/JG-3/JG/trunk/administrator/components/com_joomgallery/models/fields/thumbnailpreview.php $
|
||||
// $Id: thumbnailpreview.php 4076 2013-02-12 10:35:29Z erftralle $
|
||||
/****************************************************************************************\
|
||||
** JoomGallery 3 **
|
||||
** By: JoomGallery::ProjectTeam **
|
||||
** Copyright (C) 2008 - 2013 JoomGallery::ProjectTeam **
|
||||
** Based on: JoomGallery 1.0.0 by JoomGallery::ProjectTeam **
|
||||
** Released under GNU GPL Public License **
|
||||
** License: http://www.gnu.org/copyleft/gpl.html or have a look **
|
||||
** at administrator/components/com_joomgallery/LICENSE.TXT **
|
||||
\****************************************************************************************/
|
||||
|
||||
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
|
||||
|
||||
/**
|
||||
* Renders a thumbnail preview form field
|
||||
*
|
||||
* @package JoomGallery
|
||||
* @since 2.0
|
||||
*/
|
||||
class JFormFieldThumbnailpreview extends JFormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 2.0
|
||||
*/
|
||||
protected $type = 'Thumbnailpreview';
|
||||
|
||||
/**
|
||||
* Returns the HTML for a thumbnail preview form field.
|
||||
*
|
||||
* @return object The thumbnail preview form field.
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// Create attributes
|
||||
$class = $this->element['class'] ? (string) $this->element['class'] : '';
|
||||
$class = !empty($class) ? ' class="'.$class.'"' : '';
|
||||
|
||||
return '<img '.$class.' src="'.$this->value.'" id="'.$this->id.'" name="'.$this->name.'" border="2" alt="'.JText::_('COM_JOOMGALLERY_COMMON_THUMBNAIL_PREVIEW').'">';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields>
|
||||
<fieldset
|
||||
addfieldpath="administrator/components/com_joomgallery/models/fields"
|
||||
addrulepath="administrator/components/com_joomgallery/models/rules"
|
||||
>
|
||||
<field
|
||||
name="catid"
|
||||
type="joomcategory"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_COMMON_CATEGORY"
|
||||
message="COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_CATEGORY"
|
||||
validate="joompositivenumeric"
|
||||
required="true"
|
||||
action="joom.upload"
|
||||
/>
|
||||
<field
|
||||
id="generictitle"
|
||||
name="generictitle"
|
||||
type="checkbox"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_AJAXUPLOAD_GENERICTITLE_MODE"
|
||||
description="COM_JOOMGALLERY_AJAXUPLOAD_GENERICTITLE_MODE_DESC"
|
||||
checked="true"
|
||||
/>
|
||||
<field
|
||||
name="filecounter"
|
||||
type="text"
|
||||
default="1"
|
||||
class="inputbox validate-numeric span2"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_COUNTER_NUMBER"
|
||||
description="COM_JOOMGALLERY_UPLOAD_COUNTER_NUMBER_ASTERISK"
|
||||
/>
|
||||
<field
|
||||
name="imgtitle"
|
||||
type="text"
|
||||
class="inputbox span12"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_GENERIC_TITLE"
|
||||
message="COM_JOOMGALLERY_COMMON_ALERT_IMAGE_MUST_HAVE_TITLE"
|
||||
required="true"
|
||||
/>
|
||||
<field
|
||||
name="imgtext"
|
||||
type="textarea"
|
||||
class="inputbox span12"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_GENERIC_DESCRIPTION_OPTIONAL"
|
||||
/>
|
||||
<field
|
||||
name="imgauthor"
|
||||
type="text"
|
||||
class="inputbox span12"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_COMMON_AUTHOR"
|
||||
/>
|
||||
<field
|
||||
name="published"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
labelclass="control-label"
|
||||
default="1"
|
||||
label="COM_JOOMGALLERY_COMMON_PUBLISHED"
|
||||
size="1"
|
||||
>
|
||||
<option value="0">
|
||||
JNO</option>
|
||||
<option value="1">
|
||||
JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="COM_JOOMGALLERY_COMMON_ACCESS"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
size="1"
|
||||
/>
|
||||
<field
|
||||
name="original_delete"
|
||||
type="checkbox"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_DELETE_ORIGINAL_AFTER_UPLOAD"
|
||||
description="COM_JOOMGALLERY_UPLOAD_DELETE_ORIGINAL_AFTER_UPLOAD_ASTERISK"
|
||||
value="1"
|
||||
/>
|
||||
<field
|
||||
name="create_special_gif"
|
||||
type="checkbox"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_CREATE_SPECIAL_GIF"
|
||||
description="COM_JOOMGALLERY_UPLOAD_CREATE_SPECIAL_GIF_ASTERISK"
|
||||
value="1"
|
||||
/>
|
||||
<field
|
||||
name="debug"
|
||||
type="checkbox"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_DEBUG_MODE"
|
||||
description="COM_JOOMGALLERY_UPLOAD_DEBUG_MODE_ASTERISK"
|
||||
value="1"
|
||||
/>
|
||||
<field
|
||||
name="ajaxupload"
|
||||
type="fineuploader"
|
||||
form_id="upload-form"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields>
|
||||
<fieldset
|
||||
addfieldpath="administrator/components/com_joomgallery/models/fields"
|
||||
addrulepath="administrator/components/com_joomgallery/models/rules"
|
||||
>
|
||||
<field
|
||||
name="zippack"
|
||||
type="file"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_BATCH_ZIP_FILE"
|
||||
description="COM_JOOMGALLERY_UPLOAD_BATCH_ZIP_FILE_DESC"
|
||||
required="true"
|
||||
/>
|
||||
<field
|
||||
name="catid"
|
||||
type="joomcategory"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_COMMON_CATEGORY"
|
||||
message="COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_CATEGORY"
|
||||
validate="joompositivenumeric"
|
||||
required="true"
|
||||
action="joom.upload"
|
||||
/>
|
||||
<field
|
||||
name="filecounter"
|
||||
type="text"
|
||||
default="1"
|
||||
class="inputbox validate-numeric span2"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_COUNTER_NUMBER"
|
||||
description="COM_JOOMGALLERY_UPLOAD_COUNTER_NUMBER_ASTERISK"
|
||||
size="5"
|
||||
/>
|
||||
<field
|
||||
name="imgtitle"
|
||||
type="text"
|
||||
class="inputbox span12"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_GENERIC_TITLE"
|
||||
message="COM_JOOMGALLERY_COMMON_ALERT_IMAGE_MUST_HAVE_TITLE"
|
||||
required="true"
|
||||
/>
|
||||
<field
|
||||
name="imgtext"
|
||||
type="textarea"
|
||||
class="inputbox span12"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_GENERIC_DESCRIPTION_OPTIONAL"
|
||||
/>
|
||||
<field
|
||||
name="imgauthor"
|
||||
type="text"
|
||||
class="inputbox span12"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_COMMON_AUTHOR"
|
||||
/>
|
||||
<field
|
||||
name="published"
|
||||
type="radio"
|
||||
class="inputbox btn-group"
|
||||
labelclass="control-label"
|
||||
default="1"
|
||||
label="COM_JOOMGALLERY_COMMON_PUBLISHED"
|
||||
size="1"
|
||||
>
|
||||
<option value="0">
|
||||
JNO</option>
|
||||
<option value="1">
|
||||
JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="COM_JOOMGALLERY_COMMON_ACCESS"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
size="1"
|
||||
/>
|
||||
<field
|
||||
name="original_delete"
|
||||
type="checkbox"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_DELETE_ORIGINAL_AFTER_UPLOAD"
|
||||
description="COM_JOOMGALLERY_UPLOAD_DELETE_ORIGINAL_AFTER_UPLOAD_ASTERISK"
|
||||
value="1"
|
||||
/>
|
||||
<field
|
||||
name="create_special_gif"
|
||||
type="checkbox"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_CREATE_SPECIAL_GIF"
|
||||
description="COM_JOOMGALLERY_UPLOAD_CREATE_SPECIAL_GIF_ASTERISK"
|
||||
value="1"
|
||||
/>
|
||||
<field
|
||||
name="debug"
|
||||
type="checkbox"
|
||||
class="inputbox"
|
||||
labelclass="control-label"
|
||||
label="COM_JOOMGALLERY_UPLOAD_DEBUG_MODE"
|
||||
description="COM_JOOMGALLERY_UPLOAD_DEBUG_MODE_ASTERISK"
|
||||
value="1"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
@ -0,0 +1,211 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field
|
||||
name="cid"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_JOOMGALLERY_CATMAN_CATEGORY_ID"
|
||||
size="20"
|
||||
readonly="true"
|
||||
/>
|
||||
<field
|
||||
name="asset_id"
|
||||
type="hidden"
|
||||
filter="unset"
|
||||
/>
|
||||
<field
|
||||
type="text"
|
||||
class="inputbox"
|
||||
name="name"
|
||||
id="jform_title"
|
||||
label="COM_JOOMGALLERY_COMMON_TITLE"
|
||||
maxLength="255"
|
||||
required="true"
|
||||
message="COM_JOOMGALLERY_CATMAN_ALERT_CATEGORY_MUST_HAVE_TITLE"
|
||||
/>
|
||||
<field
|
||||
type="text"
|
||||
class="inputbox"
|
||||
name="alias"
|
||||
id="alias"
|
||||
label="COM_JOOMGALLERY_COMMON_ALIAS"
|
||||
description="COM_JOOMGALLERY_CATMAN_ALIAS_TIP"
|
||||
maxLength="255"
|
||||
/>
|
||||
<field
|
||||
class="inputbox"
|
||||
type="joomcategory"
|
||||
name="parent_id"
|
||||
id="parent_id"
|
||||
label="COM_JOOMGALLERY_COMMON_PARENT_CATEGORY"
|
||||
size="1"
|
||||
/>
|
||||
<field
|
||||
id="published"
|
||||
name="published"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="COM_JOOMGALLERY_COMMON_PUBLISHED"
|
||||
size="1"
|
||||
>
|
||||
<option value="0">
|
||||
JNO</option>
|
||||
<option value="1">
|
||||
JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="COM_JOOMGALLERY_COMMON_ACCESS"
|
||||
description="COM_JOOMGALLERY_CATMAN_ACCESS_TIP"
|
||||
class="inputbox"
|
||||
size="1"
|
||||
/>
|
||||
<field
|
||||
id="exclude_toplists"
|
||||
name="exclude_toplists"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="COM_JOOMGALLERY_CATMAN_EXCLUDE_FROM_TOPLISTS"
|
||||
description="COM_JOOMGALLERY_CATMAN_EXCLUDE_FROM_TOPLISTS_TIP"
|
||||
>
|
||||
<option value="0">
|
||||
JNO</option>
|
||||
<option value="1">
|
||||
JYES</option>
|
||||
</field>
|
||||
<field
|
||||
id="exclude_search"
|
||||
name="exclude_search"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="COM_JOOMGALLERY_CATMAN_EXCLUDE_FROM_SEARCH"
|
||||
description="COM_JOOMGALLERY_CATMAN_EXCLUDE_FROM_SEARCH_TIP"
|
||||
>
|
||||
<option value="0">
|
||||
JNO</option>
|
||||
<option value="1">
|
||||
JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="description"
|
||||
type="editor"
|
||||
label="COM_JOOMGALLERY_COMMON_DESCRIPTION"
|
||||
class="inputbox"
|
||||
filter="JComponentHelper::filterText"
|
||||
buttons="true"
|
||||
hide="readmore,pagebreak"
|
||||
/>
|
||||
<field
|
||||
name="publishhiddenstate"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_JOOMGALLERY_COMMON_STATE"
|
||||
readonly="true"
|
||||
disabled="true"
|
||||
/>
|
||||
<field
|
||||
name="notice"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_JOOMGALLERY_COMMON_NOTICE"
|
||||
readonly="true"
|
||||
disabled="true"
|
||||
/>
|
||||
<field
|
||||
name="imagelib"
|
||||
type="thumbnailpreview"
|
||||
label="COM_JOOMGALLERY_COMMON_THUMBNAIL_PREVIEW"
|
||||
/>
|
||||
<field
|
||||
id="jform_rules"
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="JFIELD_RULES_LABEL"
|
||||
translate_label="false"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
class="inputbox"
|
||||
component="com_joomgallery"
|
||||
section="category"
|
||||
/>
|
||||
<field
|
||||
name="owner"
|
||||
type="joomuser"
|
||||
label="COM_JOOMGALLERY_COMMON_OWNER"
|
||||
description="COM_JOOMGALLERY_COMMON_OWNER_DESC"
|
||||
/>
|
||||
<field
|
||||
name="hidden"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="COM_JOOMGALLERY_CATMAN_HIDDEN"
|
||||
description="COM_JOOMGALLERY_CATMAN_HIDDEN_TIP"
|
||||
>
|
||||
<option value="0">
|
||||
JNO</option>
|
||||
<option value="1">
|
||||
JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="password"
|
||||
type="joompassword"
|
||||
strengthmeter="true"
|
||||
autocomplete="off"
|
||||
class="inputbox"
|
||||
label="COM_JOOMGALLERY_CATMAN_PASSWORD"
|
||||
description="COM_JOOMGALLERY_CATMAN_PASSWORD_TIP"
|
||||
/>
|
||||
<field
|
||||
name="ordering"
|
||||
type="joomordering"
|
||||
class="inputbox"
|
||||
default=""
|
||||
label="COM_JOOMGALLERY_CATMAN_ORDERING"
|
||||
description="COM_JOOMGALLERY_CATMAN_ORDERING_TIP"
|
||||
/>
|
||||
<field
|
||||
name="thumbnail"
|
||||
type="thumbnail"
|
||||
default=""
|
||||
label="COM_JOOMGALLERY_COMMON_THUMBNAIL"
|
||||
description="COM_JOOMGALLERY_CATMAN_THUMBNAIL_TIP"
|
||||
/>
|
||||
<field
|
||||
name="img_position"
|
||||
type="list"
|
||||
default="-1"
|
||||
label="COM_JOOMGALLERY_CATMAN_THUMBNAIL_ALIGN"
|
||||
description="COM_JOOMGALLERY_CATMAN_THUMBNAIL_ALIGN_TIP"
|
||||
>
|
||||
<option value="-1">
|
||||
JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">
|
||||
COM_JOOMGALLERY_COMMON_OPTION_FLUSH_LEFT</option>
|
||||
<option value="1">
|
||||
COM_JOOMGALLERY_COMMON_OPTION_FLUSH_RIGHT</option>
|
||||
<option value="2">
|
||||
COM_JOOMGALLERY_COMMON_OPTION_CENTERED</option>
|
||||
</field>
|
||||
<field
|
||||
name="metadesc"
|
||||
type="textarea"
|
||||
rows="5"
|
||||
cols="40"
|
||||
default=""
|
||||
label="COM_JOOMGALLERY_COMMON_METADESC"
|
||||
description="COM_JOOMGALLERY_COMMON_METADESC_TIP"
|
||||
/>
|
||||
<field
|
||||
name="metakey"
|
||||
type="textarea"
|
||||
rows="5"
|
||||
cols="40"
|
||||
default=""
|
||||
label="COM_JOOMGALLERY_COMMON_METAKEYS"
|
||||
description="COM_JOOMGALLERY_COMMON_METAKEYS_TIP"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
||||
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="db">
|
||||
<fieldset>
|
||||
<field
|
||||
name="db_type"
|
||||
type="databaseconnection"
|
||||
id="db_type"
|
||||
class="inputbox"
|
||||
label="COM_JOOMGALLERY_MIGMAN_FIELD_TYPE_LABEL"
|
||||
description="COM_JOOMGALLERY_MIGMAN_FIELD_TYPE_DESC"
|
||||
supported="mysql,mysqli,postgresql,sqlsrv,sqlazure"
|
||||
default="mysqli"
|
||||
filter="string"
|
||||
/>
|
||||
<field
|
||||
name="db_host"
|
||||
type="text"
|
||||
id="db_host"
|
||||
class="inputbox"
|
||||
label="COM_JOOMGALLERY_MIGMAN_FIELD_HOST_LABEL"
|
||||
description="COM_JOOMGALLERY_MIGMAN_FIELD_HOST_DESC"
|
||||
default="localhost"
|
||||
/>
|
||||
<field
|
||||
name="db_user"
|
||||
type="text"
|
||||
id="db_user"
|
||||
class="inputbox"
|
||||
label="COM_JOOMGALLERY_MIGMAN_FIELD_USER_LABEL"
|
||||
description="COM_JOOMGALLERY_MIGMAN_FIELD_USER_DESC"
|
||||
/>
|
||||
<field
|
||||
name="db_pass"
|
||||
type="password"
|
||||
id="db_pass"
|
||||
class="inputbox"
|
||||
label="COM_JOOMGALLERY_MIGMAN_FIELD_PASSWORD_LABEL"
|
||||
description="COM_JOOMGALLERY_MIGMAN_FIELD_PASSWORD_DESC"
|
||||
filter="raw"
|
||||
/>
|
||||
<field
|
||||
name="db_name"
|
||||
type="text"
|
||||
id="db_name"
|
||||
class="inputbox"
|
||||
label="COM_JOOMGALLERY_MIGMAN_FIELD_NAME_LABEL"
|
||||
description="COM_JOOMGALLERY_MIGMAN_FIELD_NAME_DESC"
|
||||
/>
|
||||
<field
|
||||
name="prefix"
|
||||
type="prefix"
|
||||
id="db_prefix"
|
||||
class="inputbox"
|
||||
label="COM_JOOMGALLERY_MIGMAN_FIELD_PREFIX_LABEL"
|
||||
description="COM_JOOMGALLERY_MIGMAN_FIELD_PREFIX_DESC"
|
||||
validate="prefix"
|
||||
/>
|
||||
<field
|
||||
name="enabled"
|
||||
type="hidden"
|
||||
id="db_enabled"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field
|
||||
name="imgtitle"
|
||||
type="cbtext"
|
||||
class="inputbox"
|
||||
cbname="change[]"
|
||||
cbvalue="imgtitle"
|
||||
cbrequired="true"
|
||||
label="COM_JOOMGALLERY_COMMON_TITLE"
|
||||
description="COM_JOOMGALLERY_IMGMAN_IMGTITLE_DESC"
|
||||
maxLength="255"
|
||||
/>
|
||||
<field
|
||||
name="imgtitlestartcounter"
|
||||
type="text"
|
||||
class="inputbox"
|
||||
size="5"
|
||||
maxlength="5"
|
||||
default=""
|
||||
/>
|
||||
<field
|
||||
name="catid"
|
||||
type="cbcategory"
|
||||
cbname="change[]"
|
||||
cbvalue="catid"
|
||||
validate="joompositivenumeric"
|
||||
label="COM_JOOMGALLERY_COMMON_CATEGORY"
|
||||
/>
|
||||
<field
|
||||
id="jg_movecopy"
|
||||
name="movecopy"
|
||||
type="radio"
|
||||
class="inputbox btn-group"
|
||||
label="COM_JOOMGALLERY_COMMON_PUBLISHED"
|
||||
default="move"
|
||||
>
|
||||
<option value="move">
|
||||
JLIB_HTML_BATCH_MOVE</option>
|
||||
<option value="copy">
|
||||
JLIB_HTML_BATCH_COPY</option>
|
||||
</field>
|
||||
<field
|
||||
name="access"
|
||||
type="cbaccesslevel"
|
||||
class="inputbox"
|
||||
cbname="change[]"
|
||||
cbvalue="access"
|
||||
label="COM_JOOMGALLERY_COMMON_ACCESS"
|
||||
/>
|
||||
<field
|
||||
name="imgtext"
|
||||
type="cbeditor"
|
||||
class="inputbox"
|
||||
cbname="change[]"
|
||||
cbvalue="imgtext"
|
||||
label="COM_JOOMGALLERY_COMMON_DESCRIPTION"
|
||||
filter="JComponentHelper::filterText"
|
||||
buttons="true"
|
||||
hide="readmore,pagebreak"
|
||||
cols="50"
|
||||
/>
|
||||
<field
|
||||
name="owner"
|
||||
type="cbjoomuser"
|
||||
cbname="change[]"
|
||||
cbvalue="owner"
|
||||
label="COM_JOOMGALLERY_COMMON_OWNER"
|
||||
description="COM_JOOMGALLERY_COMMON_OWNER_DESC"
|
||||
/>
|
||||
<field
|
||||
name="imgauthor"
|
||||
type="cbtext"
|
||||
class="inputbox"
|
||||
cbname="change[]"
|
||||
cbvalue="imgauthor"
|
||||
label="COM_JOOMGALLERY_COMMON_AUTHOR"
|
||||
description="COM_JOOMGALLERY_IMGMAN_AUTHOR_TIP"
|
||||
size="30"
|
||||
default=""
|
||||
/>
|
||||
<field
|
||||
name="metakey"
|
||||
type="cbtextarea"
|
||||
class="inputbox"
|
||||
cbname="change[]"
|
||||
cbvalue="metakey"
|
||||
label="COM_JOOMGALLERY_COMMON_METAKEYS"
|
||||
description="COM_JOOMGALLERY_COMMON_METAKEYS_TIP"
|
||||
default=""
|
||||
rows="5"
|
||||
cols="40"
|
||||
/>
|
||||
<field
|
||||
name="metadesc"
|
||||
type="cbtextarea"
|
||||
class="inputbox"
|
||||
cbname="change[]"
|
||||
cbvalue="metadesc"
|
||||
label="COM_JOOMGALLERY_COMMON_METADESC"
|
||||
description="COM_JOOMGALLERY_COMMON_METADESC_TIP"
|
||||
default=""
|
||||
rows="5"
|
||||
cols="40"
|
||||
/>
|
||||
<field
|
||||
name="published"
|
||||
type="cblist"
|
||||
cbname="change[]"
|
||||
cbvalue="published"
|
||||
label="COM_JOOMGALLERY_COMMON_PUBLISHED"
|
||||
size="1"
|
||||
>
|
||||
<option value="0">
|
||||
JNO</option>
|
||||
<option value="1">
|
||||
JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="txtclearvotes"
|
||||
type="cbtext"
|
||||
class="readonly"
|
||||
cbname="change[]"
|
||||
cbvalue="clearvotes"
|
||||
label="COM_JOOMGALLERY_IMGMAN_IMAGES_RATINGS"
|
||||
disabled="true"
|
||||
size="60"
|
||||
/>
|
||||
<field
|
||||
name="clearvotes"
|
||||
type="hidden"
|
||||
cbname="change[]"
|
||||
cbvalue="clearvotes"
|
||||
default="1"
|
||||
/>
|
||||
<field
|
||||
name="txtclearhits"
|
||||
type="cbtext"
|
||||
class="readonly"
|
||||
cbname="change[]"
|
||||
cbvalue="clearhits"
|
||||
label="COM_JOOMGALLERY_IMGMAN_IMAGES_HITS"
|
||||
disabled="true"
|
||||
size="60"
|
||||
/>
|
||||
<field
|
||||
name="clearhits"
|
||||
type="hidden"
|
||||
cbname="change[]"
|
||||
cbvalue="clearhits"
|
||||
default="1"
|
||||
/>
|
||||
<field
|
||||
name="txtcleardownloads"
|
||||
type="cbtext"
|
||||
class="readonly"
|
||||
cbname="change[]"
|
||||
cbvalue="cleardownloads"
|
||||
label="COM_JOOMGALLERY_COMMON_DOWNLOADS"
|
||||
disabled="true"
|
||||
size="60"
|
||||
/>
|
||||
<field
|
||||
name="cleardownloads"
|
||||
type="hidden"
|
||||
cbname="change[]"
|
||||
cbvalue="cleardownloads"
|
||||
default="1"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
||||
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="filter">
|
||||
<field
|
||||
name="search"
|
||||
type="text"
|
||||
label="COM_JOOMGALLERY_COMMON_SEARCH"
|
||||
hint="COM_JOOMGALLERY_COMMON_SEARCH"
|
||||
/>
|
||||
<field
|
||||
name="published"
|
||||
type="list"
|
||||
label="JOPTION_SELECT_PUBLISHED"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
<option value="1">COM_JOOMGALLERY_COMMON_OPTION_PUBLISHED_ONLY</option>
|
||||
<option value="0">COM_JOOMGALLERY_COMMON_OPTION_NOT_PUBLISHED_ONLY</option>
|
||||
</field>
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="JOPTION_FILTER_ACCESS"
|
||||
description="JOPTION_FILTER_ACCESS_DESC"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_ACCESS</option>
|
||||
</field>
|
||||
<field
|
||||
name="owner"
|
||||
type="joomuser"
|
||||
label="COM_JOOMGALLERY_COMMON_OPTION_SELECT_OWNER"
|
||||
hint="COM_JOOMGALLERY_COMMON_OPTION_SELECT_OWNER"
|
||||
onchange="document.getElementById('adminForm').submit();"
|
||||
/>
|
||||
<field
|
||||
name="type"
|
||||
type="list"
|
||||
label="COM_JOOMGALLERY_COMMON_OPTION_SELECT_TYPE"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">COM_JOOMGALLERY_COMMON_OPTION_SELECT_TYPE</option>
|
||||
<option value="1">COM_JOOMGALLERY_CATMAN_OPTION_USERCATEGORIES_ONLY</option>
|
||||
<option value="2">COM_JOOMGALLERY_CATMAN_OPTION_BACKENDCATEGORIES_ONLY</option>
|
||||
</field>
|
||||
</fields>
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="joomlist"
|
||||
label="JGLOBAL_SORT_BY"
|
||||
onchange="this.form.submit();"
|
||||
default="c.lft ASC"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="c.lft ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="c.lft DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="c.published ASC">COM_JOOMGALLERY_COMMON_PUBLISHED, JGLOBAL_ORDER_ASCENDING</option>
|
||||
<option value="c.published DESC">COM_JOOMGALLERY_COMMON_PUBLISHED, JGLOBAL_ORDER_DESCENDING</option>
|
||||
<option value="c.name ASC">COM_JOOMGALLERY_COMMON_TITLE, JGLOBAL_ORDER_ASCENDING</option>
|
||||
<option value="c.name DESC">COM_JOOMGALLERY_COMMON_TITLE, JGLOBAL_ORDER_DESCENDING</option>
|
||||
<option value="access_level ASC">COM_JOOMGALLERY_COMMON_ACCESS, JGLOBAL_ORDER_ASCENDING</option>
|
||||
<option value="access_level DESC">COM_JOOMGALLERY_COMMON_ACCESS, JGLOBAL_ORDER_DESCENDING</option>
|
||||
<option value="c.cid ASC">COM_JOOMGALLERY_COMMON_ID, JGLOBAL_ORDER_ASCENDING</option>
|
||||
<option value="c.cid DESC">COM_JOOMGALLERY_COMMON_ID, JGLOBAL_ORDER_DESCENDING</option>
|
||||
<option value="c.alias ASC">COM_JOOMGALLERY_COMMON_ALIAS, JGLOBAL_ORDER_ASCENDING</option>
|
||||
<option value="c.alias DESC">COM_JOOMGALLERY_COMMON_ALIAS, JGLOBAL_ORDER_DESCENDING</option>
|
||||
<option value="c.parent_id ASC">COM_JOOMGALLERY_COMMON_PARENT_CATEGORY, JGLOBAL_ORDER_ASCENDING</option>
|
||||
<option value="c.parent_id DESC">COM_JOOMGALLERY_COMMON_PARENT_CATEGORY, JGLOBAL_ORDER_DESCENDING</option>
|
||||
<option value="c.owner ASC">COM_JOOMGALLERY_COMMON_OWNER, JGLOBAL_ORDER_ASCENDING</option>
|
||||
<option value="c.owner DESC">COM_JOOMGALLERY_COMMON_OWNER, JGLOBAL_ORDER_DESCENDING</option>
|
||||
</field>
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
class="input-mini"
|
||||
default="20"
|
||||
label="COM_JOOMGALLERY_COMMON_SEARCH_LIMIT"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user