Merge develop into 1404_reworked_autocomplete
Conflicts: include/text.php view/templates/head.tpl view/theme/duepuntozero/style.css view/theme/vier/style.css
This commit is contained in:
commit
01b02dbcaa
723 changed files with 40077 additions and 44824 deletions
231
mod/admin.php
231
mod/admin.php
|
@ -55,13 +55,13 @@ function admin_post(&$a){
|
|||
$func($a);
|
||||
}
|
||||
}
|
||||
goaway($a->get_baseurl(true) . '/admin/plugins/' . $a->argv[2] );
|
||||
goaway('admin/plugins/'.$a->argv[2]);
|
||||
return; // NOTREACHED
|
||||
break;
|
||||
case 'themes':
|
||||
if($a->argc < 2) {
|
||||
if(is_ajax()) return;
|
||||
goaway($a->get_baseurl(true) . '/admin/' );
|
||||
goaway('admin/');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ function admin_post(&$a){
|
|||
info(t('Theme settings updated.'));
|
||||
if(is_ajax()) return;
|
||||
|
||||
goaway($a->get_baseurl(true) . '/admin/themes/' . $theme );
|
||||
goaway('admin/themes/'.$theme);
|
||||
return;
|
||||
break;
|
||||
case 'features':
|
||||
|
@ -107,7 +107,7 @@ function admin_post(&$a){
|
|||
}
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl(true) . '/admin' );
|
||||
goaway('admin');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -150,17 +150,17 @@ function admin_content(&$a) {
|
|||
* Side bar links
|
||||
*/
|
||||
$aside_tools = array();
|
||||
// array( url, name, extra css classes )
|
||||
// array(url, name, extra css classes)
|
||||
// not part of $aside to make the template more adjustable
|
||||
$aside_sub = array(
|
||||
'site' => array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"),
|
||||
'users' => array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"),
|
||||
'plugins'=> array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
|
||||
'themes' => array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
|
||||
'features' => array($a->get_baseurl(true)."/admin/features/", t("Additional features") , "features"),
|
||||
'dbsync' => array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync"),
|
||||
'queue' => array($a->get_baseurl(true)."/admin/queue/", t('Inspect Queue'), "queue"),
|
||||
'federation' => array($a->get_baseurl(true)."/admin/federation/", t('Federation Statistics'), "federation"),
|
||||
'site' => array("admin/site/", t("Site") , "site"),
|
||||
'users' => array("admin/users/", t("Users") , "users"),
|
||||
'plugins'=> array("admin/plugins/", t("Plugins") , "plugins"),
|
||||
'themes' => array("admin/themes/", t("Themes") , "themes"),
|
||||
'features' => array("admin/features/", t("Additional features") , "features"),
|
||||
'dbsync' => array("admin/dbsync/", t('DB updates'), "dbsync"),
|
||||
'queue' => array("admin/queue/", t('Inspect Queue'), "queue"),
|
||||
'federation' => array("admin/federation/", t('Federation Statistics'), "federation"),
|
||||
);
|
||||
|
||||
/* get plugins admin page */
|
||||
|
@ -169,18 +169,18 @@ function admin_content(&$a) {
|
|||
$aside_tools['plugins_admin']=array();
|
||||
foreach ($r as $h){
|
||||
$plugin =$h['name'];
|
||||
$aside_tools['plugins_admin'][] = array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin");
|
||||
$aside_tools['plugins_admin'][] = array("admin/plugins/".$plugin, $plugin, "plugin");
|
||||
// temp plugins with admin
|
||||
$a->plugins_admin[] = $plugin;
|
||||
}
|
||||
|
||||
$aside_tools['logs'] = array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs");
|
||||
$aside_tools['viewlogs'] = array($a->get_baseurl(true)."/admin/viewlogs/", t("View Logs"), 'viewlogs');
|
||||
$aside_tools['diagnostics_probe'] = array($a->get_baseurl(true).'/probe/', t('probe address'), 'probe');
|
||||
$aside_tools['diagnostics_webfinger'] = array($a->get_baseurl(true).'/webfinger/', t('check webfinger'), 'webfinger');
|
||||
$aside_tools['logs'] = array("admin/logs/", t("Logs"), "logs");
|
||||
$aside_tools['viewlogs'] = array("admin/viewlogs/", t("View Logs"), 'viewlogs');
|
||||
$aside_tools['diagnostics_probe'] = array('probe/', t('probe address'), 'probe');
|
||||
$aside_tools['diagnostics_webfinger'] = array('webfinger/', t('check webfinger'), 'webfinger');
|
||||
|
||||
$t = get_markup_template("admin_aside.tpl");
|
||||
$a->page['aside'] .= replace_macros( $t, array(
|
||||
$a->page['aside'] .= replace_macros($t, array(
|
||||
'$admin' => $aside_tools,
|
||||
'$subpages' => $aside_sub,
|
||||
'$admtxt' => t('Admin'),
|
||||
|
@ -188,7 +188,7 @@ function admin_content(&$a) {
|
|||
'$logtxt' => t('Logs'),
|
||||
'$diagnosticstxt' => t('diagnostics'),
|
||||
'$h_pending' => t('User registrations waiting for confirmation'),
|
||||
'$admurl'=> $a->get_baseurl(true)."/admin/"
|
||||
'$admurl'=> "admin/"
|
||||
));
|
||||
|
||||
|
||||
|
@ -231,7 +231,7 @@ function admin_content(&$a) {
|
|||
$o = admin_page_federation($a);
|
||||
break;
|
||||
default:
|
||||
notice( t("Item not found.") );
|
||||
notice(t("Item not found."));
|
||||
}
|
||||
} else {
|
||||
$o = admin_page_summary($a);
|
||||
|
@ -270,6 +270,12 @@ function admin_page_federation(&$a) {
|
|||
// Add more platforms if you like, when one returns 0 known nodes it is not
|
||||
// displayed on the stats page.
|
||||
$platforms = array('Friendica', 'Diaspora', '%%red%%', 'Hubzilla', 'GNU Social', 'StatusNet');
|
||||
$colors = array('Friendica' => '#ffc018', // orange from the logo
|
||||
'Diaspora' => '#a1a1a1', // logo is black and white, makes a gray
|
||||
'%%red%%' => '#c50001', // fire red from the logo
|
||||
'Hubzilla' => '#43488a', // blue from the logo
|
||||
'GNU Social'=> '#a22430', // dark red from the logo
|
||||
'StatusNet' => '#789240'); // the green from the logo (red and blue have already others
|
||||
$counts = array();
|
||||
$total = 0;
|
||||
|
||||
|
@ -277,14 +283,14 @@ function admin_page_federation(&$a) {
|
|||
// get a total count for the platform, the name and version of the
|
||||
// highest version and the protocol tpe
|
||||
$c = q('SELECT count(*) AS total, platform, network, version FROM gserver
|
||||
WHERE platform LIKE "%s" AND last_contact > last_failure
|
||||
WHERE platform LIKE "%s" AND last_contact > last_failure AND `version` != ""
|
||||
ORDER BY version ASC;', $p);
|
||||
$total = $total + $c[0]['total'];
|
||||
|
||||
// what versions for that platform do we know at all?
|
||||
// again only the active nodes
|
||||
$v = q('SELECT count(*) AS total, version FROM gserver
|
||||
WHERE last_contact > last_failure AND platform LIKE "%s"
|
||||
WHERE last_contact > last_failure AND platform LIKE "%s" AND `version` != ""
|
||||
GROUP BY version
|
||||
ORDER BY version;', $p);
|
||||
|
||||
|
@ -338,9 +344,12 @@ function admin_page_federation(&$a) {
|
|||
$v = $newVv;
|
||||
}
|
||||
|
||||
foreach ($v as $key => $vv)
|
||||
$v[$key]["version"] = trim(strip_tags($vv["version"]));
|
||||
|
||||
// the 3rd array item is needed for the JavaScript graphs as JS does
|
||||
// not like some characters in the names of variables...
|
||||
$counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p));
|
||||
$counts[$p]=array($c[0], $v, str_replace(array(' ','%'),'',$p), $colors[$p]);
|
||||
}
|
||||
|
||||
// some helpful text
|
||||
|
@ -409,18 +418,18 @@ function admin_page_queue(&$a) {
|
|||
function admin_page_summary(&$a) {
|
||||
$r = q("SELECT `page-flags`, COUNT(uid) as `count` FROM `user` GROUP BY `page-flags`");
|
||||
$accounts = array(
|
||||
array( t('Normal Account'), 0),
|
||||
array( t('Soapbox Account'), 0),
|
||||
array( t('Community/Celebrity Account'), 0),
|
||||
array( t('Automatic Friend Account'), 0),
|
||||
array( t('Blog Account'), 0),
|
||||
array( t('Private Forum'), 0)
|
||||
array(t('Normal Account'), 0),
|
||||
array(t('Soapbox Account'), 0),
|
||||
array(t('Community/Celebrity Account'), 0),
|
||||
array(t('Automatic Friend Account'), 0),
|
||||
array(t('Blog Account'), 0),
|
||||
array(t('Private Forum'), 0)
|
||||
);
|
||||
|
||||
$users=0;
|
||||
foreach ($r as $u){ $accounts[$u['page-flags']][1] = $u['count']; $users+= $u['count']; }
|
||||
|
||||
logger('accounts: ' . print_r($accounts,true),LOGGER_DATA);
|
||||
logger('accounts: '.print_r($accounts,true),LOGGER_DATA);
|
||||
|
||||
$r = q("SELECT COUNT(id) as `count` FROM `register`");
|
||||
$pending = $r[0]['count'];
|
||||
|
@ -433,7 +442,7 @@ function admin_page_summary(&$a) {
|
|||
|
||||
// We can do better, but this is a quick queue status
|
||||
|
||||
$queues = array( 'label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue );
|
||||
$queues = array('label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue);
|
||||
|
||||
|
||||
$t = get_markup_template("admin_summary.tpl");
|
||||
|
@ -441,15 +450,15 @@ function admin_page_summary(&$a) {
|
|||
'$title' => t('Administration'),
|
||||
'$page' => t('Summary'),
|
||||
'$queues' => $queues,
|
||||
'$users' => array( t('Registered users'), $users),
|
||||
'$users' => array(t('Registered users'), $users),
|
||||
'$accounts' => $accounts,
|
||||
'$pending' => array( t('Pending registrations'), $pending),
|
||||
'$version' => array( t('Version'), FRIENDICA_VERSION),
|
||||
'$pending' => array(t('Pending registrations'), $pending),
|
||||
'$version' => array(t('Version'), FRIENDICA_VERSION),
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
'$platform' => FRIENDICA_PLATFORM,
|
||||
'$codename' => FRIENDICA_CODENAME,
|
||||
'$build' => get_config('system','build'),
|
||||
'$plugins' => array( t('Active plugins'), $a->plugins )
|
||||
'$plugins' => array(t('Active plugins'), $a->plugins)
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -473,7 +482,7 @@ function admin_page_site_post(&$a) {
|
|||
$parsed = @parse_url($new_url);
|
||||
if(!$parsed || (!x($parsed,'host') || !x($parsed,'scheme'))) {
|
||||
notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
goaway('admin/site');
|
||||
}
|
||||
|
||||
/* steps:
|
||||
|
@ -483,6 +492,10 @@ function admin_page_site_post(&$a) {
|
|||
|
||||
$old_url = $a->get_baseurl(true);
|
||||
|
||||
// Generate host names for relocation the addresses in the format user@address.tld
|
||||
$new_host = str_replace("http://", "@", normalise_link($new_url));
|
||||
$old_host = str_replace("http://", "@", normalise_link($old_url));
|
||||
|
||||
function update_table($table_name, $fields, $old_url, $new_url) {
|
||||
global $db, $a;
|
||||
|
||||
|
@ -501,17 +514,22 @@ function admin_page_site_post(&$a) {
|
|||
$q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
|
||||
$r = q($q);
|
||||
if(!$r) {
|
||||
notice( "Failed updating '$table_name': " . $db->error );
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
notice("Failed updating '$table_name': ".$db->error);
|
||||
goaway('admin/site');
|
||||
}
|
||||
}
|
||||
|
||||
// update tables
|
||||
// update profile links in the format "http://server.tld"
|
||||
update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
|
||||
update_table("term", array('url'), $old_url, $new_url);
|
||||
update_table("contact", array('photo','thumb','micro','url','nurl','request','notify','poll','confirm','poco'), $old_url, $new_url);
|
||||
update_table("gcontact", array('photo','url','nurl','server_url'), $old_url, $new_url);
|
||||
update_table("item", array('owner-link','owner-avatar','author-name','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
|
||||
update_table("contact", array('photo','thumb','micro','url','nurl','alias','request','notify','poll','confirm','poco', 'avatar'), $old_url, $new_url);
|
||||
update_table("gcontact", array('url','nurl','photo','server_url','notify','alias'), $old_url, $new_url);
|
||||
update_table("item", array('owner-link','owner-avatar','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
|
||||
|
||||
// update profile addresses in the format "user@server.tld"
|
||||
update_table("contact", array('addr'), $old_host, $new_host);
|
||||
update_table("gcontact", array('connect','addr'), $old_host, $new_host);
|
||||
|
||||
// update config
|
||||
$a->set_baseurl($new_url);
|
||||
|
@ -526,7 +544,7 @@ function admin_page_site_post(&$a) {
|
|||
|
||||
info("Relocation started. Could take a while to complete.");
|
||||
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
goaway('admin/site');
|
||||
}
|
||||
// end relocate
|
||||
|
||||
|
@ -589,6 +607,7 @@ function admin_page_site_post(&$a) {
|
|||
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
|
||||
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
|
||||
$ostatus_poll_interval = ((x($_POST,'ostatus_poll_interval')) ? intval(trim($_POST['ostatus_poll_interval'])) : 0);
|
||||
$ostatus_full_threads = ((x($_POST,'ostatus_full_threads')) ? True : False);
|
||||
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
|
||||
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
|
||||
$force_ssl = ((x($_POST,'force_ssl')) ? True : False);
|
||||
|
@ -609,6 +628,9 @@ function admin_page_site_post(&$a) {
|
|||
$only_tag_search = ((x($_POST,'only_tag_search')) ? True : False);
|
||||
$rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0);
|
||||
$embedly = ((x($_POST,'embedly')) ? notags(trim($_POST['embedly'])) : '');
|
||||
$worker = ((x($_POST,'worker')) ? True : False);
|
||||
$worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 4);
|
||||
$worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False);
|
||||
|
||||
if($a->get_path() != "")
|
||||
$diaspora_enabled = false;
|
||||
|
@ -695,12 +717,12 @@ function admin_page_site_post(&$a) {
|
|||
set_config('system','language', $language);
|
||||
set_config('system','theme', $theme);
|
||||
|
||||
if( $theme_mobile === '---' ) {
|
||||
if($theme_mobile === '---') {
|
||||
del_config('system','mobile-theme');
|
||||
} else {
|
||||
set_config('system','mobile-theme', $theme_mobile);
|
||||
}
|
||||
if( $singleuser === '---' ) {
|
||||
if($singleuser === '---') {
|
||||
del_config('system','singleuser');
|
||||
} else {
|
||||
set_config('system','singleuser', $singleuser);
|
||||
|
@ -737,6 +759,7 @@ function admin_page_site_post(&$a) {
|
|||
set_config('system','dfrn_only', $dfrn_only);
|
||||
set_config('system','ostatus_disabled', $ostatus_disabled);
|
||||
set_config('system','ostatus_poll_interval', $ostatus_poll_interval);
|
||||
set_config('system','ostatus_full_threads', $ostatus_full_threads);
|
||||
set_config('system','diaspora_enabled', $diaspora_enabled);
|
||||
|
||||
set_config('config','private_addons', $private_addons);
|
||||
|
@ -754,7 +777,9 @@ function admin_page_site_post(&$a) {
|
|||
set_config('system','proxy_disabled', $proxy_disabled);
|
||||
set_config('system','old_pager', $old_pager);
|
||||
set_config('system','only_tag_search', $only_tag_search);
|
||||
|
||||
set_config('system','worker', $worker);
|
||||
set_config('system','worker_queues', $worker_queues);
|
||||
set_config('system','worker_dont_fork', $worker_dont_fork);
|
||||
|
||||
if($rino==2 and !function_exists('mcrypt_create_iv')) {
|
||||
notice(t("RINO2 needs mcrypt php extension to work."));
|
||||
|
@ -765,8 +790,8 @@ function admin_page_site_post(&$a) {
|
|||
set_config('system','embedly', $embedly);
|
||||
|
||||
|
||||
info( t('Site settings updated.') . EOL);
|
||||
goaway($a->get_baseurl(true) . '/admin/site' );
|
||||
info(t('Site settings updated.').EOL);
|
||||
goaway('admin/site');
|
||||
return; // NOTREACHED
|
||||
|
||||
}
|
||||
|
@ -797,12 +822,12 @@ function admin_page_site(&$a) {
|
|||
$files = glob('view/theme/*');
|
||||
if($files) {
|
||||
foreach($files as $file) {
|
||||
if(intval(file_exists($file . '/unsupported')))
|
||||
if(intval(file_exists($file.'/unsupported')))
|
||||
continue;
|
||||
|
||||
$f = basename($file);
|
||||
$theme_name = ((file_exists($file . '/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
|
||||
if(file_exists($file . '/mobile')) {
|
||||
$theme_name = ((file_exists($file.'/experimental')) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
|
||||
if(file_exists($file.'/mobile')) {
|
||||
$theme_choices_mobile[$f] = $theme_name;
|
||||
} else {
|
||||
$theme_choices[$f] = $theme_name;
|
||||
|
@ -893,6 +918,7 @@ function admin_page_site(&$a) {
|
|||
'$advanced' => t('Advanced'),
|
||||
'$portable_contacts' => t('Auto Discovered Contact Directory'),
|
||||
'$performance' => t('Performance'),
|
||||
'$worker_title' => t('Worker'),
|
||||
'$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
// name, label, value, help string, extra data...
|
||||
|
@ -938,6 +964,7 @@ function admin_page_site(&$a) {
|
|||
'$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), get_config('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")),
|
||||
'$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")),
|
||||
'$ostatus_poll_interval' => array('ostatus_poll_interval', t("OStatus conversation completion interval"), (string) intval(get_config('system','ostatus_poll_interval')), t("How often shall the poller check for new entries in OStatus conversations? This can be a very ressource task."), $ostatus_poll_choices),
|
||||
'$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), get_config('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")),
|
||||
'$ostatus_not_able' => t("OStatus support can only be enabled if threading is enabled."),
|
||||
'$diaspora_able' => $diaspora_able,
|
||||
'$diaspora_not_able' => t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
|
||||
|
@ -980,6 +1007,10 @@ function admin_page_site(&$a) {
|
|||
'$rino' => array('rino', t("RINO Encryption"), intval(get_config('system','rino_encrypt')), t("Encryption layer between nodes."), array("Disabled", "RINO1 (deprecated)", "RINO2")),
|
||||
'$embedly' => array('embedly', t("Embedly API key"), get_config('system','embedly'), t("<a href='http://embed.ly'>Embedly</a> is used to fetch additional data for web pages. This is an optional parameter.")),
|
||||
|
||||
'$worker' => array('worker', t("Enable 'worker' background processing"), get_config('system','worker'), t("The worker background processing limits the number of parallel background jobs to a maximum number and respects the system load.")),
|
||||
'$worker_queues' => array('worker_queues', t("Maximum number of parallel workers"), get_config('system','worker_queues'), t("On shared hosters set this to 2. On larger systems, values of 10 are great. Default value is 4.")),
|
||||
'$worker_dont_fork' => array('worker_dont_fork', t("Don't use 'proc_open' with the worker"), get_config('system','worker_dont_fork'), t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of poller calls in your crontab.")),
|
||||
|
||||
'$form_security_token' => get_form_security_token("admin_site")
|
||||
|
||||
));
|
||||
|
@ -1003,12 +1034,12 @@ function admin_page_dbsync(&$a) {
|
|||
$o = '';
|
||||
|
||||
if($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') {
|
||||
set_config('database', 'update_' . intval($a->argv[3]), 'success');
|
||||
set_config('database', 'update_'.intval($a->argv[3]), 'success');
|
||||
$curr = get_config('system','build');
|
||||
if(intval($curr) == intval($a->argv[3]))
|
||||
set_config('system','build',intval($curr) + 1);
|
||||
info( t('Update has been marked successful') . EOL);
|
||||
goaway($a->get_baseurl(true) . '/admin/dbsync');
|
||||
info(t('Update has been marked successful').EOL);
|
||||
goaway('admin/dbsync');
|
||||
}
|
||||
|
||||
if(($a->argc > 2) AND (intval($a->argv[2]) OR ($a->argv[2] === 'check'))) {
|
||||
|
@ -1026,7 +1057,7 @@ function admin_page_dbsync(&$a) {
|
|||
|
||||
if($a->argc > 2 && intval($a->argv[2])) {
|
||||
require_once('update.php');
|
||||
$func = 'update_' . intval($a->argv[2]);
|
||||
$func = 'update_'.intval($a->argv[2]);
|
||||
if(function_exists($func)) {
|
||||
$retval = $func();
|
||||
if($retval === UPDATE_FAILED) {
|
||||
|
@ -1082,18 +1113,18 @@ function admin_page_dbsync(&$a) {
|
|||
* @param App $a
|
||||
*/
|
||||
function admin_page_users_post(&$a){
|
||||
$pending = ( x($_POST, 'pending') ? $_POST['pending'] : array() );
|
||||
$users = ( x($_POST, 'user') ? $_POST['user'] : array() );
|
||||
$nu_name = ( x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
|
||||
$nu_nickname = ( x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
|
||||
$nu_email = ( x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
|
||||
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
|
||||
$users = (x($_POST, 'user') ? $_POST['user'] : array());
|
||||
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
|
||||
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
|
||||
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
|
||||
|
||||
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
|
||||
|
||||
if(!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
|
||||
require_once('include/user.php');
|
||||
|
||||
$result = create_user( array('username'=>$nu_name, 'email'=>$nu_email, 'nickname'=>$nu_nickname, 'verified'=>1) );
|
||||
$result = create_user(array('username'=>$nu_name, 'email'=>$nu_email, 'nickname'=>$nu_nickname, 'verified'=>1));
|
||||
if(! $result['success']) {
|
||||
notice($result['message']);
|
||||
return;
|
||||
|
@ -1134,7 +1165,7 @@ function admin_page_users_post(&$a){
|
|||
notification(array(
|
||||
'type' => "SYSTEM_EMAIL",
|
||||
'to_email' => $nu['email'],
|
||||
'subject'=> sprintf( t('Registration details for %s'), $a->config['sitename']),
|
||||
'subject'=> sprintf(t('Registration details for %s'), $a->config['sitename']),
|
||||
'preamble'=> $preamble,
|
||||
'body' => $body));
|
||||
|
||||
|
@ -1143,17 +1174,17 @@ function admin_page_users_post(&$a){
|
|||
if(x($_POST,'page_users_block')) {
|
||||
foreach($users as $uid){
|
||||
q("UPDATE `user` SET `blocked`=1-`blocked` WHERE `uid`=%s",
|
||||
intval( $uid )
|
||||
intval($uid)
|
||||
);
|
||||
}
|
||||
notice( sprintf( tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)), count($users)) );
|
||||
notice(sprintf(tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)), count($users)));
|
||||
}
|
||||
if(x($_POST,'page_users_delete')) {
|
||||
require_once("include/Contact.php");
|
||||
foreach($users as $uid){
|
||||
user_remove($uid);
|
||||
}
|
||||
notice( sprintf( tt("%s user deleted", "%s users deleted", count($users)), count($users)) );
|
||||
notice(sprintf(tt("%s user deleted", "%s users deleted", count($users)), count($users)));
|
||||
}
|
||||
|
||||
if(x($_POST,'page_users_approve')) {
|
||||
|
@ -1168,7 +1199,7 @@ function admin_page_users_post(&$a){
|
|||
user_deny($hash);
|
||||
}
|
||||
}
|
||||
goaway($a->get_baseurl(true) . '/admin/users' );
|
||||
goaway('admin/users');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1189,8 +1220,8 @@ function admin_page_users(&$a){
|
|||
$uid = $a->argv[3];
|
||||
$user = q("SELECT username, blocked FROM `user` WHERE `uid`=%d", intval($uid));
|
||||
if(count($user)==0) {
|
||||
notice( 'User not found' . EOL);
|
||||
goaway($a->get_baseurl(true) . '/admin/users' );
|
||||
notice('User not found'.EOL);
|
||||
goaway('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
switch($a->argv[2]){
|
||||
|
@ -1200,18 +1231,18 @@ function admin_page_users(&$a){
|
|||
require_once("include/Contact.php");
|
||||
user_remove($uid);
|
||||
|
||||
notice( sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL);
|
||||
notice(sprintf(t("User '%s' deleted"), $user[0]['username']).EOL);
|
||||
}; break;
|
||||
case "block":{
|
||||
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
|
||||
q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s",
|
||||
intval( 1-$user[0]['blocked'] ),
|
||||
intval( $uid )
|
||||
intval(1-$user[0]['blocked']),
|
||||
intval($uid)
|
||||
);
|
||||
notice( sprintf( ($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']) . EOL);
|
||||
notice(sprintf(($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']).EOL);
|
||||
}; break;
|
||||
}
|
||||
goaway($a->get_baseurl(true) . '/admin/users' );
|
||||
goaway('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
|
||||
}
|
||||
|
@ -1230,7 +1261,7 @@ function admin_page_users(&$a){
|
|||
$a->set_pager_itemspage(100);
|
||||
}
|
||||
|
||||
$users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`
|
||||
$users = q("SELECT `user`.* , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`
|
||||
FROM
|
||||
(SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
|
||||
FROM `item`
|
||||
|
@ -1277,7 +1308,7 @@ function admin_page_users(&$a){
|
|||
|
||||
while(count($users)) {
|
||||
$new_user = array();
|
||||
foreach( array_pop($users) as $k => $v) {
|
||||
foreach(array_pop($users) as $k => $v) {
|
||||
$k = str_replace('-','_',$k);
|
||||
$new_user[$k] = $v;
|
||||
}
|
||||
|
@ -1303,7 +1334,7 @@ function admin_page_users(&$a){
|
|||
'$select_all' => t('select all'),
|
||||
'$h_pending' => t('User registrations waiting for confirm'),
|
||||
'$h_deleted' => t('User waiting for permanent deletion'),
|
||||
'$th_pending' => array( t('Request date'), t('Name'), t('Email') ),
|
||||
'$th_pending' => array(t('Request date'), t('Name'), t('Email')),
|
||||
'$no_pending' => t('No registrations.'),
|
||||
'$approve' => t('Approve'),
|
||||
'$deny' => t('Deny'),
|
||||
|
@ -1315,8 +1346,8 @@ function admin_page_users(&$a){
|
|||
|
||||
'$h_users' => t('Users'),
|
||||
'$h_newuser' => t('New User'),
|
||||
'$th_deleted' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since') ),
|
||||
'$th_users' => array( t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account') ),
|
||||
'$th_deleted' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since')),
|
||||
'$th_users' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')),
|
||||
|
||||
'$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
'$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),
|
||||
|
@ -1362,7 +1393,7 @@ function admin_page_plugins(&$a){
|
|||
if($a->argc == 3) {
|
||||
$plugin = $a->argv[2];
|
||||
if(!is_file("addon/$plugin/$plugin.php")) {
|
||||
notice( t("Item not found.") );
|
||||
notice(t("Item not found."));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -1374,14 +1405,14 @@ function admin_page_plugins(&$a){
|
|||
if($idx !== false) {
|
||||
unset($a->plugins[$idx]);
|
||||
uninstall_plugin($plugin);
|
||||
info( sprintf( t("Plugin %s disabled."), $plugin ) );
|
||||
info(sprintf(t("Plugin %s disabled."), $plugin));
|
||||
} else {
|
||||
$a->plugins[] = $plugin;
|
||||
install_plugin($plugin);
|
||||
info( sprintf( t("Plugin %s enabled."), $plugin ) );
|
||||
info(sprintf(t("Plugin %s enabled."), $plugin));
|
||||
}
|
||||
set_config("system","addon", implode(", ",$a->plugins));
|
||||
goaway($a->get_baseurl(true) . '/admin/plugins' );
|
||||
goaway('admin/plugins');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1480,7 +1511,7 @@ function admin_page_plugins(&$a){
|
|||
'$function' => 'plugins',
|
||||
'$plugins' => $plugins,
|
||||
'$pcount' => count($plugins),
|
||||
'$noplugshint' => sprintf( t('There are currently no plugins available on your node. You can find the official plugin repository at %1$s and might find other interesting plugins in the open plugin registry at %2$s'), 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
|
||||
'$noplugshint' => sprintf(t('There are currently no plugins available on your node. You can find the official plugin repository at %1$s and might find other interesting plugins in the open plugin registry at %2$s'), 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
|
||||
'$form_security_token' => get_form_security_token("admin_themes"),
|
||||
));
|
||||
}
|
||||
|
@ -1575,8 +1606,8 @@ function admin_page_themes(&$a){
|
|||
if($files) {
|
||||
foreach($files as $file) {
|
||||
$f = basename($file);
|
||||
$is_experimental = intval(file_exists($file . '/experimental'));
|
||||
$is_supported = 1-(intval(file_exists($file . '/unsupported')));
|
||||
$is_experimental = intval(file_exists($file.'/experimental'));
|
||||
$is_supported = 1-(intval(file_exists($file.'/unsupported')));
|
||||
$is_allowed = intval(in_array($f,$allowed_themes));
|
||||
|
||||
if($is_allowed OR $is_supported OR get_config("system", "show_unsupported_themes"))
|
||||
|
@ -1585,7 +1616,7 @@ function admin_page_themes(&$a){
|
|||
}
|
||||
|
||||
if(! count($themes)) {
|
||||
notice( t('No themes found.'));
|
||||
notice(t('No themes found.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -1596,7 +1627,7 @@ function admin_page_themes(&$a){
|
|||
if($a->argc == 3) {
|
||||
$theme = $a->argv[2];
|
||||
if(! is_dir("view/theme/$theme")) {
|
||||
notice( t("Item not found.") );
|
||||
notice(t("Item not found."));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -1609,15 +1640,15 @@ function admin_page_themes(&$a){
|
|||
$s = rebuild_theme_table($themes);
|
||||
if($result) {
|
||||
install_theme($theme);
|
||||
info( sprintf('Theme %s enabled.',$theme));
|
||||
info(sprintf('Theme %s enabled.',$theme));
|
||||
}
|
||||
else {
|
||||
uninstall_theme($theme);
|
||||
info( sprintf('Theme %s disabled.',$theme));
|
||||
info(sprintf('Theme %s disabled.',$theme));
|
||||
}
|
||||
|
||||
set_config('system','allowed_themes',$s);
|
||||
goaway($a->get_baseurl(true) . '/admin/themes' );
|
||||
goaway('admin/themes');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1663,7 +1694,7 @@ function admin_page_themes(&$a){
|
|||
$admin_form = __get_theme_admin_form($a, $theme);
|
||||
}
|
||||
|
||||
$screenshot = array( get_theme_screenshot($theme), t('Screenshot'));
|
||||
$screenshot = array(get_theme_screenshot($theme), t('Screenshot'));
|
||||
if(! stristr($screenshot[0],$theme))
|
||||
$screenshot = null;
|
||||
|
||||
|
@ -1754,8 +1785,8 @@ function admin_page_logs_post(&$a) {
|
|||
set_config('system','loglevel', $loglevel);
|
||||
}
|
||||
|
||||
info( t("Log settings updated.") );
|
||||
goaway($a->get_baseurl(true) . '/admin/logs' );
|
||||
info(t("Log settings updated."));
|
||||
goaway('admin/logs');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1803,7 +1834,7 @@ function admin_page_logs(&$a){
|
|||
'$form_security_token' => get_form_security_token("admin_logs"),
|
||||
'$phpheader' => t("PHP logging"),
|
||||
'$phphint' => t("To enable logging of PHP errors and warnings you can add the following to the .htconfig.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
|
||||
'$phplogcode' => "error_reporting(E_ERROR | E_WARNING | E_PARSE );\nini_set('error_log','php.out');\nini_set('log_errors','1');\nini_set('display_errors', '1');",
|
||||
'$phplogcode' => "error_reporting(E_ERROR | E_WARNING | E_PARSE);\nini_set('error_log','php.out');\nini_set('log_errors','1');\nini_set('display_errors', '1');",
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -1871,7 +1902,7 @@ function admin_page_features_post(&$a) {
|
|||
|
||||
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
|
||||
|
||||
logger('postvars: ' . print_r($_POST,true),LOGGER_DATA);
|
||||
logger('postvars: '.print_r($_POST,true),LOGGER_DATA);
|
||||
|
||||
$arr = array();
|
||||
$features = get_features(false);
|
||||
|
@ -1879,11 +1910,11 @@ function admin_page_features_post(&$a) {
|
|||
foreach($features as $fname => $fdata) {
|
||||
foreach(array_slice($fdata,1) as $f) {
|
||||
$feature = $f[0];
|
||||
$feature_state = 'feature_' . $feature;
|
||||
$featurelock = 'featurelock_' . $feature;
|
||||
$feature_state = 'feature_'.$feature;
|
||||
$featurelock = 'featurelock_'.$feature;
|
||||
|
||||
if(x($_POST[$feature_state]))
|
||||
$val = intval($_POST['feature_' . $feature]);
|
||||
$val = intval($_POST['feature_'.$feature]);
|
||||
else
|
||||
$val = 0;
|
||||
set_config('feature',$feature,$val);
|
||||
|
@ -1895,7 +1926,7 @@ function admin_page_features_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl(true) . '/admin/features' );
|
||||
goaway('admin/features');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1929,7 +1960,7 @@ function admin_page_features(&$a) {
|
|||
$set = $f[3];
|
||||
$arr[$fname][1][] = array(
|
||||
array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'),t('On'))),
|
||||
array('featurelock_' .$f[0],sprintf( t('Lock feature %s'),$f[1]),(($f[4] !== false) ? "1" : ''),'',array(t('Off'),t('On')))
|
||||
array('featurelock_' .$f[0],sprintf(t('Lock feature %s'),$f[1]),(($f[4] !== false) ? "1" : ''),'',array(t('Off'),t('On')))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ function common_content(&$a) {
|
|||
$vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array(
|
||||
'$name' => htmlentities($c[0]['name']),
|
||||
'$photo' => $c[0]['photo'],
|
||||
'url' => z_root() . '/contacts/' . $cid
|
||||
'url' => 'contacts/' . $cid
|
||||
));
|
||||
|
||||
if(! x($a->page,'aside'))
|
||||
|
|
165
mod/contacts.php
165
mod/contacts.php
|
@ -44,7 +44,7 @@ function contacts_init(&$a) {
|
|||
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
|
||||
'$name' => htmlentities($a->data['contact']['name']),
|
||||
'$photo' => $a->data['contact']['photo'],
|
||||
'$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? z_root()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'],
|
||||
'$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/".$a->data['contact']['id'] : $a->data['contact']['url'],
|
||||
'$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
|
||||
'$network_name' => $networkname,
|
||||
'$network' => t('Network:'),
|
||||
|
@ -129,9 +129,9 @@ function contacts_batch_actions(&$a){
|
|||
}
|
||||
|
||||
if(x($_SESSION,'return_url'))
|
||||
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
else
|
||||
goaway($a->get_baseurl(true) . '/contacts');
|
||||
goaway('contacts');
|
||||
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ function contacts_post(&$a) {
|
|||
|
||||
if(! count($orig_record)) {
|
||||
notice( t('Could not access contact record.') . EOL);
|
||||
goaway($a->get_baseurl(true) . '/contacts');
|
||||
goaway('contacts');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -366,19 +366,19 @@ function contacts_content(&$a) {
|
|||
|
||||
if(! count($orig_record)) {
|
||||
notice( t('Could not access contact record.') . EOL);
|
||||
goaway($a->get_baseurl(true) . '/contacts');
|
||||
goaway('contacts');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
if($cmd === 'update') {
|
||||
_contact_update($contact_id);
|
||||
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
|
||||
goaway('contacts/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if($cmd === 'updateprofile') {
|
||||
_contact_update_profile($contact_id);
|
||||
goaway($a->get_baseurl(true) . '/crepair/' . $contact_id);
|
||||
goaway('crepair/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ function contacts_content(&$a) {
|
|||
info((($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')).EOL);
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
|
||||
goaway('contacts/' . $contact_id);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ function contacts_content(&$a) {
|
|||
info((($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')).EOL);
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
|
||||
goaway('contacts/' . $contact_id);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ function contacts_content(&$a) {
|
|||
info((($archived) ? t('Contact has been archived') : t('Contact has been unarchived')).EOL);
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
|
||||
goaway('contacts/' . $contact_id);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -447,17 +447,17 @@ function contacts_content(&$a) {
|
|||
// Now check how the user responded to the confirmation query
|
||||
if($_REQUEST['canceled']) {
|
||||
if(x($_SESSION,'return_url'))
|
||||
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
else
|
||||
goaway($a->get_baseurl(true) . '/contacts');
|
||||
goaway('contacts');
|
||||
}
|
||||
|
||||
_contact_drop($contact_id, $orig_record[0]);
|
||||
info( t('Contact has been removed.') . EOL );
|
||||
if(x($_SESSION,'return_url'))
|
||||
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||
goaway('' . $_SESSION['return_url']);
|
||||
else
|
||||
goaway($a->get_baseurl(true) . '/contacts');
|
||||
goaway('contacts');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
if($cmd === 'posts') {
|
||||
|
@ -565,6 +565,9 @@ function contacts_content(&$a) {
|
|||
($contact['rel'] == CONTACT_IS_FOLLOWER))
|
||||
$follow = $a->get_baseurl(true)."/follow?url=".urlencode($contact["url"]);
|
||||
|
||||
// Load contactact related actions like hide, suggest, delete and others
|
||||
$contact_actions = contact_actions($contact);
|
||||
|
||||
|
||||
$o .= replace_macros($tpl, array(
|
||||
//'$header' => t('Contact Editor'),
|
||||
|
@ -575,7 +578,7 @@ function contacts_content(&$a) {
|
|||
'$lbl_info1' => t('Contact Information / Notes'),
|
||||
'$infedit' => t('Edit contact notes'),
|
||||
'$common_text' => $common_text,
|
||||
'$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_user() . '/' . $contact['id'],
|
||||
'$common_link' => 'common/loc/' . local_user() . '/' . $contact['id'],
|
||||
'$all_friends' => $all_friends,
|
||||
'$relation_text' => $relation_text,
|
||||
'$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']),
|
||||
|
@ -584,7 +587,7 @@ function contacts_content(&$a) {
|
|||
'$lblcrepair' => t("Repair URL settings"),
|
||||
'$lblrecent' => t('View conversations'),
|
||||
'$lblsuggest' => $lblsuggest,
|
||||
'$delete' => t('Delete contact'),
|
||||
//'$delete' => t('Delete contact'),
|
||||
'$nettype' => $nettype,
|
||||
'$poll_interval' => $poll_interval,
|
||||
'$poll_enabled' => $poll_enabled,
|
||||
|
@ -622,7 +625,11 @@ function contacts_content(&$a) {
|
|||
'$about' => bbcode($contact["about"], false, false),
|
||||
'$about_label' => t("About:"),
|
||||
'$keywords' => $contact["keywords"],
|
||||
'$keywords_label' => t("Tags:")
|
||||
'$keywords_label' => t("Tags:"),
|
||||
'$contact_action_button' => t("Actions"),
|
||||
'$contact_actions' => $contact_actions,
|
||||
'$contact_status' => t("Status"),
|
||||
'$contact_settings_label' => t('Contact Settings'),
|
||||
|
||||
));
|
||||
|
||||
|
@ -668,7 +675,7 @@ function contacts_content(&$a) {
|
|||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Suggestions'),
|
||||
'url' => $a->get_baseurl(true) . '/suggest',
|
||||
'url' => 'suggest',
|
||||
'sel' => '',
|
||||
'title' => t('Suggest potential friends'),
|
||||
'id' => 'suggestions-tab',
|
||||
|
@ -676,7 +683,7 @@ function contacts_content(&$a) {
|
|||
),
|
||||
array(
|
||||
'label' => t('All Contacts'),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/all',
|
||||
'url' => 'contacts/all',
|
||||
'sel' => ($all) ? 'active' : '',
|
||||
'title' => t('Show all contacts'),
|
||||
'id' => 'showall-tab',
|
||||
|
@ -684,7 +691,7 @@ function contacts_content(&$a) {
|
|||
),
|
||||
array(
|
||||
'label' => t('Unblocked'),
|
||||
'url' => $a->get_baseurl(true) . '/contacts',
|
||||
'url' => 'contacts',
|
||||
'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '',
|
||||
'title' => t('Only show unblocked contacts'),
|
||||
'id' => 'showunblocked-tab',
|
||||
|
@ -693,7 +700,7 @@ function contacts_content(&$a) {
|
|||
|
||||
array(
|
||||
'label' => t('Blocked'),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/blocked',
|
||||
'url' => 'contacts/blocked',
|
||||
'sel' => ($blocked) ? 'active' : '',
|
||||
'title' => t('Only show blocked contacts'),
|
||||
'id' => 'showblocked-tab',
|
||||
|
@ -702,7 +709,7 @@ function contacts_content(&$a) {
|
|||
|
||||
array(
|
||||
'label' => t('Ignored'),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/ignored',
|
||||
'url' => 'contacts/ignored',
|
||||
'sel' => ($ignored) ? 'active' : '',
|
||||
'title' => t('Only show ignored contacts'),
|
||||
'id' => 'showignored-tab',
|
||||
|
@ -711,7 +718,7 @@ function contacts_content(&$a) {
|
|||
|
||||
array(
|
||||
'label' => t('Archived'),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/archived',
|
||||
'url' => 'contacts/archived',
|
||||
'sel' => ($archived) ? 'active' : '',
|
||||
'title' => t('Only show archived contacts'),
|
||||
'id' => 'showarchived-tab',
|
||||
|
@ -720,7 +727,7 @@ function contacts_content(&$a) {
|
|||
|
||||
array(
|
||||
'label' => t('Hidden'),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/hidden',
|
||||
'url' => 'contacts/hidden',
|
||||
'sel' => ($hidden) ? 'active' : '',
|
||||
'title' => t('Only show hidden contacts'),
|
||||
'id' => 'showhidden-tab',
|
||||
|
@ -800,6 +807,17 @@ function contacts_content(&$a) {
|
|||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief List of pages for the Contact TabBar
|
||||
*
|
||||
* Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
|
||||
*
|
||||
* @param app $a
|
||||
* @param int $contact_id The ID of the contact
|
||||
* @param int $active_tab 1 if tab should be marked as active
|
||||
*
|
||||
* @return array with with contact TabBar data
|
||||
*/
|
||||
function contacts_tab($a, $contact_id, $active_tab) {
|
||||
// tabs
|
||||
$tabs = array(
|
||||
|
@ -821,6 +839,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
)
|
||||
);
|
||||
|
||||
// Show this tab only if there is visible friend list
|
||||
$x = count_all_friends(local_user(), $contact_id);
|
||||
if ($x)
|
||||
$tabs[] = array('label'=>t('Contacts'),
|
||||
|
@ -830,6 +849,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
'id' => 'allfriends-tab',
|
||||
'accesskey' => 't');
|
||||
|
||||
// Show this tab only if there is visible common friend list
|
||||
$common = count_common_friends(local_user(),$contact_id);
|
||||
if ($common)
|
||||
$tabs[] = array('label'=>t('Common Friends'),
|
||||
|
@ -839,35 +859,13 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
|||
'id' => 'common-loc-tab',
|
||||
'accesskey' => 'd');
|
||||
|
||||
$tabs[] = array('label' => t('Repair'),
|
||||
'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id,
|
||||
$tabs[] = array('label' => t('Advanced'),
|
||||
'url' => 'crepair/' . $contact_id,
|
||||
'sel' => (($active_tab == 5)?'active':''),
|
||||
'title' => t('Advanced Contact Settings'),
|
||||
'id' => 'repair-tab',
|
||||
'id' => 'advanced-tab',
|
||||
'accesskey' => 'r');
|
||||
|
||||
|
||||
$tabs[] = array('label' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
|
||||
'sel' => '',
|
||||
'title' => t('Toggle Blocked status'),
|
||||
'id' => 'toggle-block-tab',
|
||||
'accesskey' => 'b');
|
||||
|
||||
$tabs[] = array('label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
|
||||
'sel' => '',
|
||||
'title' => t('Toggle Ignored status'),
|
||||
'id' => 'toggle-ignore-tab',
|
||||
'accesskey' => 'i');
|
||||
|
||||
$tabs[] = array('label' => (($contact['archive']) ? t('Unarchive') : t('Archive') ),
|
||||
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/archive',
|
||||
'sel' => '',
|
||||
'title' => t('Toggle Archive status'),
|
||||
'id' => 'toggle-archive-tab',
|
||||
'accesskey' => 'v');
|
||||
|
||||
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||
$tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs));
|
||||
|
||||
|
@ -954,3 +952,72 @@ function _contact_detail_for_template($rr){
|
|||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gives a array with actions which can performed to a given contact
|
||||
*
|
||||
* This includes actions like e.g. 'block', 'hide', 'archive', 'delete' and others
|
||||
*
|
||||
* @param array $contact Data about the Contact
|
||||
* @return array with contact related actions
|
||||
*/
|
||||
function contact_actions($contact) {
|
||||
|
||||
$poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2));
|
||||
$contact_action = array();
|
||||
|
||||
// Provide friend suggestion only for Friendica contacts
|
||||
if($contact['network'] === NETWORK_DFRN) {
|
||||
$contact_actions['suggest'] = array(
|
||||
'label' => t('Suggest friends'),
|
||||
'url' => 'fsuggest/' . $contact['id'],
|
||||
'title' => '',
|
||||
'sel' => '',
|
||||
'id' => 'suggest',
|
||||
);
|
||||
}
|
||||
|
||||
if($poll_enabled) {
|
||||
$contact_actions['update'] = array(
|
||||
'label' => t('Update now'),
|
||||
'url' => 'contacts/' . $contact['id'] . '/update',
|
||||
'title' => '',
|
||||
'sel' => '',
|
||||
'id' => 'update',
|
||||
);
|
||||
}
|
||||
|
||||
$contact_actions['block'] = array(
|
||||
'label' => (intval($contact['blocked']) ? t('Unblock') : t('Block') ),
|
||||
'url' => 'contacts/' . $contact['id'] . '/block',
|
||||
'title' => t('Toggle Blocked status'),
|
||||
'sel' => (intval($contact['blocked']) ? 'active' : ''),
|
||||
'id' => 'toggle-block',
|
||||
);
|
||||
|
||||
$contact_actions['ignore'] = array(
|
||||
'label' => (intval($contact['readonly']) ? t('Unignore') : t('Ignore') ),
|
||||
'url' => 'contacts/' . $contact['id'] . '/ignore',
|
||||
'title' => t('Toggle Ignored status'),
|
||||
'sel' => (intval($contact['readonly']) ? 'active' : ''),
|
||||
'id' => 'toggle-ignore',
|
||||
);
|
||||
|
||||
$contact_actions['archive'] = array(
|
||||
'label' => (intval($contact['archive']) ? t('Unarchive') : t('Archive') ),
|
||||
'url' => 'contacts/' . $contact['id'] . '/archive',
|
||||
'title' => t('Toggle Archive status'),
|
||||
'sel' => (intval($contact['archive']) ? 'active' : ''),
|
||||
'id' => 'toggle-archive',
|
||||
);
|
||||
|
||||
$contact_actions['delete'] = array(
|
||||
'label' => t('Delete'),
|
||||
'url' => 'contacts/' . $contact['id'] . '/drop',
|
||||
'title' => t('Delete contact'),
|
||||
'sel' => '',
|
||||
'id' => 'delete',
|
||||
);
|
||||
|
||||
return $contact_actions;
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
|
||||
$profile_avatar = $a->contacts[$normalised]['thumb'];
|
||||
else
|
||||
$profile_avatar = ((strlen($item['author-avatar'])) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb']);
|
||||
$profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']));
|
||||
|
||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||
call_hooks('render_location',$locate);
|
||||
|
@ -615,7 +615,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
$comment_lastcollapsed = true;
|
||||
}
|
||||
|
||||
$redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ;
|
||||
$redirect_url = 'redir/' . $item['cid'] ;
|
||||
|
||||
$lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
||||
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
||||
|
@ -791,7 +791,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
|||
if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
|
||||
$profile_avatar = $a->contacts[$normalised]['thumb'];
|
||||
else
|
||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($thumb));
|
||||
$profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar']) && $diff_author) ? $item['author-avatar'] : $thumb));
|
||||
|
||||
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
||||
|
|
|
@ -427,8 +427,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
|
||||
if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
|
||||
require_once('include/diaspora.php');
|
||||
$ret = diaspora_share($user[0],$r[0]);
|
||||
logger('mod_follow: diaspora_share returns: ' . $ret);
|
||||
$ret = diaspora::send_share($user[0],$r[0]);
|
||||
logger('share returns: ' . $ret);
|
||||
}
|
||||
|
||||
// Send a new friend post if we are allowed to...
|
||||
|
@ -448,6 +448,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
if(count($self)) {
|
||||
|
||||
$arr = array();
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
|
||||
$arr['uid'] = $uid;
|
||||
$arr['contact-id'] = $self[0]['id'];
|
||||
|
@ -466,7 +467,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
$BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
|
||||
|
||||
$arr['verb'] = ACTIVITY_FRIEND;
|
||||
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
|
||||
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
|
||||
$arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
|
||||
|
||||
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
|
||||
|
@ -489,13 +490,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$g = q("select def_gid from user where uid = %d limit 1",
|
||||
intval($uid)
|
||||
);
|
||||
if($contact && $g && intval($g[0]['def_gid'])) {
|
||||
$def_gid = get_default_group($uid, $contact["network"]);
|
||||
if($contact && intval($def_gid)) {
|
||||
require_once('include/group.php');
|
||||
group_add_member($uid,'',$contact['id'],$g[0]['def_gid']);
|
||||
group_add_member($uid, '', $contact['id'], $def_gid);
|
||||
}
|
||||
|
||||
// Let's send our user to the contact editor in case they want to
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once('include/items.php');
|
||||
require_once('include/dfrn.php');
|
||||
require_once('include/event.php');
|
||||
|
||||
require_once('library/defuse/php-encryption-1.2.1/Crypto.php');
|
||||
|
@ -208,7 +209,7 @@ function dfrn_notify_post(&$a) {
|
|||
logger('rino: decrypted data: ' . $data, LOGGER_DATA);
|
||||
}
|
||||
|
||||
$ret = local_delivery($importer,$data);
|
||||
$ret = dfrn::import($data, $importer);
|
||||
xml_status($ret);
|
||||
|
||||
// NOTREACHED
|
||||
|
|
|
@ -42,8 +42,10 @@ function dfrn_request_init(&$a) {
|
|||
if(! function_exists('dfrn_request_post')) {
|
||||
function dfrn_request_post(&$a) {
|
||||
|
||||
if(($a->argc != 2) || (! count($a->profile)))
|
||||
if(($a->argc != 2) || (! count($a->profile))) {
|
||||
logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(x($_POST, 'cancel')) {
|
||||
|
@ -172,18 +174,16 @@ function dfrn_request_post(&$a) {
|
|||
info( t("Introduction complete.") . EOL);
|
||||
}
|
||||
|
||||
$r = q("select id from contact where uid = %d and url = '%s' and `site-pubkey` = '%s' limit 1",
|
||||
$r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `site-pubkey` = '%s' LIMIT 1",
|
||||
intval(local_user()),
|
||||
dbesc($dfrn_url),
|
||||
$parms['key'] // this was already escaped
|
||||
);
|
||||
if(count($r)) {
|
||||
$g = q("select def_gid from user where uid = %d limit 1",
|
||||
intval(local_user())
|
||||
);
|
||||
if($g && intval($g[0]['def_gid'])) {
|
||||
$def_gid = get_default_group(local_user(), $r[0]["network"]);
|
||||
if(intval($def_gid)) {
|
||||
require_once('include/group.php');
|
||||
group_add_member(local_user(),'',$r[0]['id'],$g[0]['def_gid']);
|
||||
group_add_member(local_user(), '', $r[0]['id'], $def_gid);
|
||||
}
|
||||
$forwardurl = $a->get_baseurl()."/contacts/".$r[0]['id'];
|
||||
} else
|
||||
|
@ -386,19 +386,17 @@ function dfrn_request_post(&$a) {
|
|||
intval($rel)
|
||||
);
|
||||
|
||||
$r = q("select id from contact where poll = '%s' and uid = %d limit 1",
|
||||
$r = q("SELECT `id`, `network` FROM `contact` WHERE `poll` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($poll),
|
||||
intval($uid)
|
||||
);
|
||||
if(count($r)) {
|
||||
$contact_id = $r[0]['id'];
|
||||
|
||||
$g = q("select def_gid from user where uid = %d limit 1",
|
||||
intval($uid)
|
||||
);
|
||||
if($g && intval($g[0]['def_gid'])) {
|
||||
$def_gid = get_default_group($uid, $r[0]["network"]);
|
||||
if (intval($def_gid)) {
|
||||
require_once('include/group.php');
|
||||
group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
|
||||
group_add_member($uid, '', $contact_id, $def_gid);
|
||||
}
|
||||
|
||||
$photo = avatar_img($addr);
|
||||
|
@ -461,7 +459,7 @@ function dfrn_request_post(&$a) {
|
|||
$network = NETWORK_DFRN;
|
||||
}
|
||||
|
||||
logger('dfrn_request: url: ' . $url);
|
||||
logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
|
||||
|
||||
if($network === NETWORK_DFRN) {
|
||||
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
|
||||
|
@ -825,7 +823,7 @@ function dfrn_request_content(&$a) {
|
|||
else
|
||||
$tpl = get_markup_template('auto_request.tpl');
|
||||
|
||||
$page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:");
|
||||
$page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");
|
||||
|
||||
// see if we are allowed to have NETWORK_MAIL2 contacts
|
||||
|
||||
|
@ -850,7 +848,7 @@ function dfrn_request_content(&$a) {
|
|||
get_server()
|
||||
);
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
$o = replace_macros($tpl,array(
|
||||
'$header' => t('Friend/Connection Request'),
|
||||
'$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
|
||||
'$pls_answer' => t('Please answer the following:'),
|
||||
|
|
|
@ -104,7 +104,7 @@ function directory_content(&$a) {
|
|||
|
||||
$itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']);
|
||||
|
||||
$profile_link = z_root() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
||||
$profile_link = 'profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
|
||||
|
||||
$pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '<br />' : '');
|
||||
|
||||
|
@ -158,14 +158,14 @@ function directory_content(&$a) {
|
|||
else {
|
||||
$location_e = $location;
|
||||
}
|
||||
|
||||
|
||||
$photo_menu = array(array(t("View Profile"), zrl($profile_link)));
|
||||
|
||||
$entry = array(
|
||||
'id' => $rr['id'],
|
||||
'url' => $profile_link,
|
||||
'itemurl' => $itemurl,
|
||||
'thumb' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
|
||||
'thumb' => proxy_url($rr[$photo], false, PROXY_SIZE_THUMB),
|
||||
'img_hover' => $rr['name'],
|
||||
'name' => $rr['name'],
|
||||
'details' => $details,
|
||||
|
|
122
mod/display.php
122
mod/display.php
|
@ -17,7 +17,7 @@ function display_init(&$a) {
|
|||
// Does the local user have this item?
|
||||
if (local_user()) {
|
||||
$r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
||||
if (count($r)) {
|
||||
$nick = $a->user["nickname"];
|
||||
|
@ -30,12 +30,12 @@ function display_init(&$a) {
|
|||
$r = q("SELECT `user`.`nickname`, `item`.`id`, `item`.`parent`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`body`
|
||||
FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
AND `item`.`private` = 0 AND NOT `user`.`hidewall`
|
||||
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND `item`.`private` = 0 AND `item`.`wall` = 1
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
if (count($r)) {
|
||||
$nick = $r[0]["nickname"];
|
||||
$itemuid = $r[0]["uid"];
|
||||
|
@ -46,17 +46,17 @@ function display_init(&$a) {
|
|||
if ($nick == "") {
|
||||
$r = q("SELECT `item`.`id`, `item`.`parent`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`body`
|
||||
FROM `item` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
FROM `item` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
AND `item`.`private` = 0 AND `item`.`uid` = 0
|
||||
AND NOT `item`.`private` AND `item`.`uid` = 0
|
||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND `item`.`private` = 0 AND `item`.`wall` = 1
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
}
|
||||
if (count($r)) {
|
||||
if ($r[0]["id"] != $r[0]["parent"])
|
||||
$r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `id` = %d", $r[0]["parent"]);
|
||||
|
||||
$profiledata = display_fetchauthor($a, $r[0]);
|
||||
|
@ -67,7 +67,7 @@ function display_init(&$a) {
|
|||
if (($nickname != $a->user["nickname"])) {
|
||||
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
|
||||
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
|
||||
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1",
|
||||
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
|
||||
dbesc($nickname)
|
||||
);
|
||||
if (count($r))
|
||||
|
@ -120,27 +120,27 @@ function display_fetchauthor($a, $item) {
|
|||
}
|
||||
|
||||
if (!$skip) {
|
||||
$author = "";
|
||||
preg_match("/author='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$author = "";
|
||||
preg_match("/author='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
|
||||
|
||||
preg_match('/author="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
preg_match('/author="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
|
||||
|
||||
$profile = "";
|
||||
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profile = "";
|
||||
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profiledata["url"] = $matches[1];
|
||||
|
||||
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profiledata["url"] = $matches[1];
|
||||
|
||||
$avatar = "";
|
||||
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$avatar = "";
|
||||
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profiledata["photo"] = $matches[1];
|
||||
|
||||
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
|
||||
|
@ -257,7 +257,7 @@ function display_content(&$a, $update = 0) {
|
|||
|
||||
if (local_user()) {
|
||||
$r = q("SELECT `id` FROM `item`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
|
||||
if (count($r)) {
|
||||
$item_id = $r[0]["id"];
|
||||
|
@ -267,12 +267,12 @@ function display_content(&$a, $update = 0) {
|
|||
|
||||
if ($nick == "") {
|
||||
$r = q("SELECT `user`.`nickname`, `item`.`id` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
AND `item`.`private` = 0 AND NOT `user`.`hidewall`
|
||||
AND NOT `item`.`private` AND NOT `user`.`hidewall`
|
||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND `item`.`private` = 0 AND `item`.`wall` = 1
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
if (count($r)) {
|
||||
$item_id = $r[0]["id"];
|
||||
$nick = $r[0]["nickname"];
|
||||
|
@ -280,12 +280,12 @@ function display_content(&$a, $update = 0) {
|
|||
}
|
||||
if ($nick == "") {
|
||||
$r = q("SELECT `item`.`id` FROM `item`
|
||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||
AND `item`.`private` = 0 AND `item`.`uid` = 0
|
||||
AND NOT `item`.`private` AND `item`.`uid` = 0
|
||||
AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
|
||||
// AND `item`.`private` = 0 AND `item`.`wall` = 1
|
||||
// AND NOT `item`.`private` AND `item`.`wall`
|
||||
if (count($r)) {
|
||||
$item_id = $r[0]["id"];
|
||||
}
|
||||
|
@ -293,12 +293,22 @@ function display_content(&$a, $update = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
if(! $item_id) {
|
||||
if ($item_id AND !is_numeric($item_id)) {
|
||||
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($item_id), intval($a->profile['uid']));
|
||||
if ($r)
|
||||
$item_id = $r[0]["id"];
|
||||
else
|
||||
$item_id = false;
|
||||
}
|
||||
|
||||
if (!$item_id) {
|
||||
$a->error = 404;
|
||||
notice( t('Item not found.') . EOL);
|
||||
notice(t('Item not found.').EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$groups = array();
|
||||
|
||||
$contact = null;
|
||||
|
@ -334,7 +344,7 @@ function display_content(&$a, $update = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
||||
intval($a->profile['uid'])
|
||||
);
|
||||
if(count($r))
|
||||
|
@ -347,10 +357,8 @@ function display_content(&$a, $update = 0) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Why do we need this on the display page? We don't have the possibility to write new content here.
|
||||
// Ad editing of posts work without this as well.
|
||||
// We should remove this completely for the 3.5.1 release.
|
||||
/*
|
||||
// We need the editor here to be able to reshare an item.
|
||||
|
||||
if ($is_owner) {
|
||||
$x = array(
|
||||
'is_owner' => true,
|
||||
|
@ -366,66 +374,56 @@ function display_content(&$a, $update = 0) {
|
|||
);
|
||||
$o .= status_editor($a,$x,0,true);
|
||||
}
|
||||
*/
|
||||
|
||||
$sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
|
||||
|
||||
// AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' ))
|
||||
|
||||
if($update) {
|
||||
|
||||
$r = q("SELECT id FROM item WHERE item.uid = %d
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE (`id` = '%s' OR `uri` = '%s'))
|
||||
$sql_extra AND unseen = 1",
|
||||
intval($a->profile['uid']),
|
||||
dbesc($item_id),
|
||||
dbesc($item_id)
|
||||
$r = q("SELECT `id` FROM `item` WHERE `item`.`uid` = %d
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = %d)
|
||||
$sql_extra AND `unseen`",
|
||||
intval($a->profile['uid']),
|
||||
intval($item_id)
|
||||
);
|
||||
|
||||
if(!$r)
|
||||
return '';
|
||||
}
|
||||
|
||||
// AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' )
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE (`id` = '%s' OR `uri` = '%s')
|
||||
AND uid = %d)
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
|
||||
AND NOT `item`.`moderated`
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = %d)
|
||||
$sql_extra
|
||||
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC",
|
||||
intval($a->profile['uid']),
|
||||
dbesc($item_id),
|
||||
dbesc($item_id),
|
||||
intval($a->profile['uid'])
|
||||
intval($item_id)
|
||||
);
|
||||
|
||||
if(!$r && local_user()) {
|
||||
// Check if this is another person's link to a post that we have
|
||||
$r = q("SELECT `item`.uri FROM `item`
|
||||
WHERE (`item`.`id` = '%s' OR `item`.`uri` = '%s' )
|
||||
WHERE (`item`.`id` = %d OR `item`.`uri` = '%s')
|
||||
LIMIT 1",
|
||||
dbesc($item_id),
|
||||
intval($item_id),
|
||||
dbesc($item_id)
|
||||
);
|
||||
if($r) {
|
||||
$item_uri = $r[0]['uri'];
|
||||
// AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE `uri` = '%s' AND uid = %d )
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0
|
||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
|
||||
AND NOT `item`.`moderated`
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `uri` = '%s' AND uid = %d)
|
||||
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
|
||||
intval(local_user()),
|
||||
|
@ -440,7 +438,7 @@ function display_content(&$a, $update = 0) {
|
|||
|
||||
if((local_user()) && (local_user() == $a->profile['uid'])) {
|
||||
q("UPDATE `item` SET `unseen` = 0
|
||||
WHERE `parent` = %d AND `unseen` = 1",
|
||||
WHERE `parent` = %d AND `unseen`",
|
||||
intval($r[0]['parent'])
|
||||
);
|
||||
}
|
||||
|
|
|
@ -74,10 +74,18 @@ function fbrowser_content($a){
|
|||
$filename_e = $rr['filename'];
|
||||
}
|
||||
|
||||
// Take the largest picture that is smaller or equal 640 pixels
|
||||
$p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1",
|
||||
dbesc($rr['resource-id']));
|
||||
if ($p)
|
||||
$scale = $p[0]["scale"];
|
||||
else
|
||||
$scale = $rr['loq'];
|
||||
|
||||
return array(
|
||||
$a->get_baseurl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
|
||||
$filename_e,
|
||||
$a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.'. $ext
|
||||
$a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext
|
||||
);
|
||||
}
|
||||
$files = array_map("_map_files1", $r);
|
||||
|
|
|
@ -62,7 +62,7 @@ function help_content(&$a) {
|
|||
if ($filename !== "Home") {
|
||||
// create TOC but not for home
|
||||
$lines = explode("\n", $html);
|
||||
$toc="<style>aside ul {padding-left: 1em;}</style><h2>TOC</h2><ul id='toc'>";
|
||||
$toc="<style>aside ul {padding-left: 1em;}aside h1{font-size:2em}</style><h2>TOC</h2><ul id='toc'>";
|
||||
$lastlevel=1;
|
||||
$idnum = array(0,0,0,0,0,0,0);
|
||||
foreach($lines as &$line){
|
||||
|
@ -84,7 +84,7 @@ function help_content(&$a) {
|
|||
}
|
||||
}
|
||||
}
|
||||
for($k=1;$k<$lastlevel; $k++) $toc.="</ul>";
|
||||
for($k=0;$k<$lastlevel; $k++) $toc.="</ul>";
|
||||
$html = implode("\n",$lines);
|
||||
|
||||
$a->page['aside'] = $toc.$a->page['aside'];
|
||||
|
|
|
@ -77,6 +77,7 @@ function install_post(&$a) {
|
|||
$dbdata = notags(trim($_POST['dbdata']));
|
||||
$phpath = notags(trim($_POST['phpath']));
|
||||
$timezone = notags(trim($_POST['timezone']));
|
||||
$language = notags(trim($_POST['language']));
|
||||
$adminmail = notags(trim($_POST['adminmail']));
|
||||
|
||||
// connect to db
|
||||
|
@ -89,6 +90,7 @@ function install_post(&$a) {
|
|||
'$dbpass' => $dbpass,
|
||||
'$dbdata' => $dbdata,
|
||||
'$timezone' => $timezone,
|
||||
'$language' => $language,
|
||||
'$urlpath' => $urlpath,
|
||||
'$phpath' => $phpath,
|
||||
'$adminmail' => $adminmail
|
||||
|
@ -273,6 +275,8 @@ function install_content(&$a) {
|
|||
|
||||
$adminmail = notags(trim($_POST['adminmail']));
|
||||
$timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
|
||||
/* Installed langs */
|
||||
$lang_choices = get_avaiable_languages();
|
||||
|
||||
$tpl = get_markup_template('install_settings.tpl');
|
||||
$o .= replace_macros($tpl, array(
|
||||
|
@ -291,7 +295,7 @@ function install_content(&$a) {
|
|||
|
||||
|
||||
'$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''),
|
||||
|
||||
'$language' => array('language', t('System Language:'), 'en', t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices),
|
||||
'$baseurl' => $a->get_baseurl(),
|
||||
|
||||
|
||||
|
|
69
mod/item.php
69
mod/item.php
|
@ -24,6 +24,7 @@ require_once('include/threads.php');
|
|||
require_once('include/text.php');
|
||||
require_once('include/items.php');
|
||||
require_once('include/Scrape.php');
|
||||
require_once('include/diaspora.php');
|
||||
|
||||
function item_post(&$a) {
|
||||
|
||||
|
@ -160,6 +161,9 @@ function item_post(&$a) {
|
|||
logger('no contact found: '.print_r($thrparent, true), LOGGER_DEBUG);
|
||||
} else
|
||||
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG);
|
||||
|
||||
if ($parent_contact["nick"] == "")
|
||||
$parent_contact["nick"] = $parent_contact["name"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -844,9 +848,6 @@ function item_post(&$a) {
|
|||
// NOTREACHED
|
||||
}
|
||||
|
||||
// Store the guid and other relevant data
|
||||
add_guid($datarray);
|
||||
|
||||
$post_id = $r[0]['id'];
|
||||
logger('mod_item: saved item ' . $post_id);
|
||||
|
||||
|
@ -900,7 +901,7 @@ function item_post(&$a) {
|
|||
|
||||
|
||||
// Store the comment signature information in case we need to relay to Diaspora
|
||||
store_diaspora_comment_sig($datarray, $author, ($self ? $user['prvkey'] : false), $parent_item, $post_id);
|
||||
diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id);
|
||||
|
||||
} else {
|
||||
$parent = $post_id;
|
||||
|
@ -1064,10 +1065,11 @@ function item_content(&$a) {
|
|||
* the appropiate link.
|
||||
*
|
||||
* @param unknown_type $body the text to replace the tag in
|
||||
* @param unknown_type $inform a comma-seperated string containing everybody to inform
|
||||
* @param unknown_type $str_tags string to add the tag to
|
||||
* @param unknown_type $profile_uid
|
||||
* @param unknown_type $tag the tag to replace
|
||||
* @param string $inform a comma-seperated string containing everybody to inform
|
||||
* @param string $str_tags string to add the tag to
|
||||
* @param integer $profile_uid
|
||||
* @param string $tag the tag to replace
|
||||
* @param string $network The network of the post
|
||||
*
|
||||
* @return boolean true if replaced, false if not replaced
|
||||
*/
|
||||
|
@ -1175,7 +1177,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
//select someone from this user's contacts by name in the current network
|
||||
if (!$r AND ($network != ""))
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($newname),
|
||||
dbesc($name),
|
||||
dbesc($network),
|
||||
intval($profile_uid)
|
||||
);
|
||||
|
@ -1192,7 +1194,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
//select someone from this user's contacts by name
|
||||
if(!$r)
|
||||
$r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($newname),
|
||||
dbesc($name),
|
||||
intval($profile_uid)
|
||||
);
|
||||
}
|
||||
|
@ -1215,13 +1217,13 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
}
|
||||
|
||||
//if there is an url for this persons profile
|
||||
if(isset($profile)) {
|
||||
if (isset($profile) AND ($newname != "")) {
|
||||
|
||||
$replaced = true;
|
||||
//create profile link
|
||||
$profile = str_replace(',','%2c',$profile);
|
||||
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
|
||||
$body = str_replace('@' . $name, $newtag, $body);
|
||||
$newtag = '@[url='.$profile.']'.$newname.'[/url]';
|
||||
$body = str_replace('@'.$name, $newtag, $body);
|
||||
//append tag to str_tags
|
||||
if(! stristr($str_tags,$newtag)) {
|
||||
if(strlen($str_tags))
|
||||
|
@ -1233,7 +1235,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
|
||||
|
||||
if(strlen($alias)) {
|
||||
$newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
|
||||
$newtag = '@[url='.$alias.']'.$newname.'[/url]';
|
||||
if(! stristr($str_tags,$newtag)) {
|
||||
if(strlen($str_tags))
|
||||
$str_tags .= ',';
|
||||
|
@ -1245,42 +1247,3 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
|
|||
|
||||
return array('replaced' => $replaced, 'contact' => $r[0]);
|
||||
}
|
||||
|
||||
|
||||
function store_diaspora_comment_sig($datarray, $author, $uprvkey, $parent_item, $post_id) {
|
||||
// We won't be able to sign Diaspora comments for authenticated visitors - we don't have their private key
|
||||
|
||||
$enabled = intval(get_config('system','diaspora_enabled'));
|
||||
if(! $enabled) {
|
||||
logger('mod_item: diaspora support disabled, not storing comment signature', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
logger('mod_item: storing diaspora comment signature');
|
||||
|
||||
require_once('include/bb2diaspora.php');
|
||||
$signed_body = html_entity_decode(bb2diaspora($datarray['body']));
|
||||
|
||||
// Only works for NETWORK_DFRN
|
||||
$contact_baseurl_start = strpos($author['url'],'://') + 3;
|
||||
$contact_baseurl_length = strpos($author['url'],'/profile') - $contact_baseurl_start;
|
||||
$contact_baseurl = substr($author['url'], $contact_baseurl_start, $contact_baseurl_length);
|
||||
$diaspora_handle = $author['nick'] . '@' . $contact_baseurl;
|
||||
|
||||
$signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $diaspora_handle;
|
||||
|
||||
if( $uprvkey !== false )
|
||||
$authorsig = rsa_sign($signed_text,$uprvkey,'sha256');
|
||||
else
|
||||
$authorsig = '';
|
||||
|
||||
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
|
||||
intval($post_id),
|
||||
dbesc($signed_text),
|
||||
dbesc(base64_encode($authorsig)),
|
||||
dbesc($diaspora_handle)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ function message_init(&$a) {
|
|||
|
||||
$new = array(
|
||||
'label' => t('New Message'),
|
||||
'url' => $a->get_baseurl(true) . '/message/new',
|
||||
'url' => 'message/new',
|
||||
'sel'=> ($a->argv[1] == 'new'),
|
||||
'accesskey' => 'm',
|
||||
);
|
||||
|
@ -90,7 +90,7 @@ function message_post(&$a) {
|
|||
$a->argv[1] = 'new';
|
||||
}
|
||||
else
|
||||
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||
goaway($_SESSION['return_url']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ function message_content(&$a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname'];
|
||||
$myprofile = 'profile/' . $a->user['nickname'];
|
||||
|
||||
$tpl = get_markup_template('mail_head.tpl');
|
||||
$header = replace_macros($tpl, array(
|
||||
|
@ -221,7 +221,7 @@ function message_content(&$a) {
|
|||
}
|
||||
// Now check how the user responded to the confirmation query
|
||||
if($_REQUEST['canceled']) {
|
||||
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
|
||||
$cmd = $a->argv[1];
|
||||
|
@ -234,7 +234,7 @@ function message_content(&$a) {
|
|||
info( t('Message deleted.') . EOL );
|
||||
}
|
||||
//goaway($a->get_baseurl(true) . '/message' );
|
||||
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
|
@ -265,7 +265,7 @@ function message_content(&$a) {
|
|||
info( t('Conversation removed.') . EOL );
|
||||
}
|
||||
//goaway($a->get_baseurl(true) . '/message' );
|
||||
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ function message_content(&$a) {
|
|||
$sparkle = '';
|
||||
}
|
||||
else {
|
||||
$from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id'];
|
||||
$from_url = 'redir/' . $message['contact-id'];
|
||||
$sparkle = ' sparkle';
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ function render_messages($msg, $t) {
|
|||
$tpl = get_markup_template($t);
|
||||
$rslt = '';
|
||||
|
||||
$myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname'];
|
||||
$myprofile = 'profile/' . $a->user['nickname'];
|
||||
|
||||
foreach($msg as $rr) {
|
||||
|
||||
|
@ -577,7 +577,7 @@ function render_messages($msg, $t) {
|
|||
$rslt .= replace_macros($tpl, array(
|
||||
'$id' => $rr['id'],
|
||||
'$from_name' => $participants,
|
||||
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']),
|
||||
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? 'redir/' . $rr['contact-id'] : $rr['url']),
|
||||
'$sparkle' => ' sparkle',
|
||||
'$from_photo' => (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']),
|
||||
'$subject' => $subject_e,
|
||||
|
|
|
@ -62,7 +62,7 @@ function mood_init(&$a) {
|
|||
$action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]);
|
||||
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uid'] = $uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri);
|
||||
|
|
|
@ -114,7 +114,7 @@ function network_init(&$a) {
|
|||
require_once('include/group.php');
|
||||
require_once('include/contact_widgets.php');
|
||||
require_once('include/items.php');
|
||||
require_once('include/forums.php');
|
||||
require_once('include/ForumManager.php');
|
||||
|
||||
if(! x($a->page,'aside'))
|
||||
$a->page['aside'] = '';
|
||||
|
@ -148,11 +148,11 @@ function network_init(&$a) {
|
|||
}
|
||||
|
||||
$a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
|
||||
$a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist(local_user(),$cid) : '');
|
||||
$a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false);
|
||||
$a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
|
||||
$a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? ForumManager::widget(local_user(),$cid) : '');
|
||||
$a->page['aside'] .= posted_date_widget('network',local_user(),false);
|
||||
$a->page['aside'] .= networks_widget('network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
|
||||
$a->page['aside'] .= saved_searches($search);
|
||||
$a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : ''));
|
||||
$a->page['aside'] .= fileas_widget('network',(x($_GET, 'file') ? $_GET['file'] : ''));
|
||||
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ function network_content(&$a, $update = 0) {
|
|||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Commented Order'),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $all_active,
|
||||
'title' => t('Sort by Comment Date'),
|
||||
'id' => 'commented-order-tab',
|
||||
|
@ -371,7 +371,7 @@ function network_content(&$a, $update = 0) {
|
|||
),
|
||||
array(
|
||||
'label' => t('Posted Order'),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $postord_active,
|
||||
'title' => t('Sort by Post Date'),
|
||||
'id' => 'posted-order-tab',
|
||||
|
@ -382,7 +382,7 @@ function network_content(&$a, $update = 0) {
|
|||
if(feature_enabled(local_user(),'personal_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Personal'),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
|
||||
'sel' => $conv_active,
|
||||
'title' => t('Posts that mention or involve you'),
|
||||
'id' => 'personal-tab',
|
||||
|
@ -393,7 +393,7 @@ function network_content(&$a, $update = 0) {
|
|||
if(feature_enabled(local_user(),'new_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('New'),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
|
||||
'url' => str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
|
||||
'sel' => $new_active,
|
||||
'title' => t('Activity Stream - by date'),
|
||||
'id' => 'activitiy-by-date-tab',
|
||||
|
@ -404,7 +404,7 @@ function network_content(&$a, $update = 0) {
|
|||
if(feature_enabled(local_user(),'link_tab')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Shared Links'),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
|
||||
'sel' => $bookmarked_active,
|
||||
'title' => t('Interesting Links'),
|
||||
'id' => 'shared-links-tab',
|
||||
|
@ -415,7 +415,7 @@ function network_content(&$a, $update = 0) {
|
|||
if(feature_enabled(local_user(),'star_posts')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Starred'),
|
||||
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
|
||||
'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
|
||||
'sel' => $starred_active,
|
||||
'title' => t('Favourite Posts'),
|
||||
'id' => 'starred-posts-tab',
|
||||
|
@ -547,7 +547,7 @@ function network_content(&$a, $update = 0) {
|
|||
if($update)
|
||||
killme();
|
||||
notice( t('No such group') . EOL );
|
||||
goaway($a->get_baseurl(true) . '/network/0');
|
||||
goaway('network/0');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ function network_content(&$a, $update = 0) {
|
|||
}
|
||||
else {
|
||||
notice( t('Invalid contact.') . EOL);
|
||||
goaway($a->get_baseurl(true) . '/network');
|
||||
goaway('network');
|
||||
// NOTREACHED
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,13 +22,17 @@ function noscrape_init(&$a) {
|
|||
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
|
||||
$keywords = explode(',', $keywords);
|
||||
|
||||
$r = q("SELECT `photo` FROM `contact` WHERE `self` AND `uid` = %d",
|
||||
intval($a->profile['uid']));
|
||||
|
||||
$json_info = array(
|
||||
'fn' => $a->profile['name'],
|
||||
'addr' => $a->profile['addr'],
|
||||
'nick' => $which,
|
||||
'key' => $a->profile['pubkey'],
|
||||
'homepage' => $a->get_baseurl()."/profile/{$which}",
|
||||
'comm' => (x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY),
|
||||
'photo' => $a->profile['photo'],
|
||||
'photo' => $r[0]["photo"],
|
||||
'tags' => $keywords
|
||||
);
|
||||
|
||||
|
|
|
@ -49,12 +49,12 @@ function notifications_post(&$a) {
|
|||
intval(local_user())
|
||||
);
|
||||
}
|
||||
goaway($a->get_baseurl(true) . '/notifications/intros');
|
||||
goaway('notifications/intros');
|
||||
}
|
||||
if($_POST['submit'] == t('Ignore')) {
|
||||
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d",
|
||||
intval($intro_id));
|
||||
goaway($a->get_baseurl(true) . '/notifications/intros');
|
||||
goaway('notifications/intros');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,37 +79,37 @@ function notifications_content(&$a) {
|
|||
$tabs = array(
|
||||
array(
|
||||
'label' => t('System'),
|
||||
'url'=>$a->get_baseurl(true) . '/notifications/system',
|
||||
'url'=>'notifications/system',
|
||||
'sel'=> (($a->argv[1] == 'system') ? 'active' : ''),
|
||||
'accesskey' => 'y',
|
||||
),
|
||||
array(
|
||||
'label' => t('Network'),
|
||||
'url'=>$a->get_baseurl(true) . '/notifications/network',
|
||||
'url'=>'notifications/network',
|
||||
'sel'=> (($a->argv[1] == 'network') ? 'active' : ''),
|
||||
'accesskey' => 'w',
|
||||
),
|
||||
array(
|
||||
'label' => t('Personal'),
|
||||
'url'=>$a->get_baseurl(true) . '/notifications/personal',
|
||||
'url'=>'notifications/personal',
|
||||
'sel'=> (($a->argv[1] == 'personal') ? 'active' : ''),
|
||||
'accesskey' => 'r',
|
||||
),
|
||||
array(
|
||||
'label' => t('Home'),
|
||||
'url' => $a->get_baseurl(true) . '/notifications/home',
|
||||
'url' => 'notifications/home',
|
||||
'sel'=> (($a->argv[1] == 'home') ? 'active' : ''),
|
||||
'accesskey' => 'h',
|
||||
),
|
||||
array(
|
||||
'label' => t('Introductions'),
|
||||
'url' => $a->get_baseurl(true) . '/notifications/intros',
|
||||
'url' => 'notifications/intros',
|
||||
'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''),
|
||||
'accesskey' => 'i',
|
||||
),
|
||||
/*array(
|
||||
'label' => t('Messages'),
|
||||
'url' => $a->get_baseurl(true) . '/message',
|
||||
'url' => 'message',
|
||||
'sel'=> '',
|
||||
),*/ /*while I can have notifications for messages, this tablist is not place for message page link */
|
||||
);
|
||||
|
|
|
@ -1,43 +1,34 @@
|
|||
<?php
|
||||
require_once('include/NotificationsManager.php');
|
||||
|
||||
|
||||
function notify_init(&$a) {
|
||||
if(! local_user())
|
||||
return;
|
||||
|
||||
if(! local_user()) return;
|
||||
$nm = new NotificationsManager();
|
||||
|
||||
if($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) {
|
||||
$r = q("select * from notify where id = %d and uid = %d limit 1",
|
||||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if(count($r)) {
|
||||
q("update notify set seen = 1 where ( link = '%s' or ( parent != 0 and parent = %d and otype = '%s' )) and uid = %d",
|
||||
dbesc($r[0]['link']),
|
||||
intval($r[0]['parent']),
|
||||
dbesc($r[0]['otype']),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
$note = $nm->getByID($a->argv[2]);
|
||||
if ($note) {
|
||||
$nm->setSeen($note);
|
||||
|
||||
// The friendica client has problems with the GUID. this is some workaround
|
||||
if ($a->is_friendica_app()) {
|
||||
require_once("include/items.php");
|
||||
$urldata = parse_url($r[0]['link']);
|
||||
$urldata = parse_url($note['link']);
|
||||
$guid = basename($urldata["path"]);
|
||||
$itemdata = get_item_id($guid, local_user());
|
||||
if ($itemdata["id"] != 0)
|
||||
$r[0]['link'] = $a->get_baseurl().'/display/'.$itemdata["nick"].'/'.$itemdata["id"];
|
||||
$note['link'] = $a->get_baseurl().'/display/'.$itemdata["nick"].'/'.$itemdata["id"];
|
||||
}
|
||||
|
||||
goaway($r[0]['link']);
|
||||
goaway($note['link']);
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl(true));
|
||||
}
|
||||
|
||||
if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) {
|
||||
$r = q("update notify set seen = 1 where uid = %d",
|
||||
intval(local_user())
|
||||
);
|
||||
$r = $nm->setAllSeen();
|
||||
$j = json_encode(array('result' => ($r) ? 'success' : 'fail'));
|
||||
echo $j;
|
||||
killme();
|
||||
|
@ -45,38 +36,35 @@ function notify_init(&$a) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
function notify_content(&$a) {
|
||||
if(! local_user())
|
||||
return login();
|
||||
if(! local_user()) return login();
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
$nm = new NotificationsManager();
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
$not_tpl = get_markup_template('notify.tpl');
|
||||
require_once('include/bbcode.php');
|
||||
$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(true).'/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.');
|
||||
$r = $nm->getAll(array('seen'=>0));
|
||||
if ($r!==false && count($r) > 0) {
|
||||
foreach ($r as $it) {
|
||||
$notif_content .= replace_macros($not_tpl,array(
|
||||
'$item_link' => $a->get_baseurl(true).'/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,
|
||||
));
|
||||
$o .= replace_macros($notif_tpl, array(
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$tabs' => false, // $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@ function p_init($a){
|
|||
|
||||
$post = array();
|
||||
|
||||
$reshared = diaspora_is_reshare($item[0]["body"]);
|
||||
$reshared = diaspora::is_reshare($item[0]["body"]);
|
||||
|
||||
if ($reshared) {
|
||||
$nodename = "reshare";
|
||||
$post["root_diaspora_id"] = $reshared["root_handle"];
|
||||
$post["root_guid"] = $reshared["root_guid"];
|
||||
$post["guid"] = $item[0]["guid"];
|
||||
$post["diaspora_handle"] = diaspora_handle_from_contact($item[0]["contact-id"]);
|
||||
$post["diaspora_handle"] = diaspora::handle_from_contact($item[0]["contact-id"]);
|
||||
$post["public"] = (!$item[0]["private"] ? 'true':'false');
|
||||
$post["created_at"] = datetime_convert('UTC','UTC',$item[0]["created"]);
|
||||
} else {
|
||||
|
@ -48,7 +48,7 @@ function p_init($a){
|
|||
$nodename = "status_message";
|
||||
$post["raw_message"] = str_replace("&", "&", $body);
|
||||
$post["guid"] = $item[0]["guid"];
|
||||
$post["diaspora_handle"] = diaspora_handle_from_contact($item[0]["contact-id"]);
|
||||
$post["diaspora_handle"] = diaspora::handle_from_contact($item[0]["contact-id"]);
|
||||
$post["public"] = (!$item[0]["private"] ? 'true':'false');
|
||||
$post["created_at"] = datetime_convert('UTC','UTC',$item[0]["created"]);
|
||||
$post["provider_display_name"] = $item[0]["app"];
|
||||
|
|
|
@ -80,7 +80,7 @@ function photos_init(&$a) {
|
|||
$entry = array(
|
||||
'text' => $album['album'],
|
||||
'total' => $album['total'],
|
||||
'url' => z_root() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']),
|
||||
'url' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']),
|
||||
'urlencode' => urlencode($album['album']),
|
||||
'bin2hex' => bin2hex($album['album'])
|
||||
);
|
||||
|
@ -100,7 +100,7 @@ function photos_init(&$a) {
|
|||
'$recent' => t('Recent Photos'),
|
||||
'$albums' => $albums['albums'],
|
||||
'$baseurl' => z_root(),
|
||||
'$upload' => array( t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload'),
|
||||
'$upload' => array( t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'),
|
||||
'$can_post' => $can_post
|
||||
));
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ function photos_post(&$a) {
|
|||
$album = hex2bin($a->argv[3]);
|
||||
|
||||
if($album === t('Profile Photos') || $album === 'Contact Photos' || $album === t('Contact Photos')) {
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
goaway($_SESSION['photo_return']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -200,13 +200,13 @@ function photos_post(&$a) {
|
|||
);
|
||||
if(! count($r)) {
|
||||
notice( t('Album not found.') . EOL);
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
goaway($_SESSION['photo_return']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
// Check if the user has responded to a delete confirmation query
|
||||
if($_REQUEST['canceled']) {
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
goaway($_SESSION['photo_return']);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -221,7 +221,7 @@ function photos_post(&$a) {
|
|||
intval($page_owner_uid)
|
||||
);
|
||||
$newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']);
|
||||
goaway($a->get_baseurl() . '/' . $newurl);
|
||||
goaway($newurl);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ function photos_post(&$a) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
goaway($_SESSION['photo_return']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -309,14 +309,14 @@ function photos_post(&$a) {
|
|||
}
|
||||
}
|
||||
}
|
||||
goaway($a->get_baseurl() . '/photos/' . $a->data['user']['nickname']);
|
||||
goaway('photos/' . $a->data['user']['nickname']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
||||
// Check if the user has responded to a delete confirmation query for a single photo
|
||||
if(($a->argc > 2) && $_REQUEST['canceled']) {
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
goaway($_SESSION['photo_return']);
|
||||
}
|
||||
|
||||
if(($a->argc > 2) && (x($_POST,'delete')) && ($_POST['delete'] == t('Delete Photo'))) {
|
||||
|
@ -379,7 +379,7 @@ function photos_post(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl() . '/photos/' . $a->data['user']['nickname']);
|
||||
goaway('photos/' . $a->data['user']['nickname']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ function photos_post(&$a) {
|
|||
$uri = item_new_uri($a->get_hostname(),$page_owner_uid);
|
||||
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = $uri;
|
||||
|
@ -677,7 +677,7 @@ function photos_post(&$a) {
|
|||
$uri = item_new_uri($a->get_hostname(),$page_owner_uid);
|
||||
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = $uri;
|
||||
|
@ -718,12 +718,6 @@ function photos_post(&$a) {
|
|||
|
||||
$item_id = item_store($arr);
|
||||
if($item_id) {
|
||||
//q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
|
||||
// dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id),
|
||||
// intval($page_owner_uid),
|
||||
// intval($item_id)
|
||||
//);
|
||||
|
||||
proc_run('php',"include/notifier.php","tag","$item_id");
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +725,7 @@ function photos_post(&$a) {
|
|||
}
|
||||
|
||||
}
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
goaway($_SESSION['photo_return']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -910,6 +904,7 @@ function photos_post(&$a) {
|
|||
if($lat && $lon)
|
||||
$arr['coord'] = $lat . ' ' . $lon;
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = $uri;
|
||||
|
@ -938,14 +933,6 @@ function photos_post(&$a) {
|
|||
|
||||
$item_id = item_store($arr);
|
||||
|
||||
//if($item_id) {
|
||||
// q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
|
||||
// dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id),
|
||||
// intval($page_owner_uid),
|
||||
// intval($item_id)
|
||||
// );
|
||||
//}
|
||||
|
||||
if($visible)
|
||||
proc_run('php', "include/notifier.php", 'wall-new', $item_id);
|
||||
|
||||
|
@ -954,7 +941,7 @@ function photos_post(&$a) {
|
|||
// addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
|
||||
// if they do not wish to be redirected
|
||||
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
goaway($_SESSION['photo_return']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1125,7 +1112,7 @@ function photos_content(&$a) {
|
|||
|
||||
$uploader = '';
|
||||
|
||||
$ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'],
|
||||
$ret = array('post_url' => 'photos/' . $a->data['user']['nickname'],
|
||||
'addon_text' => $uploader,
|
||||
'default_upload' => true);
|
||||
|
||||
|
@ -1267,15 +1254,15 @@ function photos_content(&$a) {
|
|||
else {
|
||||
if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
|
||||
if($can_post) {
|
||||
$edit = array(t('Edit Album'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
|
||||
$edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_GET['order'] === 'posted')
|
||||
$order = array(t('Show Newest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album));
|
||||
$order = array(t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album));
|
||||
else
|
||||
$order = array(t('Show Oldest First'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted');
|
||||
$order = array(t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted');
|
||||
|
||||
$photos = array();
|
||||
|
||||
|
@ -1301,10 +1288,10 @@ function photos_content(&$a) {
|
|||
$photos[] = array(
|
||||
'id' => $rr['id'],
|
||||
'twist' => ' ' . $twist . rand(2,4),
|
||||
'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
|
||||
'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
|
||||
. (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''),
|
||||
'title' => t('View Photo'),
|
||||
'src' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
|
||||
'src' => 'photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
|
||||
'alt' => $imgalt_e,
|
||||
'desc'=> $desc_e,
|
||||
'ext' => $ext,
|
||||
|
@ -1317,7 +1304,7 @@ function photos_content(&$a) {
|
|||
'$photos' => $photos,
|
||||
'$album' => $album,
|
||||
'$can_post' => $can_post,
|
||||
'$upload' => array(t('Upload New Photos'), $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)),
|
||||
'$upload' => array(t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)),
|
||||
'$order' => $order,
|
||||
'$edit' => $edit
|
||||
));
|
||||
|
@ -1384,8 +1371,8 @@ function photos_content(&$a) {
|
|||
}
|
||||
}
|
||||
$edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
|
||||
$prevlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
|
||||
$nextlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
|
||||
$prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
|
||||
$nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
|
||||
}
|
||||
|
||||
|
||||
|
@ -1402,14 +1389,14 @@ function photos_content(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
$album_link = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']);
|
||||
$album_link = 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']);
|
||||
$tools = Null;
|
||||
$lock = Null;
|
||||
|
||||
if($can_post && ($ph[0]['uid'] == $owner_uid)) {
|
||||
$tools = array(
|
||||
'edit' => array($a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))),
|
||||
'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource-id'], t('Use as profile photo')),
|
||||
'edit' => array('photos/' . $a->data['user']['nickname'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))),
|
||||
'profile'=>array('profile_photo/use/'.$ph[0]['resource-id'], t('Use as profile photo')),
|
||||
);
|
||||
|
||||
// lock
|
||||
|
@ -1433,9 +1420,9 @@ function photos_content(&$a) {
|
|||
$prevlink = array($prevlink, '<div class="icon prev"></div>') ;
|
||||
|
||||
$photo = array(
|
||||
'href' => $a->get_baseurl() . '/photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
|
||||
'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
|
||||
'title'=> t('View Full Size'),
|
||||
'src' => $a->get_baseurl() . '/photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis'),
|
||||
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis'),
|
||||
'height' => $hires['height'],
|
||||
'width' => $hires['width'],
|
||||
'album' => $hires['album'],
|
||||
|
@ -1522,7 +1509,7 @@ function photos_content(&$a) {
|
|||
}
|
||||
$tags = array(t('Tags: '), $tag_str);
|
||||
if($cmd === 'edit') {
|
||||
$tags[] = $a->get_baseurl() . '/tagrm/' . $link_item['id'];
|
||||
$tags[] = 'tagrm/' . $link_item['id'];
|
||||
$tags[] = t('[Remove any tag]');
|
||||
}
|
||||
}
|
||||
|
@ -1693,7 +1680,7 @@ function photos_content(&$a) {
|
|||
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
|
||||
continue;
|
||||
|
||||
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
|
||||
$redirect_url = 'redir/' . $item['cid'] ;
|
||||
|
||||
|
||||
if(local_user() && ($item['contact-uid'] == local_user())
|
||||
|
@ -1880,12 +1867,12 @@ function photos_content(&$a) {
|
|||
$photos[] = array(
|
||||
'id' => $rr['id'],
|
||||
'twist' => ' ' . $twist . rand(2,4),
|
||||
'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
|
||||
'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
|
||||
'title' => t('View Photo'),
|
||||
'src' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
|
||||
'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
|
||||
'alt' => $alt_e,
|
||||
'album' => array(
|
||||
'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
|
||||
'link' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
|
||||
'name' => $name_e,
|
||||
'alt' => t('View Album'),
|
||||
),
|
||||
|
@ -1898,7 +1885,7 @@ function photos_content(&$a) {
|
|||
$o .= replace_macros($tpl, array(
|
||||
'$title' => t('Recent Photos'),
|
||||
'$can_post' => $can_post,
|
||||
'$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['user']['nickname'].'/upload'),
|
||||
'$upload' => array(t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'),
|
||||
'$photos' => $photos,
|
||||
));
|
||||
|
||||
|
|
34
mod/ping.php
34
mod/ping.php
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
require_once("include/datetime.php");
|
||||
require_once('include/bbcode.php');
|
||||
require_once('include/forums.php');
|
||||
require_once('include/ForumManager.php');
|
||||
require_once('include/group.php');
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
|
@ -96,7 +96,7 @@ function ping_init(&$a) {
|
|||
}
|
||||
|
||||
if(intval(feature_enabled(local_user(),'forumlist_widget'))) {
|
||||
$forums_unseen = forums_count_unseen();
|
||||
$forums_unseen = ForumManager::count_unseen_items();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,9 +205,9 @@ function ping_init(&$a) {
|
|||
$local_time = datetime_convert('UTC',date_default_timezone_get(),$n['date']);
|
||||
|
||||
call_hooks('ping_xmlize', $n);
|
||||
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" timestamp="%s" >%s</note>'."\n";
|
||||
return sprintf ( $notsxml,
|
||||
xmlify($n['href']), xmlify($n['name']), xmlify($n['url']), xmlify($n['photo']),
|
||||
$notsxml = '<note id="%d" href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" timestamp="%s" >%s</note>'."\n";
|
||||
return sprintf ( $notsxml, intval($n['id']),
|
||||
xmlify($n['href']), xmlify(xmlify($n['name'])), xmlify($n['url']), xmlify($n['photo']),
|
||||
xmlify(relative_date($n['date'])), xmlify($n['seen']), xmlify(strtotime($local_time)),
|
||||
xmlify($n['message'])
|
||||
);
|
||||
|
@ -219,19 +219,21 @@ function ping_init(&$a) {
|
|||
<home>$home</home>\r\n";
|
||||
if ($register!=0) echo "<register>$register</register>";
|
||||
|
||||
if ( count($groups_unseen) ) {
|
||||
if (count($groups_unseen)) {
|
||||
echo '<groups>';
|
||||
foreach ($groups_unseen as $it) {
|
||||
echo '<group id="' . $it['id'] . '">' . $it['count'] . "</group>";
|
||||
}
|
||||
foreach ($groups_unseen as $it)
|
||||
if ($it['count'] > 0)
|
||||
echo '<group id="'.$it['id'].'">'.$it['count']."</group>";
|
||||
|
||||
echo "</groups>";
|
||||
}
|
||||
|
||||
if ( count($forums_unseen) ) {
|
||||
if (count($forums_unseen)) {
|
||||
echo '<forums>';
|
||||
foreach ($forums_unseen as $it) {
|
||||
echo '<forum id="' . $it['id'] . '">' . $it['count'] . "</forum>";
|
||||
}
|
||||
foreach ($forums_unseen as $it)
|
||||
if ($it['count'] > 0)
|
||||
echo '<forum id="'.$it['id'].'">'.$it['count']."</forum>";
|
||||
|
||||
echo "</forums>";
|
||||
}
|
||||
|
||||
|
@ -389,7 +391,11 @@ function ping_get_notifications($uid) {
|
|||
// Replace the name with {0} but ensure to make that only once
|
||||
// The {0} is used later and prints the name in bold.
|
||||
|
||||
$pos = strpos($notification["message"],$notification['name']);
|
||||
if ($notification['name'] != "")
|
||||
$pos = strpos($notification["message"],$notification['name']);
|
||||
else
|
||||
$pos = false;
|
||||
|
||||
if ($pos !== false)
|
||||
$notification["message"] = substr_replace($notification["message"],"{0}",$pos,strlen($notification["name"]));
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ function poke_init(&$a) {
|
|||
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uid'] = $uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri);
|
||||
|
|
|
@ -16,7 +16,7 @@ function profiles_init(&$a) {
|
|||
);
|
||||
if(! count($r)) {
|
||||
notice( t('Profile not found.') . EOL);
|
||||
goaway($a->get_baseurl(true) . '/profiles');
|
||||
goaway('profiles');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,9 @@ function profiles_init(&$a) {
|
|||
intval(local_user())
|
||||
);
|
||||
if($r)
|
||||
info( t('Profile deleted.') . EOL);
|
||||
info(t('Profile deleted.').EOL);
|
||||
|
||||
goaway($a->get_baseurl(true) . '/profiles');
|
||||
goaway('profiles');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ function profiles_init(&$a) {
|
|||
|
||||
info( t('New profile created.') . EOL);
|
||||
if(count($r3) == 1)
|
||||
goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
|
||||
goaway('profiles/'.$r3[0]['id']);
|
||||
|
||||
goaway($a->get_baseurl(true) . '/profiles');
|
||||
goaway('profiles');
|
||||
}
|
||||
|
||||
if(($a->argc > 2) && ($a->argv[1] === 'clone')) {
|
||||
|
@ -116,9 +116,9 @@ function profiles_init(&$a) {
|
|||
);
|
||||
info( t('New profile created.') . EOL);
|
||||
if(count($r3) == 1)
|
||||
goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
|
||||
goaway('profiles/'.$r3[0]['id']);
|
||||
|
||||
goaway($a->get_baseurl(true) . '/profiles');
|
||||
goaway('profiles');
|
||||
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
@ -526,6 +526,8 @@ function profile_activity($changed, $value) {
|
|||
return;
|
||||
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user());
|
||||
$arr['uid'] = local_user();
|
||||
$arr['contact-id'] = $self[0]['id'];
|
||||
|
@ -582,15 +584,7 @@ function profile_activity($changed, $value) {
|
|||
|
||||
$i = item_store($arr);
|
||||
if($i) {
|
||||
|
||||
// give it a permanent link
|
||||
//q("update item set plink = '%s' where id = %d",
|
||||
// dbesc($a->get_baseurl() . '/display/' . $a->user['nickname'] . '/' . $i),
|
||||
// intval($i)
|
||||
//);
|
||||
|
||||
proc_run('php',"include/notifier.php","activity","$i");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -786,7 +780,7 @@ function profiles_content(&$a) {
|
|||
);
|
||||
if(count($r)){
|
||||
//Go to the default profile.
|
||||
goaway($a->get_baseurl(true) . '/profiles/'.$r[0]['id']);
|
||||
goaway('profiles/'.$r[0]['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -807,12 +801,12 @@ function profiles_content(&$a) {
|
|||
|
||||
foreach($r as $rr) {
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$photo' => $a->get_cached_avatar_image($rr['thumb']),
|
||||
'$photo' => $a->remove_baseurl($rr['thumb']),
|
||||
'$id' => $rr['id'],
|
||||
'$alt' => t('Profile Image'),
|
||||
'$profile_name' => $rr['profile-name'],
|
||||
'$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>'
|
||||
: '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
|
||||
: '<a href="'.'profperm/'.$rr['id'].'" />' . t('Edit visibility') . '</a>')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,8 +122,8 @@ function pubsub_post(&$a) {
|
|||
|
||||
$importer = $r[0];
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `subhub` = 1 AND `id` = %d AND `uid` = %d
|
||||
AND ( `rel` = %d OR `rel` = %d OR network = '%s' ) AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
|
||||
$r = q("SELECT * FROM `contact` WHERE `subhub` AND `id` = %d AND `uid` = %d
|
||||
AND (`rel` = %d OR `rel` = %d OR network = '%s') AND NOT `blocked` LIMIT 1",
|
||||
intval($contact_id),
|
||||
intval($importer['uid']),
|
||||
intval(CONTACT_IS_SHARING),
|
||||
|
|
|
@ -53,7 +53,7 @@ function receive_post(&$a) {
|
|||
|
||||
logger('mod-diaspora: message is okay', LOGGER_DEBUG);
|
||||
|
||||
$msg = diaspora_decode($importer,$xml);
|
||||
$msg = diaspora::decode($importer,$xml);
|
||||
|
||||
logger('mod-diaspora: decoded', LOGGER_DEBUG);
|
||||
|
||||
|
@ -65,10 +65,11 @@ function receive_post(&$a) {
|
|||
logger('mod-diaspora: dispatching', LOGGER_DEBUG);
|
||||
|
||||
$ret = 0;
|
||||
if($public)
|
||||
diaspora_dispatch_public($msg);
|
||||
else
|
||||
$ret = diaspora_dispatch($importer,$msg);
|
||||
if($public) {
|
||||
diaspora::dispatch_public($msg);
|
||||
} else {
|
||||
$ret = diaspora::dispatch($importer,$msg);
|
||||
}
|
||||
|
||||
http_status_exit(($ret) ? $ret : 200);
|
||||
// NOTREACHED
|
||||
|
|
|
@ -84,7 +84,7 @@ function salmon_post(&$a) {
|
|||
// decode the data
|
||||
$data = base64url_decode($data);
|
||||
|
||||
$author = ostatus_salmon_author($data,$importer);
|
||||
$author = ostatus::salmon_author($data,$importer);
|
||||
$author_link = $author["author-link"];
|
||||
|
||||
if(! $author_link) {
|
||||
|
@ -181,7 +181,7 @@ function salmon_post(&$a) {
|
|||
|
||||
$contact_rec = ((count($r)) ? $r[0] : null);
|
||||
|
||||
ostatus_import($data,$importer,$contact_rec, $hub);
|
||||
ostatus::import($data,$importer,$contact_rec, $hub);
|
||||
|
||||
http_status_exit(200);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ function search_content(&$a) {
|
|||
}
|
||||
|
||||
|
||||
$o .= search($search,'search-box','/search',((local_user()) ? true : false), false);
|
||||
$o .= search($search,'search-box','search',((local_user()) ? true : false), false);
|
||||
|
||||
if(strpos($search,'#') === 0) {
|
||||
$tag = true;
|
||||
|
@ -217,11 +217,10 @@ function search_content(&$a) {
|
|||
FROM `item`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||
AND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND (`item`.`private` OR NOT `item`.`network` IN ('%s', '%s', '%s'))))
|
||||
AND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND NOT `item`.`global`))
|
||||
$sql_extra
|
||||
GROUP BY `item`.`uri` ORDER BY `item`.`id` DESC LIMIT %d , %d ",
|
||||
intval(local_user()), dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA),
|
||||
intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
}
|
||||
|
||||
if(! count($r)) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once('include/group.php');
|
||||
|
||||
function get_theme_config_file($theme){
|
||||
$a = get_app();
|
||||
|
@ -39,7 +40,7 @@ function settings_init(&$a) {
|
|||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Account'),
|
||||
'url' => $a->get_baseurl(true).'/settings',
|
||||
'url' => 'settings',
|
||||
'selected' => (($a->argc == 1) && ($a->argv[0] === 'settings')?'active':''),
|
||||
'accesskey' => 'o',
|
||||
),
|
||||
|
@ -48,7 +49,7 @@ function settings_init(&$a) {
|
|||
if(get_features()) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Additional features'),
|
||||
'url' => $a->get_baseurl(true).'/settings/features',
|
||||
'url' => 'settings/features',
|
||||
'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''),
|
||||
'accesskey' => 't',
|
||||
);
|
||||
|
@ -56,49 +57,49 @@ function settings_init(&$a) {
|
|||
|
||||
$tabs[] = array(
|
||||
'label' => t('Display'),
|
||||
'url' => $a->get_baseurl(true).'/settings/display',
|
||||
'url' => 'settings/display',
|
||||
'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''),
|
||||
'accesskey' => 'i',
|
||||
);
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => t('Social Networks'),
|
||||
'url' => $a->get_baseurl(true).'/settings/connectors',
|
||||
'url' => 'settings/connectors',
|
||||
'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
|
||||
'accesskey' => 'w',
|
||||
);
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => t('Plugins'),
|
||||
'url' => $a->get_baseurl(true).'/settings/addon',
|
||||
'url' => 'settings/addon',
|
||||
'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
|
||||
'accesskey' => 'l',
|
||||
);
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => t('Delegations'),
|
||||
'url' => $a->get_baseurl(true).'/delegate',
|
||||
'url' => 'delegate',
|
||||
'selected' => (($a->argc == 1) && ($a->argv[0] === 'delegate')?'active':''),
|
||||
'accesskey' => 'd',
|
||||
);
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => t('Connected apps'),
|
||||
'url' => $a->get_baseurl(true) . '/settings/oauth',
|
||||
'url' => 'settings/oauth',
|
||||
'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
|
||||
'accesskey' => 'b',
|
||||
);
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => t('Export personal data'),
|
||||
'url' => $a->get_baseurl(true) . '/uexport',
|
||||
'url' => 'uexport',
|
||||
'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''),
|
||||
'accesskey' => 'e',
|
||||
);
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => t('Remove account'),
|
||||
'url' => $a->get_baseurl(true) . '/removeme',
|
||||
'url' => 'removeme',
|
||||
'selected' => (($a->argc == 1) && ($a->argv[0] === 'removeme')?'active':''),
|
||||
'accesskey' => 'r',
|
||||
);
|
||||
|
@ -199,6 +200,7 @@ function settings_post(&$a) {
|
|||
if(x($_POST, 'general-submit')) {
|
||||
set_pconfig(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening']));
|
||||
set_pconfig(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
|
||||
set_pconfig(local_user(), 'ostatus', 'default_group', $_POST['group-selection']);
|
||||
set_pconfig(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
|
||||
} elseif(x($_POST, 'imap-submit')) {
|
||||
|
||||
|
@ -342,7 +344,7 @@ function settings_post(&$a) {
|
|||
);
|
||||
|
||||
call_hooks('display_settings_post', $_POST);
|
||||
goaway($a->get_baseurl(true) . '/settings/display' );
|
||||
goaway('settings/display' );
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -351,7 +353,7 @@ function settings_post(&$a) {
|
|||
if (x($_POST,'resend_relocate')) {
|
||||
proc_run('php', 'include/notifier.php', 'relocate', local_user());
|
||||
info(t("Relocate message has been send to your contacts"));
|
||||
goaway($a->get_baseurl(true) . '/settings');
|
||||
goaway('settings');
|
||||
}
|
||||
|
||||
call_hooks('settings_post', $_POST);
|
||||
|
@ -627,7 +629,7 @@ function settings_post(&$a) {
|
|||
|
||||
}
|
||||
|
||||
goaway($a->get_baseurl(true) . '/settings' );
|
||||
goaway('settings' );
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -797,8 +799,11 @@ function settings_content(&$a) {
|
|||
$settings_connectors .= '<span class="field_help">'.t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.').'</span>';
|
||||
$settings_connectors .= '</div>';
|
||||
|
||||
$default_group = get_pconfig(local_user(), 'ostatus', 'default_group');
|
||||
$legacy_contact = get_pconfig(local_user(), 'ostatus', 'legacy_contact');
|
||||
|
||||
$settings_connectors .= mini_group_select(local_user(), $default_group, t("Default group for OStatus contacts"));
|
||||
|
||||
if ($legacy_contact != "")
|
||||
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL='.$a->get_baseurl().'/ostatus_subscribe?url='.urlencode($legacy_contact).'">';
|
||||
|
||||
|
@ -1152,7 +1157,7 @@ function settings_content(&$a) {
|
|||
info( t('Profile is <strong>not published</strong>.') . EOL );
|
||||
|
||||
|
||||
//$subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl(true) . '/profile/' . $nickname : '');
|
||||
//$subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . 'profile/' . $nickname : '');
|
||||
|
||||
$tpl_addr = get_markup_template("settings_nick_set.tpl");
|
||||
|
||||
|
|
|
@ -103,10 +103,11 @@ EOT;
|
|||
$bodyverb = t('%1$s is following %2$s\'s %3$s');
|
||||
|
||||
if(! isset($bodyverb))
|
||||
return;
|
||||
return;
|
||||
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uri'] = $uri;
|
||||
$arr['uid'] = $owner_uid;
|
||||
$arr['contact-id'] = $contact['id'];
|
||||
|
@ -123,7 +124,7 @@ EOT;
|
|||
$arr['author-name'] = $contact['name'];
|
||||
$arr['author-link'] = $contact['url'];
|
||||
$arr['author-avatar'] = $contact['thumb'];
|
||||
|
||||
|
||||
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
||||
$plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
|
||||
|
|
|
@ -95,12 +95,13 @@ EOT;
|
|||
$bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s');
|
||||
|
||||
if(! isset($bodyverb))
|
||||
return;
|
||||
return;
|
||||
|
||||
$termlink = html_entity_decode('⌗') . '[url=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]';
|
||||
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
$arr['uri'] = $uri;
|
||||
$arr['uid'] = $owner_uid;
|
||||
$arr['contact-id'] = $contact['id'];
|
||||
|
@ -115,7 +116,7 @@ EOT;
|
|||
$arr['author-name'] = $contact['name'];
|
||||
$arr['author-link'] = $contact['url'];
|
||||
$arr['author-avatar'] = $contact['thumb'];
|
||||
|
||||
|
||||
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
||||
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]';
|
||||
|
|
|
@ -6,54 +6,6 @@ function uexport_init(&$a){
|
|||
|
||||
require_once("mod/settings.php");
|
||||
settings_init($a);
|
||||
|
||||
/*
|
||||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Account settings'),
|
||||
'url' => $a->get_baseurl(true).'/settings',
|
||||
'selected' => '',
|
||||
),
|
||||
array(
|
||||
'label' => t('Display settings'),
|
||||
'url' => $a->get_baseurl(true).'/settings/display',
|
||||
'selected' =>'',
|
||||
),
|
||||
|
||||
array(
|
||||
'label' => t('Connector settings'),
|
||||
'url' => $a->get_baseurl(true).'/settings/connectors',
|
||||
'selected' => '',
|
||||
),
|
||||
array(
|
||||
'label' => t('Plugin settings'),
|
||||
'url' => $a->get_baseurl(true).'/settings/addon',
|
||||
'selected' => '',
|
||||
),
|
||||
array(
|
||||
'label' => t('Connected apps'),
|
||||
'url' => $a->get_baseurl(true) . '/settings/oauth',
|
||||
'selected' => '',
|
||||
),
|
||||
array(
|
||||
'label' => t('Export personal data'),
|
||||
'url' => $a->get_baseurl(true) . '/uexport',
|
||||
'selected' => 'active'
|
||||
),
|
||||
array(
|
||||
'label' => t('Remove account'),
|
||||
'url' => $a->get_baseurl(true) . '/removeme',
|
||||
'selected' => ''
|
||||
)
|
||||
);
|
||||
|
||||
$tabtpl = get_markup_template("generic_links_widget.tpl");
|
||||
$a->page['aside'] = replace_macros($tabtpl, array(
|
||||
'$title' => t('Settings'),
|
||||
'$class' => 'settings-widget',
|
||||
'$items' => $tabs,
|
||||
));
|
||||
*/
|
||||
}
|
||||
|
||||
function uexport_content(&$a){
|
||||
|
@ -74,8 +26,8 @@ function uexport_content(&$a){
|
|||
* list of array( 'link url', 'link text', 'help text' )
|
||||
*/
|
||||
$options = array(
|
||||
array('/uexport/account',t('Export account'),t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')),
|
||||
array('/uexport/backup',t('Export all'),t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')),
|
||||
array('uexport/account',t('Export account'),t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')),
|
||||
array('uexport/backup',t('Export all'),t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')),
|
||||
);
|
||||
call_hooks('uexport_options', $options);
|
||||
|
||||
|
@ -153,9 +105,9 @@ function uexport_account($a){
|
|||
'version' => FRIENDICA_VERSION,
|
||||
'schema' => DB_UPDATE_VERSION,
|
||||
'baseurl' => $a->get_baseurl(),
|
||||
'user' => $user,
|
||||
'contact' => $contact,
|
||||
'profile' => $profile,
|
||||
'user' => $user,
|
||||
'contact' => $contact,
|
||||
'profile' => $profile,
|
||||
'photo' => $photo,
|
||||
'pconfig' => $pconfig,
|
||||
'group' => $group,
|
||||
|
@ -171,8 +123,8 @@ function uexport_account($a){
|
|||
* echoes account data and items as separated json, one per line
|
||||
*/
|
||||
function uexport_all(&$a) {
|
||||
|
||||
uexport_account($a);
|
||||
|
||||
uexport_account($a);
|
||||
echo "\n";
|
||||
|
||||
$r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue