[geeklog-cvs] geeklog: Moved "Login required" message to new function SEC_logi...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jan 17 10:38:46 EST 2010
changeset 7602:ec4f2b07a916
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/ec4f2b07a916
user: Dirk Haun <dirk at haun-online.de>
date: Sun Jan 17 10:53:04 2010 +0100
description:
Moved "Login required" message to new function SEC_loginRequiredForm() to avoid code duplication and allow for easy modification
diffstat:
plugins/calendar/autoinstall.php | 6 ++-
plugins/links/autoinstall.php | 6 ++-
plugins/polls/autoinstall.php | 6 ++-
plugins/staticpages/autoinstall.php | 6 ++-
plugins/staticpages/services.inc.php | 23 ++---------
public_html/calendar/index.php | 17 +-------
public_html/directory.php | 20 ++--------
public_html/links/index.php | 17 +-------
public_html/polls/index.php | 17 +-------
public_html/profiles.php | 34 ++---------------
public_html/stats.php | 19 +--------
public_html/submit.php | 17 +-------
public_html/users.php | 16 +-------
public_html/usersettings.php | 23 ++---------
system/classes/search.class.php | 42 +-------------------
system/lib-comment.php | 55 ++++-----------------------
system/lib-security.php | 34 ++++++++++++++++-
17 files changed, 94 insertions(+), 264 deletions(-)
diffs (truncated from 678 to 300 lines):
diff -r 5bfa86f7ad20 -r ec4f2b07a916 plugins/calendar/autoinstall.php
--- a/plugins/calendar/autoinstall.php Sun Jan 17 10:20:29 2010 +0100
+++ b/plugins/calendar/autoinstall.php Sun Jan 17 10:53:04 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | This file provides helper functions for the automatic plugin install. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2008-2009 by the following authors: |
+// | Copyright (C) 2008-2010 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
@@ -137,6 +137,10 @@
return false;
}
+ if (!function_exists('SEC_loginRequiredForm')) {
+ return false;
+ }
+
return true;
}
diff -r 5bfa86f7ad20 -r ec4f2b07a916 plugins/links/autoinstall.php
--- a/plugins/links/autoinstall.php Sun Jan 17 10:20:29 2010 +0100
+++ b/plugins/links/autoinstall.php Sun Jan 17 10:53:04 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | This file provides helper functions for the automatic plugin install. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2008-2009 by the following authors: |
+// | Copyright (C) 2008-2010 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
@@ -188,6 +188,10 @@
return false;
}
+ if (!function_exists('SEC_loginRequiredForm')) {
+ return false;
+ }
+
return true;
}
diff -r 5bfa86f7ad20 -r ec4f2b07a916 plugins/polls/autoinstall.php
--- a/plugins/polls/autoinstall.php Sun Jan 17 10:20:29 2010 +0100
+++ b/plugins/polls/autoinstall.php Sun Jan 17 10:53:04 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | This file provides helper functions for the automatic plugin install. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2008-2009 by the following authors: |
+// | Copyright (C) 2008-2010 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
@@ -150,6 +150,10 @@
return false;
}
+ if (! function_exists('SEC_loginRequiredForm')) {
+ return false;
+ }
+
return true;
}
diff -r 5bfa86f7ad20 -r ec4f2b07a916 plugins/staticpages/autoinstall.php
--- a/plugins/staticpages/autoinstall.php Sun Jan 17 10:20:29 2010 +0100
+++ b/plugins/staticpages/autoinstall.php Sun Jan 17 10:53:04 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | This file provides helper functions for the automatic plugin install. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2008-2009 by the following authors: |
+// | Copyright (C) 2008-2010 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
@@ -150,6 +150,10 @@
return false;
}
+ if (! function_exists('SEC_loginRequiredForm')) {
+ return false;
+ }
+
return true;
}
diff -r 5bfa86f7ad20 -r ec4f2b07a916 plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php Sun Jan 17 10:20:29 2010 +0100
+++ b/plugins/staticpages/services.inc.php Sun Jan 17 10:53:04 2010 +0100
@@ -60,7 +60,7 @@
function service_submit_staticpages($args, &$output, &$svc_msg)
{
global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG12, $LANG_STATIC,
- $LANG_LOGIN, $_GROUPS, $_SP_CONF;
+ $_GROUPS, $_SP_CONF;
if (version_compare(PHP_VERSION, '5.0.0', '>=') &&
(! $_CONF['disable_webservices'])) {
@@ -442,8 +442,7 @@
*/
function service_delete_staticpages($args, &$output, &$svc_msg)
{
- global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG12, $LANG_STATIC,
- $LANG_LOGIN;
+ global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG12, $LANG_STATIC;
$output = COM_refresh($_CONF['site_admin_url']
. '/plugins/staticpages/index.php?msg=20');
@@ -493,7 +492,7 @@
*/
function service_get_staticpages($args, &$output, &$svc_msg)
{
- global $_CONF, $_TABLES, $LANG_ACCESS, $LANG12, $LANG_STATIC, $LANG_LOGIN, $_SP_CONF;
+ global $_CONF, $_TABLES, $LANG_ACCESS, $LANG12, $LANG_STATIC, $_SP_CONF;
$output = '';
@@ -617,21 +616,7 @@
if ($mode !== 'autotag') {
$output = COM_siteHeader('menu');
}
- $output .= COM_startBlock($LANG_LOGIN[1], '',
- COM_getBlockTemplate('_msg_block', 'header'));
- $login = new Template($_CONF['path_layout'] . 'submit');
- $login->set_file(array('login' => 'submitloginrequired.thtml'));
- $login->set_var('xhtml', XHTML);
- $login->set_var('site_url', $_CONF['site_url']);
- $login->set_var('site_admin_url', $_CONF['site_admin_url']);
- $login->set_var('layout_url', $_CONF['layout_url']);
- $login->set_var('login_message', $LANG_LOGIN[2]);
- $login->set_var('lang_login', $LANG_LOGIN[3]);
- $login->set_var('lang_newuser', $LANG_LOGIN[4]);
- $login->parse('output', 'login');
- $output .= $login->finish($login->get_var('output'));
- $output .= COM_endBlock(COM_getBlockTemplate('_msg_block',
- 'footer'));
+ $output .= SEC_loginRequiredForm();
if ($mode !== 'autotag') {
$output .= COM_siteFooter(true);
}
diff -r 5bfa86f7ad20 -r ec4f2b07a916 public_html/calendar/index.php
--- a/public_html/calendar/index.php Sun Jan 17 10:20:29 2010 +0100
+++ b/public_html/calendar/index.php Sun Jan 17 10:53:04 2010 +0100
@@ -45,21 +45,8 @@
if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_CA_CONF['calendarloginrequired'] == 1))) {
- $display .= COM_siteHeader('');
- $display .= COM_startBlock ($LANG_LOGIN[1], '',
- COM_getBlockTemplate ('_msg_block', 'header'));
- $login = new Template($_CONF['path_layout'] . 'submit');
- $login->set_file (array ('login'=>'submitloginrequired.thtml'));
- $login->set_var ( 'xhtml', XHTML );
- $login->set_var ('login_message', $LANG_LOGIN[2]);
- $login->set_var ('site_url', $_CONF['site_url']);
- $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
- $login->set_var ('layout_url', $_CONF['layout_url']);
- $login->set_var ('lang_login', $LANG_LOGIN[3]);
- $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
- $login->parse ('output', 'login');
- $display .= $login->finish ($login->get_var('output'));
- $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+ $display .= COM_siteHeader('menu', $LANG_CAL_1[41]);
+ $display .= SEC_loginRequiredForm();
$display .= COM_siteFooter();
COM_output($display);
exit;
diff -r 5bfa86f7ad20 -r ec4f2b07a916 public_html/directory.php
--- a/public_html/directory.php Sun Jan 17 10:20:29 2010 +0100
+++ b/public_html/directory.php Sun Jan 17 10:53:04 2010 +0100
@@ -46,22 +46,9 @@
if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
($_CONF['directoryloginrequired'] == 1))) {
- $display = COM_siteHeader ('menu', $LANG_DIR['title']);
- $display .= COM_startBlock ($LANG_LOGIN[1], '',
- COM_getBlockTemplate ('_msg_block', 'header'));
- $login = new Template ($_CONF['path_layout'] . 'submit');
- $login->set_file (array ('login' => 'submitloginrequired.thtml'));
- $login->set_var ('xhtml', XHTML);
- $login->set_var ('site_url', $_CONF['site_url']);
- $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
- $login->set_var ('layout_url', $_CONF['layout_url']);
- $login->set_var ('login_message', $LANG_LOGIN[2]);
- $login->set_var ('lang_login', $LANG_LOGIN[3]);
- $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
- $login->parse ('output', 'login');
- $display .= $login->finish ($login->get_var ('output'));
- $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
- $display .= COM_siteFooter ();
+ $display = COM_siteHeader('menu', $LANG_DIR['title']);
+ $display .= SEC_loginRequiredForm();
+ $display .= COM_siteFooter();
COM_output($display);
exit;
}
@@ -439,6 +426,7 @@
$ysql['mssql'] = $yearsql['mssql'] . " GROUP BY YEAR(date) ORDER BY YEAR(date) DESC";
$yresult = DB_query ($ysql);
+COM_errorLog($ysql['mysql']);
$numyears = DB_numRows ($yresult);
for ($i = 0; $i < $numyears; $i++) {
diff -r 5bfa86f7ad20 -r ec4f2b07a916 public_html/links/index.php
--- a/public_html/links/index.php Sun Jan 17 10:20:29 2010 +0100
+++ b/public_html/links/index.php Sun Jan 17 10:53:04 2010 +0100
@@ -440,21 +440,8 @@
if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_LI_CONF['linksloginrequired'] == 1))) {
- $display .= COM_siteHeader ('menu', $LANG_LINKS[114]);
- $display .= COM_startBlock ($LANG_LOGIN[1], '',
- COM_getBlockTemplate ('_msg_block', 'header'));
- $login = new Template ($_CONF['path_layout'] . 'submit');
- $login->set_file (array ('login' => 'submitloginrequired.thtml'));
- $login->set_var ('xhtml', XHTML);
- $login->set_var ('site_url', $_CONF['site_url']);
- $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
- $login->set_var ('layout_url', $_CONF['layout_url']);
- $login->set_var ('login_message', $LANG_LOGIN[2]);
- $login->set_var ('lang_login', $LANG_LOGIN[3]);
- $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
- $login->parse ('output', 'login');
- $display .= $login->finish ($login->get_var ('output'));
- $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+ $display .= COM_siteHeader('menu', $LANG_LINKS[114]);
+ $display .= SEC_loginRequiredForm();
} else {
$display .= links_list($message);
}
diff -r 5bfa86f7ad20 -r ec4f2b07a916 public_html/polls/index.php
--- a/public_html/polls/index.php Sun Jan 17 10:20:29 2010 +0100
+++ b/public_html/polls/index.php Sun Jan 17 10:53:04 2010 +0100
@@ -60,26 +60,13 @@
*/
function polllist()
{
- global $_CONF, $_TABLES, $_PO_CONF, $LANG25, $LANG_LOGIN, $LANG_POLLS;
+ global $_CONF, $_TABLES, $_PO_CONF, $LANG25, $LANG_POLLS;
$retval = '';
if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
($_PO_CONF['pollsloginrequired'] == 1))) {
- $retval = COM_startBlock ($LANG_LOGIN[1], '',
- COM_getBlockTemplate ('_msg_block', 'header'));
- $login = new Template ($_CONF['path_layout'] . 'submit');
- $login->set_file (array ('login' => 'submitloginrequired.thtml'));
- $login->set_var ('xhtml', XHTML);
- $login->set_var ('site_url', $_CONF['site_url']);
- $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
- $login->set_var ('layout_url', $_CONF['layout_url']);
- $login->set_var ('login_message', $LANG_LOGIN[2]);
- $login->set_var ('lang_login', $LANG_LOGIN[3]);
- $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
- $login->parse ('output', 'login');
- $retval .= $login->finish ($login->get_var('output'));
- $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+ $retval .= SEC_loginRequiredForm();
} else {
require_once( $_CONF['path_system'] . 'lib-admin.php' );
$header_arr = array( // display 'text' and use table field 'field'
diff -r 5bfa86f7ad20 -r ec4f2b07a916 public_html/profiles.php
--- a/public_html/profiles.php Sun Jan 17 10:20:29 2010 +0100
+++ b/public_html/profiles.php Sun Jan 17 10:53:04 2010 +0100
@@ -175,26 +175,13 @@
*/
function contactform ($uid, $subject = '', $message = '')
{
- global $_CONF, $_TABLES, $_USER, $LANG08, $LANG_LOGIN;
+ global $_CONF, $_TABLES, $_USER, $LANG08;
$retval = '';
if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
($_CONF['emailuserloginrequired'] == 1))) {
- $retval = COM_startBlock ($LANG_LOGIN[1], '',
- COM_getBlockTemplate ('_msg_block', 'header'));
- $login = new Template($_CONF['path_layout'] . 'submit');
- $login->set_file (array ('login'=>'submitloginrequired.thtml'));
- $login->set_var ( 'xhtml', XHTML );
- $login->set_var ('site_url', $_CONF['site_url']);
- $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
- $login->set_var ('layout_url', $_CONF['layout_url']);
- $login->set_var ('login_message', $LANG_LOGIN[2]);
- $login->set_var ('lang_login', $LANG_LOGIN[3]);
- $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
- $login->parse ('output', 'login');
- $retval .= $login->finish ($login->get_var('output'));
- $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+ $retval .= SEC_loginRequiredForm();
} else {
$result = DB_query ("SELECT emailfromadmin,emailfromuser FROM {$_TABLES['userprefs']} WHERE uid = '$uid'");
More information about the geeklog-cvs
mailing list