1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

Fixes #905 and other PHP notices.

This commit is contained in:
Cameron
2015-04-17 11:46:47 -07:00
parent bc382d7317
commit 4a4e2447a1
4 changed files with 134 additions and 116 deletions

View File

@@ -13,7 +13,7 @@
* *
*/ */
if($_GET['action'] == 'dialog') if(!empty($_GET['action']) && $_GET['action'] == 'dialog')
{ {
define('e_MINIMAL',true); define('e_MINIMAL',true);
} }
@@ -431,7 +431,7 @@ class media_form_ui extends e_admin_form_ui
*/ */
public function resizeImage($oldpath,$img_import_w,$img_import_h) public function resizeImage($oldpath,$img_import_w,$img_import_h)
{ {
$mes = e107::getMessage();
try try
{ {
$thumb = PhpThumbFactory::create($oldpath); $thumb = PhpThumbFactory::create($oldpath);
@@ -584,7 +584,7 @@ class media_form_ui extends e_admin_form_ui
$text = "<input type='button' value='Select' data-placement='left' class='e-media-select e-dialog-save e-dialog-close btn btn-primary btn-large' data-id='{$id}' data-name=\"".$title."\" data-type='file' data-target='{$tagid}' data-bbcode='{$bbcode}' data-path='{$path}' data-preview='{$preview}' title=\"".$title."\" />"; $text = "<input type='button' value='Select' data-placement='left' class='e-media-select e-dialog-save e-dialog-close btn btn-primary btn-large' data-id='{$id}' data-name=\"".$title."\" data-type='file' data-target='{$tagid}' data-bbcode='{$bbcode}' data-path='{$path}' data-preview='{$preview}' title=\"".$title."\" />";
} }
$text .= $this->renderValue('options',$value,'',$id); $text = $this->renderValue('options',$value,'',$id);
return "<div class='nowrap'>".$text."</div>"; return "<div class='nowrap'>".$text."</div>";
@@ -1861,7 +1861,7 @@ class media_admin_ui extends e_admin_ui
$tp = e107::getParser(); $tp = e107::getParser();
$f = e107::getFile()->get_file_info($oldpath,TRUE); $f = e107::getFile()->get_file_info($oldpath,TRUE);
$mes->addDebug("checkDupe(): newpath=".$newpath."<br />oldpath=".$oldpath."<br />".print_r($upload,TRUE)); $mes->addDebug("checkDupe(): newpath=".$newpath."<br />oldpath=".$oldpath."<br />".print_r($newpath,TRUE));
if(file_exists($newpath) || e107::getDb()->db_Select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") ) if(file_exists($newpath) || e107::getDb()->db_Select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") )
{ {
$mes->addWarning($newpath." already exists."); $mes->addWarning($newpath." already exists.");
@@ -2023,7 +2023,7 @@ class media_admin_ui extends e_admin_ui
// $waterMarkPath = e_THEME.e107::getPref('sitetheme')."/images/watermark.png"; // Now performed site-wide dynamically. // $waterMarkPath = e_THEME.e107::getPref('sitetheme')."/images/watermark.png"; // Now performed site-wide dynamically.
if(is_readable($waterMarkPath)) // if(is_readable($waterMarkPath))
{ {
// $text .= $frm->checkbox_label("Add Watermark", 'batch_import_watermark',1); // $text .= $frm->checkbox_label("Add Watermark", 'batch_import_watermark',1);
} }

View File

@@ -11,66 +11,81 @@
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
class e107_event class e107_event
{ {
var $functions = array(); var $functions = array();
var $includes = array(); var $includes = array();
protected $coreEvents = array( // used by e_notify admin area. protected $coreEvents;
'session' => array(
'user_signup_submitted' => NU_LAN_2,
'user_signup_activated' => NU_LAN_3,
'login' => NU_LAN_4,
'logout' => NU_LAN_5,
'user_xup_login' => 'User social login',
'user_xup_signup' => 'User social signup',
'user_ban_flood' => NS_LAN_2,
'user_ban_failed_login' => 'IP banned for multiple failed login attempts',
'user_profile_display' => "User views profile"
),
'administrators' => array(
'admin_password_update' => "Administrator updates their password",
'admin_user_created' => 'Administrator creates a new user',
'admin_user_activated' => "Administrator activates a new user"
),
'news' => array(
'admin_news_created' => NN_LAN_3,
'admin_news_updated' => NN_LAN_4,
'admin_news_deleted' => NN_LAN_5,
'user_news_submit' => NN_LAN_2,
),
'mail' => array(
'maildone' => NM_LAN_2,
),
'file' => array(
// 'fileupload' => NF_LAN_2,
'user_file_upload' => NF_LAN_2,
),
);
protected $oldCoreEvents = array( protected $oldCoreEvents = array(
'usersup' => 'user_signup_submitted',
'userveri' => 'user_signup_activated',
'flood' => 'user_ban_flood',
'subnews' => 'user_news_submit',
'fileupload' => 'user_file_upload',
'newspost' => 'admin_news_created',
'newsupd' => 'admin_news_updated',
'newsdel' => 'admin_news_deleted'
);
function __construct()
{
// e107::lan('core','notify'); //FIXME e_LANGUAGE is not defined at this point.
$this->coreEvents = array( // used by e_notify admin area.
'session' => array(
'user_signup_submitted' => NU_LAN_2,
'user_signup_activated' => NU_LAN_3,
'login' => NU_LAN_4,
'logout' => NU_LAN_5,
'user_xup_login' => 'User social login',
'user_xup_signup' => 'User social signup',
'user_ban_flood' => NS_LAN_2,
'user_ban_failed_login' => 'IP banned for multiple failed login attempts',
'user_profile_display' => "User views profile"
),
'administrators' => array(
'admin_password_update' => "Administrator updates their password",
'admin_user_created' => 'Administrator creates a new user',
'admin_user_activated' => "Administrator activates a new user"
),
'news' => array(
'admin_news_created' => NN_LAN_3,
'admin_news_updated' => NN_LAN_4,
'admin_news_deleted' => NN_LAN_5,
'user_news_submit' => NN_LAN_2,
),
'mail' => array(
'maildone' => NM_LAN_2,
),
'file' => array(
// 'fileupload' => NF_LAN_2,
'user_file_upload' => NF_LAN_2,
),
);
}
'usersup' => 'user_signup_submitted',
'userveri' => 'user_signup_activated',
'flood' => 'user_ban_flood',
'subnews' => 'user_news_submit',
'fileupload' => 'user_file_upload',
'newspost' => 'admin_news_created',
'newsupd' => 'admin_news_updated',
'newsdel' => 'admin_news_deleted'
);
function coreList() function coreList()
@@ -119,8 +134,7 @@ class e107_event
/** /**
* Trigger event * Trigger event
* TODO - admin log for failed callback attempts? *
*
* @param string $eventname * @param string $eventname
* @param mixed $data * @param mixed $data
* @return mixed * @return mixed

View File

@@ -3170,6 +3170,10 @@ class e_form
$ttl = $expand."<button class='btn btn-default btn-mini pull-right'>More..</button>"; $ttl = $expand."<button class='btn btn-default btn-mini pull-right'>More..</button>";
$ttl1 = "<button class='btn btn-default btn-mini pull-right'>..Less</button>"; $ttl1 = "<button class='btn btn-default btn-mini pull-right'>..Less</button>";
} }
else
{
$ttl1 = null;
}
$expands = '<a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($ttl, $ttl)."</a>"; $expands = '<a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($ttl, $ttl)."</a>";
$contracts = '<a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($ttl1, $ttl1)."</a>"; $contracts = '<a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($ttl1, $ttl1)."</a>";
@@ -3266,7 +3270,7 @@ class e_form
// Support readParms example: thumb={width} // Support readParms example: thumb={width}
if(!isset($parms['w']) && is_numeric($parms['thumb']) && '1' != $parms['thumb']) if(!isset($parms['w']) && is_numeric($parms['thumb']) && '1' != $parms['thumb'])
{ {
$thparms['w'] = intval($thumb); $thparms['w'] = intval($parms['thumb']);
} }
elseif(vartrue($parms['thumb_aw'])) // Legacy v2. elseif(vartrue($parms['thumb_aw'])) // Legacy v2.
{ {

View File

@@ -67,62 +67,62 @@ document.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS
"; ";
*/ */
$logJS = "
$(function() {
function rstr2b64(input)
{
var b64pad = \"=\"; /* base-64 pad character. \"=\" for strict RFC compliance */
var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";
var output = \"\";
var len = input.length;
for(var i = 0; i < len; i += 3)
{
var triplet = (input.charCodeAt(i) << 16)
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
}
}
return output;
}
var ref =\"\"+escape(top.document.referrer);
var colord = window.screen.colorDepth;
var res = window.screen.width + \"x\" + window.screen.height;
var logString = 'referer=' + ref + '&colour=' + colord + '&eself=' + eself + '&res=' + res + '".$err_flag."';
logString = rstr2b64(logString);
var url = '".SITEURLBASE.e_PLUGIN_ABS."log/log.php';
var dataText = 'lv='+logString;
$.ajax({
type: 'get',
url: url,
data: {'lv' :logString},
success: function(e) {
if(e)
{
alert(e);
}
}
});
});
";
if(USER_AREA) if(USER_AREA)
{ {
$logJS = "
$(function() {
function rstr2b64(input)
{
var b64pad = \"=\"; /* base-64 pad character. \"=\" for strict RFC compliance */
var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";
var output = \"\";
var len = input.length;
for(var i = 0; i < len; i += 3)
{
var triplet = (input.charCodeAt(i) << 16)
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
}
}
return output;
}
var ref =\"\"+escape(top.document.referrer);
var colord = window.screen.colorDepth;
var res = window.screen.width + \"x\" + window.screen.height;
var logString = 'referer=' + ref + '&colour=' + colord + '&eself=' + eself + '&res=' + res + '".$err_flag."';
logString = rstr2b64(logString);
var url = '".SITEURLBASE.e_PLUGIN_ABS."log/log.php';
var dataText = 'lv='+logString;
$.ajax({
type: 'get',
url: url,
data: {'lv' :logString},
success: function(e) {
if(e)
{
alert(e);
}
}
});
});
";
e107::js('footer-inline', $logJS, 'jquery'); e107::js('footer-inline', $logJS, 'jquery');
} }
} }