Extend documentation.
This commit is contained in:
parent
671b6d2eda
commit
728788e3b9
@ -1,32 +1,34 @@
|
|||||||
<?php /** @file */
|
<?php
|
||||||
|
|
||||||
namespace Zotlabs\Lib;
|
namespace Zotlabs\Lib;
|
||||||
|
|
||||||
/**
|
|
||||||
* Apps
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once('include/plugin.php');
|
require_once('include/plugin.php');
|
||||||
require_once('include/channel.php');
|
require_once('include/channel.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Apps class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
class Apps {
|
class Apps {
|
||||||
|
|
||||||
static public $available_apps = null;
|
static public $available_apps = null;
|
||||||
static public $installed_apps = null;
|
static public $installed_apps = null;
|
||||||
|
|
||||||
static public $base_apps = null;
|
static public $base_apps = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param boolean $translate (optional) default true
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
static public function get_system_apps($translate = true) {
|
static public function get_system_apps($translate = true) {
|
||||||
|
$ret = [];
|
||||||
|
|
||||||
$ret = array();
|
|
||||||
if(is_dir('apps'))
|
if(is_dir('apps'))
|
||||||
$files = glob('apps/*.apd');
|
$files = glob('apps/*.apd');
|
||||||
else
|
else
|
||||||
$files = glob('app/*.apd');
|
$files = glob('app/*.apd');
|
||||||
|
|
||||||
if($files) {
|
if($files) {
|
||||||
foreach($files as $f) {
|
foreach($files as $f) {
|
||||||
$x = self::parse_app_description($f,$translate);
|
$x = self::parse_app_description($f,$translate);
|
||||||
@ -50,14 +52,17 @@ class Apps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
call_hooks('get_system_apps',$ret);
|
/**
|
||||||
|
* @hooks get_system_apps
|
||||||
|
* Hook to manipulate the system apps array.
|
||||||
|
*/
|
||||||
|
call_hooks('get_system_apps', $ret);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function get_base_apps() {
|
static public function get_base_apps() {
|
||||||
$x = get_config('system','base_apps',[
|
$x = get_config('system','base_apps',[
|
||||||
'Connections',
|
'Connections',
|
||||||
'Network',
|
'Network',
|
||||||
'Settings',
|
'Settings',
|
||||||
@ -72,7 +77,13 @@ class Apps {
|
|||||||
'Mail',
|
'Mail',
|
||||||
'Profile Photo'
|
'Profile Photo'
|
||||||
]);
|
]);
|
||||||
call_hooks('get_base_apps',$x);
|
|
||||||
|
/**
|
||||||
|
* @hooks get_base_apps
|
||||||
|
* Hook to manipulate the base apps array.
|
||||||
|
*/
|
||||||
|
call_hooks('get_base_apps', $x);
|
||||||
|
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +92,7 @@ class Apps {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
self::$base_apps = self::get_base_apps();
|
self::$base_apps = self::get_base_apps();
|
||||||
|
|
||||||
$apps = self::get_system_apps(false);
|
$apps = self::get_system_apps(false);
|
||||||
|
|
||||||
self::$available_apps = q("select * from app where app_channel = 0");
|
self::$available_apps = q("select * from app where app_channel = 0");
|
||||||
@ -106,6 +117,7 @@ class Apps {
|
|||||||
// $id will be boolean true or false to install an app, or an integer id to update an existing app
|
// $id will be boolean true or false to install an app, or an integer id to update an existing app
|
||||||
if($id === false)
|
if($id === false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if($id !== true) {
|
if($id !== true) {
|
||||||
// if we already installed this app, but it changed, preserve any categories we created
|
// if we already installed this app, but it changed, preserve any categories we created
|
||||||
$s = EMPTY_STR;
|
$s = EMPTY_STR;
|
||||||
@ -126,16 +138,17 @@ class Apps {
|
|||||||
$app['guid'] = hash('whirlpool',$app['name']);
|
$app['guid'] = hash('whirlpool',$app['name']);
|
||||||
$app['system'] = 1;
|
$app['system'] = 1;
|
||||||
self::app_install(local_channel(),$app);
|
self::app_install(local_channel(),$app);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install the system app if no system apps have been installed, or if a new system app
|
* Install the system app if no system apps have been installed, or if a new system app
|
||||||
* is discovered, or if the version of a system app changes.
|
* is discovered, or if the version of a system app changes.
|
||||||
|
*
|
||||||
|
* @param array $app
|
||||||
|
* @return boolean|int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static public function check_install_system_app($app) {
|
static public function check_install_system_app($app) {
|
||||||
if((! is_array(self::$available_apps)) || (! count(self::$available_apps))) {
|
if((! is_array(self::$available_apps)) || (! count(self::$available_apps))) {
|
||||||
return true;
|
return true;
|
||||||
@ -159,17 +172,16 @@ class Apps {
|
|||||||
return $notfound;
|
return $notfound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install the system app if no system apps have been installed, or if a new system app
|
* Install the personal app if no personal apps have been installed, or if a new personal app
|
||||||
* is discovered, or if the version of a system app changes.
|
* is discovered, or if the version of a personal app changes.
|
||||||
|
*
|
||||||
|
* @param array $app
|
||||||
|
* @return boolean|int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static public function check_install_personal_app($app) {
|
static public function check_install_personal_app($app) {
|
||||||
$installed = false;
|
$installed = false;
|
||||||
foreach(self::$installed_apps as $iapp) {
|
foreach(self::$installed_apps as $iapp) {
|
||||||
if($iapp['app_id'] == hash('whirlpool',$app['name'])) {
|
if($iapp['app_id'] == hash('whirlpool',$app['name'])) {
|
||||||
$installed = true;
|
$installed = true;
|
||||||
if(($iapp['app_version'] != $app['version'])
|
if(($iapp['app_version'] != $app['version'])
|
||||||
@ -189,19 +201,24 @@ class Apps {
|
|||||||
return strcasecmp($a['name'],$b['name']);
|
return strcasecmp($a['name'],$b['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
static public function parse_app_description($f,$translate = true) {
|
* @brief Parse app description.
|
||||||
|
*
|
||||||
$ret = array();
|
* @param string $f filename
|
||||||
|
* @param boolean $translate (optional) default true
|
||||||
|
* @return boolean|array
|
||||||
|
*/
|
||||||
|
static public function parse_app_description($f, $translate = true) {
|
||||||
|
$ret = [];
|
||||||
|
$matches = [];
|
||||||
|
|
||||||
$baseurl = z_root();
|
$baseurl = z_root();
|
||||||
$channel = \App::get_channel();
|
//$channel = \App::get_channel();
|
||||||
$address = (($channel) ? $channel['channel_address'] : '');
|
//$address = (($channel) ? $channel['channel_address'] : '');
|
||||||
|
|
||||||
//future expansion
|
//future expansion
|
||||||
|
|
||||||
$observer = \App::get_observer();
|
$observer = \App::get_observer();
|
||||||
|
|
||||||
|
|
||||||
$lines = @file($f);
|
$lines = @file($f);
|
||||||
if($lines) {
|
if($lines) {
|
||||||
@ -210,7 +227,7 @@ class Apps {
|
|||||||
$ret[$matches[1]] = trim($matches[2]);
|
$ret[$matches[1]] = trim($matches[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! $ret['photo'])
|
if(! $ret['photo'])
|
||||||
$ret['photo'] = $baseurl . '/' . get_default_profile_photo(80);
|
$ret['photo'] = $baseurl . '/' . get_default_profile_photo(80);
|
||||||
@ -292,10 +309,12 @@ class Apps {
|
|||||||
if($ret) {
|
if($ret) {
|
||||||
if($translate)
|
if($translate)
|
||||||
self::translate_system_apps($ret);
|
self::translate_system_apps($ret);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static public function translate_system_apps(&$arr) {
|
static public function translate_system_apps(&$arr) {
|
||||||
@ -311,17 +330,17 @@ class Apps {
|
|||||||
'Remote Diagnostics' => t('Remote Diagnostics'),
|
'Remote Diagnostics' => t('Remote Diagnostics'),
|
||||||
'Suggest Channels' => t('Suggest Channels'),
|
'Suggest Channels' => t('Suggest Channels'),
|
||||||
'Login' => t('Login'),
|
'Login' => t('Login'),
|
||||||
'Channel Manager' => t('Channel Manager'),
|
'Channel Manager' => t('Channel Manager'),
|
||||||
'Network' => t('Stream'),
|
'Network' => t('Stream'),
|
||||||
'Settings' => t('Settings'),
|
'Settings' => t('Settings'),
|
||||||
'Files' => t('Files'),
|
'Files' => t('Files'),
|
||||||
'Webpages' => t('Webpages'),
|
'Webpages' => t('Webpages'),
|
||||||
'Wiki' => t('Wiki'),
|
'Wiki' => t('Wiki'),
|
||||||
'Channel Home' => t('Channel Home'),
|
'Channel Home' => t('Channel Home'),
|
||||||
'View Profile' => t('View Profile'),
|
'View Profile' => t('View Profile'),
|
||||||
'Photos' => t('Photos'),
|
'Photos' => t('Photos'),
|
||||||
'Events' => t('Events'),
|
'Events' => t('Events'),
|
||||||
'Directory' => t('Directory'),
|
'Directory' => t('Directory'),
|
||||||
'Help' => t('Help'),
|
'Help' => t('Help'),
|
||||||
'Mail' => t('Mail'),
|
'Mail' => t('Mail'),
|
||||||
'Mood' => t('Mood'),
|
'Mood' => t('Mood'),
|
||||||
@ -366,30 +385,31 @@ class Apps {
|
|||||||
if(array_key_exists($arr[$x]['name'],$apps)) {
|
if(array_key_exists($arr[$x]['name'],$apps)) {
|
||||||
$arr[$x]['name'] = $apps[$arr[$x]['name']];
|
$arr[$x]['name'] = $apps[$arr[$x]['name']];
|
||||||
} else {
|
} else {
|
||||||
// Try to guess by app name if not in list
|
// Try to guess by app name if not in list
|
||||||
$arr[$x]['name'] = t(trim($arr[$x]['name']));
|
$arr[$x]['name'] = t(trim($arr[$x]['name']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
// papp is a portable app
|
* @brief
|
||||||
|
*
|
||||||
static public function app_render($papp,$mode = 'view') {
|
* @param array $papp
|
||||||
|
* papp is a portable app
|
||||||
/**
|
* @param string $mode (optional) default 'view'
|
||||||
* modes:
|
* Render modes:
|
||||||
* view: normal mode for viewing an app via bbcode from a conversation or page
|
* * \b view: normal mode for viewing an app via bbcode from a conversation or page
|
||||||
* provides install/update button if you're logged in locally
|
* provides install/update button if you're logged in locally
|
||||||
* install: like view but does not display app-bin options if they are present
|
* * \b install: like view but does not display app-bin options if they are present
|
||||||
* list: normal mode for viewing an app on the app page
|
* * \b list: normal mode for viewing an app on the app page
|
||||||
* no buttons are shown
|
* no buttons are shown
|
||||||
* edit: viewing the app page in editing mode provides a delete button
|
* * \b edit: viewing the app page in editing mode provides a delete button
|
||||||
* nav: render apps for app-bin
|
* * \b nav: render apps for app-bin
|
||||||
*/
|
*
|
||||||
|
* @return void|string Parsed HTML
|
||||||
|
*/
|
||||||
|
static public function app_render($papp, $mode = 'view') {
|
||||||
$installed = false;
|
$installed = false;
|
||||||
|
|
||||||
if(! $papp)
|
if(! $papp)
|
||||||
@ -414,7 +434,7 @@ class Apps {
|
|||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
$view_channel = $sys['channel_id'];
|
$view_channel = $sys['channel_id'];
|
||||||
}
|
}
|
||||||
self::app_macros($view_channel,$papp);
|
self::app_macros($view_channel,$papp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strpos($papp['url'], ',')) {
|
if(strpos($papp['url'], ',')) {
|
||||||
@ -427,7 +447,6 @@ class Apps {
|
|||||||
$papp['url'] = z_root() . ((strpos($papp['url'],'/') === 0) ? '' : '/') . $papp['url'];
|
$papp['url'] = z_root() . ((strpos($papp['url'],'/') === 0) ? '' : '/') . $papp['url'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach($papp as $k => $v) {
|
foreach($papp as $k => $v) {
|
||||||
if(strpos($v,'http') === 0 && $k != 'papp') {
|
if(strpos($v,'http') === 0 && $k != 'papp') {
|
||||||
if(! (local_channel() && strpos($v,z_root()) === 0)) {
|
if(! (local_channel() && strpos($v,z_root()) === 0)) {
|
||||||
@ -509,7 +528,7 @@ class Apps {
|
|||||||
if($x) {
|
if($x) {
|
||||||
$hosturl = $x['scheme'] . '://' . $x['host'] . '/';
|
$hosturl = $x['scheme'] . '://' . $x['host'] . '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$install_action = (($installed) ? t('Update') : t('Install'));
|
$install_action = (($installed) ? t('Update') : t('Install'));
|
||||||
@ -592,8 +611,14 @@ class Apps {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
static public function can_delete($uid,$app) {
|
* @brief
|
||||||
|
*
|
||||||
|
* @param mixed $uid If not set return false, otherwise no influence
|
||||||
|
* @param array $app
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
static public function can_delete($uid, $app) {
|
||||||
if(! $uid) {
|
if(! $uid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -601,7 +626,7 @@ class Apps {
|
|||||||
$base_apps = self::get_base_apps();
|
$base_apps = self::get_base_apps();
|
||||||
if($base_apps) {
|
if($base_apps) {
|
||||||
foreach($base_apps as $b) {
|
foreach($base_apps as $b) {
|
||||||
if($app['guid'] === hash('whirlpool',$b)) {
|
if($app['guid'] === hash('whirlpool', $b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -613,7 +638,6 @@ class Apps {
|
|||||||
static public function app_destroy($uid,$app) {
|
static public function app_destroy($uid,$app) {
|
||||||
|
|
||||||
if($uid && $app['guid']) {
|
if($uid && $app['guid']) {
|
||||||
|
|
||||||
$x = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
|
$x = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
|
||||||
dbesc($app['guid']),
|
dbesc($app['guid']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
@ -622,7 +646,7 @@ class Apps {
|
|||||||
if(! intval($x[0]['app_deleted'])) {
|
if(! intval($x[0]['app_deleted'])) {
|
||||||
$x[0]['app_deleted'] = 1;
|
$x[0]['app_deleted'] = 1;
|
||||||
if(self::can_delete($uid,$app)) {
|
if(self::can_delete($uid,$app)) {
|
||||||
$r = q("delete from app where app_id = '%s' and app_channel = %d",
|
q("delete from app where app_id = '%s' and app_channel = %d",
|
||||||
dbesc($app['guid']),
|
dbesc($app['guid']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
@ -630,10 +654,15 @@ class Apps {
|
|||||||
intval(TERM_OBJ_APP),
|
intval(TERM_OBJ_APP),
|
||||||
intval($x[0]['id'])
|
intval($x[0]['id'])
|
||||||
);
|
);
|
||||||
|
/**
|
||||||
|
* @hooks app_destroy
|
||||||
|
* Called after app entry got removed from database
|
||||||
|
* and provide app array from database.
|
||||||
|
*/
|
||||||
call_hooks('app_destroy', $x[0]);
|
call_hooks('app_destroy', $x[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$r = q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d",
|
q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d",
|
||||||
dbesc($app['guid']),
|
dbesc($app['guid']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
@ -647,22 +676,23 @@ class Apps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function app_undestroy($uid,$app) {
|
/**
|
||||||
|
* @brief Undelete a system app.
|
||||||
// undelete a system app
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param array $app
|
||||||
|
*/
|
||||||
|
static public function app_undestroy($uid, $app) {
|
||||||
if($uid && $app['guid']) {
|
if($uid && $app['guid']) {
|
||||||
|
|
||||||
$x = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
|
$x = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
|
||||||
dbesc($app['guid']),
|
dbesc($app['guid']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if($x) {
|
if($x) {
|
||||||
if($x[0]['app_system']) {
|
if($x[0]['app_system']) {
|
||||||
$r = q("update app set app_deleted = 0 where app_id = '%s' and app_channel = %d",
|
q("update app set app_deleted = 0 where app_id = '%s' and app_channel = %d",
|
||||||
dbesc($app['guid']),
|
dbesc($app['guid']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
@ -671,7 +701,15 @@ class Apps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function app_feature($uid,$app,$term) {
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param array $app
|
||||||
|
* @param string $term
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
static public function app_feature($uid, $app, $term) {
|
||||||
$r = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
|
$r = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
|
||||||
dbesc($app['guid']),
|
dbesc($app['guid']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
@ -695,23 +733,37 @@ class Apps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function app_installed($uid,$app,$bypass_filter=false) {
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param array $app
|
||||||
|
* @param boolean $bypass_filter (optional) default false
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
static public function app_installed($uid, $app, $bypass_filter = false) {
|
||||||
|
|
||||||
$r = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
|
$r = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
|
||||||
dbesc((array_key_exists('guid',$app)) ? $app['guid'] : ''),
|
dbesc((array_key_exists('guid', $app)) ? $app['guid'] : ''),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if (!$bypass_filter) {
|
if(!$bypass_filter) {
|
||||||
$filter_arr = [
|
$filter_arr = [
|
||||||
'uid'=>$uid,
|
'uid' => $uid,
|
||||||
'app'=>$app,
|
'app' => $app,
|
||||||
'installed'=>$r
|
'installed' => $r
|
||||||
];
|
];
|
||||||
call_hooks('app_installed_filter',$filter_arr);
|
/**
|
||||||
|
* @hooks app_installed_filter
|
||||||
|
* * \e int \b uid
|
||||||
|
* * \e array \b app
|
||||||
|
* * \e mixed \b installed - return value
|
||||||
|
*/
|
||||||
|
call_hooks('app_installed_filter', $filter_arr);
|
||||||
$r = $filter_arr['installed'];
|
$r = $filter_arr['installed'];
|
||||||
}
|
}
|
||||||
return(($r) ? true : false);
|
|
||||||
|
|
||||||
|
return(($r) ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -727,11 +779,17 @@ class Apps {
|
|||||||
'app'=>$app,
|
'app'=>$app,
|
||||||
'installed'=>$r
|
'installed'=>$r
|
||||||
];
|
];
|
||||||
call_hooks('addon_app_installed_filter',$filter_arr);
|
/**
|
||||||
|
* @hooks addon_app_installed_filter
|
||||||
|
* * \e int \b uid
|
||||||
|
* * \e array \b app
|
||||||
|
* * \e mixed \b installed - return value
|
||||||
|
*/
|
||||||
|
call_hooks('addon_app_installed_filter', $filter_arr);
|
||||||
$r = $filter_arr['installed'];
|
$r = $filter_arr['installed'];
|
||||||
}
|
}
|
||||||
return(($r) ? true : false);
|
|
||||||
|
|
||||||
|
return(($r) ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function system_app_installed($uid,$app,$bypass_filter=false) {
|
static public function system_app_installed($uid,$app,$bypass_filter=false) {
|
||||||
@ -746,28 +804,39 @@ class Apps {
|
|||||||
'app'=>$app,
|
'app'=>$app,
|
||||||
'installed'=>$r
|
'installed'=>$r
|
||||||
];
|
];
|
||||||
call_hooks('system_app_installed_filter',$filter_arr);
|
/**
|
||||||
|
* @hooks system_app_installed_filter
|
||||||
|
* * \e int \b uid
|
||||||
|
* * \e array \b app
|
||||||
|
* * \e mixed \b installed - return value
|
||||||
|
*/
|
||||||
|
call_hooks('system_app_installed_filter', $filter_arr);
|
||||||
$r = $filter_arr['installed'];
|
$r = $filter_arr['installed'];
|
||||||
}
|
}
|
||||||
return(($r) ? true : false);
|
|
||||||
|
|
||||||
|
return(($r) ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param boolean $deleted
|
||||||
|
* @param array $cats
|
||||||
|
* @return boolean|array
|
||||||
|
*/
|
||||||
static public function app_list($uid, $deleted = false, $cats = []) {
|
static public function app_list($uid, $deleted = false, $cats = []) {
|
||||||
if($deleted)
|
if($deleted)
|
||||||
$sql_extra = "";
|
$sql_extra = '';
|
||||||
else
|
else
|
||||||
$sql_extra = " and app_deleted = 0 ";
|
$sql_extra = ' and app_deleted = 0 ';
|
||||||
|
|
||||||
if($cats) {
|
if($cats) {
|
||||||
|
$cat_sql_extra = ' and ( ';
|
||||||
$cat_sql_extra = " and ( ";
|
|
||||||
|
|
||||||
foreach($cats as $cat) {
|
foreach($cats as $cat) {
|
||||||
if(strpos($cat_sql_extra, 'term'))
|
if(strpos($cat_sql_extra, 'term'))
|
||||||
$cat_sql_extra .= "or ";
|
$cat_sql_extra .= 'or ';
|
||||||
|
|
||||||
$cat_sql_extra .= "term = '" . dbesc($cat) . "' ";
|
$cat_sql_extra .= "term = '" . dbesc($cat) . "' ";
|
||||||
}
|
}
|
||||||
@ -779,11 +848,13 @@ class Apps {
|
|||||||
);
|
);
|
||||||
if(! $r)
|
if(! $r)
|
||||||
return $r;
|
return $r;
|
||||||
$sql_extra .= " and app.id in ( ";
|
|
||||||
|
$sql_extra .= ' and app.id in ( ';
|
||||||
$s = '';
|
$s = '';
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
if($s)
|
if($s)
|
||||||
$s .= ',';
|
$s .= ',';
|
||||||
|
|
||||||
$s .= intval($rr['oid']);
|
$s .= intval($rr['oid']);
|
||||||
}
|
}
|
||||||
$sql_extra .= $s . ') ';
|
$sql_extra .= $s . ') ';
|
||||||
@ -794,12 +865,26 @@ class Apps {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
$hookinfo = Array('uid'=>$uid,'deleted'=>$deleted,'cats'=>$cats,'apps'=>$r);
|
$hookinfo = [
|
||||||
call_hooks('app_list',$hookinfo);
|
'uid' => $uid,
|
||||||
|
'deleted' => $deleted,
|
||||||
|
'cats' => $cats,
|
||||||
|
'apps' => $r,
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* @hooks app_list
|
||||||
|
* * \e int \b uid
|
||||||
|
* * \e boolean \b deleted
|
||||||
|
* * \e array \b cats
|
||||||
|
* * \e array \b apps - return value
|
||||||
|
*/
|
||||||
|
call_hooks('app_list', $hookinfo);
|
||||||
$r = $hookinfo['apps'];
|
$r = $hookinfo['apps'];
|
||||||
for($x = 0; $x < count($r); $x ++) {
|
|
||||||
|
for($x = 0; $x < count($r); $x++) {
|
||||||
if(! $r[$x]['app_system'])
|
if(! $r[$x]['app_system'])
|
||||||
$r[$x]['type'] = 'personal';
|
$r[$x]['type'] = 'personal';
|
||||||
|
|
||||||
$r[$x]['term'] = q("select * from term where otype = %d and oid = %d",
|
$r[$x]['term'] = q("select * from term where otype = %d and oid = %d",
|
||||||
intval(TERM_OBJ_APP),
|
intval(TERM_OBJ_APP),
|
||||||
intval($r[$x]['id'])
|
intval($r[$x]['id'])
|
||||||
@ -807,7 +892,7 @@ class Apps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return($r);
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function app_order($uid,$apps,$menu) {
|
static public function app_order($uid,$apps,$menu) {
|
||||||
@ -839,13 +924,14 @@ class Apps {
|
|||||||
$ret[] = $ap;
|
$ret[] = $ap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ret;
|
|
||||||
|
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function find_app_in_array($name,$arr) {
|
static function find_app_in_array($name,$arr) {
|
||||||
if(! $arr)
|
if(! $arr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach($arr as $x) {
|
foreach($arr as $x) {
|
||||||
if($x['name'] === $name) {
|
if($x['name'] === $name) {
|
||||||
return $x;
|
return $x;
|
||||||
@ -854,8 +940,16 @@ class Apps {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function moveup($uid,$guid,$menu) {
|
/**
|
||||||
$syslist = array();
|
* @brief
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param int $guid
|
||||||
|
* @param string $menu
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
static function moveup($uid, $guid, $menu) {
|
||||||
|
$syslist = [];
|
||||||
|
|
||||||
$conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
|
$conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
|
||||||
|
|
||||||
@ -865,6 +959,7 @@ class Apps {
|
|||||||
$papp = self::app_encode($li);
|
$papp = self::app_encode($li);
|
||||||
if($menu !== 'nav_pinned_app' && strpos($papp['categories'],'nav_pinned_app') !== false)
|
if($menu !== 'nav_pinned_app' && strpos($papp['categories'],'nav_pinned_app') !== false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$syslist[] = $papp;
|
$syslist[] = $papp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,8 +972,6 @@ class Apps {
|
|||||||
if(! $syslist)
|
if(! $syslist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$newlist = [];
|
|
||||||
|
|
||||||
foreach($syslist as $k => $li) {
|
foreach($syslist as $k => $li) {
|
||||||
if($li['guid'] === $guid) {
|
if($li['guid'] === $guid) {
|
||||||
$position = $k;
|
$position = $k;
|
||||||
@ -887,6 +980,7 @@ class Apps {
|
|||||||
}
|
}
|
||||||
if(! $position)
|
if(! $position)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$dest_position = $position - 1;
|
$dest_position = $position - 1;
|
||||||
$saved = $syslist[$dest_position];
|
$saved = $syslist[$dest_position];
|
||||||
$syslist[$dest_position] = $syslist[$position];
|
$syslist[$dest_position] = $syslist[$position];
|
||||||
@ -898,11 +992,18 @@ class Apps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_pconfig($uid,'system',$conf,implode(',',$narr));
|
set_pconfig($uid,'system',$conf,implode(',',$narr));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function movedown($uid,$guid,$menu) {
|
/**
|
||||||
$syslist = array();
|
* @brief
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param int $guid
|
||||||
|
* @param string $menu
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
static function movedown($uid, $guid, $menu) {
|
||||||
|
$syslist = [];
|
||||||
|
|
||||||
$conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
|
$conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
|
||||||
|
|
||||||
@ -912,6 +1013,7 @@ class Apps {
|
|||||||
$papp = self::app_encode($li);
|
$papp = self::app_encode($li);
|
||||||
if($menu !== 'nav_pinned_app' && strpos($papp['categories'],'nav_pinned_app') !== false)
|
if($menu !== 'nav_pinned_app' && strpos($papp['categories'],'nav_pinned_app') !== false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$syslist[] = $papp;
|
$syslist[] = $papp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -924,8 +1026,6 @@ class Apps {
|
|||||||
if(! $syslist)
|
if(! $syslist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$newlist = [];
|
|
||||||
|
|
||||||
foreach($syslist as $k => $li) {
|
foreach($syslist as $k => $li) {
|
||||||
if($li['guid'] === $guid) {
|
if($li['guid'] === $guid) {
|
||||||
$position = $k;
|
$position = $k;
|
||||||
@ -934,6 +1034,7 @@ class Apps {
|
|||||||
}
|
}
|
||||||
if($position >= count($syslist) - 1)
|
if($position >= count($syslist) - 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$dest_position = $position + 1;
|
$dest_position = $position + 1;
|
||||||
$saved = $syslist[$dest_position];
|
$saved = $syslist[$dest_position];
|
||||||
$syslist[$dest_position] = $syslist[$position];
|
$syslist[$dest_position] = $syslist[$position];
|
||||||
@ -945,7 +1046,6 @@ class Apps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_pconfig($uid,'system',$conf,implode(',',$narr));
|
set_pconfig($uid,'system',$conf,implode(',',$narr));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function app_decode($s) {
|
static public function app_decode($s) {
|
||||||
@ -953,8 +1053,14 @@ class Apps {
|
|||||||
return json_decode($x,true);
|
return json_decode($x,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
static public function app_macros($uid,&$arr) {
|
* @brief
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param[in,out] array $arr
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
static public function app_macros($uid, &$arr) {
|
||||||
|
|
||||||
if(! intval($uid))
|
if(! intval($uid))
|
||||||
return;
|
return;
|
||||||
@ -962,21 +1068,17 @@ class Apps {
|
|||||||
$baseurl = z_root();
|
$baseurl = z_root();
|
||||||
$channel = channelx_by_n($uid);
|
$channel = channelx_by_n($uid);
|
||||||
$address = (($channel) ? $channel['channel_address'] : '');
|
$address = (($channel) ? $channel['channel_address'] : '');
|
||||||
|
|
||||||
//future expansion
|
//future expansion
|
||||||
|
|
||||||
$observer = \App::get_observer();
|
//$observer = \App::get_observer();
|
||||||
|
|
||||||
$arr['url'] = str_replace(array('$baseurl','$nick'),array($baseurl,$address),$arr['url']);
|
$arr['url'] = str_replace(array('$baseurl','$nick'),array($baseurl,$address),$arr['url']);
|
||||||
$arr['photo'] = str_replace(array('$baseurl','$nick'),array($baseurl,$address),$arr['photo']);
|
$arr['photo'] = str_replace(array('$baseurl','$nick'),array($baseurl,$address),$arr['photo']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static public function app_store($arr) {
|
static public function app_store($arr) {
|
||||||
|
|
||||||
//logger('app_store: ' . print_r($arr,true));
|
//logger('app_store: ' . print_r($arr,true));
|
||||||
@ -1160,16 +1262,20 @@ class Apps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
static public function app_encode($app,$embed = false) {
|
* @brief
|
||||||
|
*
|
||||||
$ret = array();
|
* @param array $app
|
||||||
|
* @param boolean $embed (optional) default false
|
||||||
|
* @return array|string
|
||||||
|
*/
|
||||||
|
static public function app_encode($app, $embed = false) {
|
||||||
|
$ret = [];
|
||||||
|
|
||||||
$ret['type'] = 'personal';
|
$ret['type'] = 'personal';
|
||||||
|
|
||||||
if($app['app_id'])
|
if($app['app_id'])
|
||||||
$ret['guid'] = $app['app_id'];
|
$ret['guid'] = $app['app_id'];
|
||||||
|
|
||||||
@ -1202,7 +1308,7 @@ class Apps {
|
|||||||
|
|
||||||
if($app['app_price'])
|
if($app['app_price'])
|
||||||
$ret['price'] = $app['app_price'];
|
$ret['price'] = $app['app_price'];
|
||||||
|
|
||||||
if($app['app_page'])
|
if($app['app_page'])
|
||||||
$ret['page'] = $app['app_page'];
|
$ret['page'] = $app['app_page'];
|
||||||
|
|
||||||
@ -1226,12 +1332,12 @@ class Apps {
|
|||||||
foreach($app['term'] as $t) {
|
foreach($app['term'] as $t) {
|
||||||
if($s)
|
if($s)
|
||||||
$s .= ',';
|
$s .= ',';
|
||||||
|
|
||||||
$s .= $t['term'];
|
$s .= $t['term'];
|
||||||
}
|
}
|
||||||
$ret['categories'] = $s;
|
$ret['categories'] = $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(! $embed)
|
if(! $embed)
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
@ -1239,18 +1345,15 @@ class Apps {
|
|||||||
|
|
||||||
if(array_key_exists('categories',$ret))
|
if(array_key_exists('categories',$ret))
|
||||||
unset($ret['categories']);
|
unset($ret['categories']);
|
||||||
|
|
||||||
$j = json_encode($ret);
|
|
||||||
return '[app]' . chunk_split(base64_encode($j),72,"\n") . '[/app]';
|
|
||||||
|
|
||||||
|
$j = json_encode($ret);
|
||||||
|
|
||||||
|
return '[app]' . chunk_split(base64_encode($j),72,"\n") . '[/app]';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static public function papp_encode($papp) {
|
static public function papp_encode($papp) {
|
||||||
return chunk_split(base64_encode(json_encode($papp)),72,"\n");
|
return chunk_split(base64_encode(json_encode($papp)),72,"\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,28 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Zotlabs\Module; /** @file */
|
namespace Zotlabs\Module;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Zotlabs\Web\Controller;
|
use Zotlabs\Web\Controller;
|
||||||
use Zotlabs\Lib\Apps;
|
use Zotlabs\Lib\Apps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Notes Module controller.
|
||||||
|
*/
|
||||||
class Notes extends Controller {
|
class Notes extends Controller {
|
||||||
|
|
||||||
function post() {
|
function post() {
|
||||||
|
|
||||||
if(! local_channel())
|
if(! local_channel())
|
||||||
return EMPTY_STR;
|
return EMPTY_STR;
|
||||||
|
|
||||||
if(! Apps::system_app_installed(local_channel(), 'Notes'))
|
if(! Apps::system_app_installed(local_channel(), 'Notes'))
|
||||||
return EMPTY_STR;
|
return EMPTY_STR;
|
||||||
|
|
||||||
$ret = array('success' => true);
|
$ret = array('success' => true);
|
||||||
if(array_key_exists('note_text',$_REQUEST)) {
|
if(array_key_exists('note_text',$_REQUEST)) {
|
||||||
$body = escape_tags($_REQUEST['note_text']);
|
$body = escape_tags($_REQUEST['note_text']);
|
||||||
|
|
||||||
// I've had my notes vanish into thin air twice in four years.
|
// I've had my notes vanish into thin air twice in four years.
|
||||||
// Provide a backup copy if there were contents previously
|
// Provide a backup copy if there were contents previously
|
||||||
// and there are none being saved now.
|
// and there are none being saved now.
|
||||||
|
|
||||||
if(! $body) {
|
if(! $body) {
|
||||||
$old_text = get_pconfig(local_channel(),'notes','text');
|
$old_text = get_pconfig(local_channel(),'notes','text');
|
||||||
if($old_text)
|
if($old_text)
|
||||||
@ -40,11 +43,9 @@ class Notes extends Controller {
|
|||||||
|
|
||||||
logger('notes saved.', LOGGER_DEBUG);
|
logger('notes saved.', LOGGER_DEBUG);
|
||||||
json_return_and_die($ret);
|
json_return_and_die($ret);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
|
|
||||||
if(! local_channel())
|
if(! local_channel())
|
||||||
return EMPTY_STR;
|
return EMPTY_STR;
|
||||||
|
|
||||||
@ -61,7 +62,6 @@ class Notes extends Controller {
|
|||||||
$arr = ['app' => true];
|
$arr = ['app' => true];
|
||||||
|
|
||||||
return $w->widget($arr);
|
return $w->widget($arr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@ function findpeople_widget() {
|
|||||||
if(get_config('system','invitation_only')) {
|
if(get_config('system','invitation_only')) {
|
||||||
$x = get_pconfig(local_channel(),'system','invites_remaining');
|
$x = get_pconfig(local_channel(),'system','invites_remaining');
|
||||||
if($x || is_site_admin()) {
|
if($x || is_site_admin()) {
|
||||||
App::$page['aside'] .= '<div class="side-link" id="side-invite-remain">'
|
App::$page['aside'] .= '<div class="side-link" id="side-invite-remain">'
|
||||||
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
|
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
|
||||||
. '</div>' . $inv;
|
. '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$advanced_search = ((local_channel() && feature_enabled(local_channel(),'advanced_dirsearch')) ? t('Advanced') : false);
|
$advanced_search = ((local_channel() && feature_enabled(local_channel(),'advanced_dirsearch')) ? t('Advanced') : false);
|
||||||
|
|
||||||
return replace_macros(get_markup_template('peoplefind.tpl'),array(
|
return replace_macros(get_markup_template('peoplefind.tpl'),array(
|
||||||
'$findpeople' => t('Find Channels'),
|
'$findpeople' => t('Find Channels'),
|
||||||
'$desc' => t('Enter name or interest'),
|
'$desc' => t('Enter name or interest'),
|
||||||
@ -22,7 +22,7 @@ function findpeople_widget() {
|
|||||||
'$hint' => t('Examples: Robert Morgenstein, Fishing'),
|
'$hint' => t('Examples: Robert Morgenstein, Fishing'),
|
||||||
'$findthem' => t('Find'),
|
'$findthem' => t('Find'),
|
||||||
'$suggest' => t('Channel Suggestions'),
|
'$suggest' => t('Channel Suggestions'),
|
||||||
'$similar' => '', // FIXME and uncomment when mod/match working // t('Similar Interests'),
|
'$similar' => '', /// @FIXME fixme and uncomment when mod/match working // t('Similar Interests'),
|
||||||
'$random' => t('Random Profile'),
|
'$random' => t('Random Profile'),
|
||||||
'$inv' => t('Invite Friends'),
|
'$inv' => t('Invite Friends'),
|
||||||
'$advanced_search' => $advanced_search,
|
'$advanced_search' => $advanced_search,
|
||||||
@ -56,12 +56,11 @@ function fileas_widget($baseurl,$selected = '') {
|
|||||||
'$all' => t('Everything'),
|
'$all' => t('Everything'),
|
||||||
'$terms' => $terms,
|
'$terms' => $terms,
|
||||||
'$base' => $baseurl,
|
'$base' => $baseurl,
|
||||||
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function categories_widget($baseurl,$selected = '') {
|
function categories_widget($baseurl,$selected = '') {
|
||||||
|
|
||||||
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
|
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
@ -100,14 +99,13 @@ function categories_widget($baseurl,$selected = '') {
|
|||||||
'$all' => t('Everything'),
|
'$all' => t('Everything'),
|
||||||
'$terms' => $terms,
|
'$terms' => $terms,
|
||||||
'$base' => $baseurl,
|
'$base' => $baseurl,
|
||||||
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function cardcategories_widget($baseurl,$selected = '') {
|
function cardcategories_widget($baseurl,$selected = '') {
|
||||||
|
|
||||||
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
|
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
@ -128,7 +126,7 @@ function cardcategories_widget($baseurl,$selected = '') {
|
|||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra
|
$sql_extra
|
||||||
order by term.term asc",
|
order by term.term asc",
|
||||||
intval(App::$profile['profile_uid']),
|
intval(App::$profile['profile_uid']),
|
||||||
intval(TERM_CATEGORY),
|
intval(TERM_CATEGORY),
|
||||||
intval(TERM_OBJ_POST),
|
intval(TERM_OBJ_POST),
|
||||||
dbesc(App::$profile['channel_hash'])
|
dbesc(App::$profile['channel_hash'])
|
||||||
@ -144,15 +142,15 @@ function cardcategories_widget($baseurl,$selected = '') {
|
|||||||
'$all' => t('Everything'),
|
'$all' => t('Everything'),
|
||||||
'$terms' => $terms,
|
'$terms' => $terms,
|
||||||
'$base' => $baseurl,
|
'$base' => $baseurl,
|
||||||
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function articlecategories_widget($baseurl,$selected = '') {
|
function articlecategories_widget($baseurl,$selected = '') {
|
||||||
|
|
||||||
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
|
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
@ -173,7 +171,7 @@ function articlecategories_widget($baseurl,$selected = '') {
|
|||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra
|
$sql_extra
|
||||||
order by term.term asc",
|
order by term.term asc",
|
||||||
intval(App::$profile['profile_uid']),
|
intval(App::$profile['profile_uid']),
|
||||||
intval(TERM_CATEGORY),
|
intval(TERM_CATEGORY),
|
||||||
intval(TERM_OBJ_POST),
|
intval(TERM_OBJ_POST),
|
||||||
dbesc(App::$profile['channel_hash'])
|
dbesc(App::$profile['channel_hash'])
|
||||||
@ -189,17 +187,14 @@ function articlecategories_widget($baseurl,$selected = '') {
|
|||||||
'$all' => t('Everything'),
|
'$all' => t('Everything'),
|
||||||
'$terms' => $terms,
|
'$terms' => $terms,
|
||||||
'$base' => $baseurl,
|
'$base' => $baseurl,
|
||||||
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function common_friends_visitor_widget($profile_uid,$cnt = 25) {
|
function common_friends_visitor_widget($profile_uid,$cnt = 25) {
|
||||||
|
|
||||||
if(local_channel() == $profile_uid)
|
if(local_channel() == $profile_uid)
|
||||||
@ -218,17 +213,14 @@ function common_friends_visitor_widget($profile_uid,$cnt = 25) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
$r = common_friends($profile_uid,$observer_hash,0,$cnt,true);
|
$r = common_friends($profile_uid,$observer_hash,0,$cnt,true);
|
||||||
|
|
||||||
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
return replace_macros(get_markup_template('remote_friends_common.tpl'), [
|
||||||
'$desc' => t('Common Connections'),
|
'$desc' => t('Common Connections'),
|
||||||
'$base' => z_root(),
|
'$base' => z_root(),
|
||||||
'$uid' => $profile_uid,
|
'$uid' => $profile_uid,
|
||||||
'$cid' => $observer,
|
|
||||||
'$linkmore' => (($t > $cnt) ? 'true' : ''),
|
'$linkmore' => (($t > $cnt) ? 'true' : ''),
|
||||||
'$more' => sprintf( t('View all %d common connections'), $t),
|
'$more' => sprintf( t('View all %d common connections'), $t),
|
||||||
'$items' => $r
|
'$items' => $r,
|
||||||
));
|
]);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,10 +7,9 @@
|
|||||||
<div class="contact-block-content">
|
<div class="contact-block-content">
|
||||||
{{foreach $items as $item}}
|
{{foreach $items as $item}}
|
||||||
<div class="contact-block-div">
|
<div class="contact-block-div">
|
||||||
<a class="contact-block-link mpfriend" href="{{$base}}/chanview?f=&url={{$item.xchan_url}}"><img class="contact-block-img mpfriend" src="{{$item.xchan_photo_s}}"alt="{{$item.xchan_name}}" title="{{$item.xchan_name}} [{{$item.xchan_addr}}]" /></a>
|
<a class="contact-block-link mpfriend" href="{{$base}}/chanview?f=&url={{$item.xchan_url}}"><img class="contact-block-img mpfriend" src="{{$item.xchan_photo_s}}" alt="{{$item.xchan_name}}" title="{{$item.xchan_name}} [{{$item.xchan_addr}}]" /></a>
|
||||||
</div>
|
</div>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user