diff options
-rw-r--r-- | Zotlabs/Lib/System.php (renamed from Zotlabs/Project/System.php) | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php (renamed from include/ItemObject.php) | 20 | ||||
-rw-r--r-- | Zotlabs/Lib/ThreadStream.php (renamed from include/ConversationObject.php) | 15 | ||||
-rw-r--r-- | Zotlabs/Module/Dav.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Help.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Linkinfo.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Pubsites.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Rsd_xml.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Settings.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Siteinfo.php | 4 | ||||
-rwxr-xr-x | boot.php | 8 | ||||
-rw-r--r-- | include/BaseObject.php | 38 | ||||
-rw-r--r-- | include/api.php | 10 | ||||
-rw-r--r-- | include/conversation.php | 7 | ||||
-rw-r--r-- | include/enotify.php | 2 | ||||
-rw-r--r-- | include/event.php | 2 | ||||
-rw-r--r-- | include/feedutils.php | 4 | ||||
-rw-r--r-- | include/identity.php | 2 | ||||
-rw-r--r-- | include/language.php | 2 | ||||
-rw-r--r-- | include/network.php | 10 | ||||
-rw-r--r-- | include/zot.php | 4 |
21 files changed, 44 insertions, 98 deletions
diff --git a/Zotlabs/Project/System.php b/Zotlabs/Lib/System.php index d95bd033c..c52a90338 100644 --- a/Zotlabs/Project/System.php +++ b/Zotlabs/Lib/System.php @@ -1,6 +1,6 @@ <?php -namespace Zotlabs\Project; +namespace Zotlabs\Lib; class System { diff --git a/include/ItemObject.php b/Zotlabs/Lib/ThreadItem.php index 019fa87ad..0ba0c0a13 100644 --- a/include/ItemObject.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -1,17 +1,15 @@ <?php /** @file */ -if(class_exists('Item')) - return; +namespace Zotlabs\Lib; -require_once('include/BaseObject.php'); require_once('include/text.php'); -require_once('boot.php'); /** - * An item + * A thread item */ -class Item extends BaseObject { +class ThreadItem { + public $data = array(); private $template = 'conv_item.tpl'; private $comment_box_template = 'comment_item.tpl'; @@ -32,7 +30,6 @@ class Item extends BaseObject { public function __construct($data) { - $a = $this->get_app(); $this->data = $data; $this->toplevel = ($this->get_id() == $this->get_data_value('parent')); @@ -49,7 +46,7 @@ class Item extends BaseObject { continue; } - $child = new Item($item); + $child = new ThreadItem($item); $this->add_child($child); } } @@ -67,7 +64,6 @@ class Item extends BaseObject { $result = array(); - $a = $this->get_app(); $item = $this->get_data(); $commentww = ''; @@ -219,7 +215,8 @@ class Item extends BaseObject { ); } - } else { + } + else { $indent = 'comment'; } @@ -675,7 +672,6 @@ class Item extends BaseObject { $template = get_markup_template($this->get_comment_box_template()); - $a = $this->get_app(); $observer = $conv->get_observer(); $qc = ((local_channel()) ? get_pconfig(local_channel(),'system','qcomment') : null); @@ -714,7 +710,7 @@ class Item extends BaseObject { '$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false), '$encrypt' => t('Encrypt text'), '$cipher' => $conv->get_cipher(), - '$sourceapp' => App::$sourcename + '$sourceapp' => \App::$sourcename )); diff --git a/include/ConversationObject.php b/Zotlabs/Lib/ThreadStream.php index 82f381b0c..2bcf167e9 100644 --- a/include/ConversationObject.php +++ b/Zotlabs/Lib/ThreadStream.php @@ -1,11 +1,8 @@ <?php /** @file */ -if(class_exists('Conversation')) - return; +namespace Zotlabs\Lib; require_once('boot.php'); -require_once('include/BaseObject.php'); -require_once('include/ItemObject.php'); require_once('include/text.php'); require_once('include/items.php'); @@ -14,7 +11,7 @@ require_once('include/items.php'); * */ -class Conversation extends BaseObject { +class ThreadStream { private $threads = array(); private $mode = null; @@ -46,9 +43,7 @@ class Conversation extends BaseObject { if($this->get_mode() == $mode) return; - $a = $this->get_app(); - - $this->observer = App::get_observer(); + $this->observer = \App::get_observer(); $ob_hash = (($this->observer) ? $this->observer['xchan_hash'] : ''); switch($mode) { @@ -57,7 +52,7 @@ class Conversation extends BaseObject { $this->writable = true; break; case 'channel': - $this->profile_owner = App::$profile['profile_uid']; + $this->profile_owner = \App::$profile['profile_uid']; $this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'); break; case 'display': @@ -67,7 +62,7 @@ class Conversation extends BaseObject { $this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'); break; case 'page': - $this->profile_owner = App::$profile['uid']; + $this->profile_owner = \App::$profile['uid']; $this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'); break; default: diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php index d65ad3405..2fddabe19 100644 --- a/Zotlabs/Module/Dav.php +++ b/Zotlabs/Module/Dav.php @@ -64,7 +64,7 @@ class Dav extends \Zotlabs\Web\Controller { $auth = new \Zotlabs\Storage\BasicAuth(); - $auth->setRealm(ucfirst(\Zotlabs\Project\System::get_platform_name()) . 'WebDAV'); + $auth->setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . 'WebDAV'); // $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function($userName,$password) { // if(account_verify_password($userName,$password)) diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index 4842c56c6..cc46c550b 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -37,7 +37,7 @@ class Help extends \Zotlabs\Web\Controller { $path = trim(substr($dirname,4),'/'); $o .= '<li><a href="help/' . (($path) ? $path . '/' : '') . $fname . '" >' . ucwords(str_replace('_',' ',notags($fname))) . '</a><br />' . - str_replace('$Projectname',\Zotlabs\Project\System::get_platform_name(),substr($rr['text'],0,200)) . '...<br /><br /></li>'; + str_replace('$Projectname',\Zotlabs\Lib\System::get_platform_name(),substr($rr['text'],0,200)) . '...<br /><br /></li>'; } $o .= '</ul>'; diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index ef34bb465..e1a3a6abe 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -115,7 +115,7 @@ class Linkinfo extends \Zotlabs\Web\Controller { // If this is a Red site, use zrl rather than url so they get zids sent to them by default - if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], \Zotlabs\Project\System::get_platform_name() . ' ') === 0)) + if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], \Zotlabs\Lib\System::get_platform_name() . ' ') === 0)) $template = str_replace('url','zrl',$template); if($siteinfo["title"] == "") { diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index 55f2c0ad6..31bca5f30 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -31,7 +31,7 @@ class Pubsites extends \Zotlabs\Web\Controller { $o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Software') . '</td><td colspan="2">' . t('Ratings') . '</td></tr>'; if($j['sites']) { foreach($j['sites'] as $jj) { - if(strpos($jj['project'],\Zotlabs\Project\System::get_platform_name()) === false) + if(strpos($jj['project'],\Zotlabs\Lib\System::get_platform_name()) === false) continue; $host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3)); $rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="fa fa-check-square-o"></i> ' . t('Rate') . '</a></td>' : ''); diff --git a/Zotlabs/Module/Rsd_xml.php b/Zotlabs/Module/Rsd_xml.php index 06af39ad1..e5059834b 100644 --- a/Zotlabs/Module/Rsd_xml.php +++ b/Zotlabs/Module/Rsd_xml.php @@ -6,7 +6,7 @@ class Rsd_xml extends \Zotlabs\Web\Controller { function init() { header ("Content-Type: text/xml"); echo replace_macros(get_markup_template('rsd.tpl'),array( - '$project' => \Zotlabs\Project\System::get_platform_name(), + '$project' => \Zotlabs\Lib\System::get_platform_name(), '$baseurl' => z_root(), '$apipath' => z_root() . '/api/' )); diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 3d37faab6..32ef89f68 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -1047,7 +1047,7 @@ class Settings extends \Zotlabs\Web\Controller { '$h_prv' => t('Security and Privacy Settings'), '$permissions_set' => $permissions_set, - '$server_role' => \Zotlabs\Project\System::get_server_role(), + '$server_role' => \Zotlabs\Lib\System::get_server_role(), '$perms_set_msg' => t('Your permissions are already configured. Click to view/adjust'), '$hide_presence' => array('hide_presence', t('Hide my online presence'),$hide_presence, t('Prevents displaying in your profile that you are online'), $yes_no), diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php index c65277004..41f6e9f0b 100644 --- a/Zotlabs/Module/Siteinfo.php +++ b/Zotlabs/Module/Siteinfo.php @@ -16,10 +16,10 @@ class Siteinfo extends \Zotlabs\Web\Controller { function get() { if(! get_config('system','hidden_version_siteinfo')) { - $version = sprintf( t('Version %s'), \Zotlabs\Project\System::get_project_version()); + $version = sprintf( t('Version %s'), \Zotlabs\Lib\System::get_project_version()); if(@is_dir('.git') && function_exists('shell_exec')) { $commit = @shell_exec('git log -1 --format="%h"'); - $tag = \Zotlabs\Project\System::get_std_version(); // @shell_exec('git describe --tags --abbrev=0'); + $tag = \Zotlabs\Lib\System::get_std_version(); // @shell_exec('git describe --tags --abbrev=0'); } if(! isset($commit) || strlen($commit) > 16) $commit = ''; @@ -37,7 +37,6 @@ require_once('include/nav.php'); require_once('include/cache.php'); require_once('include/permissions.php'); require_once('library/Mobile_Detect/Mobile_Detect.php'); -require_once('include/BaseObject.php'); require_once('include/features.php'); require_once('include/taxonomy.php'); require_once('include/identity.php'); @@ -903,13 +902,10 @@ class App { self::head_set_icon('/images/hz-32.png'); - BaseObject::set_app($this); - /* * register template engines */ - spl_autoload_register('ZotlabsAutoloader::loader'); self::$meta= new Zotlabs\Web\HttpMeta(); @@ -1080,7 +1076,7 @@ class App { if(! self::$meta->get_field('og:title')) self::$meta->set('og:title',self::$page['title']); - self::$meta->set('generator', Zotlabs\Project\System::get_platform_name()); + self::$meta->set('generator', Zotlabs\Lib\System::get_platform_name()); /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it @@ -1095,7 +1091,7 @@ class App { '$local_channel' => local_channel(), '$metas' => self::$meta->get(), '$update_interval' => $interval, - 'osearch' => sprintf( t('Search %1$s (%2$s)','opensearch'), Zotlabs\Project\System::get_site_name(), t('$Projectname','opensearch')), + 'osearch' => sprintf( t('Search %1$s (%2$s)','opensearch'), Zotlabs\Lib\System::get_site_name(), t('$Projectname','opensearch')), '$icon' => head_get_icon(), '$head_css' => head_get_css(), '$head_js' => head_get_js(), diff --git a/include/BaseObject.php b/include/BaseObject.php deleted file mode 100644 index a88978a83..000000000 --- a/include/BaseObject.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php /** @file */ - -if(class_exists('BaseObject')) - return; - -require_once('boot.php'); - -/** - * Basic object - * - * Contains what is usefull to any object - */ -class BaseObject { - private static $app = null; - - /** - * Get the app - * - * Same as get_app from boot.php - */ - public function get_app() { - if(self::$app) - return self::$app; - - global $a; - self::$app = $a; - - return self::$app; - } - - /** - * Set the app - */ - public static function set_app($app) { - self::$app = $app; - } -} - diff --git a/include/api.php b/include/api.php index 5f4d4bedb..4a462d1e8 100644 --- a/include/api.php +++ b/include/api.php @@ -2107,10 +2107,10 @@ require_once('include/api_auth.php'); 'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl, 'shorturllength' => '30', 'hubzilla' => array( - 'PLATFORM_NAME' => Zotlabs\Project\System::get_platform_name(), - 'STD_VERSION' => Zotlabs\Project\System::get_project_version(), + 'PLATFORM_NAME' => Zotlabs\Lib\System::get_platform_name(), + 'STD_VERSION' => Zotlabs\Lib\System::get_project_version(), 'ZOT_REVISION' => ZOT_REVISION, - 'DB_UPDATE_VERSION' => Zotlabs\Project\System::get_update_version() + 'DB_UPDATE_VERSION' => Zotlabs\Lib\System::get_update_version() ) )); @@ -2143,12 +2143,12 @@ require_once('include/api_auth.php'); if($type === 'xml') { header("Content-type: application/xml"); - echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . Zotlabs\Project\System::get_project_version() . '</version>' . "\r\n"; + echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . Zotlabs\Lib\System::get_project_version() . '</version>' . "\r\n"; killme(); } elseif($type === 'json') { header("Content-type: application/json"); - echo '"' . Zotlabs\Project\System::get_project_version() . '"'; + echo '"' . Zotlabs\Lib\System::get_project_version() . '"'; killme(); } } diff --git a/include/conversation.php b/include/conversation.php index 8be0557e7..fca07a91d 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -754,10 +754,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ // Normal View // logger('conv: items: ' . print_r($items,true)); - require_once('include/ConversationObject.php'); - require_once('include/ItemObject.php'); - - $conv = new Conversation($mode, $preview, $prepared_item); + $conv = new Zotlabs\Lib\ThreadStream($mode, $preview, $prepared_item); // In the display mode we don't have a profile owner. @@ -806,7 +803,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ if($item['id'] == $item['parent']) { - $item_object = new Item($item); + $item_object = new Zotlabs\Lib\ThreadItem($item); $conv->add_thread($item_object); if($page_mode === 'list') { $item_object->set_template('conv_list.tpl'); diff --git a/include/enotify.php b/include/enotify.php index d87c5af11..bd8698606 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -529,7 +529,7 @@ function notification($params) { $tpl = get_markup_template('email_notify_html.tpl'); $email_html_body = replace_macros($tpl,array( '$banner' => $datarray['banner'], - '$notify_icon' => Zotlabs\Project\System::get_notify_icon(), + '$notify_icon' => Zotlabs\Lib\System::get_notify_icon(), '$product' => $datarray['product'], '$preamble' => $datarray['preamble'], '$sitename' => $datarray['sitename'], diff --git a/include/event.php b/include/event.php index e41bf2db7..29ca5bb79 100644 --- a/include/event.php +++ b/include/event.php @@ -67,7 +67,7 @@ function ical_wrapper($ev) { $o .= "BEGIN:VCALENDAR"; $o .= "\r\nVERSION:2.0"; $o .= "\r\nMETHOD:PUBLISH"; - $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Project\System::get_platform_name() . "//" . strtoupper(App::$language). "\r\n"; + $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Lib\System::get_platform_name() . "//" . strtoupper(App::$language). "\r\n"; if(array_key_exists('start', $ev)) $o .= format_event_ical($ev); else { diff --git a/include/feedutils.php b/include/feedutils.php index 2ba5efe22..700198ff8 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -88,8 +88,8 @@ function get_feed_for($channel, $observer_hash, $params) { $atom = ''; $atom .= replace_macros($feed_template, array( - '$version' => xmlify(Zotlabs\Project\System::get_project_version()), - '$red' => xmlify(Zotlabs\Project\System::get_platform_name()), + '$version' => xmlify(Zotlabs\Lib\System::get_project_version()), + '$red' => xmlify(Zotlabs\Lib\System::get_platform_name()), '$feed_id' => xmlify($channel['xchan_url']), '$feed_title' => xmlify($channel['channel_name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now' , ATOM_TIME)) , diff --git a/include/identity.php b/include/identity.php index 206dad084..4ef1105ea 100644 --- a/include/identity.php +++ b/include/identity.php @@ -491,7 +491,7 @@ function identity_basic_export($channel_id, $items = false) { // use constants here as otherwise we will have no idea if we can import from a site // with a non-standard platform and version. - $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => STD_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => Zotlabs\Project\System::get_server_role()); + $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => STD_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => Zotlabs\Lib\System::get_server_role()); $r = q("select * from channel where channel_id = %d limit 1", intval($channel_id) diff --git a/include/language.php b/include/language.php index d6b7606ca..14139e90c 100644 --- a/include/language.php +++ b/include/language.php @@ -189,7 +189,7 @@ function t($s, $ctx = '') { function translate_projectname($s) { - return str_replace(array('$projectname','$Projectname'),array(Zotlabs\Project\System::get_platform_name(),ucfirst(Zotlabs\Project\System::get_platform_name())),$s); + return str_replace(array('$projectname','$Projectname'),array(Zotlabs\Lib\System::get_platform_name(),ucfirst(Zotlabs\Lib\System::get_platform_name())),$s); } diff --git a/include/network.php b/include/network.php index f38f8d548..3e5263d3e 100644 --- a/include/network.php +++ b/include/network.php @@ -1839,7 +1839,7 @@ function format_and_send_email($sender,$xchan,$item) { $tpl = get_markup_template('email_notify_html.tpl'); $email_html_body = replace_macros($tpl,array( '$banner' => $banner, - '$notify_icon' => Zotlabs\Project\System::get_notify_icon(), + '$notify_icon' => Zotlabs\Lib\System::get_notify_icon(), '$product' => $product, '$preamble' => '', '$sitename' => $sitename, @@ -1990,8 +1990,8 @@ function get_site_info() { $site_info = get_config('system','info'); $site_name = get_config('system','sitename'); if(! get_config('system','hidden_version_siteinfo')) { - $version = Zotlabs\Project\System::get_project_version(); - $tag = Zotlabs\Project\System::get_std_version(); + $version = Zotlabs\Lib\System::get_project_version(); + $tag = Zotlabs\Lib\System::get_std_version(); if(@is_dir('.git') && function_exists('shell_exec')) { $commit = trim( @shell_exec('git log -1 --format="%h"')); @@ -2027,7 +2027,7 @@ function get_site_info() { $data = Array( 'version' => $version, 'version_tag' => $tag, - 'server_role' => Zotlabs\Project\System::get_server_role(), + 'server_role' => Zotlabs\Lib\System::get_server_role(), 'commit' => $commit, 'url' => z_root(), 'plugins' => $visible_plugins, @@ -2041,7 +2041,7 @@ function get_site_info() { 'locked_features' => $locked_features, 'admin' => $admin, 'site_name' => (($site_name) ? $site_name : ''), - 'platform' => Zotlabs\Project\System::get_platform_name(), + 'platform' => Zotlabs\Lib\System::get_platform_name(), 'dbdriver' => $db->getdriver(), 'lastpoll' => get_config('system','lastpoll'), 'info' => (($site_info) ? $site_info : ''), diff --git a/include/zot.php b/include/zot.php index 5884245e9..54a3fe640 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3924,7 +3924,7 @@ function zotinfo($arr) { $ret['site']['channels'] = channel_total(); - $ret['site']['version'] = Zotlabs\Project\System::get_platform_name() . ' ' . STD_VERSION . '[' . DB_UPDATE_VERSION . ']'; + $ret['site']['version'] = Zotlabs\Lib\System::get_platform_name() . ' ' . STD_VERSION . '[' . DB_UPDATE_VERSION . ']'; $ret['site']['admin'] = get_config('system','admin_email'); @@ -3944,7 +3944,7 @@ function zotinfo($arr) { $ret['site']['sellpage'] = get_config('system','sellpage'); $ret['site']['location'] = get_config('system','site_location'); $ret['site']['realm'] = get_directory_realm(); - $ret['site']['project'] = Zotlabs\Project\System::get_platform_name() . Zotlabs\Project\System::get_server_role(); + $ret['site']['project'] = Zotlabs\Lib\System::get_platform_name() . Zotlabs\Lib\System::get_server_role(); } |