Merge pull request #28 from azett/master
Version 1.0.3.php7 as base for next FP release
This commit is contained in:
commit
31235ae06d
173
CHANGELOG
173
CHANGELOG
@ -1,173 +0,0 @@
|
||||
FlatPress 0.803 Vivace
|
||||
======================
|
||||
GENERAL
|
||||
-------
|
||||
+ Rewritten bootstrap, index centralized
|
||||
+ New database backend (soon to be rewroked ;))
|
||||
+ New draft system
|
||||
+ New secure hashing algorhytms for passwords
|
||||
+ New widget system
|
||||
+ Post view count moved to plugin PostViews
|
||||
+ Rewritten main config file
|
||||
+ Allowing custom appearance for date/time
|
||||
+ New URLs (still compatible)
|
||||
+ Allow static pages as home
|
||||
+ mysite.com/flatpress/?random post goodie :)
|
||||
|
||||
|
||||
PLUGINS
|
||||
-------
|
||||
+ New PostViews plugin
|
||||
+ New favicon plugin
|
||||
+ New prettyurls plugin, supporting pathinfo! (check plugin for help)
|
||||
+ Added GUI to BlockParser
|
||||
+ Added GUI to Akismet
|
||||
F Fixed accessible antispam
|
||||
F BBCode now allows inline HTML (check plugin for help): this
|
||||
allows WYSIWYG lovers to install their favourite editor (e.g.
|
||||
TinyMCE, see the forum for more)
|
||||
F Modified and cleaned interactions of BBCode with thumbs and
|
||||
lightbox plugins
|
||||
F Lightbox shouldn't crash IE7 anymore
|
||||
F Akismet shouldn't timeout anymore
|
||||
U jsUtils is mootools 1.1 full (complete download)
|
||||
|
||||
ADMIN PANEL
|
||||
-----------
|
||||
+ New GUI
|
||||
+ Allowing plugins to add panels
|
||||
+ Validating now without sessions
|
||||
+ New Widget GUI
|
||||
+ New Plugin GUI
|
||||
+ New Theme/Styles GUI
|
||||
+ New Options (formerly config) GUI
|
||||
|
||||
|
||||
0.703.6.2 (2007-11-26)
|
||||
======================
|
||||
|
||||
FIXED: removed /test.php
|
||||
FIXED: version number
|
||||
|
||||
|
||||
0.703.6.1 (2007-10-23)
|
||||
======================
|
||||
|
||||
FIXED: typo in admin.entry.delete.php
|
||||
|
||||
|
||||
0.703.6 (2007-10-19)
|
||||
====================
|
||||
|
||||
FIXED: XSS vulnerabilities in comments.tpl and contact.tpl
|
||||
FIXED: Backported from Crescendo+1 fix for XSS in $_GET fields
|
||||
FIXED: bug in static handling (THEME_LEGACY_MODE not checked)
|
||||
FIXED: Moved html escaping from default-filters to bbcode plugin
|
||||
FIXED: Added option to bbcode plugin to allow inline html! (no more ugly [html] tags! :)
|
||||
|
||||
|
||||
0.703.5 (2007-09-22)
|
||||
====================
|
||||
|
||||
FIXED: severe bug with
|
||||
FIXED: smaller one with commslock
|
||||
|
||||
|
||||
0.703.4 (2007-09-19)
|
||||
====================
|
||||
|
||||
FIXED: several XSS vulnerabilities
|
||||
|
||||
|
||||
0.703.3 (2007-09-18)
|
||||
====================
|
||||
|
||||
FIXED: XSS in search.php
|
||||
|
||||
|
||||
0.703.2 (2007-07-13)
|
||||
====================
|
||||
|
||||
FIXED: input validation problems
|
||||
|
||||
|
||||
0703.1 Crescendo (July 10, 2007)
|
||||
===============================
|
||||
|
||||
Small bug fixes
|
||||
FIXED: bbcode: [u] tag missing
|
||||
FIXED: bbcode/syntaxhighlighter: [code=MY_SYNTAX] works again
|
||||
FIXED: fixed error handling with missing categories
|
||||
|
||||
|
||||
0.703 Crescendo Final (June 27, 2007)
|
||||
=====================================
|
||||
|
||||
UPDATED: jsUtils : Mootools 1.11
|
||||
FIXED: URL issues with BBCODE
|
||||
FIXED: small issues with thumb plugin
|
||||
|
||||
|
||||
Crescendo RC2 (June 3, 2007)
|
||||
============================
|
||||
|
||||
FIXED: spaces in file names are escaped as dashes "-" when uploaded
|
||||
FIXED: various bbcode issues
|
||||
FIXED: scale/width bbcode/thumb issues
|
||||
MDFD: now thumb creates a .thumb dir for each subdir of images/
|
||||
FIXED: leggero CSS
|
||||
FIXED: double entity encoding
|
||||
ADDED: (since RC1): when loggedin trying to open a non-existent
|
||||
static page will bring you to the "add new static" panel
|
||||
|
||||
|
||||
Crescendo RC1 (May 29, 2007)
|
||||
============================
|
||||
|
||||
FIXED: plugin/bbcode: broken non-local urls
|
||||
FIXED: core/FPDB archive function: /?y=nn didn't work if a month wasn't specified
|
||||
FIXED: core/entry/cache : buggy workarounded function (see previous) is now fixed
|
||||
FIXED: core/users : session was not kept if user IP changed
|
||||
FIXED: core/rss : template now works, fixed core accordingly
|
||||
ADDED: core/rss : full content support
|
||||
UPDATED: plugin/jsUtils, upgraded to mootools 1.1
|
||||
UPDATED: plugin/lightbox updated accordingly to slimbox 1.4
|
||||
RMVD: temporarily removed prettyurls plugin
|
||||
(todo: remove from default config);
|
||||
I'm working to a newer cooler version, but
|
||||
it will require probably some changes in core, so no-go for this
|
||||
release
|
||||
|
||||
ADDED: Lang/it-it: added some strings I forgot
|
||||
|
||||
Crescendo beta1 (May 17, 2007)
|
||||
============================
|
||||
|
||||
added: some entry/cache hooks
|
||||
added: many plugin translations thanx to cimangi (http://luielei.altervista.org/)
|
||||
added: panel notifications for plugins
|
||||
added: new theme, new icons (updated old admin css)
|
||||
fixed: lightbox updated and fixed
|
||||
fixed: removed quote escaping in entries (removed and added fix for old versions)
|
||||
fixed: directory deletion under php5 (thx cimangi)
|
||||
fixed: entry_delete did not remove visit counter (cimangi)
|
||||
fixed: session retaining in control panel under certain conditions (smartyvalidate)
|
||||
changed: some behaviours in cache; need some rework as introduced a little bug... d'oh!
|
||||
|
||||
|
||||
Crescendo alpha
|
||||
===============
|
||||
|
||||
fixed: utils_mail()
|
||||
fixed: bbcode url trim
|
||||
fixed: bbcode remote image timeouts
|
||||
changed: WHOLE new POST behaviour (no longer "POSTDATA" messages)
|
||||
changed: new theme tags (almost finished). support for old themes; soon deprecated
|
||||
changed: graphics for the old theme (almost finished)
|
||||
changed: a whole bunch of graphic thingies
|
||||
changed: plugin organization
|
||||
added: [video] tag support http://flatpress.nowhereland.it/index.php?entry=entry070210-211548
|
||||
added: update checker (experimental)
|
||||
added: error/success notification system with fancy graphics :P
|
||||
|
||||
NOTE: italian language is still there until the wiki is ready
|
199
CHANGELOG.md
Normal file
199
CHANGELOG.md
Normal file
@ -0,0 +1,199 @@
|
||||
# 2019-xx-xx: FlatPress 1.1
|
||||
First release after Edoardo handed over the project ownership to Arvid.
|
||||
- Runs under PHP7
|
||||
- HTTPS support
|
||||
- Plugins added: Last comments admin, Media manager
|
||||
|
||||
# 2015-06-12: FlatPress 1.0.3
|
||||
- This release fixes an XSS (CVE-2014-100036).
|
||||
- Bonus: a new style for Leggero theme by @MarcThibeault and other UI enhancements by @MarcThibeault and @liquibyte
|
||||
|
||||
# 2013-12-11: FlatPress 1.0.2
|
||||
Another bugfix release.
|
||||
- Fixes errors in the rushed patched vulnerability in v1.0.1.
|
||||
- Clears some issues with strict standards.
|
||||
- Timezone now defaults to UTC. You can set your own time offset in the configuration panel of the admin area
|
||||
|
||||
# 2013-11-21: FlatPress 1.0.1
|
||||
Bugfix release.
|
||||
- Addresses Issue #3 http://www.exploit-db.com/exploits/29515/
|
||||
|
||||
# 2012-01-11: FlatPress 1.0 "Solenne"
|
||||
- ...still to be documented...
|
||||
|
||||
# 2010-11-07: 0.10xxx
|
||||
# 2009-10-10: 0.9xx Arioso
|
||||
# 2008-12-24: 0.8xx Fortissimo
|
||||
|
||||
2008-05-07: FlatPress 0.803 Vivace
|
||||
======================
|
||||
GENERAL
|
||||
-------
|
||||
+ Rewritten bootstrap, index centralized
|
||||
+ New database backend (soon to be rewroked ;))
|
||||
+ New draft system
|
||||
+ New secure hashing algorhytms for passwords
|
||||
+ New widget system
|
||||
+ Post view count moved to plugin PostViews
|
||||
+ Rewritten main config file
|
||||
+ Allowing custom appearance for date/time
|
||||
+ New URLs (still compatible)
|
||||
+ Allow static pages as home
|
||||
+ mysite.com/flatpress/?random post goodie :)
|
||||
|
||||
|
||||
PLUGINS
|
||||
-------
|
||||
+ New PostViews plugin
|
||||
+ New favicon plugin
|
||||
+ New prettyurls plugin, supporting pathinfo! (check plugin for help)
|
||||
+ Added GUI to BlockParser
|
||||
+ Added GUI to Akismet
|
||||
F Fixed accessible antispam
|
||||
F BBCode now allows inline HTML (check plugin for help): this
|
||||
allows WYSIWYG lovers to install their favourite editor (e.g.
|
||||
TinyMCE, see the forum for more)
|
||||
F Modified and cleaned interactions of BBCode with thumbs and
|
||||
lightbox plugins
|
||||
F Lightbox shouldn't crash IE7 anymore
|
||||
F Akismet shouldn't timeout anymore
|
||||
U jsUtils is mootools 1.1 full (complete download)
|
||||
|
||||
ADMIN PANEL
|
||||
-----------
|
||||
+ New GUI
|
||||
+ Allowing plugins to add panels
|
||||
+ Validating now without sessions
|
||||
+ New Widget GUI
|
||||
+ New Plugin GUI
|
||||
+ New Theme/Styles GUI
|
||||
+ New Options (formerly config) GUI
|
||||
|
||||
|
||||
0.703.6.2 (2007-11-26)
|
||||
======================
|
||||
|
||||
- FIXED: removed /test.php
|
||||
- FIXED: version number
|
||||
|
||||
|
||||
0.703.6.1 (2007-10-23)
|
||||
======================
|
||||
|
||||
FIXED: typo in admin.entry.delete.php
|
||||
|
||||
|
||||
0.703.6 (2007-10-19)
|
||||
====================
|
||||
|
||||
- FIXED: XSS vulnerabilities in comments.tpl and contact.tpl
|
||||
- FIXED: Backported from Crescendo+1 fix for XSS in $_GET fields
|
||||
- FIXED: bug in static handling (THEME_LEGACY_MODE not checked)
|
||||
- FIXED: Moved html escaping from default-filters to bbcode plugin
|
||||
- FIXED: Added option to bbcode plugin to allow inline html! (no more ugly [html] tags! :)
|
||||
|
||||
|
||||
0.703.5 (2007-09-22)
|
||||
====================
|
||||
|
||||
- FIXED: severe bug with
|
||||
- FIXED: smaller one with commslock
|
||||
|
||||
|
||||
0.703.4 (2007-09-19)
|
||||
====================
|
||||
|
||||
FIXED: several XSS vulnerabilities
|
||||
|
||||
|
||||
0.703.3 (2007-09-18)
|
||||
====================
|
||||
|
||||
FIXED: XSS in search.php
|
||||
|
||||
|
||||
0.703.2 (2007-07-13)
|
||||
====================
|
||||
|
||||
FIXED: input validation problems
|
||||
|
||||
|
||||
0703.1 Crescendo (July 10, 2007)
|
||||
===============================
|
||||
|
||||
Small bug fixes
|
||||
- FIXED: bbcode: [u] tag missing
|
||||
- FIXED: bbcode/syntaxhighlighter: [code=MY_SYNTAX] works again
|
||||
- FIXED: fixed error handling with missing categories
|
||||
|
||||
|
||||
0.703 Crescendo Final (June 27, 2007)
|
||||
=====================================
|
||||
|
||||
- UPDATED: jsUtils : Mootools 1.11
|
||||
- FIXED: URL issues with BBCODE
|
||||
- FIXED: small issues with thumb plugin
|
||||
|
||||
|
||||
Crescendo RC2 (June 3, 2007)
|
||||
============================
|
||||
|
||||
- FIXED: spaces in file names are escaped as dashes "-" when uploaded
|
||||
- FIXED: various bbcode issues
|
||||
- FIXED: scale/width bbcode/thumb issues
|
||||
- MDFD: now thumb creates a .thumb dir for each subdir of images/
|
||||
- FIXED: leggero CSS
|
||||
- FIXED: double entity encoding
|
||||
- ADDED: (since RC1): when loggedin trying to open a non-existent
|
||||
static page will bring you to the "add new static" panel
|
||||
|
||||
|
||||
Crescendo RC1 (May 29, 2007)
|
||||
============================
|
||||
|
||||
- FIXED: plugin/bbcode: broken non-local urls
|
||||
- FIXED: core/FPDB archive function: /?y=nn didn't work if a month wasn't specified
|
||||
- FIXED: core/entry/cache : buggy workarounded function (see previous) is now fixed
|
||||
- FIXED: core/users : session was not kept if user IP changed
|
||||
- FIXED: core/rss : template now works, fixed core accordingly
|
||||
- ADDED: core/rss : full content support
|
||||
- UPDATED: plugin/jsUtils, upgraded to mootools 1.1
|
||||
- UPDATED: plugin/lightbox updated accordingly to slimbox 1.4
|
||||
- RMVD: temporarily removed prettyurls plugin
|
||||
(todo: remove from default config);
|
||||
I'm working to a newer cooler version, but
|
||||
it will require probably some changes in core, so no-go for this
|
||||
release
|
||||
- ADDED: Lang/it-it: added some strings I forgot
|
||||
|
||||
Crescendo beta1 (May 17, 2007)
|
||||
============================
|
||||
|
||||
- added: some entry/cache hooks
|
||||
- added: many plugin translations thanx to cimangi (http://luielei.altervista.org/)
|
||||
- added: panel notifications for plugins
|
||||
- added: new theme, new icons (updated old admin css)
|
||||
- fixed: lightbox updated and fixed
|
||||
- fixed: removed quote escaping in entries (removed and added fix for old versions)
|
||||
- fixed: directory deletion under php5 (thx cimangi)
|
||||
- fixed: entry_delete did not remove visit counter (cimangi)
|
||||
- fixed: session retaining in control panel under certain conditions (smartyvalidate)
|
||||
- changed: some behaviours in cache; need some rework as introduced a little bug... d'oh!
|
||||
|
||||
|
||||
Crescendo alpha
|
||||
===============
|
||||
|
||||
- fixed: utils_mail()
|
||||
- fixed: bbcode url trim
|
||||
- fixed: bbcode remote image timeouts
|
||||
- changed: WHOLE new POST behaviour (no longer "POSTDATA" messages)
|
||||
- changed: new theme tags (almost finished). support for old themes; soon deprecated
|
||||
- changed: graphics for the old theme (almost finished)
|
||||
- changed: a whole bunch of graphic thingies
|
||||
- changed: plugin organization
|
||||
- added: [video] tag support http://flatpress.nowhereland.it/index.php?entry=entry070210-211548
|
||||
- added: update checker (experimental)
|
||||
- added: error/success notification system with fancy graphics :P
|
||||
|
||||
NOTE: italian language is still there until the wiki is ready
|
300
COPYING
300
COPYING
@ -1,300 +0,0 @@
|
||||
|
||||
FlatPress, flat-file based blog platform
|
||||
Copyright (C) 2006 Edoardo Vacchi (NoWhereMan)
|
||||
|
||||
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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, 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 Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
132
README
132
README
@ -1,132 +0,0 @@
|
||||
|
||||
|
||||
FLATPRESS README (or "the file that nobody reads except who writes") (draft 1)
|
||||
==============================================================================
|
||||
|
||||
|
||||
|
||||
## 1. WHAT THE FLATPRESS?
|
||||
|
||||
First of all, let me thank you for choosing my FlatPress. I hope you'll
|
||||
enjoy using it as I (almost) enjoyed writing it :)
|
||||
|
||||
FlatPress is a brand new blogging platform under heavy development.
|
||||
|
||||
Now, you may be like: «Another blog?? Who the heck would need that?».
|
||||
|
||||
|
||||
|
||||
## 2. WHO THE HECK NEED THAT?
|
||||
|
||||
Oh-kay, FP is flat-file based. This means *it doesn't require databases*.
|
||||
Actually all the content in stored in text files, so you don't need
|
||||
MySQL if you can't afford an hosting service which can provide that to you.
|
||||
|
||||
|
||||
|
||||
## 3. COOL. I STILL DON'T SEE WHY I SHOULD USE IT
|
||||
|
||||
«...as I could use SimplePHPBlog, Pivot, etc...».
|
||||
Good question. FlatPress was born as an extension to SPB.
|
||||
But let's clear the things out
|
||||
|
||||
1. This is not a _fork_: we didn't take the SPB code and edited it;
|
||||
2. This is not a rewrite: we didn't take SPB concept and reinvented its wheel
|
||||
|
||||
This is a *new* project, which inherits from SPB just its *storing system*.
|
||||
This means you can take your content/, images/ dirs from your SPB installation,
|
||||
put them in FP's fp-content/ dir as they are, and, once installed, it should
|
||||
almost work out-of-the-box. This is the aim.
|
||||
|
||||
Note that we don't want every single SPB user to switch to FP, it's just
|
||||
that, as a SPB user myself, I wanted an easy way to switch from that to my project
|
||||
and by the way its storing system is not bad at all :)
|
||||
|
||||
|
||||
|
||||
## 4. IF IT'S NOT THAT BAD, WHY THIS REWRITE?
|
||||
|
||||
As I said, this *IS NOT* a rewrite. This is a new blog.
|
||||
At the time we (I) started this project SPB lacked some features, it
|
||||
wasn't W3C standard-compliant and, above all, it was obviously a pain
|
||||
to upgrade if you had made many changes to the code.
|
||||
|
||||
So the most important lacks were a plugin system and a little more
|
||||
flexible theming engine.
|
||||
|
||||
FlatPress uses the same plugin system of WordPress.
|
||||
Beware: this doesn't mean you will be able to use any of the WordPress
|
||||
plugins without any effort. Only a few of the plugin "hooks" have been
|
||||
implemented (search the sources for apply_filters and do_action to know which ones).
|
||||
|
||||
Also FlatPress uses the famous Smarty template engine for the themes (the
|
||||
same of PhpBB).
|
||||
|
||||
Of course, this now will sound great (and quite conceited), then remember
|
||||
1. This is my first complete work in PHP
|
||||
2. It's unfinished :)
|
||||
|
||||
|
||||
|
||||
## 5. ANYWAY, IT SOUNDS PRETTY DECENT, HOW DO I GET IT TO WORK?
|
||||
|
||||
OK, let's see what it will take you to run the fruit of my sweat
|
||||
(sounds juicy, doesn't it? Yech!).
|
||||
|
||||
A basic Apache+PHP system as a server should work. It has been small tested on IIS,
|
||||
too. If you experience any problem, just let me know (be detailed describing the problem).
|
||||
As I said, no need for databases. Anyway I must ask for a
|
||||
version of PHP >= 4.3.0. I can't tell if it will work on older versions
|
||||
so if it something is going wrong, first check this :)
|
||||
|
||||
Unpack the .tar.bz2 you downloaded from the main site (probably
|
||||
http://flatpress.nowhereland.it/) and http://flatpress.nowhereland.it/downloads/)
|
||||
and then upload it on your webserver (or test it locally).
|
||||
|
||||
Point your browser to http://yoursite.com/flatpress/ and just follow
|
||||
*carefully* the istructions :p
|
||||
|
||||
|
||||
|
||||
## 6. FINAL WARNING AND GOODBYE
|
||||
|
||||
This you're using (or you're about to use) is intended as a TEST version;
|
||||
it should be very stable, but it if it ever blew your PC up, just
|
||||
remember you'd been told.
|
||||
|
||||
Kidding.
|
||||
|
||||
People tell me I'm quite unprofessional presenting this project.
|
||||
You'll see why when you'll install FlatPress for the first time...
|
||||
If that won't make your day, I just hope to make you smile :)
|
||||
|
||||
Once you're ready tell us what you think on the main site; any
|
||||
feedback is appreciated!
|
||||
|
||||
|
||||
|
||||
## CREDITS
|
||||
|
||||
I want to thank here some people that helped (and are helping) me with
|
||||
this project.
|
||||
|
||||
Hydra, betatester, small-coder, and official cheerleader :D
|
||||
drudo, theme designer, supporter, space and time provider
|
||||
|
||||
Other thanks to giulio and alcor for their precious advice.
|
||||
|
||||
As an additional note, I'd like to thank also Tychondriax
|
||||
another friend of mine who occasionally helps me with betasting
|
||||
and bug-discovering :)
|
||||
|
||||
Thank you all, guys, without you I would have already given up.
|
||||
|
||||
|
||||
|
||||
Edoardo Vacchi (NoWhereMan), August, 2 2006
|
||||
|
||||
email: real_nowhereman at users dot sf dot net
|
||||
www: http://www.nowhereland.it
|
||||
flatpress home: http://flatpress.nowhereland.it
|
||||
|
||||
|
24
README.md
24
README.md
@ -1,4 +1,22 @@
|
||||
flatpress
|
||||
=========
|
||||
# Welcome to FlatPress!
|
||||
FlatPress is a lightweight, easy-to-set-up blogging engine. Plain and simple, just PHP. No database needed!
|
||||
<br>
|
||||
Official FlatPress site: http://flatpress.org/<br>
|
||||
Official FlatPress GitHub project: https://github.com/flatpressblog/flatpress
|
||||
|
||||
FlatPress official repository
|
||||
## Requirements
|
||||
FlatPress runs on any web server (e.g. Apache or IIS) with PHP 5.6 or higher. Since all data is stored in files, no database is needed.
|
||||
|
||||
## Installation
|
||||
Installing FlatPress is really easy!
|
||||
- Unzip FlatPress package
|
||||
- Upload to your web server
|
||||
- Browse to your web server, FlatPress installer appears
|
||||
- Enter your desired user name, password etc.
|
||||
- Enjoy blogging with FlatPress!
|
||||
|
||||
## Credits
|
||||
FlatPress was initially developed by Edoardo Vacchi (NoWhereMan): http://www.nowhereland.it<br>
|
||||
Edoardo was supported by Hydra, drudo, giulio, alcor, and Tychondriax.<br>
|
||||
<br>
|
||||
Since 2018, FlatPress is taken care of by Arvid Zimmermann: https://arvidzimmermann.de
|
||||
|
@ -22,7 +22,7 @@
|
||||
var $actionpanel = null;
|
||||
|
||||
|
||||
function AdminPanel(&$smarty) {
|
||||
function __construct(&$smarty) {
|
||||
$this->smarty =& $smarty;
|
||||
if (!$this->panelname)
|
||||
trigger_error("Variable \$panelname is not defined!", E_USER_ERROR);
|
||||
@ -100,7 +100,7 @@
|
||||
|
||||
var $langres = '';
|
||||
|
||||
function AdminPanelAction(&$smarty) {
|
||||
function __construct(&$smarty) {
|
||||
$this->smarty =& $smarty;
|
||||
$the_action_panel = get_class($this);
|
||||
$this->smarty->assign('admin_panel_id', $the_action_panel);
|
||||
|
@ -16,12 +16,12 @@
|
||||
/* utility class */
|
||||
class tpl_deleter extends fs_filelister {
|
||||
|
||||
function tpl_deleter() {
|
||||
function __construct() {
|
||||
|
||||
//$this->smarty = $GLOBALS['_FP_SMARTY'];
|
||||
|
||||
$this->_directory = CACHE_DIR;
|
||||
parent::fs_filelister();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
@ -40,9 +40,9 @@
|
||||
|
||||
var $_directory = CONTENT_DIR;
|
||||
|
||||
function s_entry_crawler() {
|
||||
function __construct() {
|
||||
$this->index = entry_init();
|
||||
parent::fs_filelister();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
|
@ -4,13 +4,13 @@
|
||||
var $panelname = 'themes';
|
||||
var $actions = array('default' => true);
|
||||
|
||||
function admin_themes(&$smarty) {
|
||||
function __construct(&$smarty) {
|
||||
global $theme;
|
||||
|
||||
if ($theme['version'] > 0.703)
|
||||
$this->actions['style'] = true;
|
||||
|
||||
parent::AdminPanel($smarty);
|
||||
parent::__construct($smarty);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
class admin_themes_obj_style_idx extends fs_filelister {
|
||||
|
||||
function admin_themes_obj_style_idx() {
|
||||
function __construct() {
|
||||
$this->_directory = THEMES_DIR . THE_THEME;
|
||||
parent::fs_filelister();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _checkFile($d, $f) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
$this->thumburl =
|
||||
BLOG_BASEURL .
|
||||
'admin.php?p=uploader&action=thumb&f=';
|
||||
return parent::fs_filelister($d);
|
||||
return parent::__construct($d);
|
||||
}
|
||||
|
||||
function _checkFile($d, $f) {
|
||||
|
59
defaults.php
59
defaults.php
@ -103,16 +103,69 @@
|
||||
|
||||
|
||||
set_include_path(ABS_PATH);
|
||||
|
||||
|
||||
//
|
||||
// original Flatpress 1.0.3 coding disabled
|
||||
//
|
||||
// compatibility with ISS
|
||||
// if (!isset($_SERVER['REQUEST_URI']))
|
||||
// $_SERVER['REQUEST_URI'] = 'http://localhost/flatpress/';
|
||||
|
||||
// #define('BLOG_ROOT', dirname($_SERVER['PHP_SELF']) . '/');
|
||||
// define('BLOG_ROOT', ('/'==($v=dirname($_SERVER['SCRIPT_NAME']))? $v : $v.'/') );
|
||||
|
||||
// define('BLOG_BASEURL', 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT);
|
||||
|
||||
//
|
||||
// Adding security and HTTPS support
|
||||
//
|
||||
|
||||
ini_set('session.cookie_httponly', 1);
|
||||
ini_set('session.use_only_cookies', 1);
|
||||
|
||||
if (isset($_SERVER['HTTPS'])) {
|
||||
$_SERVER['HTTPS'] = htmlspecialchars($_SERVER['HTTPS'], ENT_QUOTES, "UTF-8");
|
||||
}
|
||||
$serverport = "false";
|
||||
// Unterstützung für Apache und IIS
|
||||
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == '1' || strtolower($_SERVER['HTTPS'])=='on')) {
|
||||
$serverport = "https://";
|
||||
// Uses a secure connection (HTTPS) if possible
|
||||
ini_set('session.cookie_secure', 1);
|
||||
} else {
|
||||
$serverport = "http://";
|
||||
}
|
||||
|
||||
// compatibility with ISS
|
||||
$_SERVER["REQUEST_URI"] = htmlspecialchars($_SERVER["REQUEST_URI"], ENT_QUOTES, "UTF-8");
|
||||
if (!isset($_SERVER['REQUEST_URI']))
|
||||
$_SERVER['REQUEST_URI'] = 'http://localhost/flatpress/';
|
||||
$_SERVER['REQUEST_URI'] = $serverport . 'localhost/flatpress/';
|
||||
|
||||
#define('BLOG_ROOT', dirname($_SERVER['PHP_SELF']) . '/');
|
||||
define('BLOG_ROOT', ('/'==($v=dirname($_SERVER['SCRIPT_NAME']))? $v : $v.'/') );
|
||||
|
||||
|
||||
define('BLOG_BASEURL', 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT);
|
||||
define('BLOG_BASEURL', $serverport . $_SERVER['HTTP_HOST'] . BLOG_ROOT);
|
||||
|
||||
//
|
||||
// OWASP - Browser Cache - How can the browser cache be used in attacks?
|
||||
// https://www.owasp.org/index.php/OWASP_Application_Security_FAQ#How_can_the_browser_cache_be_used_in_attacks.3F
|
||||
//
|
||||
// http://stackoverflow.com/questions/13640109/how-to-prevent-browser-cache-for-php-site
|
||||
//
|
||||
header('Expires: Sun, 01 Jan 2015 00:00:00 GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
||||
header('Pragma: no-cache');
|
||||
//
|
||||
// http://de.wikipedia.org/wiki/Liste_der_HTTP-Headerfelder
|
||||
//
|
||||
header('X-Frame-Options: SAMEORIGIN');
|
||||
header('X-XSS-Protection: 1; mode=block');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
//
|
||||
// End of send header
|
||||
//
|
||||
|
||||
#function _dummy() {}
|
||||
#set_error_handler('_dummy');
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@
|
||||
var $_keysize = 12;
|
||||
|
||||
// sub-classes will fill the above variables on constructing
|
||||
function cache_filelister() {
|
||||
function __construct() {
|
||||
|
||||
if (!$this->_cachefile)
|
||||
trigger_error('CACHE: no cache file specified', E_USER_ERROR);
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
class comment_indexer extends fs_filelister {
|
||||
|
||||
function comment_indexer($id) {
|
||||
function __construct($id) {
|
||||
$f = bdb_idtofile($id,BDB_COMMENT); //todo change
|
||||
$this->_directory = $f;
|
||||
parent::fs_filelister();
|
||||
parent::__construct();
|
||||
//substr(bdb_idtofile($id), -strlen(EXT));
|
||||
}
|
||||
|
||||
|
@ -1,223 +1,204 @@
|
||||
<?php
|
||||
define('DRAFT_DIR', CONTENT_DIR . 'drafts/');
|
||||
|
||||
|
||||
define('DRAFT_DIR', CONTENT_DIR . 'drafts/');
|
||||
|
||||
class draft_indexer extends fs_filelister {
|
||||
|
||||
var $_varname = 'cache';
|
||||
var $_cachefile = null;
|
||||
var $_directory = DRAFT_DIR;
|
||||
|
||||
function draft_indexer() {
|
||||
$this->_cachefile = CACHE_DIR . 'draft_index.php';
|
||||
return parent::fs_filelister();
|
||||
}
|
||||
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
|
||||
$f = "$directory/$file";
|
||||
if ( is_dir($f) && ctype_digit($file)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fnmatch('entry*'.EXT, $file)) {
|
||||
$id=basename($file,EXT);
|
||||
$arr=draft_parse($id);
|
||||
|
||||
//$this->add($id, $arr['subject']);
|
||||
$this->_list[$id] = $arr['subject'];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function &draft_init() {
|
||||
global $draftdb;
|
||||
if (!isset($draftdb))
|
||||
$draftdb = new draft_indexer;
|
||||
return $draftdb;
|
||||
}
|
||||
|
||||
|
||||
function draft_getlist() {
|
||||
|
||||
static $list = array();
|
||||
|
||||
if (!$list) {
|
||||
$obj =& draft_init();
|
||||
$list = $obj->getList();
|
||||
krsort($list);
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
function draft_parse($id) {
|
||||
|
||||
if ($fname=draft_exists($id)) {
|
||||
|
||||
$entry = io_load_file($fname);
|
||||
|
||||
$entry = utils_kexplode($entry);
|
||||
if (!isset($entry['categories']))
|
||||
$entry['categories'] = array();
|
||||
else
|
||||
$entry['categories'] = explode(',', $entry['categories']);
|
||||
|
||||
return $entry;
|
||||
}
|
||||
return array();
|
||||
class draft_indexer extends fs_filelister {
|
||||
|
||||
var $_varname = 'cache';
|
||||
|
||||
var $_cachefile = null;
|
||||
|
||||
var $_directory = DRAFT_DIR;
|
||||
|
||||
function __construct() {
|
||||
$this->_cachefile = CACHE_DIR . 'draft_index.php';
|
||||
return parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
function draft_save(&$entry, $id=null, $update_index = false, $update_date=false) {
|
||||
|
||||
if (!$id) {
|
||||
$id = bdb_idfromtime('entry', $entry['date']);
|
||||
function _checkFile($directory, $file) {
|
||||
$f = "$directory/$file";
|
||||
if (is_dir($f) && ctype_digit($file)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
$ed = entry_dir($id);
|
||||
$dd = draft_dir($id);
|
||||
|
||||
if (file_exists($ed.EXT)) {
|
||||
|
||||
// move collateral files
|
||||
@rename($ed, $dd);
|
||||
if (fnmatch('entry*' . EXT, $file)) {
|
||||
$id = basename($file, EXT);
|
||||
$arr = draft_parse($id);
|
||||
|
||||
if ($update_index) {
|
||||
// delete normal entry
|
||||
fs_delete($ed.EXT);
|
||||
// $this->add($id, $arr['subject']);
|
||||
$this->_list [$id] = $arr ['subject'];
|
||||
|
||||
// remove from normal flow
|
||||
$o =& entry_init();
|
||||
$o->delete($id, null);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
$new_entry = entry_prepare($entry);
|
||||
if ($new_entry['categories'])
|
||||
$new_entry['categories']=implode(',', $entry['categories']);
|
||||
else unset($new_entry['categories']);
|
||||
|
||||
$string = utils_kimplode($new_entry);
|
||||
|
||||
}
|
||||
|
||||
if (!io_write_file($dd.EXT, $string)) {
|
||||
return false;
|
||||
} else return $id;
|
||||
}
|
||||
|
||||
function &draft_init() {
|
||||
global $draftdb;
|
||||
if (!isset($draftdb))
|
||||
$draftdb = new draft_indexer();
|
||||
return $draftdb;
|
||||
}
|
||||
|
||||
function draft_getlist() {
|
||||
static $list = array();
|
||||
|
||||
if (!$list) {
|
||||
$obj = & draft_init();
|
||||
$list = $obj->getList();
|
||||
krsort($list);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function draft_parse($id) {
|
||||
if ($fname = draft_exists($id)) {
|
||||
|
||||
$entry = io_load_file($fname);
|
||||
|
||||
$entry = utils_kexplode($entry);
|
||||
if (!isset($entry ['categories']))
|
||||
$entry ['categories'] = array();
|
||||
else
|
||||
$entry ['categories'] = explode(',', $entry ['categories']);
|
||||
|
||||
return $entry;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
function draft_save(&$entry, $id = null, $update_index = false, $update_date = false) {
|
||||
if (!$id) {
|
||||
$id = bdb_idfromtime('entry', $entry ['date']);
|
||||
}
|
||||
|
||||
$ed = entry_dir($id);
|
||||
$dd = draft_dir($id);
|
||||
|
||||
if (file_exists($ed . EXT)) {
|
||||
|
||||
// move collateral files
|
||||
@rename($ed, $dd);
|
||||
|
||||
if ($update_index) {
|
||||
// delete normal entry
|
||||
fs_delete($ed . EXT);
|
||||
|
||||
// remove from normal flow
|
||||
$o = & entry_init();
|
||||
$o->delete($id, null);
|
||||
}
|
||||
}
|
||||
|
||||
$new_entry = entry_prepare($entry);
|
||||
if ($new_entry ['categories'])
|
||||
$new_entry ['categories'] = implode(',', $entry ['categories']);
|
||||
else
|
||||
unset($new_entry ['categories']);
|
||||
|
||||
$string = utils_kimplode($new_entry);
|
||||
|
||||
if (!io_write_file($dd . EXT, $string)) {
|
||||
return false;
|
||||
|
||||
}
|
||||
} else
|
||||
return $id;
|
||||
|
||||
function draft_dir($id) {
|
||||
if (!preg_match('|^entry[0-9]{6}-[0-9]{6}$|', $id))
|
||||
return false;
|
||||
//$date = date_from_id($id);
|
||||
//$f = CONTENT_DIR . "{$date['y']}/{$date['m']}/$id";
|
||||
return DRAFT_DIR . $id;
|
||||
//return $f;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function draft_exists($id) {
|
||||
|
||||
$dir = draft_dir($id);
|
||||
if (!$dir)
|
||||
return false;
|
||||
|
||||
$f = $dir .EXT;
|
||||
if (file_exists($f))
|
||||
return $f;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function draft_dir($id) {
|
||||
if (!preg_match('|^entry[0-9]{6}-[0-9]{6}$|', $id))
|
||||
return false;
|
||||
}
|
||||
// $date = date_from_id($id);
|
||||
// $f = CONTENT_DIR . "{$date['y']}/{$date['m']}/$id";
|
||||
return DRAFT_DIR . $id;
|
||||
// return $f;
|
||||
}
|
||||
|
||||
function draft_delete($id) {
|
||||
$dir = draft_dir($id);
|
||||
|
||||
$f=$dir.EXT;
|
||||
if (!file_exists($f))
|
||||
return false;
|
||||
|
||||
//$draftdb =& draft_init();
|
||||
//$draftdb->delete($id);
|
||||
fs_delete_recursive($dir);
|
||||
|
||||
return fs_delete($f);
|
||||
}
|
||||
function draft_exists($id) {
|
||||
$dir = draft_dir($id);
|
||||
if (!$dir)
|
||||
return false;
|
||||
|
||||
/*
|
||||
function draft_from_entry($entryid) {
|
||||
$dir = entry_dir($entryid);
|
||||
//$dir2 = str_replace('entry', 'draft', $dir);
|
||||
$dir2 = draft_dir($entryid);
|
||||
@rename($dir, $dir2);
|
||||
@rename($dir.EXT, $dir2.EXT);
|
||||
}
|
||||
*/
|
||||
$f = $dir . EXT;
|
||||
if (file_exists($f))
|
||||
return $f;
|
||||
|
||||
function draft_to_entry($draftid) {
|
||||
|
||||
$dir = draft_dir($draftid);
|
||||
$dir2 = entry_dir($draftid);
|
||||
|
||||
@rename($dir, $dir2);
|
||||
draft_delete($draftid);
|
||||
}
|
||||
|
||||
|
||||
function smarty_block_draftlist($params, $content, &$smarty, &$repeat) {
|
||||
global $fpdb;
|
||||
|
||||
if ($list = draft_getlist()) {
|
||||
$smarty->assign('draft_list', $list);
|
||||
return $content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function smarty_block_draft($params, $content, &$smarty, &$repeat) {
|
||||
|
||||
static $list = array();
|
||||
|
||||
$smarty->assign(array( 'subject'=>'',
|
||||
'content'=>'',
|
||||
'date'=>'',
|
||||
'author'=>'',
|
||||
'version'=>'',
|
||||
'id'=>''
|
||||
)
|
||||
);
|
||||
$arr =& $smarty->get_template_vars('draft_list');
|
||||
|
||||
$id = $subject = null;
|
||||
if ($arr)
|
||||
list($id, $subject)=each($arr);
|
||||
|
||||
if ($id){
|
||||
$smarty->assign('subject', $subject);
|
||||
$smarty->assign('id', $id);
|
||||
}
|
||||
|
||||
$repeat = (bool) $id;
|
||||
return false;
|
||||
}
|
||||
|
||||
return $content;
|
||||
function draft_delete($id) {
|
||||
$dir = draft_dir($id);
|
||||
|
||||
$f = $dir . EXT;
|
||||
if (!file_exists($f))
|
||||
return false;
|
||||
|
||||
// $draftdb =& draft_init();
|
||||
// $draftdb->delete($id);
|
||||
fs_delete_recursive($dir);
|
||||
|
||||
return fs_delete($f);
|
||||
}
|
||||
|
||||
/*
|
||||
* function draft_from_entry($entryid) {
|
||||
* $dir = entry_dir($entryid);
|
||||
* //$dir2 = str_replace('entry', 'draft', $dir);
|
||||
* $dir2 = draft_dir($entryid);
|
||||
* @rename($dir, $dir2);
|
||||
* @rename($dir.EXT, $dir2.EXT);
|
||||
* }
|
||||
*/
|
||||
function draft_to_entry($draftid) {
|
||||
$dir = draft_dir($draftid);
|
||||
$dir2 = entry_dir($draftid);
|
||||
|
||||
@rename($dir, $dir2);
|
||||
draft_delete($draftid);
|
||||
}
|
||||
|
||||
function smarty_block_draftlist($params, $content, &$smarty, &$repeat) {
|
||||
global $fpdb;
|
||||
|
||||
if ($list = draft_getlist()) {
|
||||
$smarty->assign('draft_list', $list);
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
function smarty_block_draft($params, $content, &$smarty, &$repeat) {
|
||||
static $list = array();
|
||||
|
||||
$smarty->assign(array(
|
||||
'subject' => '',
|
||||
'content' => '',
|
||||
'date' => '',
|
||||
'author' => '',
|
||||
'version' => '',
|
||||
'id' => ''
|
||||
));
|
||||
$arr = & $smarty->get_template_vars('draft_list');
|
||||
|
||||
$id = $subject = null;
|
||||
if ($arr) {
|
||||
$firstElement = utils_array_kshift($arr);
|
||||
$id = array_keys($firstElement) [0];
|
||||
$subject = $firstElement [$id];
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
$smarty->assign('subject', $subject);
|
||||
$smarty->assign('id', $id);
|
||||
}
|
||||
|
||||
$repeat = (bool) $id;
|
||||
|
||||
$smarty->register_block('draft_block', 'smarty_block_draftlist');
|
||||
$smarty->register_block('draft', 'smarty_block_draft');
|
||||
return $content;
|
||||
}
|
||||
|
||||
$smarty->register_block('draft_block', 'smarty_block_draftlist');
|
||||
$smarty->register_block('draft', 'smarty_block_draft');
|
||||
|
||||
?>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
//constructor
|
||||
function fs_filelister($directory = null) {
|
||||
function __construct($directory = null) {
|
||||
if ($directory) $this->_directory = $directory;
|
||||
$this->_listFiles($this->_directory);
|
||||
}
|
||||
@ -184,11 +184,11 @@
|
||||
var $_chmod_dir;
|
||||
var $_chmod_file;
|
||||
|
||||
function fs_chmodder($directory, $ch_file=FILE_PERMISSIONS, $ch_dir=DIR_PERMISSIONS) {
|
||||
function __construct($directory, $ch_file=FILE_PERMISSIONS, $ch_dir=DIR_PERMISSIONS) {
|
||||
$this->_directory = $directory;
|
||||
$this->_chmod_file = $ch_file;
|
||||
$this->_chmod_dir = $ch_dir;
|
||||
parent::fs_filelister();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
@ -221,7 +221,7 @@
|
||||
|
||||
function fs_deleter($directory) {
|
||||
$this->_directory = $directory;
|
||||
parent::fs_filelister();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
var $fullparse = false;
|
||||
var $comments = false;
|
||||
|
||||
function FPDB_QueryParams($params) {
|
||||
function __construct($params) {
|
||||
|
||||
if (is_string($params)) {
|
||||
$this->parse_string($params);
|
||||
@ -152,7 +152,7 @@
|
||||
var $secondary_idx = null;
|
||||
var $walker = null;
|
||||
|
||||
function FPDB_Query($params, $ID) {
|
||||
function __construct($params, $ID) {
|
||||
|
||||
global $current_query;
|
||||
|
||||
@ -297,13 +297,13 @@
|
||||
$filteredkeys = $obj->getList();
|
||||
$index_count = $obj->getCount();
|
||||
|
||||
if ($filteredkeys)
|
||||
$this->walker =& $entry_index->walker(
|
||||
entry_idtokey($filteredkeys[0]), true,
|
||||
entry_idtokey($filteredkeys[$index_count-1]), true
|
||||
);
|
||||
|
||||
|
||||
if ($filteredkeys) {
|
||||
$error302var1 = entry_idtokey($filteredkeys[0]);
|
||||
|
||||
$this->walker = $entry_index->walker(
|
||||
$error302var1, true,
|
||||
entry_idtokey($filteredkeys[$index_count-1]), true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($qp->count < 0) {
|
||||
@ -595,7 +595,7 @@
|
||||
var $current = '';
|
||||
var $entryid = '';
|
||||
|
||||
function FPDB_CommentList($ID, $array) {
|
||||
function __construct($ID, $array) {
|
||||
|
||||
if (is_array($array)) {
|
||||
$this->list = $array;
|
||||
@ -624,7 +624,7 @@
|
||||
if (!$this->hasMore())
|
||||
return false;
|
||||
|
||||
list($k,$id) = each($this->list);
|
||||
$id = array_shift($this->list);
|
||||
|
||||
$comment = comment_parse($this->entryid, $id);
|
||||
$couplet = array(&$id, &$comment);
|
||||
@ -641,7 +641,7 @@
|
||||
var $queries = array();
|
||||
|
||||
|
||||
function FPDB() {
|
||||
function __construct() {
|
||||
// constructor
|
||||
}
|
||||
|
||||
@ -769,7 +769,7 @@
|
||||
var $_nodesize = 30;
|
||||
var $_keysize = 12;
|
||||
|
||||
function FPDB_transaction($id_cat=0) {
|
||||
function __construct($id_cat=0) {
|
||||
$this->_index = INDEX_DIR.'index-'.$id_cat;
|
||||
|
||||
$this->_tree = caching_SBPT(
|
||||
|
@ -9,9 +9,9 @@
|
||||
var $_enabledlist = null;
|
||||
var $_directory = PLUGINS_DIR;
|
||||
|
||||
function plugin_indexer() {
|
||||
function __construct() {
|
||||
$this->_enabledlist = CONFIG_DIR . 'plugins.conf.php';
|
||||
parent::fs_filelister();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
|
@ -1,234 +1,223 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* system.php
|
||||
* string-to-php and general system functions
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* system.php
|
||||
* string-to-php and general system functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* function system_save
|
||||
*
|
||||
* This function saves a list of variables provided after $file
|
||||
* encapsulated in an array where KEY is the var name
|
||||
* in a php file.
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* <?php
|
||||
* // Let's suppose you want to save an array called $my_arr
|
||||
* // in file $my_file
|
||||
* $my_file = 'path/to/file'
|
||||
* $my_arr = array ('val1', 'val2', 'val3');
|
||||
* $save_arr = array('$my_arr' => $my_arr); //same as: $save_arr['$my_arr'] = $my_arr);
|
||||
* system_save($my_file, $my_arr);
|
||||
* // now the file $my_file will contain the following lines:
|
||||
* // global $my_arr;
|
||||
* // $my_arr = array (
|
||||
* // '$my_arr' => val1',
|
||||
* // '$my_arr' => 'val2',
|
||||
* // '$my_arr' => 'val3'
|
||||
* // );
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @param string $file file path where $array contents will be saved
|
||||
* @array $var_list list of vars to be saved
|
||||
* @return bool
|
||||
*
|
||||
* @see config_save, config_load
|
||||
*
|
||||
*/
|
||||
function system_save($file, $array ) {
|
||||
|
||||
//if ( ( $numargs = func_num_args() ) > 1) {
|
||||
|
||||
$string = "<?php\n\n";
|
||||
|
||||
//$arg_list = func_get_args();
|
||||
foreach ($array as $key => $arg) {
|
||||
//$vname = utils_vname ($arg);
|
||||
//var_export($arg);
|
||||
$s = /*" global {$key};\n*/ "\${$key} = " .
|
||||
var_export($arg, true) . ";\n";
|
||||
$string .= $s;
|
||||
}
|
||||
|
||||
$string .= "\n?>";
|
||||
|
||||
return io_write_file($file, $string);
|
||||
|
||||
//} else die('Wrong number of parameters!');
|
||||
|
||||
/**
|
||||
* function system_save
|
||||
*
|
||||
* This function saves a list of variables provided after $file
|
||||
* encapsulated in an array where KEY is the var name
|
||||
* in a php file.
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* <?php
|
||||
* // Let's suppose you want to save an array called $my_arr
|
||||
* // in file $my_file
|
||||
* $my_file = 'path/to/file'
|
||||
* $my_arr = array ('val1', 'val2', 'val3');
|
||||
* $save_arr = array('$my_arr' => $my_arr); //same as: $save_arr['$my_arr'] = $my_arr);
|
||||
* system_save($my_file, $my_arr);
|
||||
* // now the file $my_file will contain the following lines:
|
||||
* // global $my_arr;
|
||||
* // $my_arr = array (
|
||||
* // '$my_arr' => val1',
|
||||
* // '$my_arr' => 'val2',
|
||||
* // '$my_arr' => 'val3'
|
||||
* // );
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @param string $file
|
||||
* file path where $array contents will be saved
|
||||
* @array $var_list list of vars to be saved
|
||||
* @return bool
|
||||
*
|
||||
* @see config_save, config_load
|
||||
*
|
||||
*/
|
||||
function system_save($file, $array) {
|
||||
|
||||
// if ( ( $numargs = func_num_args() ) > 1) {
|
||||
$string = "<?php\n\n";
|
||||
|
||||
// $arg_list = func_get_args();
|
||||
foreach ($array as $key => $arg) {
|
||||
// $vname = utils_vname ($arg);
|
||||
// var_export($arg);
|
||||
$s = /*" global {$key};\n*/ "\${$key} = " . var_export($arg, true) . ";\n";
|
||||
$string .= $s;
|
||||
}
|
||||
|
||||
function system_hashsalt_save($force=false) {
|
||||
global $fp_config;
|
||||
if ($force || !file_exists(HASHSALT_FILE))
|
||||
return system_save(HASHSALT_FILE, array('fp_hashsalt'=>$fp_config['general']['blogid'] . ABS_PATH . BLOG_BASEURL .mt_rand()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
define('SYSTEM_VER', '1.0.3');
|
||||
function system_ver() {
|
||||
return 'fp-' . SYSTEM_VER;
|
||||
}
|
||||
$string .= "\n?>";
|
||||
|
||||
return io_write_file($file, $string);
|
||||
|
||||
// } else die('Wrong number of parameters!');
|
||||
}
|
||||
|
||||
function system_ver_compare($newver, $oldver) {
|
||||
$nv_arr = explode('.', $newver);
|
||||
$ov_arr = explode('.', $oldver);
|
||||
$cn = count($nv_arr);
|
||||
$co = count($ov_arr);
|
||||
$max = min($cn, $co);
|
||||
function system_hashsalt_save($force = false) {
|
||||
global $fp_config;
|
||||
if ($force || !file_exists(HASHSALT_FILE))
|
||||
return system_save(HASHSALT_FILE, array(
|
||||
'fp_hashsalt' => $fp_config ['general'] ['blogid'] . ABS_PATH . BLOG_BASEURL . mt_rand()
|
||||
));
|
||||
return true;
|
||||
}
|
||||
|
||||
// let's compare if one of the first version numbers differs
|
||||
// from new version, being greater
|
||||
for ($i=0; $i<$max; $i++) {
|
||||
if ( $nv_arr[ $i ] > $ov_arr[ $i ] ) { return 1; }
|
||||
if ( $nv_arr[ $i ] < $ov_arr[ $i ] ) { return 0; }
|
||||
define('SYSTEM_VER', '1.1');
|
||||
|
||||
function system_ver() {
|
||||
return 'fp-' . SYSTEM_VER;
|
||||
}
|
||||
|
||||
function system_ver_compare($newver, $oldver) {
|
||||
$nv_arr = explode('.', $newver);
|
||||
$ov_arr = explode('.', $oldver);
|
||||
$cn = count($nv_arr);
|
||||
$co = count($ov_arr);
|
||||
$max = min($cn, $co);
|
||||
|
||||
// let's compare if one of the first version numbers differs
|
||||
// from new version, being greater
|
||||
for($i = 0; $i < $max; $i++) {
|
||||
if ($nv_arr [$i] > $ov_arr [$i]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if they equals, but still new version has more digits
|
||||
// then old-version is still outdated
|
||||
if ($cn > $co) return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function system_generate_id($string) {
|
||||
return 'fp-'.dechex(crc32($string) ^ mt_rand());
|
||||
}
|
||||
|
||||
function system_guessblogroot() {
|
||||
return substr($_SERVER['REQUEST_URI'], 0,strrpos($_SERVER['REQUEST_URI'],'/')+1);
|
||||
}
|
||||
|
||||
function system_guessbaseurl() {
|
||||
return 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT;
|
||||
}
|
||||
|
||||
function system_getindex() {
|
||||
if (MOD_BLOG != INDEX)
|
||||
return MOD_BLOG;
|
||||
else
|
||||
return 'index.php';
|
||||
}
|
||||
|
||||
function system_unregister_globals() {
|
||||
$v = @ini_get('register_globals');
|
||||
|
||||
// on error we unregister anyway
|
||||
if ($v || is_null($v)) {
|
||||
foreach ($_REQUEST as $var => $val) {
|
||||
unset($GLOBALS[$var]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function system_sanitizequery() {
|
||||
$err = false;
|
||||
foreach ($_GET as $k => $v) {
|
||||
if (preg_match('![<>]|://!', $v)) {
|
||||
$err = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($err) {
|
||||
// @todo add log handler
|
||||
utils_redirect();
|
||||
if ($nv_arr [$i] < $ov_arr [$i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function system_prepare_iis() {
|
||||
if (!@$_SERVER['REQUEST_URI']) {
|
||||
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],1 );
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if they equals, but still new version has more digits
|
||||
// then old-version is still outdated
|
||||
if ($cn > $co)
|
||||
return 1;
|
||||
}
|
||||
|
||||
function system_init_action_params() {
|
||||
|
||||
global $fp_params;
|
||||
|
||||
$fp_params = array();
|
||||
|
||||
if ($x = @$_GET['x'])
|
||||
$fp_params = utils_kexplode($x, ':;', false);
|
||||
|
||||
$fp_params = array_merge($_GET, $fp_params);
|
||||
|
||||
}
|
||||
function system_generate_id($string) {
|
||||
return 'fp-' . dechex(crc32($string) ^ mt_rand());
|
||||
}
|
||||
|
||||
function system_guessblogroot() {
|
||||
return substr($_SERVER ['REQUEST_URI'], 0, strrpos($_SERVER ['REQUEST_URI'], '/') + 1);
|
||||
}
|
||||
|
||||
function system_guessbaseurl() {
|
||||
return 'http://' . $_SERVER ['HTTP_HOST'] . BLOG_ROOT;
|
||||
}
|
||||
|
||||
function system_getindex() {
|
||||
if (MOD_BLOG != INDEX)
|
||||
return MOD_BLOG;
|
||||
else
|
||||
return 'index.php';
|
||||
}
|
||||
|
||||
function system_unregister_globals() {
|
||||
$v = @ini_get('register_globals');
|
||||
|
||||
function system_init() {
|
||||
|
||||
system_sanitizequery();
|
||||
system_unregister_globals();
|
||||
system_prepare_iis();
|
||||
|
||||
$GLOBALS['fpdb'] = new FPDB;
|
||||
|
||||
$GLOBALS['fp_widgets'] = new widget_indexer;
|
||||
|
||||
$GLOBALS['smarty'] =& $GLOBALS['_FP_SMARTY'];
|
||||
$smarty =& $GLOBALS['smarty'];
|
||||
|
||||
$GLOBALS['fp_config'] = config_load();
|
||||
|
||||
cookie_setup();
|
||||
sess_setup();
|
||||
user_loggedin();
|
||||
|
||||
ob_start();
|
||||
|
||||
$GLOBALS['theme'] = theme_loadsettings();
|
||||
|
||||
$GLOBALS['lang'] = lang_load();
|
||||
|
||||
// on error we unregister anyway
|
||||
if ($v || is_null($v)) {
|
||||
foreach ($_REQUEST as $var => $val) {
|
||||
unset($GLOBALS [$var]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin_loadall();
|
||||
|
||||
// init smarty
|
||||
$smarty->compile_dir = CACHE_DIR;
|
||||
$smarty->cache_dir = SMARTY_DIR . 'cache/';
|
||||
$smarty->caching = 0;
|
||||
|
||||
do_action('init');
|
||||
ob_end_clean();
|
||||
|
||||
function system_sanitizequery() {
|
||||
$err = false;
|
||||
foreach ($_GET as $k => $v) {
|
||||
if (preg_match('![<>]|://!', $v)) {
|
||||
$err = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($err) {
|
||||
// @todo add log handler
|
||||
utils_redirect();
|
||||
}
|
||||
}
|
||||
|
||||
function system_seterr($module, $val) {
|
||||
if ($module)
|
||||
$elem = 'success_'.$module;
|
||||
else
|
||||
$elem = 'success';
|
||||
sess_add($elem, $val);
|
||||
function system_prepare_iis() {
|
||||
if (!@$_SERVER ['REQUEST_URI']) {
|
||||
$_SERVER ['REQUEST_URI'] = substr($_SERVER ['PHP_SELF'], 1);
|
||||
if (isset($_SERVER ['QUERY_STRING'])) {
|
||||
$_SERVER ['REQUEST_URI'] .= '?' . $_SERVER ['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function system_geterr($module='') {
|
||||
if ($module)
|
||||
$elem = 'success_'.$module;
|
||||
else
|
||||
$elem = 'success';
|
||||
return sess_remove($elem);
|
||||
}
|
||||
function system_init_action_params() {
|
||||
global $fp_params;
|
||||
|
||||
/* delayed print */
|
||||
function system_dpr($action, $content) {
|
||||
$p = print_r($content,1);
|
||||
$f = create_function('', "echo '<pre style=\'position:absolute\'>$p</pre>';");
|
||||
add_action($action, $f);
|
||||
}
|
||||
$fp_params = array();
|
||||
|
||||
if ($x = @$_GET ['x'])
|
||||
$fp_params = utils_kexplode($x, ':;', false);
|
||||
|
||||
$fp_params = array_merge($_GET, $fp_params);
|
||||
}
|
||||
|
||||
function system_init() {
|
||||
system_sanitizequery();
|
||||
system_unregister_globals();
|
||||
system_prepare_iis();
|
||||
|
||||
$GLOBALS ['fpdb'] = new FPDB();
|
||||
|
||||
$GLOBALS ['fp_widgets'] = new widget_indexer();
|
||||
|
||||
$GLOBALS ['smarty'] = & $GLOBALS ['_FP_SMARTY'];
|
||||
$smarty = & $GLOBALS ['smarty'];
|
||||
|
||||
$GLOBALS ['fp_config'] = config_load();
|
||||
|
||||
cookie_setup();
|
||||
sess_setup();
|
||||
user_loggedin();
|
||||
|
||||
ob_start();
|
||||
|
||||
$GLOBALS ['theme'] = theme_loadsettings();
|
||||
|
||||
$GLOBALS ['lang'] = lang_load();
|
||||
|
||||
plugin_loadall();
|
||||
|
||||
// init smarty
|
||||
$smarty->compile_dir = CACHE_DIR;
|
||||
$smarty->cache_dir = SMARTY_DIR . 'cache/';
|
||||
$smarty->caching = 0;
|
||||
|
||||
do_action('init');
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
function system_seterr($module, $val) {
|
||||
if ($module)
|
||||
$elem = 'success_' . $module;
|
||||
else
|
||||
$elem = 'success';
|
||||
sess_add($elem, $val);
|
||||
}
|
||||
|
||||
function system_geterr($module = '') {
|
||||
if ($module)
|
||||
$elem = 'success_' . $module;
|
||||
else
|
||||
$elem = 'success';
|
||||
return sess_remove($elem);
|
||||
}
|
||||
|
||||
/* delayed print */
|
||||
function system_dpr($action, $content) {
|
||||
$p = print_r($content, 1);
|
||||
$f = create_function('', "echo '<pre style=\'position:absolute\'>$p</pre>';");
|
||||
add_action($action, $f);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -167,7 +167,8 @@
|
||||
|
||||
echo "\n<!-- FP STD STYLESHEET -->\n";
|
||||
|
||||
echo '<link media="screen,projection,handheld" href="';
|
||||
// echo '<link media="screen,projection,handheld" href="';
|
||||
echo '<link media="screen" href="';
|
||||
echo BLOG_BASEURL . THEMES_DIR . THE_THEME;
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
function bdb_entrylister() {
|
||||
$this->_cachefile = CACHE_DIR . 'userlist.php';
|
||||
parent::cache_filelister();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
|
@ -1,458 +1,445 @@
|
||||
<?php
|
||||
|
||||
// utils.php
|
||||
// library of misc utilities
|
||||
|
||||
|
||||
// function subkey sort
|
||||
// function prototype :
|
||||
// array utils_sksort(array $arr, string $key, int $flag=SORT_ASC)
|
||||
// sorts an array of associative arrays by given key $key
|
||||
// $flag can be SORT_ASC or SORT_DESC for ascending
|
||||
// or descending order (defaults to ascending);
|
||||
// other flags are the same of array_multisort() php function ;)
|
||||
function utils_sksort($arr, $key, $flag=SORT_ASC) {
|
||||
if ($arr) {
|
||||
foreach($arr as $val)
|
||||
$sorter[] = $val[$key];
|
||||
array_multisort($sorter, $flag, $arr);
|
||||
return $arr;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
// function prototype:
|
||||
// bool utils_pattern_match(string $string, string $pattern)
|
||||
|
||||
// returns true if $pattern matches $string, else returns false (what else?)
|
||||
// $pattern is a string containing standard shell-style jokers: * and ?
|
||||
// regex are powerful but somtimes, too complicated :)
|
||||
// usage: * matches a variable number of chars
|
||||
// e.g. : doc*.txt matches document.txt, docs.txt, dock.txt, etc.
|
||||
// and also doc.txt (note: I didn't want it to do that, but I didn't change it)
|
||||
// ? matches one char, whichever is
|
||||
// e.g. : document?.txt matches document1.txt, document2.txt, document3.txt, etc.
|
||||
// likewise "*", it should match document.txt, too (but I hadn't tried it :) )
|
||||
|
||||
// code from http://www.php.net/function.glob.php.htm#54519
|
||||
// by x_terminat_or_3 at yahoo dot country:fr
|
||||
// thank you, man ;)
|
||||
// as usual, slightly modified to fit my tastes :)
|
||||
|
||||
// utils.php
|
||||
// library of misc utilities
|
||||
|
||||
// function subkey sort
|
||||
// function prototype :
|
||||
// array utils_sksort(array $arr, string $key, int $flag=SORT_ASC)
|
||||
// sorts an array of associative arrays by given key $key
|
||||
// $flag can be SORT_ASC or SORT_DESC for ascending
|
||||
// or descending order (defaults to ascending);
|
||||
// other flags are the same of array_multisort() php function ;)
|
||||
function utils_sksort($arr, $key, $flag = SORT_ASC) {
|
||||
if ($arr) {
|
||||
foreach ($arr as $val)
|
||||
$sorter [] = $val [$key];
|
||||
array_multisort($sorter, $flag, $arr);
|
||||
return $arr;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
// function prototype:
|
||||
// bool utils_pattern_match(string $string, string $pattern)
|
||||
|
||||
// returns true if $pattern matches $string, else returns false (what else?)
|
||||
// $pattern is a string containing standard shell-style jokers: * and ?
|
||||
// regex are powerful but somtimes, too complicated :)
|
||||
// usage: * matches a variable number of chars
|
||||
// e.g. : doc*.txt matches document.txt, docs.txt, dock.txt, etc.
|
||||
// and also doc.txt (note: I didn't want it to do that, but I didn't change it)
|
||||
// ? matches one char, whichever is
|
||||
// e.g. : document?.txt matches document1.txt, document2.txt, document3.txt, etc.
|
||||
// likewise "*", it should match document.txt, too (but I hadn't tried it :) )
|
||||
|
||||
// code from http://www.php.net/function.glob.php.htm#54519
|
||||
// by x_terminat_or_3 at yahoo dot country:fr
|
||||
// thank you, man ;)
|
||||
// as usual, slightly modified to fit my tastes :)
|
||||
|
||||
if (!function_exists('fnmatch')) {
|
||||
|
||||
function fnmatch($pattern, $string) {
|
||||
|
||||
if ($pattern == null)
|
||||
return false;
|
||||
|
||||
//basically prepare a regular expression
|
||||
$out=null;
|
||||
$chunks=explode(';',$pattern);
|
||||
foreach($chunks as $pattern)
|
||||
{
|
||||
$escape=array('$','^','.','{','}','(',')','[',']','|');
|
||||
while(strpos($pattern,'**')!==false)
|
||||
$pattern=str_replace('**','*',$pattern);
|
||||
|
||||
foreach($escape as $probe)
|
||||
$pattern=str_replace($probe,"\\$probe",$pattern);
|
||||
$pattern=str_replace('?*','*', str_replace('*?','*',
|
||||
str_replace('*',".*",
|
||||
str_replace('?','.{1,1}',$pattern))));
|
||||
$out[]=$pattern;
|
||||
// basically prepare a regular expression
|
||||
$out = null;
|
||||
$chunks = explode(';', $pattern);
|
||||
foreach ($chunks as $pattern) {
|
||||
$escape = array(
|
||||
'$',
|
||||
'^',
|
||||
'.',
|
||||
'{',
|
||||
'}',
|
||||
'(',
|
||||
')',
|
||||
'[',
|
||||
']',
|
||||
'|'
|
||||
);
|
||||
while (strpos($pattern, '**') !== false)
|
||||
$pattern = str_replace('**', '*', $pattern);
|
||||
|
||||
foreach ($escape as $probe)
|
||||
$pattern = str_replace($probe, "\\$probe", $pattern);
|
||||
$pattern = str_replace('?*', '*', str_replace('*?', '*', str_replace('*', ".*", str_replace('?', '.{1,1}', $pattern))));
|
||||
$out [] = $pattern;
|
||||
}
|
||||
/* // NoWhereMan note: why splitting this in two? :)
|
||||
if(count($out)==1) return(eregi("^$out[0]$",$string)); else*/
|
||||
foreach($out as $tester) {
|
||||
if (preg_match("/^$tester$/i",$string))
|
||||
/*
|
||||
* // NoWhereMan note: why splitting this in two? :)
|
||||
* if(count($out)==1) return(eregi("^$out[0]$",$string)); else
|
||||
*/
|
||||
foreach ($out as $tester) {
|
||||
if (preg_match("/^$tester$/i", $string))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// function prototype:
|
||||
// array utils_kexplode(string $string, string $delim='|')
|
||||
|
||||
// explodes a string into an array by the given delimiter;
|
||||
// delimiter defaults to pipe ('|').
|
||||
// the string must be formatted as in:
|
||||
// key1|value1|key2|value2 , etc.
|
||||
// the array will look like
|
||||
// $arr['key1'] = 'value1'; $arr['key2'] = 'value2'; etc.
|
||||
function utils_kexplode($string, $delim = '|', $keyupper = true) {
|
||||
$arr = array();
|
||||
$string = trim($string);
|
||||
|
||||
|
||||
// function prototype:
|
||||
// array utils_kexplode(string $string, string $delim='|')
|
||||
|
||||
// explodes a string into an array by the given delimiter;
|
||||
// delimiter defaults to pipe ('|').
|
||||
// the string must be formatted as in:
|
||||
// key1|value1|key2|value2 , etc.
|
||||
// the array will look like
|
||||
// $arr['key1'] = 'value1'; $arr['key2'] = 'value2'; etc.
|
||||
|
||||
function utils_kexplode($string, $delim='|', $keyupper=true) {
|
||||
$arr = array();
|
||||
$string = trim($string);
|
||||
|
||||
$k = strtolower(strtok($string, $delim));
|
||||
$arr[$k] = strtok($delim);
|
||||
while (( $k = strtok($delim) ) !== false) {
|
||||
if ($keyupper && !preg_match('/[A-Z-_]/',$k)){
|
||||
/*
|
||||
trigger_error("Failed parsing <pre>$string</pre>
|
||||
keys were supposed to be UPPERCASE but <strong>\"$k\"</strong> was found; file may be corrupted
|
||||
or in an expected format. <br />
|
||||
Some SimplePHPBlog files may raise this error: set DUMB_MODE_ENABLED
|
||||
to true in your defaults.php to force parsing of the offending keys.",
|
||||
E_USER_WARNING);
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
$arr[strtolower($k)] = strtok($delim);
|
||||
$k = strtolower(strtok($string, $delim));
|
||||
$arr [$k] = strtok($delim);
|
||||
while (($k = strtok($delim)) !== false) {
|
||||
if ($keyupper && !preg_match('/[A-Z-_]/', $k)) {
|
||||
/*
|
||||
* trigger_error("Failed parsing <pre>$string</pre>
|
||||
* keys were supposed to be UPPERCASE but <strong>\"$k\"</strong> was found; file may be corrupted
|
||||
* or in an expected format. <br />
|
||||
* Some SimplePHPBlog files may raise this error: set DUMB_MODE_ENABLED
|
||||
* to true in your defaults.php to force parsing of the offending keys.",
|
||||
* E_USER_WARNING);
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
$arr [strtolower($k)] = strtok($delim);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/*
|
||||
function utils_newkexplode($string, $delim='|') {
|
||||
|
||||
$arr = array();
|
||||
|
||||
$lastoffset = $offset = 0;
|
||||
$len = strlen($string);
|
||||
|
||||
while ($lastoffset<$len) {
|
||||
$offset = strpos($string, $delim, $lastoffset);
|
||||
$key = substr($string, $lastoffset, $offset-$lastoffset);
|
||||
//echo 'parsing key: ', $key, $offset, chr(10);
|
||||
|
||||
$lastoffset = $offset + 1;
|
||||
|
||||
if (!ctype_upper($key))
|
||||
trigger_error("Failed parsing \"$string\"
|
||||
keys were supposed to be UPPERCASE", E_USER_ERROR);
|
||||
|
||||
$offset = strpos($string, $delim, $lastoffset);
|
||||
/*
|
||||
* function utils_newkexplode($string, $delim='|') {
|
||||
*
|
||||
* $arr = array();
|
||||
*
|
||||
* $lastoffset = $offset = 0;
|
||||
* $len = strlen($string);
|
||||
*
|
||||
* while ($lastoffset<$len) {
|
||||
* $offset = strpos($string, $delim, $lastoffset);
|
||||
* $key = substr($string, $lastoffset, $offset-$lastoffset);
|
||||
* //echo 'parsing key: ', $key, $offset, chr(10);
|
||||
*
|
||||
* $lastoffset = $offset + 1;
|
||||
*
|
||||
* if (!ctype_upper($key))
|
||||
* trigger_error("Failed parsing \"$string\"
|
||||
* keys were supposed to be UPPERCASE", E_USER_ERROR);
|
||||
*
|
||||
* $offset = strpos($string, $delim, $lastoffset);
|
||||
*
|
||||
* if ($offset===false)
|
||||
* $offset = $len;
|
||||
*
|
||||
* $val = substr($string, $lastoffset, $offset-$lastoffset);
|
||||
*
|
||||
* //echo 'parsing value ', $val, $offset, chr(10);
|
||||
*
|
||||
* $lastoffset = $offset + 1;
|
||||
*
|
||||
* $arr[$key] = $val;
|
||||
*
|
||||
* }
|
||||
* return $arr;
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
if ($offset===false)
|
||||
$offset = $len;
|
||||
// function prototype:
|
||||
// array utils_kimplode(string $string, string $delim='|')
|
||||
|
||||
$val = substr($string, $lastoffset, $offset-$lastoffset);
|
||||
|
||||
//echo 'parsing value ', $val, $offset, chr(10);
|
||||
|
||||
$lastoffset = $offset + 1;
|
||||
|
||||
$arr[$key] = $val;
|
||||
|
||||
}
|
||||
return $arr;
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
// function prototype:
|
||||
// array utils_kimplode(string $string, string $delim='|')
|
||||
|
||||
// explodes a string into an array by the given delimiter;
|
||||
// delimiter defaults to pipe ('|').
|
||||
// the string must be formatted as in:
|
||||
// key1|value1|key2|value2 , etc.
|
||||
// the array will look like
|
||||
// $arr['key1'] = 'value1'; $arr['key2'] = 'value2'; etc.
|
||||
|
||||
function utils_kimplode($arr, $delim='|') {
|
||||
|
||||
$string = "";
|
||||
foreach ($arr as $k => $val) {
|
||||
if ($val)
|
||||
$string .= strtoupper($k) . $delim . ($val) . $delim;
|
||||
}
|
||||
return $string;
|
||||
// explodes a string into an array by the given delimiter;
|
||||
// delimiter defaults to pipe ('|').
|
||||
// the string must be formatted as in:
|
||||
// key1|value1|key2|value2 , etc.
|
||||
// the array will look like
|
||||
// $arr['key1'] = 'value1'; $arr['key2'] = 'value2'; etc.
|
||||
function utils_kimplode($arr, $delim = '|') {
|
||||
$string = "";
|
||||
foreach ($arr as $k => $val) {
|
||||
if ($val)
|
||||
$string .= strtoupper($k) . $delim . ($val) . $delim;
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @todo send mail to admin
|
||||
*/
|
||||
function &utils_explode_recursive($array, &$string, $rdelim, $ldelim = '', $outerldelim = '', $outerrdelim = '') {
|
||||
$string .= $outerldelim;
|
||||
|
||||
/**
|
||||
* @todo send mail to admin
|
||||
*/
|
||||
|
||||
|
||||
function &utils_explode_recursive($array, &$string, $rdelim, $ldelim='', $outerldelim='', $outerrdelim='') {
|
||||
|
||||
$string .= $outerldelim;
|
||||
|
||||
while (list(,$val) = each($array)) {
|
||||
|
||||
$string .= $rdelim;
|
||||
if (is_array($val)) {
|
||||
$string .= utils_explode_recursive($val, $string, $rdelim, $ldelim, $outerldelim, $outerrdelim);
|
||||
} else {
|
||||
$string .= $val;
|
||||
}
|
||||
|
||||
$string .= $ldelim;
|
||||
|
||||
}
|
||||
|
||||
$string .= $outerrdelim;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function utils_validateinput($str) {
|
||||
while ($val = array_shift($array)) {
|
||||
|
||||
if (preg_match('/[^a-z0-9\-_]/i',$str)){
|
||||
trigger_error("String \"$str\" is not a valid input", E_USER_ERROR);
|
||||
//return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
function utils_cut_string($str,$maxc) {
|
||||
$car = strlen($str);
|
||||
if($car > $maxc) {
|
||||
return substr($str, 0, $maxc)."...";
|
||||
$string .= $rdelim;
|
||||
if (is_array($val)) {
|
||||
$string .= utils_explode_recursive($val, $string, $rdelim, $ldelim, $outerldelim, $outerrdelim);
|
||||
} else {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function utils_status_header($status) {
|
||||
|
||||
switch ($status) {
|
||||
case 301:
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
break;
|
||||
case 403:
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
break;
|
||||
case 404:
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// code from php.net ;)
|
||||
// defaults to index.php ;)
|
||||
function utils_redirect($location="", $absolute_path=false, $red_type=null) {
|
||||
|
||||
if (!$absolute_path)
|
||||
$location = BLOG_BASEURL . $location;
|
||||
|
||||
if ( function_exists('wp_redirect') ) {
|
||||
wp_redirect($location);
|
||||
} else {
|
||||
header("Location: $location");
|
||||
$string .= $val;
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
$string .= $ldelim;
|
||||
}
|
||||
|
||||
$string .= $outerrdelim;
|
||||
}
|
||||
|
||||
function utils_validateinput($str) {
|
||||
if (preg_match('/[^a-z0-9\-_]/i', $str)) {
|
||||
trigger_error("String \"$str\" is not a valid input", E_USER_ERROR);
|
||||
// return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
function utils_cut_string($str, $maxc) {
|
||||
$car = strlen($str);
|
||||
if ($car > $maxc) {
|
||||
return substr($str, 0, $maxc) . "...";
|
||||
} else {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
function utils_status_header($status) {
|
||||
switch ($status) {
|
||||
case 301:
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
break;
|
||||
case 403:
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
break;
|
||||
case 404:
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// code from php.net ;)
|
||||
// defaults to index.php ;)
|
||||
function utils_redirect($location = "", $absolute_path = false, $red_type = null) {
|
||||
if (!$absolute_path)
|
||||
$location = BLOG_BASEURL . $location;
|
||||
|
||||
/*
|
||||
* utils_geturlstring()
|
||||
*
|
||||
* @return string complete url string as displayed in the browser
|
||||
*
|
||||
*/
|
||||
|
||||
function utils_geturlstring() {
|
||||
$str = BLOG_BASEURL . $_SERVER['PHP_SELF'];
|
||||
if ($_SERVER['QUERY_STRING'])
|
||||
$str .='?'.$_SERVER['QUERY_STRING'];
|
||||
return $str;
|
||||
if (function_exists('wp_redirect')) {
|
||||
wp_redirect($location);
|
||||
} else {
|
||||
header("Location: $location");
|
||||
}
|
||||
|
||||
// custom array_merge:
|
||||
// pads the second array to match the length of the first
|
||||
// this can be improved, anyway for now I'd just
|
||||
// do a quick & dirty solution :)
|
||||
function utils_array_merge($arr1, $arr2) {
|
||||
|
||||
$len=count($arr1[0]);
|
||||
|
||||
foreach($arr2 as $k=>$v)
|
||||
$arr2[$k]=array_pad((Array) $v, $len, null);
|
||||
|
||||
return array_merge($arr1, $arr2);
|
||||
exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* utils_geturlstring()
|
||||
*
|
||||
* @return string complete url string as displayed in the browser
|
||||
*
|
||||
*/
|
||||
function utils_geturlstring() {
|
||||
$str = BLOG_BASEURL . $_SERVER ['PHP_SELF'];
|
||||
if ($_SERVER ['QUERY_STRING'])
|
||||
$str .= '?' . $_SERVER ['QUERY_STRING'];
|
||||
return $str;
|
||||
}
|
||||
|
||||
// custom array_merge:
|
||||
// pads the second array to match the length of the first
|
||||
// this can be improved, anyway for now I'd just
|
||||
// do a quick & dirty solution :)
|
||||
function utils_array_merge($arr1, $arr2) {
|
||||
$len = count($arr1 [0]);
|
||||
|
||||
foreach ($arr2 as $k => $v)
|
||||
$arr2 [$k] = array_pad((array) $v, $len, null);
|
||||
|
||||
return array_merge($arr1, $arr2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple function to replicate PHP 5 behaviour
|
||||
*/
|
||||
function utils_microtime() {
|
||||
list ($usec, $sec) = explode(" ", microtime());
|
||||
return ((float) $usec + (float) $sec);
|
||||
}
|
||||
|
||||
function utils_countdashes($string, &$rest) {
|
||||
trim($string);
|
||||
$i = 0;
|
||||
while ($string {$i} == '-') {
|
||||
$i++;
|
||||
}
|
||||
if ($i)
|
||||
$rest = substr($string, $i);
|
||||
else
|
||||
$rest = $string;
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Simple function to replicate PHP 5 behaviour
|
||||
*/
|
||||
function utils_microtime()
|
||||
{
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
return ((float)$usec + (float)$sec);
|
||||
}
|
||||
|
||||
function utils_countdashes($string, &$rest) {
|
||||
trim($string);
|
||||
$i = 0;
|
||||
while ($string{$i} == '-') {
|
||||
$i++;
|
||||
}
|
||||
if ($i)
|
||||
$rest = substr($string, $i);
|
||||
else $rest = $string;
|
||||
|
||||
return $i;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function utils_mail($from, $subject, $message, $headers = '') {
|
||||
global $fp_config;
|
||||
if( $headers == '' ) {
|
||||
$headers = "MIME-Version: 1.0\n" .
|
||||
"From: " . $from . "\n" .
|
||||
"Content-Type: text/plain; charset=\"" . $fp_config['general']['charset'] . "\"\n";
|
||||
}
|
||||
|
||||
return mail($fp_config['general']['email'], $subject, $message, $headers);
|
||||
function utils_mail($from, $subject, $message, $headers = '') {
|
||||
global $fp_config;
|
||||
if ($headers == '') {
|
||||
$headers = "MIME-Version: 1.0\n" . "From: " . $from . "\n" . "Content-Type: text/plain; charset=\"" . $fp_config ['general'] ['charset'] . "\"\n";
|
||||
}
|
||||
|
||||
return mail($fp_config ['general'] ['email'], $subject, $message, $headers);
|
||||
}
|
||||
|
||||
/*
|
||||
* props: http://crisp.tweakblogs.net/blog/2031
|
||||
*/
|
||||
function utils_validateIPv4($IP) {
|
||||
return $IP == long2ip(ip2long($IP));
|
||||
}
|
||||
|
||||
function utils_validateIPv6($IP) {
|
||||
// fast exit for localhost
|
||||
if (strlen($IP) < 3)
|
||||
return $IP == '::';
|
||||
|
||||
// Check if part is in IPv4 format
|
||||
if (strpos($IP, '.'))
|
||||
{
|
||||
$lastcolon = strrpos($IP, ':');
|
||||
if (!($lastcolon && validateIPv4(substr($IP, $lastcolon + 1))))
|
||||
return false;
|
||||
|
||||
// replace IPv4 part with dummy
|
||||
$IP = substr($IP, 0, $lastcolon) . ':0:0';
|
||||
}
|
||||
|
||||
// check uncompressed
|
||||
if (strpos($IP, '::') === false)
|
||||
{
|
||||
return preg_match('/^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i', $IP);
|
||||
}
|
||||
|
||||
// check colon-count for compressed format
|
||||
if (substr_count($IP, ':') < 8)
|
||||
{
|
||||
return preg_match('/^(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?$/i', $IP);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
function utils_validateIPv4($IP) {
|
||||
return $IP == long2ip(ip2long($IP));
|
||||
}
|
||||
|
||||
// get client IP
|
||||
function utils_ipget() {
|
||||
function utils_validateIPv6($IP) {
|
||||
// fast exit for localhost
|
||||
if (strlen($IP) < 3)
|
||||
return $IP == '::';
|
||||
|
||||
// Check if part is in IPv4 format
|
||||
if (strpos($IP, '.')) {
|
||||
$lastcolon = strrpos($IP, ':');
|
||||
if (!($lastcolon && validateIPv4(substr($IP, $lastcolon + 1))))
|
||||
return false;
|
||||
|
||||
$ip = '';
|
||||
|
||||
if ( !empty ( $_SERVER[ 'HTTP_CLIENT_IP' ] ) ) {
|
||||
$ip = $_SERVER[ 'HTTP_CLIENT_IP' ];
|
||||
}
|
||||
elseif ( !empty ( $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] ) ) {
|
||||
$ip = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ];
|
||||
}
|
||||
elseif ( !empty ( $_SERVER[ 'REMOTE_ADDR' ] ) ) {
|
||||
$ip = $_SERVER[ 'REMOTE_ADDR' ];
|
||||
}
|
||||
elseif ( getenv( "HTTP_CLIENT_IP" ) ) {
|
||||
$ip = getenv( "HTTP_CLIENT_IP" );
|
||||
}
|
||||
elseif ( getenv( "HTTP_X_FORWARDED_FOR" ) ) {
|
||||
$ip = getenv( "HTTP_X_FORWARDED_FOR" );
|
||||
}
|
||||
elseif ( getenv( "REMOTE_ADDR") ) {
|
||||
$ip = getenv( "REMOTE_ADDR" );
|
||||
}
|
||||
|
||||
if (utils_validateIPv4($ip) || utils_validateIPv6($ip)) {
|
||||
return $ip;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
// replace IPv4 part with dummy
|
||||
$IP = substr($IP, 0, $lastcolon) . ':0:0';
|
||||
}
|
||||
|
||||
function utils_nocache_headers() {
|
||||
@ header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
|
||||
@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
@ header('Cache-Control: no-cache, must-revalidate, max-age=0');
|
||||
@ header('Pragma: no-cache');
|
||||
|
||||
// check uncompressed
|
||||
if (strpos($IP, '::') === false) {
|
||||
return preg_match('/^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i', $IP);
|
||||
}
|
||||
|
||||
// check colon-count for compressed format
|
||||
if (substr_count($IP, ':') < 8) {
|
||||
return preg_match('/^(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?$/i', $IP);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// get client IP
|
||||
function utils_ipget() {
|
||||
$ip = '';
|
||||
|
||||
if (!empty($_SERVER ['HTTP_CLIENT_IP'])) {
|
||||
$ip = $_SERVER ['HTTP_CLIENT_IP'];
|
||||
} elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER ['HTTP_X_FORWARDED_FOR'];
|
||||
} elseif (!empty($_SERVER ['REMOTE_ADDR'])) {
|
||||
$ip = $_SERVER ['REMOTE_ADDR'];
|
||||
} elseif (getenv("HTTP_CLIENT_IP")) {
|
||||
$ip = getenv("HTTP_CLIENT_IP");
|
||||
} elseif (getenv("HTTP_X_FORWARDED_FOR")) {
|
||||
$ip = getenv("HTTP_X_FORWARDED_FOR");
|
||||
} elseif (getenv("REMOTE_ADDR")) {
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
}
|
||||
|
||||
if (utils_validateIPv4($ip) || utils_validateIPv6($ip)) {
|
||||
return $ip;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function utils_nocache_headers() {
|
||||
@ header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
|
||||
@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
@ header('Cache-Control: no-cache, must-revalidate, max-age=0');
|
||||
@ header('Pragma: no-cache');
|
||||
}
|
||||
|
||||
// from http://nadeausoftware.com/articles/2007/06/php_tip_how_get_web_page_using_curl
|
||||
// code under OSI BSD
|
||||
/**
|
||||
* Get a web file (HTML, XHTML, XML, image, etc.) from a URL. Return an
|
||||
* Get a web file (HTML, XHTML, XML, image, etc.) from a URL.
|
||||
* Return an
|
||||
* array containing the HTTP server response header fields and content.
|
||||
*/
|
||||
function utils_geturl($url) {
|
||||
/*
|
||||
if (ini_get('allow_url_fopen')) {
|
||||
return array('content' => io_load_file($url));
|
||||
}
|
||||
*/
|
||||
* if (ini_get('allow_url_fopen')) {
|
||||
* return array('content' => io_load_file($url));
|
||||
* }
|
||||
*/
|
||||
if (!function_exists('curl_init')) {
|
||||
trigger_error('curl extension is not installed');
|
||||
return array();
|
||||
}
|
||||
|
||||
$options = array(
|
||||
CURLOPT_RETURNTRANSFER => true, // return web page
|
||||
CURLOPT_HEADER => false, // don't return headers
|
||||
CURLOPT_FOLLOWLOCATION => false, // don't follow redirects
|
||||
CURLOPT_ENCODING => "", // handle all encodings
|
||||
CURLOPT_USERAGENT => "spider", // who am i
|
||||
CURLOPT_AUTOREFERER => true, // set referer on redirect
|
||||
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
|
||||
CURLOPT_TIMEOUT => 120, // timeout on response
|
||||
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
|
||||
);
|
||||
|
||||
$ch = curl_init( $url );
|
||||
curl_setopt_array( $ch, $options );
|
||||
$content = curl_exec( $ch );
|
||||
$err = curl_errno( $ch );
|
||||
$errmsg = curl_error( $ch );
|
||||
$header = curl_getinfo( $ch );
|
||||
curl_close( $ch );
|
||||
|
||||
$header['errno'] = $err;
|
||||
$header['errmsg'] = $errmsg;
|
||||
$header['content'] = $content;
|
||||
return $header;
|
||||
|
||||
$options = array(
|
||||
CURLOPT_RETURNTRANSFER => true, // return web page
|
||||
CURLOPT_HEADER => false, // don't return headers
|
||||
CURLOPT_FOLLOWLOCATION => false, // don't follow redirects
|
||||
CURLOPT_ENCODING => "", // handle all encodings
|
||||
CURLOPT_USERAGENT => "spider", // who am i
|
||||
CURLOPT_AUTOREFERER => true, // set referer on redirect
|
||||
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
|
||||
CURLOPT_TIMEOUT => 120, // timeout on response
|
||||
CURLOPT_MAXREDIRS => 10 // stop after 10 redirects
|
||||
);
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, $options);
|
||||
$content = curl_exec($ch);
|
||||
$err = curl_errno($ch);
|
||||
$errmsg = curl_error($ch);
|
||||
$header = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$header ['errno'] = $err;
|
||||
$header ['errmsg'] = $errmsg;
|
||||
$header ['content'] = $content;
|
||||
return $header;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function utils_checksmarty() {
|
||||
|
||||
if (!file_exists(SMARTY_DIR . 'Smarty.class.php')) {
|
||||
function utils_checksmarty() {
|
||||
if (!file_exists(SMARTY_DIR . 'Smarty.class.php')) {
|
||||
$err = <<<ERR
|
||||
Fatal error: Smarty is not installed; please download it from <a href="http://smarty.php.net">http://smarty.php.net</a>; you will
|
||||
probably need <a href="http://www.phpinsider.com/php/code/SmartyValidate/">SmartyValidate</a> as well; unpack them to <b>fp-includes/core/smarty</b>: please do not overwrite files in fp-includes/core/smarty/plugins/
|
||||
ERR;
|
||||
trigger_error($err, E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fplog($str) {
|
||||
if (!defined('DEBUG_MODE'))
|
||||
echo "\n[DEBUG] $str \n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Shift an element with its key off the beginning of array.
|
||||
* Just like array_shift(), but for an associative array.
|
||||
*
|
||||
* @param array $arr
|
||||
* The input array
|
||||
* @return unknown the shifted value, or NULL if array is empty or is not an array
|
||||
*/
|
||||
function utils_array_kshift(&$arr) {
|
||||
if (!is_array($arr) || count($arr) === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function fplog($str) {
|
||||
if(!defined('DEBUG_MODE'))
|
||||
echo "\n[DEBUG] $str \n";
|
||||
}
|
||||
|
||||
list ($k) = array_keys($arr);
|
||||
$r = array(
|
||||
$k => $arr [$k]
|
||||
);
|
||||
unset($arr [$k]);
|
||||
return $r;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -11,7 +11,7 @@
|
||||
var $_varname = 'fp_widgets';
|
||||
var $_enabledlist = null;
|
||||
|
||||
function widget_indexer() {
|
||||
function __construct() {
|
||||
if (!file_exists(CONFIG_DIR. 'widgets.conf.php'))
|
||||
trigger_error('widgets.conf.php not found. Blog may not work as expected, create a widgetlist.conf.php
|
||||
or reinstall completely FlatPress. If you have just installed FlatPress, the package you
|
||||
@ -45,7 +45,7 @@
|
||||
do {
|
||||
$content = array();
|
||||
|
||||
list(,$id) = each($this->_list[$hor]);
|
||||
$id = array_shift($this->_list[$hor]);
|
||||
|
||||
$newid=$id;# @list($newid, $params) = explode(":", $id);
|
||||
if (@$params) $params = explode(',', $params); else $params = array();
|
||||
|
157
fp-includes/core/function.list_categories.php
Normal file
157
fp-includes/core/function.list_categories.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: function.list_categories.php
|
||||
* Type: function
|
||||
* Name: list_categories
|
||||
* Purpose: print out the comment form
|
||||
*
|
||||
* @param string after
|
||||
* @param string before
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_function_list_categories($params) //, &$smarty)
|
||||
{
|
||||
$cat_params = array(
|
||||
'ild'=>'<li>','ird'=>"</li>\n",
|
||||
'old'=>"<ul>\n",'ord'=>"</ul>\n",
|
||||
'name' => isset($params['name'])? $params['name'] : '',
|
||||
'selected' => array()
|
||||
);
|
||||
|
||||
$cat_params = array_merge($cat_params, $params);
|
||||
|
||||
// makese 'selected' an arr
|
||||
$cat_params['selected'] = (array)$params['selected'];
|
||||
|
||||
//echo "<pre>" . print_r(entry_categories_get()) . "</pre>";
|
||||
|
||||
if (file_exists(CONTENT_DIR . 'categories.txt')) {
|
||||
$cats = trim(io_load_file(CONTENT_DIR . 'categories.txt'));
|
||||
$stack=array(0);
|
||||
$arr=array();
|
||||
|
||||
$line36error = explode("\n", $cats);
|
||||
$line35error = '<ul>'.do_print_categories_list($line36error, $stack, $arr, $cat_params).'</ul>';
|
||||
|
||||
return $line35error;
|
||||
} else {
|
||||
global $lang;
|
||||
|
||||
$content = '<a href="'.BLOG_BASEURL.'">Unfiled</a>';
|
||||
if (isset($lang['admin']['entry']['publish']['nocategories']))
|
||||
$content = $lang['admin']['entry']['publish']['nocategories'];
|
||||
return '<ul><li>' . $content .'</li></ul>' ;
|
||||
}
|
||||
|
||||
//<label><input name="cats[{$catId}]"
|
||||
//{if (bool)array_intersect(array($catId),$categories) }
|
||||
//checked="checked"{/if} type="checkbox" /> {$cat} </label><br />
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
|
||||
|
||||
global $smarty, $fpdb;
|
||||
|
||||
extract($params);
|
||||
|
||||
if (empty($lines)) {
|
||||
$l = count($indentstack)-1;
|
||||
if ($l > 0)
|
||||
$arr = array_fill(0, $l, $ord.$ird);
|
||||
else
|
||||
$arr = array();
|
||||
|
||||
$result = array_merge($result, $arr);
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$str = '';
|
||||
$v = reset($lines);
|
||||
$vt = ltrim($v);
|
||||
|
||||
$indent = utils_countdashes($vt, $text);
|
||||
$indent_old = end($indentstack);
|
||||
|
||||
$val = explode(':', $text);
|
||||
$vt = $val[0];
|
||||
$vid = trim($val[1]);
|
||||
|
||||
$catname = $params['name'];
|
||||
|
||||
if ($indent > $indent_old) {
|
||||
array_push($indentstack, $indent);
|
||||
|
||||
array_pop($result);
|
||||
array_push($result, $old);
|
||||
//array_push($result, $ild);
|
||||
do_print_categories_list($lines, $indentstack, $result, $params);
|
||||
}elseif($indent < $indent_old) {
|
||||
array_pop($indentstack);
|
||||
|
||||
array_push($result, $ord);
|
||||
array_push($result, $ird);
|
||||
|
||||
do_print_categories_list($lines, $indentstack, $result, $params);
|
||||
}else{
|
||||
array_push($result, $ild);
|
||||
|
||||
|
||||
$cat_entry = $params['selected'];
|
||||
|
||||
if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) {
|
||||
$string = '<label><input name="'.$catname.'cats['.$vid.']" ';
|
||||
|
||||
if ((bool) array_intersect(array($vid), $cat_entry))
|
||||
$string .= 'checked="checked" ';
|
||||
|
||||
$string .= 'type="checkbox" />';
|
||||
$before = $string;
|
||||
}elseif (isset($params['type']) && $params['type']=='radio') {
|
||||
$string = '<label><input name="'.$catname.'cats" type="radio" value="'.$vid.'"';
|
||||
if ((bool) array_intersect(array($vid), $cat_entry))
|
||||
$string .= 'checked="checked" ';
|
||||
|
||||
$string .= ' />';
|
||||
$before = $string;
|
||||
|
||||
|
||||
}elseif(isset($params['type']) && $params['type']=='linked'){
|
||||
$before = '<a href="'.get_category_link($vid).'">';
|
||||
}
|
||||
|
||||
|
||||
array_push($result, $before);
|
||||
|
||||
|
||||
array_push($result, $vt);
|
||||
|
||||
if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check' || $params['type']=='radio')) {
|
||||
$string = '</label>';
|
||||
$after = $string;
|
||||
}elseif(isset($params['type']) && $params['type']=='linked'){
|
||||
$after='</a>';
|
||||
if (isset($params['count']) && $params['count']) {
|
||||
$index =& $fpdb->get_index($vid);
|
||||
$count = ($index)? $index->length() : 0;
|
||||
$after = " ($count) ". $after;
|
||||
}
|
||||
}
|
||||
|
||||
array_push($result, $after);
|
||||
|
||||
array_push($result, $ird);
|
||||
array_shift($lines);
|
||||
do_print_categories_list($lines, $indentstack, $result, $params);
|
||||
}
|
||||
|
||||
return implode($result);
|
||||
|
||||
}
|
@ -22,14 +22,14 @@
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://www.smarty.net/
|
||||
* @version 2.6.26
|
||||
* @version 2.6.25-dev
|
||||
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
* @access public
|
||||
* @package Smarty
|
||||
*/
|
||||
|
||||
/* $Id: Config_File.class.php 3149 2009-05-23 20:59:25Z monte.ohrt $ */
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* Config file reading class
|
||||
@ -73,7 +73,7 @@ class Config_File {
|
||||
*
|
||||
* @param string $config_path (optional) path to the config files
|
||||
*/
|
||||
function Config_File($config_path = NULL)
|
||||
public function __construct($config_path = NULL)
|
||||
{
|
||||
if (isset($config_path))
|
||||
$this->set_path($config_path);
|
||||
|
@ -20,17 +20,17 @@
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://www.smarty.net/
|
||||
* @copyright 2001-2005 New Digital Group, Inc.
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
* @package Smarty
|
||||
* @version 2.6.26
|
||||
* @version 2.6.30
|
||||
*/
|
||||
|
||||
/* $Id: Smarty.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* DIR_SEP isn't used anymore, but third party apps might
|
||||
@ -465,7 +465,7 @@ class Smarty
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $_version = '2.6.26';
|
||||
var $_version = '2.6.30';
|
||||
|
||||
/**
|
||||
* current template inclusion depth
|
||||
@ -562,11 +562,17 @@ class Smarty
|
||||
*/
|
||||
var $_cache_including = false;
|
||||
|
||||
/**
|
||||
* plugin filepath cache
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $_filepaths_cache = array();
|
||||
/**#@-*/
|
||||
/**
|
||||
* The class constructor.
|
||||
*/
|
||||
function Smarty()
|
||||
public function __construct()
|
||||
{
|
||||
$this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
|
||||
: @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
|
||||
@ -1058,7 +1064,7 @@ class Smarty
|
||||
} else {
|
||||
// var non-existant, return valid reference
|
||||
$_tmp = null;
|
||||
return $_tmp;
|
||||
return $_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1090,7 +1096,8 @@ class Smarty
|
||||
*/
|
||||
function trigger_error($error_msg, $error_type = E_USER_WARNING)
|
||||
{
|
||||
trigger_error("Smarty error: $error_msg", $error_type);
|
||||
$msg = htmlentities($error_msg);
|
||||
trigger_error("Smarty error: $msg", $error_type);
|
||||
}
|
||||
|
||||
|
||||
@ -1117,7 +1124,7 @@ class Smarty
|
||||
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
|
||||
{
|
||||
static $_cache_info = array();
|
||||
|
||||
|
||||
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
|
||||
? $this->error_reporting : error_reporting() & ~E_NOTICE);
|
||||
|
||||
@ -1933,10 +1940,10 @@ class Smarty
|
||||
{
|
||||
return eval($code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts the filter name from the given callback
|
||||
*
|
||||
*
|
||||
* @param callback $function
|
||||
* @return string
|
||||
*/
|
||||
@ -1951,7 +1958,7 @@ class Smarty
|
||||
return $function;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**#@-*/
|
||||
|
||||
}
|
||||
|
@ -35,16 +35,18 @@ class SmartyValidate {
|
||||
/**
|
||||
* Class Constructor
|
||||
*/
|
||||
function SmartyValidate() { }
|
||||
|
||||
public function __construct() { }
|
||||
|
||||
// public static function SmartyValidate() { }
|
||||
public function SmartyValidate() { }
|
||||
|
||||
/**
|
||||
* initialize the validator
|
||||
*
|
||||
* @param obj $smarty the smarty object
|
||||
* @param string $reset reset the default form?
|
||||
*/
|
||||
function connect(&$smarty, $reset = false) {
|
||||
public static function connect(&$smarty, $reset = false) {
|
||||
if(SmartyValidate::is_valid_smarty_object($smarty)) {
|
||||
SmartyValidate::_object_instance('Smarty', $smarty);
|
||||
SmartyValidate::register_form(SMARTY_VALIDATE_DEFAULT_FORM, $reset);
|
||||
@ -59,7 +61,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param obj $smarty_obj the smarty object
|
||||
*/
|
||||
function is_valid_smarty_object(&$smarty_obj) {
|
||||
public static function is_valid_smarty_object(&$smarty_obj) {
|
||||
return (is_object($smarty_obj) && (strtolower(get_class($smarty_obj)) == 'smarty' || is_subclass_of($smarty_obj, 'smarty')));
|
||||
|
||||
}
|
||||
@ -68,7 +70,7 @@ class SmartyValidate {
|
||||
* clear the entire SmartyValidate session
|
||||
*
|
||||
*/
|
||||
function disconnect() {
|
||||
public static function disconnect() {
|
||||
unset($_SESSION['SmartyValidate']);
|
||||
SmartyValidate::_object_instance('-', $_dummy);
|
||||
}
|
||||
@ -79,7 +81,7 @@ class SmartyValidate {
|
||||
* @param string $form the name of the form being validated
|
||||
* @param string $reset reset an already registered form?
|
||||
*/
|
||||
function register_form($form, $reset = false) {
|
||||
public static function register_form($form, $reset = false) {
|
||||
if(SmartyValidate::is_registered_form($form) && !$reset) {
|
||||
return false;
|
||||
} else {
|
||||
@ -99,7 +101,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $form the name of the form being validated
|
||||
*/
|
||||
function unregister_form($form) {
|
||||
public static function unregister_form($form) {
|
||||
unset($_SESSION['SmartyValidate'][$form]);
|
||||
}
|
||||
|
||||
@ -108,11 +110,11 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $form the name of the form being validated
|
||||
*/
|
||||
function is_registered_form($form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function is_registered_form($form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
return isset($_SESSION['SmartyValidate'][$form]);
|
||||
}
|
||||
|
||||
function _failed_fields(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM, $revalidate = false)
|
||||
public static function _failed_fields(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM, $revalidate = false)
|
||||
{
|
||||
// keep track of failed fields
|
||||
static $_failed_fields = array();
|
||||
@ -254,7 +256,7 @@ class SmartyValidate {
|
||||
* @param string $formvars the array of submitted for variables
|
||||
* @param string $form the name of the form being validated
|
||||
*/
|
||||
function is_valid(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function is_valid(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
|
||||
static $_is_valid = array();
|
||||
|
||||
@ -297,7 +299,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $func_name the function being registered
|
||||
*/
|
||||
function register_object($object_name, &$object) {
|
||||
public static function register_object($object_name, &$object) {
|
||||
if(!is_object($object)) {
|
||||
trigger_error("SmartyValidate: [register_object] not a valid object.");
|
||||
return false;
|
||||
@ -310,7 +312,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $func_name the function being registered
|
||||
*/
|
||||
function is_registered_object($object_name) {
|
||||
public static function is_registered_object($object_name) {
|
||||
$_object =& SmartyValidate::_object_instance($object_name, $_dummy);
|
||||
return is_object($_object);
|
||||
}
|
||||
@ -320,7 +322,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $func_name the function being registered
|
||||
*/
|
||||
function register_criteria($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function register_criteria($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
return SmartyValidate::_register_function('criteria', $name, $func_name, $form);
|
||||
}
|
||||
|
||||
@ -329,7 +331,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $func_name the function being registered
|
||||
*/
|
||||
function register_transform($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function register_transform($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
return SmartyValidate::_register_function('transform', $name, $func_name, $form);
|
||||
}
|
||||
|
||||
@ -338,7 +340,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $var the value being booleanized
|
||||
*/
|
||||
function is_registered_criteria($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function is_registered_criteria($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
if(!SmartyValidate::is_registered_form($form)) {
|
||||
trigger_error("SmartyValidate: [is_registered_criteria] form '$form' is not registered.");
|
||||
return false;
|
||||
@ -351,7 +353,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $var the value being booleanized
|
||||
*/
|
||||
function is_registered_transform($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function is_registered_transform($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
if(!SmartyValidate::is_registered_form($form)) {
|
||||
trigger_error("SmartyValidate: [is_registered_transform] form '$form' is not registered.");
|
||||
return false;
|
||||
@ -370,7 +372,7 @@ class SmartyValidate {
|
||||
* @param string $transform transform function(s) to apply (optional)
|
||||
* @param string $form name of the form (optional)
|
||||
*/
|
||||
function register_validator($id, $field, $criteria, $empty = false, $halt = false, $transform = null, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function register_validator($id, $field, $criteria, $empty = false, $halt = false, $transform = null, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
if(!SmartyValidate::is_registered_form($form)) {
|
||||
trigger_error("SmartyValidate: [register_validator] form '$form' is not registered.");
|
||||
return false;
|
||||
@ -408,7 +410,7 @@ class SmartyValidate {
|
||||
* @param string $transform the name of the transform function(s)
|
||||
* @param string $form name of the form (optional)
|
||||
*/
|
||||
function set_transform($id, $transform, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function set_transform($id, $transform, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
|
||||
if(($_validator_key = SmartyValidate::is_registered_validator($id,$form)) === false) {
|
||||
trigger_error("SmartyValidate: [set_transform] validator '$id' is not registered.");
|
||||
@ -424,7 +426,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $id the validator to test
|
||||
*/
|
||||
function is_registered_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function is_registered_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
if(!SmartyValidate::is_registered_form($form)) {
|
||||
trigger_error("SmartyValidate: [is_registered_validator] form '$form' is not registered.");
|
||||
return false;
|
||||
@ -444,7 +446,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $id the validator to unregister
|
||||
*/
|
||||
function unregister_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function unregister_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
if(!SmartyValidate::is_registered_form($form)) {
|
||||
return false;
|
||||
}
|
||||
@ -465,7 +467,7 @@ class SmartyValidate {
|
||||
* @param string $page the name of the page being validated
|
||||
* @param string $form the name of the form being validated
|
||||
*/
|
||||
function set_page($page, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function set_page($page, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
$_SESSION['SmartyValidate'][$form]['page'] = $page;
|
||||
$_SESSION['SmartyValidate'][$form]['is_error'] = false;
|
||||
$_SESSION['SmartyValidate'][$form]['is_init'] = true;
|
||||
@ -478,7 +480,7 @@ class SmartyValidate {
|
||||
* @param string $name the registered name
|
||||
* @param string $form the form name
|
||||
*/
|
||||
function _execute_transform($name, $value, $params, &$formvars, $form) {
|
||||
public static function _execute_transform($name, $value, $params, &$formvars, $form) {
|
||||
|
||||
if(SmartyValidate::is_registered_transform($name, $form)) {
|
||||
$_func_name = SmartyValidate::_get_registered_func_name('transform', $name, $form);
|
||||
@ -515,7 +517,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $func_name the function being registered
|
||||
*/
|
||||
function _register_function($type, $name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
public static function _register_function($type, $name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||
if(!SmartyValidate::is_registered_form($form)) {
|
||||
trigger_error("SmartyValidate: [register_$type] form '$form' is not registered.");
|
||||
return false;
|
||||
@ -552,7 +554,7 @@ class SmartyValidate {
|
||||
* @param string $name the registered name
|
||||
* @param string $form the form name
|
||||
*/
|
||||
function _get_registered_func_name($type,$name,$form) {
|
||||
public static function _get_registered_func_name($type,$name,$form) {
|
||||
return isset($_SESSION['SmartyValidate'][$form]['registered_funcs'][$type][$name])
|
||||
? $_SESSION['SmartyValidate'][$form]['registered_funcs'][$type][$name]
|
||||
: false;
|
||||
@ -564,7 +566,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $var the value being booleanized
|
||||
*/
|
||||
function _booleanize($var) {
|
||||
public static function _booleanize($var) {
|
||||
if(in_array(strtolower($var), array(true, 1, 'true','on','yes','y'),true)) {
|
||||
return true;
|
||||
}
|
||||
@ -578,7 +580,7 @@ class SmartyValidate {
|
||||
* @param string $value the value being tested
|
||||
* @param string $empty skip empty values or not
|
||||
*/
|
||||
function _is_valid_criteria($criteria, $value, $empty, &$params, &$formvars, $form) {
|
||||
public static function _is_valid_criteria($criteria, $value, $empty, &$params, &$formvars, $form) {
|
||||
if(SmartyValidate::is_registered_criteria($criteria,$form)) {
|
||||
$_func_name = SmartyValidate::_get_registered_func_name('criteria',$criteria, $form);
|
||||
} else {
|
||||
@ -615,7 +617,7 @@ class SmartyValidate {
|
||||
* @param string $name the object name
|
||||
* @param object $object the object being set
|
||||
*/
|
||||
function &_object_instance($name, &$object) {
|
||||
public static function &_object_instance($name, &$object) {
|
||||
$return = false;
|
||||
static $_objects = array();
|
||||
if ($name=='-') {
|
||||
@ -638,7 +640,7 @@ class SmartyValidate {
|
||||
*
|
||||
* @param string $value the value being tested
|
||||
*/
|
||||
function _smarty_assign($vars = array()) {
|
||||
public static function _smarty_assign($vars = array()) {
|
||||
|
||||
$_smarty_obj =& SmartyValidate::_object_instance('Smarty', $_dummy);
|
||||
|
||||
|
@ -21,12 +21,12 @@
|
||||
* @link http://smarty.php.net/
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
* @version 2.6.26
|
||||
* @version 2.6.25-dev
|
||||
* @copyright 2001-2005 New Digital Group, Inc.
|
||||
* @package Smarty
|
||||
*/
|
||||
|
||||
/* $Id: Smarty_Compiler.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* Template compiling class
|
||||
@ -78,7 +78,7 @@ class Smarty_Compiler extends Smarty {
|
||||
/**
|
||||
* The class constructor.
|
||||
*/
|
||||
function Smarty_Compiler()
|
||||
public function __construct()
|
||||
{
|
||||
// matches double quoted strings:
|
||||
// "foobar"
|
||||
@ -259,14 +259,9 @@ class Smarty_Compiler extends Smarty {
|
||||
|
||||
preg_match_all($search, $source_content, $match, PREG_SET_ORDER);
|
||||
$this->_folded_blocks = $match;
|
||||
reset($this->_folded_blocks);
|
||||
|
||||
/* replace special blocks by "{php}" */
|
||||
$source_content = preg_replace($search.'e', "'"
|
||||
. $this->_quote_replace($this->left_delimiter) . 'php'
|
||||
. "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
|
||||
. $this->_quote_replace($this->right_delimiter)
|
||||
. "'"
|
||||
$source_content = preg_replace_callback($search, array($this,'_preg_callback')
|
||||
, $source_content);
|
||||
|
||||
/* Gather all template tags. */
|
||||
@ -556,7 +551,7 @@ class Smarty_Compiler extends Smarty {
|
||||
|
||||
case 'php':
|
||||
/* handle folded tags replaced by {php} */
|
||||
list(, $block) = each($this->_folded_blocks);
|
||||
$block = array_shift($this->_folded_blocks);
|
||||
$this->_current_line_no += substr_count($block[0], "\n");
|
||||
/* the number of matched elements in the regexp in _compile_file()
|
||||
determins the type of folded tag that was found */
|
||||
@ -754,7 +749,12 @@ class Smarty_Compiler extends Smarty {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function _preg_callback ($matches) {
|
||||
return $this->_quote_replace($this->left_delimiter)
|
||||
. 'php'
|
||||
. str_repeat("\n", substr_count($matches[1], "\n"))
|
||||
. $this->_quote_replace($this->right_delimiter);
|
||||
}
|
||||
/**
|
||||
* compile custom function tag
|
||||
*
|
||||
@ -2122,7 +2122,7 @@ class Smarty_Compiler extends Smarty {
|
||||
return null;
|
||||
|
||||
case 'template':
|
||||
$compiled_ref = "'$this->_current_file'";
|
||||
$compiled_ref = "'" . addslashes($this->_current_file) . "'";
|
||||
$_max_index = 1;
|
||||
break;
|
||||
|
||||
|
@ -14,11 +14,9 @@
|
||||
*/
|
||||
function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
||||
{
|
||||
static $_filepaths_cache = array();
|
||||
|
||||
$_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
|
||||
if (isset($_filepaths_cache[$_plugin_filename])) {
|
||||
return $_filepaths_cache[$_plugin_filename];
|
||||
if (isset($smarty->_filepaths_cache[$_plugin_filename])) {
|
||||
return $smarty->_filepaths_cache[$_plugin_filename];
|
||||
}
|
||||
$_return = false;
|
||||
|
||||
@ -58,7 +56,7 @@ function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
||||
}
|
||||
}
|
||||
}
|
||||
$_filepaths_cache[$_plugin_filename] = $_return;
|
||||
$smarty->_filepaths_cache[$_plugin_filename] = $_return;
|
||||
return $_return;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,11 @@ function smarty_function_cycle($params, &$smarty)
|
||||
$cycle_vars[$name]['values'] = $params['values'];
|
||||
}
|
||||
|
||||
$cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ',';
|
||||
if (isset($params['delimiter'])) {
|
||||
$cycle_vars[$name]['delimiter'] = $params['delimiter'];
|
||||
} elseif (!isset($cycle_vars[$name]['delimiter'])) {
|
||||
$cycle_vars[$name]['delimiter'] = ',';
|
||||
}
|
||||
|
||||
if(is_array($cycle_vars[$name]['values'])) {
|
||||
$cycle_array = $cycle_vars[$name]['values'];
|
||||
|
@ -181,12 +181,12 @@ function smarty_function_fetch($params, &$smarty)
|
||||
$content .= fgets($fp,4096);
|
||||
}
|
||||
fclose($fp);
|
||||
$csplit = split("\r\n\r\n",$content,2);
|
||||
$csplit = preg_split("!\r\n\r\n!",$content,2);
|
||||
|
||||
$content = $csplit[1];
|
||||
|
||||
if(!empty($params['assign_headers'])) {
|
||||
$smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
|
||||
$smarty->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -42,7 +42,7 @@ function smarty_function_html_select_date($params, &$smarty)
|
||||
require_once $smarty->_get_plugin_filepath('function','html_options');
|
||||
/* Default values. */
|
||||
$prefix = "Date_";
|
||||
$start_year = date_strformat("%Y");
|
||||
$start_year = strftime("%Y");
|
||||
$end_year = $start_year;
|
||||
$display_days = true;
|
||||
$display_months = true;
|
||||
@ -142,8 +142,8 @@ function smarty_function_html_select_date($params, &$smarty)
|
||||
$time = $found[1];
|
||||
} else {
|
||||
// use smarty_make_timestamp to get an unix timestamp and
|
||||
// date_strformat to make yyyy-mm-dd
|
||||
$time = date_strformat('%Y-%m-%d', smarty_make_timestamp($time));
|
||||
// strftime to make yyyy-mm-dd
|
||||
$time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
|
||||
}
|
||||
// Now split this in pieces, which later can be used to set the select
|
||||
$time = explode("-", $time);
|
||||
@ -151,16 +151,16 @@ function smarty_function_html_select_date($params, &$smarty)
|
||||
// make syntax "+N" or "-N" work with start_year and end_year
|
||||
if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
|
||||
if ($match[1] == '+') {
|
||||
$end_year = date_strformat('%Y') + $match[2];
|
||||
$end_year = strftime('%Y') + $match[2];
|
||||
} else {
|
||||
$end_year = date_strformat('%Y') - $match[2];
|
||||
$end_year = strftime('%Y') - $match[2];
|
||||
}
|
||||
}
|
||||
if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
|
||||
if ($match[1] == '+') {
|
||||
$start_year = date_strformat('%Y') + $match[2];
|
||||
$start_year = strftime('%Y') + $match[2];
|
||||
} else {
|
||||
$start_year = date_strformat('%Y') - $match[2];
|
||||
$start_year = strftime('%Y') - $match[2];
|
||||
}
|
||||
}
|
||||
if (strlen($time[0]) > 0) {
|
||||
@ -188,8 +188,8 @@ function smarty_function_html_select_date($params, &$smarty)
|
||||
$month_values[''] = '';
|
||||
}
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$month_names[$i] = date_strformat($month_format, mktime(0, 0, 0, $i, 1, 2000));
|
||||
$month_values[$i] = date_strformat($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
|
||||
$month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
|
||||
$month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
|
||||
}
|
||||
|
||||
$month_result .= '<select name=';
|
||||
@ -211,7 +211,7 @@ function smarty_function_html_select_date($params, &$smarty)
|
||||
|
||||
$month_result .= smarty_function_html_options(array('output' => $month_names,
|
||||
'values' => $month_values,
|
||||
'selected' => (int)$time[1] ? date_strformat($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
|
||||
'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
|
||||
'print_result' => false),
|
||||
$smarty);
|
||||
$month_result .= '</select>';
|
||||
|
@ -20,7 +20,6 @@ function smarty_function_list_categories($params) //, &$smarty)
|
||||
'selected' => array()
|
||||
);
|
||||
|
||||
//list($catId) = each($categories);
|
||||
$cat_params = array_merge($cat_params, $params);
|
||||
|
||||
// makese 'selected' an arr
|
||||
@ -32,8 +31,11 @@ function smarty_function_list_categories($params) //, &$smarty)
|
||||
$cats = trim(io_load_file(CONTENT_DIR . 'categories.txt'));
|
||||
$stack=array(0);
|
||||
$arr=array();
|
||||
$explode_result=explode("\n", $cats);
|
||||
return '<ul>'.do_print_categories_list($explode_result, $stack, $arr, $cat_params).'</ul>';
|
||||
|
||||
$line36error = explode("\n", $cats);
|
||||
$line35error = '<ul>'.do_print_categories_list($line36error, $stack, $arr, $cat_params).'</ul>';
|
||||
|
||||
return $line35error;
|
||||
} else {
|
||||
global $lang;
|
||||
|
||||
@ -103,8 +105,6 @@ function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
|
||||
|
||||
|
||||
$cat_entry = $params['selected'];
|
||||
//list($catId) = each($categories);
|
||||
|
||||
|
||||
if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) {
|
||||
$string = '<label><input name="'.$catname.'cats['.$vid.']" ';
|
||||
|
@ -1,85 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
* @package Smarty
|
||||
* @subpackage plugins
|
||||
* This plugin is only for Smarty2 BC
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Smarty {math} function plugin
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: math<br>
|
||||
* Purpose: handle math computations in template<br>
|
||||
* @link http://smarty.php.net/manual/en/language.function.math.php {math}
|
||||
* (Smarty online manual)
|
||||
* Purpose: handle math computations in template
|
||||
*
|
||||
* @link http://www.smarty.net/manual/en/language.function.math.php {math}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @param array
|
||||
* @param Smarty
|
||||
* @return string
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_math($params, &$smarty)
|
||||
function smarty_function_math($params, $template)
|
||||
{
|
||||
static $_allowed_funcs =
|
||||
array('int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
|
||||
'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true, 'rand' => true,
|
||||
'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true, 'tan' => true);
|
||||
// be sure equation parameter is present
|
||||
if (empty($params['equation'])) {
|
||||
$smarty->trigger_error("math: missing equation parameter");
|
||||
if (empty($params[ 'equation' ])) {
|
||||
trigger_error("math: missing equation parameter", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// strip out backticks, not necessary for math
|
||||
$equation = str_replace('`','',$params['equation']);
|
||||
$equation = $params[ 'equation' ];
|
||||
|
||||
// make sure parenthesis are balanced
|
||||
if (substr_count($equation,"(") != substr_count($equation,")")) {
|
||||
$smarty->trigger_error("math: unbalanced parenthesis");
|
||||
if (substr_count($equation, "(") != substr_count($equation, ")")) {
|
||||
trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// disallow backticks
|
||||
if (strpos($equation, '`') !== false) {
|
||||
trigger_error("math: backtick character not allowed in equation", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// also disallow dollar signs
|
||||
if (strpos($equation, '$') !== false) {
|
||||
trigger_error("math: dollar signs not allowed in equation", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// match all vars in equation, make sure all are passed
|
||||
preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
|
||||
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
||||
|
||||
foreach($match[1] as $curr_var) {
|
||||
if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
|
||||
$smarty->trigger_error("math: function call $curr_var not allowed");
|
||||
preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
|
||||
|
||||
foreach ($match[ 1 ] as $curr_var) {
|
||||
if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
|
||||
trigger_error("math: function call $curr_var not allowed", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($params as $key => $val) {
|
||||
foreach ($params as $key => $val) {
|
||||
if ($key != "equation" && $key != "format" && $key != "assign") {
|
||||
// make sure value is not empty
|
||||
if (strlen($val)==0) {
|
||||
$smarty->trigger_error("math: parameter $key is empty");
|
||||
if (strlen($val) == 0) {
|
||||
trigger_error("math: parameter $key is empty", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
if (!is_numeric($val)) {
|
||||
$smarty->trigger_error("math: parameter $key: is not numeric");
|
||||
trigger_error("math: parameter $key: is not numeric", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
|
||||
}
|
||||
}
|
||||
$smarty_math_result = null;
|
||||
eval("\$smarty_math_result = " . $equation . ";");
|
||||
|
||||
eval("\$smarty_math_result = ".$equation.";");
|
||||
|
||||
if (empty($params['format'])) {
|
||||
if (empty($params['assign'])) {
|
||||
if (empty($params[ 'format' ])) {
|
||||
if (empty($params[ 'assign' ])) {
|
||||
return $smarty_math_result;
|
||||
} else {
|
||||
$smarty->assign($params['assign'],$smarty_math_result);
|
||||
$template->assign($params[ 'assign' ], $smarty_math_result);
|
||||
}
|
||||
} else {
|
||||
if (empty($params['assign'])){
|
||||
printf($params['format'],$smarty_math_result);
|
||||
if (empty($params[ 'assign' ])) {
|
||||
printf($params[ 'format' ], $smarty_math_result);
|
||||
} else {
|
||||
$smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
|
||||
$template->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
@ -199,6 +199,9 @@ class StringParser {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
function StringParser () {
|
||||
}
|
||||
|
||||
@ -910,7 +913,7 @@ class StringParser_Node {
|
||||
* occurred at. If not determinable, it is -1.
|
||||
* @global __STRINGPARSER_NODE_ID
|
||||
*/
|
||||
function StringParser_Node ($occurredAt = -1) {
|
||||
function __construct ($occurredAt = -1) {
|
||||
$this->_id = $GLOBALS['__STRINGPARSER_NODE_ID']++;
|
||||
$this->occurredAt = $occurredAt;
|
||||
}
|
||||
@ -1486,8 +1489,8 @@ class StringParser_Node_Text extends StringParser_Node {
|
||||
* occurred at. If not determinable, it is -1.
|
||||
* @see StringParser_Node_Text::content
|
||||
*/
|
||||
function StringParser_Node_Text ($content, $occurredAt = -1) {
|
||||
parent::StringParser_Node ($occurredAt);
|
||||
function __construct ($content, $occurredAt = -1) {
|
||||
parent::__construct ($occurredAt);
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
|
@ -1,89 +1,100 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Plugin Name: Calendar
|
||||
Version: 1.1
|
||||
Plugin URI: http://flatpress.sf.net
|
||||
Type: Block
|
||||
Description: Adds a Calendar block level element
|
||||
Author: NoWhereMan
|
||||
Author URI: http://flatpress.sf.net
|
||||
*/
|
||||
* Plugin Name: Calendar
|
||||
* Version: 1.1
|
||||
* Plugin URI: http://flatpress.sf.net
|
||||
* Type: Block
|
||||
* Description: Adds a Calendar block level element
|
||||
* Author: NoWhereMan
|
||||
* Author URI: http://flatpress.sf.net
|
||||
*/
|
||||
|
||||
|
||||
# PHP Calendar (version 2.3), written by Keith Devens
|
||||
# http://keithdevens.com/software/php_calendar
|
||||
# see example at http://keithdevens.com/weblog
|
||||
# License: http://keithdevens.com/software/license
|
||||
|
||||
function generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array()){
|
||||
$first_of_month = gmmktime(0,0,0,$month,1,$year);
|
||||
#remember that mktime will automatically correct if invalid dates are entered
|
||||
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
|
||||
# this provides a built in "rounding" feature to generate_calendar()
|
||||
|
||||
$day_names = array(); #generate all the day names according to the current locale
|
||||
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
|
||||
$day_names[$n] = ucfirst(date_strformat('%A',$t)); #%A means full textual day name
|
||||
|
||||
list($month, $year, $month_name, $weekday) = explode(',',date_strformat('%m,%Y,%B,%w',$first_of_month));
|
||||
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
|
||||
$title = htmlentities(ucfirst($month_name)).' '.$year; #note that some locales don't capitalize month and day names
|
||||
|
||||
#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
|
||||
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
|
||||
if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.($pl).'">'.$p.'</a>' : $p).'</span> ';
|
||||
if($n) $n = ' <span class="calendar-next">'.($nl ? '<a href="'.($nl).'">'.$n.'</a>' : $n).'</span>';
|
||||
$calendar = '<table class="calendar">'."\n".
|
||||
'<caption class="calendar-month">'.$p.($month_href ? '<a href="'.($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";
|
||||
|
||||
if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
|
||||
#if day_name_length is >3, the full name of the day will be printed
|
||||
foreach($day_names as $d)
|
||||
$calendar .= '<th abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
|
||||
// PHP Calendar (version 2.3), written by Keith Devens
|
||||
// http://keithdevens.com/software/php_calendar
|
||||
// see example at http://keithdevens.com/weblog
|
||||
// License: http://keithdevens.com/software/license
|
||||
function generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array()) {
|
||||
$first_of_month = gmmktime(0, 0, 0, $month, 1, $year);
|
||||
// remember that mktime will automatically correct if invalid dates are entered
|
||||
// for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
|
||||
// this provides a built in "rounding" feature to generate_calendar()
|
||||
|
||||
$day_names = array(); // generate all the day names according to the current locale
|
||||
for($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400) // January 4, 1970 was a Sunday
|
||||
$day_names [$n] = ucfirst(date_strformat('%A', $t)); // %A means full textual day name
|
||||
|
||||
list ($month, $year, $month_name, $weekday) = explode(',', date_strformat('%m,%Y,%B,%w', $first_of_month));
|
||||
$weekday = ($weekday + 7 - $first_day) % 7; // adjust for $first_day
|
||||
$title = htmlentities(ucfirst($month_name)) . ' ' . $year; // note that some locales don't capitalize month and day names
|
||||
|
||||
// Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
|
||||
|
||||
// PHP7 compatibility: Since $pn is never passed, we do not need to create "previous" and "next" elements.
|
||||
$p = '';
|
||||
$n = '';
|
||||
// Commented out to prevent deprecated each() function from being executed.
|
||||
// @list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
|
||||
// if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.($pl).'">'.$p.'</a>' : $p).'</span> ';
|
||||
// if($n) $n = ' <span class="calendar-next">'.($nl ? '<a href="'.($nl).'">'.$n.'</a>' : $n).'</span>';
|
||||
|
||||
$calendar = '<table class="calendar">' . "\n" . '<caption class="calendar-month">' . $p . ($month_href ? '<a href="' . ($month_href) . '">' . $title . '</a>' : $title) . $n . "</caption>\n<tr>";
|
||||
|
||||
if ($day_name_length) { // if the day names should be shown ($day_name_length > 0)
|
||||
// if day_name_length is >3, the full name of the day will be printed
|
||||
foreach ($day_names as $d)
|
||||
$calendar .= '<th abbr="' . htmlentities($d) . '">' . htmlentities($day_name_length < 4 ? substr($d, 0, $day_name_length) : $d) . '</th>';
|
||||
$calendar .= "</tr>\n<tr>";
|
||||
}
|
||||
|
||||
if($weekday > 0) $calendar .= '<td colspan="'.$weekday.'"> </td>'; #initial 'empty' days
|
||||
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
|
||||
if($weekday == 7){
|
||||
$weekday = 0; #start a new week
|
||||
|
||||
if ($weekday > 0)
|
||||
$calendar .= '<td colspan="' . $weekday . '"> </td>'; // initial 'empty' days
|
||||
for($day = 1, $days_in_month = gmdate('t', $first_of_month); $day <= $days_in_month; $day++, $weekday++) {
|
||||
if ($weekday == 7) {
|
||||
$weekday = 0; // start a new week
|
||||
$calendar .= "</tr>\n<tr>";
|
||||
}
|
||||
if(isset($days[$day]) and is_array($days[$day])){
|
||||
@list($link, $classes, $content) = $days[$day];
|
||||
if(is_null($content)) $content = $day;
|
||||
$calendar .= '<td'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
|
||||
($link ? '<a class="calendar-day" href="'.($link).'">'.$content.'</a>' : $content).'</td>';
|
||||
}
|
||||
else $calendar .= "<td>$day</td>";
|
||||
if (isset($days [$day]) and is_array($days [$day])) {
|
||||
@list ($link, $classes, $content) = $days [$day];
|
||||
if (is_null($content))
|
||||
$content = $day;
|
||||
$calendar .= '<td' . ($classes ? ' class="' . htmlspecialchars($classes) . '">' : '>') . ($link ? '<a class="calendar-day" href="' . ($link) . '">' . $content . '</a>' : $content) . '</td>';
|
||||
} else
|
||||
$calendar .= "<td>$day</td>";
|
||||
}
|
||||
if($weekday != 7) $calendar .= '<td colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days
|
||||
|
||||
return $calendar."</tr>\n</table>\n";
|
||||
if ($weekday != 7)
|
||||
$calendar .= '<td colspan="' . (7 - $weekday) . '"> </td>'; // remaining "empty" days
|
||||
|
||||
return $calendar . "</tr>\n</table>\n";
|
||||
}
|
||||
|
||||
function plugin_calendar_widget() {
|
||||
|
||||
global $fp_params;
|
||||
|
||||
$y = isset($fp_params['y'])? $fp_params['y'] : date('y');
|
||||
$m = isset($fp_params['m'])? $fp_params['m'] : date('m');
|
||||
|
||||
$y = isset($fp_params ['y']) ? $fp_params ['y'] : date('y');
|
||||
$m = isset($fp_params ['m']) ? $fp_params ['m'] : date('m');
|
||||
|
||||
global $fpdb;
|
||||
|
||||
$q =& new FPDB_Query(array('fullparse'=>false,'y'=>$y,'m'=>$m, 'count' => -1), null);
|
||||
|
||||
$q = new FPDB_Query(array(
|
||||
'fullparse' => false,
|
||||
'y' => $y,
|
||||
'm' => $m,
|
||||
'count' => -1
|
||||
), null);
|
||||
|
||||
$days = array();
|
||||
|
||||
while ($q->hasmore($queryId)) {
|
||||
|
||||
list($id, $entry) = $q->getEntry($queryId);
|
||||
list ($id, $entry) = $q->getEntry($queryId);
|
||||
$date = date_from_id($id);
|
||||
$d = (int)$date['d'];
|
||||
|
||||
$days[$d] = array(get_day_link($y, $m, str_pad($d, 2, '0', STR_PAD_LEFT)), 'linked-day');
|
||||
$d = (int) $date ['d'];
|
||||
|
||||
$days [$d] = array(
|
||||
get_day_link($y, $m, str_pad($d, 2, '0', STR_PAD_LEFT)),
|
||||
'linked-day'
|
||||
);
|
||||
|
||||
$count++;
|
||||
}
|
||||
@ -93,8 +104,8 @@ function plugin_calendar_widget() {
|
||||
$lang = lang_load('plugin:calendar');
|
||||
|
||||
$widget = array();
|
||||
$widget['subject'] = $lang['plugin']['calendar']['subject'];
|
||||
$widget['content'] = '<ul id="widget_calendar"><li>'. generate_calendar($y,$m, $days).'</li></ul>';
|
||||
$widget ['subject'] = $lang ['plugin'] ['calendar'] ['subject'];
|
||||
$widget ['content'] = '<ul id="widget_calendar"><li>' . generate_calendar($y, $m, $days) . '</li></ul>';
|
||||
|
||||
return $widget;
|
||||
}
|
||||
|
@ -38,14 +38,16 @@ class footnotes_class {
|
||||
|
||||
$lines = preg_split('|\[([0-9]+)\]|', $matches[1], -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
// first array element is always empty - remove
|
||||
array_shift($lines);
|
||||
|
||||
while ((list (,$n) = each($lines)) && (list (,$s) = each($lines)))
|
||||
// get each footnote's number ($n) and content ($s) from the array ...
|
||||
while (($n = array_shift($lines)) && ($s = array_shift($lines))) {
|
||||
// ... and add it to the result string
|
||||
$str .=$this->note($n, $s);
|
||||
|
||||
}
|
||||
|
||||
$str .= '</ol></div>';
|
||||
|
||||
return $str;
|
||||
|
||||
}
|
||||
|
24
fp-plugins/lastcommentsadmin/lang/lang.de-de.php
Normal file
24
fp-plugins/lastcommentsadmin/lang/lang.de-de.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
$lang['plugin']['lastcommentsadmin ']['errors'] = array (
|
||||
-1 => 'API key not set. Open the plugin to set your API key. Register on <a href="http://wordpress.com">Wordpress.com</a> to get one'
|
||||
);
|
||||
|
||||
$lang['admin']['plugin']['submenu']['lastcommentsadmin'] = 'Last Comments Admin';
|
||||
|
||||
$lang['admin']['plugin']['lastcommentsadmin'] = array(
|
||||
'head' => '"Letzte Kommentare" Cache verwalten',
|
||||
'description'=>'Leert und erneuert den Inhalt für die "Letzte Kommentare" Cache Datei ',
|
||||
'clear' => 'Lösche Cache',
|
||||
'cleardescription' => 'Lösche die vorhandene "Letzte Kommentare" Cache Datei. Eine neue Datei wird nach dem Posten eines Kommentares wieder angelegt.',
|
||||
'rebuild' => 'Cache neu anlegen',
|
||||
'rebuilddescription' => 'Eine neue Cache Datei anlegen. Diese Funktion sucht in allen Blog Beiträgen nach Kommentaren und übernimmt diese in die neue Cache Datei. Das kann einige Zeit dauern, je nachdem wieviele Kommentare gefunden werden!',
|
||||
);
|
||||
$lang['admin']['plugin']['lastcommentsadmin']['msgs'] = array(
|
||||
1 => 'Cache wurde erfolgreich gelöscht',
|
||||
2 => 'Cache wurde erfolgreich erneuert',
|
||||
-1 => 'Fehler!',
|
||||
-2 => 'Dieses Plugin benötigt das in Flatpress integrierte LastComment Plugin. Bitte dieses vorher im Plugin Bereich aktivieren!'
|
||||
);
|
||||
|
||||
|
||||
?>
|
24
fp-plugins/lastcommentsadmin/lang/lang.en-us.php
Normal file
24
fp-plugins/lastcommentsadmin/lang/lang.en-us.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
$lang['plugin']['lastcommentsadmin ']['errors'] = array (
|
||||
-1 => 'API key not set. Open the plugin to set your API key. Register on <a href="http://wordpress.com">Wordpress.com</a> to get one'
|
||||
);
|
||||
|
||||
$lang['admin']['plugin']['submenu']['lastcommentsadmin'] = 'Last Comments Admin';
|
||||
|
||||
$lang['admin']['plugin']['lastcommentsadmin'] = array(
|
||||
'head' => 'Last Comments Admin',
|
||||
'description'=>'Clear and rebuil last comment cache ',
|
||||
'clear' => 'Clear cache',
|
||||
'cleardescription' => 'Delete last comment cache file. New file cache will created when a new comment will be posted.',
|
||||
'rebuild' => 'Rebuild cache',
|
||||
'rebuilddescription' => 'Rebuild last comment cache file. Could take very long time. Could not work at all. Could burn your mouse up!',
|
||||
);
|
||||
$lang['admin']['plugin']['lastcommentsadmin']['msgs'] = array(
|
||||
1 => 'Cache deleted',
|
||||
2 => 'Cache rebuilded!',
|
||||
-1 => 'Error!',
|
||||
-2 => 'This plugin require LastComments plugin!'
|
||||
);
|
||||
|
||||
|
||||
?>
|
65
fp-plugins/lastcommentsadmin/plugin.lastcommentsadmin.php
Normal file
65
fp-plugins/lastcommentsadmin/plugin.lastcommentsadmin.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Last Comments Admin
|
||||
Version: 0.1
|
||||
Plugin URI: http://kirgroup.com/blog/
|
||||
Description: Manage last comments cache. Require LastComment plugin.
|
||||
Author: Fabrixxm
|
||||
Author URI: http://kirgroup.com/blog/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (class_exists('AdminPanelAction')){
|
||||
|
||||
class admin_plugin_lastcommentsadmin extends AdminPanelAction {
|
||||
|
||||
var $langres = 'plugin:lastcommentsadmin';
|
||||
|
||||
function setup() {
|
||||
$this->smarty->assign('admin_resource', "plugin:lastcommentsadmin/admin.plugin.lastcommentsadmin");
|
||||
}
|
||||
|
||||
function main() {
|
||||
if (!function_exists('plugin_lastcomments_cache')){
|
||||
$this->smarty->assign('success', -2);
|
||||
}
|
||||
}
|
||||
|
||||
function onsubmit($data = NULL) {
|
||||
global $fp_config;
|
||||
|
||||
if (isset($_POST['lastcommentadmin_clear'])){
|
||||
fs_delete(LASTCOMMENTS_CACHE_FILE);
|
||||
$this->smarty->assign('success', 1);
|
||||
}
|
||||
|
||||
if (isset($_POST['lastcommentadmin_rebuild'])){
|
||||
fs_delete(LASTCOMMENTS_CACHE_FILE);
|
||||
$coms = Array();
|
||||
|
||||
$q = new FPDB_Query(array('fullparse'=>false,'start'=>0,'count'=>-1), null);
|
||||
while ($q->hasmore()) {
|
||||
list($id,$e) = $q->getEntry();
|
||||
$obj = new comment_indexer($id);
|
||||
foreach($obj->getList() as $value){
|
||||
$coms[$value]=$id;
|
||||
}
|
||||
ksort($coms);
|
||||
$coms = array_slice($coms, -LASTCOMMENTS_MAX );
|
||||
}
|
||||
foreach($coms as $cid=>$eid){
|
||||
$c = comment_parse($eid, $cid);
|
||||
plugin_lastcomments_cache($eid, array($cid, $c));
|
||||
}
|
||||
$this->smarty->assign('success', 2);
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
admin_addpanelaction('plugin', 'lastcommentsadmin', true);
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<h2>{$plang.head}</h2>
|
||||
<p>{$plang.description}</p>
|
||||
|
||||
{include file=shared:errorlist.tpl}
|
||||
|
||||
<div style="margin: 0 auto; width: 20em;">
|
||||
|
||||
{html_form}
|
||||
<p><input type="submit" name="lastcommentadmin_clear" value="{$plang.clear}"/> </p><p>{$plang.cleardescription} </p>
|
||||
<p><br></p>
|
||||
<p><input type="submit" name="lastcommentadmin_rebuild" value="{$plang.rebuild}"/> </p><p>{$plang.rebuilddescription} </p>
|
||||
|
||||
{/html_form}
|
||||
|
||||
</div>
|
45
fp-plugins/mediamanager/lang/lang.de-de.php
Normal file
45
fp-plugins/mediamanager/lang/lang.de-de.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/* MediaManager DE-DE language file by Laborix */
|
||||
|
||||
/* THIS LINE SHOULDN'T BE HERE! */
|
||||
$lang['admin']['uploader']['submenu']['default'] = 'Uploader';
|
||||
|
||||
|
||||
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Media Manager';
|
||||
|
||||
|
||||
$lang['admin']['uploader']['mediamanager'] = array(
|
||||
'head' => 'Media Manager',
|
||||
'description'=>'Der Media Manager schafft einen Überblick der in Flatpress hochgeladenen Dateien und Bilder.',
|
||||
|
||||
'delete' => 'Löschen',
|
||||
'up' => 'Zurück',
|
||||
'page' => 'Seite',
|
||||
'colname' => 'Dateiname',
|
||||
'colsize' => 'Dateigröße in KB',
|
||||
'coltype' => 'Abgelegt in',
|
||||
'colmtime' => 'Hochgeladen am',
|
||||
'colusecount'=>'In Beiträgen genutzt',
|
||||
'nofiles' => 'Keine Mediendaten vorhanden.',
|
||||
'loadfile' => 'Datei/en hochladen',
|
||||
|
||||
'seòected' => 'Ausgewählt',
|
||||
'selectaction' => '-- auswahl --',
|
||||
'addtogallery' => 'Zur Gallery hinzufügen',
|
||||
'newgallery' => 'Neue Gallery',
|
||||
'go' => 'Anlegen',
|
||||
'add' => 'Hinzufügen'
|
||||
|
||||
);
|
||||
|
||||
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||
3 => 'Neue Gallery angelegt',
|
||||
2 => 'Bilder in Gallery verschoben',
|
||||
1 => 'Datei gelöscht',
|
||||
-1 => 'Fehler beim Löschen der Datei/en',
|
||||
-2 => 'Fehler beim Erstellen einer neuen Gallery',
|
||||
-3 => 'Bitte einen Namen für die neue Gallery angeben'
|
||||
);
|
||||
|
||||
|
||||
?>
|
43
fp-plugins/mediamanager/lang/lang.en-us.php
Normal file
43
fp-plugins/mediamanager/lang/lang.en-us.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/* MediaManager EN-US language file by Fabrix Xm */
|
||||
|
||||
/* THIS LINE SHOULDN'T BE HERE! */
|
||||
$lang['admin']['uploader']['submenu']['default'] = 'Uploader';
|
||||
|
||||
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Media manager';
|
||||
|
||||
|
||||
$lang['admin']['uploader']['mediamanager'] = array(
|
||||
'head' => 'Media manager',
|
||||
'description'=>'Manage your media',
|
||||
|
||||
'delete' => 'delete',
|
||||
'up' => 'Back',
|
||||
'page' => 'Page',
|
||||
'colname' => 'Name',
|
||||
'colsize' => 'Size',
|
||||
'coltype' => 'Type',
|
||||
'colmtime' => 'Uploaded on',
|
||||
'colusecount'=>'# use',
|
||||
'nofiles' => 'No files loaded.',
|
||||
'loadfile' => 'Load file',
|
||||
|
||||
'selected' => 'Selected',
|
||||
'selectaction' => '-- select action --',
|
||||
'addtogallery' => 'Add to gallery',
|
||||
'newgallery' => 'New gallery',
|
||||
'go' => 'Go',
|
||||
'add' => 'Add'
|
||||
|
||||
);
|
||||
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||
3 => 'New gallery created',
|
||||
2 => 'Images moved to gallery',
|
||||
1 => 'File deleted',
|
||||
-1 => 'Error deleting file',
|
||||
-2 => 'Error creating new gallery',
|
||||
-3 => 'Please specify the name of new gallery'
|
||||
);
|
||||
|
||||
|
||||
?>
|
42
fp-plugins/mediamanager/lang/lang.es-la.php
Normal file
42
fp-plugins/mediamanager/lang/lang.es-la.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/* MediaManager ES-LA language file by Agvztíñ IV */
|
||||
/* http://ingeniebrios.com/fp-content/attachs/mediamanager_es-la.zip */
|
||||
|
||||
/* ¡Esta línea no debería estar aquí! */
|
||||
$lang['admin']['uploader']['submenu']['default'] = 'Subir archivos';
|
||||
|
||||
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Administrar Media';
|
||||
|
||||
$lang['admin']['uploader']['mediamanager'] = array(
|
||||
'head' => 'Administrar Media',
|
||||
'description' =>'Administrador de media',
|
||||
|
||||
'delete' => 'eliminar',
|
||||
'up' => 'Atrás',
|
||||
'page' => 'Página',
|
||||
'colname' => 'Nombre',
|
||||
'colsize' => 'Tamaño',
|
||||
'coltype' => 'Tipo',
|
||||
'colmtime' => 'Fecha de subida',
|
||||
'colusecount' =>'# de usos',
|
||||
'nofiles' => 'No hay archivos',
|
||||
'loadfile' => 'Subir archivo',
|
||||
|
||||
'selected' => 'Seleccción',
|
||||
'selectaction' => '-- selecciona acción --',
|
||||
'addtogallery' => 'Agregar a galería',
|
||||
'newgallery' => 'Nueva galería',
|
||||
'go' => 'Ir',
|
||||
'add' => 'Agregar'
|
||||
|
||||
);
|
||||
|
||||
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||
3 => 'Nueva galería creada',
|
||||
2 => 'Imágenes movidas a galería',
|
||||
1 => 'Archivo eliminado',
|
||||
-1 => 'Error al eliminar archivo',
|
||||
-2 => 'Error al crear nueva galería',
|
||||
-3 => 'Por favor ingresa el nombre de la galería'
|
||||
);
|
||||
?>
|
43
fp-plugins/mediamanager/lang/lang.it-it.php
Normal file
43
fp-plugins/mediamanager/lang/lang.it-it.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/* MediaManager IT-IT language file by Fabrix Xm */
|
||||
|
||||
/* THIS LINE SHOULDN'T BE HERE! */
|
||||
$lang['admin']['uploader']['submenu']['default'] = 'Caricatore';
|
||||
|
||||
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Gestore media';
|
||||
|
||||
|
||||
$lang['admin']['uploader']['mediamanager'] = array(
|
||||
'head' => 'Gestore media',
|
||||
'description'=>'Gestisci i tuoi file',
|
||||
|
||||
'delete' => 'cancella',
|
||||
'up' => 'Indietro',
|
||||
'page' => 'Pagina',
|
||||
'colname' => 'Nome',
|
||||
'colsize' => 'Dim.',
|
||||
'coltype' => 'Tipo',
|
||||
'colmtime' => 'Caricato il',
|
||||
'colusecount'=>'usato n.',
|
||||
'nofiles' => 'Nessun file caricato.',
|
||||
'loadfile' => 'Carica file.',
|
||||
|
||||
'selected' => 'Selezionati',
|
||||
'selectaction' => '-- seleziona azione --',
|
||||
'addtogallery' => 'Aggiungi alla galleria',
|
||||
'newgallery' => 'Nuova galleria',
|
||||
'go' => 'Vai',
|
||||
'add' => 'Aggiungi'
|
||||
|
||||
);
|
||||
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||
3 => 'Nuova galleria creata',
|
||||
2 => 'Immagini aggiunte alla galleria',
|
||||
1 => 'File cancellato',
|
||||
-1 => 'Errore cancellando il file',
|
||||
-2 => 'Errore creando la nuova galleria',
|
||||
-3 => 'Perfavore specifica il nome della nuova galleria'
|
||||
);
|
||||
|
||||
|
||||
?>
|
247
fp-plugins/mediamanager/panels/panel.mediamanager.file.php
Normal file
247
fp-plugins/mediamanager/panels/panel.mediamanager.file.php
Normal file
@ -0,0 +1,247 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
class admin_uploader_mediamanager extends AdminPanelAction {
|
||||
var $finfo;
|
||||
var $conf;
|
||||
var $langres = 'plugin:mediamanager';
|
||||
|
||||
function cmpfiles($a, $b){
|
||||
$c = strcmp($a['type'],$b['type']);
|
||||
if ($c==0){
|
||||
return strcmp($a['name'],$b['name']);
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
|
||||
|
||||
function formatBytes($bytes, $precision = 2) {
|
||||
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||
|
||||
$bytes = max($bytes, 0);
|
||||
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
||||
$pow = min($pow, count($units) - 1);
|
||||
|
||||
$bytes /= pow(1024, $pow);
|
||||
|
||||
return round($bytes, $precision) . ' ' . $units[$pow];
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getFileInfo($filepath){
|
||||
global $fp_config;
|
||||
|
||||
$info = array(
|
||||
"name"=>basename($filepath),
|
||||
"size"=>$this->formatBytes(filesize($filepath)),
|
||||
"mtime"=>date_strformat($fp_config['locale']['dateformatshort'], filemtime($filepath))
|
||||
);
|
||||
|
||||
if (isset($this->conf['usecount'][basename($filepath)])){
|
||||
$info['usecount']=$this->conf['usecount'][basename($filepath)];
|
||||
} else {
|
||||
$info['usecount'] = null;
|
||||
}
|
||||
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
function setup() {
|
||||
$this->smarty->assign('admin_resource', "plugin:mediamanager/admin.plugin.mediamanager.files");
|
||||
}
|
||||
|
||||
function deleteFolder($folder, $mmbaseurl){
|
||||
if (!file_exists($folder)) return false;
|
||||
$dir = opendir($folder);
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if (!in_array($file, array(".",".."))) {
|
||||
if (is_dir($folder."/".$file)){
|
||||
$this->deleteFolder($folder."/".$file, $mmbaseurl);
|
||||
} else {
|
||||
if (!unlink($folder."/".$file)) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rmdir($folder);
|
||||
}
|
||||
|
||||
function doItemActions($folder, $mmbaseurl){
|
||||
/* delete file*/
|
||||
if (isset($_GET['deletefile'])){
|
||||
list($type, $name) = explode("-", $_GET['deletefile'],2);
|
||||
switch($type){
|
||||
case 'attachs': $type=ABS_PATH.ATTACHS_DIR; break;
|
||||
case 'images': $type=ABS_PATH.IMAGES_DIR.$folder; break;
|
||||
case 'gallery':
|
||||
if ( !$this->deleteFolder(ABS_PATH.IMAGES_DIR.$name, $mmbaseurl))
|
||||
@utils_redirect($mmbaseurl.'&status=-1');
|
||||
@utils_redirect($mmbaseurl.'&status=1');
|
||||
return true;
|
||||
break;
|
||||
default: { @utils_redirect($mmbaseurl.'&status=-1'); return true; }
|
||||
}
|
||||
if (!file_exists($type.$name)) { @utils_redirect($mmbaseurl.'&status=-1'); return true; }
|
||||
if (!unlink($type.$name)) { @utils_redirect($mmbaseurl.'&status=-1'); return true; }
|
||||
@utils_redirect($mmbaseurl.'&status=1');
|
||||
return true;
|
||||
}
|
||||
if (isset($_GET['status'])){
|
||||
$this->smarty->assign('success', $_GET['status']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function main() {
|
||||
$mmbaseurl="admin.php?p=uploader&action=mediamanager";
|
||||
$folder = ""; $gallery="";
|
||||
if (isset($_GET['gallery'])){
|
||||
$mmbaseurl .= "&gallery=".$_GET['gallery'];
|
||||
$gallery = str_replace("/","",$_GET['gallery']);
|
||||
$folder = $gallery."/";
|
||||
}
|
||||
|
||||
|
||||
$weburl = plugin_geturl('mediamanager');
|
||||
$this->conf = plugin_getoptions('mediamanager');
|
||||
if ($this->doItemActions($folder, $mmbaseurl)) return;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$files = array();
|
||||
$galleries = array();
|
||||
|
||||
$files_needupdate=array();
|
||||
$galleries_needupdate=array();
|
||||
|
||||
# galleries (alwais from IMAGES_DIR)
|
||||
if (file_exists(ABS_PATH.IMAGES_DIR)){
|
||||
$dir = opendir(ABS_PATH.IMAGES_DIR);
|
||||
while (false !== ($file = readdir($dir))){
|
||||
$fullpath=ABS_PATH.IMAGES_DIR.$file;
|
||||
if (!in_array($file, array(".","..",".thumbs")) && is_dir($fullpath)) {
|
||||
$info = $this->getFileInfo($fullpath);
|
||||
$info['type'] = "gallery";
|
||||
$galleries[$fullpath] = $info;
|
||||
if (is_null($info['usecount'])) { $galleries_needupdate[]=$fullpath;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# attachs (NO attachs in galleries)
|
||||
if ($folder=="" && file_exists(ABS_PATH.ATTACHS_DIR)){
|
||||
$dir = opendir(ABS_PATH.ATTACHS_DIR);
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if (!in_array($file, array(".",".."))) {
|
||||
$fullpath = ABS_PATH.ATTACHS_DIR.$file;
|
||||
$info=$this->getFileInfo($fullpath);
|
||||
$info['type']="attachs";
|
||||
$info['url']=BLOG_ROOT.ATTACHS_DIR.$file;
|
||||
$files[$fullpath]=$info;
|
||||
if (is_null($info['usecount'])) { $files_needupdate[]=$fullpath;}
|
||||
}
|
||||
}
|
||||
}
|
||||
# images
|
||||
if (file_exists(ABS_PATH.IMAGES_DIR.$folder)){
|
||||
$dir = opendir(ABS_PATH.IMAGES_DIR.$folder);
|
||||
while (false !== ($file = readdir($dir))){
|
||||
$fullpath=ABS_PATH.IMAGES_DIR.$folder.$file;
|
||||
if (!in_array($file, array(".","..",".thumbs")) && !is_dir($fullpath)) {
|
||||
$info=$this->getFileInfo($fullpath);
|
||||
$info['type']="images";
|
||||
$info['url']=BLOG_ROOT.IMAGES_DIR.$folder.$file;
|
||||
$files[$fullpath]=$info;
|
||||
# NO count for images in galleries
|
||||
if ($folder=="" && is_null($info['usecount'])) { $files_needupdate[]=$fullpath; }
|
||||
}
|
||||
}
|
||||
}
|
||||
mediamanager_updateUseCountArr($files,$files_needupdate);
|
||||
mediamanager_updateUseCountArr($galleries,$galleries_needupdate);
|
||||
|
||||
usort($files, Array("admin_uploader_mediamanager","cmpfiles"));
|
||||
$totalfilescount = (string) count($files);
|
||||
#paginator
|
||||
$pages = ceil((count($files)+count($galleries))/ ITEMSPERPAGE);
|
||||
if ($pages==0) $pages=1;
|
||||
if (isset($_GET['page'])){
|
||||
$page = (int) $_GET['page'];
|
||||
} else {
|
||||
$page=1;
|
||||
}
|
||||
if ($page<1) $page=1;
|
||||
if ($page>$pages) $page=$pages;
|
||||
$pagelist = array();
|
||||
for($k=1; $k<=$pages; $k++ ) $pagelist[]=$k;
|
||||
$paginator = array( "total"=>$pages,
|
||||
"current"=>$page,
|
||||
"limit" => ITEMSPERPAGE,
|
||||
"pages" => $pagelist
|
||||
);
|
||||
|
||||
$startfrom = ($page-1)*ITEMSPERPAGE;
|
||||
$galleriesout = count(array_slice($galleries,0, $startfrom));
|
||||
$dropdowngalleries=$galleries;
|
||||
$galleries = array_slice($galleries, $startfrom, ITEMSPERPAGE);
|
||||
|
||||
$files = array_slice($files, $startfrom-$galleriesout, ITEMSPERPAGE- count($galleries));
|
||||
|
||||
$this->smarty->assign('paginator', $paginator);
|
||||
$this->smarty->assign('files', $files);
|
||||
$this->smarty->assign('galleries', $galleries);
|
||||
$this->smarty->assign('dwgalleries', $dropdowngalleries);
|
||||
$this->smarty->assign('mmurl', $weburl);
|
||||
$this->smarty->assign('mmbaseurl', $mmbaseurl);
|
||||
$this->smarty->assign('currentgallery', $gallery);
|
||||
$this->smarty->assign('totalfilescount', $totalfilescount);
|
||||
}
|
||||
|
||||
function onsubmit($data = NULL) {
|
||||
if (isset($_POST['mm-newgallery'])){
|
||||
$newgallery=$_POST['mm-newgallery-name'];
|
||||
if ($newgallery==""){
|
||||
$this->smarty->assign('success', -3);
|
||||
return 2;
|
||||
}
|
||||
$newgallery = str_replace("/","", $newgallery);
|
||||
$newgallery = str_replace(".","", $newgallery);
|
||||
if (mkdir(ABS_PATH.IMAGES_DIR.$newgallery) ) {
|
||||
$this->smarty->assign('success', 3);
|
||||
} else {
|
||||
$this->smarty->assign('success', -2);
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
$folder = "";
|
||||
if (isset($_GET['gallery'])){
|
||||
$mmbaseurl .= "&gallery=".$_GET['gallery'];
|
||||
$folder = str_replace("/","",$_GET['gallery'])."/";
|
||||
}
|
||||
|
||||
list($action,$arg) = explode("-",$_POST['action'],2);
|
||||
if (!isset($_POST['file'])) return 2;
|
||||
foreach($_POST['file'] as $file=>$v){
|
||||
list($type,$name) = explode("-",$file,2);
|
||||
if ($action=='atg' && $type=='images'){
|
||||
copy( ABS_PATH.IMAGES_DIR.$folder.$name, ABS_PATH.IMAGES_DIR.$arg.'/'.$name);
|
||||
$this->smarty->assign('success', 2);
|
||||
}
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
admin_addpanelaction('uploader', 'mediamanager', true);
|
||||
|
||||
|
||||
?>
|
66
fp-plugins/mediamanager/plugin.mediamanager.php
Normal file
66
fp-plugins/mediamanager/plugin.mediamanager.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Media Manager
|
||||
Version: 0.4
|
||||
Plugin URI: http://kirgroup.com/blog/
|
||||
Description: Manage uloaded files ad photo galleries
|
||||
Author: Fabrix.xm
|
||||
Author URI: http://kirgroup.com/fabrixxm/
|
||||
*/
|
||||
|
||||
// config
|
||||
define('ITEMSPERPAGE', 10);
|
||||
|
||||
|
||||
//
|
||||
function mediamanager_updateUseCountArr(&$files,$fupd){
|
||||
$params = array();
|
||||
$params['start']=0;
|
||||
$params['count']=-1;
|
||||
$params['fullparse'] = true;
|
||||
$q = new FPDB_Query($params, null);
|
||||
while ($q->hasMore()) {
|
||||
list($id, $e) = $q->getEntry();
|
||||
if (isset($e['content'])){
|
||||
foreach($fupd as $id){
|
||||
if (is_null($files[$id]['usecount'])) $files[$id]['usecount']=0;
|
||||
if ($files[$id]['type']=='gallery'){
|
||||
$searchterm="[gallery=images/".$files[$id]['name'];
|
||||
} else {
|
||||
$searchterm=$files[$id]['type']."/".$files[$id]['name'];
|
||||
}
|
||||
if (strpos($e['content'], $searchterm) !== false) $files[$id]['usecount']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$usecount=array();
|
||||
foreach($files as $info){
|
||||
$usecount[$info['name']]=$info['usecount'];
|
||||
}
|
||||
plugin_addoption('mediamanager', 'usecount', $usecount);
|
||||
plugin_saveoptions('mediamanager');
|
||||
}
|
||||
|
||||
|
||||
if (class_exists('AdminPanelAction')){
|
||||
|
||||
|
||||
include(plugin_getdir('mediamanager') .'/panels/panel.mediamanager.file.php');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* invalidate count on entry save and delete */
|
||||
function mediamanager_invalidatecount($arg){
|
||||
plugin_addoption('mediamanager', 'usecount', array());
|
||||
plugin_saveoptions('mediamanager');
|
||||
return $arg;
|
||||
}
|
||||
add_filter('delete_post', 'mediamanager_invalidatecount', 1);
|
||||
add_filter('content_save_pre', 'mediamanager_invalidatecount', 1);
|
||||
|
||||
|
||||
?>
|
BIN
fp-plugins/mediamanager/res/folder.gif
Normal file
BIN
fp-plugins/mediamanager/res/folder.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
BIN
fp-plugins/mediamanager/res/image2.gif
Normal file
BIN
fp-plugins/mediamanager/res/image2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 309 B |
18
fp-plugins/mediamanager/res/style.css
Normal file
18
fp-plugins/mediamanager/res/style.css
Normal file
@ -0,0 +1,18 @@
|
||||
.type-attachs a {
|
||||
padding-left: 25px;
|
||||
background-image: url('unknown.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
}
|
||||
.type-images a {
|
||||
padding-left: 25px;
|
||||
background-image: url('image2.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
}
|
||||
.type-gallery a {
|
||||
padding-left: 25px;
|
||||
background-image: url('folder.gif');
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
}
|
BIN
fp-plugins/mediamanager/res/unknown.gif
Normal file
BIN
fp-plugins/mediamanager/res/unknown.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 245 B |
112
fp-plugins/mediamanager/tpls/admin.plugin.mediamanager.files.tpl
Normal file
112
fp-plugins/mediamanager/tpls/admin.plugin.mediamanager.files.tpl
Normal file
@ -0,0 +1,112 @@
|
||||
<link rel="stylesheet" type="text/css" href="{$mmurl}res/style.css" />
|
||||
<h2>{$plang.head}</h2>
|
||||
<p>{$plang.description}</p>
|
||||
{include file=shared:errorlist.tpl}
|
||||
|
||||
{html_form class=option-set}
|
||||
{$plang.page}: {$paginator.current} / {$paginator.total}</br>
|
||||
{if $currentgallery!=""}<h3>gallery '{$currentgallery}'</h3>{/if}
|
||||
<table class="entrylist">
|
||||
<thead>
|
||||
<colgroup><col/><col width="50%"/><col/><col/><col/></colgroup>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>{$plang.colname}</th>
|
||||
<th>{$plang.colusecount}</th>
|
||||
<th>{$plang.colsize}</th>
|
||||
<th>{$plang.colmtime}</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $currentgallery!=""}
|
||||
<tr><td> </td>
|
||||
<td class="main-cell type-gallery" colspan="5">
|
||||
<a class="link-general" href="admin.php?p=uploader&action=mediamanager">{$plang.up}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{else}
|
||||
{foreach from=$galleries item=v}
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td class="main-cell type-{$v.type}">
|
||||
<a class="link-general" href="admin.php?p=uploader&action=mediamanager&gallery={$v.name}">{$v.name}</a>
|
||||
</td>
|
||||
<td>{if $v.usecount>0}
|
||||
<a class="link-general" href="search.php?q=images%2F{$v.name}&stype=full&Date_Day=&Date_Month=&Date_Year=&submit=Search">{$v.usecount}</a>
|
||||
{else}
|
||||
0
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$v.size}</td>
|
||||
<td>{$v.mtime}</td>
|
||||
<td>
|
||||
<a class="link-delete" href="{$mmbaseurl}&deletefile={$v.type}-{$v.name}">{$plang.delete}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
{if $totalfilescount=="0" }
|
||||
<tr><td colspan="6"><br>{$plang.nofiles} <a class="link-general" href="admin.php?p=uploader&action=default">{$plang.loadfile}</a><br><br></td></tr>
|
||||
{else}
|
||||
{foreach from=$files item=v}
|
||||
<tr>
|
||||
<td>
|
||||
{if $v.type=='images'}
|
||||
<input type='checkbox' name='file[{$v.type}-{$v.name}]'>
|
||||
{else}
|
||||
|
||||
{/if}
|
||||
</td>
|
||||
<td class="main-cell type-{$v.type}"><a class="link-general" {if $v.type=='images'}rel="lightbox[mm]"{/if} href="{$v.url}">{$v.name}</a></td>
|
||||
<td>{if $v.usecount>0}
|
||||
<a class="link-general" href="search.php?q={$v.type}%2F{$v.name}&stype=full&Date_Day=&Date_Month=&Date_Year=&submit=Search">{$v.usecount}</a>
|
||||
{else}
|
||||
0
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$v.size}</td>
|
||||
<td>{$v.mtime}</td>
|
||||
<td>
|
||||
<a class="link-delete" href="{$mmbaseurl}&deletefile={$v.type}-{$v.name}">{$plang.delete}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- paginator -->
|
||||
<p class="paginator">
|
||||
{foreach name=pagelist from=$paginator.pages item=page}
|
||||
{if $paginator.current==$page}
|
||||
{$page}
|
||||
{else}
|
||||
<a href="{$mmbaseurl}&page={$page}">{$page}</a>
|
||||
{/if}
|
||||
{if $smarty.foreach.pagelist.last==false} - {/if}
|
||||
{/foreach}
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
{$plang.selected}:
|
||||
<select name='action'>
|
||||
<option value='-'>{$plang.selectaction}</option>
|
||||
<{foreach from=$dwgalleries item=v}
|
||||
<option value='atg-{$v.name}'>{$plang.addtogallery} '{$v.name}'</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="submit" name="mm-addto" value="{$plang.go}"/>
|
||||
</p>
|
||||
<p>
|
||||
<label>{$plang.newgallery}:
|
||||
<input type="text" name="mm-newgallery-name" />
|
||||
</label>
|
||||
<input type="submit" name="mm-newgallery" value="{$plang.add}"/>
|
||||
</p>
|
||||
|
||||
{/html_form}
|
||||
|
@ -236,13 +236,26 @@ class Plugin_PrettyURLs {
|
||||
$opt = plugin_getoptions('prettyurls', 'mode');
|
||||
$url = substr($_SERVER['REQUEST_URI'], strlen(BLOG_ROOT)-1);
|
||||
|
||||
$urllenght = strlen($url);
|
||||
|
||||
if (isset($_SERVER['PATH_INFO'])) {
|
||||
$pathinfo = $_SERVER['PATH_INFO'];
|
||||
} else {
|
||||
$pathinfo = '';
|
||||
}
|
||||
|
||||
switch($opt) {
|
||||
case null:
|
||||
case 0:
|
||||
$opt = file_exists(ABS_PATH . '.htaccess') ? 3 : 1;
|
||||
case 1:
|
||||
$baseurl .= 'index.php/';
|
||||
$url = $_SERVER['PATH_INFO'];
|
||||
if ($urllenght < 2) {
|
||||
$url = "/";
|
||||
} else {
|
||||
// $url = $_SERVER['PATH_INFO'];
|
||||
$url = $pathinfo;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$baseurl .= '?u=/';
|
||||
@ -613,7 +626,7 @@ STR;
|
||||
|
||||
|
||||
|
||||
function onsubmit() {
|
||||
function onsubmit($data = null) {
|
||||
global $fp_config;
|
||||
|
||||
if (isset($_POST['saveopt'])) {
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
add_filter('wp_head', 'myredirect');
|
||||
|
||||
$content = (SHARED_TPLS . 'login_success.tpl');
|
||||
$content = (SHARED_TPLS . 'login.tpl');
|
||||
|
||||
} elseif (user_loggedin()) {
|
||||
|
||||
|
29
patch-description.txt
Normal file
29
patch-description.txt
Normal file
@ -0,0 +1,29 @@
|
||||
Flatpress 1.0.3 Patch for PHP 7.1
|
||||
=================================
|
||||
|
||||
You can use this patch for this Flatpress version:
|
||||
- Flatpress 1.0.3
|
||||
|
||||
This developer snapshot isn't full tested with all
|
||||
available Flatpress plugins from third party developers.
|
||||
So it is possible that some plugins not run.
|
||||
|
||||
|
||||
Please note!
|
||||
------------
|
||||
|
||||
Do a full backup of your Flatpress Blog before making any changes!
|
||||
|
||||
For instructions how to backup please refer the Flatpress Basics Wiki article
|
||||
-> http://wiki.flatpress.org/en:doc:basic:backup
|
||||
|
||||
|
||||
Instructions:
|
||||
-------------
|
||||
|
||||
You need a FTP program to transfer the patch files to your webspace.
|
||||
Override the files on your flatpress installation,
|
||||
then login and clear the cache. That's all.
|
||||
|
||||
|
||||
date: 03/26/2017
|
387
search.php
387
search.php
@ -1,228 +1,211 @@
|
||||
<?php
|
||||
|
||||
if (!defined('MOD_INDEX')) {
|
||||
// Example of use
|
||||
require_once 'defaults.php';
|
||||
require_once (INCLUDES_DIR.'includes.php');
|
||||
require_once (INCLUDES_DIR . 'includes.php');
|
||||
|
||||
require(SMARTY_DIR . 'SmartyValidate.class.php');
|
||||
|
||||
|
||||
|
||||
system_init();
|
||||
search_main();
|
||||
search_display();
|
||||
require (SMARTY_DIR . 'SmartyValidate.class.php');
|
||||
|
||||
system_init();
|
||||
search_main();
|
||||
search_display();
|
||||
}
|
||||
|
||||
function search_title($title, $sep) {
|
||||
global $lang;
|
||||
return "$title $sep {$lang['search']['head']}";
|
||||
function search_title($title, $sep) {
|
||||
global $lang;
|
||||
return "$title $sep {$lang['search']['head']}";
|
||||
}
|
||||
|
||||
function search_display() {
|
||||
global $smarty;
|
||||
theme_init($smarty);
|
||||
|
||||
$smarty->display('default.tpl');
|
||||
|
||||
unset($smarty);
|
||||
|
||||
do_action('shutdown');
|
||||
}
|
||||
|
||||
function search_main() {
|
||||
global $lang, $smarty;
|
||||
|
||||
add_action('wp_title', 'search_title', 0, 2);
|
||||
|
||||
if (empty($_GET)) {
|
||||
// display form
|
||||
$title = $lang ['search'] ['head'];
|
||||
$content = "shared:search.tpl";
|
||||
} else {
|
||||
// validate
|
||||
if (isset($_GET ['q']) && $kw = trim($_GET ['q'])) {
|
||||
$title = $lang ['search'] ['head'];
|
||||
$content = "shared:search_results.tpl";
|
||||
|
||||
$kw = strtolower($kw);
|
||||
search_do($kw);
|
||||
} else {
|
||||
$smarty->assign('error', $lang ['search'] ['error'] ['keywords']);
|
||||
$title = $lang ['search'] ['headres'];
|
||||
$content = "shared:search.tpl";
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
'subject' => $title,
|
||||
'content' => $content
|
||||
));
|
||||
return 'default.tpl';
|
||||
}
|
||||
|
||||
function search_display() {
|
||||
global $smarty;
|
||||
theme_init($smarty);
|
||||
|
||||
$smarty->display('default.tpl');
|
||||
|
||||
unset($smarty);
|
||||
|
||||
do_action('shutdown');
|
||||
|
||||
|
||||
function search_do($keywords) {
|
||||
global $smarty, $srchresults;
|
||||
|
||||
// get parameters
|
||||
|
||||
$srchkeywords = $keywords;
|
||||
|
||||
$params = array();
|
||||
$params ['start'] = 0;
|
||||
$params ['count'] = -1;
|
||||
|
||||
(!empty($_GET ['Date_Day'])) && ($_GET ['Date_Day'] != '--') ? $params ['d'] = $_GET ['Date_Day'] : null;
|
||||
isset($_GET ['Date_Month']) && ($_GET ['Date_Month'] != '--') ? $params ['m'] = $_GET ['Date_Month'] : null;
|
||||
!empty($_GET ['Date_Year']) && ($_GET ['Date_Year'] != '--') ? $params ['y'] = substr($_GET ['Date_Year'], 2) : null;
|
||||
|
||||
// isset($_GET['cats'])? $params = $_GET['cats']: null;
|
||||
isset($_GET ['cats']) ? $params ['cats'] = $_GET ['cats'] : null;
|
||||
|
||||
$params ['fullparse'] = false;
|
||||
|
||||
if (!empty($_GET ['stype']) && $_GET ['stype'] == 'full') {
|
||||
$params ['fullparse'] = true;
|
||||
$fts = "yes";
|
||||
} else {
|
||||
$params ['fullparse'] = false;
|
||||
$fts = "no";
|
||||
}
|
||||
|
||||
|
||||
function search_main() {
|
||||
|
||||
$srchparams = $params;
|
||||
|
||||
$list = array();
|
||||
|
||||
$q = new FPDB_Query($params, null);
|
||||
|
||||
while ($q->hasMore()) {
|
||||
|
||||
global $lang, $smarty;
|
||||
|
||||
|
||||
add_action('wp_title', 'search_title', 0, 2);
|
||||
list ($id, $e) = $q->getEntry();
|
||||
|
||||
if(empty($_GET)) {
|
||||
// display form
|
||||
$title = $lang['search']['head'];
|
||||
$content = "shared:search.tpl";
|
||||
} else {
|
||||
// validate
|
||||
if(isset($_GET['q']) && $kw = trim($_GET['q'])) {
|
||||
$title = $lang['search']['head'];
|
||||
$content = "shared:search_results.tpl";
|
||||
|
||||
$kw = strtolower($kw);
|
||||
search_do($kw);
|
||||
|
||||
} else {
|
||||
$smarty->assign('error', $lang['search']['error']['keywords']);
|
||||
$title = $lang['search']['headres'];
|
||||
$content = "shared:search.tpl";
|
||||
$match = false;
|
||||
|
||||
if ($keywords == '*') {
|
||||
$match = true;
|
||||
} else {
|
||||
$match = strpos(strtolower($e ['subject']), $keywords) !== false;
|
||||
|
||||
// if (!$match && $params['fullparse']) {
|
||||
if (!$match && ($fts === "yes")) {
|
||||
|
||||
$match = strpos(strtolower($e ['content']), $keywords) !== false;
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign(array('subject'=>$title, 'content'=>$content));
|
||||
return 'default.tpl';
|
||||
if ($match)
|
||||
$list [$id] = $e;
|
||||
}
|
||||
|
||||
$smarty->register_block('search_result_block', 'smarty_search_results_block');
|
||||
$smarty->register_block('search_result', 'smarty_search_result');
|
||||
|
||||
function search_do($keywords) {
|
||||
|
||||
global $smarty, $srchresults;
|
||||
// get parameters
|
||||
|
||||
$srchkeywords = $keywords;
|
||||
|
||||
$params = array();
|
||||
$params['start']=0;
|
||||
$params['count']=-1;
|
||||
|
||||
(!empty($_GET['Date_Day'])) && ($_GET['Date_Day']!='--')? $params['d'] = $_GET['Date_Day']: null;
|
||||
isset($_GET['Date_Month']) && ($_GET['Date_Month']!='--')? $params['m'] = $_GET['Date_Month'] : null;
|
||||
!empty($_GET['Date_Year']) && ($_GET['Date_Year']!='--')? $params['y'] = substr($_GET['Date_Year'], 2) : null;
|
||||
|
||||
isset($_GET['cats'])? $params = $_GET['cats']: null;
|
||||
|
||||
|
||||
$params['fullparse'] = false;
|
||||
|
||||
if(!empty($_GET['stype']) && $_GET['stype']=='full') {
|
||||
$params['fullparse'] = true;
|
||||
}
|
||||
|
||||
$srchparams = $params;
|
||||
|
||||
|
||||
$list = array();
|
||||
|
||||
$q = new FPDB_Query($params, null);
|
||||
|
||||
|
||||
while ($q->hasMore()) {
|
||||
|
||||
list($id, $e) = $q->getEntry();
|
||||
if (!$list)
|
||||
$smarty->assign('noresults', true);
|
||||
|
||||
$srchresults = $list;
|
||||
}
|
||||
|
||||
$match = false;
|
||||
|
||||
if ($keywords == '*') {
|
||||
$match = true;
|
||||
} else {
|
||||
$match = strpos(
|
||||
strtolower($e['subject']),
|
||||
$keywords
|
||||
) !== false;
|
||||
|
||||
if (!$match && $params['fullparse']) {
|
||||
|
||||
$match = strpos(
|
||||
strtolower($e['content']),
|
||||
$keywords
|
||||
) !== false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($match)
|
||||
$list[$id] = $e;
|
||||
}
|
||||
|
||||
|
||||
$smarty->register_block('search_result_block', 'smarty_search_results_block');
|
||||
$smarty->register_block('search_result', 'smarty_search_result');
|
||||
|
||||
if (!$list)
|
||||
$smarty->assign('noresults', true);
|
||||
|
||||
|
||||
$srchresults = $list;
|
||||
|
||||
function smarty_search_results_block($params, $content, &$smarty, &$repeat) {
|
||||
global $srchresults;
|
||||
|
||||
if ($srchresults) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
function smarty_search_results_block($params, $content, &$smarty, &$repeat) {
|
||||
|
||||
global $srchresults;
|
||||
|
||||
if ($srchresults) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function smarty_search_result($params, $content, &$smarty, &$repeat) {
|
||||
|
||||
global $srchresults, $post;
|
||||
|
||||
$repeat = false;
|
||||
|
||||
if (list($id, $e) = each($srchresults)) {
|
||||
$smarty->assign('id', $id);
|
||||
$post = $e;
|
||||
$smarty->assign($e);
|
||||
$repeat = true;
|
||||
return $content;
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
class rawsearchbot extends fs_filelister {
|
||||
|
||||
var $_varname = 'cache';
|
||||
var $_cachefile = null;
|
||||
var $_directory = CONTENT_DIR;
|
||||
var $_constrained_list = array();
|
||||
|
||||
function rawsearchbot($keywords, $fullparse, $searchjusthese=array()) {
|
||||
|
||||
$this->keywords = strtolower($keywords);
|
||||
$this->fullparse = $fullparse;
|
||||
$o = new entry_indexer;
|
||||
$this->entry_arr = $o->getList();
|
||||
|
||||
|
||||
if ($searchjusthese) {
|
||||
$this->_constrained_list = $searchjusthese;
|
||||
}
|
||||
return parent::fs_filelister();
|
||||
|
||||
}
|
||||
|
||||
function _checkFile($directory, $file) {
|
||||
|
||||
$f = "$directory/$file";
|
||||
|
||||
if ( is_dir($f) && ctype_digit($file)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fnmatch('entry*'.EXT, $file)) {
|
||||
$id=basename($file,EXT);
|
||||
$arr = $this->entry_arr[$id];
|
||||
|
||||
if (in_array('draft',$arr['categories'])) return 0;
|
||||
|
||||
if ($this->fullparse) {
|
||||
$str = strtolower(io_load_file(bdb_idtofile($id, BDB_ENTRY)));
|
||||
|
||||
if (strpos($str, $this->keywords)!==false) {
|
||||
$this->_list[$id] = $arr['subject'];
|
||||
}
|
||||
|
||||
} else {
|
||||
if (strpos(strtolower($arr['subject']), $this->keywords)!==false) {
|
||||
$this->_list[$id] = $arr['subject'];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
function smarty_search_result($params, $content, &$smarty, &$repeat) {
|
||||
global $srchresults, $post;
|
||||
$repeat = false;
|
||||
|
||||
// check if we have at least one more search result
|
||||
// (current pointer position must not be after the last element)
|
||||
if (current($srchresults)) {
|
||||
// get the current search result details
|
||||
$id = key($srchresults);
|
||||
$e = $srchresults [$id];
|
||||
// assign values to template
|
||||
$smarty->assign('id', $id);
|
||||
$post = $e;
|
||||
+$smarty->assign($e);
|
||||
$repeat = true;
|
||||
// advance pointer to next search result element
|
||||
next($srchresults);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
/*
|
||||
* class rawsearchbot extends fs_filelister {
|
||||
*
|
||||
* var $_varname = 'cache';
|
||||
* var $_cachefile = null;
|
||||
* var $_directory = CONTENT_DIR;
|
||||
* var $_constrained_list = array();
|
||||
*
|
||||
* function rawsearchbot($keywords, $fullparse, $searchjusthese=array()) {
|
||||
*
|
||||
* $this->keywords = strtolower($keywords);
|
||||
* $this->fullparse = $fullparse;
|
||||
* $o = new entry_indexer;
|
||||
* $this->entry_arr = $o->getList();
|
||||
*
|
||||
*
|
||||
* if ($searchjusthese) {
|
||||
* $this->_constrained_list = $searchjusthese;
|
||||
* }
|
||||
* return parent::__construct();
|
||||
*
|
||||
* }
|
||||
*
|
||||
* function _checkFile($directory, $file) {
|
||||
*
|
||||
* $f = "$directory/$file";
|
||||
*
|
||||
* if ( is_dir($f) && ctype_digit($file)) {
|
||||
* return 1;
|
||||
* }
|
||||
*
|
||||
* if (fnmatch('entry*'.EXT, $file)) {
|
||||
* $id=basename($file,EXT);
|
||||
* $arr = $this->entry_arr[$id];
|
||||
*
|
||||
* if (in_array('draft',$arr['categories'])) return 0;
|
||||
*
|
||||
* if ($this->fullparse) {
|
||||
* $str = strtolower(io_load_file(bdb_idtofile($id, BDB_ENTRY)));
|
||||
*
|
||||
* if (strpos($str, $this->keywords)!==false) {
|
||||
* $this->_list[$id] = $arr['subject'];
|
||||
* }
|
||||
*
|
||||
* } else {
|
||||
* if (strpos(strtolower($arr['subject']), $this->keywords)!==false) {
|
||||
* $this->_list[$id] = $arr['subject'];
|
||||
* }
|
||||
* }
|
||||
* return 0;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user