[geeklog-hg] geeklog: Merged with HEAD
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Wed Jan 8 09:57:07 EST 2014
changeset 9398:84782981d1f7
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/84782981d1f7
user: Kenji ITO <mystralkk at gmail.com>
date: Wed Jan 08 23:56:21 2014 +0900
description:
Merged with HEAD
diffstat:
plugins/spamx/BlackList.Examine.class.php | 16 +++-
public_html/admin/plugins.php | 30 +++++-
public_html/admin/syndication.php | 63 ++++++++-----
public_html/javascript/dialog_help.js | 35 +++++++
public_html/layout/denim/header.thtml | 2 +-
public_html/layout/denim/users/storyrow.thtml | 2 +-
public_html/layout/modern_curve/header.thtml | 2 +-
public_html/layout/modern_curve/users/storyrow.thtml | 2 +-
public_html/layout/professional/users/storyrow.thtml | 2 +-
public_html/layout/professional_css/header.thtml | 2 +-
public_html/layout/professional_css/users/storyrow.thtml | 2 +-
public_html/lib-common.php | 73 +++++----------
system/classes/scripts.class.php | 73 +++++++++++++--
system/classes/search.class.php | 64 +++++++------
system/classes/template.class.php | 34 +++++++
system/lib-user.php | 4 +-
16 files changed, 276 insertions(+), 130 deletions(-)
diffs (truncated from 831 to 300 lines):
diff -r 32d07561f405 -r 84782981d1f7 plugins/spamx/BlackList.Examine.class.php
--- a/plugins/spamx/BlackList.Examine.class.php Sun Jan 05 18:29:51 2014 +0900
+++ b/plugins/spamx/BlackList.Examine.class.php Wed Jan 08 23:56:21 2014 +0900
@@ -33,6 +33,18 @@
/**
* No Constructor Use BaseCommand constructor
*/
+
+ // Callback functions for preg_replace_callback()
+ protected function callbackDecimal($str)
+ {
+ return chr($str);
+ }
+
+ protected function callbackHex($str)
+ {
+ return chr('0x' . $str);
+ }
+
/**
* Here we do the work
*/
@@ -55,9 +67,9 @@
// named entities
$comment = html_entity_decode ($comment);
// decimal notation
- $comment = preg_replace ('/&#(\d+);/me', "chr(\\1)", $comment);
+ $comment = preg_replace_callback('/&#(\d+);/m', array($this, 'callbackDecimal'), $comment);
// hex notation
- $comment = preg_replace ('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment);
+ $comment = preg_replace_callback('/&#x([a-f0-9]+);/mi', array($this, 'callbackHex'), $comment);
$ans = 0;
for ($i = 1; $i <= $nrows; $i++) {
list ($val) = DB_fetchArray ($result);
diff -r 32d07561f405 -r 84782981d1f7 public_html/admin/plugins.php
--- a/public_html/admin/plugins.php Sun Jan 05 18:29:51 2014 +0900
+++ b/public_html/admin/plugins.php Wed Jan 08 23:56:21 2014 +0900
@@ -731,10 +731,16 @@
$pi_was_enabled = ($A['pi_enabled'] == 1);
}
- // Prevents the existing plugin from being overwritten with
- // the files uploaded
- if ($pi_was_enabled || $pi_had_entry) {
- return COM_refresh($_CONF['site_admin_url'] . '/plugins.php?msg=99');
+ $callback = 'plugin_enablestatechange_' . $dirname;
+
+ if ($pi_was_enabled) {
+ // disable temporarily while we move the files around
+ if (is_callable($callback)) {
+ changePluginStatus($dirname);
+ } else {
+ DB_change($_TABLES['plugins'], 'pi_enabled', 0,
+ 'pi_name', $dirname);
+ }
}
require_once 'System.php';
@@ -779,10 +785,13 @@
$fdata = fread($fhandle, filesize($plugin_inst));
fclose($fhandle);
}
-
+/*
// Remove the plugin from data/
require_once 'System.php';
@System::rm('-rf ' . $_CONF['path'] . 'data/' . $dirname);
+*/
+ // Some plugins seem to expect files under the data directory to
+ // be unchanged while they are disabled. Let's leave the files untouched.
/**
* One time I wanted to install a muffler on my car and
@@ -834,6 +843,8 @@
unset($archive); // Collect some garbage
// cleanup when uploading a new version
+ require_once 'System.php';
+
if ($pi_did_exist) {
$plugin_dir = $_CONF['path'] . 'plugins/' . $dirname;
if (file_exists($plugin_dir . '.previous')) {
@@ -851,8 +862,13 @@
}
if ($pi_was_enabled) {
- DB_change($_TABLES['plugins'], 'pi_enabled', 1,
- 'pi_name', $dirname);
+ // Enable the plugin again
+ if (is_callable($callback)) {
+ changePluginStatus($dirname);
+ } else {
+ DB_change($_TABLES['plugins'], 'pi_enabled', 1,
+ 'pi_name', $dirname);
+ }
}
}
diff -r 32d07561f405 -r 84782981d1f7 public_html/admin/syndication.php
--- a/public_html/admin/syndication.php Sun Jan 05 18:29:51 2014 +0900
+++ b/public_html/admin/syndication.php Wed Jan 08 23:56:21 2014 +0900
@@ -234,7 +234,7 @@
$fid = $A['fid'];
}
if ($fid == 0) {
- if (!empty ($type)) { // set defaults
+ if (!empty($type)) { // set defaults
$A['fid'] = $fid;
$A['type'] = $type;
$A['topic'] = '::all';
@@ -457,6 +457,7 @@
}
// Make sure correct format returned and correct file extenstion
+ $A['filename'] = COM_sanitizeFilename($A['filename'], true);
$file_parts = pathinfo($A['filename']);
$A['filename'] = ''; // Clear out filename. If it doesn't get recreated then we know there is an error
if (!empty($file_parts['filename'])) {
@@ -465,31 +466,31 @@
if ($A['format'] == ($f['name'] . '-' . $f['version'])) {
switch($f['name'])
{
- case "Atom":
- if ($file_parts['extension'] != "atm" OR $file_parts['extension'] != "xml") {
- $A['filename'] = $file_parts['filename'] . '.atm';
+ case 'Atom':
+ if (!in_array(@$file_parts['extension'], array('atm', 'xml'))) {
+ $file_parts['extension'] = 'xml';
}
+
+ $A['filename'] = $file_parts['filename'] . '.' . $file_parts['extension'];
break;
-
- case "RSS":
- if ($file_parts['extension'] != "rss" OR $file_parts['extension'] != "xml") {
- $A['filename'] = $file_parts['filename'] . '.rss';
+
+ case 'RSS':
+ if (!in_array(@$file_parts['extension'], array('rss', 'xml'))) {
+ $file_parts['extension'] = 'rss';
}
+
+ $A['filename'] = $file_parts['filename'] . '.' . $file_parts['extension'];
break;
-
- case "RDF":
- if ($file_parts['extension'] != "rdf") {
- $A['filename'] = $file_parts['filename'] . '.rdf';
- }
+
+ case 'RDF':
+ $A['filename'] = $file_parts['filename'] . '.rdf';
break;
-
}
-
}
}
}
- if (empty ($A['title']) || empty ($A['description']) ||
- empty ($A['filename'])) {
+ if (empty($A['title']) || empty($A['description']) ||
+ empty($A['filename'])) {
$retval = COM_showMessageText($LANG33[39], $LANG33[38])
. editfeed ($A['fid'], $A['type']);
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG33[38]));
@@ -516,19 +517,33 @@
}
// we can compensate if these are missing ...
- if (empty ($A['charset'])) {
+ if (!empty($A['charset'])) {
+ $A['charset'] = preg_replace('/[^0-9a-zA-Z_\-]/', '', $A['charset']);
+ }
+
+ if (empty($A['charset'])) {
$A['charset'] = $_CONF['default_charset'];
- if (empty ($A['charset'])) {
+ if (empty($A['charset'])) {
$A['charset'] = 'UTF-8';
}
}
- if (empty ($A['language'])) {
+
+ if (!empty($A['language'])) {
+ $A['language'] = preg_replace('/[^0-9a-zA-Z_\.\-]/', '', $A['language']);
+ }
+
+ if (empty($A['language'])) {
$A['language'] = $_CONF['rdf_language'];
- if (empty ($A['language'])) {
+ if (empty($A['language'])) {
$A['language'] = $_CONF['locale'];
}
}
- if (empty ($A['content_length']) || ($A['content_length'] < 0)) {
+
+ if (!empty($A['content_length'])) {
+ $A['content_length'] = intval($A['content_length'], 10);
+ }
+
+ if (empty($A['content_length']) || ($A['content_length'] < 0)) {
$A['content_length'] = 0;
}
@@ -595,14 +610,14 @@
$mode = $_REQUEST['mode'];
}
if ($mode == 'edit') {
- if (empty ($_REQUEST['fid'])) {
+ if (empty($_REQUEST['fid'])) {
$display .= newfeed ();
} else {
$display .= editfeed (COM_applyFilter($_REQUEST['fid']));
$display = COM_createHTMLDocument($display, array('pagetitle' => $LANG33[24]));
}
}
-elseif (($mode == $LANG33[1]) && !empty ($LANG33[1]))
+elseif (($mode == $LANG33[1]) && !empty($LANG33[1]))
{
$display .= editfeed (0, COM_applyFilter($_REQUEST['type']));
$display = COM_createHTMLDocument($display, array('pagetitle' => $LANG33[24]));
diff -r 32d07561f405 -r 84782981d1f7 public_html/javascript/dialog_help.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/javascript/dialog_help.js Wed Jan 08 23:56:21 2014 +0900
@@ -0,0 +1,35 @@
+$(function() {
+ $('a.blocktitle').each(function() {
+ var $link = $(this);
+ $link.one('click', function() {
+
+ var $loading = $('<div style="margin: auto; padding-top: 90px; width: 32px; height: 32px">'
+ + '<img src="' + geeklog.layout_url + '/images/loading.gif" alt="loading"' + geeklog.xhtml + '></div>');
+
+ var $dialog = $('<div></div>')
+ .append($loading.clone());
+
+ var buttons_obj = new Object();
+ buttons_obj[geeklog.lang.close] = function() {
+ $dialog.dialog("close");
+ };
+
+ $dialog
+ .load($link.attr('href')+ ' #content')
+ .dialog({
+ title: $link.attr("title"),
+ width: 500,
+ height: 300,
+ buttons: buttons_obj,
+ });
+
+ $link.click(function() {
+ $dialog.dialog("open");
+
+ return false;
+ });
+
+ return false;
+ });
+ });
+});
diff -r 32d07561f405 -r 84782981d1f7 public_html/layout/denim/header.thtml
--- a/public_html/layout/denim/header.thtml Sun Jan 05 18:29:51 2014 +0900
+++ b/public_html/layout/denim/header.thtml Wed Jan 08 23:56:21 2014 +0900
@@ -2,7 +2,7 @@
<html{lang_attribute}{xmlns}>
<head profile="http://www.w3.org/2003/g/data-view">
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"{xhtml}>
+<meta http-equiv="Content-Type" content="text/html; charset={charset}"{xhtml}>
<title>{page_title_and_site_name}</title>
<meta http-equiv="Content-Script-Type" content="text/javascript"{xhtml}>
<meta http-equiv="Content-Style-Type" content="text/css"{xhtml}>
diff -r 32d07561f405 -r 84782981d1f7 public_html/layout/denim/users/storyrow.thtml
--- a/public_html/layout/denim/users/storyrow.thtml Sun Jan 05 18:29:51 2014 +0900
+++ b/public_html/layout/denim/users/storyrow.thtml Wed Jan 08 23:56:21 2014 +0900
@@ -1,6 +1,6 @@
<!-- users/storyrow.thtml { -->
-<p class="storyrow">{row_number} {story_title}{story_date}</p>
+<p class="storyrow">{row_number} {story_title} {story_date}</p>
<!-- } users/storyrow.thtml -->
diff -r 32d07561f405 -r 84782981d1f7 public_html/layout/modern_curve/header.thtml
--- a/public_html/layout/modern_curve/header.thtml Sun Jan 05 18:29:51 2014 +0900
+++ b/public_html/layout/modern_curve/header.thtml Wed Jan 08 23:56:21 2014 +0900
@@ -1,7 +1,7 @@
{doctype}
<html{lang_attribute}{xmlns}>
<head profile="http://www.w3.org/2003/g/data-view">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"{xhtml}>
+ <meta http-equiv="Content-Type" content="text/html; charset={charset}"{xhtml}>
<title>{page_title_and_site_name}</title>
<meta http-equiv="Content-Script-Type" content="text/javascript"{xhtml}>
diff -r 32d07561f405 -r 84782981d1f7 public_html/layout/modern_curve/users/storyrow.thtml
--- a/public_html/layout/modern_curve/users/storyrow.thtml Sun Jan 05 18:29:51 2014 +0900
+++ b/public_html/layout/modern_curve/users/storyrow.thtml Wed Jan 08 23:56:21 2014 +0900
@@ -1,5 +1,5 @@
More information about the geeklog-cvs
mailing list