fix whitespaces and change a msg error string to 2.0 style
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
@ -287,7 +287,7 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath') {
|
||||
if (file_exists($serendipity['serendipityPath'] . $templateFile)) {
|
||||
return $serendipity[$key] . $templateFile;
|
||||
}
|
||||
|
||||
|
||||
if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl")) {
|
||||
# catch *.tpl files, used by the backend for serendipity_editor.js.tpl
|
||||
return $serendipity['baseURL'] . 'index.php?/plugin/' . $file;
|
||||
@ -343,7 +343,6 @@ function serendipity_load_configuration($author = null) {
|
||||
if ((empty($author) || empty($serendipity['baseURL'])) && isset($serendipity['defaultBaseURL'])) {
|
||||
$serendipity['baseURL'] = $serendipity['defaultBaseURL'];
|
||||
}
|
||||
|
||||
|
||||
// Store default language
|
||||
$serendipity['default_lang'] = $serendipity['lang'];
|
||||
@ -400,7 +399,6 @@ function serendipity_login($use_external = true) {
|
||||
if (empty($serendipity['POST']['auto'])) {
|
||||
serendipity_deleteCookie('author_information');
|
||||
serendipity_deleteCookie('author_information_iv');
|
||||
|
||||
return false;
|
||||
} else {
|
||||
serendipity_issueAutologin(
|
||||
@ -425,7 +423,7 @@ function serendipity_login($use_external = true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data = array('ext' => $use_external, 'mode' => 2, 'user' => $serendipity['POST']['user'], 'pass' => $serendipity['POST']['pass']);
|
||||
serendipity_plugin_api::hook_event('backend_loginfail', $data);
|
||||
}
|
||||
@ -524,7 +522,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
|
||||
global $serendipity;
|
||||
static $debug = false;
|
||||
static $debugc = 0;
|
||||
|
||||
|
||||
if ($debug) {
|
||||
$fp = fopen('login.log', 'a');
|
||||
flock($fp, LOCK_EX);
|
||||
@ -569,7 +567,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
|
||||
|
||||
// Old MD5 hashing routine. Will convert user.
|
||||
if (empty($row['hashtype']) || $row['hashtype'] == 0) {
|
||||
|
||||
|
||||
if (isset($serendipity['hashkey']) && (time() - $serendipity['hashkey']) >= 15768000) {
|
||||
die('You can no longer login with an old-style MD5 hash to prevent MD5-Hostage abuse.
|
||||
Please ask the Administrator to set you a new password.');
|
||||
@ -586,7 +584,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
|
||||
$is_valid_user = true;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( ($is_hashed === false && (string)$row['password'] === (string)serendipity_hash($password)) ||
|
||||
($is_hashed !== false && (string)$row['password'] === (string)$password) ) {
|
||||
@ -596,7 +594,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
|
||||
} else {
|
||||
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - INValidated ' . $row['password'] . ' == ' . ($is_hashed === false ? 'unhash:' . serendipity_hash($password) : 'hash:' . $password) . "\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This code is only reached, if the password before is valid.
|
||||
@ -616,7 +614,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
|
||||
$_SESSION['serendipityAuthedUser'] = $serendipity['serendipityAuthedUser'] = true;
|
||||
$_SESSION['serendipityRightPublish']= $serendipity['serendipityRightPublish'] = $row['right_publish'];
|
||||
$_SESSION['serendipityHashType'] = $serendipity['serendipityHashType'] = $row['hashtype'];
|
||||
|
||||
|
||||
serendipity_load_configuration($serendipity['authorid']);
|
||||
serendipity_setCookie('userDefLang', $serendipity['lang'], false);
|
||||
return true;
|
||||
@ -626,7 +624,7 @@ function serendipity_authenticate_author($username = '', $password = '', $is_has
|
||||
|
||||
// Only reached, when proper login did not yet return true.
|
||||
if ($debug) fwrite($fp, date('Y-m-d H:i') . ' - FAIL.' . "\n");
|
||||
|
||||
|
||||
$_SESSION['serendipityAuthedUser'] = false;
|
||||
serendipity_session_destroy();
|
||||
}
|
||||
@ -694,7 +692,7 @@ function serendipity_setCookie($name, $value, $securebyprot = true) {
|
||||
} else {
|
||||
$secure = false;
|
||||
}
|
||||
|
||||
|
||||
// If HTTP-Hosts like "localhost" are used, current browsers reject cookies.
|
||||
// In this case, we disregard the HTTP host to be able to set that cookie.
|
||||
if (substr_count($host, '.') < 1) {
|
||||
@ -708,7 +706,7 @@ function serendipity_setCookie($name, $value, $securebyprot = true) {
|
||||
|
||||
/**
|
||||
* Echo Javascript code to set a cookie variable
|
||||
*
|
||||
*
|
||||
* This function is useful if your HTTP headers were already sent, but you still want to set a cookie
|
||||
* Note that contents are echo'd, not return'd. Can be used by plugins.
|
||||
*
|
||||
@ -747,7 +745,7 @@ function serendipity_deleteCookie($name) {
|
||||
if (substr_count($host, '.') < 1) {
|
||||
$host = '';
|
||||
}
|
||||
|
||||
|
||||
setcookie("serendipity[$name]", '', time()-4000, $serendipity['serendipityHTTPPath'], $host);
|
||||
unset($_COOKIE[$name]);
|
||||
unset($serendipity['COOKIE'][$name]);
|
||||
@ -844,7 +842,7 @@ function serendipity_iframe_create($mode, &$entry) {
|
||||
|
||||
$_SESSION['save_entry'] = $entry;
|
||||
$_SESSION['save_entry_POST'] = $serendipity['POST'];
|
||||
|
||||
|
||||
$attr = '';
|
||||
switch($mode) {
|
||||
case 'save':
|
||||
@ -987,7 +985,7 @@ function serendipity_getSessionLanguage() {
|
||||
$lang = $serendipity['COOKIE']['userDefLang'];
|
||||
} else {
|
||||
$lang = $serendipity['lang'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$serendipity['detected_lang'] = null;
|
||||
}
|
||||
@ -1978,7 +1976,7 @@ function serendipity_reportXSRF($type = 0, $reset = true, $use_config = false) {
|
||||
// Set this in your serendipity_config_local.inc.php if you want HTTP Referrer blocking:
|
||||
// $serendipity['referrerXSRF'] = true;
|
||||
|
||||
$string = '<div class="serendipityAdminMsgError msg_error XSRF_' . $type . '"><img class="img_error" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . ERROR_XSRF . '</div>';
|
||||
$string = '<div class="msg_error XSRF_' . $type . '"><span class="icon-attention"></span> ' . ERROR_XSRF . '</div>';
|
||||
if ($reset) {
|
||||
// Config key "referrerXSRF" can be set to enable blocking based on HTTP Referrer. Recommended for Paranoia.
|
||||
if (($use_config && isset($serendipity['referrerXSRF']) && $serendipity['referrerXSRF']) || $use_config === false) {
|
||||
@ -2065,7 +2063,7 @@ function serendipity_setFormToken($type = 'form') {
|
||||
*/
|
||||
function &serendipity_loadThemeOptions(&$template_config, $okey = '', $bc_bool = false) {
|
||||
global $serendipity;
|
||||
|
||||
|
||||
if (empty($okey)) {
|
||||
$okey = $serendipity['template'];
|
||||
}
|
||||
@ -2084,9 +2082,9 @@ function &serendipity_loadThemeOptions(&$template_config, $okey = '', $bc_bool =
|
||||
$template_vars[$item['var']] = $item['default'];
|
||||
}
|
||||
}
|
||||
if($bc_bool) {
|
||||
foreach($template_vars AS $k => $i) {
|
||||
if($i == 'true' || $i == 'false') {
|
||||
if($bc_bool) {
|
||||
foreach($template_vars AS $k => $i) {
|
||||
if ($i == 'true' || $i == 'false') {
|
||||
$template_vars[$k] = serendipity_db_bool($i);
|
||||
}
|
||||
}
|
||||
@ -2105,7 +2103,7 @@ function &serendipity_loadThemeOptions(&$template_config, $okey = '', $bc_bool =
|
||||
*/
|
||||
function serendipity_loadGlobalThemeOptions(&$template_config, &$template_loaded_config, $supported = array()) {
|
||||
global $serendipity;
|
||||
|
||||
|
||||
if ($supported['navigation']) {
|
||||
$navlinks = array();
|
||||
|
||||
@ -2117,24 +2115,24 @@ function serendipity_loadGlobalThemeOptions(&$template_config, &$template_loaded
|
||||
'scope' => 'global'
|
||||
);
|
||||
|
||||
// This always needs to be present, if not it could happen that the template options do have an older version of this variable
|
||||
$template_config[] = $conf_amount;
|
||||
// This always needs to be present, if not it could happen that the template options do have an older version of this variable
|
||||
$template_config[] = $conf_amount;
|
||||
|
||||
if (!isset($template_loaded_config['amount']) || empty($template_loaded_config['amount'])) {
|
||||
$template_loaded_config['amount'] = $conf_amount['default'];
|
||||
}
|
||||
|
||||
// Check if we are currently inside the admin interface.
|
||||
if ($serendipity['POST']['adminModule'] == 'templates' && $serendipity['POST']['adminAction'] == 'configure' && !empty($serendipity['POST']['template']['amount'])) {
|
||||
$template_loaded_config['amount'] = (int)$serendipity['POST']['template']['amount'];
|
||||
}
|
||||
|
||||
// Check if we are currently inside the admin interface.
|
||||
if ($serendipity['POST']['adminModule'] == 'templates' && $serendipity['POST']['adminAction'] == 'configure' && !empty($serendipity['POST']['template']['amount'])) {
|
||||
$template_loaded_config['amount'] = (int)$serendipity['POST']['template']['amount'];
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $template_loaded_config['amount']; $i++) {
|
||||
$navlinks[] = array(
|
||||
'title' => $template_loaded_config['navlink' . $i . 'text'],
|
||||
'href' => $template_loaded_config['navlink' . $i . 'url']
|
||||
);
|
||||
|
||||
|
||||
$template_config[] = array(
|
||||
'var' => 'navlink' . $i . 'text',
|
||||
'name' => NAV_LINK_TEXT . ' #' . ($i+1),
|
||||
@ -2150,10 +2148,10 @@ function serendipity_loadGlobalThemeOptions(&$template_config, &$template_loaded
|
||||
'scope' => 'global'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$serendipity['smarty']->assignByRef('navlinks', $navlinks);
|
||||
}
|
||||
|
||||
|
||||
// Forward thinking. ;-)
|
||||
serendipity_plugin_api::hook_event('backend_templates_globalthemeoptions', $template_config, $supported);
|
||||
}
|
||||
@ -2177,7 +2175,7 @@ function serendipity_hasPluginPermissions($plugin, $groupid = null) {
|
||||
|
||||
if ($forbidden === null || ($groupid !== null && !isset($forbidden[$groupid]))) {
|
||||
$forbidden = array();
|
||||
|
||||
|
||||
if ($groupid === null) {
|
||||
$groups = serendipity_checkPermission(null, null, 'all');
|
||||
} else {
|
||||
@ -2205,7 +2203,7 @@ function serendipity_hasPluginPermissions($plugin, $groupid = null) {
|
||||
|
||||
function serendipity_hash($string) {
|
||||
global $serendipity;
|
||||
|
||||
|
||||
if (empty($serendipity['hashkey'])) {
|
||||
serendipity_set_config_var('hashkey', time(), 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user