Port of patch #16 to 2.0

This commit is contained in:
Garvin Hicking 2013-05-06 09:47:19 +02:00
parent b543fae655
commit 5ec7481030
17 changed files with 35 additions and 37 deletions

View File

@ -166,7 +166,7 @@ class ONYX_RSS
clearstatcache();
if (!($fp = @fopen($file, 'r')))
{
$this->raiseError((__LINE__-2), 'Could not read contents of cache file (<em>'.$cache_file.'</em>).');
$this->raiseError((__LINE__-2), 'Could not read contents of cache file (<em>'.$file.'</em>).');
return false;
}
$this->data = unserialize(fread($fp, filesize($file)));

View File

@ -177,7 +177,7 @@ Class Image_Transform_Driver_NetPBM extends Image_Transform
."$size -x $x -y ".$y+$size." -text \"$text\"";
} // End addText
function _postProcess($type, $quality, $save_type)
function _postProcess($type, $quality, $save_type=null)
{
$type = is_null($type) || $type==''? $this->type : $type;
$save_type = is_null($save_type) || $save_type==''? $this->type : $save_type;

View File

@ -64,7 +64,7 @@ die('disabled in s9y');
$socket = fsockopen($Host, 80, $errno, $errstr);
if (!$socket) {
$result = "($errno) $errstr";
return $Result;
return $result;
}
fputs($socket, $ReqHeader);

View File

@ -54,7 +54,7 @@ if (isset($_POST['SAVE']) && serendipity_checkFormToken()) {
WHERE categoryid = ". (int)$parentid);
$data['subcat'] = sprintf(ALREADY_SUBCATEGORY, htmlspecialchars($r[0]['category_name']), htmlspecialchars($name));
} else {
serendipity_updateCategory($serendipity['GET']['cid'], $name, $desc, $authorid, $icon, $parentid, $serendipity['POST']['cat']['sort_order'], $serendipity['POST']['cat']['hide_sub']);
serendipity_updateCategory($serendipity['GET']['cid'], $name, $desc, $authorid, $icon, $parentid, $serendipity['POST']['cat']['sort_order'], $serendipity['POST']['cat']['hide_sub'], $admin_category);
serendipity_ACLGrant($serendipity['GET']['cid'], 'category', 'read', $serendipity['POST']['cat']['read_authors']);
serendipity_ACLGrant($serendipity['GET']['cid'], 'category', 'write', $serendipity['POST']['cat']['write_authors']);
}

View File

@ -184,7 +184,7 @@ class Serendipity_Import_Blogger extends Serendipity_Import {
'realname' => $author,
'username' => $author,
'userlevel' => 0,
'password' => md5($defaultpass))
'password' => md5($this->data['defaultpass']))
);
$authorid = serendipity_db_insert_id('authors', 'authorid');
$authorList[$authorid] = $author;

View File

@ -156,9 +156,8 @@ class Serendipity_Import_LiveJournalXML extends Serendipity_Import {
}
function gatherComments($entrydata) {
$comments;
if (is_array($entrydata['children'])) {
$comments = array();
if (is_array($entrydata['children'])) {
foreach($entrydata['children'] AS $idx3 => $commententry) {
if ($commententry['tag'] == 'comment' && is_array($commententry['children'])) {
$comment = array(

View File

@ -387,7 +387,6 @@ function serendipity_db_limit_sql($limitstring) {
case "mysql":
return ' LIMIT ' . $limitstring;
case "postgresql":
$limit;
$limit_split = explode(',', $limitstring);
if (count($limit_split) > 1) {
$limit = ' LIMIT ' . $limit_split[0] . ' OFFSET ' . $limit_split[1];
@ -510,7 +509,7 @@ function serendipity_db_schema_import($query) {
*/
function serendipity_db_probe($hash, &$errs) {
global $serendipity;
$c;
$c = null;
if (!function_exists('sqlrcon_alloc')) {
$errs[] = 'No sql_relay extension found. Please check your webserver installation or contact your systems administrator regarding this problem.';

View File

@ -1072,7 +1072,7 @@ function serendipity_addCategory($name, $desc, $authorid, $icon, $parentid) {
* @param int The new category subcat hiding
* @return null
*/
function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $parentid, $sort_order = 0, $hide_sub = 0) {
function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $parentid, $sort_order = 0, $hide_sub = 0, $admin_category = '') {
global $serendipity;
$query = "UPDATE {$serendipity['dbPrefix']}category

View File

@ -52,7 +52,7 @@ function serendipity_isActiveFile($file) {
* @param boolean Apply strict directory checks, or include subdirectories?
* @return array Resultset of images
*/
function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total, $order = false, $ordermode = false, $directory = '', $filename = '', $keywords = '', $filter = array(), $strict_directory = false) {
function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total=null, $order = false, $ordermode = false, $directory = '', $filename = '', $keywords = '', $filter = array(), $strict_directory = false) {
global $serendipity;
$cond = array(
@ -1132,7 +1132,7 @@ function serendipity_syncThumbs($deleteThumbs = false) {
if ($tdim['noimage']) {
// Delete it so it can be regenerated
if (@unlink($fthumb)) {
printf(DELETE_THUMBNAIL . "<br />\n", $sthumb);
printf(DELETE_THUMBNAIL . "<br />\n", $sThumb);
$i++;
}
} else {
@ -1144,7 +1144,7 @@ function serendipity_syncThumbs($deleteThumbs = false) {
// This thumbnail is incorrect; delete it so
// it can be regenerated
if (@unlink($fthumb)) {
printf(DELETE_THUMBNAIL . "<br />\n", $sthumb);
printf(DELETE_THUMBNAIL . "<br />\n", $sThumb);
$i++;
}
}
@ -2257,7 +2257,6 @@ function serendipity_showPropertyForm(&$new_media, $keywordsPerBlock = 3, $is_ed
$dprops = explode(';', $serendipity['mediaProperties']);
$keywords = explode(';', $serendipity['mediaKeywords']);
$now = serendipity_serverOffsetHour();
$show = array();
foreach($new_media AS $idx => $media) {
$props =& serendipity_fetchMediaProperties($media['image_id']);
@ -2287,7 +2286,7 @@ function serendipity_showPropertyForm(&$new_media, $keywordsPerBlock = 3, $is_ed
return serendipity_showMedia(
$show,
$mirror,
$url,
'',
false,
1,
false,
@ -2399,7 +2398,7 @@ function serendipity_parseMediaProperties(&$dprops, &$keywords, &$media, &$props
if (empty($val)) {
switch($parts[0]) {
case 'DATE':
$default_iptc_val = $now;
$default_iptc_val = serendipity_serverOffsetHour();
case 'RUN_LENGTH':
if (!isset($default_iptc_val)) {
@ -2533,7 +2532,7 @@ function serendipity_mediaTypeCast($key, $val, $invert = false) {
* @return array array('image_id') holding the last created thumbnail for immediate processing
*
*/
function serendipity_insertMediaProperty($property_group, $property_subgroup = '', $image_id, &$media, $use_cast = true) {
function serendipity_insertMediaProperty($property_group, $property_subgroup, $image_id, &$media, $use_cast = true) {
global $serendipity;
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}mediaproperties
@ -2562,7 +2561,7 @@ function serendipity_insertMediaProperty($property_group, $property_subgroup = '
VALUES (%d, '%s', '%s', '%s', '%s')",
$image_id,
serendipity_db_escape_string($property_group),
serendipity_db_escape_string($useproperty_subgroup),
serendipity_db_escape_string($use_property_subgroup),
serendipity_db_escape_string($insert_key),
serendipity_db_escape_string($insert_val));
serendipity_db_query($q);
@ -2850,7 +2849,7 @@ function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lin
'nextIMG' => serendipity_getTemplateFile('admin/img/next.png'),
'token' => serendipity_setFormToken(),
'form_hidden' => $form_hidden,
'blimit_path' => basename($limit_path),
'blimit_path' => empty($smarty_vars['limit_path']) ? '':basename($smarty_vars['limit_path']),
'only_path' => $serendipity['GET']['only_path'],
'only_filename' => $serendipity['GET']['only_filename'],
'sortorder' => $serendipity['GET']['sortorder'],

View File

@ -584,7 +584,7 @@ function serendipity_smarty_refhookPlugin(&$eventData, $hook, $addData = null) {
// $serendipity['skip_smarty_hook'] = array('entries_header');
// That would only skip the entries_header event hook, but allow all others.
// Of course it cannot be used in conjunction with the all-blocking skip_smarty_hooks.
if (isset($serendipity['skip_smarty_hook']) && is_array($serendipity['skip_smarty_hook']) && isset($serendipity['skip_smarty_hook'][$params['hook']])) {
if (isset($serendipity['skip_smarty_hook']) && is_array($serendipity['skip_smarty_hook']) && isset($serendipity['skip_smarty_hook'][$hook])) {
return;
}

View File

@ -663,7 +663,7 @@ class serendipity_topreferrers_plugin extends serendipity_plugin {
} else {
$use_links = serendipity_db_bool($use_links);
}
echo serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
serendipity_displayTopReferrers($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
}
}
@ -729,7 +729,7 @@ class serendipity_topexits_plugin extends serendipity_plugin {
$use_links = serendipity_db_bool($use_links);
}
echo serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
}
}

View File

@ -559,7 +559,7 @@ class serendipity_event_entryproperties extends serendipity_event
$elements = explode(',', $this->get_config('sequence'));
foreach($elements AS $element) {
$this->showBackend($element, $eventData, $is_sticky, $no_frontpage, $hiderss, $access_values, $access, $password, $use_groups, $access_groups, $use_users, $access_users, $more);
$this->showBackend($element, $eventData, $is_sticky, $no_frontpage, $hiderss, $access_values, $access, $password, $use_groups, $access_groups, $use_users, $access_users);
}
?>
</fieldset>

View File

@ -713,7 +713,7 @@ class serendipity_event_karma extends serendipity_event
if ($this->image_name) {
// Is this a single-image bar, or a single segment?
$ratio = $this->image_width / $this->image_height;
if ($ratio < $max_segment_ratio) {
if ($ratio < $this->max_segment_ratio) {
// This is probably a single segment. Square segments
// will have a ratio of 0.3; long, flat segments won't
// get up to 1.0 unless they're 3 times as wide as they
@ -1760,6 +1760,8 @@ function invertSelection() {
* @return string an HTML string including working images of all the rating bars in the img/ directory.
*/
function createRatingSelector() {
global $serendipity;
// Since the inputs are set up with the proper names, the config item
// gets saved automatically, with no need for magic
@ -1817,7 +1819,7 @@ function invertSelection() {
$width = $fdata['width'];
$ratio = $width / $height;
// If this is a single segment, adjust width
if ($ratio < $max_segment_ratio) {
if ($ratio < $this->max_segment_ratio) {
$width = $width * 5;
}
$height = $height / 3;

View File

@ -478,7 +478,9 @@ var $filter_defaults;
}
}
function akismetRequest($api_key, $data, &$ret, $action = 'comment-check') {
function akismetRequest($api_key, $data, &$ret, $action = 'comment-check', $eventData = null, $addData = null) {
global $serendipity;
$opt = array(
'method' => 'POST',
'http' => '1.1',
@ -515,7 +517,7 @@ var $filter_defaults;
}
if (empty($server)) {
$this->log($this->logfile, $eventData['id'], 'AKISMET_SERVER', 'No Akismet server found', $addData);
$this->log($this->logfile, is_null($eventData) ? 0:$eventData['id'], 'AKISMET_SERVER', 'No Akismet server found', $addData);
$ret['is_spam'] = false;
$ret['message'] = 'No server for Akismet request';
return;
@ -589,7 +591,7 @@ var $filter_defaults;
}
function tellAboutComment($where, $api_key = '', $comment_id, $is_spam) {
function tellAboutComment($where, $api_key, $comment_id, $is_spam) {
global $serendipity;
$comment = serendipity_db_query(" SELECT C.*, L.useragent as log_useragent, E.title as entry_title "
. " FROM {$serendipity['dbPrefix']}comments C, {$serendipity['dbPrefix']}spamblocklog L , {$serendipity['dbPrefix']}entries E "
@ -627,7 +629,7 @@ var $filter_defaults;
if (function_exists('serendipity_request_end')) serendipity_request_end();
}
function &getBlacklist($where, $api_key = '', &$eventData, &$addData) {
function &getBlacklist($where, $api_key, &$eventData, &$addData) {
global $serendipity;
$ret = false;
@ -998,7 +1000,7 @@ var $filter_defaults;
$tipval_method = ($trackback_ipvalidation_option == 'reject'?'REJECTED':'MODERATE');
// Getting host from url successfully?
if (!is_array($parts)) { // not a valid URL
$this->log($logfile, $eventData['id'], $tipval_method, sprintf(PLUGIN_EVENT_SPAMBLOCK_REASON_IPVALIDATION, $addData['url'], '', ''));
$this->log($logfile, $eventData['id'], $tipval_method, sprintf(PLUGIN_EVENT_SPAMBLOCK_REASON_IPVALIDATION, $addData['url'], '', ''), $addData);
if ($trackback_ipvalidation_option == 'reject') {
$eventData = array('allow_comments' => false);
$serendipity['messagestack']['comments'][] = sprintf(PLUGIN_EVENT_SPAMBLOCK_REASON_IPVALIDATION, $addData['url']);
@ -1543,6 +1545,7 @@ var $filter_defaults;
if($ftc) {
// Check for maximum number of links before rejecting
$link_count = substr_count(strtolower($addData['comment']), 'http://');
$links_reject = $this->get_config('links_reject', 20);
if ($links_reject > 0 && $link_count > $links_reject) {
$this->log($logfile, $eventData['id'], 'REJECTED', PLUGIN_EVENT_SPAMBLOCK_REASON_LINKS_REJECT, $addData);
$eventData = array('allow_comments' => false);

View File

@ -532,11 +532,11 @@ class serendipity_event_statistics extends serendipity_event
<br />
<dt><strong><?php echo TOP_REFERRER; ?></strong></dt>
<dd><?php echo serendipity_displayTopReferrers($max_items, true); ?></dd>
<dd><?php serendipity_displayTopReferrers($max_items, true); ?></dd>
<br />
<dt><strong><?php echo TOP_EXITS; ?></strong></dt>
<dd><?php echo serendipity_displayTopExits($max_items, true); ?></dd>
<dd><?php serendipity_displayTopExits($max_items, true); ?></dd>
</dl>
<hr />
<?php serendipity_plugin_api::hook_event('event_additional_statistics', $eventData, array('maxitems' => $max_items)); ?>

View File

@ -1092,8 +1092,6 @@ class Textile
function textile_popup_help($name, $helpvar, $windowW, $windowH)
{
return ' <a target="_blank" href="http://www.textpattern.com/help/?item=' . $helpvar . '" onclick="window.open(this.href, \'popupwindow\', \'width=' . $windowW . ',height=' . $windowH . ',scrollbars,resizable\'); return false;">' . $name . '</a><br />';
return $out;
}
// -------------------------------------------------------------

View File

@ -262,7 +262,7 @@ Applying Attributes:
$matched = str_replace($pl[0],'',$matched);
}
if(preg_match("/([)]+)/",$matched,$pr)) {
dump($pr);
# dump($pr);
$textile_style[] = "padding-right:".strlen($pr[1])."em;";
$matched = str_replace($pr[0],'',$matched);
}
@ -882,8 +882,6 @@ Applying Attributes:
// -------------------------------------------------------------
function textile_popup_help($name,$helpvar,$windowW,$windowH) {
return ' <a target="_blank" href="http://www.textpattern.com/help/?item='.$helpvar.'" onclick="window.open(this.href, \'popupwindow\', \'width='.$windowW.',height='.$windowH.',scrollbars,resizable\'); return false;">'.$name.'</a><br />';
return $out;
}
// -------------------------------------------------------------