1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Merge pull request #36 from e107inc/master

.
This commit is contained in:
rica-carv
2016-12-14 21:02:13 +00:00
committed by GitHub
28 changed files with 2411 additions and 414 deletions

View File

@@ -1127,27 +1127,77 @@ if (($_SERVER['QUERY_STRING'] == 'logout')/* || (($pref['user_tracking'] == 'ses
exit(); exit();
} }
/*
* Calculate time zone offset, based on session cookie set in e107.js.
* (Buyer beware: this may be wrong for the first pageview in a session,
* which is while the user is logged out, so not a problem...)
*
* Time offset is SECONDS. Seconds is much better than hours as a base,
* as some places have 30 and 45 minute time zones.
* It matches user clock time, instead of only time zones.
* Add the offset to MySQL/server time to get user time.
* Subtract the offset from user time to get server time.
*
*/
$tz = vartrue($pref['timezone'],'GMT'); //TODO Adjust on the front-end based on user timezone value.
date_default_timezone_set($tz); // Must be set or PHP Warning thrown.
unset($tz);
$e_deltaTime=0; /**
* @addtogroup timezone
* @{
*/
/**
* Generate an array of time zones.
*
* @return array
* Array of time zones.
*/
function systemTimeZones()
{
// Never do something time consuming twice if you can hold onto the results
// and re-use them. So we re-use the statically cached value to save time
// and memory.
static $zones = array();
// If Timezone list is not populated yet.
if(empty($zones))
{
$zonelist = timezone_identifiers_list();
$timeNow = date('m/d/Y H:i', $_SERVER['REQUEST_TIME']);
foreach($zonelist as $zone)
{
// Because many time zones exist in PHP only for backward compatibility
// reasons and should not be used, the list is filtered by a regular
// expression.
if(preg_match('!^((Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)/|UTC$)!', $zone))
{
$dateTimeZone = new DateTimeZone($zone);
$dateTime = new DateTime($timeNow, $dateTimeZone);
$offset = $dateTime->format('O');
$offset = chunk_split($offset, 3, ':');
$zones[$zone] = str_replace('_', ' ', $zone) . ' (' . rtrim($offset, ':') . ')';
}
}
// Sort time zones alphabetically.
asort($zones);
}
return $zones;
}
/**
* Validate a timezone.
*
* @param string $zone
* Timezone.
*
* @return bool
*/
function systemTimeZoneIsValid($zone = '')
{
$zones = systemTimeZones();
$zoneKeys = array_keys($zones);
if(in_array($zone, $zoneKeys))
{
return true;
}
return false;
}
$e_deltaTime = 0;
if (isset($_COOKIE['e107_tdOffset'])) if (isset($_COOKIE['e107_tdOffset']))
{ {
@@ -1163,6 +1213,10 @@ if (isset($_COOKIE['e107_tzOffset']))
define('TIMEOFFSET', $e_deltaTime); define('TIMEOFFSET', $e_deltaTime);
/**
* @} End of "addtogroup timezone".
*/
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1723,6 +1777,33 @@ function init_session()
// New user model // New user model
$user = e107::getUser(); $user = e107::getUser();
// Get user timezone.
$tzUser = $user->getTimezone();
// If user timezone is valid.
if (varset($tzUser, false) && systemTimeZoneIsValid($tzUser))
{
// Sets the default timezone used by all date/time functions.
date_default_timezone_set($tzUser);
// Save timezone for later use.
define('USERTIMEZONE', $tzUser);
unset($tzUser);
}
else
{
// Use system default timezone.
$pref = e107::getPref();
$tz = vartrue($pref['timezone'], 'UTC');
// Sets the default timezone used by all date/time functions.
date_default_timezone_set($tz);
// Save timezone for later use.
define('USERTIMEZONE', $tz);
unset($tz);
}
define('USERIP', e107::getIPHandler()->getIP(FALSE)); define('USERIP', e107::getIPHandler()->getIP(FALSE));
define('POST_REFERER', md5($user->getToken())); define('POST_REFERER', md5($user->getToken()));

View File

@@ -1,9 +1,9 @@
# Custom error pages for php scripts only # Custom error pages for php scripts only
<FilesMatch \.php$> <FilesMatch \.php$>
ErrorDocument 400 /error.php?400 ErrorDocument 400 /error.php?400
ErrorDocument 401 /error.php?401 ErrorDocument 401 /error.php?401
ErrorDocument 403 /error.php?403 ErrorDocument 403 /error.php?403
ErrorDocument 404 /error.php?404 ErrorDocument 404 /error.php?404
ErrorDocument 500 /error.php?500 ErrorDocument 500 /error.php?500
</FilesMatch> </FilesMatch>

View File

@@ -20,7 +20,7 @@ if (!defined('e107_INIT'))
header('Content-type: text/html; charset=utf-8', TRUE); header('Content-type: text/html; charset=utf-8', TRUE);
define('ADMINFEED', 'http://e107.org/adminfeed'); define('ADMINFEED', 'https://e107.org/adminfeed');
@@ -67,6 +67,13 @@ if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type']
echo $text; echo $text;
} }
else
{
if(e_DEBUG)
{
// echo "Feed failed: ".ADMINFEED;
}
}
exit; exit;
} }
@@ -92,7 +99,7 @@ if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons' )
} }
if($data = e107::getXml()->getRemoteFile('http://e107.org/feed/?limit=3&type='.$type,3)) if($data = e107::getXml()->getRemoteFile('https://e107.org/feed/?limit=3&type='.$type,3))
{ {
$rows = e107::getXml()->parseXml($data, 'advanced'); $rows = e107::getXml()->parseXml($data, 'advanced');
// print_a($rows); // print_a($rows);

View File

@@ -727,43 +727,15 @@ $text .= "
$text .= " $text .= "
</td> </td>
</tr> </tr>";
<tr>
<td><label for='time-offset'>".PRFLAN_26."</label></td>
<td>
".$frm->select_open('time_offset', 'class=tbox select time-offset');//use form handler because of the tabindex
$toffset = array("-12", "-11", "-10", "-9", "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1", "0", "+1", "+2", "+3", "+4", "+5", "+6", "+7", "+8", "+9", "+10", "+11", "+12", "+13", "+14", "+15", "+16");
if(! isset($pref['time_offset']))
{
$pref['time_offset'] = "0";
}
//XXX TODO FIXME - Do we still need this?
foreach($toffset as $o)
{
$text .= "
".$frm->option($o, $o, ($o == $pref['time_offset']))."
";
}
$timeZones = timezone_identifiers_list();
$timeZones = systemTimeZones();
$text .= " $text .= "
</select>
<div class='smalltext field-help'>".PRFLAN_27."</div>
</td>
</tr>
<tr> <tr>
<td><label for='timezone'>".PRFLAN_56."</label></td> <td><label for='timezone'>".PRFLAN_56."</label></td>
<td> <td>
".$frm->select('timezone', $timeZones, vartrue($pref['timezone'],'GMT'), 'useValues=1')." ".$frm->select('timezone', $timeZones, vartrue($pref['timezone'], 'UTC'))."
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -772,6 +744,7 @@ $text .= "
</fieldset> </fieldset>
"; ";
// =========== Registration Preferences. ================== // =========== Registration Preferences. ==================

View File

@@ -1,102 +1,104 @@
<?php <?php
/*
/**
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2011 e107 Inc (e107.org) * Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* System error controller * @file
* * System error controller.
* $URL$ */
* $Id$
*/
/**
* Class core_system_error_controller.
*/
class core_system_error_controller extends eController class core_system_error_controller extends eController
{ {
function preAction()
/**
* Pre-action callback, fired only if dispatch status is still true
* and action method is found.
*/
public function preAction()
{ {
e107::coreLan('error'); e107::coreLan('error');
} }
/**
* Alias
*/
public function action404()
{
$this->_forward('notfound');
}
public function actionNotfound()
{
$this->getResponse()
->setRenderMod('error404')
->addHeader('HTTP/1.0 404 Not Found');
$this->addTitle(LAN_ERROR_7);
$template = e107::getCoreTemplate('error', 404);
$vars = new e_vars(array(
'SITEURL' => SITEURL,
'SEARCHURL' => e107::getUrl()->create('search'),
));
$body = e107::getParser()->parseTemplate(
$this->updateTemplate($template['start']).
$this->updateTemplate($template['body']).
$this->updateTemplate($template['end'])
, true, null, $vars);
$this->addBody($body);
}
/** /**
* Update template to v2.x spec. ALL CAPS shortcodes only. * Alias for "Error 403".
* @param $template
* @return mixed
*/
private function updateTemplate($template)
{
$srch = array('{siteUrl}','{searchUrl}');
$repl = array('{SITEURL}','{SEARCHURL}');
return str_replace($srch,$repl,$template);
}
/**
* Alias
*/ */
public function action403() public function action403()
{ {
$this->_forward('forbidden'); $this->_forward('forbidden');
} }
/**
* Alias for "Error 404".
*/
public function action404()
{
$this->_forward('notfound');
}
/**
* Error 403.
*/
public function actionForbidden() public function actionForbidden()
{ {
$this->getResponse() $response = $this->getResponse();
->setRenderMod('error403') $response->setRenderMod('error403');
->addHeader('HTTP/1.0 403 Forbidden'); $response->addHeader('HTTP/1.0 403 Forbidden');
$this->addTitle(LAN_ERROR_7); $tp = e107::getParser();
$template = e107::getCoreTemplate('error', 403); $tpl = e107::getCoreTemplate('error', '403');
$sc = e107::getScBatch('error');
$vars = new e_vars(array(
'SITEURL' => SITEURL, $title = LAN_ERROR_TITLE;
$subtitle = LAN_ERROR_4;
$caption = LAN_ERROR_45;
$content = LAN_ERROR_5 . '<br/>' . LAN_ERROR_6 . '<br/><br/>' . LAN_ERROR_2;
$sc->setVars(array(
'title' => $title,
'subtitle' => $subtitle,
'caption' => $caption,
'content' => $content,
)); ));
$body = e107::getParser()->parseTemplate( $body = $tp->parseTemplate($tpl, true, $sc);
$this->updateTemplate($template['start']).
$this->updateTemplate($template['body']).
$this->updateTemplate($template['end'])
, true, null, $vars);
$this->addBody($body); $this->addBody($body);
} }
function actionHelloWorld() /**
* Error 404.
*/
public function actionNotfound()
{ {
//$this->addTitle('Hello!'); $response = $this->getResponse();
//echo 'Hello World'; $response->setRenderMod('error404');
$response->addHeader('HTTP/1.0 404 Not Found');
$tp = e107::getParser();
$tpl = e107::getCoreTemplate('error', '404');
$sc = e107::getScBatch('error');
$title = LAN_ERROR_TITLE;
$subtitle = LAN_ERROR_7;
$caption = LAN_ERROR_45;
$content = LAN_ERROR_21 . '<br/>' . LAN_ERROR_9;
$sc->setVars(array(
'title' => $title,
'subtitle' => $subtitle,
'caption' => $caption,
'content' => $content,
));
$body = $tp->parseTemplate($tpl, true, $sc);
$this->addBody($body);
} }
} }

View File

@@ -0,0 +1,81 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* @file
* Error shortcodes.
*/
if(!defined('e107_INIT'))
{
exit;
}
/**
* Class error_shortcodes.
*/
class error_shortcodes extends e_shortcode
{
/**
* @return mixed
*/
public function sc_error_title()
{
return varset($this->var['title'], '');
}
/**
* @return mixed
*/
public function sc_error_subtitle()
{
return varset($this->var['subtitle'], '');
}
/**
* @return mixed
*/
public function sc_error_caption()
{
return varset($this->var['caption'], '');
}
/**
* @return mixed
*/
public function sc_error_content()
{
return varset($this->var['content'], '');
}
/**
* @return string
*/
public function sc_error_link_home()
{
$icon = e107::getParser()->toGlyph('fa-home');
$url = SITEURL;
return '<a href="' . $url . '" class="btn btn-primary">' . $icon . ' ' . LAN_ERROR_20 . '</a>';
}
/**
* @return string
*/
public function sc_error_link_search()
{
$icon = e107::getParser()->toGlyph('fa-search');
$url = e107::getUrl()->create('search');
return '<a href="' . $url . '" class="btn btn-default">' . $icon . ' ' . LAN_ERROR_22 . '</a>';
}
}

View File

@@ -61,7 +61,7 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
{ {
$NEWSCAT_ITEM = " $NEWSCAT_ITEM = "
<div style='width:100%;padding-bottom:2px'> <div style='width:100%;padding-bottom:2px'>
<table style='width:100%' cellpadding='0' cellspacing='0' border='0'> <table class='news-category table' style='width:100%' cellpadding='0' cellspacing='0' border='0'>
<tr> <tr>
<td style='width:2px;vertical-align:top'>&#8226; <td style='width:2px;vertical-align:top'>&#8226;
</td> </td>
@@ -85,7 +85,7 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
} }
if(!defined("NEWSCAT_STYLE")) if(!defined("NEWSCAT_STYLE"))
{ {
define("NEWSCAT_STYLE","width:96%"); define("NEWSCAT_STYLE",'');
} }
if(!defined("NEWSCAT_CATICON")) if(!defined("NEWSCAT_CATICON"))
{ {
@@ -131,7 +131,7 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
$text3 = "\n\n\n $text3 = "\n\n\n
<div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'> <div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'>
<table style='".NEWSCAT_STYLE."' cellpadding='0' cellspacing='0'> <table class='table' style='".NEWSCAT_STYLE."' cellpadding='0' cellspacing='0'>
\n"; \n";
$t = 0; $t = 0;
$wid = floor(100/$nbr_cols); $wid = floor(100/$nbr_cols);

View File

@@ -14,121 +14,136 @@
* $Author$ * $Author$
*/ */
if (!defined('e107_INIT')) { exit; } if(!defined('e107_INIT'))
{
exit;
}
/* /**
This file is used with the extended user field 'predefined list' type. It is invoked when the value field is 'timezones'. * @file
* This file is used with the extended user field 'predefined list' type. It is
* invoked when the value field is 'timezones'.
*
* It is an example of an extended user field which access a predetermined list
* of key-pair values. In this example all the data is loaded into memory; for
* other applications the data may be read from a database, possibly with
* caching.
*
* The objective is to provide a uniform interface to such data.
*
* The class name must be the same as the file name - i.e. the list name
* prefixed with 'extended_'.
*
* The variable name must be 'timezones_list', and is an array of possible
* values, each of which is a value => text pair.
*
* The text is displayed in a drop-down; the value is returned.
*
* If function timezones_value() exists, it is called to create the displayed
* text.
*/
It is an example of an extended user field which access a predetermined list of key-pair values. In this example all the data is loaded
into memory; for other applications the data may be read from a database, possibly with caching.
The objective is to provide a uniform interface to such data.
The class name must be the same as the file name - i.e. the list name prefixed with 'extended_'.
The variable name must be 'timezones_list', and is an array of possible values, each of which is a value => text pair
The text is displayed in a drop-down; the value is returned.
If function timezones_value() exists, it is called to create the displayed text
*/
/**
* Class extended_timezones.
*/
class extended_timezones class extended_timezones
{ {
private $timezonesList = array( /**
'-12' => "International DateLine West", * @var array
'-11' => "Samoa", */
'-10' => "Hawaii", private $timezonesList = array();
'-9' => "Alaska",
'-8' => "Pacific Time (US and Canada)",
'-7' => "Mountain Time (US and Canada)",
'-6' => "Central Time (US and Canada), Central America",
'-5' => "Eastern Time (US and Canada)",
'-4' => "Atlantic Time (Canada)",
'-3.30' => 'Newfoundland',
'-3' => "Greenland, Brasilia, Buenos Aires, Georgetown",
'-2' => "Mid-Atlantic",
'-1' => "Azores, Cape Verde Islands",
'+0' => "UK, Ireland, Lisbon",
'+1' => "West Central Africa, Western Europe",
'+2' => "Greece, Egypt, parts of Africa",
'+3' => "Russia, Baghdad, Kuwait, Nairobi",
'+3.30' => 'Tehran, Iran',
'+4' => "Abu Dhabi, Kabul",
'+4.30' => 'Afghanistan',
'+5' => "Islamabad, Karachi",
'+5.30' => "Mumbai, Delhi, Calcutta",
'+5.45' => 'Kathmandu',
'+6' => "Astana, Dhaka",
'+7' => "Bangkok, Rangoon",
'+8' => "Hong Kong, Singapore, Perth, Beijing",
'+9' => "Tokyo, Seoul",
'+9.30' => 'Darwin, Adelaide',
'+10' => "Brisbane, Canberra, Sydney, Melbourne",
'+10.30' => 'Lord Howe Island',
'+11' => "Soloman Islands",
'+11.30' => 'Norfolk Island',
'+12' => "New Zealand, Fiji, Marshall Islands",
'+13' => "Tonga, Nuku'alofa, Rawaki Islands",
'+13.45' => 'Chatham Island',
'+14' => 'Kiribati: Line Islands'
);
private $isEOF = FALSE; // True if at last element of list
private $bufferValid = FALSE;
/** /**
* Call before using the 'next' format option, to ensure the array is indexed from the beginning * @var bool
*/
private $isEOF = false; // True if at last element of list.
/**
* @var bool
*/
private $bufferValid = false;
/**
* Constructor.
*/
public function __construct()
{
$this->timezonesList = systemTimeZones();
}
/**
* Call before using the 'next' format option, to ensure the array is
* indexed from the beginning.
*/ */
public function pointerReset() public function pointerReset()
{ {
$this->isEOF = (FALSE === reset($this->timezonesList)); $this->isEOF = (false === reset($this->timezonesList));
$this->bufferValid = TRUE; $this->bufferValid = true;
} }
/** /**
* Return a formatted timezone value * Return a formatted timezone value
* *
* @param mixed $key - the key value to select * @param mixed $key
* @param string $formatSpec - defines format of return value * The key value to select.
* @param string $formatSpec
* Defines format of return value.
* *
* @return mixed (according to $formatSpec). FALSE if no value available * @return mixed
* 'array' - a single-element array; key as passed, and value to match key * (according to $formatSpec).
* 'next' - as 'array', but ignores the passed $key and moves to next value. * false - if no value available.
* default - a string usable for display * 'array' - a single-element array; key as passed, and value to match key
* 'next' - as 'array', but ignores the passed $key and moves to next value.
* 'default' - a string usable for display.
*/ */
public function getValue($key, $formatSpec = '') public function getValue($key, $formatSpec = '')
{ {
if ($formatSpec == 'next') if($formatSpec == 'next')
{ {
if (!$this->bufferValid) $this->pointerReset; // Make sure buffer is defined // Make sure buffer is defined.
if ($this->isEOF) return FALSE; if(!$this->bufferValid)
{
$this->pointerReset();
}
if($this->isEOF)
{
return false;
}
$key = key($this->timezonesList); $key = key($this->timezonesList);
$val = current($this->timezonesList); $val = current($this->timezonesList);
if (FALSE === $val)
if(false === $val)
{ {
$this->isEOF = TRUE; $this->isEOF = true;
return FALSE; return false;
} }
$this->isEOF = (FALSE === next($this->timezonesList));
$this->isEOF = (false === next($this->timezonesList));
return array($key => $val); return array($key => $val);
} }
$exists = isset($this->timezonesList[$key]); $exists = isset($this->timezonesList[$key]);
if (!$exists) return FALSE;
if(!$exists)
{
return false;
}
$val = $this->timezonesList[$key]; $val = $this->timezonesList[$key];
if ($formatSpec == 'array')
if($formatSpec == 'array')
{ {
return array($key => $val); return array($key => $val);
} }
// Default (as per earlier implementations) - can be specified with 'display' format // Default (as per earlier implementations) - can be specified with
return 'GMT'.$key.' - '.$val; // 'display' format.
return $val;
} }
} }
?>

View File

@@ -1,47 +1,187 @@
<?php <?php
/*
/**
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2013 e107 Inc (e107.org) * Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* Error Templates * @file
* * Error templates.
* $Id: $
*/ */
/** if(!defined('e107_INIT'))
* {
* @package e107 exit;
* @subpackage e107_templates }
* @version $Id$;
*
*/
if (!defined('e107_INIT')) { exit; }
$ERROR_TEMPLATE = array(); $ERROR_TEMPLATE = array();
$ERROR_TEMPLATE['404']['start'] = '<div class="error-404 alert-danger">'; /**
$ERROR_TEMPLATE['404']['body'] = ' * 400 Bad Request.
<h3><i class="icon-exclamation-sign" title="'.LAN_ERROR_45.'"></i> '.LAN_ERROR_45.'</h3> */
<p> $ERROR_TEMPLATE['400'] = '
'.LAN_ERROR_21.'<br />'.LAN_ERROR_9.' <h1 class="text-center">
</p> <strong>{ERROR_TITLE}</strong>
<a href="{SITEURL}">'.LAN_ERROR_20.'</a><br /> </h1>
<a href="{SEARCHURL}">'.LAN_ERROR_22.'</a> <h2 class="text-center">
{ERROR_SUBTITLE}
</h2>
<br/>
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
{ERROR_CAPTION}
</div>
<div class="panel-body">
{ERROR_CONTENT}
</div>
</div>
</div>
<br/>
<div class="error-actions text-center">
{ERROR_LINK_HOME}
</div>
<br/>
'; ';
$ERROR_TEMPLATE['404']['end'] = '</div>';
/**
$ERROR_TEMPLATE['403']['start'] = '<div class="error-403 alert-danger">'; * 401 Unauthorized.
$ERROR_TEMPLATE['403']['body'] = ' */
<h3><i class="icon-exclamation-sign" title="'.LAN_ERROR_4.'"></i> '.LAN_ERROR_4.'</h3> $ERROR_TEMPLATE['401'] = '
<p> <h1 class="text-center">
'.LAN_ERROR_5.'<br />'.LAN_ERROR_6.'<br /><br />'.LAN_ERROR_2.' <strong>{ERROR_TITLE}</strong>
</p> </h1>
<a href="{SITEURL}">'.LAN_ERROR_20.'</a><br /> <h2 class="text-center">
{ERROR_SUBTITLE}
</h2>
<br/>
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
{ERROR_CAPTION}
</div>
<div class="panel-body">
{ERROR_CONTENT}
</div>
</div>
</div>
<br/>
<div class="error-actions text-center">
{ERROR_LINK_HOME}
</div>
<br/>
'; ';
$ERROR_TEMPLATE['403']['end'] = '</div>';
/**
* 403 Forbidden.
*/
$ERROR_TEMPLATE['403'] = '
<h1 class="text-center">
<strong>{ERROR_TITLE}</strong>
</h1>
<h2 class="text-center">
{ERROR_SUBTITLE}
</h2>
<br/>
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
{ERROR_CAPTION}
</div>
<div class="panel-body">
{ERROR_CONTENT}
</div>
</div>
</div>
<br/>
<div class="error-actions text-center">
{ERROR_LINK_HOME}
</div>
<br/>
';
/**
* 404 Not Found.
*/
$ERROR_TEMPLATE['404'] = '
<h1 class="text-center">
<strong>{ERROR_TITLE}</strong>
</h1>
<h2 class="text-center">
{ERROR_SUBTITLE}
</h2>
<br/>
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
{ERROR_CAPTION}
</div>
<div class="panel-body">
{ERROR_CONTENT}
</div>
</div>
</div>
<br/>
<div class="error-actions text-center">
{ERROR_LINK_HOME} {ERROR_LINK_SEARCH}
</div>
<br/>
';
/**
* 500 Internal server error.
*/
$ERROR_TEMPLATE['500'] = '
<h1 class="text-center">
<strong>{ERROR_TITLE}</strong>
</h1>
<h2 class="text-center">
{ERROR_SUBTITLE}
</h2>
<br/>
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
{ERROR_CAPTION}
</div>
<div class="panel-body">
{ERROR_CONTENT}
</div>
</div>
</div>
<br/>
<div class="error-actions text-center">
{ERROR_LINK_HOME}
</div>
<br/>
';
/**
* Default error page.
*/
$ERROR_TEMPLATE['DEFAULT'] = '
<h1 class="text-center">
<strong>{ERROR_TITLE}</strong>
</h1>
<h2 class="text-center">
{ERROR_SUBTITLE}
</h2>
<br/>
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
{ERROR_CAPTION}
</div>
<div class="panel-body">
{ERROR_CONTENT}
</div>
</div>
</div>
<br/>
<div class="error-actions text-center">
{ERROR_LINK_HOME}
</div>
<br/>
';

View File

@@ -42,7 +42,7 @@ class core_system_rewrite_url extends eUrlConfig
'name' => LAN_EURL_CORE_SYSTEM, // Module name 'name' => LAN_EURL_CORE_SYSTEM, // Module name
'label' => LAN_EURL_SYSTEM_REWRITE_LABEL, // Current profile name 'label' => LAN_EURL_SYSTEM_REWRITE_LABEL, // Current profile name
'description' => LAN_EURL_SYSTEM_REWRITE_DESCR, // 'description' => LAN_EURL_SYSTEM_REWRITE_DESCR, //
'examples' => array("{SITEURL}system/error404") 'examples' => array("{SITEURL}system/error/404")
), ),
'form' => array(), // Under construction - additional configuration options 'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity 'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity

View File

@@ -310,7 +310,6 @@ City, State, Country
<core name="subnews_resize"></core> <core name="subnews_resize"></core>
<core name="themecss">style.css</core> <core name="themecss">style.css</core>
<core name="thumbnail_quality">75</core> <core name="thumbnail_quality">75</core>
<core name="time_offset">0</core>
<core name="timezone">UTC</core> <core name="timezone">UTC</core>
<core name="track_online">1</core> <core name="track_online">1</core>
<core name="ue_upgrade">1</core> <core name="ue_upgrade">1</core>

View File

@@ -45,6 +45,12 @@ class ecache {
*/ */
public function setMD5($text, $hash=true) public function setMD5($text, $hash=true)
{ {
if($text === null)
{
$this->CachePageMD5 = md5(e_BASE.e_LANGUAGE.THEME.USERCLASS_LIST.defset('e_QUERY').filemtime(THEME.'theme.php'));
return $this;
}
$this->CachePageMD5 = ($hash === true) ? md5($text) : $text; $this->CachePageMD5 = ($hash === true) ? md5($text) : $text;
return $this; return $this;
} }

View File

@@ -1177,7 +1177,7 @@ class comment
$ret['comment'] = $text; $ret['comment'] = $text;
$ret['moderate'] = $modcomment;
$ret['comment_form'] = $comment; $ret['comment_form'] = $comment;
$ret['caption'] = "<span id='e-comment-total'>".$this->totalComments."</span> ".LAN_COMMENTS; $ret['caption'] = "<span id='e-comment-total'>".$this->totalComments."</span> ".LAN_COMMENTS;

View File

@@ -3036,11 +3036,26 @@ class e107
/** /**
* Simple redirect method for developers. * Simple redirect method for developers.
* @param $url string : 'admin' to redirect to admin entry page or leave blank to go to home page (SITEURL) *
* @param string $url
* 'admin' to redirect to admin entry page or leave blank to go to home page
* (SITEURL).
* @param int $http_response_code
* The HTTP status code to use for the redirection, defaults to 302.
* The valid values for 3xx redirection status codes are defined in RFC 2616
* and the draft for the new HTTP status codes:
* - 301: Moved Permanently (the recommended value for most redirects).
* - 302: Found (default in PHP, sometimes used for spamming search engines).
* - 303: See Other.
* - 304: Not Modified.
* - 305: Use Proxy.
* - 307: Temporary Redirect.
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
* @see https://tools.ietf.org/html/draft-reschke-http-status-308-07
*/ */
public static function redirect($url='') public static function redirect($url = '', $http_response_code = 302)
{ {
self::getRedirect()->go($url); self::getRedirect()->go($url, true, $http_response_code);
} }

View File

@@ -4060,7 +4060,7 @@ class e_parser
if($type == 'youtube') if($type == 'youtube')
{ {
// $thumbSrc = "https://i1.ytimg.com/vi/".$id."/0.jpg"; // $thumbSrc = "https://i1.ytimg.com/vi/".$id."/0.jpg";
$thumbSrc = "http://i1.ytimg.com/vi/".$id."/mqdefault.jpg"; $thumbSrc = "https://i1.ytimg.com/vi/".$id."/mqdefault.jpg";
$video = '<iframe class="embed-responsive-item" width="560" height="315" src="//www.youtube.com/embed/'.$id.'?'.$ytqry.'" style="background-size: 100%;background-image: url('.$thumbSrc.');border:0px" allowfullscreen></iframe>'; $video = '<iframe class="embed-responsive-item" width="560" height="315" src="//www.youtube.com/embed/'.$id.'?'.$ytqry.'" style="background-size: 100%;background-image: url('.$thumbSrc.');border:0px" allowfullscreen></iframe>';

View File

@@ -1255,6 +1255,7 @@ class e_file
// $text = 'umask 0022'; //Could correct permissions issue with 0664 files. // $text = 'umask 0022'; //Could correct permissions issue with 0664 files.
// Change Dir. // Change Dir.
$folder = e107::getParser()->filter($folder,'file'); // extra filter to keep RIPS happy.
switch($type) switch($type)
{ {

View File

@@ -219,6 +219,13 @@ class e_user_model extends e_admin_model
return ($this->isAdmin() ? $this->get('user_perms') : false); return ($this->isAdmin() ? $this->get('user_perms') : false);
} }
final public function getTimezone()
{
// If timezone is not set, we return an empty string in order to use the
// default timezone is set for e107.
return ($this->get('user_timezone') ? $this->get('user_timezone') : '');
}
/** /**
* DEPRECATED - will be removed or changed soon (see e_session) * DEPRECATED - will be removed or changed soon (see e_session)
* @return string * @return string

View File

@@ -10,6 +10,7 @@
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
define("PAGE_NAME", "Error"); define("PAGE_NAME", "Error");
define("LAN_ERROR_TITLE", "Oops!");
define("LAN_ERROR_1", "Error 401 - Authentication Failed"); define("LAN_ERROR_1", "Error 401 - Authentication Failed");
define("LAN_ERROR_2", "The URL you've requested requires a correct username and password. Either you entered an incorrect username/password, or your browser doesn't support this feature."); define("LAN_ERROR_2", "The URL you've requested requires a correct username and password. Either you entered an incorrect username/password, or your browser doesn't support this feature.");
@@ -21,7 +22,7 @@ define("LAN_ERROR_6", "Please inform the administrator of the referring page if
define("LAN_ERROR_7", "Error 404 - Document Not Found"); define("LAN_ERROR_7", "Error 404 - Document Not Found");
define("LAN_ERROR_9", "Please inform the administrator of the referring page if you think this error message has been shown by mistake."); define("LAN_ERROR_9", "Please inform the administrator of the referring page if you think this error message has been shown by mistake.");
define("LAN_ERROR_10", "Error 500 - Malformed Header"); define("LAN_ERROR_10", "Error 500 - Internal server error");
define("LAN_ERROR_11", "The server encountered an internal error or misconfiguration and was unable to complete your request"); define("LAN_ERROR_11", "The server encountered an internal error or misconfiguration and was unable to complete your request");
define("LAN_ERROR_12", "Please inform the administrator of the referring page if you think this error page has been shown by mistake."); define("LAN_ERROR_12", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
define("LAN_ERROR_13", "Error - Unknown"); define("LAN_ERROR_13", "Error - Unknown");

View File

@@ -373,20 +373,25 @@ class forum_post_handler
global $FORUMPOST, $subjectbox, $userbox, $poll_form, $fileattach, $fileattach_alert; // needed for BC. global $FORUMPOST, $subjectbox, $userbox, $poll_form, $fileattach, $fileattach_alert; // needed for BC.
$FORUM_POST_TEMPLATE = array(); //-- $FORUM_POST_TEMPLATE = array();
$FORUM_POSTED_TEMPLATE = array(); //-- $FORUM_POSTED_TEMPLATE = array();
$FORUMREPLYPOSTED = ''; $FORUMREPLYPOSTED = '';
$FORUMTHREADPOSTED = ''; $FORUMTHREADPOSTED = '';
$FORUMPOLLPOSTED = ''; $FORUMPOLLPOSTED = '';
$file = "forum_".$type."_template.php"; // $file = "forum_".$type."_template.php";
if($template = e107::getTemplate('forum', 'forum_post')) // var_dump ($type);
{ // var_dump (e107::getTemplate('forum', 'forum_'.$type));
$FORUM_POST_TEMPLATE = $template; $template = e107::getTemplate('forum', 'forum_'.$type);
} //-- if($template = e107::getTemplate('forum', 'forum_'.$type))
elseif (empty($FORUMPOST) && empty($FORUMREPLYPOSTED) && empty($FORUMTHREADPOSTED)) //-- {
//-- $FORUM_POST_TEMPLATE = $template;
//-- }
//-- elseif (empty($FORUMPOST) && empty($FORUMREPLYPOSTED) && empty($FORUMTHREADPOSTED))
if (empty($template) && empty($FORUMPOST) && empty($FORUMREPLYPOSTED) && empty($FORUMTHREADPOSTED))
{ {
$file = "forum_".$type."_template.php";
if (is_readable(THEME.$file)) if (is_readable(THEME.$file))
{ {
include_once(THEME.$file); include_once(THEME.$file);
@@ -609,33 +614,29 @@ class forum_post_handler
if($type == 'post') //-- if($type == 'post' || $type == 'posted')
if($template)
{ {
$template= (deftrue('BOOTSTRAP')) ? $FORUM_POST_TEMPLATE : array('form'=>$FORUMPOST); //-- $template= (deftrue('BOOTSTRAP')) ? $FORUM_POST_TEMPLATE : array('form'=>$FORUMPOST);
$template= (deftrue('BOOTSTRAP')) ? $template : array('form'=>$FORUMPOST);
// print_a($template); // print_a($template);
return $this->upgradeTemplate($template); return $this->upgradeTemplate($template);
} }
else //-- else
{ //-- {
if (deftrue('BOOTSTRAP')) //v2.x //-- if (deftrue('BOOTSTRAP')) //v2.x
{ //-- {
return $FORUM_POSTED_TEMPLATE; //-- return $FORUM_POSTED_TEMPLATE;
} //-- }
else //v1.x //-- else //v1.x
{ //-- {
return array( return array(
"reply" => $FORUMREPLYPOSTED, "reply" => $FORUMREPLYPOSTED,
"thread" => $FORUMTHREADPOSTED, "thread" => $FORUMTHREADPOSTED,
"poll" => $FORUMPOLLPOSTED "poll" => $FORUMPOLLPOSTED
); );
//-- }
} //-- }
}
} }

View File

@@ -348,7 +348,8 @@ class forum_shortcodes extends e_shortcode
if(USER && is_array($this->newFlagList) && in_array($this->var['forum_id'], $this->newFlagList)) if(USER && is_array($this->newFlagList) && in_array($this->var['forum_id'], $this->newFlagList))
{ {
$url = $this->sc_lastpost('url');
$url = $this->sc_lastpost(array('type'=>'url'));
return "<a href='".$url."'>".IMAGE_new.'</a>'; return "<a href='".$url."'>".IMAGE_new.'</a>';
} }
elseif(empty($this->var['forum_replies']) && defined('IMAGE_noreplies')) elseif(empty($this->var['forum_replies']) && defined('IMAGE_noreplies'))
@@ -418,13 +419,13 @@ class forum_shortcodes extends e_shortcode
function sc_lastpostuser() function sc_lastpostuser()
{ {
return $this->sc_lastpost('username'); return $this->sc_lastpost(array('type'=>'username'));
} }
function sc_lastpostdate() function sc_lastpostdate()
{ {
return $this->sc_lastpost('datelink'); return $this->sc_lastpost(array('type'=>'datelink'));
} }

View File

@@ -797,13 +797,15 @@ function sc_buttonsx()
{ {
global $forum, $thread; global $forum, $thread;
if ($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active']) if ($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active'])
{ {
$url = e107::url('forum','post')."?f=rp&amp;id=".$this->var['thread_id']."&amp;post=".$thread->threadId; $url = e107::url('forum','post')."?f=rp&amp;id=".$this->var['thread_id']."&amp;post=".$thread->threadId;
// $url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId)); // $url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId));
$replyUrl = "<a class='btn btn-primary' href='".$url."'>".LAN_FORUM_2006."</a>";
} }
$replyUrl = "<a class='btn btn-primary".($url ?"":" disabled")."' "
.($url?"":" data-toggle='tooltip' title='".LAN_FORUM_0046."'
style='cursor: not-allowed; pointer-events: all !important;'")." href='".($url ?:"#")."'>".LAN_FORUM_2006."</a>";
if ($forum->checkPerm($this->var['thread_forum_id'], 'post')) if ($forum->checkPerm($this->var['thread_forum_id'], 'post'))
{ {
$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $this->var['thread_forum_id']; $ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $this->var['thread_forum_id'];
@@ -828,10 +830,21 @@ function sc_buttonsx()
} }
/*
$text = '<div class="btn-group">
'.($replyUrl?:"").'
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
'.($replyUrl?"":LAN_FORUM_1003." ".LAN_FORUM_8013).'<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu pull-right">
';
*/
$text = '<div class="btn-group"> $text = '<div class="btn-group">
'.($replyUrl?:LAN_FORUM_1003." ".LAN_FORUM_8013).' '.$replyUrl.'
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span> <span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button> </button>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
'; ';

View File

@@ -81,14 +81,28 @@
$jumpList = $forum->forumGetAllowed('view'); $jumpList = $forum->forumGetAllowed('view');
$text = '<div class="btn-group">'; $text = '<div class="btn-group">';
/*
$text .= $text .=
($this->var['ntUrl'] ? '<a href="'.$this->var['ntUrl'].'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>' : LAN_FORUM_1001." ".LAN_FORUM_8013). ($this->var['ntUrl'] ? '<a href="'.$this->var['ntUrl'].'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>' :'').
'<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> '<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span> '.($this->var['ntUrl'] ? '' : LAN_FORUM_1001." ".LAN_FORUM_8013).'<span class="caret"></span>
</button> <span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
'; ';
*/
$text .=
'<a href="'.($this->var['ntUrl'] ?:"#").
'" class="btn btn-primary'.($this->var['ntUrl'] ?"":" disabled").'"'
.($this->var['ntUrl'] ?"":" data-toggle='tooltip' title='".LAN_FORUM_0006."'
style='cursor: not-allowed; pointer-events: all !important;'").'>'.LAN_FORUM_1018.'</a>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu pull-right">
';
//-- foreach($jumpList as $key => $val) //-- foreach($jumpList as $key => $val)
foreach($jumpList as $val) foreach($jumpList as $val)
{ {
@@ -336,7 +350,7 @@
// Initial ideia, to have a separate shortcode var ($subsc).... // Initial ideia, to have a separate shortcode var ($subsc)....
//global $forum, $forumId, $threadFrom, $view; //global $forum, $forumId, $threadFrom, $view;
global $sc, $forum, $forumId; global $forum, $forumId;
// var_dump ($forumId); // var_dump ($forumId);
// var_dump (vartrue($forumId)); // var_dump (vartrue($forumId));
//var_dump ($forum->forumGetSubs(vartrue($forum_id))); //var_dump ($forum->forumGetSubs(vartrue($forum_id)));
@@ -429,12 +443,12 @@
// Initial ideia, to have a separate shortcode var ($subsc).... // Initial ideia, to have a separate shortcode var ($subsc)....
// $subsc->setVars($subInfo); // $subsc->setVars($subInfo);
// Use setVars or addVars??? // Use setVars or addVars???
$sc->setVars($subInfo); $this->addVars($subInfo);
//echo "--------------------------------------"; //echo "--------------------------------------";
// Initial ideia, to have a separate shortcode var ($subsc).... // Initial ideia, to have a separate shortcode var ($subsc)....
// $sub_info .= e107::getParser()->parseTemplate($FORUM_VIEW_SUB, false, $subsc); // $sub_info .= e107::getParser()->parseTemplate($FORUM_VIEW_SUB, false, $subsc);
$sub_info .= e107::getParser()->parseTemplate($FORUM_VIEW_SUB, false, $sc); $sub_info .= e107::getParser()->parseTemplate($FORUM_VIEW_SUB, false, $this);
//var_dump ($sc); //var_dump ($sc);

1580
e107_plugins/news/news.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -110,6 +110,8 @@ if (empty($rss_type))
} }
while (@ob_end_clean());
// Returning feeds here // Returning feeds here
// Conversion table for old urls ------- // Conversion table for old urls -------
$conversion[1] = 'news'; $conversion[1] = 'news';
@@ -199,7 +201,6 @@ class rssCreate
$sql_rs = new db; $sql_rs = new db;
global $rssgen; global $rssgen;
$sql = e107::getDb(); $sql = e107::getDb();
$pref = e107::getPref();
$tp = e107::getParser(); $tp = e107::getParser();
$this->e107 = e107::getInstance(); $this->e107 = e107::getInstance();
@@ -207,7 +208,6 @@ class rssCreate
$this -> path = e_PLUGIN."rss_menu/"; $this -> path = e_PLUGIN."rss_menu/";
$this -> rssType = $rss_type; $this -> rssType = $rss_type;
$this -> topicid = $topic_id; $this -> topicid = $topic_id;
$this -> offset = $pref['time_offset'] * 3600;
$this -> limit = $row['rss_limit']; $this -> limit = $row['rss_limit'];
$this -> contentType = $row['rss_name']; $this -> contentType = $row['rss_name'];
@@ -422,7 +422,7 @@ class rssCreate
<title>".$tp->toRss($rss_title)."</title> <title>".$tp->toRss($rss_title)."</title>
<link>".$pref['siteurl']."</link> <link>".$pref['siteurl']."</link>
<description>".$tp->toRss($pref['sitedescription'])."</description> <description>".$tp->toRss($pref['sitedescription'])."</description>
<lastBuildDate>".$itemdate = date("r", ($time + $this -> offset))."</lastBuildDate> <lastBuildDate>".$itemdate = date("r", ($time))."</lastBuildDate>
<docs>http://backend.userland.com/rss092</docs>\n"; <docs>http://backend.userland.com/rss092</docs>\n";
foreach($this -> rssItems as $value) foreach($this -> rssItems as $value)
@@ -473,8 +473,8 @@ class rssCreate
<copyright>".$tp->toRss(SITEDISCLAIMER)."</copyright> <copyright>".$tp->toRss(SITEDISCLAIMER)."</copyright>
<managingEditor>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</managingEditor> <managingEditor>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</managingEditor>
<webMaster>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</webMaster> <webMaster>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</webMaster>
<pubDate>".date("r",($time + $this -> offset))."</pubDate> <pubDate>".date("r",($time))."</pubDate>
<lastBuildDate>".date("r",($time + $this -> offset))."</lastBuildDate> <lastBuildDate>".date("r",($time))."</lastBuildDate>
<docs>http://backend.userland.com/rss</docs> <docs>http://backend.userland.com/rss</docs>
<generator>e107 (http://e107.org)</generator> <generator>e107 (http://e107.org)</generator>
<sy:updatePeriod>hourly</sy:updatePeriod> <sy:updatePeriod>hourly</sy:updatePeriod>
@@ -549,7 +549,7 @@ class rssCreate
echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\" />\n"; echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\" />\n";
} }
echo "<pubDate>".date("r", ($value['pubdate'] + $this -> offset))."</pubDate>\n"; echo "<pubDate>".date("r", ($value['pubdate']))."</pubDate>\n";
if($link) if($link)
{ {
@@ -596,7 +596,7 @@ class rssCreate
<link>".$pref['siteurl']."</link> <link>".$pref['siteurl']."</link>
<description>".$tp->toRss($pref['sitedescription'])."</description> <description>".$tp->toRss($pref['sitedescription'])."</description>
<dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language> <dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language>
<dc:date>".$this->get_iso_8601_date($time + $this -> offset). "</dc:date> <dc:date>".$this->get_iso_8601_date($time). "</dc:date>
<dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator> <dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator>
<admin:generatorAgent rdf:resource=\"http://e107.org\" /> <admin:generatorAgent rdf:resource=\"http://e107.org\" />
<admin:errorReportsTo rdf:resource=\"mailto:".$this->nospam($pref['siteadminemail'])."\" /> <admin:errorReportsTo rdf:resource=\"mailto:".$this->nospam($pref['siteadminemail'])."\" />
@@ -629,7 +629,7 @@ class rssCreate
<item rdf:about=\"".$link."\"> <item rdf:about=\"".$link."\">
<title>".$tp->toRss($value['title'])."</title> <title>".$tp->toRss($value['title'])."</title>
<link>".$link."</link> <link>".$link."</link>
<dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date> <dc:date>".$this->get_iso_8601_date($time)."</dc:date>
<dc:creator>".$value['author']."</dc:creator> <dc:creator>".$value['author']."</dc:creator>
<dc:subject>".$tp->toRss($value['category_name'])."</dc:subject> <dc:subject>".$tp->toRss($value['category_name'])."</dc:subject>
<description>".$tp->toRss($value['description']). "</description> <description>".$tp->toRss($value['description']). "</description>
@@ -653,7 +653,7 @@ class rssCreate
echo " echo "
<id>".$pref['siteurl']."</id>\n <id>".$pref['siteurl']."</id>\n
<title type='text'>".$tp->toRss($rss_title)."</title>\n <title type='text'>".$tp->toRss($rss_title)."</title>\n
<updated>".$this->get_iso_8601_date($time + $this -> offset)."</updated>\n"; <updated>".$this->get_iso_8601_date($time)."</updated>\n";
// Recommended // Recommended
echo " echo "
@@ -689,7 +689,7 @@ class rssCreate
echo " echo "
<id>".$value['link']."</id>\n <id>".$value['link']."</id>\n
<title type='text'>".$tp->toRss($value['title'])."</title>\n <title type='text'>".$tp->toRss($value['title'])."</title>\n
<updated>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</updated>\n"; <updated>".$this->get_iso_8601_date($value['pubdate'])."</updated>\n";
// Recommended // Recommended
$author = ($value['author']) ? $value['author'] : "unknown"; $author = ($value['author']) ? $value['author'] : "unknown";
@@ -713,7 +713,7 @@ class rssCreate
//<contributor> //<contributor>
// <name>Jane Doe</name> // <name>Jane Doe</name>
//</contributor> //</contributor>
echo "<published>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</published>\n"; echo "<published>".$this->get_iso_8601_date($value['pubdate'])."</published>\n";
//<source> //<source>
// <id>http://example.org/</id> // <id>http://example.org/</id>
// <title>Fourty-Two</title> // <title>Fourty-Two</title>

View File

@@ -29,5 +29,14 @@ div.checkboxes label.checkbox { display: block }
textarea.bbarea { margin:0; } textarea.bbarea { margin:0; }
#chatbox-input-block { text-align:center } #chatbox-input-block { text-align:center }
ul.breadcrumb { margin:15px 0; }
ul.breadcrumb li { display:inline-block; padding-right:5px;} ul.breadcrumb li { display:inline-block; padding-right:5px;}
ul.breadcrumb li span.divider { padding-left:5px; } ul.breadcrumb li span.divider { padding-left:5px; }
.row { margin-left:15px; margin-right:15px; }
.col-md-3 { float:left; width:25%; margin-right:15px}
.thumbnail img { border-radius:8px; }
.img-responsive { max-width:100%; }

248
error.php
View File

@@ -1,115 +1,159 @@
<?php <?php
/* /**
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2008-2016 e107 Inc (e107.org)
| Copyright (C) 2008-2009 e107 Inc * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| *
| * @file
| Released under the terms and conditions of the * System error pages.
| GNU General Public License (http://gnu.org). */
|
| $Source: /cvs_backup/e107_0.8/error.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
*/
define("ERR_PAGE_ACTIVE", 'error'); define("ERR_PAGE_ACTIVE", 'error');
//TODO - template(s) //We need minimal mod.
$_E107 = array(
'no_forceuserupdate',
'no_online',
'no_prunetmp',
);
//We need minimal mod
$_E107 = array('no_forceuserupdate', 'no_online', 'no_prunetmp');
require_once("class2.php"); require_once("class2.php");
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
//start session if required // Start session if required.
if(!session_id()) session_start(); if(!session_id())
if (!defined('PAGE_NAME')) define('PAGE_NAME','Error page');
$errorHeader = '';
$errorText = '';
$errorNumber = 999;
$errFrom = isset($_SESSION['e107_http_referer']) ? $_SESSION['e107_http_referer'] : $_SERVER['HTTP_REFERER'];
$errReturnTo = isset($_SESSION['e107_error_return']) ? $_SESSION['e107_error_return'] : array();
unset($_SESSION['e107_http_referer'], $_SESSION['e107_error_return']);
$errTo = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$errorQuery = htmlentities($_SERVER['QUERY_STRING']);
$base_path = e_HTTP;
if (is_numeric(e_QUERY)) $errorNumber = intval(e_QUERY);
switch($errorNumber)
{ {
case 400 : session_start();
$errorHeader = "HTTP/1.1 400 Bad Request"; }
$errorText = "<h1><img src='".e_IMAGE_ABS."generic/warning.png' alt='".LAN_ERROR_37."' /> ".LAN_ERROR_35."</h1><div class='installh'>".LAN_ERROR_36."</div><br /><div class='smalltext'>".LAN_ERROR_3."</div>
<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>"; // Include language file.
break; e107::coreLan('error');
case 401:
$errorHeader = "HTTP/1.1 401 Unauthorized";
$errorText = "<h1><img src='".e_IMAGE_ABS."generic/warning.png' alt='".LAN_ERROR_37."' /> ".LAN_ERROR_1."</h1><div class='installh'>".LAN_ERROR_2."</div><br /><div class='smalltext'>".LAN_ERROR_3."</div> /**
<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>"; * Class error_front.
break; */
case 403: class error_front
$errorHeader = "HTTP/1.1 403 Forbidden"; {
$errorText = "<h1><img src='".e_IMAGE_ABS."generic/warning.png' alt='".LAN_ERROR_37."' /> ".LAN_ERROR_4."</h1><div class='installh'>".LAN_ERROR_5."</div><br /><div class='smalltext'>".LAN_ERROR_6."</div>
<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>"; /**
break; * @var
case 404: */
$errorHeader = "HTTP/1.1 404 Not Found"; private $errorNumber;
$errorText = "<h1><img src='".e_IMAGE_ABS."generic/warning.png' alt='".LAN_ERROR_37."' /> ".LAN_ERROR_7."</h1>".LAN_ERROR_21.'<br />'.LAN_ERROR_9."<br /><br />";
if (strlen($errFrom)) $errorText .= LAN_ERROR_23." <a href='{$errFrom}' rel='external'>{$errFrom}</a> ".LAN_ERROR_24." -- ".LAN_ERROR_19."<br /><br />"; /**
//.LAN_ERROR_23."<b>{$errTo}</b>".LAN_ERROR_24."<br /><br />" ??? * Constructor.
*/
$errorText .= "<h3>".LAN_ERROR_45."</h3>"; public function __construct()
if($errReturnTo) {
{ if(is_numeric(e_QUERY))
foreach ($errReturnTo as $url => $label) {
{ $this->errorNumber = intval(e_QUERY);
$errorText .= "<a href='{$url}'>".$label."</a><br />"; }
}
$errorText .= '<br />'; $this->renderErrorPage();
} }
$errorText .= "<a href='{$base_path}index.php'>".LAN_ERROR_20."</a><br />";
$errorText .= "<a href='{$base_path}search.php'>".LAN_ERROR_22."</a>"; /**
break; * Renders the error page.
case 500: */
$errorHeader = "HTTP/1.1 500 Internal Server Error"; public function renderErrorPage()
$errorText = "<h1><img src='".e_IMAGE_ABS."generic/warning.png' alt='".LAN_ERROR_37."' /> ".LAN_ERROR_10."</h1><div class='installh'>".LAN_ERROR_11."</div><br /><div class='smalltext'>".LAN_ERROR_12."</div> {
<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>"; switch($this->errorNumber)
break; {
case 999: case 400:
if (E107_DEBUG_LEVEL) header('HTTP/1.1 400 Bad Request');
{
echo LAN_ERROR_33."<br/><pre>\n"; $subtitle = LAN_ERROR_35; // Error 400 - Bad Request
print_r($_SERVER); $caption = LAN_ERROR_45;
print_r($_REQUEST); $content = LAN_ERROR_36 . '<br/>' . LAN_ERROR_3;
echo "\n</pre>\n"; break;
}
else case 401:
{ header('HTTP/1.1 401 Unauthorized');
header("location: ".e_HTTP."index.php");
exit; $subtitle = LAN_ERROR_1; // Error 401 - Authentication Failed
} $caption = LAN_ERROR_45;
break; $content = LAN_ERROR_2 . '<br/>' . LAN_ERROR_3;
break;
default :
$errorText = "<h1>".LAN_ERROR_13." (".$errorQuery.")</h1><div class='installh'>".LAN_ERROR_14."</div><br /><div class='smalltext'>".LAN_ERROR_15."</div> case 403:
<br /><div class='installh'><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>"; header('HTTP/1.1 403 Forbidden');
// default: $subtitle = LAN_ERROR_4; // Error 403 - Access forbidden
// $errorText = LAN_ERROR_34." e_QUERY = '".e_QUERY."'<br/><a href='{$base_path}index.php'>".LAN_ERROR_20."</a>"; $caption = LAN_ERROR_45;
// break; $content = LAN_ERROR_5 . '<br/>' . LAN_ERROR_6 . '<br/><br/>' . LAN_ERROR_2;
break;
case 404:
header('HTTP/1.1 404 Not Found');
$subtitle = LAN_ERROR_7; // Error 404 - Document Not Found
$caption = LAN_ERROR_45;
$content = LAN_ERROR_21 . '<br/>' . LAN_ERROR_9;
$errFrom = isset($_SESSION['e107_http_referer']) ? $_SESSION['e107_http_referer'] : $_SERVER['HTTP_REFERER'];
if(strlen($errFrom))
{
$content .= '<br/>';
$content .= '<br/>';
$content .= LAN_ERROR_23 . ' <a href="' . $errFrom . '" rel="external">' . $errFrom . '</a> ';
$content .= LAN_ERROR_24;
}
break;
case 500:
header('HTTP/1.1 500 Internal Server Error');
$subtitle = LAN_ERROR_10; // Error 500 - Internal server error
$caption = LAN_ERROR_14;
$content = LAN_ERROR_11 . '<br/>' . LAN_ERROR_12;
break;
case 999:
if(!defset('E107_DEBUG_LEVEL', false))
{
e107::redirect();
}
$this->errorNumber = 'DEFAULT'; // Use default template.
$subtitle = LAN_ERROR_33;
$caption = LAN_ERROR_14;
$content = '<pre>' . print_r($_SERVER) . print_r($_REQUEST) . '</pre>';
break;
default:
$this->errorNumber = 'DEFAULT'; // Use default template.
$errorQuery = htmlentities($_SERVER['QUERY_STRING']);
$subtitle = LAN_ERROR_13 . ' (' . $errorQuery . ')'; // Error - Unknown
$caption = LAN_ERROR_14;
$content = LAN_ERROR_15;
break;
}
$tp = e107::getParser();
$tpl = e107::getCoreTemplate('error', $this->errorNumber);
$sc = e107::getScBatch('error');
$sc->setVars(array(
'title' => LAN_ERROR_TITLE,
'subtitle' => $subtitle,
'caption' => $caption,
'content' => $content,
));
$body = $tp->parseTemplate($tpl, true, $sc);
e107::getRender()->tablerender('', $body);
}
} }
if ($errorHeader) header($errorHeader);
require_once(HEADERF); require_once(HEADERF);
new error_front();
e107::getRender()->tablerender(PAGE_NAME, $errorText);
require_once(FOOTERF); require_once(FOOTERF);
?>

View File

@@ -220,7 +220,7 @@ class e_install
var $previous_steps; var $previous_steps;
var $stage; var $stage;
var $post_data; var $post_data;
var $required = ""; //TODO - use for highlighting required fields with css/js. var $required = array(); //TODO - use for highlighting required fields with css/js.
var $logFile; // Name of log file, empty string if logging disabled var $logFile; // Name of log file, empty string if logging disabled
var $dbLink = NULL; // DB link - needed for PHP5.3 bug var $dbLink = NULL; // DB link - needed for PHP5.3 bug
var $session = null; var $session = null;
@@ -398,12 +398,12 @@ class e_install
function display_required() function display_required()
{ {
if(!$this->required) if(empty($this->required))
{ {
return; return;
} }
$this->required = array_filter($this->required); $this->required = array_filter($this->required);
if(vartrue($this->required)) if(!empty($this->required))
{ {
$this->template->SetTag("required","<div class='message'>". implode("<br />",$this->required)."</div>"); $this->template->SetTag("required","<div class='message'>". implode("<br />",$this->required)."</div>");
$this->required = array(); $this->required = array();
@@ -1064,7 +1064,7 @@ class e_install
$this->required['u_name'] = LANINS_086; // $this->required['u_name'] = LANINS_086; //
} }
if(vartrue($this->required['u_name']) || vartrue($this->required['pass1'])) if(!empty($this->required['u_name']) || !empty($this->required['pass1']))
{ {
return $this->stage_5(); return $this->stage_5();
} }
@@ -1220,7 +1220,7 @@ class e_install
$this->required['sitetheme'] = LANINS_114; // 'Please select a theme.'; $this->required['sitetheme'] = LANINS_114; // 'Please select a theme.';
} }
if(vartrue($this->required['sitetheme']) || vartrue($this->required['sitename'])) if(!empty($this->required['sitetheme']) || !empty($this->required['sitename']))
{ {
return $this->stage_6(); return $this->stage_6();
} }
@@ -2019,7 +2019,7 @@ class SimpleTemplate
var $open_tag = "{"; var $open_tag = "{";
var $close_tag = "}"; var $close_tag = "}";
function SimpleTemplate() function __construct()
{ {
define("TEMPLATE_TYPE_FILE", 0); define("TEMPLATE_TYPE_FILE", 0);
define("TEMPLATE_TYPE_DATA", 1); define("TEMPLATE_TYPE_DATA", 1);

View File

@@ -20,6 +20,13 @@
*/ */
require_once("class2.php"); require_once("class2.php");
if(e_DEBUG === 'news')
{
require_once(e_PLUGIN."news/news.php");
// exit;
}
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
require_once(e_HANDLER."news_class.php"); require_once(e_HANDLER."news_class.php");
@@ -185,7 +192,7 @@ if(!empty($_GET['author']) || substr($action,0,4) == 'author=')
} }
if(E107_DBG_PATH) if(e_DEBUG === 'news')
{ {
echo "<div class='alert alert-info'>"; echo "<div class='alert alert-info'>";
echo "<h4>SEF Debug Info</h4>"; echo "<h4>SEF Debug Info</h4>";