Merge remote-tracking branch 'friendica/master' into randomerror
This commit is contained in:
commit
b71a3af457
95 changed files with 4753 additions and 2319 deletions
|
@ -16,6 +16,8 @@ function acl_init(&$a){
|
|||
if ($search!=""){
|
||||
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
|
||||
$sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
|
||||
} else {
|
||||
$sql_extra = $sql_extra2 = "";
|
||||
}
|
||||
|
||||
// count groups and contacts
|
||||
|
@ -75,7 +77,7 @@ function acl_init(&$a){
|
|||
|
||||
if ($type=='' || $type=='c'){
|
||||
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url` FROM `contact`
|
||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
|
||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
|
||||
$sql_extra2
|
||||
ORDER BY `name` ASC ",
|
||||
|
|
181
mod/admin.php
181
mod/admin.php
|
@ -6,14 +6,19 @@
|
|||
require_once("include/remoteupdate.php");
|
||||
|
||||
function admin_post(&$a){
|
||||
|
||||
|
||||
if(!is_site_admin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// do not allow a page manager to access the admin panel at all.
|
||||
|
||||
if(x($_SESSION,'submanage') && intval($_SESSION['submanage']))
|
||||
return;
|
||||
|
||||
|
||||
|
||||
// urls
|
||||
if ($a->argc > 1){
|
||||
switch ($a->argv[1]){
|
||||
|
@ -66,6 +71,7 @@ function admin_content(&$a) {
|
|||
'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"),
|
||||
'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"),
|
||||
'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"),
|
||||
'themes' => Array($a->get_baseurl()."/admin/themes/", t("Themes") , "themes"),
|
||||
'update' => Array($a->get_baseurl()."/admin/update/", t("Update") , "update")
|
||||
);
|
||||
|
||||
|
@ -108,6 +114,9 @@ function admin_content(&$a) {
|
|||
case 'plugins':
|
||||
$o = admin_page_plugins($a);
|
||||
break;
|
||||
case 'themes':
|
||||
$o = admin_page_themes($a);
|
||||
break;
|
||||
case 'logs':
|
||||
$o = admin_page_logs($a);
|
||||
break;
|
||||
|
@ -564,7 +573,7 @@ function admin_page_plugins(&$a){
|
|||
'$info' => get_plugin_info($plugin),
|
||||
|
||||
'$admin_form' => $admin_form,
|
||||
|
||||
'$function' => 'plugins',
|
||||
'$readme' => $readme
|
||||
));
|
||||
}
|
||||
|
@ -593,11 +602,179 @@ function admin_page_plugins(&$a){
|
|||
'$page' => t('Plugins'),
|
||||
'$submit' => t('Submit'),
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
|
||||
'$function' => 'plugins',
|
||||
'$plugins' => $plugins
|
||||
));
|
||||
}
|
||||
|
||||
function toggle_theme(&$themes,$th,&$result) {
|
||||
for($x = 0; $x < count($themes); $x ++) {
|
||||
if($themes[$x]['name'] === $th) {
|
||||
if($themes[$x]['allowed']) {
|
||||
$themes[$x]['allowed'] = 0;
|
||||
$result = 0;
|
||||
}
|
||||
else {
|
||||
$themes[$x]['allowed'] = 1;
|
||||
$result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function theme_status($themes,$th) {
|
||||
for($x = 0; $x < count($themes); $x ++) {
|
||||
if($themes[$x]['name'] === $th) {
|
||||
if($themes[$x]['allowed']) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function rebuild_theme_table($themes) {
|
||||
$o = '';
|
||||
if(count($themes)) {
|
||||
foreach($themes as $th) {
|
||||
if($th['allowed']) {
|
||||
if(strlen($o))
|
||||
$o .= ',';
|
||||
$o .= $th['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Themes admin page
|
||||
*/
|
||||
|
||||
function admin_page_themes(&$a){
|
||||
|
||||
$allowed_themes_str = get_config('system','allowed_themes');
|
||||
$allowed_themes_raw = explode(',',$allowed_themes_str);
|
||||
$allowed_themes = array();
|
||||
if(count($allowed_themes_raw))
|
||||
foreach($allowed_themes_raw as $x)
|
||||
if(strlen(trim($x)))
|
||||
$allowed_themes[] = trim($x);
|
||||
|
||||
$themes = array();
|
||||
$files = glob('view/theme/*');
|
||||
if($files) {
|
||||
foreach($files as $file) {
|
||||
$f = basename($file);
|
||||
$is_experimental = intval(file_exists($file . '/experimental'));
|
||||
$is_unsupported = 1-(intval(file_exists($file . '/unsupported')));
|
||||
$is_allowed = intval(in_array($f,$allowed_themes));
|
||||
$themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
|
||||
}
|
||||
}
|
||||
|
||||
if(! count($themes)) {
|
||||
notice( t('No themes found.'));
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Single theme
|
||||
*/
|
||||
|
||||
if ($a->argc == 3){
|
||||
$theme = $a->argv[2];
|
||||
if(! is_dir("view/theme/$theme")){
|
||||
notice( t("Item not found.") );
|
||||
return;
|
||||
}
|
||||
|
||||
if (x($_GET,"a") && $_GET['a']=="t"){
|
||||
|
||||
// Toggle theme status
|
||||
|
||||
toggle_theme($themes,$theme,$result);
|
||||
$s = rebuild_theme_table($themes);
|
||||
if($result)
|
||||
info( sprintf('Theme %s enabled.',$theme));
|
||||
else
|
||||
info( sprintf('Theme %s disabled.',$theme));
|
||||
|
||||
set_config('system','allowed_themes',$s);
|
||||
goaway($a->get_baseurl() . '/admin/themes' );
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
// display theme details
|
||||
require_once('library/markdown.php');
|
||||
|
||||
if (theme_status($themes,$theme)) {
|
||||
$status="on"; $action= t("Disable");
|
||||
} else {
|
||||
$status="off"; $action= t("Enable");
|
||||
}
|
||||
|
||||
$readme=Null;
|
||||
if (is_file("view/$theme/README.md")){
|
||||
$readme = file_get_contents("view/$theme/README.md");
|
||||
$readme = Markdown($readme);
|
||||
} else if (is_file("view/$theme/README")){
|
||||
$readme = "<pre>". file_get_contents("view/$theme/README") ."</pre>";
|
||||
}
|
||||
|
||||
$admin_form="";
|
||||
|
||||
$t = get_markup_template("admin_plugins_details.tpl");
|
||||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Themes'),
|
||||
'$toggle' => t('Toggle'),
|
||||
'$settings' => t('Settings'),
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
|
||||
'$plugin' => $theme,
|
||||
'$status' => $status,
|
||||
'$action' => $action,
|
||||
'$info' => get_theme_info($theme),
|
||||
'$function' => 'themes',
|
||||
'$admin_form' => $admin_form,
|
||||
|
||||
'$readme' => $readme
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* List plugins
|
||||
*/
|
||||
|
||||
$xthemes = array();
|
||||
if($themes) {
|
||||
foreach($themes as $th) {
|
||||
$xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
|
||||
}
|
||||
}
|
||||
|
||||
$t = get_markup_template("admin_plugins.tpl");
|
||||
return replace_macros($t, array(
|
||||
'$title' => t('Administration'),
|
||||
'$page' => t('Themes'),
|
||||
'$submit' => t('Submit'),
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$function' => 'themes',
|
||||
'$plugins' => $xthemes,
|
||||
'$experimental' => t('[Experimental]'),
|
||||
'$unsupported' => t('[Unsupported]')
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logs admin page
|
||||
|
|
|
@ -504,8 +504,9 @@ function contacts_content(&$a) {
|
|||
'name' => $rr['name'],
|
||||
'username' => $rr['name'],
|
||||
'sparkle' => $sparkle,
|
||||
'itemurl' => $rr['url'],
|
||||
'url' => $url,
|
||||
'item' => $rr,
|
||||
'network' => network_to_name($rr['network']),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
*
|
||||
*/
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE ( ( `issued-id` != '' AND `issued-id` = '%s' ) OR ( `id` = %d AND `id` != 0 ) ) AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM `contact` WHERE ( ( `issued-id` != '' AND `issued-id` = '%s' ) OR ( `id` = %d AND `id` != 0 ) ) AND `uid` = %d AND `duplex` = 0 LIMIT 1",
|
||||
dbesc($dfrn_id),
|
||||
intval($cid),
|
||||
intval($uid)
|
||||
|
@ -116,6 +116,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
if(! count($r)) {
|
||||
logger('dfrn_confirm: Contact not found in DB.');
|
||||
notice( t('Contact not found.') . EOL );
|
||||
notice( t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -631,6 +632,15 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
xml_status(3,$message);
|
||||
}
|
||||
|
||||
// It's possible that the other person also requested friendship.
|
||||
// If it is a duplex relationship, ditch the issued-id if one exists.
|
||||
|
||||
if($duplex) {
|
||||
$r = q("UPDATE `contact` SET `issued-id` = '' WHERE `id` = %d LIMIT 1",
|
||||
intval($dfrn_record)
|
||||
);
|
||||
}
|
||||
|
||||
// We're good but now we have to scrape the profile photo and send notifications.
|
||||
|
||||
|
||||
|
|
|
@ -74,11 +74,11 @@ function display_content(&$a) {
|
|||
$x = array(
|
||||
'is_owner' => true,
|
||||
'allow_location' => $a->user['allow_location'],
|
||||
'default_location' => $a->user['default_location'],
|
||||
'default_location' => $a->user['default-location'],
|
||||
'nickname' => $a->user['nickname'],
|
||||
'lockstate' => ((($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
|
||||
'acl' => populate_acl((($group || $cid) ? $def_acl : $a->user), $celeb),
|
||||
'bang' => (($group || $cid) ? '!' : ''),
|
||||
'lockstate' => ( (is_array($a->user)) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'),
|
||||
'acl' => populate_acl($a->user, $celeb),
|
||||
'bang' => '',
|
||||
'visitor' => 'block',
|
||||
'profile_uid' => local_user()
|
||||
);
|
||||
|
|
|
@ -49,6 +49,11 @@ function follow_init(&$a) {
|
|||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
}
|
||||
|
||||
// This just confuses things, remove it
|
||||
if($ret['network'] === NETWORK_DIASPORA)
|
||||
$ret['url'] = str_replace('?absolute=true','',$ret['url']);
|
||||
|
||||
|
||||
// do we have enough information?
|
||||
|
||||
|
|
|
@ -400,6 +400,8 @@ function item_post(&$a) {
|
|||
|
||||
$body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body);
|
||||
|
||||
$body = scale_external_images($body,false);
|
||||
|
||||
/**
|
||||
* Look for any tags and linkify them
|
||||
*/
|
||||
|
@ -753,7 +755,8 @@ function item_post(&$a) {
|
|||
'source_link' => $datarray['author-link'],
|
||||
'source_photo' => $datarray['author-avatar'],
|
||||
'verb' => ACTIVITY_POST,
|
||||
'otype' => 'item'
|
||||
'otype' => 'item',
|
||||
'parent' => $parent,
|
||||
));
|
||||
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ function network_content(&$a, $update = 0) {
|
|||
$x = array(
|
||||
'is_owner' => true,
|
||||
'allow_location' => $a->user['allow_location'],
|
||||
'default_location' => $a->user['default_location'],
|
||||
'default_location' => $a->user['default-location'],
|
||||
'nickname' => $a->user['nickname'],
|
||||
'lockstate' => ((($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
|
||||
'acl' => populate_acl((($group || $cid) ? $def_acl : $a->user), $celeb),
|
||||
|
|
|
@ -295,7 +295,7 @@ function notifications_content(&$a) {
|
|||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl,array(
|
||||
'$notif_header' => t('Notifications'),
|
||||
'$notif_header' => t('Network Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
@ -325,7 +325,7 @@ function notifications_content(&$a) {
|
|||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl,array(
|
||||
'$notif_header' => t('System'),
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
@ -420,7 +420,7 @@ function notifications_content(&$a) {
|
|||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl,array(
|
||||
'$notif_header' => t('Notifications'),
|
||||
'$notif_header' => t('Personal Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
@ -501,7 +501,7 @@ function notifications_content(&$a) {
|
|||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl,array(
|
||||
'$notif_header' => t('Notifications'),
|
||||
'$notif_header' => t('Home Notifications'),
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
|
|
@ -36,4 +36,36 @@ function notify_init(&$a) {
|
|||
function notify_content(&$a) {
|
||||
if(! local_user())
|
||||
return login();
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
$not_tpl = get_markup_template('notify.tpl');
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
if (count($r) > 0) {
|
||||
foreach ($r as $it) {
|
||||
$notif_content .= replace_macros($not_tpl,array(
|
||||
'$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'],
|
||||
'$item_image' => $it['photo'],
|
||||
'$item_text' => strip_tags(bbcode($it['msg'])),
|
||||
'$item_when' => relative_date($it['date'])
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$notif_content .= t('No more system notifications.');
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl,array(
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$tabs' => '', // $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
|
||||
}
|
|
@ -119,7 +119,7 @@ function photo_init(&$a) {
|
|||
// NOTREACHED
|
||||
}
|
||||
|
||||
if(intval($customres) && $customres > 0 && $customres < 500) {
|
||||
if(isset($customres) && $customres > 0 && $customres < 500) {
|
||||
require_once('include/Photo.php');
|
||||
$ph = new Photo($data);
|
||||
if($ph->is_valid()) {
|
||||
|
|
272
mod/ping.php
272
mod/ping.php
|
@ -12,92 +12,70 @@ function ping_init(&$a) {
|
|||
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||
if(local_user()){
|
||||
|
||||
$z = q("select * from notify where seen = 0 and uid = %d
|
||||
order by date desc",
|
||||
$firehose = intval(get_pconfig(local_user(),'system','notify_full'));
|
||||
|
||||
$z = q("select * from notify where uid = %d
|
||||
order by seen asc, date desc limit 0, 50",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
|
||||
|
||||
$tags = array();
|
||||
$comments = array();
|
||||
$likes = array();
|
||||
$dislikes = array();
|
||||
$friends = array();
|
||||
$posts = array();
|
||||
|
||||
$home = 0;
|
||||
$network = 0;
|
||||
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
|
||||
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`
|
||||
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
|
||||
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
|
||||
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0
|
||||
`item`.`deleted` = 0 AND `item`.`uid` = %d
|
||||
ORDER BY `item`.`created` DESC",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
$network = count($r);
|
||||
foreach ($r as $it) {
|
||||
switch($it['verb']){
|
||||
case ACTIVITY_TAG:
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['tname'] = $obj->content;
|
||||
$tags[] = $it;
|
||||
break;
|
||||
case ACTIVITY_LIKE:
|
||||
$likes[] = $it;
|
||||
break;
|
||||
case ACTIVITY_DISLIKE:
|
||||
$dislikes[] = $it;
|
||||
break;
|
||||
case ACTIVITY_FRIEND:
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['fname'] = $obj->title;
|
||||
$friends[] = $it;
|
||||
break;
|
||||
default:
|
||||
if ($it['parent']!=$it['id']) {
|
||||
$comments[] = $it;
|
||||
} else {
|
||||
$posts[] = $it;
|
||||
}
|
||||
|
||||
if(count($r)) {
|
||||
|
||||
foreach ($r as $it) {
|
||||
|
||||
if($it['wall'])
|
||||
$home ++;
|
||||
else
|
||||
$network ++;
|
||||
|
||||
switch($it['verb']){
|
||||
case ACTIVITY_TAG:
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['tname'] = $obj->content;
|
||||
$tags[] = $it;
|
||||
break;
|
||||
case ACTIVITY_LIKE:
|
||||
$likes[] = $it;
|
||||
break;
|
||||
case ACTIVITY_DISLIKE:
|
||||
$dislikes[] = $it;
|
||||
break;
|
||||
case ACTIVITY_FRIEND:
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['fname'] = $obj->title;
|
||||
$friends[] = $it;
|
||||
break;
|
||||
default:
|
||||
if ($it['parent']!=$it['id']) {
|
||||
$comments[] = $it;
|
||||
} else {
|
||||
if(! $it['wall'])
|
||||
$posts[] = $it;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
|
||||
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`
|
||||
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
|
||||
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
|
||||
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1",
|
||||
intval(local_user())
|
||||
);
|
||||
$home = count($r);
|
||||
foreach ($r as $it) {
|
||||
switch($it['verb']){
|
||||
case ACTIVITY_TAG:
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['tname'] = $obj->content;
|
||||
$tags[] = $it;
|
||||
break;
|
||||
case ACTIVITY_LIKE:
|
||||
$likes[] = $it;
|
||||
break;
|
||||
case ACTIVITY_DISLIKE:
|
||||
$dislikes[] = $it;
|
||||
break;
|
||||
case ACTIVITY_FRIEND:
|
||||
$obj = parse_xml_string($xmlhead.$it['object']);
|
||||
$it['fname'] = $obj->title;
|
||||
$friends[] = $it;
|
||||
break;
|
||||
default:
|
||||
if ($it['parent']!=$it['id']) $comments[] = $it;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`,
|
||||
`fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo`
|
||||
FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
|
||||
|
@ -122,24 +100,25 @@ function ping_init(&$a) {
|
|||
intval(local_user()),
|
||||
dbesc($myurl)
|
||||
);
|
||||
$mail = $mails[0]['total'];
|
||||
if($mails)
|
||||
$mail = $mails[0]['total'];
|
||||
|
||||
if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()){
|
||||
$regs = q("SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) as `total` FROM `contact` RIGHT JOIN `register` ON `register`.`uid`=`contact`.`uid` WHERE `contact`.`self`=1");
|
||||
$register = $regs[0]['total'];
|
||||
if($regs)
|
||||
$register = $regs[0]['total'];
|
||||
} else {
|
||||
$register = "0";
|
||||
}
|
||||
|
||||
|
||||
function xmlize($href, $name, $url, $photo, $date, $message){
|
||||
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s">%s</note>';
|
||||
function xmlize($href, $name, $url, $photo, $date, $seen, $message){
|
||||
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" >%s</note>';
|
||||
return sprintf ( $notsxml,
|
||||
xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($message)
|
||||
);
|
||||
xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($seen), xmlify($message)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
echo "<intro>$intro</intro>
|
||||
<mail>$mail</mail>
|
||||
<net>$network</net>
|
||||
|
@ -147,95 +126,100 @@ function ping_init(&$a) {
|
|||
if ($register!=0) echo "<register>$register</register>";
|
||||
|
||||
$tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags);
|
||||
|
||||
echo ' <notif count="'.$tot.'">';
|
||||
|
||||
require_once('include/bbcode.php');
|
||||
$sysnotify = 0;
|
||||
|
||||
if(count($z)) {
|
||||
foreach($z as $zz) {
|
||||
echo xmlize($a->get_baseurl() . '/notify/' . $zz['id'], $zz['name'],$zz['url'],$zz['photo'],relative_date($zz['date']), bbcode($zz['msg']));
|
||||
if($firehose) {
|
||||
echo ' <notif count="'.$tot.'">';
|
||||
}
|
||||
else {
|
||||
if(count($z)) {
|
||||
foreach($z as $zz) {
|
||||
if($zz['seen'] == 0)
|
||||
$sysnotify ++;
|
||||
}
|
||||
}
|
||||
|
||||
echo ' <notif count="'. $sysnotify .'">';
|
||||
if(count($z)) {
|
||||
foreach($z as $zz) {
|
||||
echo xmlize($a->get_baseurl() . '/notify/view/' . $zz['id'], $zz['name'],$zz['url'],$zz['photo'],relative_date($zz['date']), ($zz['seen'] ? 'notify-seen' : 'notify-unseen'), ($zz['seen'] ? '' : '→ ') .strip_tags(bbcode($zz['msg'])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($firehose) {
|
||||
if ($intro>0){
|
||||
foreach ($intros as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), 'notify-unseen',t("{0} wants to be your friend") );
|
||||
};
|
||||
}
|
||||
if ($mail>0){
|
||||
foreach ($mails as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), 'notify-unseen',t("{0} sent you a message") );
|
||||
};
|
||||
}
|
||||
if ($register>0){
|
||||
foreach ($regs as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), 'notify-unseen',t("{0} requested registration") );
|
||||
};
|
||||
}
|
||||
|
||||
if (count($comments)){
|
||||
foreach ($comments as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} commented %s's post"), $i['pname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($likes)){
|
||||
foreach ($likes as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} liked %s's post"), $i['pname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($dislikes)){
|
||||
foreach ($dislikes as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} disliked %s's post"), $i['pname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($friends)){
|
||||
foreach ($friends as $i) {
|
||||
echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-name'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} is now friends with %s"), $i['fname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($posts)){
|
||||
foreach ($posts as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} posted") ) );
|
||||
};
|
||||
}
|
||||
if (count($tags)){
|
||||
foreach ($tags as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) );
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
if ($intro>0){
|
||||
foreach ($intros as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") );
|
||||
};
|
||||
if (count($cit)){
|
||||
foreach ($cit as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',t("{0} mentioned you in a post") );
|
||||
};
|
||||
}
|
||||
}
|
||||
if ($mail>0){
|
||||
foreach ($mails as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), t("{0} sent you a message") );
|
||||
};
|
||||
}
|
||||
if ($register>0){
|
||||
foreach ($regs as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), t("{0} requested registration") );
|
||||
};
|
||||
}
|
||||
|
||||
if (count($comments)){
|
||||
foreach ($comments as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} commented %s's post"), $i['pname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($likes)){
|
||||
foreach ($likes as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} liked %s's post"), $i['pname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($dislikes)){
|
||||
foreach ($dislikes as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} disliked %s's post"), $i['pname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($friends)){
|
||||
foreach ($friends as $i) {
|
||||
echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-name'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friends with %s"), $i['fname'] ) );
|
||||
};
|
||||
}
|
||||
if (count($posts)){
|
||||
foreach ($posts as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} posted") ) );
|
||||
};
|
||||
}
|
||||
if (count($tags)){
|
||||
foreach ($tags as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) );
|
||||
};
|
||||
}
|
||||
|
||||
if (count($cit)){
|
||||
foreach ($cit as $i) {
|
||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), t("{0} mentioned you in a post") );
|
||||
};
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
echo " </notif>";
|
||||
}
|
||||
echo " <sysmsgs>";
|
||||
|
||||
if(x($_SESSION,'sysmsg')){
|
||||
foreach ($_SESSION['sysmsg'] as $m){
|
||||
echo "<notice>".xmlify($m)."</notice>";
|
||||
}
|
||||
unset($_SESSION['sysmsg']);
|
||||
if(x($_SESSION,'sysmsg')){
|
||||
foreach ($_SESSION['sysmsg'] as $m){
|
||||
echo "<notice>".xmlify($m)."</notice>";
|
||||
}
|
||||
if(x($_SESSION,'sysmsg_info')){
|
||||
foreach ($_SESSION['sysmsg_info'] as $m){
|
||||
echo "<info>".xmlify($m)."</info>";
|
||||
}
|
||||
unset($_SESSION['sysmsg_info']);
|
||||
unset($_SESSION['sysmsg']);
|
||||
}
|
||||
if(x($_SESSION,'sysmsg_info')){
|
||||
foreach ($_SESSION['sysmsg_info'] as $m){
|
||||
echo "<info>".xmlify($m)."</info>";
|
||||
}
|
||||
unset($_SESSION['sysmsg_info']);
|
||||
}
|
||||
|
||||
echo " </sysmsgs>";
|
||||
echo"</result>
|
||||
|
|
|
@ -107,7 +107,7 @@ function profile_content(&$a, $update = 0) {
|
|||
|
||||
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
||||
|
||||
if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
|
||||
if($a->user['hidewall'] && (! $is_owner) && (! $remote_contact)) {
|
||||
notice( t('Access to this profile has been restricted.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
@ -228,10 +228,12 @@ function profile_content(&$a, $update = 0) {
|
|||
intval($a->profile['profile_uid']),
|
||||
dbesc($parents_str)
|
||||
);
|
||||
|
||||
$items = conv_sort($items,'created');
|
||||
} else {
|
||||
$items = array();
|
||||
}
|
||||
|
||||
$items = conv_sort($items,'created');
|
||||
|
||||
if($is_owner && ! $update) {
|
||||
$o .= get_birthdays();
|
||||
$o .= get_events();
|
||||
|
|
|
@ -50,6 +50,8 @@ function settings_post(&$a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$old_page_flags = $a->user['page-flags'];
|
||||
|
||||
if(($a->argc > 1) && ($a->argv[1] === 'oauth') && x($_POST,'remove')){
|
||||
$key = $_POST['remove'];
|
||||
q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
|
||||
|
@ -110,13 +112,15 @@ function settings_post(&$a) {
|
|||
if(($a->argc > 1) && ($a->argv[1] == 'connectors')) {
|
||||
|
||||
if(x($_POST['imap-submit'])) {
|
||||
$mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
|
||||
$mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
|
||||
$mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
|
||||
$mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
|
||||
$mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
|
||||
$mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
|
||||
$mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
|
||||
$mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
|
||||
$mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
|
||||
$mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
|
||||
$mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
|
||||
$mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
|
||||
$mail_action = ((x($_POST,'mail_action')) ? trim($_POST['mail_action']) : '');
|
||||
$mail_movetofolder = ((x($_POST,'mail_movetofolder')) ? trim($_POST['mail_movetofolder']) : '');
|
||||
$mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
|
||||
$mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
|
||||
|
||||
|
||||
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
|
||||
|
@ -142,11 +146,14 @@ function settings_post(&$a) {
|
|||
);
|
||||
}
|
||||
$r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
|
||||
`action` = %d, `movetofolder` = '%s',
|
||||
`mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1",
|
||||
dbesc($mail_server),
|
||||
intval($mail_port),
|
||||
dbesc($mail_ssl),
|
||||
dbesc($mail_user),
|
||||
intval($mail_action),
|
||||
dbesc($mail_movetofolder),
|
||||
dbesc($mail_replyto),
|
||||
intval($mail_pubmail),
|
||||
intval(local_user())
|
||||
|
@ -210,7 +217,7 @@ function settings_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
|
||||
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']);
|
||||
$username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : '');
|
||||
$email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : '');
|
||||
$timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : '');
|
||||
|
@ -218,8 +225,8 @@ function settings_post(&$a) {
|
|||
$openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
|
||||
$maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0);
|
||||
$expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0);
|
||||
|
||||
|
||||
|
||||
|
||||
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
|
||||
$expire_notes = ((x($_POST,'expire_notes')) ? intval($_POST['expire_notes']) : 0);
|
||||
$expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0);
|
||||
|
@ -370,7 +377,7 @@ function settings_post(&$a) {
|
|||
);
|
||||
}
|
||||
|
||||
if($old_visibility != $net_publish) {
|
||||
if(($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
|
||||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if($url && strlen(get_config('system','directory_submit_url')))
|
||||
|
@ -561,23 +568,25 @@ function settings_content(&$a) {
|
|||
$r = null;
|
||||
}
|
||||
|
||||
$mail_server = ((count($r)) ? $r[0]['server'] : '');
|
||||
$mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
|
||||
$mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
|
||||
$mail_user = ((count($r)) ? $r[0]['user'] : '');
|
||||
$mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
|
||||
$mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
|
||||
$mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
|
||||
$mail_server = ((count($r)) ? $r[0]['server'] : '');
|
||||
$mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
|
||||
$mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
|
||||
$mail_user = ((count($r)) ? $r[0]['user'] : '');
|
||||
$mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
|
||||
$mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
|
||||
$mail_action = ((count($r)) ? $r[0]['action'] : 0);
|
||||
$mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : '');
|
||||
$mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
|
||||
|
||||
|
||||
|
||||
$tpl = get_markup_template("settings_connectors.tpl");
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$title' => t('Connector Settings'),
|
||||
'$tabs' => $tabs,
|
||||
|
||||
|
||||
'$diasp_enabled' => $diasp_enabled,
|
||||
'$ostat_enabled' => $ostat_enabled,
|
||||
|
||||
|
||||
'$h_imap' => t('Email/Mailbox Setup'),
|
||||
'$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
|
||||
'$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk,''),
|
||||
|
@ -589,8 +598,10 @@ function settings_content(&$a) {
|
|||
'$mail_pass' => array('mail_pass', t('Email password:'), '', ''),
|
||||
'$mail_replyto' => array('mail_replyto', t('Reply-to address:'), '', 'Optional'),
|
||||
'$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''),
|
||||
'$submit' => t('Submit'),
|
||||
|
||||
'$mail_action' => array('mail_action', t('Action after import:'), $mail_action, '', array(0=>t('None'), 1=>t('Delete'), 2=>t('Mark as seen'), 3=>t('Move to folder'))),
|
||||
'$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''),
|
||||
'$submit' => t('Submit'),
|
||||
|
||||
|
||||
|
||||
'$settings_connectors' => $settings_connectors
|
||||
|
@ -598,7 +609,7 @@ function settings_content(&$a) {
|
|||
return $o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once('include/acl_selectors.php');
|
||||
|
||||
$p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
|
||||
|
@ -728,13 +739,23 @@ function settings_content(&$a) {
|
|||
$default_theme = get_config('system','theme');
|
||||
if(! $default_theme)
|
||||
$default_theme = 'default';
|
||||
|
||||
$allowed_themes_str = get_config('system','allowed_themes');
|
||||
$allowed_themes_raw = explode(',',$allowed_themes_str);
|
||||
$allowed_themes = array();
|
||||
if(count($allowed_themes_raw))
|
||||
foreach($allowed_themes_raw as $x)
|
||||
if(strlen(trim($x)))
|
||||
$allowed_themes[] = trim($x);
|
||||
|
||||
|
||||
$themes = array();
|
||||
$files = glob('view/theme/*');
|
||||
if($files) {
|
||||
foreach($files as $file) {
|
||||
$f = basename($file);
|
||||
$is_experimental = file_exists($file . '/experimental');
|
||||
if($allowed_themes) {
|
||||
foreach($allowed_themes as $th) {
|
||||
$f = $th;
|
||||
$is_experimental = file_exists('view/theme/' . $th . '/experimental');
|
||||
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
|
||||
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
|
||||
$theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
|
||||
$themes[$f]=$theme_name;
|
||||
|
|
|
@ -134,6 +134,7 @@ EOT;
|
|||
$arr['target'] = $target;
|
||||
$arr['object-type'] = $objtype;
|
||||
$arr['object'] = $obj;
|
||||
$arr['private'] = $item['private'];
|
||||
$arr['allow_cid'] = $item['allow_cid'];
|
||||
$arr['allow_gid'] = $item['allow_gid'];
|
||||
$arr['deny_cid'] = $item['deny_cid'];
|
||||
|
|
|
@ -63,7 +63,8 @@ function viewcontacts_content(&$a) {
|
|||
'username' => $rr['name'],
|
||||
'url' => $url,
|
||||
'sparkle' => '',
|
||||
'item' => $rr,
|
||||
'itemurl' => $rr['url'],
|
||||
'network' => network_to_name($rr['network']),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue