only variables can be sent by reference (strict standards)
This commit is contained in:
parent
030b570051
commit
d5a24da167
|
@ -41,7 +41,7 @@ class AllAction extends ShowstreamAction
|
||||||
{
|
{
|
||||||
var $notice;
|
var $notice;
|
||||||
|
|
||||||
protected function getStream()
|
public function getStream()
|
||||||
{
|
{
|
||||||
if ($this->scoped instanceof Profile && $this->scoped->isLocal() && $this->scoped->getUser()->streamModeOnly()) {
|
if ($this->scoped instanceof Profile && $this->scoped->isLocal() && $this->scoped->getUser()->streamModeOnly()) {
|
||||||
$stream = new InboxNoticeStream($this->target, $this->scoped);
|
$stream = new InboxNoticeStream($this->target, $this->scoped);
|
||||||
|
|
|
@ -43,7 +43,7 @@ class RepliesAction extends ShowstreamAction
|
||||||
var $page = null;
|
var $page = null;
|
||||||
var $notice;
|
var $notice;
|
||||||
|
|
||||||
protected function getStream()
|
public function getStream()
|
||||||
{
|
{
|
||||||
return new ReplyNoticeStream($this->target->getID(), $this->scoped);
|
return new ReplyNoticeStream($this->target->getID(), $this->scoped);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,18 +78,7 @@ class ShowstreamAction extends ProfileAction
|
||||||
$this->target = $this->user->getProfile();
|
$this->target = $this->user->getProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function profileActionPreparation()
|
public function getStream()
|
||||||
{
|
|
||||||
$stream = $this->getStream();
|
|
||||||
$this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
|
||||||
|
|
||||||
if ($this->page > 1 && $this->notice->N == 0) {
|
|
||||||
// TRANS: Client error when page not found (404).
|
|
||||||
$this->clientError(_('No such page.'), 404);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getStream()
|
|
||||||
{
|
{
|
||||||
if (empty($this->tag)) {
|
if (empty($this->tag)) {
|
||||||
$stream = new ProfileNoticeStream($this->target, $this->scoped);
|
$stream = new ProfileNoticeStream($this->target, $this->scoped);
|
||||||
|
|
|
@ -32,10 +32,11 @@
|
||||||
* @author Amir Mohammad Saied <amir@php.net>
|
* @author Amir Mohammad Saied <amir@php.net>
|
||||||
* @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
|
* @copyright 1997-2006 Pierre-Alain Joye,Tomas V.V.Cox,Amir Mohammad Saied
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
* @version CVS: $Id: Validate.php,v 1.134 2009/01/28 12:27:33 davidc Exp $
|
* @version CVS: $Id$
|
||||||
* @link http://pear.php.net/package/Validate
|
* @link http://pear.php.net/package/Validate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// {{{ Constants
|
||||||
/**
|
/**
|
||||||
* Methods for common data validations
|
* Methods for common data validations
|
||||||
*/
|
*/
|
||||||
|
@ -44,17 +45,18 @@ define('VALIDATE_SPACE', '\s');
|
||||||
define('VALIDATE_ALPHA_LOWER', 'a-z');
|
define('VALIDATE_ALPHA_LOWER', 'a-z');
|
||||||
define('VALIDATE_ALPHA_UPPER', 'A-Z');
|
define('VALIDATE_ALPHA_UPPER', 'A-Z');
|
||||||
define('VALIDATE_ALPHA', VALIDATE_ALPHA_LOWER . VALIDATE_ALPHA_UPPER);
|
define('VALIDATE_ALPHA', VALIDATE_ALPHA_LOWER . VALIDATE_ALPHA_UPPER);
|
||||||
define('VALIDATE_EALPHA_LOWER', VALIDATE_ALPHA_LOWER . 'áéíóúýàèìòùäëïöüÿâêîôûãñõ¨åæç½ðøþß');
|
define('VALIDATE_EALPHA_LOWER', VALIDATE_ALPHA_LOWER . 'áéíóúýàèìòùäëïöüÿâêîôûãñõ¨åæç½ðøþß');
|
||||||
define('VALIDATE_EALPHA_UPPER', VALIDATE_ALPHA_UPPER . 'ÁÉÍÓÚÝÀÈÌÒÙÄËÏÖܾÂÊÎÔÛÃÑÕ¦ÅÆǼÐØÞ');
|
define('VALIDATE_EALPHA_UPPER', VALIDATE_ALPHA_UPPER . 'ÁÉÍÓÚÝÀÈÌÒÙÄËÏÖܾÂÊÎÔÛÃÑÕ¦ÅÆǼÐØÞ');
|
||||||
define('VALIDATE_EALPHA', VALIDATE_EALPHA_LOWER . VALIDATE_EALPHA_UPPER);
|
define('VALIDATE_EALPHA', VALIDATE_EALPHA_LOWER . VALIDATE_EALPHA_UPPER);
|
||||||
define('VALIDATE_PUNCTUATION', VALIDATE_SPACE . '\.,;\:&"\'\?\!\(\)');
|
define('VALIDATE_PUNCTUATION', VALIDATE_SPACE . '\.,;\:&"\'\?\!\(\)');
|
||||||
define('VALIDATE_NAME', VALIDATE_EALPHA . VALIDATE_SPACE . "'" . "-");
|
define('VALIDATE_NAME', VALIDATE_EALPHA . VALIDATE_SPACE . "'" . '\-');
|
||||||
define('VALIDATE_STREET', VALIDATE_NUM . VALIDATE_NAME . "/\\ºª\.");
|
define('VALIDATE_STREET', VALIDATE_NUM . VALIDATE_NAME . "/\\ºª\.");
|
||||||
|
|
||||||
define('VALIDATE_ITLD_EMAILS', 1);
|
define('VALIDATE_ITLD_EMAILS', 1);
|
||||||
define('VALIDATE_GTLD_EMAILS', 2);
|
define('VALIDATE_GTLD_EMAILS', 2);
|
||||||
define('VALIDATE_CCTLD_EMAILS', 4);
|
define('VALIDATE_CCTLD_EMAILS', 4);
|
||||||
define('VALIDATE_ALL_EMAILS', 8);
|
define('VALIDATE_ALL_EMAILS', 8);
|
||||||
|
// }}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation class
|
* Validation class
|
||||||
|
@ -79,6 +81,7 @@ define('VALIDATE_ALL_EMAILS', 8);
|
||||||
*/
|
*/
|
||||||
class Validate
|
class Validate
|
||||||
{
|
{
|
||||||
|
// {{{ International, Generic and Country code TLDs
|
||||||
/**
|
/**
|
||||||
* International Top-Level Domain
|
* International Top-Level Domain
|
||||||
*
|
*
|
||||||
|
@ -202,6 +205,7 @@ class Validate
|
||||||
'ye','yt','yu','za',
|
'ye','yt','yu','za',
|
||||||
'zm','zw',
|
'zm','zw',
|
||||||
);
|
);
|
||||||
|
// }}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a tag URI (RFC4151)
|
* Validate a tag URI (RFC4151)
|
||||||
|
@ -445,6 +449,10 @@ class Validate
|
||||||
if(!empty($options["VALIDATE_GTLD_EMAILS"])) array_push($validate, 'gtld');
|
if(!empty($options["VALIDATE_GTLD_EMAILS"])) array_push($validate, 'gtld');
|
||||||
if(!empty($options["VALIDATE_CCTLD_EMAILS"])) array_push($validate, 'cctld');
|
if(!empty($options["VALIDATE_CCTLD_EMAILS"])) array_push($validate, 'cctld');
|
||||||
|
|
||||||
|
if (count($validate) === 0) {
|
||||||
|
array_push($validate, 'itld', 'gtld', 'cctld');
|
||||||
|
}
|
||||||
|
|
||||||
$self = new Validate;
|
$self = new Validate;
|
||||||
|
|
||||||
$toValidate = array();
|
$toValidate = array();
|
||||||
|
@ -524,13 +532,15 @@ class Validate
|
||||||
*/
|
*/
|
||||||
$hasIDNA = false;
|
$hasIDNA = false;
|
||||||
|
|
||||||
if (@include_once('Net/IDNA.php')) {
|
if (Validate::_includePathFileExists('Net/IDNA.php')) {
|
||||||
|
include_once('Net/IDNA.php');
|
||||||
$hasIDNA = true;
|
$hasIDNA = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hasIDNA === true) {
|
if ($hasIDNA === true) {
|
||||||
if (strpos($email, '@') !== false) {
|
if (strpos($email, '@') !== false) {
|
||||||
list($name, $domain) = explode('@', $email, 2);
|
$tmpEmail = explode('@', $email);
|
||||||
|
$domain = array_pop($tmpEmail);
|
||||||
|
|
||||||
// Check if the domain contains characters > 127 which means
|
// Check if the domain contains characters > 127 which means
|
||||||
// it's an idn domain name.
|
// it's an idn domain name.
|
||||||
|
@ -540,7 +550,8 @@ class Validate
|
||||||
$domain = $idna->encode($domain);
|
$domain = $idna->encode($domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
$email = "$name@$domain";
|
array_push($tmpEmail, $domain);
|
||||||
|
$email = implode('@', $tmpEmail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +583,7 @@ class Validate
|
||||||
if ($use_rfc822? Validate::__emailRFC822($email, $options) :
|
if ($use_rfc822? Validate::__emailRFC822($email, $options) :
|
||||||
preg_match($regex, $email)) {
|
preg_match($regex, $email)) {
|
||||||
if ($check_domain && function_exists('checkdnsrr')) {
|
if ($check_domain && function_exists('checkdnsrr')) {
|
||||||
list ($account, $domain) = explode('@', $email);
|
$domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop(explode('@', $email)));
|
||||||
if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {
|
if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1086,8 +1097,10 @@ class Validate
|
||||||
$class = implode('_', $validateType);
|
$class = implode('_', $validateType);
|
||||||
$classPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
|
$classPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
|
||||||
$class = 'Validate_' . $class;
|
$class = 'Validate_' . $class;
|
||||||
if (!@include_once "Validate/$classPath.php") {
|
if (Validate::_includePathFileExists("Validate/$classPath.php")) {
|
||||||
trigger_error("$class isn't installed or you may have some permissoin issues", E_USER_ERROR);
|
include_once "Validate/$classPath.php";
|
||||||
|
} else {
|
||||||
|
trigger_error("$class isn't installed or you may have some permission issues", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ce = substr(phpversion(), 0, 1) > 4 ?
|
$ce = substr(phpversion(), 0, 1) > 4 ?
|
||||||
|
@ -1112,5 +1125,25 @@ class Validate
|
||||||
}
|
}
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether specified file exists along the include path.
|
||||||
|
*
|
||||||
|
* @param string $filename file to search for
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*
|
||||||
|
* @return bool true if file exists
|
||||||
|
*/
|
||||||
|
function _includePathFileExists($filename)
|
||||||
|
{
|
||||||
|
$paths = explode(":", ini_get("include_path"));
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
while ((!($result)) && (list($key,$val) = each($paths))) {
|
||||||
|
$result = file_exists($val . "/" . $filename);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,8 @@ class AvatarLink
|
||||||
|
|
||||||
// yuck!
|
// yuck!
|
||||||
static function mediatype($filename) {
|
static function mediatype($filename) {
|
||||||
$ext = strtolower(end(explode('.', $filename)));
|
$parts = explode('.', $filename);
|
||||||
|
$ext = strtolower(end($parts));
|
||||||
if ($ext == 'jpeg') {
|
if ($ext == 'jpeg') {
|
||||||
$ext = 'jpg';
|
$ext = 'jpg';
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
abstract class ProfileAction extends ManagedAction
|
abstract class ProfileAction extends ManagedAction implements NoticestreamAction
|
||||||
{
|
{
|
||||||
var $page = null;
|
var $page = null;
|
||||||
var $tag = null;
|
var $tag = null;
|
||||||
|
@ -50,7 +50,7 @@ abstract class ProfileAction extends ManagedAction
|
||||||
|
|
||||||
protected function prepare(array $args=array())
|
protected function prepare(array $args=array())
|
||||||
{
|
{
|
||||||
// this will call ->doPreparation() which lower classes can use
|
// this will call ->doPreparation() which child classes use to set $this->target
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if ($this->target->hasRole(Profile_role::SILENCED)
|
if ($this->target->hasRole(Profile_role::SILENCED)
|
||||||
|
@ -66,7 +66,14 @@ abstract class ProfileAction extends ManagedAction
|
||||||
common_set_returnto($this->selfUrl());
|
common_set_returnto($this->selfUrl());
|
||||||
|
|
||||||
// fetch the actual stream stuff
|
// fetch the actual stream stuff
|
||||||
$this->profileActionPreparation();
|
$stream = $this->getStream();
|
||||||
|
$this->notice = $stream->getNotices(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||||
|
|
||||||
|
if ($this->page > 1 && $this->notice->N == 0) {
|
||||||
|
// TRANS: Client error when page not found (404).
|
||||||
|
$this->clientError(_('No such page.'), 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user