Merge lp:~quam-plures-core/quam-plures/qp5_html5_templates into lp:quam-plures

Proposed by EdB
Status: Merged
Merged at revision: 7659
Proposed branch: lp:~quam-plures-core/quam-plures/qp5_html5_templates
Merge into: lp:quam-plures
Diff against target: 36764 lines (+12324/-15134)
238 files modified
blog2.php (+21/-16)
blog3.php (+21/-16)
blog4.php (+21/-16)
license.txt (+652/-276)
multiblogs.php (+21/-19)
qp_config/license.txt (+0/-293)
qp_inc/_application.php (+1/-1)
qp_inc/_core/__core.init.php (+2/-1)
qp_inc/_core/_param.funcs.php (+343/-267)
qp_inc/_core/_template.funcs.php (+22/-8)
qp_inc/_core/model/__core.install.php (+4/-2)
qp_inc/collections/coll_settings.ctrl.php (+2/-2)
qp_inc/collections/collections.ctrl.php (+1/-1)
qp_inc/collections/model/_blog.class.php (+12/-0)
qp_inc/comments/views/_comment.form.php (+193/-217)
qp_inc/items/views/_item_expert.form.php (+125/-142)
qp_inc/license.txt (+0/-293)
qp_inc/plugins/_plugin.class.php (+8/-5)
qp_inc/plugins/_plugin.funcs.php (+1/-1)
qp_inc/plugins/model/_plugins.class.php (+291/-512)
qp_inc/templates/_template.funcs.php (+675/-661)
qp_inc/templates/model/_template.class.php (+692/-544)
qp_inc/templates/model/_templatecache.class.php (+41/-70)
qp_inc/templates/templates.ctrl.php (+127/-153)
qp_inc/templates/views/_coll_sel_template.view.php (+0/-39)
qp_inc/templates/views/_coll_template.view.php (+0/-58)
qp_inc/templates/views/_coll_template_settings.form.php (+0/-101)
qp_inc/templates/views/_template.form.php (+58/-71)
qp_inc/templates/views/_template_list.view.php (+0/-89)
qp_inc/templates/views/_template_list_available.view.php (+50/-36)
qp_inc/templates/views/_template_list_installed.view.php (+85/-0)
qp_inc/templates/views/_template_select.view.php (+46/-0)
qp_inc/templates/views/_template_select_create.view.php (+37/-0)
qp_inc/templates/views/_template_settings.form.php (+71/-0)
qp_inc/users/model/_user.class.php (+10/-14)
qp_inc/xhtml_validator/_html5_dtd.inc.php (+387/-0)
qp_inc/xhtml_validator/_xhtml_dtd.inc.php (+116/-296)
qp_inc/xhtml_validator/_xhtml_validator.class.php (+13/-5)
qp_install/_functions_dbupgrade.php (+33/-0)
qp_install/license.txt (+0/-293)
qp_rsc/css/basic.css (+244/-587)
qp_rsc/css/smoothness/jquery-ui-1.8.16.custom.css (+363/-542)
qp_rsc/css/toolbar_debug.css (+66/-0)
qp_rsc/js/html5shiv.js (+4/-0)
qp_rsc/license.txt (+0/-293)
qp_srvc/getmail.php (+109/-137)
qp_srvc/license.txt (+0/-293)
qp_templates/_403_referer_spam.main.php (+8/-5)
qp_templates/_404_blog_not_found.main.php (+8/-7)
qp_templates/_404_not_found.disp.php (+13/-20)
qp_templates/_410_stats_gone.main.php (+10/-6)
qp_templates/_arcdir.disp.php (+7/-8)
qp_templates/_atom/_template.class.php (+12/-24)
qp_templates/_atom/comments.main.php (+14/-10)
qp_templates/_atom/index.main.php (+21/-22)
qp_templates/_body_footer.inc.php (+6/-12)
qp_templates/_catdir.disp.php (+7/-8)
qp_templates/_comments.disp.php (+12/-12)
qp_templates/_contributors.php (+0/-9)
qp_templates/_credits.disp.php (+13/-15)
qp_templates/_html5_header.inc.php (+84/-0)
qp_templates/_html_header.inc.php (+0/-82)
qp_templates/_item_block.inc.php (+6/-11)
qp_templates/_item_comment.inc.php (+11/-16)
qp_templates/_item_comment_form.inc.php (+66/-66)
qp_templates/_item_content.inc.php (+26/-33)
qp_templates/_item_feedback.inc.php (+19/-21)
qp_templates/_mediaidx.disp.php (+9/-10)
qp_templates/_msgform.disp.php (+26/-27)
qp_templates/_profile.disp.php (+18/-37)
qp_templates/_rdf/_template.class.php (+12/-24)
qp_templates/_rdf/comments.main.php (+17/-11)
qp_templates/_rdf/index.main.php (+23/-34)
qp_templates/_rss/_template.class.php (+12/-24)
qp_templates/_rss/comments.main.php (+16/-11)
qp_templates/_rss/index.main.php (+18/-18)
qp_templates/_rss2/_template.class.php (+12/-24)
qp_templates/_rss2/comments.main.php (+14/-9)
qp_templates/_rss2/index.main.php (+30/-40)
qp_templates/_sitemap/_template.class.php (+13/-25)
qp_templates/_sitemap/index.main.php (+10/-9)
qp_templates/_subs.disp.php (+24/-33)
qp_templates/_toolbar.inc.php (+14/-37)
qp_templates/_user.disp.php (+18/-31)
qp_templates/_xhtml_header.inc.php (+84/-0)
qp_templates/asevo/_item_block.inc.php (+5/-11)
qp_templates/asevo/_template.class.php (+20/-31)
qp_templates/asevo/index.main.php (+7/-11)
qp_templates/asevo/print.css (+5/-18)
qp_templates/asevo/style.css (+130/-171)
qp_templates/basic/_credits.disp.php (+0/-134)
qp_templates/basic/_item_block.inc.php (+0/-108)
qp_templates/basic/_item_feedback.inc.php (+0/-142)
qp_templates/basic/_template.class.php (+0/-134)
qp_templates/basic/index.main.php (+0/-143)
qp_templates/basic/po/messages.pot (+0/-122)
qp_templates/basic/print.css (+0/-21)
qp_templates/basic/style.css (+0/-122)
qp_templates/basic/style_borders.css (+0/-132)
qp_templates/basic/style_colors.css (+0/-132)
qp_templates/basic/style_everything.css (+0/-133)
qp_templates/basic/style_outlines.css (+0/-10)
qp_templates/custom/_item_block.inc.php (+0/-126)
qp_templates/custom/_template.class.php (+0/-133)
qp_templates/custom/index.main.php (+0/-175)
qp_templates/custom/po/messages.pot (+0/-86)
qp_templates/custom/print.css (+0/-21)
qp_templates/custom/style.css (+0/-346)
qp_templates/darkdragon/_item_block.inc.php (+91/-0)
qp_templates/darkdragon/_item_block_featured.inc.php (+62/-0)
qp_templates/darkdragon/_item_content.inc.php (+163/-0)
qp_templates/darkdragon/_template.class.php (+122/-0)
qp_templates/darkdragon/font/CloisterBlack-webfont.svg (+139/-0)
qp_templates/darkdragon/font/DieterSteffmannFontLicense.txt (+1/-0)
qp_templates/darkdragon/index.main.php (+180/-0)
qp_templates/darkdragon/po/messages.pot (+85/-0)
qp_templates/darkdragon/print.css (+17/-0)
qp_templates/darkdragon/style.css (+77/-0)
qp_templates/evocamp/_body_footer.inc.php (+7/-11)
qp_templates/evocamp/_body_header.inc.php (+7/-11)
qp_templates/evocamp/_item_block.inc.php (+7/-11)
qp_templates/evocamp/_sidebar.inc.php (+7/-11)
qp_templates/evocamp/_sidebar_2.inc.php (+7/-11)
qp_templates/evocamp/_template.class.php (+23/-32)
qp_templates/evocamp/index.main.php (+8/-11)
qp_templates/evocamp/page.main.php (+8/-12)
qp_templates/evocamp/posts.main.php (+8/-12)
qp_templates/evocamp/print.css (+5/-18)
qp_templates/evocamp/single.main.php (+8/-12)
qp_templates/evocamp/style.css (+219/-330)
qp_templates/evopress/_body_footer.inc.php (+6/-11)
qp_templates/evopress/_body_header.inc.php (+6/-11)
qp_templates/evopress/_item_block.inc.php (+6/-11)
qp_templates/evopress/_sidebar.inc.php (+6/-11)
qp_templates/evopress/_template.class.php (+21/-31)
qp_templates/evopress/index.main.php (+7/-11)
qp_templates/evopress/page.main.php (+7/-12)
qp_templates/evopress/posts.main.php (+7/-12)
qp_templates/evopress/print.css (+5/-18)
qp_templates/evopress/single.main.php (+7/-12)
qp_templates/evopress/style.css (+224/-369)
qp_templates/glossyblue/_body_footer.inc.php (+7/-11)
qp_templates/glossyblue/_body_header.inc.php (+7/-11)
qp_templates/glossyblue/_item_block.inc.php (+7/-11)
qp_templates/glossyblue/_item_feedback.inc.php (+31/-39)
qp_templates/glossyblue/_sidebar.inc.php (+7/-11)
qp_templates/glossyblue/_template.class.php (+23/-32)
qp_templates/glossyblue/index.main.php (+8/-11)
qp_templates/glossyblue/page.main.php (+8/-12)
qp_templates/glossyblue/posts.main.php (+8/-12)
qp_templates/glossyblue/print.css (+5/-18)
qp_templates/glossyblue/single.main.php (+8/-12)
qp_templates/glossyblue/style.css (+335/-371)
qp_templates/intense/_body_footer.inc.php (+5/-11)
qp_templates/intense/_body_header.inc.php (+6/-12)
qp_templates/intense/_item_block.inc.php (+5/-11)
qp_templates/intense/_sidebar.inc.php (+5/-11)
qp_templates/intense/_template.class.php (+27/-40)
qp_templates/intense/index.main.php (+6/-11)
qp_templates/intense/page.main.php (+6/-12)
qp_templates/intense/posts.main.php (+6/-12)
qp_templates/intense/print.css (+5/-18)
qp_templates/intense/single.main.php (+6/-12)
qp_templates/intense/style.css (+273/-323)
qp_templates/license.txt (+0/-298)
qp_templates/miami_blue/_item_block.inc.php (+6/-11)
qp_templates/miami_blue/_template.class.php (+21/-31)
qp_templates/miami_blue/index.main.php (+8/-11)
qp_templates/miami_blue/print.css (+5/-18)
qp_templates/miami_blue/style.css (+198/-247)
qp_templates/natural_pink/_item_block.inc.php (+6/-11)
qp_templates/natural_pink/_template.class.php (+21/-31)
qp_templates/natural_pink/index.main.php (+8/-11)
qp_templates/natural_pink/print.css (+5/-18)
qp_templates/natural_pink/style.css (+164/-222)
qp_templates/nifty_colors/_featured_item.inc.php (+105/-0)
qp_templates/nifty_colors/_template.class.php (+103/-0)
qp_templates/nifty_colors/_xhtml_header.inc.php (+85/-0)
qp_templates/nifty_colors/index.main.php (+295/-0)
qp_templates/nifty_colors/po/messages.pot (+101/-0)
qp_templates/nifty_colors/print.css (+8/-0)
qp_templates/nifty_colors/rsc/A0C22E.css (+70/-0)
qp_templates/nifty_colors/rsc/A477A4.css (+70/-0)
qp_templates/nifty_colors/rsc/BD4D55.css (+70/-0)
qp_templates/nifty_colors/rsc/FF9933.css (+70/-0)
qp_templates/nifty_colors/rsc/left.css (+12/-0)
qp_templates/nifty_colors/rsc/nifty_corners.css (+22/-0)
qp_templates/nifty_colors/rsc/nifty_corners.js (+178/-0)
qp_templates/nifty_colors/rsc/nifty_print.css (+26/-0)
qp_templates/nifty_colors/rsc/right.css (+12/-0)
qp_templates/nifty_colors/style.css (+246/-0)
qp_templates/nifty_colors/tinymce.css (+38/-0)
qp_templates/nifty_corners/_item_block.inc.php (+6/-11)
qp_templates/nifty_corners/_template.class.php (+21/-31)
qp_templates/nifty_corners/index.main.php (+8/-11)
qp_templates/nifty_corners/print.css (+5/-18)
qp_templates/nifty_corners/rsc/nifty_corners.css (+1/-4)
qp_templates/nifty_corners/rsc/nifty_print.css (+2/-4)
qp_templates/nifty_corners/style.css (+172/-239)
qp_templates/photoblog/_html_header.inc.php (+0/-88)
qp_templates/photoblog/_item_block.inc.php (+6/-11)
qp_templates/photoblog/_template.class.php (+70/-79)
qp_templates/photoblog/_xhtml_header.inc.php (+92/-0)
qp_templates/photoblog/feedback_popup.main.php (+8/-6)
qp_templates/photoblog/index.main.php (+2/-1)
qp_templates/photoblog/print.css (+5/-18)
qp_templates/photoblog/style.css (+103/-124)
qp_templates/pixelgreen/_item_block.inc.php (+7/-11)
qp_templates/pixelgreen/_template.class.php (+22/-31)
qp_templates/pixelgreen/index.main.php (+18/-13)
qp_templates/pixelgreen/print.css (+5/-18)
qp_templates/pixelgreen/style.css (+230/-233)
qp_templates/pluralism/_body_footer.inc.php (+6/-11)
qp_templates/pluralism/_body_header.inc.php (+6/-11)
qp_templates/pluralism/_item_block.inc.php (+6/-11)
qp_templates/pluralism/_sidebar.inc.php (+6/-11)
qp_templates/pluralism/_template.class.php (+21/-31)
qp_templates/pluralism/index.main.php (+7/-11)
qp_templates/pluralism/page.main.php (+7/-12)
qp_templates/pluralism/posts.main.php (+9/-13)
qp_templates/pluralism/print.css (+5/-18)
qp_templates/pluralism/single.main.php (+7/-12)
qp_templates/pluralism/style.css (+149/-232)
qp_templates/terrafirma/_item_block.inc.php (+6/-11)
qp_templates/terrafirma/_item_comment.inc.php (+14/-17)
qp_templates/terrafirma/_template.class.php (+21/-31)
qp_templates/terrafirma/index.main.php (+16/-12)
qp_templates/terrafirma/print.css (+5/-18)
qp_templates/terrafirma/style.css (+293/-439)
qp_templates/vastitude/_item_block.inc.php (+6/-11)
qp_templates/vastitude/_template.class.php (+21/-31)
qp_templates/vastitude/index.main.php (+17/-15)
qp_templates/vastitude/print.css (+5/-18)
qp_templates/vastitude/style.css (+628/-229)
qp_view_admin/_html_header.inc.php (+89/-104)
qp_view_admin/license.txt (+0/-298)
stubfile.template.php (+16/-11)
summary.php (+17/-18)
To merge this branch: bzr merge lp:~quam-plures-core/quam-plures/qp5_html5_templates
Reviewer Review Type Date Requested Status
Quam Plures Core Team Pending
Review via email: mp+152514@code.launchpad.net

Description of the change

dunno what happened last time, but this time I can see the changes here on LP so yay merge-a-thon!

Again there is a css issue when you switch to one of the html5 templates but so what it'll get fixed fairly soon :)

http://forums.quamplures.net/viewtopic.php?f=6&t=1892

To post a comment you must log in.
7660. By EdB

fixing the only flaw I found :)

7661. By EdB

needed screenshots for the new templates, fixed a css issue when using an html5 template

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'blog2.php'
--- blog2.php 2010-12-31 12:12:03 +0000
+++ blog2.php 2013-03-11 07:27:21 +0000
@@ -1,37 +1,42 @@
1<?php1<?php
2/**2/**
3 * Stub File3 * Stub File Template
4 *4 *
5 * Quam Plures - {@link http://quamplures.net/}5 * This file is used to create a new stub file when a blog is created. If the value of $blog
6 * Released under GNU GPL License - {@link http://quamplures.net/license.html}6 * is not NNN then this file was created; only stubfile.template.php has that value of $blog.
7 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}7 *
8 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}8 * @author {@link http://wonderwinds.com/ Ed Bennett}
9 * @copyright (c) 2010 by {@link http://quamplures.net/ the Quam Plures project}
10 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
9 * @package templates11 * @package templates
10 * @subpackage stubfiles
11 */12 */
1213
13# select which blog14// select which blog
14$blog = 2;15$blog = 2;
1516
16# force a template?17// retricts posts to published, hides drafts
17# $template = 'custom';
18
19# retricts posts to published, hides drafts.
20$show_statuses = array();18$show_statuses = array();
2119
22# ignore before, unix timestamp or 'now'20// ignore before, unix timestamp or 'now'
23$timestamp_min = '';21$timestamp_min = '';
2422
25# ignore after, unix timestamp or 'now'23// ignore after, unix timestamp or 'now'
26$timestamp_max = 'now';24$timestamp_max = 'now';
2725
28# change order?26// force a template?
27# $template = 'custom';
28
29// change order?
29# $order = 'ASC';30# $order = 'ASC';
3031
31/**32/**
32 * That's it, now let Quam Plures do the rest! :)33 * Load the configuration minimum
33 */34 */
34require_once dirname(__FILE__).'/qp_config/_config.php';35require_once dirname(__FILE__).'/qp_config/_config.php';
3536
37/**
38 * Main initialization, with the identified $blog
39 */
36require $inc_path.'_blog_main.inc.php';40require $inc_path.'_blog_main.inc.php';
41
37?>42?>
3843
=== modified file 'blog3.php'
--- blog3.php 2010-12-31 12:12:03 +0000
+++ blog3.php 2013-03-11 07:27:21 +0000
@@ -1,37 +1,42 @@
1<?php1<?php
2/**2/**
3 * Stub File3 * Stub File Template
4 *4 *
5 * Quam Plures - {@link http://quamplures.net/}5 * This file is used to create a new stub file when a blog is created. If the value of $blog
6 * Released under GNU GPL License - {@link http://quamplures.net/license.html}6 * is not NNN then this file was created; only stubfile.template.php has that value of $blog.
7 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}7 *
8 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}8 * @author {@link http://wonderwinds.com/ Ed Bennett}
9 * @copyright (c) 2010 by {@link http://quamplures.net/ the Quam Plures project}
10 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
9 * @package templates11 * @package templates
10 * @subpackage stubfiles
11 */12 */
1213
13# select which blog14// select which blog
14$blog = 3;15$blog = 3;
1516
16# force a template?17// retricts posts to published, hides drafts
17# $template = 'custom';
18
19# retricts posts to published, hides drafts.
20$show_statuses = array();18$show_statuses = array();
2119
22# ignore before, unix timestamp or 'now'20// ignore before, unix timestamp or 'now'
23$timestamp_min = '';21$timestamp_min = '';
2422
25# ignore after, unix timestamp or 'now'23// ignore after, unix timestamp or 'now'
26$timestamp_max = 'now';24$timestamp_max = 'now';
2725
28# change order?26// force a template?
27# $template = 'custom';
28
29// change order?
29# $order = 'ASC';30# $order = 'ASC';
3031
31/**32/**
32 * That's it, now let Quam Plures do the rest! :)33 * Load the configuration minimum
33 */34 */
34require_once dirname(__FILE__).'/qp_config/_config.php';35require_once dirname(__FILE__).'/qp_config/_config.php';
3536
37/**
38 * Main initialization, with the identified $blog
39 */
36require $inc_path.'_blog_main.inc.php';40require $inc_path.'_blog_main.inc.php';
41
37?>42?>
3843
=== modified file 'blog4.php'
--- blog4.php 2010-12-31 12:12:03 +0000
+++ blog4.php 2013-03-11 07:27:21 +0000
@@ -1,37 +1,42 @@
1<?php1<?php
2/**2/**
3 * Stub File3 * Stub File Template
4 *4 *
5 * Quam Plures - {@link http://quamplures.net/}5 * This file is used to create a new stub file when a blog is created. If the value of $blog
6 * Released under GNU GPL License - {@link http://quamplures.net/license.html}6 * is not NNN then this file was created; only stubfile.template.php has that value of $blog.
7 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}7 *
8 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}8 * @author {@link http://wonderwinds.com/ Ed Bennett}
9 * @copyright (c) 2010 by {@link http://quamplures.net/ the Quam Plures project}
10 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
9 * @package templates11 * @package templates
10 * @subpackage stubfiles
11 */12 */
1213
13# select which blog14// select which blog
14$blog = 4;15$blog = 4;
1516
16# force a template?17// retricts posts to published, hides drafts
17# $template = 'custom';
18
19# retricts posts to published, hides drafts.
20$show_statuses = array();18$show_statuses = array();
2119
22# ignore before, unix timestamp or 'now'20// ignore before, unix timestamp or 'now'
23$timestamp_min = '';21$timestamp_min = '';
2422
25# ignore after, unix timestamp or 'now'23// ignore after, unix timestamp or 'now'
26$timestamp_max = 'now';24$timestamp_max = 'now';
2725
28# change order?26// force a template?
27# $template = 'custom';
28
29// change order?
29# $order = 'ASC';30# $order = 'ASC';
3031
31/**32/**
32 * That's it, now let Quam Plures do the rest! :)33 * Load the configuration minimum
33 */34 */
34require_once dirname(__FILE__).'/qp_config/_config.php';35require_once dirname(__FILE__).'/qp_config/_config.php';
3536
37/**
38 * Main initialization, with the identified $blog
39 */
36require $inc_path.'_blog_main.inc.php';40require $inc_path.'_blog_main.inc.php';
41
37?>42?>
3843
=== modified file 'license.txt'
--- license.txt 2010-01-04 17:32:41 +0000
+++ license.txt 2013-03-11 07:27:21 +0000
@@ -1,298 +1,674 @@
1 GNU GENERAL PUBLIC LICENSE1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 19912 Version 3, 29 June 2007
33
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.4 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5 675 Mass Ave, Cambridge, MA 02139, USA
6 Everyone is permitted to copy and distribute verbatim copies5 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.6 of this license document, but changing it is not allowed.
87
9 Preamble8 Preamble
109
11 The licenses for most software are designed to take away your10 The GNU General Public License is a free, copyleft license for
12freedom to share and change it. By contrast, the GNU General Public11software and other kinds of works.
13License is intended to guarantee your freedom to share and change free12
14software--to make sure the software is free for all its users. This13 The licenses for most software and other practical works are designed
15General Public License applies to most of the Free Software14to take away your freedom to share and change the works. By contrast,
16Foundation's software and to any other program whose authors commit to15the GNU General Public License is intended to guarantee your freedom to
17using it. (Some other Free Software Foundation software is covered by16share and change all versions of a program--to make sure it remains free
18the GNU Library General Public License instead.) You can apply it to17software for all its users. We, the Free Software Foundation, use the
18GNU General Public License for most of our software; it applies also to
19any other work released this way by its authors. You can apply it to
19your programs, too.20your programs, too.
2021
21 When we speak of free software, we are referring to freedom, not22 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you23price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for24have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it25them if you wish), that you receive source code or can get it if you
25if you want it, that you can change the software or use pieces of it26want it, that you can change the software or use pieces of it in new
26in new free programs; and that you know you can do these things.27free programs, and that you know you can do these things.
2728
28 To protect your rights, we need to make restrictions that forbid29 To protect your rights, we need to prevent others from denying you
29anyone to deny you these rights or to ask you to surrender the rights.30these rights or asking you to surrender the rights. Therefore, you have
30These restrictions translate to certain responsibilities for you if you31certain responsibilities if you distribute copies of the software, or if
31distribute copies of the software, or if you modify it.32you modify it: responsibilities to respect the freedom of others.
3233
33 For example, if you distribute copies of such a program, whether34 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that35gratis or for a fee, you must pass on to the recipients the same
35you have. You must make sure that they, too, receive or can get the36freedoms that you received. You must make sure that they, too, receive
36source code. And you must show them these terms so they know their37or can get the source code. And you must show them these terms so they
37rights.38know their rights.
3839
39 We protect your rights with two steps: (1) copyright the software, and40 Developers that use the GNU GPL protect your rights with two steps:
40(2) offer you this license which gives you legal permission to copy,41(1) assert copyright on the software, and (2) offer you this License
41distribute and/or modify the software.42giving you legal permission to copy, distribute and/or modify it.
4243
43 Also, for each author's protection and ours, we want to make certain44 For the developers' and authors' protection, the GPL clearly explains
44that everyone understands that there is no warranty for this free45that there is no warranty for this free software. For both users' and
45software. If the software is modified by someone else and passed on, we46authors' sake, the GPL requires that modified versions be marked as
46want its recipients to know that what they have is not the original, so47changed, so that their problems will not be attributed erroneously to
47that any problems introduced by others will not reflect on the original48authors of previous versions.
48authors' reputations.49
4950 Some devices are designed to deny users access to install or run
50 Finally, any free program is threatened constantly by software51modified versions of the software inside them, although the manufacturer
51patents. We wish to avoid the danger that redistributors of a free52can do so. This is fundamentally incompatible with the aim of
52program will individually obtain patent licenses, in effect making the53protecting users' freedom to change the software. The systematic
53program proprietary. To prevent this, we have made it clear that any54pattern of such abuse occurs in the area of products for individuals to
54patent must be licensed for everyone's free use or not licensed at all.55use, which is precisely where it is most unacceptable. Therefore, we
56have designed this version of the GPL to prohibit the practice for those
57products. If such problems arise substantially in other domains, we
58stand ready to extend this provision to those domains in future versions
59of the GPL, as needed to protect the freedom of users.
60
61 Finally, every program is threatened constantly by software patents.
62States should not allow patents to restrict development and use of
63software on general-purpose computers, but in those that do, we wish to
64avoid the special danger that patents applied to a free program could
65make it effectively proprietary. To prevent this, the GPL assures that
66patents cannot be used to render the program non-free.
5567
56 The precise terms and conditions for copying, distribution and68 The precise terms and conditions for copying, distribution and
57modification follow.69modification follow.
5870
59 GNU GENERAL PUBLIC LICENSE71 TERMS AND CONDITIONS
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION72
6173 0. Definitions.
62 0. This License applies to any program or other work which contains74
63a notice placed by the copyright holder saying it may be distributed75 "This License" refers to version 3 of the GNU General Public License.
64under the terms of this General Public License. The "Program", below,76
65refers to any such program or work, and a "work based on the Program"77 "Copyright" also means copyright-like laws that apply to other kinds of
66means either the Program or any derivative work under copyright law:78works, such as semiconductor masks.
67that is to say, a work containing the Program or a portion of it,79
68either verbatim or with modifications and/or translated into another80 "The Program" refers to any copyrightable work licensed under this
69language. (Hereinafter, translation is included without limitation in81License. Each licensee is addressed as "you". "Licensees" and
70the term "modification".) Each licensee is addressed as "you".82"recipients" may be individuals or organizations.
7183
72Activities other than copying, distribution and modification are not84 To "modify" a work means to copy from or adapt all or part of the work
73covered by this License; they are outside its scope. The act of85in a fashion requiring copyright permission, other than the making of an
74running the Program is not restricted, and the output from the Program86exact copy. The resulting work is called a "modified version" of the
75is covered only if its contents constitute a work based on the87earlier work or a work "based on" the earlier work.
76Program (independent of having been made by running the Program).88
77Whether that is true depends on what the Program does.89 A "covered work" means either the unmodified Program or a work based
7890on the Program.
79 1. You may copy and distribute verbatim copies of the Program's91
80source code as you receive it, in any medium, provided that you92 To "propagate" a work means to do anything with it that, without
81conspicuously and appropriately publish on each copy an appropriate93permission, would make you directly or secondarily liable for
82copyright notice and disclaimer of warranty; keep intact all the94infringement under applicable copyright law, except executing it on a
83notices that refer to this License and to the absence of any warranty;95computer or modifying a private copy. Propagation includes copying,
84and give any other recipients of the Program a copy of this License96distribution (with or without modification), making available to the
85along with the Program.97public, and in some countries other activities as well.
8698
87You may charge a fee for the physical act of transferring a copy, and99 To "convey" a work means any kind of propagation that enables other
88you may at your option offer warranty protection in exchange for a fee.100parties to make or receive copies. Mere interaction with a user through
89101a computer network, with no transfer of a copy, is not conveying.
90 2. You may modify your copy or copies of the Program or any portion102
91of it, thus forming a work based on the Program, and copy and103 An interactive user interface displays "Appropriate Legal Notices"
92distribute such modifications or work under the terms of Section 1104to the extent that it includes a convenient and prominently visible
93above, provided that you also meet all of these conditions:105feature that (1) displays an appropriate copyright notice, and (2)
94106tells the user that there is no warranty for the work (except to the
95 a) You must cause the modified files to carry prominent notices107extent that warranties are provided), that licensees may convey the
96 stating that you changed the files and the date of any change.108work under this License, and how to view a copy of this License. If
97109the interface presents a list of user commands or options, such as a
98 b) You must cause any work that you distribute or publish, that in110menu, a prominent item in the list meets this criterion.
99 whole or in part contains or is derived from the Program or any111
100 part thereof, to be licensed as a whole at no charge to all third112 1. Source Code.
101 parties under the terms of this License.113
102114 The "source code" for a work means the preferred form of the work
103 c) If the modified program normally reads commands interactively115for making modifications to it. "Object code" means any non-source
104 when run, you must cause it, when started running for such116form of a work.
105 interactive use in the most ordinary way, to print or display an117
106 announcement including an appropriate copyright notice and a118 A "Standard Interface" means an interface that either is an official
107 notice that there is no warranty (or else, saying that you provide119standard defined by a recognized standards body, or, in the case of
108 a warranty) and that users may redistribute the program under120interfaces specified for a particular programming language, one that
109 these conditions, and telling the user how to view a copy of this121is widely used among developers working in that language.
110 License. (Exception: if the Program itself is interactive but122
111 does not normally print such an announcement, your work based on123 The "System Libraries" of an executable work include anything, other
112 the Program is not required to print an announcement.)124than the work as a whole, that (a) is included in the normal form of
113125packaging a Major Component, but which is not part of that Major
114These requirements apply to the modified work as a whole. If126Component, and (b) serves only to enable use of the work with that
115identifiable sections of that work are not derived from the Program,127Major Component, or to implement a Standard Interface for which an
116and can be reasonably considered independent and separate works in128implementation is available to the public in source code form. A
117themselves, then this License, and its terms, do not apply to those129"Major Component", in this context, means a major essential component
118sections when you distribute them as separate works. But when you130(kernel, window system, and so on) of the specific operating system
119distribute the same sections as part of a whole which is a work based131(if any) on which the executable work runs, or a compiler used to
120on the Program, the distribution of the whole must be on the terms of132produce the work, or an object code interpreter used to run it.
121this License, whose permissions for other licensees extend to the133
122entire whole, and thus to each and every part regardless of who wrote it.134 The "Corresponding Source" for a work in object code form means all
123Thus, it is not the intent of this section to claim rights or contest135the source code needed to generate, install, and (for an executable
124your rights to work written entirely by you; rather, the intent is to136work) run the object code and to modify the work, including scripts to
125exercise the right to control the distribution of derivative or137control those activities. However, it does not include the work's
126collective works based on the Program.138System Libraries, or general-purpose tools or generally available free
127139programs which are used unmodified in performing those activities but
128In addition, mere aggregation of another work not based on the Program140which are not part of the work. For example, Corresponding Source
129with the Program (or with a work based on the Program) on a volume of141includes interface definition files associated with source files for
130a storage or distribution medium does not bring the other work under142the work, and the source code for shared libraries and dynamically
131the scope of this License.143linked subprograms that the work is specifically designed to require,
132144such as by intimate data communication or control flow between those
133 3. You may copy and distribute the Program (or a work based on it,145subprograms and other parts of the work.
134under Section 2) in object code or executable form under the terms of146
135Sections 1 and 2 above provided that you also do one of the following:147 The Corresponding Source need not include anything that users
136148can regenerate automatically from other parts of the Corresponding
137 a) Accompany it with the complete corresponding machine-readable149Source.
138 source code, which must be distributed under the terms of Sections150
139 1 and 2 above on a medium customarily used for software interchange; or,151 The Corresponding Source for a work in source code form is that
140152same work.
141 b) Accompany it with a written offer, valid for at least three153
142 years, to give any third party, for a charge no more than your154 2. Basic Permissions.
143 cost of physically performing source distribution, a complete155
144 machine-readable copy of the corresponding source code, to be156 All rights granted under this License are granted for the term of
145 distributed under the terms of Sections 1 and 2 above on a medium157copyright on the Program, and are irrevocable provided the stated
146 customarily used for software interchange; or,158conditions are met. This License explicitly affirms your unlimited
147159permission to run the unmodified Program. The output from running a
148 c) Accompany it with the information you received as to the offer160covered work is covered by this License only if the output, given its
149 to distribute corresponding source code. (This alternative is161content, constitutes a covered work. This License acknowledges your
150 allowed only for noncommercial distribution and only if you162rights of fair use or other equivalent, as provided by copyright law.
151 received the program in object code or executable form with such163
152 an offer, in accord with Subsection b above.)164 You may make, run and propagate covered works that you do not
153165convey, without conditions so long as your license otherwise remains
154The source code for a work means the preferred form of the work for166in force. You may convey covered works to others for the sole purpose
155making modifications to it. For an executable work, complete source167of having them make modifications exclusively for you, or provide you
156code means all the source code for all modules it contains, plus any168with facilities for running those works, provided that you comply with
157associated interface definition files, plus the scripts used to169the terms of this License in conveying all material for which you do
158control compilation and installation of the executable. However, as a170not control copyright. Those thus making or running the covered works
159special exception, the source code distributed need not include171for you must do so exclusively on your behalf, under your direction
160anything that is normally distributed (in either source or binary172and control, on terms that prohibit them from making any copies of
161form) with the major components (compiler, kernel, and so on) of the173your copyrighted material outside their relationship with you.
162operating system on which the executable runs, unless that component174
163itself accompanies the executable.175 Conveying under any other circumstances is permitted solely under
164176the conditions stated below. Sublicensing is not allowed; section 10
165If distribution of executable or object code is made by offering177makes it unnecessary.
166access to copy from a designated place, then offering equivalent178
167access to copy the source code from the same place counts as179 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168distribution of the source code, even though third parties are not180
169compelled to copy the source along with the object code.181 No covered work shall be deemed part of an effective technological
170182measure under any applicable law fulfilling obligations under article
171 4. You may not copy, modify, sublicense, or distribute the Program18311 of the WIPO copyright treaty adopted on 20 December 1996, or
172except as expressly provided under this License. Any attempt184similar laws prohibiting or restricting circumvention of such
173otherwise to copy, modify, sublicense or distribute the Program is185measures.
174void, and will automatically terminate your rights under this License.186
175However, parties who have received copies, or rights, from you under187 When you convey a covered work, you waive any legal power to forbid
176this License will not have their licenses terminated so long as such188circumvention of technological measures to the extent such circumvention
177parties remain in full compliance.189is effected by exercising rights under this License with respect to
178190the covered work, and you disclaim any intention to limit operation or
179 5. You are not required to accept this License, since you have not191modification of the work as a means of enforcing, against the work's
180signed it. However, nothing else grants you permission to modify or192users, your or third parties' legal rights to forbid circumvention of
181distribute the Program or its derivative works. These actions are193technological measures.
182prohibited by law if you do not accept this License. Therefore, by194
183modifying or distributing the Program (or any work based on the195 4. Conveying Verbatim Copies.
184Program), you indicate your acceptance of this License to do so, and196
185all its terms and conditions for copying, distributing or modifying197 You may convey verbatim copies of the Program's source code as you
186the Program or works based on it.198receive it, in any medium, provided that you conspicuously and
187199appropriately publish on each copy an appropriate copyright notice;
188 6. Each time you redistribute the Program (or any work based on the200keep intact all notices stating that this License and any
189Program), the recipient automatically receives a license from the201non-permissive terms added in accord with section 7 apply to the code;
190original licensor to copy, distribute or modify the Program subject to202keep intact all notices of the absence of any warranty; and give all
191these terms and conditions. You may not impose any further203recipients a copy of this License along with the Program.
192restrictions on the recipients' exercise of the rights granted herein.204
193You are not responsible for enforcing compliance by third parties to205 You may charge any price or no price for each copy that you convey,
206and you may offer support or warranty protection for a fee.
207
208 5. Conveying Modified Source Versions.
209
210 You may convey a work based on the Program, or the modifications to
211produce it from the Program, in the form of source code under the
212terms of section 4, provided that you also meet all of these conditions:
213
214 a) The work must carry prominent notices stating that you modified
215 it, and giving a relevant date.
216
217 b) The work must carry prominent notices stating that it is
218 released under this License and any conditions added under section
219 7. This requirement modifies the requirement in section 4 to
220 "keep intact all notices".
221
222 c) You must license the entire work, as a whole, under this
223 License to anyone who comes into possession of a copy. This
224 License will therefore apply, along with any applicable section 7
225 additional terms, to the whole of the work, and all its parts,
226 regardless of how they are packaged. This License gives no
227 permission to license the work in any other way, but it does not
228 invalidate such permission if you have separately received it.
229
230 d) If the work has interactive user interfaces, each must display
231 Appropriate Legal Notices; however, if the Program has interactive
232 interfaces that do not display Appropriate Legal Notices, your
233 work need not make them do so.
234
235 A compilation of a covered work with other separate and independent
236works, which are not by their nature extensions of the covered work,
237and which are not combined with it such as to form a larger program,
238in or on a volume of a storage or distribution medium, is called an
239"aggregate" if the compilation and its resulting copyright are not
240used to limit the access or legal rights of the compilation's users
241beyond what the individual works permit. Inclusion of a covered work
242in an aggregate does not cause this License to apply to the other
243parts of the aggregate.
244
245 6. Conveying Non-Source Forms.
246
247 You may convey a covered work in object code form under the terms
248of sections 4 and 5, provided that you also convey the
249machine-readable Corresponding Source under the terms of this License,
250in one of these ways:
251
252 a) Convey the object code in, or embodied in, a physical product
253 (including a physical distribution medium), accompanied by the
254 Corresponding Source fixed on a durable physical medium
255 customarily used for software interchange.
256
257 b) Convey the object code in, or embodied in, a physical product
258 (including a physical distribution medium), accompanied by a
259 written offer, valid for at least three years and valid for as
260 long as you offer spare parts or customer support for that product
261 model, to give anyone who possesses the object code either (1) a
262 copy of the Corresponding Source for all the software in the
263 product that is covered by this License, on a durable physical
264 medium customarily used for software interchange, for a price no
265 more than your reasonable cost of physically performing this
266 conveying of source, or (2) access to copy the
267 Corresponding Source from a network server at no charge.
268
269 c) Convey individual copies of the object code with a copy of the
270 written offer to provide the Corresponding Source. This
271 alternative is allowed only occasionally and noncommercially, and
272 only if you received the object code with such an offer, in accord
273 with subsection 6b.
274
275 d) Convey the object code by offering access from a designated
276 place (gratis or for a charge), and offer equivalent access to the
277 Corresponding Source in the same way through the same place at no
278 further charge. You need not require recipients to copy the
279 Corresponding Source along with the object code. If the place to
280 copy the object code is a network server, the Corresponding Source
281 may be on a different server (operated by you or a third party)
282 that supports equivalent copying facilities, provided you maintain
283 clear directions next to the object code saying where to find the
284 Corresponding Source. Regardless of what server hosts the
285 Corresponding Source, you remain obligated to ensure that it is
286 available for as long as needed to satisfy these requirements.
287
288 e) Convey the object code using peer-to-peer transmission, provided
289 you inform other peers where the object code and Corresponding
290 Source of the work are being offered to the general public at no
291 charge under subsection 6d.
292
293 A separable portion of the object code, whose source code is excluded
294from the Corresponding Source as a System Library, need not be
295included in conveying the object code work.
296
297 A "User Product" is either (1) a "consumer product", which means any
298tangible personal property which is normally used for personal, family,
299or household purposes, or (2) anything designed or sold for incorporation
300into a dwelling. In determining whether a product is a consumer product,
301doubtful cases shall be resolved in favor of coverage. For a particular
302product received by a particular user, "normally used" refers to a
303typical or common use of that class of product, regardless of the status
304of the particular user or of the way in which the particular user
305actually uses, or expects or is expected to use, the product. A product
306is a consumer product regardless of whether the product has substantial
307commercial, industrial or non-consumer uses, unless such uses represent
308the only significant mode of use of the product.
309
310 "Installation Information" for a User Product means any methods,
311procedures, authorization keys, or other information required to install
312and execute modified versions of a covered work in that User Product from
313a modified version of its Corresponding Source. The information must
314suffice to ensure that the continued functioning of the modified object
315code is in no case prevented or interfered with solely because
316modification has been made.
317
318 If you convey an object code work under this section in, or with, or
319specifically for use in, a User Product, and the conveying occurs as
320part of a transaction in which the right of possession and use of the
321User Product is transferred to the recipient in perpetuity or for a
322fixed term (regardless of how the transaction is characterized), the
323Corresponding Source conveyed under this section must be accompanied
324by the Installation Information. But this requirement does not apply
325if neither you nor any third party retains the ability to install
326modified object code on the User Product (for example, the work has
327been installed in ROM).
328
329 The requirement to provide Installation Information does not include a
330requirement to continue to provide support service, warranty, or updates
331for a work that has been modified or installed by the recipient, or for
332the User Product in which it has been modified or installed. Access to a
333network may be denied when the modification itself materially and
334adversely affects the operation of the network or violates the rules and
335protocols for communication across the network.
336
337 Corresponding Source conveyed, and Installation Information provided,
338in accord with this section must be in a format that is publicly
339documented (and with an implementation available to the public in
340source code form), and must require no special password or key for
341unpacking, reading or copying.
342
343 7. Additional Terms.
344
345 "Additional permissions" are terms that supplement the terms of this
346License by making exceptions from one or more of its conditions.
347Additional permissions that are applicable to the entire Program shall
348be treated as though they were included in this License, to the extent
349that they are valid under applicable law. If additional permissions
350apply only to part of the Program, that part may be used separately
351under those permissions, but the entire Program remains governed by
352this License without regard to the additional permissions.
353
354 When you convey a copy of a covered work, you may at your option
355remove any additional permissions from that copy, or from any part of
356it. (Additional permissions may be written to require their own
357removal in certain cases when you modify the work.) You may place
358additional permissions on material, added by you to a covered work,
359for which you have or can give appropriate copyright permission.
360
361 Notwithstanding any other provision of this License, for material you
362add to a covered work, you may (if authorized by the copyright holders of
363that material) supplement the terms of this License with terms:
364
365 a) Disclaiming warranty or limiting liability differently from the
366 terms of sections 15 and 16 of this License; or
367
368 b) Requiring preservation of specified reasonable legal notices or
369 author attributions in that material or in the Appropriate Legal
370 Notices displayed by works containing it; or
371
372 c) Prohibiting misrepresentation of the origin of that material, or
373 requiring that modified versions of such material be marked in
374 reasonable ways as different from the original version; or
375
376 d) Limiting the use for publicity purposes of names of licensors or
377 authors of the material; or
378
379 e) Declining to grant rights under trademark law for use of some
380 trade names, trademarks, or service marks; or
381
382 f) Requiring indemnification of licensors and authors of that
383 material by anyone who conveys the material (or modified versions of
384 it) with contractual assumptions of liability to the recipient, for
385 any liability that these contractual assumptions directly impose on
386 those licensors and authors.
387
388 All other non-permissive additional terms are considered "further
389restrictions" within the meaning of section 10. If the Program as you
390received it, or any part of it, contains a notice stating that it is
391governed by this License along with a term that is a further
392restriction, you may remove that term. If a license document contains
393a further restriction but permits relicensing or conveying under this
394License, you may add to a covered work material governed by the terms
395of that license document, provided that the further restriction does
396not survive such relicensing or conveying.
397
398 If you add terms to a covered work in accord with this section, you
399must place, in the relevant source files, a statement of the
400additional terms that apply to those files, or a notice indicating
401where to find the applicable terms.
402
403 Additional terms, permissive or non-permissive, may be stated in the
404form of a separately written license, or stated as exceptions;
405the above requirements apply either way.
406
407 8. Termination.
408
409 You may not propagate or modify a covered work except as expressly
410provided under this License. Any attempt otherwise to propagate or
411modify it is void, and will automatically terminate your rights under
412this License (including any patent licenses granted under the third
413paragraph of section 11).
414
415 However, if you cease all violation of this License, then your
416license from a particular copyright holder is reinstated (a)
417provisionally, unless and until the copyright holder explicitly and
418finally terminates your license, and (b) permanently, if the copyright
419holder fails to notify you of the violation by some reasonable means
420prior to 60 days after the cessation.
421
422 Moreover, your license from a particular copyright holder is
423reinstated permanently if the copyright holder notifies you of the
424violation by some reasonable means, this is the first time you have
425received notice of violation of this License (for any work) from that
426copyright holder, and you cure the violation prior to 30 days after
427your receipt of the notice.
428
429 Termination of your rights under this section does not terminate the
430licenses of parties who have received copies or rights from you under
431this License. If your rights have been terminated and not permanently
432reinstated, you do not qualify to receive new licenses for the same
433material under section 10.
434
435 9. Acceptance Not Required for Having Copies.
436
437 You are not required to accept this License in order to receive or
438run a copy of the Program. Ancillary propagation of a covered work
439occurring solely as a consequence of using peer-to-peer transmission
440to receive a copy likewise does not require acceptance. However,
441nothing other than this License grants you permission to propagate or
442modify any covered work. These actions infringe copyright if you do
443not accept this License. Therefore, by modifying or propagating a
444covered work, you indicate your acceptance of this License to do so.
445
446 10. Automatic Licensing of Downstream Recipients.
447
448 Each time you convey a covered work, the recipient automatically
449receives a license from the original licensors, to run, modify and
450propagate that work, subject to this License. You are not responsible
451for enforcing compliance by third parties with this License.
452
453 An "entity transaction" is a transaction transferring control of an
454organization, or substantially all assets of one, or subdividing an
455organization, or merging organizations. If propagation of a covered
456work results from an entity transaction, each party to that
457transaction who receives a copy of the work also receives whatever
458licenses to the work the party's predecessor in interest had or could
459give under the previous paragraph, plus a right to possession of the
460Corresponding Source of the work from the predecessor in interest, if
461the predecessor has it or can get it with reasonable efforts.
462
463 You may not impose any further restrictions on the exercise of the
464rights granted or affirmed under this License. For example, you may
465not impose a license fee, royalty, or other charge for exercise of
466rights granted under this License, and you may not initiate litigation
467(including a cross-claim or counterclaim in a lawsuit) alleging that
468any patent claim is infringed by making, using, selling, offering for
469sale, or importing the Program or any portion of it.
470
471 11. Patents.
472
473 A "contributor" is a copyright holder who authorizes use under this
474License of the Program or a work on which the Program is based. The
475work thus licensed is called the contributor's "contributor version".
476
477 A contributor's "essential patent claims" are all patent claims
478owned or controlled by the contributor, whether already acquired or
479hereafter acquired, that would be infringed by some manner, permitted
480by this License, of making, using, or selling its contributor version,
481but do not include claims that would be infringed only as a
482consequence of further modification of the contributor version. For
483purposes of this definition, "control" includes the right to grant
484patent sublicenses in a manner consistent with the requirements of
194this License.485this License.
195486
196 7. If, as a consequence of a court judgment or allegation of patent487 Each contributor grants you a non-exclusive, worldwide, royalty-free
197infringement or for any other reason (not limited to patent issues),488patent license under the contributor's essential patent claims, to
198conditions are imposed on you (whether by court order, agreement or489make, use, sell, offer for sale, import and otherwise run, modify and
490propagate the contents of its contributor version.
491
492 In the following three paragraphs, a "patent license" is any express
493agreement or commitment, however denominated, not to enforce a patent
494(such as an express permission to practice a patent or covenant not to
495sue for patent infringement). To "grant" such a patent license to a
496party means to make such an agreement or commitment not to enforce a
497patent against the party.
498
499 If you convey a covered work, knowingly relying on a patent license,
500and the Corresponding Source of the work is not available for anyone
501to copy, free of charge and under the terms of this License, through a
502publicly available network server or other readily accessible means,
503then you must either (1) cause the Corresponding Source to be so
504available, or (2) arrange to deprive yourself of the benefit of the
505patent license for this particular work, or (3) arrange, in a manner
506consistent with the requirements of this License, to extend the patent
507license to downstream recipients. "Knowingly relying" means you have
508actual knowledge that, but for the patent license, your conveying the
509covered work in a country, or your recipient's use of the covered work
510in a country, would infringe one or more identifiable patents in that
511country that you have reason to believe are valid.
512
513 If, pursuant to or in connection with a single transaction or
514arrangement, you convey, or propagate by procuring conveyance of, a
515covered work, and grant a patent license to some of the parties
516receiving the covered work authorizing them to use, propagate, modify
517or convey a specific copy of the covered work, then the patent license
518you grant is automatically extended to all recipients of the covered
519work and works based on it.
520
521 A patent license is "discriminatory" if it does not include within
522the scope of its coverage, prohibits the exercise of, or is
523conditioned on the non-exercise of one or more of the rights that are
524specifically granted under this License. You may not convey a covered
525work if you are a party to an arrangement with a third party that is
526in the business of distributing software, under which you make payment
527to the third party based on the extent of your activity of conveying
528the work, and under which the third party grants, to any of the
529parties who would receive the covered work from you, a discriminatory
530patent license (a) in connection with copies of the covered work
531conveyed by you (or copies made from those copies), or (b) primarily
532for and in connection with specific products or compilations that
533contain the covered work, unless you entered into that arrangement,
534or that patent license was granted, prior to 28 March 2007.
535
536 Nothing in this License shall be construed as excluding or limiting
537any implied license or other defenses to infringement that may
538otherwise be available to you under applicable patent law.
539
540 12. No Surrender of Others' Freedom.
541
542 If conditions are imposed on you (whether by court order, agreement or
199otherwise) that contradict the conditions of this License, they do not543otherwise) that contradict the conditions of this License, they do not
200excuse you from the conditions of this License. If you cannot544excuse you from the conditions of this License. If you cannot convey a
201distribute so as to satisfy simultaneously your obligations under this545covered work so as to satisfy simultaneously your obligations under this
202License and any other pertinent obligations, then as a consequence you546License and any other pertinent obligations, then as a consequence you may
203may not distribute the Program at all. For example, if a patent547not convey it at all. For example, if you agree to terms that obligate you
204license would not permit royalty-free redistribution of the Program by548to collect a royalty for further conveying from those to whom you convey
205all those who receive copies directly or indirectly through you, then549the Program, the only way you could satisfy both those terms and this
206the only way you could satisfy both it and this License would be to550License would be to refrain entirely from conveying the Program.
207refrain entirely from distribution of the Program.551
208552 13. Use with the GNU Affero General Public License.
209If any portion of this section is held invalid or unenforceable under553
210any particular circumstance, the balance of the section is intended to554 Notwithstanding any other provision of this License, you have
211apply and the section as a whole is intended to apply in other555permission to link or combine any covered work with a work licensed
212circumstances.556under version 3 of the GNU Affero General Public License into a single
213557combined work, and to convey the resulting work. The terms of this
214It is not the purpose of this section to induce you to infringe any558License will continue to apply to the part which is the covered work,
215patents or other property right claims or to contest validity of any559but the special requirements of the GNU Affero General Public License,
216such claims; this section has the sole purpose of protecting the560section 13, concerning interaction through a network will apply to the
217integrity of the free software distribution system, which is561combination as such.
218implemented by public license practices. Many people have made562
219generous contributions to the wide range of software distributed563 14. Revised Versions of this License.
220through that system in reliance on consistent application of that564
221system; it is up to the author/donor to decide if he or she is willing565 The Free Software Foundation may publish revised and/or new versions of
222to distribute software through any other system and a licensee cannot566the GNU General Public License from time to time. Such new versions will
223impose that choice.
224
225This section is intended to make thoroughly clear what is believed to
226be a consequence of the rest of this License.
227
228 8. If the distribution and/or use of the Program is restricted in
229certain countries either by patents or by copyrighted interfaces, the
230original copyright holder who places the Program under this License
231may add an explicit geographical distribution limitation excluding
232those countries, so that distribution is permitted only in or among
233countries not thus excluded. In such case, this License incorporates
234the limitation as if written in the body of this License.
235
236 9. The Free Software Foundation may publish revised and/or new versions
237of the General Public License from time to time. Such new versions will
238be similar in spirit to the present version, but may differ in detail to567be similar in spirit to the present version, but may differ in detail to
239address new problems or concerns.568address new problems or concerns.
240569
241Each version is given a distinguishing version number. If the Program570 Each version is given a distinguishing version number. If the
242specifies a version number of this License which applies to it and "any571Program specifies that a certain numbered version of the GNU General
243later version", you have the option of following the terms and conditions572Public License "or any later version" applies to it, you have the
244either of that version or of any later version published by the Free573option of following the terms and conditions either of that numbered
245Software Foundation. If the Program does not specify a version number of574version or of any later version published by the Free Software
246this License, you may choose any version ever published by the Free Software575Foundation. If the Program does not specify a version number of the
247Foundation.576GNU General Public License, you may choose any version ever published
248577by the Free Software Foundation.
249 10. If you wish to incorporate parts of the Program into other free578
250programs whose distribution conditions are different, write to the author579 If the Program specifies that a proxy can decide which future
251to ask for permission. For software which is copyrighted by the Free580versions of the GNU General Public License can be used, that proxy's
252Software Foundation, write to the Free Software Foundation; we sometimes581public statement of acceptance of a version permanently authorizes you
253make exceptions for this. Our decision will be guided by the two goals582to choose that version for the Program.
254of preserving the free status of all derivatives of our free software and583
255of promoting the sharing and reuse of software generally.584 Later license versions may give you additional or different
256585permissions. However, no additional obligations are imposed on any
257 NO WARRANTY586author or copyright holder as a result of your choosing to follow a
258587later version.
259 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY588
260FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN589 15. Disclaimer of Warranty.
261OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES590
262PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED591 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
263OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF592APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
264MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS593HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
265TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE594OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
266PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,595THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
267REPAIR OR CORRECTION.596PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
268597IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
269 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING598ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
270WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR599
271REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,600 16. Limitation of Liability.
272INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING601
273OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED602 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
274TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY603WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
275YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER604THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
276PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE605GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
277POSSIBILITY OF SUCH DAMAGES.606USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
278607DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
279--------------------------------------------------------------------------608PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
280609EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
281 * In addition, as a special exception, the copyright holders give permission to link610SUCH DAMAGES.
282 * the code of this program with the following code libraries or files and distribute611
283 * linked combinations including any number of these and the main code.612 17. Interpretation of Sections 15 and 16.
284 * - Any blog skin, "evoSkin" or design elements licensed under any of the following613
285 * Creative Commons licenses:614 If the disclaimer of warranty and limitation of liability provided
286 * - Attribution-Share Alike ( http://creativecommons.org/licenses/by-sa/3.0/ )615above cannot be given local legal effect according to their terms,
287 * - Attribution ( http://creativecommons.org/licenses/by/3.0/ )616reviewing courts shall apply local law that most closely approximates
288 * - The PHP/SWF Charts library by maani.us (or with modified versions of this library617an absolute waiver of all civil liability in connection with the
289 * that use the same license as PHP/SWF Charts library by maani.us).618Program, unless a warranty or assumption of liability accompanies a
290 * You must obey the GNU General Public License in all respects for all of the code used619copy of the Program in return for a fee.
291 * other than the libraries/files listed above. If you modify this file, you may extend620
292 * this exception to your version of the file, but you are not obligated to do so. If621 END OF TERMS AND CONDITIONS
293 * you do not wish to do so, delete this exception statement from your version.622
294623 How to Apply These Terms to Your New Programs
295--------------------------------------------------------------------------624
296625 If you develop a new program, and you want it to be of the greatest
297 END OF TERMS AND CONDITIONS626possible use to the public, the best way to achieve this is to make it
298627free software which everyone can redistribute and change under these terms.
628
629 To do so, attach the following notices to the program. It is safest
630to attach them to the start of each source file to most effectively
631state the exclusion of warranty; and each file should have at least
632the "copyright" line and a pointer to where the full notice is found.
633
634 <one line to give the program's name and a brief idea of what it does.>
635 Copyright (C) <year> <name of author>
636
637 This program is free software: you can redistribute it and/or modify
638 it under the terms of the GNU General Public License as published by
639 the Free Software Foundation, either version 3 of the License, or
640 (at your option) any later version.
641
642 This program is distributed in the hope that it will be useful,
643 but WITHOUT ANY WARRANTY; without even the implied warranty of
644 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 GNU General Public License for more details.
646
647 You should have received a copy of the GNU General Public License
648 along with this program. If not, see <http://www.gnu.org/licenses/>.
649
650Also add information on how to contact you by electronic and paper mail.
651
652 If the program does terminal interaction, make it output a short
653notice like this when it starts in an interactive mode:
654
655 <program> Copyright (C) <year> <name of author>
656 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 This is free software, and you are welcome to redistribute it
658 under certain conditions; type `show c' for details.
659
660The hypothetical commands `show w' and `show c' should show the appropriate
661parts of the General Public License. Of course, your program's commands
662might be different; for a GUI interface, you would use an "about box".
663
664 You should also get your employer (if you work as a programmer) or school,
665if any, to sign a "copyright disclaimer" for the program, if necessary.
666For more information on this, and how to apply and follow the GNU GPL, see
667<http://www.gnu.org/licenses/>.
668
669 The GNU General Public License does not permit incorporating your program
670into proprietary programs. If your program is a subroutine library, you
671may consider it more useful to permit linking proprietary applications with
672the library. If this is what you want to do, use the GNU Lesser General
673Public License instead of this License. But first, please read
674<http://www.gnu.org/philosophy/why-not-lgpl.html>.
299675
=== modified file 'multiblogs.php'
--- multiblogs.php 2012-07-29 20:36:41 +0000
+++ multiblogs.php 2013-03-11 07:27:21 +0000
@@ -1,28 +1,35 @@
1<?php1<?php
2/**2/**
3 * Demo file displaying multiple blogs on the same page3 * Displays multiple blogs on the same page
4 *4 *
5 * Note: This is a very advanced use of Quam Plures! Most of the time, calling5 * Note: This is a very advanced situation! Most of the time, calling your blog
6 * your blog through index.php (or a stub file) with a template will be enough.6 * through index.php (or a stub file) with a template will be enough. You should
7 * You should try to customize a template before trying to use this file.7 * try to customize a template before trying to use this file.
8 *8 * @todo (1111) this needs to pick up default blog on index and use it's
9 * Quam Plures - {@link http://quamplures.net/}9 * template's style sheet
10 * Released under GNU GPL License - {@link http://quamplures.net/license.html}10 * @todo (1111) actually, this needs to containerized and moved into the
11 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}11 * qp_templates where it belongs
12 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}12 * @todo (1111) does $PageCache actually do anything worth having, or can that
13 *13 * whole thing go away?
14 * @author {@link http://wonderwinds.com/ Ed Bennett}
15 * @author {@link http://fplanque.net/ Francois PLANQUE}
16 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
17 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
14 * @package templates18 * @package templates
15 * @subpackage oddballs
16 */19 */
1720
18// select which blog you want to display here21// select which blog you want to display here
19$blog = 1;22$blog = 1;
23
20// force it to ignore the blog's designated template24// force it to ignore the blog's designated template
21$template = '';25$template = '';
26
22// restrict posts to those published, thus hiding drafts.27// restrict posts to those published, thus hiding drafts.
23$show_statuses = array();28$show_statuses = array();
29
24// set a limit before which posts will be ignored30// set a limit before which posts will be ignored
25$timestamp_min = '';31$timestamp_min = '';
32
26// set a limit after which posts will be ignored33// set a limit after which posts will be ignored
27$timestamp_max = 'now';34$timestamp_max = 'now';
2835
@@ -33,14 +40,12 @@
33$redir = 'no';40$redir = 'no';
3441
35/**42/**
36 * Load Quam Plures configuration43 * Load the configuration minimum
37 */44 */
38require_once dirname(__FILE__).'/qp_config/_config.php';45require_once dirname(__FILE__).'/qp_config/_config.php';
3946
40/**47/**
41 * Initialize Quam Plures48 * Main initialization, with the identified $blog
42 *
43 * Loads the blog identified by $blog with other params above
44 */49 */
45require_once $inc_path.'_blog_main.inc.php';50require_once $inc_path.'_blog_main.inc.php';
4651
@@ -50,7 +55,6 @@
50// --------------------- PAGE LEVEL CACHING SUPPORT ---------------------55// --------------------- PAGE LEVEL CACHING SUPPORT ---------------------
51// This is totally optional. General caching must be enabled56// This is totally optional. General caching must be enabled
52// in Global settings, otherwise this will do nothing.57// in Global settings, otherwise this will do nothing.
53load_class( '_core/model/_pagecache.class.php' );
54$PageCache = new PageCache( NULL );58$PageCache = new PageCache( NULL );
5559
56// Check for cached content & Start caching if needed:60// Check for cached content & Start caching if needed:
@@ -210,7 +214,6 @@
210214
211 // Run the query:215 // Run the query:
212 $BlogBList->query();216 $BlogBList->query();
213
214 while( $Item = & $BlogBList->get_item() )217 while( $Item = & $BlogBList->get_item() )
215 {218 {
216 ?>219 ?>
@@ -248,7 +251,6 @@
248251
249 // Run the query:252 // Run the query:
250 $LinkblogList->query();253 $LinkblogList->query();
251
252 while( $Item = & $LinkblogList->get_item() )254 while( $Item = & $LinkblogList->get_item() )
253 {255 {
254 ?>256 ?>
255257
=== removed file 'qp_config/license.txt'
--- qp_config/license.txt 2006-03-12 22:08:51 +0000
+++ qp_config/license.txt 1970-01-01 00:00:00 +0000
@@ -1,293 +0,0 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 675 Mass Ave, Cambridge, MA 02139, USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123Thus, it is not the intent of this section to claim rights or contest
124your rights to work written entirely by you; rather, the intent is to
125exercise the right to control the distribution of derivative or
126collective works based on the Program.
127
128In addition, mere aggregation of another work not based on the Program
129with the Program (or with a work based on the Program) on a volume of
130a storage or distribution medium does not bring the other work under
131the scope of this License.
132
133 3. You may copy and distribute the Program (or a work based on it,
134under Section 2) in object code or executable form under the terms of
135Sections 1 and 2 above provided that you also do one of the following:
136
137 a) Accompany it with the complete corresponding machine-readable
138 source code, which must be distributed under the terms of Sections
139 1 and 2 above on a medium customarily used for software interchange; or,
140
141 b) Accompany it with a written offer, valid for at least three
142 years, to give any third party, for a charge no more than your
143 cost of physically performing source distribution, a complete
144 machine-readable copy of the corresponding source code, to be
145 distributed under the terms of Sections 1 and 2 above on a medium
146 customarily used for software interchange; or,
147
148 c) Accompany it with the information you received as to the offer
149 to distribute corresponding source code. (This alternative is
150 allowed only for noncommercial distribution and only if you
151 received the program in object code or executable form with such
152 an offer, in accord with Subsection b above.)
153
154The source code for a work means the preferred form of the work for
155making modifications to it. For an executable work, complete source
156code means all the source code for all modules it contains, plus any
157associated interface definition files, plus the scripts used to
158control compilation and installation of the executable. However, as a
159special exception, the source code distributed need not include
160anything that is normally distributed (in either source or binary
161form) with the major components (compiler, kernel, and so on) of the
162operating system on which the executable runs, unless that component
163itself accompanies the executable.
164
165If distribution of executable or object code is made by offering
166access to copy from a designated place, then offering equivalent
167access to copy the source code from the same place counts as
168distribution of the source code, even though third parties are not
169compelled to copy the source along with the object code.
170
171 4. You may not copy, modify, sublicense, or distribute the Program
172except as expressly provided under this License. Any attempt
173otherwise to copy, modify, sublicense or distribute the Program is
174void, and will automatically terminate your rights under this License.
175However, parties who have received copies, or rights, from you under
176this License will not have their licenses terminated so long as such
177parties remain in full compliance.
178
179 5. You are not required to accept this License, since you have not
180signed it. However, nothing else grants you permission to modify or
181distribute the Program or its derivative works. These actions are
182prohibited by law if you do not accept this License. Therefore, by
183modifying or distributing the Program (or any work based on the
184Program), you indicate your acceptance of this License to do so, and
185all its terms and conditions for copying, distributing or modifying
186the Program or works based on it.
187
188 6. Each time you redistribute the Program (or any work based on the
189Program), the recipient automatically receives a license from the
190original licensor to copy, distribute or modify the Program subject to
191these terms and conditions. You may not impose any further
192restrictions on the recipients' exercise of the rights granted herein.
193You are not responsible for enforcing compliance by third parties to
194this License.
195
196 7. If, as a consequence of a court judgment or allegation of patent
197infringement or for any other reason (not limited to patent issues),
198conditions are imposed on you (whether by court order, agreement or
199otherwise) that contradict the conditions of this License, they do not
200excuse you from the conditions of this License. If you cannot
201distribute so as to satisfy simultaneously your obligations under this
202License and any other pertinent obligations, then as a consequence you
203may not distribute the Program at all. For example, if a patent
204license would not permit royalty-free redistribution of the Program by
205all those who receive copies directly or indirectly through you, then
206the only way you could satisfy both it and this License would be to
207refrain entirely from distribution of the Program.
208
209If any portion of this section is held invalid or unenforceable under
210any particular circumstance, the balance of the section is intended to
211apply and the section as a whole is intended to apply in other
212circumstances.
213
214It is not the purpose of this section to induce you to infringe any
215patents or other property right claims or to contest validity of any
216such claims; this section has the sole purpose of protecting the
217integrity of the free software distribution system, which is
218implemented by public license practices. Many people have made
219generous contributions to the wide range of software distributed
220through that system in reliance on consistent application of that
221system; it is up to the author/donor to decide if he or she is willing
222to distribute software through any other system and a licensee cannot
223impose that choice.
224
225This section is intended to make thoroughly clear what is believed to
226be a consequence of the rest of this License.
227
228 8. If the distribution and/or use of the Program is restricted in
229certain countries either by patents or by copyrighted interfaces, the
230original copyright holder who places the Program under this License
231may add an explicit geographical distribution limitation excluding
232those countries, so that distribution is permitted only in or among
233countries not thus excluded. In such case, this License incorporates
234the limitation as if written in the body of this License.
235
236 9. The Free Software Foundation may publish revised and/or new versions
237of the General Public License from time to time. Such new versions will
238be similar in spirit to the present version, but may differ in detail to
239address new problems or concerns.
240
241Each version is given a distinguishing version number. If the Program
242specifies a version number of this License which applies to it and "any
243later version", you have the option of following the terms and conditions
244either of that version or of any later version published by the Free
245Software Foundation. If the Program does not specify a version number of
246this License, you may choose any version ever published by the Free Software
247Foundation.
248
249 10. If you wish to incorporate parts of the Program into other free
250programs whose distribution conditions are different, write to the author
251to ask for permission. For software which is copyrighted by the Free
252Software Foundation, write to the Free Software Foundation; we sometimes
253make exceptions for this. Our decision will be guided by the two goals
254of preserving the free status of all derivatives of our free software and
255of promoting the sharing and reuse of software generally.
256
257 NO WARRANTY
258
259 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
260FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
261OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
262PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
263OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
264MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
265TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
266PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
267REPAIR OR CORRECTION.
268
269 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
270WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
271REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
272INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
273OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
274TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
275YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
276PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
277POSSIBILITY OF SUCH DAMAGES.
278
279--------------------------------------------------------------------------
280
281 * In addition, as a special exception, the copyright holders give permission to link
282 * the code of this program with the PHP/SWF Charts library by maani.us (or with
283 * modified versions of this library that use the same license as PHP/SWF Charts library
284 * by maani.us), and distribute linked combinations including the two. You must obey the
285 * GNU General Public License in all respects for all of the code used other than the
286 * PHP/SWF Charts library by maani.us. If you modify this file, you may extend this
287 * exception to your version of the file, but you are not obligated to do so. If you do
288 * not wish to do so, delete this exception statement from your version.
289
290--------------------------------------------------------------------------
291
292 END OF TERMS AND CONDITIONS
293
2940
=== modified file 'qp_inc/_application.php'
--- qp_inc/_application.php 2013-03-04 20:46:54 +0000
+++ qp_inc/_application.php 2013-03-11 07:27:21 +0000
@@ -22,7 +22,7 @@
22$files_version = '1.10';22$files_version = '1.10';
2323
24// The database version, incrememented by 1 with each change in upgrade_dbase_tables()24// The database version, incrememented by 1 with each change in upgrade_dbase_tables()
25$app_db_version = 17;25$app_db_version = 20;
2626
27$app_version = $files_version.'.'.$app_db_version;27$app_version = $files_version.'.'.$app_db_version;
2828
2929
=== modified file 'qp_inc/_core/__core.init.php'
--- qp_inc/_core/__core.init.php 2013-02-28 16:40:18 +0000
+++ qp_inc/_core/__core.init.php 2013-03-11 07:27:21 +0000
@@ -72,7 +72,8 @@
72 'aspm_settings' => 'antispam/settings.ctrl.php',72 'aspm_settings' => 'antispam/settings.ctrl.php',
73 'chapters' => 'chapters/chapters.ctrl.php',73 'chapters' => 'chapters/chapters.ctrl.php',
74 'collections' => 'collections/collections.ctrl.php',74 'collections' => 'collections/collections.ctrl.php',
75 'coll_settings' => 'collections/coll_settings.ctrl.php',75 'coll_settings' => 'collections/coll_settings.ctrl.php', // old
76 'blog_settings' => 'collections/coll_settings.ctrl.php', // new after monster
76 'comments' => 'comments/_comments.ctrl.php',77 'comments' => 'comments/_comments.ctrl.php',
77 'crontab' => 'cron/cronjobs.ctrl.php',78 'crontab' => 'cron/cronjobs.ctrl.php',
78 'dashboard' => 'dashboard/dashboard.ctrl.php',79 'dashboard' => 'dashboard/dashboard.ctrl.php',
7980
=== modified file 'qp_inc/_core/_param.funcs.php'
--- qp_inc/_core/_param.funcs.php 2013-02-28 16:40:18 +0000
+++ qp_inc/_core/_param.funcs.php 2013-03-11 07:27:21 +0000
@@ -50,33 +50,39 @@
50 * dirty spambots or borked index bots. Saves a lot of processor time by killing invalid requests)50 * dirty spambots or borked index bots. Saves a lot of processor time by killing invalid requests)
51 * @return mixed Final value of Variable, or false if we don't force setting and did not set51 * @return mixed Final value of Variable, or false if we don't force setting and did not set
52 */52 */
53function param( $var, $type = '', $default = '', $memorize = false,53function param(
54 $override = false, $use_default = true, $strict_typing = 'allow_empty' )54 $var,
55 $type = '',
56 $default = '',
57 $memorize = false,
58 $override = false,
59 $use_default = true,
60 $strict_typing = 'allow_empty' )
55{61{
56 global $debug, $app_charset, $io_charset;62 global $debug;
57 // NOTE: we use $GLOBALS[$var] instead of $$var, because otherwise it would conflict with param names which are used as function params ("var", "type", "default", ..)!63 global $app_charset;
64 global $io_charset;
5865
59 /*66 // STEP 1 : Set the variable
60 * STEP 1 : Set the variable67 // Check if already set. NOTE: we use $GLOBALS[$var] instead of $$var, because
61 *68 // otherwise it would conflict with param names which are used as function
62 * Check if already set69 // params ("var", "type", "default", ..)!
63 * WARNING: when PHP register globals is ON, COOKIES get priority over GET and POST with this!!!70 // WARNING: when PHP register globals is ON, COOKIES get priority over GET and
64 * dh> I never understood that comment.. does it refer to "variables_order" php.ini setting?71 // POST with this!!! dh> I never understood that comment.. does it refer to
65 * fp> I guess72 // "variables_order" php.ini setting? fp> I guess
66 */
67 if( ! isset( $GLOBALS[$var] ) || $override )73 if( ! isset( $GLOBALS[$var] ) || $override )
68 {74 {
69 if( isset( $_POST[$var] ) )75 if( isset( $_POST[$var] ) )
70 {76 {
71 $GLOBALS[$var] = remove_magic_quotes( $_POST[$var] );77 $GLOBALS[$var] = remove_magic_quotes( $_POST[$var] );
72 }78 }
73 elseif( isset($_GET[$var]) )79 elseif( isset( $_GET[$var] ) )
74 {80 {
75 $GLOBALS[$var] = remove_magic_quotes($_GET[$var]);81 $GLOBALS[$var] = remove_magic_quotes( $_GET[$var] );
76 }82 }
77 elseif( isset($_COOKIE[$var]))83 elseif( isset( $_COOKIE[$var] ) )
78 {84 {
79 $GLOBALS[$var] = remove_magic_quotes($_COOKIE[$var]);85 $GLOBALS[$var] = remove_magic_quotes( $_COOKIE[$var] );
80 }86 }
81 elseif( $default === true )87 elseif( $default === true )
82 {88 {
@@ -84,7 +90,7 @@
84 }90 }
85 elseif( $use_default )91 elseif( $use_default )
86 {92 {
87 // We haven't set any value yet and we really want one: use default:93 // We haven't set any value yet and we really want one: use default
88 if( $type == 'array' && $default === '' )94 if( $type == 'array' && $default === '' )
89 {95 {
90 // Change default '' into array() (otherwise there would be a notice with settype() below)96 // Change default '' into array() (otherwise there would be a notice with settype() below)
@@ -94,15 +100,14 @@
94 }100 }
95 else101 else
96 {102 {
97 // param not found! don't set the variable.103 // param not found! don't set the variable ... won't be memorized nor type-forced!
98 // Won't be memorized nor type-forced!
99 return false;104 return false;
100 }105 }
101 }106 }
102 else107 else
103 {108 {
104 // Variable was already set but we need to remove the auto quotes109 // Variable was already set but we need to remove the auto quotes
105 $GLOBALS[$var] = remove_magic_quotes($GLOBALS[$var]);110 $GLOBALS[$var] = remove_magic_quotes( $GLOBALS[$var] );
106 }111 }
107112
108 if( isset( $io_charset ) && ! empty( $app_charset ) )113 if( isset( $io_charset ) && ! empty( $app_charset ) )
@@ -110,130 +115,123 @@
110 $GLOBALS[$var] = convert_charset( $GLOBALS[$var], $app_charset, $io_charset );115 $GLOBALS[$var] = convert_charset( $GLOBALS[$var], $app_charset, $io_charset );
111 }116 }
112117
113 // STEP 2: make sure the data fits the expected type118 // STEP 2: make sure the data fits the expected type type,
114 // type will be forced even if it was set before and not overriden119 // will be forced even if it was set before and not overriden
115 if( ! empty( $type ) && $GLOBALS[$var] !== NULL )120 if( ! empty( $type ) && $GLOBALS[$var] !== NULL )
116 {121 {
117 // Force the type122 // Force the type
118 switch( $type )123 switch( $type )
119 {124 {
120 case 'html':125 case 'html':
121 // do nothing126 // do nothing
122 break;127 break;
123128
124 case 'string':129 case 'string':
125 // strip out any html130 // strip out any html
126 if( ! is_scalar($GLOBALS[$var]) )131 if( ! is_scalar( $GLOBALS[$var] ) )
127 {132 {
128 // This happens if someone uses "foo[]=x" where "foo" is expected as string133 // This happens if someone uses "foo[]=x" where "foo" is expected as string
129 // TODO: dh> debug_die() instead?134 $GLOBALS[$var] = '';
130 $GLOBALS[$var] = '';135 }
131 }136 else
132 else137 {
133 {138 $GLOBALS[$var] = trim( strip_tags( $GLOBALS[$var] ) );
134 $GLOBALS[$var] = trim( strip_tags($GLOBALS[$var]) );139 // Make sure the string is a single line. While this example works without
135 // Make sure the string is a single line140 // newlines, there are probably places where it's more important.
136 // TODO: dh> this breaks e.g. multi-line widget params (e.g. "Custom TinyMCE init")141 // fp> Someone was hiding text. Can't remember exactly where.
137 // While this example works without newlines, there are probably places142 // Make a "multiline-string" where appropriate.
138 // where it's more important.143 $GLOBALS[$var] = preg_replace( '¤\r|\n¤', '', $GLOBALS[$var] );
139 // fp> Someone was hiding text. Can't remember exactly where.144 }
140 // Make a "multiline-string" where appropriate.145 break;
141 $GLOBALS[$var] = preg_replace( '¤\r|\n¤', '', $GLOBALS[$var] );
142 }
143 break;
144146
145 default:147 default:
146 if( substr( $type, 0, 1 ) == '/' )148 if( substr( $type, 0, 1 ) == '/' )
147 {149 {
148 // We want to match against a REGEXP150 // We want to match against a REGEXP
149 if( preg_match( $type, $GLOBALS[$var] ) )151 if( preg_match( $type, $GLOBALS[$var] ) )
150 {152 {
151 // Okay, match153 // Okay, match
152 }154 if( isset( $Debuglog ) ) $Debuglog->add( 'param(-): <strong>'.$var.'</strong> matched against '.$type, 'params' );
153 elseif( $strict_typing == 'allow_empty' && empty($GLOBALS[$var]) )155 }
154 {156 elseif( $strict_typing == 'allow_empty' && empty( $GLOBALS[$var] ) )
155 // No match but we accept empty value157 {
156 }158 // No match but we accept empty value
157 elseif( $strict_typing )159 if( isset( $Debuglog ) ) $Debuglog->add( 'param(-): <strong>'.$var.'</strong> is empty: ok', 'params' );
158 {160 }
159 // We cannot accept this MISMATCH161 elseif( $strict_typing )
162 {
163 // We cannot accept this MISMATCH
164 bad_request_die( sprintf( T_('Illegal value received for parameter &laquo;%s&raquo;!'), $var ) );
165 }
166 else
167 {
168 // Fall back to default
169 $GLOBALS[$var] = $default;
170 }
171
172 // From now on, consider this as a string: (we need this when memorizing)
173 $type = 'string';
174 }
175 elseif( $GLOBALS[$var] === '' )
176 {
177 // Special handling of empty values
178 if( $strict_typing === false && $use_default )
179 {
180 // We want to consider empty values as invalid and fall back to the default value
181 $GLOBALS[$var] = $default;
182 }
183 else
184 {
185 // We memorize the empty value as NULL. fplanque> note: there might be side effects
186 // to this, but we need this to distinguish between 0 and 'no input' Note: we do this
187 // after regexps because we may or may not want to allow empty strings in regexps
188 $GLOBALS[$var] = NULL;
189 }
190 }
191 elseif( $GLOBALS[$var] === array() )
192 {
193 if( $strict_typing === false && $use_default )
194 {
195 // We want to consider empty values as invalid and fall back to the default value
196 $GLOBALS[$var] = $default;
197 }
198 }
199 else
200 {
201 if( $strict_typing )
202 {
203 // We want to make sure the value is valid
204 $regexp = '';
205 switch( $type )
206 {
207 case 'boolean':
208 $regexp = '/^(0|1|false|true)$/i';
209 break;
210
211 case 'integer':
212 $regexp = '/^(\+|-)?[0-9]+$/';
213 break;
214
215 case 'float':
216 case 'double':
217 $regexp = '/^(\+|-)?[0-9]+(.[0-9]+)?$/';
218 break;
219 // Note: other types are not tested here
220 }
221 if( $strict_typing == 'allow_empty' && empty( $GLOBALS[$var] ) )
222 {
223 // We have an empty value and we accept it
224 }
225 elseif( ! empty( $regexp ) && ( ! is_scalar( $GLOBALS[$var] ) || ! preg_match( $regexp, $GLOBALS[$var] ) ) )
226 {
227 // Value does not match!
160 bad_request_die( sprintf( T_('Illegal value received for parameter &laquo;%s&raquo;!'), $var ) );228 bad_request_die( sprintf( T_('Illegal value received for parameter &laquo;%s&raquo;!'), $var ) );
161 }229 }
162 else230 }
163 {231
164 // Fall back to default232 // Change the variable type
165 $GLOBALS[$var] = $default;233 settype( $GLOBALS[$var], $type );
166 }234 }
167
168 // From now on, consider this as a string: (we need this when memorizing)
169 $type = 'string';
170 }
171 elseif( $GLOBALS[$var] === '' )
172 {
173 // Special handling of empty values.
174 if( $strict_typing === false && $use_default )
175 {
176 // ADDED BY FP 2006-07-06
177 // We want to consider empty values as invalid and fall back to the default value:
178 $GLOBALS[$var] = $default;
179 }
180 else
181 {
182 // We memorize the empty value as NULL:
183 // fplanque> note: there might be side effects to this, but we need
184 // this to distinguish between 0 and 'no input'
185 // Note: we do this after regexps because we may or may not want to allow empty strings in regexps
186 $GLOBALS[$var] = NULL;
187 }
188 }
189 elseif( $GLOBALS[$var] === array() )
190 {
191 if( $strict_typing === false && $use_default )
192 {
193 // ADDED BY FP 2006-09-07
194 // We want to consider empty values as invalid and fall back to the default value
195 $GLOBALS[$var] = $default;
196 }
197 }
198 // TODO: dh> if a var (e.g. from POST) comes in as '' but has type "array" it does not get "converted" to array type (nor gets the default used!)
199 else
200 {
201 if( $strict_typing )
202 {
203 // We want to make sure the value is valid
204 $regexp = '';
205 switch( $type )
206 {
207 case 'boolean':
208 $regexp = '/^(0|1|false|true)$/i';
209 break;
210
211 case 'integer':
212 $regexp = '/^(\+|-)?[0-9]+$/';
213 break;
214
215 case 'float':
216 case 'double':
217 $regexp = '/^(\+|-)?[0-9]+(.[0-9]+)?$/';
218 break;
219
220 // Note: other types are not tested here
221 }
222 if( $strict_typing == 'allow_empty' && empty($GLOBALS[$var]) )
223 {
224 // We have an empty value and we accept it
225 // ok..
226 }
227 elseif( !empty( $regexp ) && ( !is_scalar($GLOBALS[$var]) || !preg_match( $regexp, $GLOBALS[$var] ) ) )
228 {
229 // Value does not match!
230 bad_request_die( sprintf( T_('Illegal value received for parameter &laquo;%s&raquo;!'), $var ) );
231 }
232 }
233
234 // Change the variable type
235 settype( $GLOBALS[$var], $type );
236 }
237 }235 }
238 }236 }
239237
@@ -243,16 +241,16 @@
243 // Memorize this parameter241 // Memorize this parameter
244 memorize_param( $var, $type, $default );242 memorize_param( $var, $type, $default );
245 }243 }
244
246 return $GLOBALS[$var];245 return $GLOBALS[$var];
247}246}
248247
249248
250/**249/**
251 * Get the param from an array param's first index instead of the value.250 * Get the param from an array param's first index instead of the value
252 *251 *
253 * E.g., for "param[value]" as a submit button you can get the value with252 * E.g., for "param[value]" as a submit button you can get the value with
254 * <code>Request::param_arrayindex( 'param' )</code>.253 * <code>Request::param_arrayindex( 'param' )</code>.
255 *
256 * @see param_action()254 * @see param_action()
257 * @param string Param name255 * @param string Param name
258 * @param mixed Default to use256 * @param mixed Default to use
@@ -262,9 +260,9 @@
262{260{
263 $array = array_keys( param( $param_name, 'array', array() ) );261 $array = array_keys( param( $param_name, 'array', array() ) );
264 $value = array_pop( $array );262 $value = array_pop( $array );
265 if( is_string($value) )263 if( is_string( $value ) )
266 {264 {
267 $value = substr( strip_tags($value), 0, 50 ); // sanitize it265 $value = substr( strip_tags( $value ), 0, 50 ); // sanitize it
268 }266 }
269 elseif( ! empty( $value ) )267 elseif( ! empty( $value ) )
270 {268 {
@@ -286,8 +284,9 @@
286 * If we got no "action" param, we'll check for an "actionArray" param284 * If we got no "action" param, we'll check for an "actionArray" param
287 * ( <input type="submit" name="actionArray[real_action]" ...> ).285 * ( <input type="submit" name="actionArray[real_action]" ...> ).
288 * And the real $action will be found in the first key...286 * And the real $action will be found in the first key...
289 * When there are multiple submit buttons, this is smarter than checking the value which is a translated string.287 * When there are multiple submit buttons, this is smarter than checking the value
290 * When there is an image button, this allows to work around IE not sending the value (it only sends X & Y coords of the click).288 * which is a translated string. When there is an image button, this allows to work
289 * around IE not sending the value (it only sends X & Y coords of the click).
291 * @param mixed Default to use.290 * @param mixed Default to use.
292 * @return string291 * @return string
293 */292 */
@@ -295,7 +294,7 @@
295{294{
296 $action = param( 'action', 'string', NULL, $memorize );295 $action = param( 'action', 'string', NULL, $memorize );
297296
298 if( is_null($action) )297 if( is_null( $action ) )
299 {298 {
300 // Check $actionArray299 // Check $actionArray
301 $action = param_arrayindex( 'actionArray', $default );300 $action = param_arrayindex( 'actionArray', $default );
@@ -310,13 +309,20 @@
310/**309/**
311 * Get a param from cookie310 * Get a param from cookie
312 *311 *
313 * This is just a wrapper around {@link param()} which unsets and restores GET and POST.312 * This is just a wrapper around {@link param()} which unsets and restores GET and
314 * IMHO this is less hackish, at least performance wise then using a $sources param for param()313 * POST. IMHO this is less hackish, at least performance wise then using a $sources
314 * param for param()
315 * @uses param()315 * @uses param()
316 * @see param()316 * @see param()
317 */317 */
318function param_cookie($var, $type = '', $default = '', $memorize = false,318function param_cookie(
319 $override = false, $use_default = true, $strict_typing = 'allow_empty')319 $var,
320 $type = '',
321 $default = '',
322 $memorize = false,
323 $override = false,
324 $use_default = true,
325 $strict_typing = 'allow_empty' )
320{326{
321 $save_GET = $_GET;327 $save_GET = $_GET;
322 $save_POST = $_POST;328 $save_POST = $_POST;
@@ -412,7 +418,6 @@
412418
413/**419/**
414 * Gets a param and makes sure it's a decimal number (no float, e.g. 3.14) in a given range.420 * Gets a param and makes sure it's a decimal number (no float, e.g. 3.14) in a given range.
415 *
416 * @param string param name421 * @param string param name
417 * @param integer min value422 * @param integer min value
418 * @param integer max value423 * @param integer max value
@@ -428,7 +433,6 @@
428433
429/**434/**
430 * Checks if the param is a decimal number (no float, e.g. 3.14) in a given range435 * Checks if the param is a decimal number (no float, e.g. 3.14) in a given range
431 *
432 * @param string param name436 * @param string param name
433 * @param integer min value437 * @param integer min value
434 * @param integer max value438 * @param integer max value
@@ -496,7 +500,6 @@
496500
497/**501/**
498 * Check if the value is a file name502 * Check if the value is a file name
499 *
500 * @param string param name503 * @param string param name
501 * @param string error message504 * @param string error message
502 * @return boolean true if OK505 * @return boolean true if OK
@@ -514,7 +517,6 @@
514517
515/**518/**
516 * Check if the value of a param is a regular expression (syntax).519 * Check if the value of a param is a regular expression (syntax).
517 *
518 * @param string param name520 * @param string param name
519 * @param string error message521 * @param string error message
520 * @param string|NULL error message for form field ($err_msg gets used if === NULL).522 * @param string|NULL error message for form field ($err_msg gets used if === NULL).
@@ -533,7 +535,6 @@
533535
534/**536/**
535 * Sets a date parameter by converting locale date (if valid) to ISO date537 * Sets a date parameter by converting locale date (if valid) to ISO date
536 *
537 * If the date is not valid, it is set to the param unchanged (unconverted).538 * If the date is not valid, it is set to the param unchanged (unconverted).
538 * @param string param name539 * @param string param name
539 * @param string error message540 * @param string error message
@@ -541,7 +542,12 @@
541 * @param string Default (in the format of $date_format)542 * @param string Default (in the format of $date_format)
542 * @param string date format (php format), defaults to {@link locale_datefmt()}543 * @param string date format (php format), defaults to {@link locale_datefmt()}
543 */544 */
544function param_date( $var, $err_msg, $required, $default = '', $date_format = NULL )545function param_date(
546 $var,
547 $err_msg,
548 $required,
549 $default = '',
550 $date_format = NULL )
545{551{
546 param( $var, 'string', $default );552 param( $var, 'string', $default );
547553
@@ -559,7 +565,8 @@
559/**565/**
560 * Check if param is an ISO date566 * Check if param is an ISO date
561 *567 *
562 * NOTE: for tokens like e.g. "D" (abbr. weekday), T_() gets used and it uses the current locale!568 * NOTE: for tokens like e.g. "D" (abbr. weekday), T_() gets used and it uses
569 * the current locale!
563 * @param string param name570 * @param string param name
564 * @param string error message571 * @param string error message
565 * @param boolean Is a non-empty date required?572 * @param boolean Is a non-empty date required?
@@ -590,33 +597,56 @@
590 if( $m[1] == "\\\" ) return $m[2]; // escaped597 if( $m[1] == "\\\" ) return $m[2]; // escaped
591 switch( $m[2] )598 switch( $m[2] )
592 {599 {
593 case "d": return "([0-3]\\d)"; // day, 01-31600 case "d":
594 case "j": return "([1-3]?\\d)"; // day, 1-31601 return "([0-3]\\d)"; // day, 01-31
595 case "l": return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday"])))).")";602
596 case "D": return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_abbrev"])))).")";603 case "j":
604 return "([1-3]?\\d)"; // day, 1-31
605
606 case "l":
607 return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday"])))).")";
608
609 case "D":
610 return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_abbrev"])))).")";
611
597 case "e": // QP extension!612 case "e": // QP extension!
598 return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_letter"])))).")";613 return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_letter"])))).")";
599 case "S": return "(st|nd|rd|th)"; // english suffix for day614
600615 case "S":
601 case "m": return "([0-1]\\d)"; // month, 01-12616 return "(st|nd|rd|th)"; // english suffix for day
602 case "n": return "(1?\\d)"; // month, 1-12617
603 case "F": return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["month"])))).")"; // A full textual representation of a month, such as January or March618 case "m":
604 case "M": return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["month_abbrev"])))).")";619 return "([0-1]\\d)"; // month, 01-12
605620
606 case "y": return "(\\d\\d)"; // year, 00-99621 case "n":
607 case "Y": return "(\\d{4})"; // year, XXXX622 return "(1?\\d)"; // month, 1-12
623
624 case "F":
625 return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["month"])))).")"; // A full textual representation of a month, such as January or March
626
627 case "M":
628 return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["month_abbrev"])))).")";
629
630 case "y":
631 return "(\\d\\d)"; // year, 00-99
632
633 case "Y":
634 return "(\\d{4})"; // year, XXXX
635
608 default:636 default:
609 return $m[0];637 return $m[0];
610 }' ), $date_format ).'$~i'; // case-insensitive?638 }' ), $date_format ).'$~i'; // case-insensitive?
611 // Allow additional spaces, e.g. "03 May 2007" when format is "d F Y":639
640 // Allow additional spaces, e.g. "03 May 2007" when format is "d F Y"
612 $date_regexp = preg_replace( '~ +~', '\s+', $date_regexp );641 $date_regexp = preg_replace( '~ +~', '\s+', $date_regexp );
613642
614 // Check that the numbers match the date pattern643 // Check that the numbers match the date pattern
615 if( preg_match( $date_regexp, $GLOBALS[$var], $numbers ) )644 if( preg_match( $date_regexp, $GLOBALS[$var], $numbers ) )
616 {645 {
617 // Date does match pattern646 // Date does match pattern ... Get all date pattern parts. We should get 3 parts!
618 // Get all date pattern parts. We should get 3 parts!647
619 preg_match_all( '/(?<!\\\\)[A-Za-z]/', $date_format, $parts ); // "(?<!\\\\)" means that the letter is not escaped with "\"648 // "(?<!\\\\)" means that the letter is not escaped with "\"
649 preg_match_all( '/(?<!\\\\)[A-Za-z]/', $date_format, $parts );
620 $day = null;650 $day = null;
621 $month = null;651 $month = null;
622 $year = null;652 $year = null;
@@ -627,46 +657,52 @@
627 {657 {
628 case 'd':658 case 'd':
629 case 'j':659 case 'j':
630 $day = $numbers[$position+1];660 $day = $numbers[$position+1];
631 break;661 break;
632662
633 case 'm':663 case 'm':
634 case 'n':664 case 'n':
635 $month = $numbers[$position+1];665 $month = $numbers[$position+1];
636 break;666 break;
637 case 'F': // full month name667
638 $month = array_search( strtolower($numbers[$position+1]), array_map('strtolower', array_map('trim', array_map('T_', $GLOBALS['month']))) );668 // full month name
639 break;669 case 'F':
670 $month = array_search(
671 strtolower( $numbers[$position+1] ), array_map( 'strtolower', array_map(
672 'trim', array_map( 'T_', $GLOBALS['month'] ) ) ) );
673 break;
674
640 case 'M':675 case 'M':
641 $month = array_search( strtolower($numbers[$position+1]), array_map('strtolower', array_map('trim', array_map('T_', $GLOBALS['month_abbrev']))) );676 $month = array_search(
642 break;677 strtolower( $numbers[$position+1] ), array_map( 'strtolower', array_map(
678 'trim', array_map( 'T_', $GLOBALS['month_abbrev'] ) ) ) );
679 break;
643680
644 case 'y':681 case 'y':
645 case 'Y':682 case 'Y':
646 $year = $numbers[$position+1];683 $year = $numbers[$position+1];
647 if( $year < 50 )684 if( $year < 50 )
648 {685 {
649 $year = 2000 + $year;686 $year = 2000 + $year;
650 }687 }
651 elseif( $year < 100 )688 elseif( $year < 100 )
652 {689 {
653 $year = 1900 + $year;690 $year = 1900 + $year;
654 }691 }
655 break;692 break;
656 }693 }
657 }694 }
658695
659 if( checkdate( $month, $day, $year ) )696 if( checkdate( $month, $day, $year ) )
660 {697 {
661 // all clean! :) We convert the value to ISO:698 // all clean! :) We convert the value to ISO
662 $iso_date = substr( '0'.$year, -4 ).'-'.substr( '0'.$month, -2 ).'-'.substr( '0'.$day, -2 );699 $iso_date = substr( '0'.$year, -4 ).'-'.substr( '0'.$month, -2 ).'-'.substr( '0'.$day, -2 );
663700
664 return $iso_date;701 return $iso_date;
665 }702 }
666 }703 }
667704
668 // Date did not pass all tests:705 // Date did not pass all tests
669
670 param_error( $var, $err_msg );706 param_error( $var, $err_msg );
671707
672 return false;708 return false;
@@ -676,13 +712,11 @@
676/**712/**
677 * Sets a date parameter with values from the request or to provided default,713 * Sets a date parameter with values from the request or to provided default,
678 * And check we have a compact date (numbers only) ( used for URL filtering )714 * And check we have a compact date (numbers only) ( used for URL filtering )
679 *
680 * @param string Variable to set715 * @param string Variable to set
681 * @param mixed Default value or TRUE if user input required716 * @param mixed Default value or TRUE if user input required
682 * @param boolean memorize ( see {@link param()} )717 * @param boolean memorize ( see {@link param()} )
683 * @param string error message718 * @param string error message
684 * @param boolean 'required': Is non-empty date required? Default: true.719 * @param boolean 'required': Is non-empty date required? Default: true.
685 *
686 * @return string the compact date value ( yyyymmdd )720 * @return string the compact date value ( yyyymmdd )
687 */721 */
688function param_compact_date( $var, $default = '', $memorize = false, $err_msg, $required = false )722function param_compact_date( $var, $default = '', $memorize = false, $err_msg, $required = false )
@@ -712,10 +746,11 @@
712746
713747
714/**748/**
749 * Set a time parameter with the value from the request of the var argument
750 *
715 * Sets a time parameter with the value from the request of the var argument751 * Sets a time parameter with the value from the request of the var argument
716 * or of the concat of the var argument_h: var argument_mn: var argument_s ,752 * or of the concat of the var argument_h: var argument_mn: var argument_s ,
717 * except if param is already set!753 * except if param is already set!
718 *
719 * @param string Variable to set754 * @param string Variable to set
720 * @param mixed Default value or TRUE if user input required755 * @param mixed Default value or TRUE if user input required
721 * @param boolean Do we need to memorize this to regenerate the URL for this page?756 * @param boolean Do we need to memorize this to regenerate the URL for this page?
@@ -741,7 +776,7 @@
741 }776 }
742 }777 }
743 elseif( ( $time_h = param( $var.'_h', 'integer', -1 ) ) != -1778 elseif( ( $time_h = param( $var.'_h', 'integer', -1 ) ) != -1
744 && ( $time_mn = param( $var.'_mn', 'integer', -1 ) ) != -1 )779 && ( $time_mn = param( $var.'_mn', 'integer', -1 ) ) != -1 )
745 {780 {
746 // Got a time from selects781 // Got a time from selects
747 $time_s = param( $var.'_s', 'integer', 0 );782 $time_s = param( $var.'_s', 'integer', 0 );
@@ -770,10 +805,9 @@
770/**805/**
771 * Extend a LIST parameter with an ARRAY param.806 * Extend a LIST parameter with an ARRAY param.
772 *807 *
773 * Will be used for author/authorsel[], etc.808 * Will be used for author/authorsel[], etc. Note: cannot be used for catsel[]
774 * Note: cannot be used for catsel[], because catsel is NON-recursive.809 * because catsel is NON-recursive.
775 * @see param_compile_cat_array()810 * @see param_compile_cat_array()
776 *
777 * @param string Variable to extend811 * @param string Variable to extend
778 * @param string Name of array Variable to use as an extension812 * @param string Name of array Variable to use as an extension
779 * @param boolean Save non numeric prefix? ( 1 char -- can be used as a modifier, e-g: - + * )813 * @param boolean Save non numeric prefix? ( 1 char -- can be used as a modifier, e-g: - + * )
@@ -813,8 +847,8 @@
813 }847 }
814 }848 }
815849
816 // Merge values:850 // Merge values
817 if( empty($original_val) )851 if( empty( $original_val ) )
818 {852 {
819 $original_values_array = array();853 $original_values_array = array();
820 }854 }
@@ -832,8 +866,9 @@
832866
833867
834/**868/**
835 * Compiles the cat array from $cat (recursive + optional modifiers) and $catsel[] (non recursive)869 * Compiles the cat array from $cat (recursive + optional modifiers) and
836 * and keeps those values available for future reference (category widget)870 * $catsel[] (non recursive) and keeps those values available for future
871 * reference (category widget)
837 */872 */
838function param_compile_cat_array( $restrict_to_blog = 0, $cat_default = NULL, $catsel_default = array() )873function param_compile_cat_array( $restrict_to_blog = 0, $cat_default = NULL, $catsel_default = array() )
839{874{
@@ -1511,31 +1546,6 @@
1511}1546}
15121547
15131548
1514
1515
1516
1517/**
1518 * Sets an HTML parameter and checks for sanitized code.
1519 *
1520 * WARNING: this does *NOT* (necessarilly) make the HTML code safe.
1521 * It only checks on it and produces error messages.
1522 * It is NOT (necessarily) safe to use the output.
1523 *
1524 * @todo dh> Not implemented?!
1525 *
1526 * @param string Variable to set
1527 * @param mixed Default value or TRUE if user input required
1528 * @param boolean memorize ( see {@link param()} )
1529 * @param string error message
1530 *
1531 * @return string
1532 */
1533function param_html( $var, $default = '', $memorize = false, $err_msg )
1534{
1535
1536}
1537
1538
1539/**1549/**
1540 * Checks for sanitized code.1550 * Checks for sanitized code.
1541 *1551 *
@@ -1551,7 +1561,7 @@
1551{1561{
1552 global $Messages;1562 global $Messages;
15531563
1554 $altered_html = check_html_sanity( $GLOBALS[$var], 'posting', $autobr );1564 $altered_html = check_html_sanity( array( 'param_check_html' => '1' ), $GLOBALS[$var], 'posting', $autobr );
15551565
1556 if( $altered_html === false )1566 if( $altered_html === false )
1557 {1567 {
@@ -1581,7 +1591,7 @@
1581 */1591 */
1582function format_to_post( $content, $autobr = 0, $is_comment = 0, $encoding = NULL )1592function format_to_post( $content, $autobr = 0, $is_comment = 0, $encoding = NULL )
1583{1593{
1584 $ret = check_html_sanity( $content, ( $is_comment ? 'commenting' : 'posting' ), $autobr, $encoding );1594 $ret = check_html_sanity( array( 'format_to_post' => '1' ), $content, ( $is_comment ? 'commenting' : 'posting' ), $autobr, $encoding );
1585 if( $ret === false )1595 if( $ret === false )
1586 {1596 {
1587 // ERROR1597 // ERROR
@@ -1618,14 +1628,22 @@
1618 * visible HTML? Forced to true when "commenting".1628 * visible HTML? Forced to true when "commenting".
1619 * @return boolean|string1629 * @return boolean|string
1620 */1630 */
1621function check_html_sanity( $content, $context = 'posting', $autobr = false,1631function check_html_sanity(
1622 $encoding = NULL, $escape_comments = false )1632 $source = array(),
1633 $content,
1634 $context = 'posting',
1635 $autobr = false,
1636 $encoding = NULL,
1637 $escape_comments = false )
1623{1638{
1624 global $use_balanceTags, $admin_url;1639 global $admin_url;
1625 global $io_charset, $use_xhtmlvalidation_for_comments, $comment_allowed_tags, $comments_allow_css_tweaks;1640 global $balance_tags;
1641 global $comments_allow_css_tweaks;
1642 global $comment_allowed_tags;
1643 global $current_User;
1644 global $io_charset;
1626 global $Messages;1645 global $Messages;
16271646 global $xhtml_validate_comments;
1628 global $current_User;
16291647
1630 switch( $context )1648 switch( $context )
1631 {1649 {
@@ -1648,7 +1666,7 @@
1648 break;1666 break;
16491667
1650 case 'commenting':1668 case 'commenting':
1651 $xhtmlvalidation = $use_xhtmlvalidation_for_comments;1669 $xhtmlvalidation = $xhtml_validate_comments;
1652 $allow_css_tweaks = $comments_allow_css_tweaks;1670 $allow_css_tweaks = $comments_allow_css_tweaks;
1653 $allow_javascript = false;1671 $allow_javascript = false;
1654 $allow_iframes = false;1672 $allow_iframes = false;
@@ -1700,7 +1718,7 @@
17001718
1701 $content = trim( $content );1719 $content = trim( $content );
17021720
1703 if( $use_balanceTags )1721 if( $balance_tags )
1704 {1722 {
1705 // Auto close open tags1723 // Auto close open tags
1706 $content = balance_tags( $content );1724 $content = balance_tags( $content );
@@ -1709,11 +1727,11 @@
1709 if( $context == 'commenting' || $escape_comments )1727 if( $context == 'commenting' || $escape_comments )
1710 {1728 {
1711 // Comments, processing instructions etc. are not allowed when commenting.1729 // Comments, processing instructions etc. are not allowed when commenting.
1712 $content = str_replace( array(1730 $content = str_replace(
1713 // Comments, CDATA sections and various declarations.1731 array(
1714 // Declarations end with a single '>' which makes it hard1732 // Comments, CDATA sections and various declarations. Declarations end with
1715 // to correctly detect their closing tags. Thus, we don't1733 // a single '>' which makes it hard to correctly detect their closing tags.
1716 // even try to do that (FIXME).1734 // Thus, we don't even try to do that (FIXME).
1717 '<!',1735 '<!',
1718 // Closing comments1736 // Closing comments
1719 '-->',1737 '-->',
@@ -1721,22 +1739,80 @@
1721 ']]>',1739 ']]>',
1722 // Processing instructions1740 // Processing instructions
1723 '<?',1741 '<?',
1724 '?>',1742 '?>', ),
1725 ), array(1743 array(
1726 '&lt;!',1744 '&lt;!',
1727 '--&gt;',1745 '--&gt;',
1728 ']]&gt;',1746 ']]&gt;',
1729 '&lt;?',1747 '&lt;?',
1730 '?&gt;',1748 '?&gt;', ),
1731 ), $content );1749 $content );
1732 }1750 }
17331751
1734 if( $xhtmlvalidation )1752 if( $xhtmlvalidation )
1735 {1753 {
1736 // We want to validate XHTML1754 // We want to validate XHTML
1737 load_class( 'xhtml_validator/_xhtml_validator.class.php' );1755
17381756 // figure out what we want to validate against ($flavor)
1739 $XHTML_Validator = new XHTML_Validator( $context, $allow_css_tweaks, $allow_iframes, $allow_javascript, $allow_objects, $encoding );1757 $skip = false;
1758 $flavor = 'xhtml';
1759 $source = array_merge( array(
1760 'template_type' => '', 'main_cat_ID' => 0, 'item_ID' => 0,
1761 ), $source );
1762
1763 // if we have template_type we're done
1764 if( $source['template_type'] )
1765 {
1766 $flavor = $source['template_type'];
1767 $skip = true;
1768 }
1769
1770 // if we come from param_check_html() we're almost done
1771 if( ! $skip && $source['param_check_html'] )
1772 {
1773 global $Blog;
1774
1775 // during blog creation, $Blog is NULL but template_ID has a value
1776 if( is_null( $Blog ) )
1777 {
1778 $template_ID = $_POST['template_ID'];
1779 $TemplateCache = & get_Cache( 'TemplateCache' );
1780 $Template = $TemplateCache->get_by_ID( $template_ID, false );
1781 $flavor = $Template->type;
1782 $skip = true;
1783 }
1784 else
1785 {
1786 $flavor = $Blog->template_type;
1787 $skip = true;
1788 }
1789 }
1790
1791 // okay let's get a $blog_ID value if we can
1792 if( ! $skip && $source['main_cat_ID'] )
1793 {
1794 $blog_ID = get_catblog( $main_cat ); // @todo (0000) should not die, if cat does not exist!
1795 }
1796 elseif( $source['item_ID'] )
1797 {
1798 $ItemCache = & get_Cache( 'ItemCache' );
1799 $current_Item = & $ItemCache->get_by_ID( $source['item_ID'], false );
1800 $blog_ID = get_catblog( $current_Item->main_cat_ID ); // @todo (0000) should not die, if cat does not exist!
1801 }
1802 else
1803 {
1804 $blog_ID = 0;
1805 }
1806
1807 if( ! $skip && $blog_ID != 0 )
1808 {
1809 // Get the appropriate blog from the cache
1810 $BlogCache = & get_Cache( 'BlogCache' );
1811 $Blog = & $BlogCache->get_by_ID( $blog_ID, false, false );
1812 $flavor = $Blog->template_type;
1813 }
1814
1815 $XHTML_Validator = new XHTML_Validator( $flavor, $context, $allow_css_tweaks, $allow_iframes, $allow_javascript, $allow_objects, $encoding );
17401816
1741 if( ! $XHTML_Validator->check( $content ) )1817 if( ! $XHTML_Validator->check( $content ) )
1742 {1818 {
@@ -1746,8 +1822,9 @@
1746 else1822 else
1747 {1823 {
1748 // We do not WANT to validate XHTML, fall back to basic security checking:1824 // We do not WANT to validate XHTML, fall back to basic security checking:
1749 // This is only as strong as its regexps can parse xhtml. This is significantly inferior to the XHTML checker above.1825 // This is only as strong as its regexps can parse xhtml. This is significantly
1750 // The only advantage of this checker is that it can check for a little security without requiring VALID XHTML.1826 // inferior to the XHTML checker above. The only advantage of this checker is
1827 // that it can check for a little security without requiring VALID XHTML.
17511828
1752 if( $context == 'commenting' )1829 if( $context == 'commenting' )
1753 {1830 {
@@ -1757,11 +1834,10 @@
1757 else if( ! $escape_comments1834 else if( ! $escape_comments
1758 && preg_match_all( '#(?:<!--|<!\[CDATA\[|<\?)#i', $content, $matches, PREG_OFFSET_CAPTURE ) )1835 && preg_match_all( '#(?:<!--|<!\[CDATA\[|<\?)#i', $content, $matches, PREG_OFFSET_CAPTURE ) )
1759 {1836 {
1760 // We are posting an item, try an el-cheapo check for unclosed1837 // We are posting an item, try an el-cheapo check for unclosed comments,
1761 // comments, processing instructions etc.1838 // processing instructions etc. Declarations end with a single '>' which
1762 // Declarations end with a single '>' which is hard to detect1839 // is hard to detect correctly, so we don't try to validate them here. In
1763 // correctly, so we don't try to validate them here. In theory,1840 // theory this may be an issue, but apparently, it's not a big threat.
1764 // this may be an issue, but apparently, it's not a big threat.
1765 static $search = array(1841 static $search = array(
1766 '<!--' => '-->',1842 '<!--' => '-->',
1767 '<![CDATA[' => ']]>',1843 '<![CDATA[' => ']]>',
@@ -1794,15 +1870,15 @@
1794 // No error yet?1870 // No error yet?
1795 $check = $content;1871 $check = $content;
17961872
1797 // CHECK Styling restictions:1873 // CHECK Styling restictions
1798 if( ! $allow_css_tweaks1874 if( ! $allow_css_tweaks
1799 && preg_match( '#\s((style|class|id)\s*=)#i', $check, $matches) )1875 && preg_match( '#\s((style|class|id)\s*=)#i', $check, $matches ) )
1800 {1876 {
1801 $Messages->add( T_('Illegal CSS markup found: ').htmlspecialchars( $matches[1] ), 'error' );1877 $Messages->add( T_('Illegal CSS markup found: ').htmlspecialchars( $matches[1] ), 'error' );
1802 $error = true;1878 $error = true;
1803 }1879 }
18041880
1805 // CHECK JAVASCRIPT:1881 // CHECK JAVASCRIPT
1806 if( ! $allow_javascript1882 if( ! $allow_javascript
1807 && ( preg_match( '¤( < \s* //? \s* (script|noscript) )¤xi', $check, $matches )1883 && ( preg_match( '¤( < \s* //? \s* (script|noscript) )¤xi', $check, $matches )
1808 || preg_match( '#\s((on[a-z]+)\s*=)#i', $check, $matches )1884 || preg_match( '#\s((on[a-z]+)\s*=)#i', $check, $matches )
@@ -1813,7 +1889,7 @@
1813 $error = true;1889 $error = true;
1814 }1890 }
18151891
1816 // CHECK IFRAMES:1892 // CHECK IFRAMES
1817 if( ! $allow_iframes1893 if( ! $allow_iframes
1818 && preg_match( '¤( < \s* //? \s* (frame|iframe) )¤xi', $check, $matches) )1894 && preg_match( '¤( < \s* //? \s* (frame|iframe) )¤xi', $check, $matches) )
1819 {1895 {
@@ -1821,7 +1897,7 @@
1821 $error = true;1897 $error = true;
1822 }1898 }
18231899
1824 // CHECK OBJECTS:1900 // CHECK OBJECTS
1825 if( ! $allow_objects1901 if( ! $allow_objects
1826 && preg_match( '¤( < \s* //? \s* (applet|object|param|embed) )¤xi', $check, $matches) )1902 && preg_match( '¤( < \s* //? \s* (applet|object|param|embed) )¤xi', $check, $matches) )
1827 {1903 {
@@ -1834,11 +1910,12 @@
1834 if( $error )1910 if( $error )
1835 {1911 {
1836 if( ! empty( $current_User )1912 if( ! empty( $current_User )
1837 && ! empty( $Group ) // This one will basically prevent this case from happening when commenting1913 && ! empty( $Group ) // This one will basically prevent this case from happening when commenting
1838 && $current_User->check_perm( 'users', 'edit', false ) )1914 && $current_User->check_perm( 'users', 'edit', false ) )
1839 {1915 {
1840 $Messages->add( sprintf( T_('(Note: To get rid of the above validation warnings, you can deactivate unwanted validation rules in your <a %s>Group settings</a>.)'),1916 $Messages->add(
1841 'href="'.$admin_url.'?ctrl=users&amp;grp_ID='.$Group->ID.'"' ), 'error' );1917 sprintf( T_('(Note: To get rid of the above validation warnings, you can deactivate unwanted validation rules in your <a %s>Group settings</a>.)'),
1918 'href="'.$admin_url.'?ctrl=users&amp;grp_ID='.$Group->ID.'"' ), 'error' );
1842 }1919 }
1843 return false;1920 return false;
1844 }1921 }
@@ -1850,7 +1927,6 @@
18501927
1851/**1928/**
1852 * Balances Tags of string using a modified stack.1929 * Balances Tags of string using a modified stack.
1853 *
1854 * @param string HTML to be balanced1930 * @param string HTML to be balanced
1855 * @return string Balanced HTML1931 * @return string Balanced HTML
1856 */1932 */
18571933
=== modified file 'qp_inc/_core/_template.funcs.php'
--- qp_inc/_core/_template.funcs.php 2013-03-04 20:46:54 +0000
+++ qp_inc/_core/_template.funcs.php 2013-03-11 07:27:21 +0000
@@ -82,7 +82,7 @@
8282
83 if( $redirect_to[0] == '/' )83 if( $redirect_to[0] == '/' )
84 {84 {
85 // @todo (0000): until all calls to header_redirect are cleaned up:85 // @todo (0000) until all calls to header_redirect are cleaned up:
86 global $ReqHost;86 global $ReqHost;
87 $redirect_to = $ReqHost.$redirect_to;87 $redirect_to = $ReqHost.$redirect_to;
88 // debug_die( '$redirect_to must be an absolute URL' );88 // debug_die( '$redirect_to must be an absolute URL' );
@@ -202,11 +202,11 @@
202 *202 *
203 * 'auto_pilot' => 'seo_title' uses the SEO title autopilot. (default: "none")203 * 'auto_pilot' => 'seo_title' uses the SEO title autopilot. (default: "none")
204 *204 *
205 * @todo (0000): single month: Respect locales datefmt205 * @todo (0000) single month: Respect locales datefmt
206 * @todo (0000): single post: posts do no get proper checking (wether they are in the requested206 * @todo (0000) single post: posts do no get proper checking (wether they are in the requested
207 * blog or whether their permissions match user rights, thus the title sometimes gets displayed207 * blog or whether their permissions match user rights, thus the title sometimes gets displayed
208 * even when it should not. We need to pre-query the ItemList instead!!208 * even when it should not. We need to pre-query the ItemList instead!!
209 * @todo (0000): make it complete with all possible params!209 * @todo (0000) make it complete with all possible params!
210 */210 */
211function request_title( $params = array() )211function request_title( $params = array() )
212{212{
@@ -472,7 +472,7 @@
472 '#jqueryUI_debug#' => 'jquery.ui.all.js',472 '#jqueryUI_debug#' => 'jquery.ui.all.js',
473 );473 );
474474
475 // @todo (0000): dh> I think dependencies should get handled where the files are included!475 // @todo (0000) dh> I think dependencies should get handled where the files are included!
476 if( in_array( $js_file, array( '#jqueryUI#', '#jqueryUI_debug#' ) ) )476 if( in_array( $js_file, array( '#jqueryUI#', '#jqueryUI_debug#' ) ) )
477 {477 {
478 // Dependency : ensure jQuery is loaded478 // Dependency : ensure jQuery is loaded
@@ -676,7 +676,7 @@
676676
677/**677/**
678 * T-Tag: Registers all the javascripts needed by the toolbar menu678 * T-Tag: Registers all the javascripts needed by the toolbar menu
679 * @todo (0000): fp> include basic.css ? -- rename to add_headlines_for* -- potential679 * @todo (0000) fp> include basic.css ? -- rename to add_headlines_for* -- potential
680 * problem with inclusion order of CSS files!! dh> would be nice to have the batch of CSS in680 * problem with inclusion order of CSS files!! dh> would be nice to have the batch of CSS in
681 * a separate file. basic.css would get included first always, then e.g. this toolbar.css.681 * a separate file. basic.css would get included first always, then e.g. this toolbar.css.
682 */682 */
@@ -689,7 +689,7 @@
689689
690 require_js( '#jquery#' );690 require_js( '#jquery#' );
691 require_js( 'functions.min.js' ); // for rollovers AddEvent - TODO: change to jQuery691 require_js( 'functions.min.js' ); // for rollovers AddEvent - TODO: change to jQuery
692 require_js( 'rollovers.js' ); // @todo (0000): change to jQuery692 require_js( 'rollovers.js' ); // @todo (0000) change to jQuery
693 // Superfish menus:693 // Superfish menus:
694 require_js( 'hoverintent.js' );694 require_js( 'hoverintent.js' );
695 require_js( 'superfish.js' );695 require_js( 'superfish.js' );
@@ -709,14 +709,28 @@
709/**709/**
710 * T-Tag: Outputs the collected HTML HEAD lines.710 * T-Tag: Outputs the collected HTML HEAD lines.
711 * @see add_headline()711 * @see add_headline()
712 * @param string The template's type (default is 'xthml')
712 * @return string713 * @return string
713 */714 */
714function include_headlines()715function include_headlines( $type = 'xhtml' )
715{716{
716 global $headlines;717 global $headlines;
717718
718 if( $headlines )719 if( $headlines )
719 {720 {
721
722 if( $type == 'html5' )
723 {
724 // http://php.net/manual/en/language.types.array.php Example 3...
725 foreach( $headlines as &$headline )
726 {
727 $headline = str_replace( "<script type=\"text/javascript\"", "<script", $headline );
728 $headline = str_replace( "<style type=\"text/css\"", "<style", $headline );
729 $headline = str_replace( "<link rel=\"stylesheet\" type=\"text/css\"", "<link rel=\"stylesheet\"", $headline );
730 }
731 unset( $headline );
732 }
733
720 echo "\n".implode( "\n", $headlines );734 echo "\n".implode( "\n", $headlines );
721 echo "\n";735 echo "\n";
722 }736 }
723737
=== modified file 'qp_inc/_core/model/__core.install.php'
--- qp_inc/_core/model/__core.install.php 2013-03-04 07:34:42 +0000
+++ qp_inc/_core/model/__core.install.php 2013-03-11 07:27:21 +0000
@@ -53,6 +53,7 @@
53 blog_allowblogcss TINYINT(1) NOT NULL default 1,53 blog_allowblogcss TINYINT(1) NOT NULL default 1,
54 blog_allowusercss TINYINT(1) NOT NULL default 1,54 blog_allowusercss TINYINT(1) NOT NULL default 1,
55 blog_template_ID INT(10) UNSIGNED NOT NULL DEFAULT 1,55 blog_template_ID INT(10) UNSIGNED NOT NULL DEFAULT 1,
56 blog_template_type ENUM('xhtml','html5','feed','other') NOT NULL default 'xhtml',
56 blog_in_bloglist TINYINT(1) NOT NULL DEFAULT 1,57 blog_in_bloglist TINYINT(1) NOT NULL DEFAULT 1,
57 blog_links_blog_ID INT(11) NULL DEFAULT NULL,58 blog_links_blog_ID INT(11) NULL DEFAULT NULL,
58 blog_media_location ENUM( 'default', 'subdir', 'custom', 'none' ) DEFAULT 'default' NOT NULL,59 blog_media_location ENUM( 'default', 'subdir', 'custom', 'none' ) DEFAULT 'default' NOT NULL,
@@ -420,17 +421,18 @@
420 "CREATE TABLE T_templates__template (421 "CREATE TABLE T_templates__template (
421 template_ID INT(10) unsigned NOT NULL auto_increment,422 template_ID INT(10) unsigned NOT NULL auto_increment,
422 template_name VARCHAR(32) NOT NULL,423 template_name VARCHAR(32) NOT NULL,
423 template_type ENUM('xhtml','feed','other') NOT NULL default 'xhtml',424 template_type ENUM('xhtml','html5','feed','other') NOT NULL default 'xhtml',
424 template_folder VARCHAR(32) NOT NULL,425 template_folder VARCHAR(32) NOT NULL,
425 PRIMARY KEY template_ID (template_ID),426 PRIMARY KEY template_ID (template_ID),
426 UNIQUE template_folder( template_folder ),427 UNIQUE template_folder( template_folder ),
427 KEY template_name( template_name )428 KEY template_name( template_name )
428 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),429 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
429430
430 'T_templates__container' => array( 'Creating table for template containers',431 'T_templates__container' => array( 'Creating template containers table',
431 "CREATE TABLE T_templates__container (432 "CREATE TABLE T_templates__container (
432 sco_template_ID INT(10) unsigned NOT NULL,433 sco_template_ID INT(10) unsigned NOT NULL,
433 sco_name VARCHAR(40) NOT NULL,434 sco_name VARCHAR(40) NOT NULL,
435 sco_order TINYINT NOT NULL default 0,
434 PRIMARY KEY ( sco_template_ID, sco_name )436 PRIMARY KEY ( sco_template_ID, sco_name )
435 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),437 ) ENGINE = innodb DEFAULT CHARSET = $db_storage_charset" ),
436438
437439
=== modified file 'qp_inc/collections/coll_settings.ctrl.php'
--- qp_inc/collections/coll_settings.ctrl.php 2011-07-20 06:26:28 +0000
+++ qp_inc/collections/coll_settings.ctrl.php 2013-03-11 07:27:21 +0000
@@ -253,8 +253,8 @@
253 break;253 break;
254254
255 case 'template':255 case 'template':
256 $AdminUI->disp_view( 'templates/views/_coll_template_settings.form.php' );256 $AdminUI->disp_view( 'templates/views/_template_settings.form.php' );
257 $AdminUI->disp_view( 'templates/views/_coll_template.view.php' );257 $AdminUI->disp_view( 'templates/views/_template_select.view.php' );
258 break;258 break;
259259
260 case 'plugin_settings':260 case 'plugin_settings':
261261
=== modified file 'qp_inc/collections/collections.ctrl.php'
--- qp_inc/collections/collections.ctrl.php 2012-07-21 09:43:31 +0000
+++ qp_inc/collections/collections.ctrl.php 2013-03-11 07:27:21 +0000
@@ -269,7 +269,7 @@
269 $AdminUI->displayed_sub_begin = 1; // DIRTY HACK :/ replacing an even worse hack...269 $AdminUI->displayed_sub_begin = 1; // DIRTY HACK :/ replacing an even worse hack...
270 $AdminUI->disp_payload_begin();270 $AdminUI->disp_payload_begin();
271271
272 $AdminUI->disp_view( 'templates/views/_coll_sel_template.view.php' );272 $AdminUI->disp_view( 'templates/views/_template_select_create.view.php' );
273273
274 $AdminUI->disp_payload_end();274 $AdminUI->disp_payload_end();
275 break;275 break;
276276
=== modified file 'qp_inc/collections/model/_blog.class.php'
--- qp_inc/collections/model/_blog.class.php 2011-03-14 23:04:42 +0000
+++ qp_inc/collections/model/_blog.class.php 2013-03-11 07:27:21 +0000
@@ -95,6 +95,11 @@
95 var $media_fullpath = '';95 var $media_fullpath = '';
96 var $media_url = '';96 var $media_url = '';
97 var $default_cat_ID;97 var $default_cat_ID;
98 /**
99 * This blog's template type
100 * @var string
101 */
102 var $template_type;
98103
99 /**104 /**
100 * Constructor105 * Constructor
@@ -125,6 +130,7 @@
125 $this->set( 'locale', $default_locale );130 $this->set( 'locale', $default_locale );
126 $this->set( 'access_type', 'index.php' );131 $this->set( 'access_type', 'index.php' );
127 $this->template_ID = 1; // TODO: this is the DB default, but it will fail if template #1 does not exist132 $this->template_ID = 1; // TODO: this is the DB default, but it will fail if template #1 does not exist
133 $this->template_type = 'xhtml';
128 }134 }
129 else135 else
130 {136 {
@@ -154,6 +160,7 @@
154 $this->media_fullpath = $db_row->blog_media_fullpath;160 $this->media_fullpath = $db_row->blog_media_fullpath;
155 $this->media_url = $db_row->blog_media_url;161 $this->media_url = $db_row->blog_media_url;
156 $this->UID = $db_row->blog_UID;162 $this->UID = $db_row->blog_UID;
163 $this->template_type = $db_row->blog_template_type;
157 }164 }
158 }165 }
159166
@@ -1405,6 +1412,11 @@
1405 $this->set_from_Request( 'template_ID' );1412 $this->set_from_Request( 'template_ID' );
1406 }1413 }
14071414
1415 if( param( 'blog_template_type', 'string', NULL ) !== NULL )
1416 {
1417 $this->set( 'template_type', get_param( 'blog_template_type' ) );
1418 }
1419
1408 if( param( 'what_to_show', 'string', NULL ) !== NULL )1420 if( param( 'what_to_show', 'string', NULL ) !== NULL )
1409 { // Show x days or x posts?:1421 { // Show x days or x posts?:
1410 $this->set_setting( 'what_to_show', get_param( 'what_to_show' ) );1422 $this->set_setting( 'what_to_show', get_param( 'what_to_show' ) );
14111423
=== modified file 'qp_inc/comments/views/_comment.form.php'
--- qp_inc/comments/views/_comment.form.php 2010-12-31 12:12:03 +0000
+++ qp_inc/comments/views/_comment.form.php 2013-03-11 07:27:21 +0000
@@ -2,269 +2,245 @@
2/**2/**
3 * This file implements the Comment form.3 * This file implements the Comment form.
4 *4 *
5 * This file is part of the Quam Plures project - {@link http://quamplures.net/}.5 * @author {@link http://wonderwinds.com/ Ed Bennett}
6 * See also {@link https://launchpad.net/quam-plures}.6 * @author {@link http://fplanque.net/ Francois PLANQUE}
7 *7 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
8 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}8 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
9 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}.9 * @package comments
10 *
11 * @license http://quamplures.net/license.html GNU General Public License (GPL)
12 *
13 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
14 * @author fplanque: Francois PLANQUE
15 *
16 * @package pond
17 */10 */
18if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );11if(!defined('QP_MAIN_INIT')) die('fail');
1912
20/**
21 * @var Blog
22 */
23global $Blog;13global $Blog;
24/**14global $comments_use_autobr;
25 * @var Comment
26 */
27global $edited_Comment;15global $edited_Comment;
28/**16global $mode;
29 *17global $month;
30 */
31global $Plugins;18global $Plugins;
3219global $redirect_to;
33global $comments_use_autobr, $mode, $month, $tab, $redirect_to;20global $tab;
3421
35$Form = new Form( NULL, 'comment_checkchanges', 'post' );22$Form = new Form( NULL, 'comment_checkchanges', 'post' );
36
37$Form->global_icon( T_('Cancel editing!'), 'close', str_replace( '&', '&amp;', $redirect_to), T_('cancel'), 4, 1 );23$Form->global_icon( T_('Cancel editing!'), 'close', str_replace( '&', '&amp;', $redirect_to), T_('cancel'), 4, 1 );
38
39$Form->begin_form( 'eform' );24$Form->begin_form( 'eform' );
4025$Form->hidden_ctrl();
41$Form->hidden( 'ctrl', 'comments' );
42$Form->hidden( 'action', 'update' );26$Form->hidden( 'action', 'update' );
43$Form->hidden( 'redirect_to', $redirect_to );27$Form->hidden( 'redirect_to', $redirect_to );
44$Form->hidden( 'comment_ID', $edited_Comment->ID );28$Form->hidden( 'comment_ID', $edited_Comment->ID );
45?>29?>
4630
47<div class="clear"></div>31<div class="clear"></div>
48
49<div class="left_col">32<div class="left_col">
5033<?php
5134$Form->begin_fieldset( T_('Comment contents') );
52 <?php35echo '<table cellspacing="0" class="compose_layout">';
53 $Form->begin_fieldset( T_('Comment contents') );36echo '<tr><td width="1%"><strong>'.T_('In response to').':</strong></td>';
5437echo '<td class="input">';
55 echo '<table cellspacing="0" class="compose_layout">';38$comment_Item = & $edited_Comment->get_Item();
5639// display and link item title
57 echo '<tr><td width="1%"><strong>'.T_('In response to').':</strong></td>';40$comment_Item->title( array(
58 echo '<td class="input">';41 'link_type' => 'admin_view',
59 $comment_Item = & $edited_Comment->get_Item();42) );
60 // display and link item title43echo '</td></tr>';
61 $comment_Item->title( array(44
62 'link_type' => 'admin_view',45if( ! $edited_Comment->get_author_User() )
63 ) );46{
64 echo '</td></tr>';47 // This is not a member comment
6548 $Form->switch_layout( 'none' );
66 if( ! $edited_Comment->get_author_User() )49
67 { // This is not a member comment50 echo '<tr><td width="1%"><strong>'.T_('Author').':</strong></td>';
68 $Form->switch_layout( 'none' );51 echo '<td class="input">';
6952 $Form->text_input( 'newcomment_author', $edited_Comment->author, 20, '', '', array('maxlength' => 100, 'style' => 'width: 100%;') );
70 echo '<tr><td width="1%"><strong>'.T_('Author').':</strong></td>';53 echo '</td></tr>';
71 echo '<td class="input">';54
72 $Form->text_input( 'newcomment_author', $edited_Comment->author, 20, '', '', array('maxlength'=>100, 'style'=>'width: 100%;') );55 echo '<tr><td width="1%"><strong>'.T_('Email').':</strong></td>';
73 echo '</td></tr>';56 echo '<td class="input">';
7457 $Form->text_input( 'newcomment_author_email', $edited_Comment->author_email, 20, '', '', array('maxlength' => 100, 'style' => 'width: 100%;') );
75 echo '<tr><td width="1%"><strong>'.T_('Email').':</strong></td>';58 echo '</td></tr>';
76 echo '<td class="input">';59
77 $Form->text_input( 'newcomment_author_email', $edited_Comment->author_email, 20, '', '', array('maxlength'=>100, 'style'=>'width: 100%;') );60 echo '<tr><td width="1%"><strong>'.T_('Website URL').':</strong></td>';
78 echo '</td></tr>';61 echo '<td class="input">';
7962 $Form->text_input( 'newcomment_author_url', $edited_Comment->author_url, 20, '', '', array('maxlength' => 100, 'style' => 'width: 100%;') );
80 echo '<tr><td width="1%"><strong>'.T_('Website URL').':</strong></td>';63 echo '</td></tr>';
81 echo '<td class="input">';64
82 $Form->text_input( 'newcomment_author_url', $edited_Comment->author_url, 20, '', '', array('maxlength'=>100, 'style'=>'width: 100%;') );65 $Form->switch_layout( NULL );
83 echo '</td></tr>';66}
8467else
85 $Form->switch_layout( NULL );68{
86 }69 echo '<tr><td width="1%"><strong>'.T_('Author').':</strong></td>';
87 else70 echo '<td class="input">';
88 {71 // display comment author's name
89 echo '<tr><td width="1%"><strong>'.T_('Author').':</strong></td>';72 $edited_Comment->author( array() );
90 echo '<td class="input">';73 echo '</td></tr>';
91 // display comment author's name74}
92 $edited_Comment->author( array() );75
93 echo '</td></tr>';76echo '</table>';
94 }77?>
95
96 echo '</table>';
97 ?>
9878
99<div class="edit_toolbars">79<div class="edit_toolbars">
100<?php80<?php
101// spark the plugin manager81// spark the plugin manager
102$Plugins->trigger_event( 'AdminDisplayToolbarAbove', array(82$Plugins->trigger_event( 'AdminDisplayToolbarAbove', array(
103 'target_type' => 'Comment',83 'target_type' => 'Comment',
84 'template_type' => $Blog->template_type,
104) );85) );
105?>86?>
106</div>87</div>
10788
108 <?php // ---------------------------- TEXTAREA -------------------------------------89<?php // TEXTAREA
109 $content = $edited_Comment->content;90$content = $edited_Comment->content;
110 if( $comments_use_autobr == 'always' || $comments_use_autobr == 'opt-out' )91if( $comments_use_autobr == 'always' || $comments_use_autobr == 'opt-out' )
111 {92{
112 $content = unautobrize($content);93 $content = unautobrize( $content );
113 }94}
11495
115 $Form->fieldstart = '<div class="edit_area">';96$Form->fieldstart = '<div class="edit_area">';
116 $Form->fieldend = "</div>\n";97$Form->fieldend = "</div>\n";
117 $Form->textarea( 'content', $content, 16, '', '', 40 , '' );98$Form->textarea( 'content', $content, 16, '', '', 40, '' );
118 $Form->fieldstart = '<div class="tile">';99$Form->fieldstart = '<div class="tile">';
119 $Form->fieldend = '</div>';100$Form->fieldend = '</div>';
120 ?>101?>
121 <script type="text/javascript">102<script type="text/javascript">
122 <!--103<!--
123 // This is for toolbar plugins104// This is for toolbar plugins
124 var app_Canvas = document.getElementById('content');105var app_Canvas = document.getElementById('content');
125 //-->106//-->
126 </script>107</script>
127108
128<div class="edit_toolbars">109<div class="edit_toolbars">
129<?php110<?php
130// spark the plugin manager111// spark the plugin manager
131$Plugins->trigger_event( 'AdminDisplayToolbarBelow', array(112$Plugins->trigger_event( 'AdminDisplayToolbarBelow', array(
132 'target_type' => 'Comment',113 'target_type' => 'Comment',
133) );114 'template_type' => $Blog->template_type,
134?>115) );
135</div>116?>
136117</div>
137 <div class="edit_actions">118
138 <input type="submit" value="<?php /* TRANS: This is the value of an input submit button */ echo T_('Save !'); ?>" class="SaveButton" tabindex="10" />119<div class="edit_actions">
139 <?php120<input type="submit" value="<?php /* TRANS: This is the value of an input submit button */ echo T_('Save !'); ?>" class="SaveButton" tabindex="10" />
140 // ---------- DELETE ----------121<?php
141 if( $action == 'editcomment' )122if( $action == 'editcomment' )
142 {123{
143 // display a link to delete a comment124 // display a link to delete a comment
144 $edited_Comment->delete_link( array(125 $edited_Comment->delete_link( array(
145 'class' => 'DeleteButton',126 'class' => 'DeleteButton',
146 ) );127 ) );
147 }128}
148129
149 // spark the plugin manager130// spark the plugin manager
150 $Plugins->trigger_event( 'AdminDisplayEditorButton', array(131$Plugins->trigger_event( 'AdminDisplayEditorButton', array(
151 'target_type' => 'Comment',132 'target_type' => 'Comment',
152 ) );133) );
153 ?>134?>
154 </div>135</div>
155136
156 <?php137<?php
157 $Form->end_fieldset();138$Form->end_fieldset();
158139
159 $Form->begin_fieldset( T_('Advanced properties') );140$Form->begin_fieldset( T_('Advanced properties') );
160141$Form->switch_layout( 'linespan' );
161 $Form->switch_layout( 'linespan' );142
162143if( $current_User->check_perm( 'edit_timestamp' ) )
163 if( $current_User->check_perm( 'edit_timestamp' ) )144{
164 { // ------------------------------------ TIME STAMP -------------------------------------145 // TIME STAMP
165 echo '<div id="itemform_edit_timestamp">';146 echo '<div id="itemform_edit_timestamp">';
166 $Form->date( 'comment_issue_date', $edited_Comment->date, T_('Comment date') );147 $Form->date( 'comment_issue_date', $edited_Comment->date, T_('Comment date') );
167 echo ' '; // allow wrapping!148 echo ' '; // allow wrapping!
168 $Form->time( 'comment_issue_time', $edited_Comment->date, '' );149 $Form->time( 'comment_issue_time', $edited_Comment->date, '' );
169 echo '</div>';150 echo '</div>';
170 }151}
171152
172 // --------------------------- AUTOBR --------------------------------------153// AUTOBR ... fp> TODO: this should be Auto-P and handled by the Auto-P plugin
173 // fp> TODO: this should be Auto-P and handled by the Auto-P plugin154?>
174 ?>155<input type="checkbox" class="checkbox" name="post_autobr" value="1"
175 <input type="checkbox" class="checkbox" name="post_autobr" value="1"156<?php if( $comments_use_autobr == 'always' || $comments_use_autobr == 'opt-out' )
176 <?php if( $comments_use_autobr == 'always' || $comments_use_autobr == 'opt-out' ) echo ' checked="checked"' ?>157{
177 id="autobr" tabindex="6" />158 echo ' checked="checked"';
178 <label for="autobr"><strong><?php echo T_('Auto-BR') ?></strong></label>159}
179160?>
180 <?php161 id="autobr" tabindex="6" />
181162<label for="autobr"><strong><?php echo T_('Auto-BR') ?></strong></label>
182 $Form->switch_layout( NULL );163<?php
183164$Form->switch_layout( NULL );
184 $Form->end_fieldset();165
185166$Form->end_fieldset();
186 // ####################### PLUGIN FIELDSETS #########################167
187 // spark the plugin manager168// spark the plugin manager
188 $Plugins->trigger_event( 'AdminDispCommentFormField', array(169$Plugins->trigger_event( 'AdminDispCommentFormField', array(
189 'Form' => & $Form,170 'Form' => & $Form,
190 'Comment' => & $edited_Comment,171 'Comment' => & $edited_Comment,
191 ) );172) );
192 ?>173?>
193
194</div>174</div>
195175
196<div class="right_col">176<div class="right_col">
197
198<div class="edit_toolbars">177<div class="edit_toolbars">
199<?php178<?php
200// spark the plugin manager179// spark the plugin manager
201$Plugins->trigger_event( 'AdminDisplayToolbarSidebar', array(180$Plugins->trigger_event( 'AdminDisplayToolbarSidebar', array(
202 'target_type' => 'Comment',181 'target_type' => 'Comment',
182 'template_type' => $Blog->template_type,
203) );183) );
204?>184?>
205</div>185</div>
206186
207<?php187<?php
208 if( $Blog->get_setting('allow_rating') != 'never'188if( $Blog->get_setting( 'allow_rating' ) != 'never' || ! empty( $edited_Comment->rating ) )
209 || !empty( $edited_Comment->rating ) )189{
210 { // Rating is editable190 // Rating is editable
211 $Form->begin_fieldset( T_('Rating') );191 $Form->begin_fieldset( T_('Rating') );
212192
213 // display options to rate a comment193 // display options to rate a comment
214 $edited_Comment->rating_input( array(194 $edited_Comment->rating_input( array(
215 'before' => '<p>',195 'before' => '<p>',
216 'after' => '</p>',196 'after' => '</p>',
217 ) );197 ) );
218198
219 // display option to reset rating199 // display option to reset rating
220 $edited_Comment->rating_none_input( array(200 $edited_Comment->rating_none_input( array(
221 'before' => '<p>',201 'before' => '<p>',
222 'after' => '</p>',202 'after' => '</p>',
223 ) );203 ) );
224204
225 $Form->end_fieldset();205 $Form->end_fieldset();
226 }206}
227 else207else
228 {208{
229 $Form->hidden( 'comment_rating', 0 );209 $Form->hidden( 'comment_rating', 0 );
230 }210}
231211
232 /*212/*
233 $Form->begin_fieldset( T_('Properties') );213$Form->begin_fieldset( T_('Properties') );
234 echo '<p>';214echo '<p>';
235 $Form->checkbox_basic_input( 'comment_featured', $edited_Comment->featured, T_('Featured') );215$Form->checkbox_basic_input( 'comment_featured', $edited_Comment->featured, T_('Featured') );
236 echo '</p>';216echo '</p>';
237 $Form->end_fieldset();217$Form->end_fieldset();
238 */218*/
239219
240 $Form->begin_fieldset( T_('Visibility'), array( 'id' => 'commentform_visibility' ) );220$Form->begin_fieldset( T_('Visibility'), array( 'id' => 'commentform_visibility' ) );
241221$sharing_options[] = array( 'published', T_('Published (Public)') );
242 $sharing_options[] = array( 'published', T_('Published (Public)') );222$sharing_options[] = array( 'draft', T_('Draft (Not published!)') );
243 $sharing_options[] = array( 'draft', T_('Draft (Not published!)') );223$sharing_options[] = array( 'deprecated', T_('Deprecated (Not published!)') );
244 $sharing_options[] = array( 'deprecated', T_('Deprecated (Not published!)') );224$Form->radio( 'comment_status', $edited_Comment->status, $sharing_options, '', true );
245 $Form->radio( 'comment_status', $edited_Comment->status, $sharing_options, '', true );225$Form->end_fieldset();
246226
247 $Form->end_fieldset();227$Form->begin_fieldset( T_('Links') );
248228echo '<p>';
249 $Form->begin_fieldset( T_('Links') );229$Form->checkbox_basic_input( 'comment_nofollow', $edited_Comment->nofollow, T_('Nofollow website URL') );
250 echo '<p>';230echo '</p>';
251 $Form->checkbox_basic_input( 'comment_nofollow', $edited_Comment->nofollow, T_('Nofollow website URL') );231$Form->end_fieldset();
252 // TODO: apply to all links -- note: see basic antispam plugin that does this for x hours232$Form->begin_fieldset( T_('Feedback info') );
253 echo '</p>';233?>
254 $Form->end_fieldset();234
255235<p><strong><?php echo T_('Type') ?>:</strong> <?php echo $edited_Comment->type; ?></p>
256 $Form->begin_fieldset( T_('Feedback info') );236<p><strong><?php echo T_('IP address') ?>:</strong> <?php
257 ?>237// Display IP address and allow plugins to filter it, e.g. the DNSBL plugin will add a link to check the IP
258238echo $Plugins->get_trigger_event( 'FilterIpAddress', array('format' => 'htmlbody', 'data' => $edited_Comment->author_IP), 'data' ); ?></p>
259 <p><strong><?php echo T_('Type') ?>:</strong> <?php echo $edited_Comment->type; ?></p>239<p><strong><?php echo T_('Spam Karma') ?>:</strong> <?php $edited_Comment->spam_karma(); ?></p>
260 <p><strong><?php echo T_('IP address') ?>:</strong> <?php240
261 // Display IP address and allow plugins to filter it, e.g. the DNSBL plugin will add a link to check the IP:241<?php
262 echo $Plugins->get_trigger_event( 'FilterIpAddress', array('format'=>'htmlbody', 'data'=>$edited_Comment->author_IP), 'data' ); ?></p>242$Form->end_fieldset();
263 <p><strong><?php echo T_('Spam Karma') ?>:</strong> <?php $edited_Comment->spam_karma(); ?></p>243?>
264
265 <?php
266 $Form->end_fieldset();
267 ?>
268</div>244</div>
269245
270<div class="clear"></div>246<div class="clear"></div>
271247
=== modified file 'qp_inc/items/views/_item_expert.form.php'
--- qp_inc/items/views/_item_expert.form.php 2011-09-01 16:29:34 +0000
+++ qp_inc/items/views/_item_expert.form.php 2013-03-11 07:27:21 +0000
@@ -1,75 +1,66 @@
1<?php1<?php
2/**2/**
3 * This file implements the Post form.3 * This file implements the Post form
4 *4 *
5 * This file is part of the Quam Plures project - {@link http://quamplures.net/}.5 * @author {@link http://wonderwinds.com/ Ed Bennett}
6 * See also {@link https://launchpad.net/quam-plures}.6 * @author {@link http://daniel.hahler.de/ Daniel HAHLER}
7 *7 * @author {@link http://progidistri.com/ PROGIDISTRI}
8 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}8 * @author {@link http://fplanque.net/ Francois PLANQUE}
9 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}.
10 *
11 * @license http://quamplures.net/license.html GNU General Public License (GPL)
12 *
13 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
14 * @author fplanque: Francois PLANQUE
15 * @author fsaya: Fabrice SAYA-GASNIER / PROGIDISTRI
16 * @author blueyed: Daniel HAHLER
17 * @author gorgeb: Bertrand GORGE / EPISTEMA9 * @author gorgeb: Bertrand GORGE / EPISTEMA
18 *10 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
19 * @todo blueyed>> IMHO it's not good to use CSS class .line here (mainly white-space:nowrap),11 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
20 * because on a smaller screen you'll cut things off! (and not every browser
21 * allows "marking and moving" of text then).
22 *
23 * @package items12 * @package items
24 */13 */
25if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );14if(!defined('QP_MAIN_INIT')) die('fail');
2615
27/**16global $admin_url;
28 * @var User17global $app_allow_dbase_reset;
29 */18global $basepath;
19global $Blog;
20global $bozo_start_modified;
21global $creating;
30global $current_User;22global $current_User;
31/**
32 * @var Item
33 */
34global $edited_Item;23global $edited_Item;
35/**24global $install_subdir;
36 * @var Blog25global $item_content;
37 */26global $item_tags;
38global $Blog;27global $item_title;
39/**28global $mode;
40 * @var Plugins29global $pagenow;
41 */
42global $Plugins;30global $Plugins;
43/**31global $post_comment_status;
44 * @var GeneralSettings32global $redirect_to;
45 */
46global $Settings;33global $Settings;
47
48global $pagenow;
49global $mode;
50global $admin_url;
51global $post_comment_status;
52global $trackback_url;34global $trackback_url;
53global $item_tags;35
54global $bozo_start_modified;36// security notice on dashboard
55global $creating;37if( is_file( $basepath.$install_subdir.'index.php' ) )
56global $item_title;38{
57global $item_content;39 echo '<div class="action_messages"><div class="log_error">'.T_('Your /qp_install/index.php file is still there. That\'s not good. You need to delete that file OR delete the entire /qp_install/ folder!').'</div></div>';
58global $redirect_to;40 if( $app_allow_dbase_reset )
41 {
42 echo '<div class="action_messages"><div class="log_error">'.T_('Additionally, your /qp_config/_main_config.php file allows your database to be reset ($app_allow_dbase_reset is set to \'1\').');
43 echo '<ul><li><strong>'.T_('You will not be able to use use this program until you').'</strong>';
44 echo '<ul><li>'.T_('delete the file "/qp_install/index.php" OR delete the folder "/qp_install/"').'</li>';
45 echo '<li>'.T_('OR change $app_allow_dbase_reset to 0 in your /qp_config/_main_config.php file.').'</li></ul>';
46 echo '</ul></div></div>';
47 die();
48 }
49}
5950
60// Determine if we are creating or updating...51// Determine if we are creating or updating...
61$creating = is_create_action( $action );52$creating = is_create_action( $action );
6253
63// ================================ START OF EDIT FORM ================================54// ====== START OF EDIT FORM ======
64$Form = new Form( NULL, 'item_checkchanges', 'post' );55$Form = new Form( NULL, 'item_checkchanges', 'post' );
65$Form->labelstart = '<strong>';56$Form->labelstart = '<strong>';
66$Form->labelend = "</strong>\n";57$Form->labelend = "</strong>\n";
6758
68$params = array();59$params = array();
6960
70if( !empty( $bozo_start_modified ) )61if( ! empty( $bozo_start_modified ) )
71{62{
72 $params['bozo_start_modified'] = true;63 $params['bozo_start_modified'] = false;
73}64}
7465
75$Form->begin_form( '', '', $params );66$Form->begin_form( '', '', $params );
@@ -90,33 +81,32 @@
90 'Form' => & $Form, 'Item' => & $edited_Item,81 'Form' => & $Form, 'Item' => & $edited_Item,
91) );82) );
9283
93// ############################ POST CONTENTS #############################84// ====== POST CONTENTS ======
9485$Form->begin_fieldset( T_('Post contents') );
95$Form->begin_fieldset( get_manual_link( 'post-contents' ).T_('Post contents') );
9686
97echo '<table cellspacing="0" class="compose_layout"><tr>';87echo '<table cellspacing="0" class="compose_layout"><tr>';
9888
99// Title input:89// Title input:
100$require_title = $Blog->get_setting('require_title');90$require_title = $Blog->get_setting( 'require_title' );
101if( $require_title != 'none' )91if( $require_title != 'none' )
102{92{
103 echo '<td width="1%"><strong>'.T_('Title').':</strong></td>';93 echo '<td width="1%"><strong>'.T_('Title').':</strong></td>';
104 echo '<td width="97%" class="input">';94 echo '<td width="97%" class="input">';
105 $Form->switch_layout( 'none' );95 $Form->switch_layout( 'none' );
106 $Form->text_input( 'post_title', $item_title, 20, '', '', array('maxlength'=>255, 'style'=>'width: 100%;', 'required' => $Blog->get_setting('require_title') == 'required') );96 $Form->text_input( 'post_title', $item_title, 20, '', '', array( 'maxlength' => 255, 'style' => 'width: 100%;', 'required' => $Blog->get_setting( 'require_title' ) == 'required' ) );
107 echo '</td>';97 echo '</td>';
108}98}
10999
110// -- Language chooser100// -- Language chooser
111$locale_options = locale_options( $edited_Item->get( 'locale' ), false, true );101$locale_options = locale_options( $edited_Item->get( 'locale' ), false, true );
112if ( is_array( $locale_options ) )102if( is_array( $locale_options ) )
113{ // We've only one enabled locale.103{ // We've only one enabled locale.
114 // Tblue> The locale name is not really needed here, but maybe we104 // Tblue> The locale name is not really needed here, but maybe we
115 // want to display the name of the only locale?105 // want to display the name of the only locale?
116 $Form->hidden( 'post_locale', $locale_options[0] );106 $Form->hidden( 'post_locale', $locale_options[0] );
117}107}
118else108else
119{ // More than one locale => select field.109{ // More than one locale => select field.
120 echo '<td width="1%">';110 echo '<td width="1%">';
121 if( $require_title != 'none' )111 if( $require_title != 'none' )
122 {112 {
@@ -129,6 +119,18 @@
129}119}
130echo '</tr></table>';120echo '</tr></table>';
131121
122// -- item url & type selector fields
123echo '<table cellspacing="0" class="compose_layout" style="width:100%"><tr>';
124echo '<td width="1%"><strong>'.T_('Link to url').':</strong></td>';
125echo '<td class="input">';
126$Form->text_input( 'post_url', $edited_Item->get( 'url' ), 20, '', '', array('maxlength' => 255, 'style' => 'width: 100%;') );
127echo '</td>';
128echo '<td width="1%">&nbsp;&nbsp;<strong>'.T_('Type').':</strong></td>';
129echo '<td width="1%" class="select">';
130$ItemTypeCache = & get_Cache( 'ItemTypeCache' );
131$Form->select_object( 'item_typ_ID', $edited_Item->ptyp_ID, $ItemTypeCache, '', '', false, '', 'get_option_list_unreserved_only' );
132echo '</td></tr></table>'."\n";
133
132$Form->switch_layout( NULL );134$Form->switch_layout( NULL );
133?>135?>
134136
@@ -137,14 +139,15 @@
137// spark the plugin manager139// spark the plugin manager
138$Plugins->trigger_event( 'AdminDisplayToolbarAbove', array(140$Plugins->trigger_event( 'AdminDisplayToolbarAbove', array(
139 'target_type' => 'Item',141 'target_type' => 'Item',
142 'template_type' => $Blog->template_type,
140) );143) );
141?>144?>
142</div>145</div>
143146
144<?php // ---------------------------- TEXTAREA -------------------------------------147<?php // ====== TEXTAREA ======
145$Form->fieldstart = '<div class="edit_area">';148$Form->fieldstart = '<div class="edit_area">';
146$Form->fieldend = "</div>\n";149$Form->fieldend = "</div>\n";
147$Form->textarea_input( 'content', $item_content, 16, '', array( 'cols' => 40 , 'id' => 'itemform_post_content' ) );150$Form->textarea_input( 'content', $item_content, 16, '', array( 'cols' => 40, 'id' => 'itemform_post_content' ) );
148$Form->switch_layout( 'linespan' );151$Form->switch_layout( 'linespan' );
149?>152?>
150<script type="text/javascript">153<script type="text/javascript">
@@ -159,12 +162,13 @@
159// spark the plugin manager162// spark the plugin manager
160$Plugins->trigger_event( 'AdminDisplayToolbarBelow', array(163$Plugins->trigger_event( 'AdminDisplayToolbarBelow', array(
161 'target_type' => 'Item',164 'target_type' => 'Item',
165 'template_type' => $Blog->template_type,
162) );166) );
163?>167?>
164</div>168</div>
165169
166<?php170<?php
167// ------------------------------- ACTIONS ----------------------------------171// ====== ACTIONS ======
168echo '<div class="edit_actions">';172echo '<div class="edit_actions">';
169173
170// spark the plugin manager174// spark the plugin manager
@@ -181,7 +185,7 @@
181 if( $current_User->check_perm( 'files', 'view' ) )185 if( $current_User->check_perm( 'files', 'view' ) )
182 {186 {
183 $fm_url_params = 'mode=upload';187 $fm_url_params = 'mode=upload';
184 if( !empty($edited_Item->ID) )188 if( ! empty( $edited_Item->ID ) )
185 {189 {
186 $fm_url_params .= '&amp;fm_mode=link_item&amp;item_ID='.$edited_Item->ID;190 $fm_url_params .= '&amp;fm_mode=link_item&amp;item_ID='.$edited_Item->ID;
187 }191 }
@@ -191,21 +195,21 @@
191 }195 }
192}196}
193197
194// ---------- PREVIEW ----------198// ====== PREVIEW ======
195$url = url_same_protocol( $Blog->get( 'url' ) ); // was dynurl199$url = url_same_protocol( $Blog->get( 'url' ) ); // was dynurl
196$Form->button( array( 'button', '', T_('Preview'), 'PreviewButton', 'b2edit_open_preview(this.form, \''.$url.'\');' ) );200$Form->button( array( 'button', '', T_('Preview'), 'PreviewButton', 'b2edit_open_preview(this.form, \''.$url.'\');' ) );
197201
198// ---------- SAVE ----------202// ====== SAVE ======
199$next_action = ($creating ? 'create' : 'update');203$next_action = ( $creating ? 'create' : 'update' );
200$Form->submit( array( 'actionArray['.$next_action.']', /* TRANS: This is the value of an input submit button */ T_('Save'), 'SaveButton' ) );204$Form->submit( array( 'actionArray['.$next_action.']', /* TRANS: This is the value of an input submit button */ T_('Save'), 'SaveButton' ) );
201$Form->submit( array( 'actionArray['.$next_action.'_edit]', /* TRANS: This is the value of an input submit button */ T_('Save & edit'), 'SaveEditButton' ) );205$Form->submit( array( 'actionArray['.$next_action.'_edit]', /* TRANS: This is the value of an input submit button */ T_('Save & edit'), 'SaveEditButton' ) );
202206
203// ----- PUBLISH NOW --------207// ====== PUBLISH NOW ======
204$publishnow_displayed = false;208$publishnow_displayed = false;
205if( $edited_Item->status == 'draft'209if( $edited_Item->status == 'draft'
206 && $current_User->check_perm( 'blog_post!published', 'edit', false, $Blog->ID ) // TODO: if we actually set the primary cat to another blog, we may still get an ugly perm die210 && $current_User->check_perm( 'blog_post!published', 'edit', false, $Blog->ID )
207 && $current_User->check_perm( 'edit_timestamp', 'edit', false ) )211 && $current_User->check_perm( 'edit_timestamp', 'edit', false ) )
208{ // Only allow publishing if in draft mode. Other modes are too special to run the risk of 1 click publication.212{ // Only allow publishing if in draft mode. Other modes are too special to run the risk of 1 click publication.
209 $Form->submit( array(213 $Form->submit( array(
210 'actionArray['.$next_action.'_publish]',214 'actionArray['.$next_action.'_publish]',
211 /* TRANS: This is the value of an input submit button */ T_('Publish NOW !'),215 /* TRANS: This is the value of an input submit button */ T_('Publish NOW !'),
@@ -225,71 +229,47 @@
225 'Item' => & $edited_Item,229 'Item' => & $edited_Item,
226) );230) );
227231
228// ####################### ATTACHMENTS/LINKS #########################232// ====== ATTACHMENTS/LINKS ======
229attachment_iframe( $Form, $creating, $edited_Item, $Blog );233attachment_iframe( $Form, $creating, $edited_Item, $Blog );
230234
231// ############################ ADVANCED #############################235// ====== ADVANCED ======
232$Form->switch_layout( 'linespan' );236$Form->switch_layout( 'linespan' );
233237
234$Form->begin_fieldset( get_manual_link( 'advanced-properties' ).T_('Advanced properties'), array( 'id' => 'itemform_adv_props' ) );238$Form->begin_fieldset( T_('Advanced properties'), array( 'id' => 'itemform_adv_props' ) );
235239
236// -- item url & type selector fields240echo '<table cellspacing="0" class="compose_layout">';
237
238echo '<table cellspacing="0" class="compose_layout" style="width:100%">';
239echo '<tr><td class="label"><strong>'.T_('Type').'</strong></td>';
240echo '<td style="padding:0 1em; text-align:center;">:</td><td width="1%" class="select">';
241$ItemTypeCache = & get_Cache( 'ItemTypeCache' );
242$Form->select_object( 'item_typ_ID', $edited_Item->ptyp_ID, $ItemTypeCache, '', '', false, '', 'get_option_list_unreserved_only' );
243echo '</td>';
244echo '</tr>'."\n";
245
246/* old code
247echo '<tr><td class="label"><label for="item_tags"><strong>'.T_('Tags').'</strong> <span class="notes">'.T_('sep by ,').'</span></label></td>';
248echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';
249$Form->text_input( 'item_tags', $item_tags, 40, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );
250echo '</td><td width="1"><!-- for IE7 --></td></tr>';
251//*/
252
253echo '<tr><td class="label" style="vertical-align:top"><label for="post_excerpt"><strong>'.T_('Excerpt').'</strong>
254<span class="notes">'.T_('(for XML feeds)').'</span></label></td>';
255echo '<td style="padding:0 1em; text-align:center;vertical-align:top">:</td><td class="input" ><textarea name="post_excerpt" rows="2" cols="25" style="width:100%" id="post_excerpt">';
256$edited_Item->disp( 'excerpt', 'formvalue' );
257echo '</textarea></td><td width="1"><!-- for IE7 --></td></tr>';
258
259echo '<tr><td class="label"><strong>'.T_('Link to url').'</strong></td>';
260echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';
261$Form->text_input( 'post_url', $edited_Item->get( 'url' ), 20, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );
262echo '</td></tr>'."\n";
263
264
265echo '<tr><td class="label"><label for="post_urltitle" title="'.T_('&quot;slug&quot; to be used in permalinks').'"><strong>'.T_('URL title "slug"').'</strong></label></td>';241echo '<tr><td class="label"><label for="post_urltitle" title="'.T_('&quot;slug&quot; to be used in permalinks').'"><strong>'.T_('URL title "slug"').'</strong></label></td>';
266echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';242echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';
267$Form->text_input( 'post_urltitle', $edited_Item->get('urltitle'), 40, '', '', array('maxlength'=>210, 'style'=>'width: 100%;') );243$Form->text_input( 'post_urltitle', $edited_Item->get( 'urltitle' ), 40, '', '', array('maxlength' => 210, 'style' => 'width: 100%;') );
268echo '</td><td width="1"><!-- for IE7 --></td></tr>';244echo '</td><td width="1"><!-- for IE7 --></td></tr>';
269245
270echo '<tr><td class="label"><label for="titletag"><strong>'.T_('&lt;title&gt; tag').'</strong></label></td>';246echo '<tr><td class="label"><label for="titletag"><strong>'.T_('&lt;title&gt; tag').'</strong></label></td>';
271echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';247echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';
272$Form->text_input( 'titletag', $edited_Item->get('titletag'), 40, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );248$Form->text_input( 'titletag', $edited_Item->get( 'titletag' ), 40, '', '', array('maxlength' => 255, 'style' => 'width: 100%;') );
273echo '</td><td width="1"><!-- for IE7 --></td></tr>';249echo '</td><td width="1"><!-- for IE7 --></td></tr>';
274250
275echo '<tr><td class="label"><label for="metadesc" title="&lt;meta name=&quot;description&quot;&gt;"><strong>'.T_('&lt;meta&gt; desc').'</strong></label></td>';251echo '<tr><td class="label"><label for="metadesc" title="&lt;meta name=&quot;description&quot;&gt;"><strong>'.T_('&lt;meta&gt; desc').'</strong></label></td>';
276echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';252echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';
277$Form->text_input( 'metadesc', $edited_Item->get('metadesc'), 40, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );253$Form->text_input( 'metadesc', $edited_Item->get( 'metadesc' ), 40, '', '', array('maxlength' => 255, 'style' => 'width: 100%;') );
278echo '</td><td width="1"><!-- for IE7 --></td></tr>';254echo '</td><td width="1"><!-- for IE7 --></td></tr>';
279255
280echo '<tr><td class="label"><label for="metakeywords" title="&lt;meta name=&quot;keywords&quot;&gt;"><strong>'.T_('&lt;meta&gt; keywords').'</strong></label></td>';256echo '<tr><td class="label"><label for="metakeywords" title="&lt;meta name=&quot;keywords&quot;&gt;"><strong>'.T_('&lt;meta&gt; keywords').'</strong></label></td>';
281echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';257echo '<td style="padding:0 1em; text-align:center;">:</td><td class="input" >';
282$Form->text_input( 'metakeywords', $edited_Item->get('metakeywords'), 40, '', '', array('maxlength'=>255, 'style'=>'width: 100%;') );258$Form->text_input( 'metakeywords', $edited_Item->get( 'metakeywords' ), 40, '', '', array('maxlength' => 255, 'style' => 'width: 100%;') );
283echo '</td><td width="1"><!-- for IE7 --></td></tr>';259echo '</td><td width="1"><!-- for IE7 --></td></tr>';
284260
261echo '<tr><td class="label" style="vertical-align:top"><label for="post_excerpt"><strong>'.T_('Excerpt').'</strong><span class="notes">'.T_('(for XML feeds)').'</span></label></td>';
262echo '<td style="padding:0 1em; text-align:center;vertical-align:top">:</td><td class="input" ><textarea name="post_excerpt" rows="2" cols="25" style="width:100%" id="post_excerpt">';
263$edited_Item->disp( 'excerpt', 'formvalue' );
264echo '</textarea></td><td width="1"><!-- for IE7 --></td></tr>';
285echo '</table>';265echo '</table>';
286266
287$Form->end_fieldset();267$Form->end_fieldset();
288268
289// ############################ WORKFLOW #############################269// ====== WORKFLOW ======
290if( $Blog->get_setting( 'use_workflow' ) )270if( $Blog->get_setting( 'use_workflow' ) )
291{ // We want to use workflow properties for this blog:271{ // We want to use workflow properties for this blog:
292 $Form->begin_fieldset( get_manual_link( 'workflow-properties' ).T_('Workflow properties'), array( 'id' => 'itemform_workflow_props' ) );272 $Form->begin_fieldset( T_('Workflow properties'), array( 'id' => 'itemform_workflow_props' ) );
293 echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';273 echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';
294 $Form->select_object( 'item_priority', NULL, $edited_Item, T_('Priority'), '', true, '', 'priority_options' );274 $Form->select_object( 'item_priority', NULL, $edited_Item, T_('Priority'), '', true, '', 'priority_options' );
295 echo ' '; // allow wrapping!275 echo ' '; // allow wrapping!
@@ -298,16 +278,16 @@
298 $ItemStatusCache = & get_Cache( 'ItemStatusCache' );278 $ItemStatusCache = & get_Cache( 'ItemStatusCache' );
299 $Form->select_options( 'item_st_ID', $ItemStatusCache->get_option_list( $edited_Item->pst_ID, true ), T_('Task status') );279 $Form->select_options( 'item_st_ID', $ItemStatusCache->get_option_list( $edited_Item->pst_ID, true ), T_('Task status') );
300 echo ' '; // allow wrapping!280 echo ' '; // allow wrapping!
301 $Form->date( 'item_deadline', $edited_Item->get('datedeadline'), T_('Deadline') );281 $Form->date( 'item_deadline', $edited_Item->get( 'datedeadline' ), T_('Deadline') );
302 echo '</div>';282 echo '</div>';
303 $Form->end_fieldset();283 $Form->end_fieldset();
304}284}
305285
306// ####################### ADDITIONAL ACTIONS #########################286// ====== ADDITIONAL ACTIONS ======
307if( isset( $Blog ) && $Blog->get('allowtrackbacks') )287if( isset( $Blog ) && $Blog->get( 'allowtrackbacks' ) )
308{288{
309 $Form->begin_fieldset( get_manual_link( 'additional-actions' ).T_('Additional actions'), array( 'id' => 'itemform_additional_actions' ) );289 $Form->begin_fieldset( T_('Additional actions'), array( 'id' => 'itemform_additional_actions' ) );
310 // --------------------------- TRACKBACK --------------------------------------290 // ====== TRACKBACK ======
311 ?>291 ?>
312 <div id="itemform_trackbacks">292 <div id="itemform_trackbacks">
313 <label for="trackback_url"><strong><?php echo T_('Trackback URLs') ?>:</strong>293 <label for="trackback_url"><strong><?php echo T_('Trackback URLs') ?>:</strong>
@@ -335,24 +315,29 @@
335// spark the plugin manager315// spark the plugin manager
336$Plugins->trigger_event( 'AdminDisplayToolbarSidebar', array(316$Plugins->trigger_event( 'AdminDisplayToolbarSidebar', array(
337 'target_type' => 'Item',317 'target_type' => 'Item',
318 'template_type' => $Blog->template_type,
338) );319) );
339?>320?>
340</div>321</div>
341322
342<?php323<?php
343// ################### CATEGORIES ###################324// ====== CATEGORIES ======
344cat_select( $Form );325cat_select( $Form );
345326
346$Form->switch_layout( 'linespan' );327$Form->switch_layout( 'linespan' );
347328// ====== TAGS ======
348// ################### TAGS ##################
349$Form->begin_fieldset( T_('Tags'), array( 'id' => 'itemform_tags' ) );329$Form->begin_fieldset( T_('Tags'), array( 'id' => 'itemform_tags' ) );
350$Form->textarea_input( 'item_tags', $item_tags, 4, '', array( 'note' => T_('separated by' ).' <strong>,</strong>', 'cols' => 10, 'style'=>'width: 90%;margin:0 auto;display:block;') );330$Form->textarea_input( 'item_tags', $item_tags, 4, '', array( 'note' => T_('separated by' ).' <strong>,</strong>', 'cols' => 10, 'style' => 'width: 98%;margin:0 auto;display:block;') );
351$Form->end_fieldset();331$Form->end_fieldset();
352332
353// ################### PROPERTIES ###################333// ====== VISIBILITY / SHARING ======
354$Form->begin_fieldset( T_('Properties'), array( 'id' => 'itemform_extra' ) );334$Form->begin_fieldset( T_('Visibility / Sharing'), array( 'id' => 'itemform_visibility' ) );
355$Form->checkbox_basic_input( 'item_featured', $edited_Item->featured, '<strong>'.T_('Featured post').'</strong>' );335visibility_select( $Form, $edited_Item->status );
336$Form->end_fieldset();
337
338// ====== ISSUE DATE ======
339$Form->switch_layout( 'linespan' );
340$Form->begin_fieldset( T_('Item issue date'), array( 'id' => 'itemform_iss_date' ) );
356if( $current_User->check_perm( 'edit_timestamp' ) )341if( $current_User->check_perm( 'edit_timestamp' ) )
357{ // ------------------------------------ TIME STAMP -------------------------------------342{ // ------------------------------------ TIME STAMP -------------------------------------
358 echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';343 echo '<div id="itemform_edit_timestamp" class="edit_fieldgroup">';
@@ -360,29 +345,27 @@
360 echo '</div>';345 echo '</div>';
361}346}
362347
363echo '<table>';348/**
364echo '<tr><td><strong>'.T_('Order').':</strong></td><td>';349 * commented out because I don't like this "order" thing
365$Form->text( 'item_order', $edited_Item->order, 10, '', T_('can be decimal') );350 * echo '<table>';
366echo '</td></tr>';351 * echo '<tr><td><strong>'.T_('Order').':</strong></td><td>';
367echo '</table>';352 * $Form->text( 'item_order', $edited_Item->order, 10, '', T_('can be decimal') );
368353 * echo '</td></tr>';
369$Form->end_fieldset();354 * echo '</table>';
370355 */
371// ################### VISIBILITY / SHARING ###################356
372$Form->begin_fieldset( T_('Visibility / Sharing'), array( 'id' => 'itemform_visibility' ) );357$Form->end_fieldset();
373visibility_select( $Form, $edited_Item->status );358
374$Form->end_fieldset();359// ====== TEXT RENDERERS ======
375360$Form->begin_fieldset( T_('Text Renderers'), array( 'id' => 'itemform_renderers' ) );
376// ################### TEXT RENDERERS ###################
377$Form->begin_fieldset( get_manual_link( 'text-renderers' ).T_('Text Renderers'), array( 'id' => 'itemform_renderers' ) );
378// fp> TODO: there should be no param call here (shld be in controller)361// fp> TODO: there should be no param call here (shld be in controller)
379$edited_Item->renderer_checkboxes( param('renderers', 'array', NULL) );362$edited_Item->renderer_checkboxes( param('renderers', 'array', NULL) );
380$Form->end_fieldset();363$Form->end_fieldset();
381364
382// ################### COMMENT STATUS ###################365// ====== COMMENT STATUS ======
383if( $Blog->allowcomments == 'post_by_post' )366if( $Blog->allowcomments == 'post_by_post' )
384{367{
385 $Form->begin_fieldset( get_manual_link( 'comments' ).T_('Comments'), array( 'id' => 'itemform_comments' ) );368 $Form->begin_fieldset( T_('Comments'), array( 'id' => 'itemform_comments' ) );
386 ?>369 ?>
387 <label title="<?php echo T_('Visitors can leave comments on this post.') ?>"><input type="radio" name="post_comment_status" value="open" class="checkbox" <?php if( $post_comment_status == 'open' ) echo 'checked="checked"'; ?> />370 <label title="<?php echo T_('Visitors can leave comments on this post.') ?>"><input type="radio" name="post_comment_status" value="open" class="checkbox" <?php if( $post_comment_status == 'open' ) echo 'checked="checked"'; ?> />
388 <?php echo T_('Open') ?></label><br />371 <?php echo T_('Open') ?></label><br />
@@ -398,11 +381,11 @@
398<div class="clear"></div>381<div class="clear"></div>
399382
400<?php383<?php
401// ================================== END OF EDIT FORM ==================================384// ====== END OF EDIT FORM ======
402$Form->end_form();385$Form->end_form();
403386
404if( $publishnow_displayed )387if( $publishnow_displayed )
405{ // fp> TODO: ideally this should not be hacked in *here*388{ // fp> TODO: ideally this should not be hacked in *here*
406 echo_publishnowbutton_js( $next_action );389 echo_publishnowbutton_js( $next_action );
407}390}
408?>391?>
@@ -453,7 +436,7 @@
453 $closed_panels = array(436 $closed_panels = array(
454 'itemform_createlinks',437 'itemform_createlinks',
455 'itemform_adv_props',438 'itemform_adv_props',
456 'itemform_extra',439 'itemform_iss_date',
457 'itemform_renderers',440 'itemform_renderers',
458 'itemform_comments',441 'itemform_comments',
459 );442 );
460443
=== removed file 'qp_inc/license.txt'
--- qp_inc/license.txt 2006-03-12 22:08:51 +0000
+++ qp_inc/license.txt 1970-01-01 00:00:00 +0000
@@ -1,293 +0,0 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 675 Mass Ave, Cambridge, MA 02139, USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123Thus, it is not the intent of this section to claim rights or contest
124your rights to work written entirely by you; rather, the intent is to
125exercise the right to control the distribution of derivative or
126collective works based on the Program.
127
128In addition, mere aggregation of another work not based on the Program
129with the Program (or with a work based on the Program) on a volume of
130a storage or distribution medium does not bring the other work under
131the scope of this License.
132
133 3. You may copy and distribute the Program (or a work based on it,
134under Section 2) in object code or executable form under the terms of
135Sections 1 and 2 above provided that you also do one of the following:
136
137 a) Accompany it with the complete corresponding machine-readable
138 source code, which must be distributed under the terms of Sections
139 1 and 2 above on a medium customarily used for software interchange; or,
140
141 b) Accompany it with a written offer, valid for at least three
142 years, to give any third party, for a charge no more than your
143 cost of physically performing source distribution, a complete
144 machine-readable copy of the corresponding source code, to be
145 distributed under the terms of Sections 1 and 2 above on a medium
146 customarily used for software interchange; or,
147
148 c) Accompany it with the information you received as to the offer
149 to distribute corresponding source code. (This alternative is
150 allowed only for noncommercial distribution and only if you
151 received the program in object code or executable form with such
152 an offer, in accord with Subsection b above.)
153
154The source code for a work means the preferred form of the work for
155making modifications to it. For an executable work, complete source
156code means all the source code for all modules it contains, plus any
157associated interface definition files, plus the scripts used to
158control compilation and installation of the executable. However, as a
159special exception, the source code distributed need not include
160anything that is normally distributed (in either source or binary
161form) with the major components (compiler, kernel, and so on) of the
162operating system on which the executable runs, unless that component
163itself accompanies the executable.
164
165If distribution of executable or object code is made by offering
166access to copy from a designated place, then offering equivalent
167access to copy the source code from the same place counts as
168distribution of the source code, even though third parties are not
169compelled to copy the source along with the object code.
170
171 4. You may not copy, modify, sublicense, or distribute the Program
172except as expressly provided under this License. Any attempt
173otherwise to copy, modify, sublicense or distribute the Program is
174void, and will automatically terminate your rights under this License.
175However, parties who have received copies, or rights, from you under
176this License will not have their licenses terminated so long as such
177parties remain in full compliance.
178
179 5. You are not required to accept this License, since you have not
180signed it. However, nothing else grants you permission to modify or
181distribute the Program or its derivative works. These actions are
182prohibited by law if you do not accept this License. Therefore, by
183modifying or distributing the Program (or any work based on the
184Program), you indicate your acceptance of this License to do so, and
185all its terms and conditions for copying, distributing or modifying
186the Program or works based on it.
187
188 6. Each time you redistribute the Program (or any work based on the
189Program), the recipient automatically receives a license from the
190original licensor to copy, distribute or modify the Program subject to
191these terms and conditions. You may not impose any further
192restrictions on the recipients' exercise of the rights granted herein.
193You are not responsible for enforcing compliance by third parties to
194this License.
195
196 7. If, as a consequence of a court judgment or allegation of patent
197infringement or for any other reason (not limited to patent issues),
198conditions are imposed on you (whether by court order, agreement or
199otherwise) that contradict the conditions of this License, they do not
200excuse you from the conditions of this License. If you cannot
201distribute so as to satisfy simultaneously your obligations under this
202License and any other pertinent obligations, then as a consequence you
203may not distribute the Program at all. For example, if a patent
204license would not permit royalty-free redistribution of the Program by
205all those who receive copies directly or indirectly through you, then
206the only way you could satisfy both it and this License would be to
207refrain entirely from distribution of the Program.
208
209If any portion of this section is held invalid or unenforceable under
210any particular circumstance, the balance of the section is intended to
211apply and the section as a whole is intended to apply in other
212circumstances.
213
214It is not the purpose of this section to induce you to infringe any
215patents or other property right claims or to contest validity of any
216such claims; this section has the sole purpose of protecting the
217integrity of the free software distribution system, which is
218implemented by public license practices. Many people have made
219generous contributions to the wide range of software distributed
220through that system in reliance on consistent application of that
221system; it is up to the author/donor to decide if he or she is willing
222to distribute software through any other system and a licensee cannot
223impose that choice.
224
225This section is intended to make thoroughly clear what is believed to
226be a consequence of the rest of this License.
227
228 8. If the distribution and/or use of the Program is restricted in
229certain countries either by patents or by copyrighted interfaces, the
230original copyright holder who places the Program under this License
231may add an explicit geographical distribution limitation excluding
232those countries, so that distribution is permitted only in or among
233countries not thus excluded. In such case, this License incorporates
234the limitation as if written in the body of this License.
235
236 9. The Free Software Foundation may publish revised and/or new versions
237of the General Public License from time to time. Such new versions will
238be similar in spirit to the present version, but may differ in detail to
239address new problems or concerns.
240
241Each version is given a distinguishing version number. If the Program
242specifies a version number of this License which applies to it and "any
243later version", you have the option of following the terms and conditions
244either of that version or of any later version published by the Free
245Software Foundation. If the Program does not specify a version number of
246this License, you may choose any version ever published by the Free Software
247Foundation.
248
249 10. If you wish to incorporate parts of the Program into other free
250programs whose distribution conditions are different, write to the author
251to ask for permission. For software which is copyrighted by the Free
252Software Foundation, write to the Free Software Foundation; we sometimes
253make exceptions for this. Our decision will be guided by the two goals
254of preserving the free status of all derivatives of our free software and
255of promoting the sharing and reuse of software generally.
256
257 NO WARRANTY
258
259 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
260FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
261OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
262PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
263OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
264MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
265TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
266PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
267REPAIR OR CORRECTION.
268
269 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
270WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
271REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
272INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
273OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
274TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
275YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
276PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
277POSSIBILITY OF SUCH DAMAGES.
278
279--------------------------------------------------------------------------
280
281 * In addition, as a special exception, the copyright holders give permission to link
282 * the code of this program with the PHP/SWF Charts library by maani.us (or with
283 * modified versions of this library that use the same license as PHP/SWF Charts library
284 * by maani.us), and distribute linked combinations including the two. You must obey the
285 * GNU General Public License in all respects for all of the code used other than the
286 * PHP/SWF Charts library by maani.us. If you modify this file, you may extend this
287 * exception to your version of the file, but you are not obligated to do so. If you do
288 * not wish to do so, delete this exception statement from your version.
289
290--------------------------------------------------------------------------
291
292 END OF TERMS AND CONDITIONS
293
2940
=== modified file 'qp_inc/plugins/_plugin.class.php'
--- qp_inc/plugins/_plugin.class.php 2013-03-05 23:34:17 +0000
+++ qp_inc/plugins/_plugin.class.php 2013-03-11 07:27:21 +0000
@@ -4,11 +4,11 @@
4 *4 *
5 * Real plugins should be derived from this class.5 * Real plugins should be derived from this class.
6 *6 *
7 * @todo (1111): var $code needs to be checked for duplicity upon installation and a note thrown7 * @todo (1111) var $code needs to be checked for duplicity upon installation and a note thrown
8 * to the installing user indicating a potential conflict ... if it isn't already checked ;)8 * to the installing user indicating a potential conflict ... if it isn't already checked ;)
9 * @todo (1111): var $group needs to be an enum with "other" as the default. There is no need9 * @todo (1111) var $group needs to be an enum with "other" as the default. There is no need
10 * for a plugin author to jack up the plugins display page with their own group name!10 * for a plugin author to jack up the plugins display page with their own group name!
11 * @todo (1111): var $priority needs to not apply to "install widget". Actually, it needs to not11 * @todo (1111) var $priority needs to not apply to "install widget". Actually, it needs to not
12 * apply to everything except rendering ... and it needs a rename to $render_priority12 * apply to everything except rendering ... and it needs a rename to $render_priority
13 * @author {@link http://wonderwinds.com/ Ed Bennett}13 * @author {@link http://wonderwinds.com/ Ed Bennett}
14 * @author {@link http://daniel.hahler.de/ Daniel HAHLER}14 * @author {@link http://daniel.hahler.de/ Daniel HAHLER}
@@ -435,7 +435,10 @@
435 * 'my_param' => array(435 * 'my_param' => array(
436 * 'label' => $this->T_('My Param'),436 * 'label' => $this->T_('My Param'),
437 * 'defaultvalue' => '10',437 * 'defaultvalue' => '10',
438 * 'valid_pattern' => array( 'pattern' => '[1-9]\d+', $this->T_('The value must be >= 10.') ),438 * 'valid_pattern' => array(
439 * 'pattern' => '[1-9]\d+',
440 * $this->T_('The value must be >= 10.')
441 * ),
439 * 'note' => $this->T_('Quite cool, eh?'),442 * 'note' => $this->T_('Quite cool, eh?'),
440 * ),443 * ),
441 * 'another_param' => array( // this one has no 'note'444 * 'another_param' => array( // this one has no 'note'
@@ -2579,7 +2582,7 @@
2579 * {@link $srvc_url_sensitive} (if {@link $ReqHost} is on https). NOTE: AJAX callbacks are2582 * {@link $srvc_url_sensitive} (if {@link $ReqHost} is on https). NOTE: AJAX callbacks are
2580 * required to be on the same domain/protocol, so if you're using absolute blog URLs on2583 * required to be on the same domain/protocol, so if you're using absolute blog URLs on
2581 * different domains you must set {@link $srvc_url} dynamically, to use the same domain!2584 * different domains you must set {@link $srvc_url} dynamically, to use the same domain!
2582 * @todo (0000): dh> we might want to provide whitelisting of methods through {@link2585 * @todo (0000) dh> we might want to provide whitelisting of methods through {@link
2583 * $Session} here and check for it in the srvc handler.2586 * $Session} here and check for it in the srvc handler.
2584 * @param string Method to call. This must be listed in {@link GetSrvcMethods()}.2587 * @param string Method to call. This must be listed in {@link GetSrvcMethods()}.
2585 * @param array Array of optional parameters passed to the method.2588 * @param array Array of optional parameters passed to the method.
25862589
=== modified file 'qp_inc/plugins/_plugin.funcs.php'
--- qp_inc/plugins/_plugin.funcs.php 2013-02-28 16:40:18 +0000
+++ qp_inc/plugins/_plugin.funcs.php 2013-03-11 07:27:21 +0000
@@ -163,7 +163,7 @@
163 switch( $set_type )163 switch( $set_type )
164 {164 {
165 case 'CollSettings':165 case 'CollSettings':
166 $set_value = $Obj->get_blog_setting( $parname, $set_target );166 $set_value = $Obj->get_coll_setting( $parname, $set_target );
167 $error_value = NULL;167 $error_value = NULL;
168 break;168 break;
169169
170170
=== modified file 'qp_inc/plugins/model/_plugins.class.php'
--- qp_inc/plugins/model/_plugins.class.php 2013-02-21 11:49:06 +0000
+++ qp_inc/plugins/model/_plugins.class.php 2013-03-11 07:27:21 +0000
@@ -1,207 +1,146 @@
1<?php1<?php
2/**2/**
3 * This file implements the PluginS class.3 * This file implements the Plugins base class
4 *4 *
5 * This is where you can plug in some {@link Plugin plugins} :D5 * This is where you can plug in some {@link Plugin plugins} :D
6 *6 *
7 * This file is part of Quam Plures - {@link http://quamplures.net/}7 * @todo (1111) vars here are missing a title - they only have an at-var tag :(
8 * See also {@link https://launchpad.net/quam-plures}.8 * @author {@link http://wonderwinds.com/ Ed Bennett}
9 *9 * @author {@link http://daniel.hahler.de/ Daniel HAHLER}
10 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}10 * @author {@link http://fplanque.net/ Francois PLANQUE}
11 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}11 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
12 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.12 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
13 *
14 * {@internal License choice
15 * - If you have received this file as part of a package, please find the license.txt file in
16 * the same folder or the closest folder above for complete license terms.
17 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
18 * then you must choose one of the following licenses before using the file:
19 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
20 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
21 * }}
22 *
23 * {@internal Open Source relicensing agreement:
24 * Daniel HAHLER grants Francois PLANQUE the right to license
25 * Daniel HAHLER's contributions to this file and the b2evolution project
26 * under any OSI approved OSS license (http://www.opensource.org/licenses/).
27 * }}
28 *
29 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
30 * @author fplanque: Francois PLANQUE - {@link http://fplanque.net/}
31 * @author blueyed: Daniel HAHLER
32 *
33 * @package plugins13 * @package plugins
34 */14 */
35if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );15if(!defined('QP_MAIN_INIT')) die('fail');
36
37load_class('plugins/_plugin.class.php');
38
3916
40/**17/**
41 * Plugins Class18 * Plugins base class
42 *
43 * This is where you can plug in some {@link Plugin plugins} :D
44 *
45 * @todo dh> Currently when a plugin goes into "broken" status (e.g. file not readable), it is "disabled" afterwards.
46 * This should rather remember the old status (e.g. "enabled") and make it enabled again.
47 *
48 * @package plugins19 * @package plugins
49 */20 */
50class Plugins21class Plugins
51{22{
52 /**#@+
53 * @access private
54 */
55
56 /**23 /**
57 * @var array of plugin_code => Plugin24 * FIX THIS
25 * @var array Array of plugin_code => Plugin
58 */26 */
59 var $index_code_Plugins = array();27 var $index_code_Plugins = array();
60
61 /**28 /**
62 * @var array of plugin_ID => Plugin29 * FIX THIS
30 * @var array Array of plugin_ID => Plugin
63 */31 */
64 var $index_ID_Plugins = array();32 var $index_ID_Plugins = array();
65
66 /**33 /**
34 * FIX THIS
67 * @see Plugins::load_events()35 * @see Plugins::load_events()
68 * @var array of event => plug_ID. IDs are sorted by priority.36 * @var array Array of event => plug_ID, IDs are sorted by priority
69 */37 */
70 var $index_event_IDs = array();38 var $index_event_IDs = array();
71
72 /**39 /**
73 * @var array of plug_ID => DB row from T_plugins. Used to lazy-instantiate Plugins.40 * FIX THIS
41 * @var array Array of plug_ID => DB row from T_plugins, used to lazy-instantiate Plugins
74 */42 */
75 var $index_ID_rows = array();43 var $index_ID_rows = array();
76
77 /**44 /**
78 * @var array of plug_code => plug_ID. Used to lazy-instantiate by code.45 * FIX THIS
46 * @var array Array of plug_code => plug_ID, used to lazy-instantiate by code
79 */47 */
80 var $index_code_ID = array();48 var $index_code_ID = array();
81
82 /**49 /**
83 * Cache Plugin codes by apply_rendering setting.50 * Cache Plugin codes by apply_rendering setting
84 * @var array of apply_rendering => plug_code51 * @var array Array of apply_rendering => plug_code
85 */52 */
86 var $index_apply_rendering_codes = array();53 var $index_apply_rendering_codes = array();
87
88 /**54 /**
89 * Path to plugins.55 * Path to plugins
90 *56 * @var string The preferred method is to have a sub-directory for each plugin (named
91 * The preferred method is to have a sub-directory for each plugin (named57 * after the plugin's classname), but they can be supplied just in this directory.
92 * after the plugin's classname), but they can be supplied just in this
93 * directory.
94 */58 */
95 var $plugins_path;59 var $plugins_path;
96
97 /**60 /**
98 * Have we loaded the plugins table (T_plugins)?61 * FIX THIS
99 * @var boolean62 * @var boolean Have we loaded the plugins table (T_plugins)?
100 */63 */
101 var $loaded_plugins_table = false;64 var $loaded_plugins_table = false;
102
103 /**65 /**
104 * Current object index in {@link $sorted_IDs} array.66 * FIX THIS
105 * @var integer67 * @var integer Current object index in {@link $sorted_IDs} array
106 */68 */
107 var $current_idx = -1;69 var $current_idx = -1;
108
109 /**70 /**
110 * List of IDs, sorted. This gets used to lazy-instantiate a Plugin.71 * FIX THIS
111 *72 * @var array List of IDs, sorted, used to lazy-instantiate a Plugin
112 * @var array
113 */73 */
114 var $sorted_IDs = array();74 var $sorted_IDs = array();
115
116 /**75 /**
117 * The smallest internal/auto-generated Plugin ID.76 * FIX THIS
118 * @var integer77 * @var integer The smallest internal/auto-generated Plugin ID
119 */78 */
120 var $smallest_internal_ID = 0;79 var $smallest_internal_ID = 0;
12180 /**
122 /**#@-*/81 * FIX THIS
12382 * @var string SQL to use in {@link load_plugins_table()}, gets overwritten for {@link Plugins_admin}
12483 */
125 /**#@+84 var $sql_load_plugins_table = 'SELECT plug_ID, plug_priority, plug_classname, plug_code, plug_name, plug_shortdesc, plug_apply_rendering, plug_status, plug_version, plug_spam_weight
126 * @access protected85 FROM T_plugins WHERE plug_status = \'enabled\' ORDER BY plug_priority, plug_classname';
127 */86 /**
12887 * Plugin Errors
129 /**88 *
130 * SQL to use in {@link load_plugins_table()}. Gets overwritten for {@link Plugins_admin}.
131 * @var string
132 * @static
133 */
134 var $sql_load_plugins_table = '
135 SELECT plug_ID, plug_priority, plug_classname, plug_code, plug_name, plug_shortdesc, plug_apply_rendering, plug_status, plug_version, plug_spam_weight
136 FROM T_plugins
137 WHERE plug_status = \'enabled\'
138 ORDER BY plug_priority, plug_classname';
139
140 /**#@-*/
141
142
143 /**
144 * Errors associated to plugins (during loading), indexed by plugin_ID and89 * Errors associated to plugins (during loading), indexed by plugin_ID and
145 * error class ("register").90 * error class ("register").
146 *91 * @var array Errors associated to plugins (during loading), indexed by plugin_ID and error class ("register")
147 * @var array
148 */92 */
149 var $plugin_errors = array();93 var $plugin_errors = array();
15094
151
152 /**95 /**
153 * Constructor. Sets {@link $plugins_path} and load events.96 * Constructor
97 *
98 * Sets {@link $plugins_path} and load events.
154 */99 */
155 function Plugins()100 function Plugins()
156 {101 {
157 global $basepath, $plugins_subdir, $Timer;102 global $basepath;
103 global $plugins_subdir;
104 global $Timer;
158105
159 // Set plugin path:106 // Set plugin path:
160 $this->plugins_path = $basepath.$plugins_subdir;107 $this->plugins_path = $basepath.$plugins_subdir;
161
162 $Timer->resume( 'plugin_init' );108 $Timer->resume( 'plugin_init' );
163109
164 // Load events for enabled plugins:110 // Load events for enabled plugins:
165 $this->load_events();111 $this->load_events();
166
167 $Timer->pause( 'plugin_init' );112 $Timer->pause( 'plugin_init' );
168 }113 }
169114
170115
171 /**116 /**
172 * Get a list of available Plugin groups.117 * Get a list of available Plugin groups
173 *
174 * @return array118 * @return array
175 */119 */
176 function get_plugin_groups()120 function get_plugin_groups()
177 {121 {
178 $result = array();122 $result = array();
179
180 foreach( $this->sorted_IDs as $plugin_ID )123 foreach( $this->sorted_IDs as $plugin_ID )
181 {124 {
182 $Plugin = & $this->get_by_ID( $plugin_ID );125 $Plugin = & $this->get_by_ID( $plugin_ID );
183126 if( empty( $Plugin->group ) || in_array( $Plugin->group, $result ) )
184 if( empty($Plugin->group) || in_array( $Plugin->group, $result ) )
185 {127 {
186 continue;128 continue;
187 }129 }
188
189 $result[] = $Plugin->group;130 $result[] = $Plugin->group;
190 }131 }
191
192 return $result;132 return $result;
193 }133 }
194134
195135
196 /**136 /**
137 * Get Plugins in group
197 * Will return an array that contents are references to plugins that have the same group.138 * Will return an array that contents are references to plugins that have the same group.
198 *
199 * @return array139 * @return array
200 */140 */
201 function get_Plugins_in_group( $group )141 function get_Plugins_in_group( $group )
202 {142 {
203 $result = array();143 $result = array();
204
205 foreach( $this->sorted_IDs as $plugin_ID )144 foreach( $this->sorted_IDs as $plugin_ID )
206 {145 {
207 $Plugin = & $this->get_by_ID( $plugin_ID );146 $Plugin = & $this->get_by_ID( $plugin_ID );
@@ -210,39 +149,35 @@
210 $result[] = & $Plugin;149 $result[] = & $Plugin;
211 }150 }
212 }151 }
213
214 return $result;152 return $result;
215 }153 }
216154
217155
218 /**156 /**
219 * Sets the status of a Plugin in DB and registers it into the internal indices when "enabled".157 * Get Plugin status
220 * Otherwise it gets unregistered, but only when we're not in {@link Plugins_admin}, because we158 *
221 * want to keep it in then in our indices.159 * Sets the status of a Plugin in DB and registers it into the internal indices
222 *160 * when "enabled". Otherwise it gets unregistered, but only when we're not in
223 * {@internal161 * {@link Plugins_admin}, because we want to keep it in then in our indices. Note:
224 * Note: this should probably always get called on the {@link $Plugins} object,162 * this should probably always get called on the {@link $Plugins} object, not
225 * not {@link $admin_Plugins}.163 * {@link $admin_Plugins}.
226 * }}
227 *
228 * @param Plugin164 * @param Plugin
229 * @param string New status ("enabled", "disabled", "needs_config", "broken")165 * @param string New status ("enabled", "disabled", "needs_config", "broken")
230 * @return boolean True on success, false on failure.166 * @return boolean True on success, false on failure.
231 */167 */
232 function set_Plugin_status( & $Plugin, $status )168 function set_Plugin_status( & $Plugin, $status )
233 {169 {
234 global $DB, $Debuglog;170 global $DB;
235171
236 if( $Plugin->status == $status172 if( $Plugin->status == $status
237 && $DB->query( "SELECT plug_status FROM T_plugins WHERE plug_ID = ".$DB->quote($Plugin->ID), 'set_Plugin_status safety net' ) == $status )173 && $DB->query( "SELECT plug_status FROM T_plugins WHERE plug_ID = ".$DB->quote( $Plugin->ID ), 'set_Plugin_status safety net' ) == $status )
238 {174 {
239 return true;175 return true;
240 }176 }
241
242 $DB->query( "UPDATE T_plugins SET plug_status = '".$status."' WHERE plug_ID = '".$Plugin->ID."'" );177 $DB->query( "UPDATE T_plugins SET plug_status = '".$status."' WHERE plug_ID = '".$Plugin->ID."'" );
243
244 if( $status == 'enabled' )178 if( $status == 'enabled' )
245 { // Reload plugins tables, which includes the plugin in further requests179 {
180 // Reload plugins tables, which includes the plugin in further requests
246 $this->loaded_plugins_table = false;181 $this->loaded_plugins_table = false;
247 $this->load_plugins_table();182 $this->load_plugins_table();
248 $this->load_events();183 $this->load_events();
@@ -251,77 +186,62 @@
251 {186 {
252 // Notify the plugin that it has been disabled:187 // Notify the plugin that it has been disabled:
253 $Plugin->BeforeDisable();188 $Plugin->BeforeDisable();
254
255 $this->unregister( $Plugin );189 $this->unregister( $Plugin );
256 }190 }
257
258 $Plugin->status = $status;191 $Plugin->status = $status;
259
260 $Debuglog->add( 'Set status for plugin #'.$Plugin->ID.' to "'.$status.'"!', 'plugins' );
261
262 return true;192 return true;
263 }193 }
264194
265195
266 /**196 /**
267 * Register a plugin.197 * Register a plugin
268 *198 *
269 * This handles the indexes, dynamically unregisters a Plugin that does not exist (anymore)199 * This handles the indexes, dynamically unregisters a Plugin that does not exist
270 * and instantiates the Plugin's (User)Settings.200 * (anymore) and instantiates the Plugin's (User)Settings. Attention: The code of
271 * 201 * the plugin is set to NULL if it is found to be not unique! To get the original
272 * Attention: The code of the plugin is set to NULL if it is found to be not unique!202 * code, use the $orig_code parameter.
273 * To get the original code, use the $orig_code parameter.
274 *
275 * @access protected
276 * @param string name of plugin class to instantiate and register203 * @param string name of plugin class to instantiate and register
277 * @param int ID in database (0 if not installed)204 * @param int ID in database (0 if not installed)
278 * @param int Priority in database (-1 to keep default)205 * @param int Priority in database (-1 to keep default)
279 * @param array When should rendering apply? (NULL to keep default)206 * @param array When should rendering apply? (NULL to keep default)
280 * @param string Path of the .php class file of the plugin.207 * @param string Path of the .php class file of the plugin.
281 * @param boolean Must the plugin exist (classfile_path and classname)?208 * @param boolean Must the plugin exist (classfile_path and classname)? This is used internally
282 * This is used internally to be able to unregister a non-existing plugin.209 * to be able to unregister a non-existing plugin.
283 * @param NULL|string If a reference to a variable is given here, it will receive210 * @param NULL|string If a reference to a variable is given here, it will receive the code
284 * the code of the plugin we are registering, even if the code211 * of the plugin we are registering, even if the code is found to be not unique.
285 * is found to be not unique.
286 * @return Plugin Plugin ref to newly created plugin; string in case of error212 * @return Plugin Plugin ref to newly created plugin; string in case of error
287 */213 */
288 function & register( $classname, $ID = 0, $priority = -1, $apply_rendering = NULL,214 function & register( $classname, $ID = 0, $priority = -1, $apply_rendering = NULL,
289 $classfile_path = NULL, $must_exists = true, & $orig_code = NULL )215 $classfile_path = NULL, $must_exists = true, & $orig_code = NULL )
290 {216 {
291 global $Debuglog, $Messages, $Timer;217 global $Messages;
218 global $Timer;
292219
293 if( $ID && isset($this->index_ID_Plugins[$ID]) )220 if( $ID && isset( $this->index_ID_Plugins[$ID] ) )
294 {221 {
295 debug_die( 'Tried to register already registered Plugin (ID '.$ID.')' ); // should never happen!222 debug_die( 'Tried to register already registered Plugin (ID '.$ID.')' ); // should never happen!
296 }223 }
297
298 $Timer->resume( 'plugins_register' );224 $Timer->resume( 'plugins_register' );
299225 if( empty( $classfile_path ) )
300 if( empty($classfile_path) )
301 {226 {
302 $plugin_filename = '_'.str_replace( '_plugin', '.plugin', $classname ).'.php';227 $plugin_filename = '_'.str_replace( '_plugin', '.plugin', $classname ).'.php';
303 // Try <plug_classname>/<plug_classname>.php (subfolder) first228 // Try <plug_classname>/<plug_classname>.php (subfolder) first
304 $classfile_path = $this->plugins_path.$classname.'/'.$plugin_filename;229 $classfile_path = $this->plugins_path.$classname.'/'.$plugin_filename;
305 /**230 # NOTE: next two lines makes folders be plugin_feature intead of feature_plugin
306 * @todo EdB: next two lines makes folders be plugin_feature intead of feature_plugin231 # $plugin_foldername = 'plugin_'.str_replace( '_plugin', '', $classname );
307 * $plugin_foldername = 'plugin_'.str_replace( '_plugin', '', $classname );232 # $classfile_path = $this->plugins_path.$plugin_foldername.'/'.$plugin_filename;
308 * $classfile_path = $this->plugins_path.$plugin_foldername.'/'.$plugin_filename;
309 */
310
311 if( ! is_readable( $classfile_path ) )233 if( ! is_readable( $classfile_path ) )
312 { // Look directly in $plugins_path234 {
235 // Look directly in $plugins_path
313 $classfile_path = $this->plugins_path.$plugin_filename;236 $classfile_path = $this->plugins_path.$plugin_filename;
314 }237 }
315 }238 }
316
317 $Debuglog->add( 'register(): '.$classname.', ID: '.$ID.', priority: '.$priority.', classfile_path: ['.$classfile_path.']', 'plugins' );
318
319 if( ! is_readable( $classfile_path ) )239 if( ! is_readable( $classfile_path ) )
320 { // Plugin file not found!240 {
241 // Plugin file not found!
321 if( $must_exists )242 if( $must_exists )
322 {243 {
323 $r = 'Plugin class file ['.rel_path_to_base($classfile_path).'] is not readable!';244 $r = 'Plugin class file ['.rel_path_to_base( $classfile_path ).'] is not readable!';
324 $Debuglog->add( $r, array( 'plugins', 'error' ) );
325245
326 // Get the Plugin object (must not exist)246 // Get the Plugin object (must not exist)
327 $Plugin = & $this->register( $classname, $ID, $priority, $apply_rendering, $classfile_path, false );247 $Plugin = & $this->register( $classname, $ID, $priority, $apply_rendering, $classfile_path, false );
@@ -331,7 +251,7 @@
331 // unregister:251 // unregister:
332 if( $this->unregister( $Plugin ) )252 if( $this->unregister( $Plugin ) )
333 {253 {
334 $Debuglog->add( 'Unregistered plugin ['.$classname.']!', array( 'plugins', 'error' ) );254 // debuglog-add removed
335 }255 }
336 else256 else
337 {257 {
@@ -339,33 +259,29 @@
339 $Timer->pause( 'plugins_register' );259 $Timer->pause( 'plugins_register' );
340 return $Plugin;260 return $Plugin;
341 }261 }
342
343 $Timer->pause( 'plugins_register' );262 $Timer->pause( 'plugins_register' );
344 return $r;263 return $r;
345 }264 }
346 }265 }
347 elseif( ! class_exists($classname) ) // If there are several copies of one plugin for example..266 elseif( ! class_exists( $classname ) ) // If there are several copies of one plugin for example..
348 {267 {
349 $Debuglog->add( 'Loading plugin class file: '.$classname, 'plugins' );
350 require_once $classfile_path;268 require_once $classfile_path;
351 }269 }
352270
353 if( ! class_exists( $classname ) )271 if( ! class_exists( $classname ) )
354 { // the given class does not exist272 {
273 // the given class does not exist
355 if( $must_exists )274 if( $must_exists )
356 {275 {
357 $r = sprintf( 'Plugin class for &laquo;%s&raquo; in file &laquo;%s&raquo; not defined.', $classname, rel_path_to_base($classfile_path) );276 $r = sprintf( 'Plugin class for &laquo;%s&raquo; in file &laquo;%s&raquo; not defined.', $classname, rel_path_to_base( $classfile_path ) );
358 $Debuglog->add( $r, array( 'plugins', 'error' ) );277 // Get the Plugin object (must not exist) fp> why is this recursive?
359
360 // Get the Plugin object (must not exist) fp> why is this recursive?
361 $Plugin = & $this->register( $classname, $ID, $priority, $apply_rendering, $classfile_path, false );278 $Plugin = & $this->register( $classname, $ID, $priority, $apply_rendering, $classfile_path, false );
362 $this->plugin_errors[$ID]['register'] = $r;279 $this->plugin_errors[$ID]['register'] = $r;
363 $this->set_Plugin_status( $Plugin, 'broken' );280 $this->set_Plugin_status( $Plugin, 'broken' );
364
365 // unregister:281 // unregister:
366 if( $this->unregister( $Plugin ) )282 if( $this->unregister( $Plugin ) )
367 {283 {
368 $Debuglog->add( 'Unregistered plugin ['.$classname.']!', array( 'plugins', 'error' ) );284 // debuglog-add removed
369 }285 }
370 else286 else
371 {287 {
@@ -373,24 +289,21 @@
373 $Timer->pause( 'plugins_register' );289 $Timer->pause( 'plugins_register' );
374 return $Plugin;290 return $Plugin;
375 }291 }
376
377 $Timer->pause( 'plugins_register' );292 $Timer->pause( 'plugins_register' );
378 return $r;293 return $r;
379 }294 }
380 else295 else
381 {296 {
382 $Plugin = new Plugin; // COPY !297 $Plugin = new Plugin; // COPY !
383 $Plugin->code = NULL;298 $Plugin->code = NULL;
384 $Plugin->apply_rendering = 'never';299 $Plugin->apply_rendering = 'never';
385 }300 }
386 }301 }
387 else302 else
388 {303 {
389 $Plugin = new $classname; // COPY !304 $Plugin = new $classname; // COPY !
390 }305 }
391
392 $Plugin->classfile_path = $classfile_path;306 $Plugin->classfile_path = $classfile_path;
393
394 // Tell him his ID :)307 // Tell him his ID :)
395 if( $ID == 0 )308 if( $ID == 0 )
396 {309 {
@@ -399,9 +312,9 @@
399 else312 else
400 {313 {
401 $Plugin->ID = $ID;314 $Plugin->ID = $ID;
402
403 if( $ID > 0 )315 if( $ID > 0 )
404 { // Properties from T_plugins316 {
317 // Properties from T_plugins
405 // Code318 // Code
406 $Plugin->code = $this->index_ID_rows[$Plugin->ID]['plug_code'];319 $Plugin->code = $this->index_ID_rows[$Plugin->ID]['plug_code'];
407 // Status320 // Status
@@ -413,30 +326,33 @@
413 // Tell him his priority:326 // Tell him his priority:
414 if( $priority > -1 ) { $Plugin->priority = $priority; }327 if( $priority > -1 ) { $Plugin->priority = $priority; }
415328
416 if( isset($apply_rendering) )329 if( isset( $apply_rendering ) )
417 {330 {
418 $Plugin->apply_rendering = $apply_rendering;331 $Plugin->apply_rendering = $apply_rendering;
419 }332 }
420333
421 if( empty($Plugin->name) )334 if( empty( $Plugin->name ) )
422 {335 {
423 $Plugin->name = $Plugin->classname;336 $Plugin->name = $Plugin->classname;
424 }337 }
425338
426 $orig_code = $Plugin->code;339 $orig_code = $Plugin->code;
427 if( ! empty($this->index_code_ID[ $Plugin->code ]) && $this->index_code_ID[ $Plugin->code ] != $Plugin->ID )340 if( ! empty( $this->index_code_ID[$Plugin->code] ) && $this->index_code_ID[$Plugin->code] != $Plugin->ID )
428 { // The plugin's default code is already in use!341 {
342 // The plugin's default code is already in use!
429 $Plugin->code = NULL;343 $Plugin->code = NULL;
430 }344 }
431 else345 else
432 {346 {
433 $this->index_code_Plugins[ $Plugin->code ] = & $Plugin;347 $this->index_code_Plugins[$Plugin->code] = & $Plugin;
434 $this->index_code_ID[ $Plugin->code ] = & $Plugin->ID;348 $this->index_code_ID[$Plugin->code] = & $Plugin->ID;
435 }349 }
436 $this->index_ID_Plugins[ $Plugin->ID ] = & $Plugin;350 $this->index_ID_Plugins[$Plugin->ID] = & $Plugin;
437351
438 if( ! in_array( $Plugin->ID, $this->sorted_IDs ) ) // TODO: check if this extra check is required..352 // @todo (0000) check if this extra check is required...
439 { // not in our sort index yet353 if( ! in_array( $Plugin->ID, $this->sorted_IDs ) )
354 {
355 // not in our sort index yet
440 $this->sorted_IDs[] = & $Plugin->ID;356 $this->sorted_IDs[] = & $Plugin->ID;
441 }357 }
442358
@@ -449,56 +365,56 @@
449 $tmp_params = array( 'db_row' => $this->index_ID_rows[$Plugin->ID], 'is_installed' => true );365 $tmp_params = array( 'db_row' => $this->index_ID_rows[$Plugin->ID], 'is_installed' => true );
450 if( $Plugin->PluginInit( $tmp_params ) === false && $this->unregister( $Plugin ) )366 if( $Plugin->PluginInit( $tmp_params ) === false && $this->unregister( $Plugin ) )
451 {367 {
452 $Debuglog->add( 'Unregistered plugin, because PluginInit returned false.', 'plugins' );
453 $Plugin = '';368 $Plugin = '';
454 }369 }
455 // Version check:370 // Version check:
456 elseif( $Plugin->version != $this->index_ID_rows[$Plugin->ID]['plug_version'] && $must_exists )371 elseif( $Plugin->version != $this->index_ID_rows[$Plugin->ID]['plug_version'] && $must_exists )
457 { // Version has changed since installation or last update372 {
373 // Version has changed since installation or last update
458 $db_deltas = array();374 $db_deltas = array();
459375
460 // Tell the Plugin that we've detected a version change:376 // Tell the Plugin that we've detected a version change:
461 $tmp_params = array( 'old_version'=>$this->index_ID_rows[$Plugin->ID]['plug_version'], 'db_row'=>$this->index_ID_rows[$Plugin->ID] );377 $tmp_params = array( 'old_version' => $this->index_ID_rows[$Plugin->ID]['plug_version'], 'db_row' => $this->index_ID_rows[$Plugin->ID] );
462378
463 if( $this->call_method( $Plugin->ID, 'PluginVersionChanged', $tmp_params ) === false )379 if( $this->call_method( $Plugin->ID, 'PluginVersionChanged', $tmp_params ) === false )
464 {380 {
465 $Debuglog->add( 'Set plugin status to "needs_config", because PluginVersionChanged returned false.', 'plugins' );
466 $this->set_Plugin_status( $Plugin, 'needs_config' );381 $this->set_Plugin_status( $Plugin, 'needs_config' );
467 if( $this->unregister( $Plugin ) )382 if( $this->unregister( $Plugin ) )
468 { // only unregister the Plugin, if it's not the admin list's class:383 {
384 // only unregister the Plugin, if it's not the admin list's class:
469 $Plugin = '';385 $Plugin = '';
470 }386 }
471 }387 }
472 else388 else
473 {389 {
474 // Check if there are DB deltas required (also when downgrading!), without excluding any query type:390 // Check if there are DB deltas required (also when downgrading!), without excluding any query type:
475 load_funcs('_core/model/db/_upgrade.funcs.php');391 load_funcs( '_core/model/db/_upgrade.funcs.php' );
476 $db_deltas = db_delta( $Plugin->GetDbLayout() );392 $db_deltas = db_delta( $Plugin->GetDbLayout() );
477393
478 if( empty($db_deltas) )394 if( empty( $db_deltas ) )
479 { // No DB changes needed, update (bump or decrease) the version395 {
480 global $DB;396 global $DB;
397
398 // No DB changes needed, update (bump or decrease) the version
481 $Plugins_admin = & get_Cache('Plugins_admin');399 $Plugins_admin = & get_Cache('Plugins_admin');
482400
483 // Update version in DB:401 // Update version in DB:
484 $DB->query( '402 $DB->query( 'UPDATE T_plugins
485 UPDATE T_plugins403 SET plug_version = '.$DB->quote( $Plugin->version ).'
486 SET plug_version = '.$DB->quote($Plugin->version).'404 WHERE plug_ID = '.$Plugin->ID );
487 WHERE plug_ID = '.$Plugin->ID );
488405
489 // Update "plug_version" in indexes:406 // Update "plug_version" in indexes:
490 $this->index_ID_rows[$Plugin->ID]['plug_version'] = $Plugin->version;407 $this->index_ID_rows[$Plugin->ID]['plug_version'] = $Plugin->version;
491 if( isset($Plugins_admin->index_ID_rows[$Plugin->ID]) )408 if( isset( $Plugins_admin->index_ID_rows[$Plugin->ID] ) )
492 {409 {
493 $Plugins_admin->index_ID_rows[$Plugin->ID]['plug_version'] = $Plugin->version;410 $Plugins_admin->index_ID_rows[$Plugin->ID]['plug_version'] = $Plugin->version;
494 }411 }
495412
496 // Remove any prerenderered content for the Plugins renderer code:413 // Remove any prerenderered content for the Plugins renderer code:
497 if( ! empty($Plugin->code) )414 if( ! empty( $Plugin->code ) )
498 {415 {
499 $DB->query( '416 $DB->query( 'DELETE FROM T_items__prerendering
500 DELETE FROM T_items__prerendering417 WHERE itpr_renderers REGEXP "^(.*\.)?'.$DB->escape( $Plugin->code ).'(\..*)?$"' );
501 WHERE itpr_renderers REGEXP "^(.*\.)?'.$DB->escape($Plugin->code).'(\..*)?$"' );
502 }418 }
503419
504 // Detect new events (and delete obsolete ones - in case of downgrade):420 // Detect new events (and delete obsolete ones - in case of downgrade):
@@ -506,26 +422,22 @@
506 {422 {
507 $this->load_events(); // re-load for the current request423 $this->load_events(); // re-load for the current request
508 }424 }
509
510 $Debuglog->add( 'Version for '.$Plugin->classname.' changed from '.$this->index_ID_rows[$Plugin->ID]['plug_version'].' to '.$Plugin->version, 'plugins' );
511 }425 }
512 else426 else
513 { // If there are DB schema changes needed, set the Plugin status to "needs_config"427 {
514428 // If there are DB schema changes needed, set the Plugin status to "needs_config"
515 // TODO: automatic upgrade in some cases (e.g. according to query types)?
516
517 $this->set_Plugin_status( $Plugin, 'needs_config' );429 $this->set_Plugin_status( $Plugin, 'needs_config' );
518 $Debuglog->add( 'Set plugin status to "needs_config", because version DB schema needs upgrade.', 'plugins' );
519430
520 if( $this->unregister( $Plugin ) )431 if( $this->unregister( $Plugin ) )
521 { // only unregister the Plugin, if it's not the admin list's class:432 {
433 // only unregister the Plugin, if it's not the admin list's class:
522 $Plugin = '';434 $Plugin = '';
523 }435 }
524 }436 }
525 }437 }
526 }438 }
527439
528 if( $Plugin && isset($this->index_ID_rows[$Plugin->ID]) ) // may have been unregistered above440 if( $Plugin && isset( $this->index_ID_rows[$Plugin->ID] ) ) // may have been unregistered above
529 {441 {
530 if( $this->index_ID_rows[$Plugin->ID]['plug_name'] !== NULL )442 if( $this->index_ID_rows[$Plugin->ID]['plug_name'] !== NULL )
531 {443 {
@@ -538,13 +450,12 @@
538 }450 }
539 }451 }
540 else452 else
541 { // This gets called for non-installed Plugins:453 {
454 // This gets called for non-installed Plugins:
542 // We're not instantiating UserSettings/Settings, since that needs a DB backend.455 // We're not instantiating UserSettings/Settings, since that needs a DB backend.
543
544 $tmp_params = array( 'db_row' => array(), 'is_installed' => false );456 $tmp_params = array( 'db_row' => array(), 'is_installed' => false );
545 if( $Plugin->PluginInit( $tmp_params ) === false && $this->unregister( $Plugin ) )457 if( $Plugin->PluginInit( $tmp_params ) === false && $this->unregister( $Plugin ) )
546 {458 {
547 $Debuglog->add( 'Unregistered plugin, because PluginInit returned false.', 'plugins' );
548 $Plugin = '';459 $Plugin = '';
549 }460 }
550 }461 }
@@ -556,22 +467,19 @@
556467
557468
558 /**469 /**
559 * Un-register a plugin.470 * Un-register a plugin
560 *471 *
561 * This does not un-install it from DB, just from the internal indexes.472 * This does not un-install it from DB, just from the internal indexes.
562 *
563 * @param Plugin473 * @param Plugin
564 * @param boolean Force unregistering (ignored here, but used in Plugins_admin)474 * @param boolean Force unregistering (ignored here, but used in Plugins_admin)
565 * @return boolean True, if unregistered475 * @return boolean True, if unregistered
566 */476 */
567 function unregister( & $Plugin, $force = false )477 function unregister( & $Plugin, $force = false )
568 {478 {
569 global $Debuglog;
570
571 $this->forget_events( $Plugin->ID );479 $this->forget_events( $Plugin->ID );
572480
573 // Unset apply-rendering index:481 // Unset apply-rendering index:
574 if( isset( $this->index_apply_rendering_codes[ $Plugin->apply_rendering ] ) )482 if( isset( $this->index_apply_rendering_codes[$Plugin->apply_rendering] ) )
575 {483 {
576 while( ( $key = array_search( $Plugin->code, $this->index_apply_rendering_codes[$Plugin->apply_rendering] ) ) !== false )484 while( ( $key = array_search( $Plugin->code, $this->index_apply_rendering_codes[$Plugin->apply_rendering] ) ) !== false )
577 {485 {
@@ -579,25 +487,27 @@
579 }487 }
580 }488 }
581489
582 unset( $this->index_code_Plugins[ $Plugin->code ] );490 unset( $this->index_code_Plugins[$Plugin->code] );
583 unset( $this->index_ID_Plugins[ $Plugin->ID ] );491 unset( $this->index_ID_Plugins[$Plugin->ID] );
584492
585 if( isset($this->index_ID_rows[ $Plugin->ID ]) )493 if( isset( $this->index_ID_rows[$Plugin->ID] ) )
586 { // It has an associated DB row (load_plugins_table() was called)494 {
587 unset($this->index_ID_rows[ $Plugin->ID ]);495 // It has an associated DB row (load_plugins_table() was called)
496 unset( $this->index_ID_rows[$Plugin->ID] );
588 }497 }
589498
590 $sort_key = array_search( $Plugin->ID, $this->sorted_IDs );499 $sort_key = array_search( $Plugin->ID, $this->sorted_IDs );
591 if( $sort_key === false )500 if( $sort_key === false )
592 { // this may happen if a Plugin has unregistered itself501 {
593 $Debuglog->add( 'Tried to unregister not-installed plugin (not in $sorted_IDs)!', 'plugins' );502 // this may happen if a Plugin has unregistered itself
594 return false;503 return false;
595 }504 }
596 unset( $this->sorted_IDs[$sort_key] );505 unset( $this->sorted_IDs[$sort_key] );
597 $this->sorted_IDs = array_values( $this->sorted_IDs );506 $this->sorted_IDs = array_values( $this->sorted_IDs );
598507
599 if( $this->current_idx >= $sort_key )508 if( $this->current_idx >= $sort_key )
600 { // We have removed a file before or at the $sort_key'th position509 {
510 // We have removed a file before or at the $sort_key'th position
601 $this->current_idx--;511 $this->current_idx--;
602 }512 }
603513
@@ -606,20 +516,19 @@
606516
607517
608 /**518 /**
609 * Forget the events a Plugin has registered.519 * Forget the events a Plugin has registered
610 *520 *
611 * This gets used when {@link unregister() unregistering} a Plugin or if521 * This gets used when {@link unregister() unregistering} a Plugin or if
612 * {@link Plugin::PluginInit()} returned false, which means522 * {@link Plugin::PluginInit()} returned false, which means
613 * "do not use it for subsequent events in the request".523 * "do not use it for subsequent events in the request".
614 *
615 * @param integer Plugin ID524 * @param integer Plugin ID
616 */525 */
617 function forget_events( $plugin_ID )526 function forget_events( $plugin_ID )
618 {527 {
619 // Forget events:528 // Forget events:
620 foreach( array_keys($this->index_event_IDs) as $l_event )529 foreach( array_keys( $this->index_event_IDs ) as $l_event )
621 {530 {
622 while( ($key = array_search( $plugin_ID, $this->index_event_IDs[$l_event] )) !== false )531 while( ( $key = array_search( $plugin_ID, $this->index_event_IDs[$l_event] ) ) !== false )
623 {532 {
624 unset( $this->index_event_IDs[$l_event][$key] );533 unset( $this->index_event_IDs[$l_event][$key] );
625 }534 }
@@ -628,49 +537,29 @@
628537
629538
630 /**539 /**
631 * Init {@link Plugin::$Settings} and {@link Plugin::$UserSettings}, either by540 * Init {@link Plugin::$Settings} and {@link Plugin::$UserSettings}
632 * unsetting them for PHP5's overloading or instantiating them for PHP4.
633 *
634 * This only gets used for installed plugins, but we're initing it for PHP 5.1,
635 * to trigger a helpful error, when e.g. Plugin::Settings gets accessed in PluginInit().
636 *
637 * @param Plugin541 * @param Plugin
638 */542 */
639 function init_settings( & $Plugin )543 function init_settings( & $Plugin )
640 {544 {
641 if( version_compare( PHP_VERSION, '5.1', '>=' ) )545 unset( $Plugin->Settings );
642 { // we use overloading for PHP5, therefor the member has to be unset:546 unset( $Plugin->UserSettings );
643 // Note: this is somehow buggy at least in PHP 5.0.5, therefor we use it from 5.1 on.547 return;
644 // see http://forums.b2evolution.net/viewtopic.php?p=49031#49031
645 unset( $Plugin->Settings );
646 unset( $Plugin->UserSettings );
647
648 // Nothing to do here, will get called through Plugin::__get() when accessed
649 return;
650 }
651
652 // PHP < 5.1: instantiate now, but only for installed plugins (needs DB).
653 if( $Plugin->ID > 0 )
654 {
655 $this->instantiate_Settings( $Plugin, 'Settings' );
656 $this->instantiate_Settings( $Plugin, 'UserSettings' );
657 }
658 }548 }
659549
660550
661 /**551 /**
662 * Instantiate Settings object (class {@link PluginSettings}) for the given plugin.552 * Instantiate Settings object (class {@link PluginSettings}) for the given plugin
663 *553 *
664 * The plugin must provide setting definitions (through {@link Plugin::GetDefaultSettings()}554 * The plugin must provide setting definitions (through {@link Plugin::GetDefaultSettings()}
665 * OR {@link Plugin::GetDefaultUserSettings()}).555 * OR {@link Plugin::GetDefaultUserSettings()}).
666 *
667 * @param Plugin556 * @param Plugin
668 * @param string settings type: "Settings" or "UserSettings"557 * @param string settings type: "Settings" or "UserSettings"
669 * @return boolean NULL, if no Settings558 * @return boolean NULL, if no Settings
670 */559 */
671 function instantiate_Settings( & $Plugin, $set_type )560 function instantiate_Settings( & $Plugin, $set_type )
672 {561 {
673 global $Debuglog, $Timer;562 global $Timer;
674563
675 $Timer->resume( 'plugins_inst_'.$set_type );564 $Timer->resume( 'plugins_inst_'.$set_type );
676565
@@ -679,35 +568,34 @@
679 // This may happen, if Plugin(User)Settings get accessed in PluginInit (which is allowed568 // This may happen, if Plugin(User)Settings get accessed in PluginInit (which is allowed
680 // when is_installed=true).569 // when is_installed=true).
681 $method = 'GetDefault'.$set_type;570 $method = 'GetDefault'.$set_type;
682 $params = array('for_editing'=>false);571 $params = array( 'for_editing' => false );
683 $Timer->resume( $Plugin->classname.'_(#'.$Plugin->ID.')' );572 $Timer->resume( $Plugin->classname.'_(#'.$Plugin->ID.')' );
684 $defaults = $Plugin->$method( $params );573 $defaults = $Plugin->$method( $params );
685 $Timer->pause( $Plugin->classname.'_(#'.$Plugin->ID.')' );574 $Timer->pause( $Plugin->classname.'_(#'.$Plugin->ID.')' );
686575
687 if( empty($defaults) )576 if( empty( $defaults ) )
688 { // No settings, no need to instantiate.577 {
578 // No settings, no need to instantiate.
689 $Timer->pause( 'plugins_inst_'.$set_type );579 $Timer->pause( 'plugins_inst_'.$set_type );
690 return NULL;580 return NULL;
691 }581 }
692582
693 if( ! is_array($defaults) )583 if( ! is_array( $defaults ) )
694 { // invalid data584 {
695 $Debuglog->add( $Plugin->classname.'::GetDefault'.$set_type.'() did not return array!', array('plugins', 'error') );585 // invalid data
696 return NULL; // fp> correct me if I'm wrong.586 return NULL; // fp> correct me if I'm wrong.
697 }587 }
698588
699 if( $set_type == 'UserSettings' )589 if( $set_type == 'UserSettings' )
700 { // User specific settings:590 {
701 load_class('plugins/model/_pluginusersettings.class.php');591 // User specific settings
702
703 $Plugin->UserSettings = new PluginUserSettings( $Plugin->ID );592 $Plugin->UserSettings = new PluginUserSettings( $Plugin->ID );
704593
705 $set_Obj = & $Plugin->UserSettings;594 $set_Obj = & $Plugin->UserSettings;
706 }595 }
707 else596 else
708 { // Global settings:597 {
709 load_class('plugins/model/_pluginsettings.class.php');598 // Global settings
710
711 $Plugin->Settings = new PluginSettings( $Plugin->ID );599 $Plugin->Settings = new PluginSettings( $Plugin->ID );
712600
713 $set_Obj = & $Plugin->Settings;601 $set_Obj = & $Plugin->Settings;
@@ -716,13 +604,14 @@
716 // Register default values:604 // Register default values:
717 foreach( $defaults as $l_name => $l_meta )605 foreach( $defaults as $l_name => $l_meta )
718 {606 {
719 if( isset($l_meta['layout']) )607 if( isset( $l_meta['layout'] ) )
720 { // Skip non-value entries608 {
609 // Skip non-value entries
721 continue;610 continue;
722 }611 }
723612
724 // Register settings as _defaults into Settings:613 // Register settings as _defaults into Settings:
725 if( isset($l_meta['defaultvalue']) )614 if( isset( $l_meta['defaultvalue'] ) )
726 {615 {
727 $set_Obj->_defaults[$l_name] = $l_meta['defaultvalue'];616 $set_Obj->_defaults[$l_name] = $l_meta['defaultvalue'];
728 }617 }
@@ -743,7 +632,7 @@
743632
744633
745 /**634 /**
746 * Load plugins table and rewind iterator used by {@link get_next()}.635 * Load plugins table and rewind iterator used by {@link get_next()}
747 */636 */
748 function restart()637 function restart()
749 {638 {
@@ -754,36 +643,30 @@
754643
755644
756 /**645 /**
757 * Get next plugin in the list.646 * Get next plugin in the list
758 *647 *
759 * NOTE: You'll have to call {@link restart()} or {@link load_plugins_table()}648 * NOTE: You'll have to call {@link restart()} or {@link load_plugins_table()}
760 * before using it.649 * before using it.
761 *
762 * @return Plugin (false if no more plugin).650 * @return Plugin (false if no more plugin).
763 */651 */
764 function & get_next()652 function & get_next()
765 {653 {
766 global $Debuglog;
767
768 ++$this->current_idx;654 ++$this->current_idx;
769655
770 $Debuglog->add( 'get_next() ('.$this->current_idx.')..', 'plugins' );656 if( isset( $this->sorted_IDs[$this->current_idx] ) )
771
772 if( isset($this->sorted_IDs[$this->current_idx]) )
773 {657 {
774 $Plugin = & $this->get_by_ID( $this->sorted_IDs[$this->current_idx] );658 $Plugin = & $this->get_by_ID( $this->sorted_IDs[$this->current_idx] );
775659
776 if( ! $Plugin )660 if( ! $Plugin )
777 { // recurse until we've been through whole $sorted_IDs!661 {
662 // recurse until we've been through whole $sorted_IDs!
778 return $this->get_next();663 return $this->get_next();
779 }664 }
780665
781 $Debuglog->add( 'return: '.$Plugin->classname.' ('.$Plugin->ID.')', 'plugins' );
782 return $Plugin;666 return $Plugin;
783 }667 }
784 else668 else
785 {669 {
786 $Debuglog->add( 'return: false', 'plugins' );
787 --$this->current_idx;670 --$this->current_idx;
788 $r = false;671 $r = false;
789 return $r;672 return $r;
@@ -801,32 +684,26 @@
801684
802685
803 /**686 /**
804 * Call all plugins for a given event.687 * Call all plugins for a given event
805 *
806 * @param string event name, see {@link Plugins_admin::get_supported_events()}688 * @param string event name, see {@link Plugins_admin::get_supported_events()}
807 * @param array Associative array of parameters for the Plugin689 * @param array Associative array of parameters for the Plugin
808 * @return boolean True, if at least one plugin has been called.690 * @return boolean True, if at least one plugin has been called.
809 */691 */
810 function trigger_event( $event, $params = array() )692 function trigger_event( $event, $params = array() )
811 {693 {
812 global $Debuglog;694 if( empty( $this->index_event_IDs[$event] ) )
813695 {
814 $Debuglog->add( 'Trigger event '.$event, 'plugins' );696 // No events registered
815
816 if( empty($this->index_event_IDs[$event]) )
817 { // No events registered
818 $Debuglog->add( 'No registered plugins.', 'plugins' );
819 return false;697 return false;
820 }698 }
821699
822 $Debuglog->add( 'Registered plugin IDs: '.implode( ', ', $this->index_event_IDs[$event]), 'plugins' );
823
824 foreach( $this->index_event_IDs[$event] as $l_plugin_ID )700 foreach( $this->index_event_IDs[$event] as $l_plugin_ID )
825 {701 {
826 $this->call_method( $l_plugin_ID, $event, $params );702 $this->call_method( $l_plugin_ID, $event, $params );
827703
828 if( ! empty($this->_stop_propagation) )704 if( ! empty( $this->_stop_propagation ) )
829 { // A plugin has requested to stop propagation.705 {
706 // A plugin has requested to stop propagation.
830 $this->_stop_propagation = false;707 $this->_stop_propagation = false;
831 break;708 break;
832 }709 }
@@ -836,32 +713,25 @@
836713
837714
838 /**715 /**
839 * Call all plugins for a given event, until the first one returns true.716 * Call all plugins for a given event, until the first one returns true
840 *
841 * @param string event name, see {@link Plugins_admin::get_supported_events()}717 * @param string event name, see {@link Plugins_admin::get_supported_events()}
842 * @param array Associative array of parameters for the Plugin718 * @param array Associative array of parameters for the Plugin
843 * @return array The (modified) params array with key "plugin_ID" set to the last called plugin;719 * @return array The (modified) params array with key "plugin_ID" set to the last called plugin;
844 * Empty array if no Plugin returned true or no Plugin has this event registered.720 * Empty array if no Plugin returned true or no Plugin has this event registered.
845 */721 */
846 function trigger_event_first_true( $event, $params = NULL )722 function trigger_event_first_true( $event, $params = NULL )
847 {723 {
848 global $Debuglog;
849
850 $Debuglog->add( 'Trigger event '.$event.' (first true)', 'plugins' );
851
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches