Merge remote-tracking branch 'upstream/dev' into wiki

This commit is contained in:
Andrew Manning
2016-05-28 14:12:53 -04:00
5 changed files with 2676 additions and 2648 deletions

View File

@@ -48,7 +48,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '1.7.1' ); define ( 'STD_VERSION', '1.7.1' );
define ( 'ZOT_REVISION', 1.1 ); define ( 'ZOT_REVISION', 1.1 );
define ( 'DB_UPDATE_VERSION', 1168 ); define ( 'DB_UPDATE_VERSION', 1169 );
/** /**
@@ -692,7 +692,7 @@ function startup() {
class ZotlabsAutoloader { class ZotlabsAutoloader {
static public function loader($className) { static public function loader($className) {
$filename = str_replace('\\', '/', $className) . ".php"; $filename = str_replace('\\', '/', $className) . ".php";
if (file_exists($filename)) { if(file_exists($filename)) {
include($filename); include($filename);
if (class_exists($className)) { if (class_exists($className)) {
return TRUE; return TRUE;
@@ -703,7 +703,7 @@ class ZotlabsAutoloader {
if(! $arr[0]) if(! $arr[0])
$arr = array_shift($arr); $arr = array_shift($arr);
$filename = 'addon/' . lcfirst($arr[0]) . '/' . $arr[1] . ((count($arr) === 2) ? '.php' : '/' . $arr[2] . ".php"); $filename = 'addon/' . lcfirst($arr[0]) . '/' . $arr[1] . ((count($arr) === 2) ? '.php' : '/' . $arr[2] . ".php");
if (file_exists($filename)) { if(file_exists($filename)) {
include($filename); include($filename);
if (class_exists($className)) { if (class_exists($className)) {
return TRUE; return TRUE;
@@ -1769,7 +1769,9 @@ function get_account_id() {
* @return int|bool channel_id or false * @return int|bool channel_id or false
*/ */
function local_channel() { function local_channel() {
if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'uid'))) if(session_id()
&& array_key_exists('authenticated',$_SESSION) && $_SESSION['authenticated']
&& array_key_exists('uid',$_SESSION) && intval($_SESSION['uid']))
return intval($_SESSION['uid']); return intval($_SESSION['uid']);
return false; return false;
@@ -1800,7 +1802,9 @@ function local_user() {
* @return string|bool visitor_id or false * @return string|bool visitor_id or false
*/ */
function remote_channel() { function remote_channel() {
if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id'))) if(session_id()
&& array_key_exists('authenticated',$_SESSION) && $_SESSION['authenticated']
&& array_key_exists('visitor_id',$_SESSION) && intval($_SESSION['visitor_id']))
return $_SESSION['visitor_id']; return $_SESSION['visitor_id'];
return false; return false;
@@ -1825,6 +1829,9 @@ function remote_user() {
* @param string $s Text to display * @param string $s Text to display
*/ */
function notice($s) { function notice($s) {
if(! session_id())
return;
if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array(); if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array();
// ignore duplicated error messages which haven't yet been displayed // ignore duplicated error messages which haven't yet been displayed
@@ -1848,7 +1855,10 @@ function notice($s) {
* @param string $s Text to display * @param string $s Text to display
*/ */
function info($s) { function info($s) {
if(! x($_SESSION, 'sysmsg_info')) $_SESSION['sysmsg_info'] = array(); if(! session_id())
return;
if(! x($_SESSION, 'sysmsg_info'))
$_SESSION['sysmsg_info'] = array();
if(App::$interactive) if(App::$interactive)
$_SESSION['sysmsg_info'][] = $s; $_SESSION['sysmsg_info'][] = $s;
} }
@@ -1934,6 +1944,10 @@ function proc_run(){
* @brief Checks if we are running on M$ Windows. * @brief Checks if we are running on M$ Windows.
* *
* @return bool true if we run on M$ Windows * @return bool true if we run on M$ Windows
*
* It's possible you might be able to run on WAMP or XAMPP, and this
* has been accomplished, but is not officially supported. Good luck.
*
*/ */
function is_windows() { function is_windows() {
return ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false); return ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false);
@@ -1949,6 +1963,9 @@ function is_windows() {
function is_site_admin() { function is_site_admin() {
if(! session_id())
return false;
if($_SESSION['delegate']) if($_SESSION['delegate'])
return false; return false;
@@ -1969,6 +1986,9 @@ function is_site_admin() {
*/ */
function is_developer() { function is_developer() {
if(! session_id())
return false;
if((intval($_SESSION['authenticated'])) if((intval($_SESSION['authenticated']))
&& (is_array(App::$account)) && (is_array(App::$account))
&& (App::$account['account_roles'] & ACCOUNT_ROLE_DEVELOPER)) && (App::$account['account_roles'] & ACCOUNT_ROLE_DEVELOPER))
@@ -1987,7 +2007,7 @@ function load_contact_links($uid) {
// logger('load_contact_links'); // logger('load_contact_links');
$r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d ", $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d ",
intval($uid) intval($uid)
); );
if($r) { if($r) {
@@ -2010,6 +2030,7 @@ function load_contact_links($uid) {
* *
* @return string * @return string
*/ */
function build_querystring($params, $name = null) { function build_querystring($params, $name = null) {
$ret = ''; $ret = '';
foreach($params as $key => $val) { foreach($params as $key => $val) {
@@ -2052,8 +2073,9 @@ function dba_timer() {
/** /**
* @brief Returns xchan_hash from the observer. * @brief Returns xchan_hash from the observer.
* *
* @return string Empty if no observer, otherwise xchan_hash from observer * @return empty string if no observer, otherwise xchan_hash from observer
*/ */
function get_observer_hash() { function get_observer_hash() {
$observer = App::get_observer(); $observer = App::get_observer();
if(is_array($observer)) if(is_array($observer))
@@ -2110,8 +2132,6 @@ function load_pdl(&$a) {
App::$comanche = new Zotlabs\Render\Comanche(); App::$comanche = new Zotlabs\Render\Comanche();
// require_once('include/comanche.php');
if (! count(App::$layout)) { if (! count(App::$layout)) {
$arr = array('module' => App::$module, 'layout' => ''); $arr = array('module' => App::$module, 'layout' => '');
@@ -2132,13 +2152,10 @@ function load_pdl(&$a) {
App::$pdl = $s; App::$pdl = $s;
} }
} }
} }
function exec_pdl(&$a) { function exec_pdl(&$a) {
// require_once('include/comanche.php');
if(App::$pdl) { if(App::$pdl) {
App::$comanche->parse(App::$pdl,1); App::$comanche->parse(App::$pdl,1);
} }

View File

@@ -883,6 +883,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
`obj_imgurl` char(255) NOT NULL DEFAULT '', `obj_imgurl` char(255) NOT NULL DEFAULT '',
`obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`obj_quantity` int(11) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL, `allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL,
@@ -897,6 +898,7 @@ CREATE TABLE IF NOT EXISTS `obj` (
KEY `obj_imgurl` (`obj_imgurl`), KEY `obj_imgurl` (`obj_imgurl`),
KEY `obj_created` (`obj_created`), KEY `obj_created` (`obj_created`),
KEY `obj_edited` (`obj_edited`), KEY `obj_edited` (`obj_edited`),
KEY `obj_quantity` (`obj_quantity`),
KEY `obj_obj` (`obj_obj`) KEY `obj_obj` (`obj_obj`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@@ -873,6 +873,7 @@ CREATE TABLE "obj" (
"obj_imgurl" char(255) NOT NULL DEFAULT '', "obj_imgurl" char(255) NOT NULL DEFAULT '',
"obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"obj_quantity" int(11) NOT NULL DEFAUL '0'.
"allow_cid" text NOT NULL, "allow_cid" text NOT NULL,
"allow_gid" text NOT NULL, "allow_gid" text NOT NULL,
"deny_cid" text NOT NULL, "deny_cid" text NOT NULL,
@@ -890,6 +891,7 @@ create index "obj_url" on obj ("obj_url");
create index "obj_imgurl" on obj ("obj_imgurl"); create index "obj_imgurl" on obj ("obj_imgurl");
create index "obj_created" on obj ("obj_created"); create index "obj_created" on obj ("obj_created");
create index "obj_edited" on obj ("obj_edited"); create index "obj_edited" on obj ("obj_edited");
create index "obj_quantity" on obj ("obj_quantity");
CREATE TABLE "outq" ( CREATE TABLE "outq" (
"outq_hash" text NOT NULL, "outq_hash" text NOT NULL,

View File

@@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1168 ); define( 'UPDATE_VERSION' , 1169 );
/** /**
* *
@@ -2097,3 +2097,20 @@ function update_r1167() {
return UPDATE_SUCCESS; return UPDATE_SUCCESS;
return UPDATE_FAILED; return UPDATE_FAILED;
} }
function update_r1168() {
$r1 = q("alter table obj add obj_quantity int not null default '0' ");
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r2 = q("create index \"obj_quantity_idx\" on obj (\"obj_quantity\") ");
}
else {
$r2 = q("alter table obj add index ( obj_quantity ) ");
}
if($r1 && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

File diff suppressed because it is too large Load Diff