diff options
Diffstat (limited to 'Zotlabs/Module')
57 files changed, 451 insertions, 497 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 5c14ab599..62ac29286 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -260,7 +260,7 @@ class Acl extends \Zotlabs\Web\Controller { // logger('navbar_complete'); - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 0a167b273..8f15035d1 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -902,7 +902,6 @@ class Admin extends \Zotlabs\Web\Controller { } // account delete button was submitted if (x($_POST, 'page_users_delete')) { - require_once('include/Contact.php'); foreach ($users as $uid){ account_remove($uid, true, false); } @@ -951,7 +950,6 @@ class Admin extends \Zotlabs\Web\Controller { switch (argv(2)){ case 'delete': // delete user - require_once('include/Contact.php'); account_remove($uid,true,false); notice( sprintf(t("Account '%s' deleted"), $account[0]['account_email']) . EOL); @@ -1096,7 +1094,6 @@ class Admin extends \Zotlabs\Web\Controller { notice( sprintf( tt("%s channel code allowed/disallowed", "%s channels code allowed/disallowed", count($channels)), count($channels)) ); } if (x($_POST,'page_channels_delete')){ - require_once("include/Contact.php"); foreach($channels as $uid){ channel_remove($uid,true); } @@ -1128,7 +1125,6 @@ class Admin extends \Zotlabs\Web\Controller { case "delete":{ check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels', 't'); // delete channel - require_once("include/Contact.php"); channel_remove($uid,true); notice( sprintf(t("Channel '%s' deleted"), $channel[0]['channel_name']) . EOL); @@ -1425,13 +1421,15 @@ class Admin extends \Zotlabs\Web\Controller { function listAddonRepos() { $addonrepos = []; $addonDir = __DIR__ . '/../../extend/addon/'; - if ($handle = opendir($addonDir)) { - while (false !== ($entry = readdir($handle))) { - if ($entry != "." && $entry != "..") { - $addonrepos[] = $entry; + if(is_dir($addonDir)) { + if ($handle = opendir($addonDir)) { + while (false !== ($entry = readdir($handle))) { + if ($entry != "." && $entry != "..") { + $addonrepos[] = $entry; + } } + closedir($handle); } - closedir($handle); } return $addonrepos; } @@ -1735,7 +1733,7 @@ class Admin extends \Zotlabs\Web\Controller { } else { json_return_and_die(array('message' => 'No repo name provided.', 'success' => false)); } - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { @@ -1748,7 +1746,7 @@ class Admin extends \Zotlabs\Web\Controller { } } } - $repoDir = __DIR__ . '/../../store/git/sys/extend/addon/' . $repoName; + $repoDir = __DIR__ . '/../../store/[data]/git/sys/extend/addon/' . $repoName; if (!is_dir($repoDir)) { logger('Repo directory does not exist: ' . $repoDir); json_return_and_die(array('message' => 'Invalid addon repo.', 'success' => false)); @@ -1785,7 +1783,7 @@ class Admin extends \Zotlabs\Web\Controller { } else { json_return_and_die(array('message' => 'No repo name provided.', 'success' => false)); } - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { @@ -1798,7 +1796,7 @@ class Admin extends \Zotlabs\Web\Controller { } } } - $repoDir = __DIR__ . '/../../store/git/sys/extend/addon/' . $repoName; + $repoDir = __DIR__ . '/../../store/[data]/git/sys/extend/addon/' . $repoName; if (!is_dir($repoDir)) { logger('Repo directory does not exist: ' . $repoDir); json_return_and_die(array('message' => 'Invalid addon repo.', 'success' => false)); @@ -1818,7 +1816,7 @@ class Admin extends \Zotlabs\Web\Controller { if (array_key_exists('repoURL', $_REQUEST)) { require __DIR__ . '/../../library/PHPGit.autoload.php'; // Load PHPGit dependencies $repoURL = $_REQUEST['repoURL']; - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { @@ -1846,7 +1844,7 @@ class Admin extends \Zotlabs\Web\Controller { json_return_and_die(array('message' => 'Invalid git repo', 'success' => false)); } $repoDir = $addonDir . '/' . $repoName; - $tempRepoBaseDir = __DIR__ . '/../../store/git/sys/temp/'; + $tempRepoBaseDir = __DIR__ . '/../../store/[data]/git/sys/temp/'; $tempAddonDir = $tempRepoBaseDir . $repoName; if (!is_writable($addonDir) || !is_writable($tempAddonDir)) { @@ -1880,9 +1878,9 @@ class Admin extends \Zotlabs\Web\Controller { if (array_key_exists('repoURL', $_REQUEST)) { require __DIR__ . '/../../library/PHPGit.autoload.php'; // Load PHPGit dependencies $repoURL = $_REQUEST['repoURL']; - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; - $tempAddonDir = __DIR__ . '/../../store/git/sys/temp'; + $tempAddonDir = __DIR__ . '/../../store/[data]/git/sys/temp'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { logger('Error creating extend folder: ' . $extendDir); @@ -1894,6 +1892,12 @@ class Admin extends \Zotlabs\Web\Controller { } } } + if (!is_dir($tempAddonDir)) { + if (!mkdir($tempAddonDir, 0770, true)) { + logger('Error creating temp plugin repo folder: ' . $tempAddonDir); + json_return_and_die(array('message' => 'Error creating temp plugin repo folder: ' . $tempAddonDir, 'success' => false)); + } + } $repoName = null; if (array_key_exists('repoName', $_REQUEST) && $_REQUEST['repoName'] !== '') { $repoName = $_REQUEST['repoName']; diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php index ba2a64f35..a200e986a 100644 --- a/Zotlabs/Module/Appman.php +++ b/Zotlabs/Module/Appman.php @@ -2,8 +2,9 @@ namespace Zotlabs\Module; -require_once('include/apps.php'); +//require_once('include/apps.php'); +use \Zotlabs\Lib as Zlib; class Appman extends \Zotlabs\Web\Controller { @@ -30,16 +31,16 @@ class Appman extends \Zotlabs\Web\Controller { 'categories' => escape_tags($_REQUEST['categories']) ); - $_REQUEST['appid'] = app_install(local_channel(),$arr); + $_REQUEST['appid'] = Zlib\Apps::app_install(local_channel(),$arr); - if(app_installed(local_channel(),$arr)) + if(Zlib\Apps::app_installed(local_channel(),$arr)) info( t('App installed.') . EOL); return; } - $papp = app_decode($_POST['papp']); + $papp = Zlib\Apps::app_decode($_POST['papp']); if(! is_array($papp)) { notice( t('Malformed app.') . EOL); @@ -47,13 +48,13 @@ class Appman extends \Zotlabs\Web\Controller { } if($_POST['install']) { - app_install(local_channel(),$papp); - if(app_installed(local_channel(),$papp)) + Zlib\Apps::app_install(local_channel(),$papp); + if(Zlib\Apps::app_installed(local_channel(),$papp)) info( t('App installed.') . EOL); } if($_POST['delete']) { - app_destroy(local_channel(),$papp); + Zlib\Apps::app_destroy(local_channel(),$papp); } if($_POST['edit']) { @@ -100,7 +101,7 @@ class Appman extends \Zotlabs\Web\Controller { } } - $embed = array('embed', t('Embed code'), app_encode($app,true),'', 'onclick="this.select();"'); + $embed = array('embed', t('Embed code'), Zlib\Apps::app_encode($app,true),'', 'onclick="this.select();"'); } diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php index 33259b319..4bdec4573 100644 --- a/Zotlabs/Module/Apps.php +++ b/Zotlabs/Module/Apps.php @@ -1,8 +1,9 @@ <?php namespace Zotlabs\Module; -require_once('include/apps.php'); +//require_once('include/apps.php'); +use \Zotlabs\Lib as Zlib; class Apps extends \Zotlabs\Web\Controller { @@ -19,25 +20,25 @@ class Apps extends \Zotlabs\Web\Controller { if(local_channel()) { - import_system_apps(); + Zlib\Apps::import_system_apps(); $syslist = array(); - $list = app_list(local_channel(), false, $_GET['cat']); + $list = Zlib\Apps::app_list(local_channel(), false, $_GET['cat']); if($list) { foreach($list as $x) { - $syslist[] = app_encode($x); + $syslist[] = Zlib\Apps::app_encode($x); } } - translate_system_apps($syslist); + Zlib\Apps::translate_system_apps($syslist); } else - $syslist = get_system_apps(true); + $syslist = Zlib\Apps::get_system_apps(true); - usort($syslist,'app_name_compare'); + usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare'); // logger('apps: ' . print_r($syslist,true)); foreach($syslist as $app) { - $apps[] = app_render($app,$mode); + $apps[] = Zlib\Apps::app_render($app,$mode); } return replace_macros(get_markup_template('myapps.tpl'), array( diff --git a/Zotlabs/Module/Blocks.php b/Zotlabs/Module/Blocks.php index ed702befb..32650a090 100644 --- a/Zotlabs/Module/Blocks.php +++ b/Zotlabs/Module/Blocks.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index 958ce5aa6..a1adb30e5 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -6,14 +6,12 @@ require_once('include/bbcode.php'); require_once('include/datetime.php'); require_once('include/event.php'); require_once('include/items.php'); -require_once('include/Contact.php'); - class Cal extends \Zotlabs\Web\Controller { function init() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } @@ -47,13 +45,12 @@ class Cal extends \Zotlabs\Web\Controller { - function get() { + function get() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } - - + $channel = null; if(argc() > 1) { diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index f55705442..29bfcbc3c 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -13,353 +13,355 @@ require_once('include/PermissionDescription.php'); class Channel extends \Zotlabs\Web\Controller { -function init() { - - $which = null; - if(argc() > 1) - $which = argv(1); - if(! $which) { - if(local_channel()) { - $channel = \App::get_channel(); - if($channel && $channel['channel_address']) - $which = $channel['channel_address']; + function init() { + + $which = null; + if(argc() > 1) + $which = argv(1); + if(! $which) { + if(local_channel()) { + $channel = \App::get_channel(); + if($channel && $channel['channel_address']) + $which = $channel['channel_address']; + } + } + if(! $which) { + notice( t('You must be logged in to see this page.') . EOL ); + return; } - } - if(! $which) { - notice( t('You must be logged in to see this page.') . EOL ); - return; - } - $profile = 0; - $channel = \App::get_channel(); + $profile = 0; + $channel = \App::get_channel(); - if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { - $which = $channel['channel_address']; - $profile = argv(1); - } + if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { + $which = $channel['channel_address']; + $profile = argv(1); + } - \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Posts and comments') . '" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n" ; - \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Only posts') . '" href="' . z_root() . '/feed/' . $which . '?top=1" />' . "\r\n" ; + \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Posts and comments') . '" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n" ; + \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Only posts') . '" href="' . z_root() . '/feed/' . $which . '?top=1" />' . "\r\n" ; -// Not yet ready for prime time -// \App::$page['htmlhead'] .= '<link rel="openid.server" href="' . z_root() . '/id/' . $which .'?f=" />' . "\r\n" ; -// \App::$page['htmlhead'] .= '<link rel="openid.delegate" href="' . z_root() . '/channel/' . $which .'" />' . "\r\n" ; + // Not yet ready for prime time + // \App::$page['htmlhead'] .= '<link rel="openid.server" href="' . z_root() . '/id/' . $which .'?f=" />' . "\r\n" ; + // \App::$page['htmlhead'] .= '<link rel="openid.delegate" href="' . z_root() . '/channel/' . $which .'" />' . "\r\n" ; - // Run profile_load() here to make sure the theme is set before - // we start loading content + // Run profile_load() here to make sure the theme is set before + // we start loading content - profile_load($a,$which,$profile); + profile_load($a,$which,$profile); -} + } -function get($update = 0, $load = false) { + function get($update = 0, $load = false) { - if($load) - $_SESSION['loadtime'] = datetime_convert(); + if($load) + $_SESSION['loadtime'] = datetime_convert(); - $checkjs = new \Zotlabs\Web\CheckJS(1); + $checkjs = new \Zotlabs\Web\CheckJS(1); - $category = $datequery = $datequery2 = ''; + $category = $datequery = $datequery2 = ''; - $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); + $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); - $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); - $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); + $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); + $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); - if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) { + if(observer_prohibited(true)) { return login(); - } + } - $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); - $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : ''); + $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); + $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : ''); - $groups = array(); + $groups = array(); - $o = ''; + $o = ''; - if($update) { - // Ensure we've got a profile owner if updating. - \App::$profile['profile_uid'] = \App::$profile_uid = $update; - } - else { - if(\App::$profile['profile_uid'] == local_channel()) { - nav_set_selected('home'); + if($update) { + // Ensure we've got a profile owner if updating. + \App::$profile['profile_uid'] = \App::$profile_uid = $update; + } + else { + if(\App::$profile['profile_uid'] == local_channel()) { + nav_set_selected('home'); + } } - } - $is_owner = (((local_channel()) && (\App::$profile['profile_uid'] == local_channel())) ? true : false); + $is_owner = (((local_channel()) && (\App::$profile['profile_uid'] == local_channel())) ? true : false); - $channel = \App::get_channel(); - $observer = \App::get_observer(); - $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); + $channel = \App::get_channel(); + $observer = \App::get_observer(); + $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); - $perms = get_all_perms(\App::$profile['profile_uid'],$ob_hash); + $perms = get_all_perms(\App::$profile['profile_uid'],$ob_hash); - if(! $perms['view_stream']) { + if(! $perms['view_stream']) { // We may want to make the target of this redirect configurable if($perms['view_profile']) { notice( t('Insufficient permissions. Request redirected to profile page.') . EOL); goaway (z_root() . "/profile/" . \App::$profile['channel_address']); } - notice( t('Permission denied.') . EOL); - return; - } + notice( t('Permission denied.') . EOL); + return; + } - if(! $update) { + if(! $update) { - $o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); + $o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); - $o .= common_friends_visitor_widget(\App::$profile['profile_uid']); + $o .= common_friends_visitor_widget(\App::$profile['profile_uid']); - if($channel && $is_owner) { - $channel_acl = array( - 'allow_cid' => $channel['channel_allow_cid'], - 'allow_gid' => $channel['channel_allow_gid'], - 'deny_cid' => $channel['channel_deny_cid'], - 'deny_gid' => $channel['channel_deny_gid'] - ); - } - else - $channel_acl = array(); - - - if($perms['post_wall']) { - - $x = array( - 'is_owner' => $is_owner, - 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(\App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false), - 'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''), - 'nickname' => \App::$profile['channel_address'], - 'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl,true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''), - 'showacl' => (($is_owner) ? 'yes' : ''), - 'bang' => '', - 'visitor' => (($is_owner || $observer) ? true : false), - 'profile_uid' => \App::$profile['profile_uid'], - 'editor_autocomplete' => true, - 'bbco_autocomplete' => 'bbcode', - 'bbcode' => true - ); - - $o .= status_editor($a,$x); - } + if($channel && $is_owner) { + $channel_acl = array( + 'allow_cid' => $channel['channel_allow_cid'], + 'allow_gid' => $channel['channel_allow_gid'], + 'deny_cid' => $channel['channel_deny_cid'], + 'deny_gid' => $channel['channel_deny_gid'] + ); + } + else + $channel_acl = array(); + + + if($perms['post_wall']) { + + $x = array( + 'is_owner' => $is_owner, + 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(\App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false), + 'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''), + 'nickname' => \App::$profile['channel_address'], + 'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($channel_acl,true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''), + 'showacl' => (($is_owner) ? 'yes' : ''), + 'bang' => '', + 'visitor' => (($is_owner || $observer) ? true : false), + 'profile_uid' => \App::$profile['profile_uid'], + 'editor_autocomplete' => true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true + ); + + $o .= status_editor($a,$x); + } - } + } - /** - * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups - */ + /** + * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups + */ - $item_normal = item_normal(); - $sql_extra = item_permissions_sql(\App::$profile['profile_uid']); + $item_normal = item_normal(); + $sql_extra = item_permissions_sql(\App::$profile['profile_uid']); - if(get_pconfig(\App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid)) - $page_mode = 'list'; - else - $page_mode = 'client'; + if(get_pconfig(\App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid)) + $page_mode = 'list'; + else + $page_mode = 'client'; - $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " "; + $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " "; - $simple_update = (($update) ? " AND item_unseen = 1 " : ''); + $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - \App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string) . '" title="oembed" />' . "\r\n"; + \App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string) . '" title="oembed" />' . "\r\n"; - if($update && $_SESSION['loadtime']) - $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; - if($load) - $simple_update = ''; - - if(($update) && (! $load)) { - - if ($mid) { - $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal - AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", - dbesc($mid . '%'), - intval(\App::$profile['profile_uid']) - ); - } else { - $r = q("SELECT distinct parent AS `item_id`, created from item - left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) - WHERE uid = %d $item_normal - AND item_wall = 1 $simple_update - AND (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra - ORDER BY created DESC", - intval(\App::$profile['profile_uid']) - ); - $_SESSION['loadtime'] = datetime_convert(); - } - - } - else { - - if(x($category)) { - $sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY)); - } - if(x($hashtags)) { - $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG)); - } - - if($datequery) { - $sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery)))); - } - if($datequery2) { - $sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2)))); - } + if($update && $_SESSION['loadtime']) + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; + if($load) + $simple_update = ''; - $itemspage = get_pconfig(local_channel(),'system','itemspage'); - \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); + if(($update) && (! $load)) { - if($load || ($checkjs->disabled())) { - if ($mid) { - $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal - AND item_wall = 1 $sql_extra limit 1", - dbesc($mid), + if($mid) { + $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal + AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", + dbesc($mid . '%'), intval(\App::$profile['profile_uid']) ); - if (! $r) { - notice( t('Permission denied.') . EOL); - } - - } else { - $r = q("SELECT distinct id AS item_id, created FROM item - left join abook on item.author_xchan = abook.abook_xchan + } + else { + $r = q("SELECT distinct parent AS `item_id`, created from item + left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE uid = %d $item_normal - AND item_wall = 1 and item_thread_top = 1 - AND (abook_blocked = 0 or abook.abook_flags is null) - $sql_extra $sql_extra2 - ORDER BY created DESC $pager_sql ", + AND item_wall = 1 $simple_update + AND (abook.abook_blocked = 0 or abook.abook_flags is null) + $sql_extra + ORDER BY created DESC", intval(\App::$profile['profile_uid']) ); + $_SESSION['loadtime'] = datetime_convert(); } + } else { - $r = array(); - } - } - if($r) { + if(x($category)) { + $sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY)); + } + if(x($hashtags)) { + $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG)); + } - $parents_str = ids_to_querystr($r,'item_id'); - - $items = q("SELECT `item`.*, `item`.`id` AS `item_id` - FROM `item` - WHERE `item`.`uid` = %d $item_normal - AND `item`.`parent` IN ( %s ) - $sql_extra ", - intval(\App::$profile['profile_uid']), - dbesc($parents_str) - ); - - xchan_query($items); - $items = fetch_post_tags($items, true); - $items = conv_sort($items,'created'); - - if ($load && $mid && (! count($items))) { - // This will happen if we don't have sufficient permissions - // to view the parent item (or the item itself if it is toplevel) - notice( t('Permission denied.') . EOL); + if($datequery) { + $sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery)))); + } + if($datequery2) { + $sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2)))); + } + + $itemspage = get_pconfig(local_channel(),'system','itemspage'); + \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); + + if($load || ($checkjs->disabled())) { + if($mid) { + $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal + AND item_wall = 1 $sql_extra limit 1", + dbesc($mid), + intval(\App::$profile['profile_uid']) + ); + if (! $r) { + notice( t('Permission denied.') . EOL); + } + + } + else { + $r = q("SELECT distinct id AS item_id, created FROM item + left join abook on item.author_xchan = abook.abook_xchan + WHERE uid = %d $item_normal + AND item_wall = 1 and item_thread_top = 1 + AND (abook_blocked = 0 or abook.abook_flags is null) + $sql_extra $sql_extra2 + ORDER BY created DESC $pager_sql ", + intval(\App::$profile['profile_uid']) + ); + } + } + else { + $r = array(); + } } - } else { - $items = array(); - } + if($r) { - if((! $update) && (! $load)) { - - // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, - // because browser prefetching might change it on us. We have to deliver it with the page. - - $maxheight = get_pconfig(\App::$profile['profile_uid'],'system','channel_divmore_height'); - if(! $maxheight) - $maxheight = 400; - - $o .= '<div id="live-channel"></div>' . "\r\n"; - $o .= "<script> var profile_uid = " . \App::$profile['profile_uid'] - . "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] - . "; divmore_height = " . intval($maxheight) . "; </script>\r\n"; - - \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( - '$baseurl' => z_root(), - '$pgtype' => 'channel', - '$uid' => ((\App::$profile['profile_uid']) ? \App::$profile['profile_uid'] : '0'), - '$gid' => '0', - '$cid' => '0', - '$cmin' => '0', - '$cmax' => '0', - '$star' => '0', - '$liked' => '0', - '$conv' => '0', - '$spam' => '0', - '$nouveau' => '0', - '$wall' => '1', - '$fh' => '0', - '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), - '$search' => '', - '$order' => '', - '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), - '$file' => '', - '$cats' => (($category) ? $category : ''), - '$tags' => (($hashtags) ? $hashtags : ''), - '$mid' => $mid, - '$verb' => '', - '$dend' => $datequery, - '$dbegin' => $datequery2 - )); + $parents_str = ids_to_querystr($r,'item_id'); + + $items = q("SELECT `item`.*, `item`.`id` AS `item_id` + FROM `item` + WHERE `item`.`uid` = %d $item_normal + AND `item`.`parent` IN ( %s ) + $sql_extra ", + intval(\App::$profile['profile_uid']), + dbesc($parents_str) + ); + xchan_query($items); + $items = fetch_post_tags($items, true); + $items = conv_sort($items,'created'); - } + if($load && $mid && (! count($items))) { + // This will happen if we don't have sufficient permissions + // to view the parent item (or the item itself if it is toplevel) + notice( t('Permission denied.') . EOL); + } - $update_unseen = ''; + } + else { + $items = array(); + } - if($page_mode === 'list') { + if((! $update) && (! $load)) { + + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, + // because browser prefetching might change it on us. We have to deliver it with the page. + + $maxheight = get_pconfig(\App::$profile['profile_uid'],'system','channel_divmore_height'); + if(! $maxheight) + $maxheight = 400; + + $o .= '<div id="live-channel"></div>' . "\r\n"; + $o .= "<script> var profile_uid = " . \App::$profile['profile_uid'] + . "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] + . "; divmore_height = " . intval($maxheight) . "; </script>\r\n"; + + \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + '$baseurl' => z_root(), + '$pgtype' => 'channel', + '$uid' => ((\App::$profile['profile_uid']) ? \App::$profile['profile_uid'] : '0'), + '$gid' => '0', + '$cid' => '0', + '$cmin' => '0', + '$cmax' => '0', + '$star' => '0', + '$liked' => '0', + '$conv' => '0', + '$spam' => '0', + '$nouveau' => '0', + '$wall' => '1', + '$fh' => '0', + '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), + '$search' => '', + '$order' => '', + '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), + '$file' => '', + '$cats' => (($category) ? $category : ''), + '$tags' => (($hashtags) ? $hashtags : ''), + '$mid' => $mid, + '$verb' => '', + '$dend' => $datequery, + '$dbegin' => $datequery2 + )); - /** - * in "list mode", only mark the parent item and any like activities as "seen". - * We won't distinguish between comment likes and post likes. The important thing - * is that the number of unseen comments will be accurate. The SQL to separate the - * comment likes could also get somewhat hairy. - */ - if($parents_str) { - $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )"; - $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) "; - } - } - else { - if($parents_str) { - $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )"; } - } - if($is_owner && $update_unseen) { - $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen", - intval(local_channel()) - ); - } + $update_unseen = ''; + if($page_mode === 'list') { - if($checkjs->disabled()) { - $o .= conversation($a,$items,'channel',$update,'traditional'); - } else { - $o .= conversation($a,$items,'channel',$update,$page_mode); - } + /** + * in "list mode", only mark the parent item and any like activities as "seen". + * We won't distinguish between comment likes and post likes. The important thing + * is that the number of unseen comments will be accurate. The SQL to separate the + * comment likes could also get somewhat hairy. + */ - if((! $update) || ($checkjs->disabled())) { - $o .= alt_pager($a,count($items)); - if ($mid && $items[0]['title']) - \App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title']; - } + if($parents_str) { + $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )"; + $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) "; + } + } + else { + if($parents_str) { + $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )"; + } + } + + if($is_owner && $update_unseen) { + $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen", + intval(local_channel()) + ); + } - if($mid) - $o .= '<div id="content-complete"></div>'; - return $o; -} + if($checkjs->disabled()) { + $o .= conversation($a,$items,'channel',$update,'traditional'); + } + else { + $o .= conversation($a,$items,'channel',$update,$page_mode); + } + if((! $update) || ($checkjs->disabled())) { + $o .= alt_pager($a,count($items)); + if ($mid && $items[0]['title']) + \App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title']; + } + if($mid) + $o .= '<div id="content-complete"></div>'; + + return $o; + } }
\ No newline at end of file diff --git a/Zotlabs/Module/Chanview.php b/Zotlabs/Module/Chanview.php index f70444816..c6dd07eb7 100644 --- a/Zotlabs/Module/Chanview.php +++ b/Zotlabs/Module/Chanview.php @@ -1,10 +1,8 @@ <?php namespace Zotlabs\Module; -require_once('include/Contact.php'); require_once('include/zot.php'); - class Chanview extends \Zotlabs\Web\Controller { function get() { @@ -62,18 +60,15 @@ class Chanview extends \Zotlabs\Web\Controller { } if($_REQUEST['address']) { - $ret = zot_finger($_REQUEST['address'],null); - if($ret['success']) { - $j = json_decode($ret['body'],true); - if($j) - import_xchan($j); + $j = \Zotlabs\Zot\Finger::run($_REQUEST['address'],null); + if($j['success']) { + import_xchan($j); $r = q("select * from xchan where xchan_addr = '%s' limit 1", dbesc($_REQUEST['address']) ); if($r) \App::$poi = $r[0]; } - } } diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index 9508ed3de..d14c32b7d 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -1,9 +1,11 @@ -<?php -namespace Zotlabs\Module; /** @file */ +<?php /** @file */ + +namespace Zotlabs\Module; + -require_once('include/chat.php'); require_once('include/bookmarks.php'); +use \Zotlabs\Lib as Zlib; class Chat extends \Zotlabs\Web\Controller { @@ -41,7 +43,7 @@ class Chat extends \Zotlabs\Web\Controller { } - function post() { + function post() { if($_POST['room_name']) $room = strip_tags(trim($_POST['room_name'])); @@ -54,7 +56,7 @@ class Chat extends \Zotlabs\Web\Controller { if($_POST['action'] === 'drop') { logger('delete chatroom'); - chatroom_destroy($channel,array('cr_name' => $room)); + Zlib\Chatroom::destroy($channel,array('cr_name' => $room)); goaway(z_root() . '/chat/' . $channel['channel_address']); } @@ -67,7 +69,7 @@ class Chat extends \Zotlabs\Web\Controller { if(intval($arr['expire']) < 0) $arr['expire'] = 0; - chatroom_create($channel,$arr); + Zlib\Chatroom::create($channel,$arr); $x = q("select * from chatroom where cr_name = '%s' and cr_uid = %d limit 1", dbesc($room), @@ -87,7 +89,7 @@ class Chat extends \Zotlabs\Web\Controller { } - function get() { + function get() { if(local_channel()) $channel = \App::get_channel(); @@ -105,7 +107,7 @@ class Chat extends \Zotlabs\Web\Controller { } if((argc() > 3) && intval(argv(2)) && (argv(3) === 'leave')) { - chatroom_leave($observer,argv(2),$_SERVER['REMOTE_ADDR']); + Zlib\Chatroom::leave($observer,argv(2),$_SERVER['REMOTE_ADDR']); goaway(z_root() . '/channel/' . argv(1)); } @@ -158,7 +160,7 @@ class Chat extends \Zotlabs\Web\Controller { $room_id = intval(argv(2)); $bookmark_link = get_bookmark_link($ob); - $x = chatroom_enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']); + $x = Zlib\Chatroom::enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']); if(! $x) return; $x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1", @@ -238,7 +240,7 @@ class Chat extends \Zotlabs\Web\Controller { )); } - $rooms = chatroom_list(\App::$profile['profile_uid']); + $rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( '$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['name']), diff --git a/Zotlabs/Module/Chatsvc.php b/Zotlabs/Module/Chatsvc.php index a9bc97301..6a28a7c4d 100644 --- a/Zotlabs/Module/Chatsvc.php +++ b/Zotlabs/Module/Chatsvc.php @@ -1,14 +1,16 @@ -<?php -namespace Zotlabs\Module; /** @file */ +<?php /** @file */ + +namespace Zotlabs\Module; require_once('include/security.php'); +use \Zotlabs\Lib as Zlib; class Chatsvc extends \Zotlabs\Web\Controller { function init() { - //logger('chatsvc'); + //logger('chatsvc'); $ret = array('success' => false); @@ -27,7 +29,7 @@ class Chatsvc extends \Zotlabs\Web\Controller { } - function post() { + function post() { $ret = array('success' => false); @@ -65,7 +67,7 @@ class Chatsvc extends \Zotlabs\Web\Controller { json_return_and_die($ret); } - function get() { + function get() { $status = strip_tags($_REQUEST['status']); $room_id = intval(\App::$data['chat']['room_id']); diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index d9b0c47d4..b691475ce 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -100,9 +100,12 @@ class Cloud extends \Zotlabs\Web\Controller { // require_once('\Zotlabs\Storage/QuotaPlugin.php'); // $server->addPlugin(new \Zotlabs\Storage\\QuotaPlugin($auth)); + ob_start(); // All we need to do now, is to fire up the server $server->exec(); + ob_end_flush(); + killme(); } diff --git a/Zotlabs/Module/Connect.php b/Zotlabs/Module/Connect.php index 382abf370..f68e0baac 100644 --- a/Zotlabs/Module/Connect.php +++ b/Zotlabs/Module/Connect.php @@ -2,7 +2,7 @@ namespace Zotlabs\Module; /** @file */ -require_once('include/Contact.php'); + require_once('include/contact_widgets.php'); require_once('include/items.php'); diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php index ebf8ff8e6..a412d16ae 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/Contact.php'); + require_once('include/socgraph.php'); require_once('include/selectors.php'); require_once('include/group.php'); diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 8bf4ac9b4..c5c38b96a 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -7,7 +7,7 @@ namespace Zotlabs\Module; * */ -require_once('include/Contact.php'); + require_once('include/socgraph.php'); require_once('include/selectors.php'); require_once('include/group.php'); @@ -230,7 +230,7 @@ class Connedit extends \Zotlabs\Web\Controller { if(\App::$poi && \App::$poi['abook_my_perms'] != $abook_my_perms && (! intval(\App::$poi['abook_self']))) { - \Zotlabs\Daemon\Master(array('Notifier', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id)); + \Zotlabs\Daemon\Master::Summon(array('Notifier', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id)); } if($new_friend) { @@ -485,7 +485,6 @@ class Connedit extends \Zotlabs\Web\Controller { if($cmd === 'drop') { - require_once('include/Contact.php'); // FIXME // We need to send either a purge or a refresh packet to the other side (the channel being unfriended). diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index aafc1bdb0..2e53696ff 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -8,7 +8,7 @@ namespace Zotlabs\Module; */ require_once('include/photo/photo_driver.php'); -require_once('include/identity.php'); +require_once('include/channel.php'); diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index b8bac53bb..560038ffc 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -57,9 +57,9 @@ class Directory extends \Zotlabs\Web\Controller { } } - function get() { + function get() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 2a5a04a2a..c1a0d84bc 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -7,17 +7,13 @@ class Display extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { - // logger("mod-display: update = $update load = $load"); - - $checkjs = new \Zotlabs\Web\CheckJS(1); - if($load) $_SESSION['loadtime'] = datetime_convert(); - if(intval(get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } @@ -185,7 +181,7 @@ class Display extends \Zotlabs\Web\Controller { if($load || ($checkjs->disabled())) { $r = null; - require_once('include/identity.php'); + require_once('include/channel.php'); $sys = get_sys_channel(); $sysid = $sys['channel_id']; @@ -233,7 +229,7 @@ class Display extends \Zotlabs\Web\Controller { elseif($update && !$load) { $r = null; - require_once('include/identity.php'); + require_once('include/channel.php'); $sys = get_sys_channel(); $sysid = $sys['channel_id']; diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php index a79962033..fb86557f2 100644 --- a/Zotlabs/Module/Editblock.php +++ b/Zotlabs/Module/Editblock.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/acl_selectors.php'); require_once('include/conversation.php'); diff --git a/Zotlabs/Module/Editlayout.php b/Zotlabs/Module/Editlayout.php index c5b50235a..5028882d2 100644 --- a/Zotlabs/Module/Editlayout.php +++ b/Zotlabs/Module/Editlayout.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/acl_selectors.php'); require_once('include/conversation.php'); diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php index c2346c53b..1b5c320a0 100644 --- a/Zotlabs/Module/Editwebpage.php +++ b/Zotlabs/Module/Editwebpage.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/acl_selectors.php'); require_once('include/conversation.php'); require_once('include/PermissionDescription.php'); diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 3440e0727..2b5e239f9 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -232,7 +232,7 @@ class Events extends \Zotlabs\Web\Controller { } if($share) - \Zotlabs\Daemon\Master(array('Notifier','event',$item_id)); + \Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id)); } diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php index 9d33ba2c3..47871eafb 100644 --- a/Zotlabs/Module/Feed.php +++ b/Zotlabs/Module/Feed.php @@ -31,7 +31,7 @@ class Feed extends \Zotlabs\Web\Controller { $channel = $r[0]; - if((intval(get_config('system','block_public'))) && (! get_account_id())) + if(observer_prohibited(true)) killme(); logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['channel_address']); diff --git a/Zotlabs/Module/Getfile.php b/Zotlabs/Module/Getfile.php index 6999e77e8..09d761887 100644 --- a/Zotlabs/Module/Getfile.php +++ b/Zotlabs/Module/Getfile.php @@ -21,7 +21,6 @@ namespace Zotlabs\Module; -require_once('include/Contact.php'); require_once('include/attach.php'); diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 4e99155fb..57ced22a3 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -4,9 +4,9 @@ namespace Zotlabs\Module; // Import a channel, either by direct file upload or via // connection to original server. -require_once('include/Contact.php'); + require_once('include/zot.php'); -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/import.php'); diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index ff8510ade..041939ad8 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -17,10 +17,10 @@ namespace Zotlabs\Module; */ require_once('include/crypto.php'); -require_once('include/enotify.php'); require_once('include/items.php'); require_once('include/attach.php'); +use \Zotlabs\Lib as Zlib; class Item extends \Zotlabs\Web\Controller { @@ -56,7 +56,7 @@ class Item extends \Zotlabs\Web\Controller { $remote_xchan = $remote_observer = false; $profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0); - require_once('include/identity.php'); + require_once('include/channel.php'); $sys = get_sys_channel(); if($sys && $profile_uid && ($sys['channel_id'] == $profile_uid) && is_site_admin()) { $uid = intval($sys['channel_id']); @@ -925,7 +925,7 @@ class Item extends \Zotlabs\Web\Controller { // otherwise it will happen during delivery if(($datarray['owner_xchan'] != $datarray['author_xchan']) && (intval($parent_item['item_wall']))) { - notification(array( + Zlib\Enotify::submit(array( 'type' => NOTIFY_COMMENT, 'from_xchan' => $datarray['author_xchan'], 'to_xchan' => $datarray['owner_xchan'], @@ -943,7 +943,7 @@ class Item extends \Zotlabs\Web\Controller { $parent = $post_id; if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($datarray['item_type'] == ITEM_TYPE_POST)) { - notification(array( + Zlib\Enotify::submit(array( 'type' => NOTIFY_WALL, 'from_xchan' => $datarray['author_xchan'], 'to_xchan' => $datarray['owner_xchan'], diff --git a/Zotlabs/Module/Layouts.php b/Zotlabs/Module/Layouts.php index 8a7207fc2..9b9fc22f3 100644 --- a/Zotlabs/Module/Layouts.php +++ b/Zotlabs/Module/Layouts.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php index 63db4a317..6798f72a9 100644 --- a/Zotlabs/Module/Magic.php +++ b/Zotlabs/Module/Magic.php @@ -47,11 +47,9 @@ class Magic extends \Zotlabs\Web\Controller { * */ - $ret = zot_finger((($addr) ? $addr : '[system]@' . $parsed['host']),null); - if($ret['success']) { - $j = json_decode($ret['body'],true); - if($j) - import_xchan($j); + $j = \Zotlabs\Zot\Finger::run((($addr) ? $addr : '[system]@' . $parsed['host']),null); + if($j['success']) { + import_xchan($j); // Now try again diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index e6487d681..aae7585c4 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -5,7 +5,7 @@ require_once('include/acl_selectors.php'); require_once('include/message.php'); require_once('include/zot.php'); require_once("include/bbcode.php"); -require_once('include/Contact.php'); + @@ -32,17 +32,16 @@ class Mail extends \Zotlabs\Web\Controller { if(! $recipient) { $channel = \App::get_channel(); - $ret = zot_finger($rstr,$channel); + $j = \Zotlabs\Zot\Finger::run($rstr,$channel); - if(! $ret['success']) { + if(! $j['success']) { notice( t('Unable to lookup recipient.') . EOL); return; } - $j = json_decode($ret['body'],true); logger('message_post: lookup: ' . $url . ' ' . print_r($j,true)); - if(! ($j['success'] && $j['guid'])) { + if(! $j['guid']) { notice( t('Unable to communicate with requested channel.')); return; } @@ -306,11 +305,6 @@ class Mail extends \Zotlabs\Web\Controller { else \App::$poi = $messages[0]['to']; - // require_once('include/Contact.php'); - - // \App::set_widget('mail_conversant',vcard_from_xchan(\App::$poi,$get_observer_hash,'mail')); - - $tpl = get_markup_template('msg-header.tpl'); \App::$page['htmlhead'] .= replace_macros($tpl, array( diff --git a/Zotlabs/Module/Menu.php b/Zotlabs/Module/Menu.php index 9ada63911..e98053f8c 100644 --- a/Zotlabs/Module/Menu.php +++ b/Zotlabs/Module/Menu.php @@ -2,7 +2,7 @@ namespace Zotlabs\Module; require_once('include/menu.php'); -require_once('include/identity.php'); +require_once('include/channel.php'); class Menu extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Message.php b/Zotlabs/Module/Message.php index 58a138899..ea2127a1d 100644 --- a/Zotlabs/Module/Message.php +++ b/Zotlabs/Module/Message.php @@ -5,8 +5,6 @@ require_once('include/acl_selectors.php'); require_once('include/message.php'); require_once('include/zot.php'); require_once("include/bbcode.php"); -require_once('include/Contact.php'); - class Message extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index c88258a78..238df3593 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -385,7 +385,7 @@ class Network extends \Zotlabs\Web\Controller { $abook_uids = " and abook.abook_channel = " . local_channel() . " "; if($firehose && (! get_config('system','disable_discover_tab'))) { - require_once('include/identity.php'); + require_once('include/channel.php'); $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; \App::$data['firehose'] = intval($sys['channel_id']); diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index 3dca1b0b4..30d7c83c6 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/permissions.php'); diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php index 638ea7e2d..89824fc7e 100644 --- a/Zotlabs/Module/Oep.php +++ b/Zotlabs/Module/Oep.php @@ -181,8 +181,8 @@ class Oep extends \Zotlabs\Web\Controller { function oep_profile_reply($args) { - require_once('include/identity.php'); - require_once('include/Contact.php'); + require_once('include/channel.php'); + $url = $args['url']; if(preg_match('#//(.*?)/(.*?)/(.*?)(/|\?|&|$)#',$url,$matches)) { diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 1659350a5..7186209ba 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -1,12 +1,12 @@ <?php namespace Zotlabs\Module; + require_once('include/photo/photo_driver.php'); require_once('include/photos.php'); require_once('include/items.php'); require_once('include/acl_selectors.php'); require_once('include/bbcode.php'); require_once('include/security.php'); -require_once('include/Contact.php'); require_once('include/attach.php'); require_once('include/text.php'); require_once('include/PermissionDescription.php'); @@ -18,7 +18,7 @@ class Photos extends \Zotlabs\Web\Controller { function init() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } @@ -518,7 +518,7 @@ class Photos extends \Zotlabs\Web\Controller { // photos/name/image/xxxxx - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index bea4a08b7..32427b06f 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -1,12 +1,13 @@ <?php namespace Zotlabs\Module; + /** * @file mod/ping.php * */ require_once('include/bbcode.php'); -require_once('include/notify.php'); + /** * @brief do several updates when pinged. @@ -285,7 +286,7 @@ class Ping extends \Zotlabs\Web\Controller { foreach($r as $item) { if((argv(1) === 'home') && (! intval($item['item_wall']))) continue; - $result[] = format_notification($item); + $result[] = \Zotlabs\Lib\Enotify::format($item); } } // logger('ping (network||home): ' . print_r($result, true), LOGGER_DATA); diff --git a/Zotlabs/Module/Probe.php b/Zotlabs/Module/Probe.php index 79abe9819..dda792131 100644 --- a/Zotlabs/Module/Probe.php +++ b/Zotlabs/Module/Probe.php @@ -20,17 +20,17 @@ class Probe extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); $addr = trim($_GET['addr']); $do_import = ((intval($_GET['import']) && is_site_admin()) ? true : false); - $res = zot_finger($addr,$channel,false); + + $j = \Zotlabs\Zot\Finger::run($addr,$channel,false); + + // $res = zot_finger($addr,$channel,false); + $o .= '<pre>'; - if($res['success']) - $j = json_decode($res['body'],true); - else { + if(! $j['success']) { $o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n"); $o .= "<strong>https connection failed. Trying again with auto failover to http.</strong>\r\n\r\n"; - $res = zot_finger($addr,$channel,true); - if($res['success']) - $j = json_decode($res['body'],true); - else + $j = \Zotlabs\Zot\Finger::run($addr,$channel,true); + if(! $j['success']) $o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n"); } diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index 04a64fe76..8bf358bc8 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -55,8 +55,8 @@ class Profile extends \Zotlabs\Web\Controller { function get() { - if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) { - return login(); + if(observer_prohibited(true)) { + return login(); } $groups = array(); diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index efcc7bece..a8cf3cbee 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -9,7 +9,7 @@ namespace Zotlabs\Module; require_once('include/photo/photo_driver.php'); require_once('include/photos.php'); -require_once('include/identity.php'); +require_once('include/channel.php'); /* @brief Function for sync'ing permissions of profile-photos and their profile * diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index e899abb3f..54780499b 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/selectors.php'); @@ -602,7 +602,7 @@ class Profiles extends \Zotlabs\Web\Controller { return; } - require_once('include/identity.php'); + require_once('include/channel.php'); $profile_fields_basic = get_profile_fields_basic(); $profile_fields_advanced = get_profile_fields_advanced(); diff --git a/Zotlabs/Module/Profperm.php b/Zotlabs/Module/Profperm.php index 94267aaac..33e9d1ece 100644 --- a/Zotlabs/Module/Profperm.php +++ b/Zotlabs/Module/Profperm.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/Contact.php'); + require_once('include/photos.php'); diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index 31bca5f30..0dda08e6d 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -28,9 +28,10 @@ class Pubsites extends \Zotlabs\Web\Controller { if($ret['success']) { $j = json_decode($ret['body'],true); if($j) { - $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>'; + $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('Stats') . '</td><td>' . t('Software') . '</td><td colspan="2">' . t('Ratings') . '</td></tr>'; if($j['sites']) { foreach($j['sites'] as $jj) { + $m = parse_url($jj['url']); if(strpos($jj['project'],\Zotlabs\Lib\System::get_platform_name()) === false) continue; $host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3)); @@ -43,7 +44,7 @@ class Pubsites extends \Zotlabs\Web\Controller { $location = '<br /> '; } $urltext = str_replace(array('https://'), '', $jj['url']); - $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . ucwords($jj['project']) . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links . '</tr>'; + $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links . '</tr>'; } } diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index adc16e6e6..312be7718 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -12,7 +12,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $_SESSION['loadtime'] = datetime_convert(); - if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) { + if(observer_prohibited(true)) { return login(); } @@ -71,7 +71,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); } - require_once('include/identity.php'); + require_once('include/channel.php'); require_once('include/security.php'); if(get_config('system','site_firehose')) { diff --git a/Zotlabs/Module/Randprof.php b/Zotlabs/Module/Randprof.php index 86b25c22a..dc2e925fe 100644 --- a/Zotlabs/Module/Randprof.php +++ b/Zotlabs/Module/Randprof.php @@ -6,7 +6,6 @@ namespace Zotlabs\Module; class Randprof extends \Zotlabs\Web\Controller { function init() { - require_once('include/Contact.php'); $x = random_profile(); if($x) goaway(chanlink_url($x)); diff --git a/Zotlabs/Module/Ratings.php b/Zotlabs/Module/Ratings.php index 802bbfec2..969fb5015 100644 --- a/Zotlabs/Module/Ratings.php +++ b/Zotlabs/Module/Ratings.php @@ -8,7 +8,7 @@ class Ratings extends \Zotlabs\Web\Controller { function init() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } @@ -80,9 +80,9 @@ class Ratings extends \Zotlabs\Web\Controller { - function get() { + function get() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Regdir.php b/Zotlabs/Module/Regdir.php index 65f8daf67..48a7cc16d 100644 --- a/Zotlabs/Module/Regdir.php +++ b/Zotlabs/Module/Regdir.php @@ -60,14 +60,11 @@ class Regdir extends \Zotlabs\Web\Controller { json_return_and_die($result); } - $f = zot_finger('[system]@' . $m['host']); - if($f['success']) { - $j = json_decode($f['body'],true); - if($j['success'] && $j['guid']) { - $x = import_xchan($j); - if($x['success']) { - $result['success'] = true; - } + $j = \Zotlabs\Zot\Finger::run('[system]@' . $m['host']); + if($j['success'] && $j['guid']) { + $x = import_xchan($j); + if($x['success']) { + $result['success'] = true; } } diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index ca3f33238..7cd1ee501 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); class Register extends \Zotlabs\Web\Controller { diff --git a/Zotlabs/Module/Removeaccount.php b/Zotlabs/Module/Removeaccount.php index da496dfad..39e06bb7f 100644 --- a/Zotlabs/Module/Removeaccount.php +++ b/Zotlabs/Module/Removeaccount.php @@ -36,17 +36,12 @@ class Removeaccount extends \Zotlabs\Web\Controller { } } - require_once('include/Contact.php'); - $global_remove = intval($_POST['global']); - account_remove($account_id,true); - + account_remove($account_id, 1 - $global_remove); } - - - - function get() { + + function get() { if(! local_channel()) goaway(z_root()); diff --git a/Zotlabs/Module/Removeme.php b/Zotlabs/Module/Removeme.php index 9b634672a..e611d8112 100644 --- a/Zotlabs/Module/Removeme.php +++ b/Zotlabs/Module/Removeme.php @@ -35,8 +35,6 @@ class Removeme extends \Zotlabs\Web\Controller { } } - require_once('include/Contact.php'); - $global_remove = intval($_POST['global']); channel_remove(local_channel(),1 - $global_remove,true); @@ -44,8 +42,7 @@ class Removeme extends \Zotlabs\Web\Controller { } - - function get() { + function get() { if(! local_channel()) goaway(z_root()); diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 9941ebbd2..fcc2506fc 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -139,7 +139,7 @@ class Search extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $pub_sql = public_permissions_sql($observer_hash); - require_once('include/identity.php'); + require_once('include/channel.php'); $sys = get_sys_channel(); diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 32ef89f68..5687ce84b 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -483,7 +483,7 @@ class Settings extends \Zotlabs\Web\Controller { if($username != $channel['channel_name']) { $name_change = true; - require_once('include/identity.php'); + require_once('include/channel.php'); $err = validate_channelname($username); if($err) { notice($err); diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index f8c14951b..447f46ed6 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -12,7 +12,6 @@ namespace Zotlabs\Module; /** * @brief Initialisation for the setup module. * - * @param[in,out] App &$a */ class Setup extends \Zotlabs\Web\Controller { @@ -54,16 +53,15 @@ class Setup extends \Zotlabs\Web\Controller { /** * @brief Handle the actions of the different setup steps. * - * @param[in,out] App &$a */ - function post() { - global $db; + + function post() { switch($this->install_wizard_pass) { case 1: case 2: return; - break; // just in case return don't return :) + // implied break; case 3: $urlpath = \App::get_path(); $dbhost = trim($_POST['dbhost']); @@ -82,39 +80,15 @@ class Setup extends \Zotlabs\Web\Controller { $siteurl = rtrim($siteurl,'/'); require_once('include/dba/dba_driver.php'); - unset($db); - $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); + + $db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); - if(! $db->connected) { - echo 'Database Connect failed: ' . $db->error; + if(! \DBA::$dba->connected) { + echo 'Database Connect failed: ' . DBA::$dba->error; killme(); - \App::$data['db_conn_failed']=true; } - /*if(get_db_errno()) { - unset($db); - $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, '', true); - - if(! get_db_errno()) { - $r = q("CREATE DATABASE '%s'", - dbesc($dbdata) - ); - if($r) { - unset($db); - $db = new dba($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true); - } else { - \App::$data['db_create_failed']=true; - } - } else { - \App::$data['db_conn_failed']=true; - return; - } - }*/ - //if(get_db_errno()) { - - //} - return; - break; + // implied break; case 4: $urlpath = \App::get_path(); $dbhost = notags(trim($_POST['dbhost'])); @@ -138,10 +112,12 @@ class Setup extends \Zotlabs\Web\Controller { } } - // connect to db - $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); - - if(! $db->connected) { + if(! \DBA::$dba->connected) { + // connect to db + $db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); + } + + if(! \DBA::$dba->connected) { echo 'CRITICAL: DB not connected.'; killme(); } @@ -175,6 +151,8 @@ class Setup extends \Zotlabs\Web\Controller { \App::$data['db_installed'] = true; return; + // implied break; + default: break; } } @@ -191,11 +169,10 @@ class Setup extends \Zotlabs\Web\Controller { * * Depending on the state we are currently in it returns different content. * - * @param App &$a * @return string parsed HTML output */ - function get() { - global $db; + + function get() { $o = ''; $wizard_status = ''; @@ -228,7 +205,7 @@ class Setup extends \Zotlabs\Web\Controller { $txt .= "<pre>".\App::$data['db_failed'] . "</pre>". EOL ; $db_return_text .= $txt; } - if($db && $db->connected) { + if(\DBA::$dba && \DBA::$dba->connected) { $r = q("SELECT COUNT(*) as `total` FROM `account`"); if($r && count($r) && $r[0]['total']) { $tpl = get_markup_template('install.tpl'); @@ -598,7 +575,7 @@ class Setup extends \Zotlabs\Web\Controller { if(! is_writable(TEMPLATE_BUILD_PATH) ) { $status = false; $help = t('Red uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL; - $help .= sprintf( t('In order to store these compiled templates, the web server needs to have write access to the directory %s under the Red top level folder.'), TEMPLATE_BUILD_PATH) . EOL; + $help .= sprintf( t('In order to store these compiled templates, the web server needs to have write access to the directory %s under the top level web folder.'), TEMPLATE_BUILD_PATH) . EOL; $help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL; $help .= sprintf( t('Note: as a security measure, you should give the web server write access to %s only--not the template files (.tpl) that it contains.'), TEMPLATE_BUILD_PATH) . EOL; } @@ -698,12 +675,12 @@ class Setup extends \Zotlabs\Web\Controller { function load_database($db) { - $str = file_get_contents($db->get_install_script()); + $str = file_get_contents(\DBA::$dba->get_install_script()); $arr = explode(';',$str); $errors = false; foreach($arr as $a) { if(strlen(trim($a))) { - $r = @$db->q(trim($a)); + $r = dbq(trim($a)); if(! $r) { $errors .= t('Errors encountered creating database tables.') . $a . EOL; } @@ -734,7 +711,7 @@ class Setup extends \Zotlabs\Web\Controller { set_config('system','curl_ssl_ciphers','ALL:!eNULL'); // Create a system channel - require_once ('include/identity.php'); + require_once ('include/channel.php'); create_sys_channel(); $baseurl = z_root(); diff --git a/Zotlabs/Module/Uexport.php b/Zotlabs/Module/Uexport.php index ada7e0986..d48f96d76 100644 --- a/Zotlabs/Module/Uexport.php +++ b/Zotlabs/Module/Uexport.php @@ -11,7 +11,7 @@ class Uexport extends \Zotlabs\Web\Controller { if(argc() > 1) { $channel = \App::get_channel(); - require_once('include/identity.php'); + require_once('include/channel.php'); if(argc() > 1 && intval(argv(1)) > 1900) { $year = intval(argv(1)); diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php index a9445cdeb..ea478f92a 100644 --- a/Zotlabs/Module/Viewconnections.php +++ b/Zotlabs/Module/Viewconnections.php @@ -2,23 +2,21 @@ namespace Zotlabs\Module; require_once('include/selectors.php'); -require_once('include/Contact.php'); - class Viewconnections extends \Zotlabs\Web\Controller { function init() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } if(argc() > 1) profile_load($a,argv(1)); } - function get() { + function get() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php index 5bdecfa75..9a1019ddb 100644 --- a/Zotlabs/Module/Wall_attach.php +++ b/Zotlabs/Module/Wall_attach.php @@ -2,7 +2,7 @@ namespace Zotlabs\Module; require_once('include/attach.php'); -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/photos.php'); diff --git a/Zotlabs/Module/Wall_upload.php b/Zotlabs/Module/Wall_upload.php index fff3ed03a..3868cb14e 100644 --- a/Zotlabs/Module/Wall_upload.php +++ b/Zotlabs/Module/Wall_upload.php @@ -2,7 +2,7 @@ namespace Zotlabs\Module; require_once('include/photo/photo_driver.php'); -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/photos.php'); diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php index d8adb55b2..bb8d454c8 100644 --- a/Zotlabs/Module/Webpages.php +++ b/Zotlabs/Module/Webpages.php @@ -1,7 +1,7 @@ <?php namespace Zotlabs\Module; -require_once('include/identity.php'); +require_once('include/channel.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); require_once('include/PermissionDescription.php'); diff --git a/Zotlabs/Module/Zotfeed.php b/Zotlabs/Module/Zotfeed.php index 28040149f..6b505c890 100644 --- a/Zotlabs/Module/Zotfeed.php +++ b/Zotlabs/Module/Zotfeed.php @@ -15,7 +15,7 @@ class Zotfeed extends \Zotlabs\Web\Controller { if(! $mindate) $mindate = datetime_convert('UTC','UTC', 'now - 14 days'); - if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) { + if(observer_prohibited()) { $result['message'] = 'Public access denied'; json_return_and_die($result); } @@ -45,8 +45,6 @@ class Zotfeed extends \Zotlabs\Web\Controller { $result['messages'] = zot_feed($r[0]['channel_id'],$observer['xchan_hash'],array('mindate' => $mindate)); $result['success'] = true; json_return_and_die($result); - - } } |