basic ssl_policy for important modules

This commit is contained in:
friendica 2012-03-14 21:20:20 -07:00
parent f0a62d8908
commit 110e8f2919
11 changed files with 140 additions and 130 deletions

View file

@ -186,6 +186,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
require_once('bbcode.php'); require_once('bbcode.php');
$ssl_state = ((local_user()) ? true : false);
$profile_owner = 0; $profile_owner = 0;
$page_writeable = false; $page_writeable = false;
@ -345,7 +347,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'like' => '', 'like' => '',
'dislike' => '', 'dislike' => '',
'comment' => '', 'comment' => '',
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), 'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
'previewing' => $previewing, 'previewing' => $previewing,
'wait' => t('Please wait'), 'wait' => t('Please wait'),
); );
@ -461,7 +463,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$comment_lastcollapsed = true; $comment_lastcollapsed = true;
} }
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; $redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ;
$lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|| strlen($item['deny_cid']) || strlen($item['deny_gid'])))) || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
@ -543,7 +545,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
} }
$edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes')) $edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
? array($a->get_baseurl()."/editpost/".$item['id'], t("Edit")) ? array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"))
: False); : False);
@ -697,7 +699,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$page_template = get_markup_template("conversation.tpl"); $page_template = get_markup_template("conversation.tpl");
$o .= replace_macros($page_template, array( $o .= replace_macros($page_template, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl($ssl_state),
'$mode' => $mode, '$mode' => $mode,
'$user' => $a->user, '$user' => $a->user,
'$threads' => $threads, '$threads' => $threads,
@ -707,7 +709,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
return $o; return $o;
}} }}
function best_link_url($item,&$sparkle) { function best_link_url($item,&$sparkle,$ssl_state = false) {
$a = get_app(); $a = get_app();
@ -719,7 +721,7 @@ function best_link_url($item,&$sparkle) {
if((local_user()) && (local_user() == $item['uid'])) { if((local_user()) && (local_user() == $item['uid'])) {
if(isset($a->contacts) && x($a->contacts,$clean_url)) { if(isset($a->contacts) && x($a->contacts,$clean_url)) {
if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) { if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
$best_url = $a->get_baseurl() . '/redir/' . $a->contacts[$clean_url]['id']; $best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id'];
$sparkle = true; $sparkle = true;
} }
else else
@ -740,10 +742,14 @@ function best_link_url($item,&$sparkle) {
if(! function_exists('item_photo_menu')){ if(! function_exists('item_photo_menu')){
function item_photo_menu($item){ function item_photo_menu($item){
$a = get_app(); $a = get_app();
if (local_user() && (! count($a->contacts)))
load_contact_links(local_user());
$ssl_state = false;
if(local_user()) {
$ssl_state = true;
if(! count($a->contacts))
load_contact_links(local_user());
}
$contact_url=""; $contact_url="";
$pm_url=""; $pm_url="";
$status_link=""; $status_link="";
@ -751,7 +757,7 @@ function item_photo_menu($item){
$posts_link=""; $posts_link="";
$sparkle = false; $sparkle = false;
$profile_link = best_link_url($item,$sparkle); $profile_link = best_link_url($item,$sparkle,$ssl_state);
if($profile_link === 'mailbox') if($profile_link === 'mailbox')
$profile_link = ''; $profile_link = '';
@ -760,7 +766,7 @@ function item_photo_menu($item){
$status_link = $profile_link . "?url=status"; $status_link = $profile_link . "?url=status";
$photos_link = $profile_link . "?url=photos"; $photos_link = $profile_link . "?url=photos";
$profile_link = $profile_link . "?url=profile"; $profile_link = $profile_link . "?url=profile";
$pm_url = $a->get_baseurl() . '/message/new/' . $cid; $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
} }
else { else {
if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) { if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
@ -771,8 +777,8 @@ function item_photo_menu($item){
} }
} }
if(($cid) && (! $item['self'])) { if(($cid) && (! $item['self'])) {
$contact_url = $a->get_baseurl() . '/contacts/' . $cid; $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
$posts_link = $a->get_baseurl() . '/network/?cid=' . $cid; $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid;
} }
$menu = Array( $menu = Array(
@ -808,7 +814,7 @@ function like_puller($a,$item,&$arr,$mode) {
if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) { if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
$url = $item['author-link']; $url = $item['author-link'];
if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) { if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
$url = $a->get_baseurl() . '/redir/' . $item['contact-id']; $url = $a->get_baseurl(true) . '/redir/' . $item['contact-id'];
$sparkle = ' class="sparkle" '; $sparkle = ' class="sparkle" ';
} }
if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l'])))) if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
@ -870,7 +876,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$a->page['htmlhead'] .= replace_macros($tpl, array( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$newpost' => 'true', '$newpost' => 'true',
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$nickname' => $x['nickname'],
@ -921,7 +927,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$return_path' => $a->cmd, '$return_path' => $a->cmd,
'$action' => $a->get_baseurl().'/item', '$action' => $a->get_baseurl(true) . '/item',
'$share' => (x($x,'button') ? $x['button'] : t('Share')), '$share' => (x($x,'button') ? $x['button'] : t('Share')),
'$upload' => t('Upload photo'), '$upload' => t('Upload photo'),
'$shortupload' => t('upload photo'), '$shortupload' => t('upload photo'),
@ -945,7 +951,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$ptyp' => (($notes_cid) ? 'note' : 'wall'), '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
'$content' => '', '$content' => '',
'$post_id' => '', '$post_id' => '',
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$defloc' => $x['default_location'], '$defloc' => $x['default_location'],
'$visitor' => $x['visitor'], '$visitor' => $x['visitor'],
'$pvisit' => (($notes_cid) ? 'none' : $x['visitor']), '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),

View file

@ -8,6 +8,8 @@ function nav(&$a) {
* *
*/ */
$ssl_state = ((local_user()) ? true : false);
if(!(x($a->page,'nav'))) if(!(x($a->page,'nav')))
$a->page['nav'] = ''; $a->page['nav'] = '';
@ -27,7 +29,7 @@ function nav(&$a) {
$myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : ''); $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
$sitelocation = $myident . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 ); $sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
// nav links: array of array('href', 'text', 'extra css classes', 'title') // nav links: array of array('href', 'text', 'extra css classes', 'title')
@ -53,7 +55,7 @@ function nav(&$a) {
// user info // user info
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid'])); $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
$userinfo = array( $userinfo = array(
'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"), 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl($ssl_state)."/images/default-profile-mm.jpg"),
'name' => $a->user['username'], 'name' => $a->user['username'],
); );
@ -76,7 +78,7 @@ function nav(&$a) {
if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user())) if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
$nav['register'] = array('register',t('Register'), "", t('Create an account')); $nav['register'] = array('register',t('Register'), "", t('Create an account'));
$help_url = $a->get_baseurl() . '/help'; $help_url = $a->get_baseurl($ssl_state) . '/help';
if(! get_config('system','hide_help')) if(! get_config('system','hide_help'))
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation')); $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));

View file

@ -37,7 +37,7 @@ function admin_post(&$a){
$func($a); $func($a);
} }
} }
goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] ); goaway($a->get_baseurl(true) . '/admin/plugins/' . $a->argv[2] );
return; // NOTREACHED return; // NOTREACHED
break; break;
case 'logs': case 'logs':
@ -49,7 +49,7 @@ function admin_post(&$a){
} }
} }
goaway($a->get_baseurl() . '/admin' ); goaway($a->get_baseurl(true) . '/admin' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -68,11 +68,11 @@ function admin_content(&$a) {
// array( url, name, extra css classes ) // array( url, name, extra css classes )
$aside = Array( $aside = Array(
'site' => Array($a->get_baseurl()."/admin/site/", t("Site") , "site"), 'site' => Array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"),
'users' => Array($a->get_baseurl()."/admin/users/", t("Users") , "users"), 'users' => Array($a->get_baseurl(true)."/admin/users/", t("Users") , "users"),
'plugins'=> Array($a->get_baseurl()."/admin/plugins/", t("Plugins") , "plugins"), 'plugins'=> Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
'themes' => Array($a->get_baseurl()."/admin/themes/", t("Themes") , "themes"), 'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
'update' => Array($a->get_baseurl()."/admin/update/", t("Update") , "update") 'update' => Array($a->get_baseurl(true)."/admin/update/", t("Update") , "update")
); );
/* get plugins admin page */ /* get plugins admin page */
@ -81,18 +81,18 @@ function admin_content(&$a) {
$aside['plugins_admin']=Array(); $aside['plugins_admin']=Array();
foreach ($r as $h){ foreach ($r as $h){
$plugin =$h['name']; $plugin =$h['name'];
$aside['plugins_admin'][] = Array($a->get_baseurl()."/admin/plugins/".$plugin, $plugin, "plugin"); $aside['plugins_admin'][] = Array($a->get_baseurl(true)."/admin/plugins/".$plugin, $plugin, "plugin");
// temp plugins with admin // temp plugins with admin
$a->plugins_admin[] = $plugin; $a->plugins_admin[] = $plugin;
} }
$aside['logs'] = Array($a->get_baseurl()."/admin/logs/", t("Logs"), "logs"); $aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs");
$t = get_markup_template("admin_aside.tpl"); $t = get_markup_template("admin_aside.tpl");
$a->page['aside'] = replace_macros( $t, array( $a->page['aside'] = replace_macros( $t, array(
'$admin' => $aside, '$admin' => $aside,
'$h_pending' => t('User registrations waiting for confirmation'), '$h_pending' => t('User registrations waiting for confirmation'),
'$admurl'=> $a->get_baseurl()."/admin/" '$admurl'=> $a->get_baseurl(true)."/admin/"
)); ));
@ -255,7 +255,7 @@ function admin_page_site_post(&$a){
set_config('system','diaspora_enabled', $diaspora_enabled); set_config('system','diaspora_enabled', $diaspora_enabled);
info( t('Site settings updated.') . EOL); info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl() . '/admin/site' ); goaway($a->get_baseurl(true) . '/admin/site' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -319,7 +319,7 @@ function admin_page_site(&$a) {
'$corporate' => t('Policies'), '$corporate' => t('Policies'),
'$advanced' => t('Advanced'), '$advanced' => t('Advanced'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
// name, label, value, help string, extra data... // name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""), '$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
@ -392,7 +392,7 @@ function admin_page_users_post(&$a){
user_deny($hash); user_deny($hash);
} }
} }
goaway($a->get_baseurl() . '/admin/users' ); goaway($a->get_baseurl(true) . '/admin/users' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -402,7 +402,7 @@ function admin_page_users(&$a){
$user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid)); $user = q("SELECT * FROM `user` WHERE `uid`=%d", intval($uid));
if (count($user)==0){ if (count($user)==0){
notice( 'User not found' . EOL); notice( 'User not found' . EOL);
goaway($a->get_baseurl() . '/admin/users' ); goaway($a->get_baseurl(true) . '/admin/users' );
return; // NOTREACHED return; // NOTREACHED
} }
switch($a->argv[2]){ switch($a->argv[2]){
@ -421,7 +421,7 @@ function admin_page_users(&$a){
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; }; break;
} }
goaway($a->get_baseurl() . '/admin/users' ); goaway($a->get_baseurl(true) . '/admin/users' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -500,7 +500,7 @@ function admin_page_users(&$a){
// values // // values //
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$pending' => $pending, '$pending' => $pending,
'$users' => $users, '$users' => $users,
@ -539,7 +539,7 @@ function admin_page_plugins(&$a){
info( sprintf( t("Plugin %s enabled."), $plugin ) ); info( sprintf( t("Plugin %s enabled."), $plugin ) );
} }
set_config("system","addon", implode(", ",$a->plugins)); set_config("system","addon", implode(", ",$a->plugins));
goaway($a->get_baseurl() . '/admin/plugins' ); goaway($a->get_baseurl(true) . '/admin/plugins' );
return; // NOTREACHED return; // NOTREACHED
} }
// display plugin details // display plugin details
@ -572,7 +572,7 @@ function admin_page_plugins(&$a){
'$page' => t('Plugins'), '$page' => t('Plugins'),
'$toggle' => t('Toggle'), '$toggle' => t('Toggle'),
'$settings' => t('Settings'), '$settings' => t('Settings'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$plugin' => $plugin, '$plugin' => $plugin,
'$status' => $status, '$status' => $status,
@ -610,7 +610,7 @@ function admin_page_plugins(&$a){
'$title' => t('Administration'), '$title' => t('Administration'),
'$page' => t('Plugins'), '$page' => t('Plugins'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$function' => 'plugins', '$function' => 'plugins',
'$plugins' => $plugins '$plugins' => $plugins
)); ));
@ -716,7 +716,7 @@ function admin_page_themes(&$a){
info( sprintf('Theme %s disabled.',$theme)); info( sprintf('Theme %s disabled.',$theme));
set_config('system','allowed_themes',$s); set_config('system','allowed_themes',$s);
goaway($a->get_baseurl() . '/admin/themes' ); goaway($a->get_baseurl(true) . '/admin/themes' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -745,7 +745,7 @@ function admin_page_themes(&$a){
'$page' => t('Themes'), '$page' => t('Themes'),
'$toggle' => t('Toggle'), '$toggle' => t('Toggle'),
'$settings' => t('Settings'), '$settings' => t('Settings'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$plugin' => $theme, '$plugin' => $theme,
'$status' => $status, '$status' => $status,
@ -777,7 +777,7 @@ function admin_page_themes(&$a){
'$title' => t('Administration'), '$title' => t('Administration'),
'$page' => t('Themes'), '$page' => t('Themes'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$function' => 'themes', '$function' => 'themes',
'$plugins' => $xthemes, '$plugins' => $xthemes,
'$experimental' => t('[Experimental]'), '$experimental' => t('[Experimental]'),
@ -805,7 +805,7 @@ function admin_page_logs_post(&$a) {
} }
info( t("Log settings updated.") ); info( t("Log settings updated.") );
goaway($a->get_baseurl() . '/admin/logs' ); goaway($a->get_baseurl(true) . '/admin/logs' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -859,7 +859,7 @@ readable.");
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$clear' => t('Clear'), '$clear' => t('Clear'),
'$data' => $data, '$data' => $data,
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$logname' => get_config('system','logfile'), '$logname' => get_config('system','logfile'),
// name, label, value, help string, extra data... // name, label, value, help string, extra data...
@ -904,7 +904,7 @@ function admin_page_remoteupdate(&$a) {
$tpl = get_markup_template("admin_remoteupdate.tpl"); $tpl = get_markup_template("admin_remoteupdate.tpl");
return replace_macros($tpl, array( return replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$submit' => t("Update now"), '$submit' => t("Update now"),
'$close' => t("Close"), '$close' => t("Close"),
'$localversion' => FRIENDICA_VERSION, '$localversion' => FRIENDICA_VERSION,

View file

@ -61,7 +61,7 @@ function contacts_post(&$a) {
if(! count($orig_record)) { if(! count($orig_record)) {
notice( t('Could not access contact record.') . EOL); notice( t('Could not access contact record.') . EOL);
goaway($a->get_baseurl() . '/contacts'); goaway($a->get_baseurl(true) . '/contacts');
return; // NOTREACHED return; // NOTREACHED
} }
@ -141,7 +141,7 @@ function contacts_content(&$a) {
if(! count($orig_record)) { if(! count($orig_record)) {
notice( t('Could not access contact record.') . EOL); notice( t('Could not access contact record.') . EOL);
goaway($a->get_baseurl() . '/contacts'); goaway($a->get_baseurl(true) . '/contacts');
return; // NOTREACHED return; // NOTREACHED
} }
@ -149,7 +149,7 @@ function contacts_content(&$a) {
// pull feed and consume it, which should subscribe to the hub. // pull feed and consume it, which should subscribe to the hub.
proc_run('php',"include/poller.php","$contact_id"); proc_run('php',"include/poller.php","$contact_id");
goaway($a->get_baseurl() . '/contacts/' . $contact_id); goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
// NOTREACHED // NOTREACHED
} }
@ -164,7 +164,7 @@ function contacts_content(&$a) {
//notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL ); //notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL );
info( (($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')) . EOL ); info( (($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')) . EOL );
} }
goaway($a->get_baseurl() . '/contacts/' . $contact_id); goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
return; // NOTREACHED return; // NOTREACHED
} }
@ -178,7 +178,7 @@ function contacts_content(&$a) {
if($r) { if($r) {
info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL ); info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL );
} }
goaway($a->get_baseurl() . '/contacts/' . $contact_id); goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
return; // NOTREACHED return; // NOTREACHED
} }
@ -220,9 +220,9 @@ function contacts_content(&$a) {
contact_remove($orig_record[0]['id']); contact_remove($orig_record[0]['id']);
info( t('Contact has been removed.') . EOL ); info( t('Contact has been removed.') . EOL );
if(x($_SESSION,'return_url')) if(x($_SESSION,'return_url'))
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
else else
goaway($a->get_baseurl() . '/contacts'); goaway($a->get_baseurl(true) . '/contacts');
return; // NOTREACHED return; // NOTREACHED
} }
} }
@ -233,7 +233,7 @@ function contacts_content(&$a) {
$contact = $a->data['contact']; $contact = $a->data['contact'];
$tpl = get_markup_template('contact_head.tpl'); $tpl = get_markup_template('contact_head.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
@ -295,17 +295,17 @@ function contacts_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => (($contact['blocked']) ? t('Unblock') : t('Block') ), 'label' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
'url' => $a->get_baseurl() . '/contacts/' . $contact_id . '/block', 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
'sel' => '', 'sel' => '',
), ),
array( array(
'label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), 'label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
'url' => $a->get_baseurl() . '/contacts/' . $contact_id . '/ignore', 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
'sel' => '', 'sel' => '',
), ),
array( array(
'label' => t('Repair'), 'label' => t('Repair'),
'url' => $a->get_baseurl() . '/crepair/' . $contact_id, 'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id,
'sel' => '', 'sel' => '',
) )
); );
@ -322,7 +322,7 @@ function contacts_content(&$a) {
'$lbl_info1' => t('Contact Information / Notes'), '$lbl_info1' => t('Contact Information / Notes'),
'$infedit' => t('Edit contact notes'), '$infedit' => t('Edit contact notes'),
'$common_text' => $common_text, '$common_text' => $common_text,
'$common_link' => $a->get_baseurl() . '/common/' . $contact['id'], '$common_link' => $a->get_baseurl(true) . '/common/' . $contact['id'],
'$all_friends' => $all_friends, '$all_friends' => $all_friends,
'$relation_text' => $relation_text, '$relation_text' => $relation_text,
'$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']), '$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']),
@ -397,30 +397,30 @@ function contacts_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => t('All Contacts'), 'label' => t('All Contacts'),
'url' => $a->get_baseurl() . '/contacts/all', 'url' => $a->get_baseurl(true) . '/contacts/all',
'sel' => ($all) ? 'active' : '', 'sel' => ($all) ? 'active' : '',
), ),
array( array(
'label' => t('Unblocked Contacts'), 'label' => t('Unblocked Contacts'),
'url' => $a->get_baseurl() . '/contacts', 'url' => $a->get_baseurl(true) . '/contacts',
'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '', 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored)) ? 'active' : '',
), ),
array( array(
'label' => t('Blocked Contacts'), 'label' => t('Blocked Contacts'),
'url' => $a->get_baseurl() . '/contacts/blocked', 'url' => $a->get_baseurl(true) . '/contacts/blocked',
'sel' => ($blocked) ? 'active' : '', 'sel' => ($blocked) ? 'active' : '',
), ),
array( array(
'label' => t('Ignored Contacts'), 'label' => t('Ignored Contacts'),
'url' => $a->get_baseurl() . '/contacts/ignored', 'url' => $a->get_baseurl(true) . '/contacts/ignored',
'sel' => ($ignored) ? 'active' : '', 'sel' => ($ignored) ? 'active' : '',
), ),
array( array(
'label' => t('Hidden Contacts'), 'label' => t('Hidden Contacts'),
'url' => $a->get_baseurl() . '/contacts/hidden', 'url' => $a->get_baseurl(true) . '/contacts/hidden',
'sel' => ($hidden) ? 'active' : '', 'sel' => ($hidden) ? 'active' : '',
), ),

View file

@ -74,7 +74,7 @@ function manage_post(&$a) {
if($limited_id) if($limited_id)
$_SESSION['submanage'] = $original_id; $_SESSION['submanage'] = $original_id;
goaway($a->get_baseurl() . '/profile/' . $a->user['nickname']); goaway($a->get_baseurl(true) . '/profile/' . $a->user['nickname']);
// NOTREACHED // NOTREACHED
} }

View file

@ -56,23 +56,23 @@ function message_content(&$a) {
return; return;
} }
$myprofile = $a->get_baseurl() . '/profile/' . $a->user['nickname']; $myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname'];
$tabs = array( $tabs = array(
array( array(
'label' => t('Inbox'), 'label' => t('Inbox'),
'url'=> $a->get_baseurl() . '/message', 'url'=> $a->get_baseurl(true) . '/message',
'sel'=> (($a->argc == 1) ? 'active' : ''), 'sel'=> (($a->argc == 1) ? 'active' : ''),
), ),
array( array(
'label' => t('Outbox'), 'label' => t('Outbox'),
'url' => $a->get_baseurl() . '/message/sent', 'url' => $a->get_baseurl(true) . '/message/sent',
'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''),
), ),
array( array(
'label' => t('New Message'), 'label' => t('New Message'),
'url' => $a->get_baseurl() . '/message/new', 'url' => $a->get_baseurl(true) . '/message/new',
'sel'=> (($a->argv[1] == 'new') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'new') ? 'active' : ''),
), ),
); );
@ -99,7 +99,7 @@ function message_content(&$a) {
if($r) { if($r) {
info( t('Message deleted.') . EOL ); info( t('Message deleted.') . EOL );
} }
goaway($a->get_baseurl() . '/message' ); goaway($a->get_baseurl(true) . '/message' );
} }
else { else {
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@ -129,7 +129,7 @@ function message_content(&$a) {
if($r) if($r)
info( t('Conversation removed.') . EOL ); info( t('Conversation removed.') . EOL );
} }
goaway($a->get_baseurl() . '/message' ); goaway($a->get_baseurl(true) . '/message' );
} }
} }
@ -146,7 +146,7 @@ function message_content(&$a) {
$tpl = get_markup_template('msg-header.tpl'); $tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => t('Please enter a link URL:')
@ -210,7 +210,7 @@ function message_content(&$a) {
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$id' => $rr['id'], '$id' => $rr['id'],
'$from_name' =>$rr['from-name'], '$from_name' =>$rr['from-name'],
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl() . '/redir/' . $rr['contact-id'] : $rr['url']), '$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']),
'$sparkle' => ' sparkle', '$sparkle' => ' sparkle',
'$from_photo' => $rr['thumb'], '$from_photo' => $rr['thumb'],
'$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>')), '$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>')),
@ -267,7 +267,7 @@ function message_content(&$a) {
$a->page['htmlhead'] .= replace_macros($tpl, array( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$baseurl' => $a->get_baseurl() '$baseurl' => $a->get_baseurl(true)
)); ));
@ -278,7 +278,7 @@ function message_content(&$a) {
$sparkle = ''; $sparkle = '';
} }
else { else {
$from_url = $a->get_baseurl() . '/redir/' . $message['contact-id']; $from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id'];
$sparkle = ' sparkle'; $sparkle = ' sparkle';
} }
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(

View file

@ -44,14 +44,16 @@ function network_init(&$a) {
} }
$a->page['aside'] .= group_side('network','network',true,$group_id); $a->page['aside'] .= group_side('network','network',true,$group_id);
$a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search); $a->page['aside'] .= saved_searches($search);
$a->page['aside'] .= fileas_widget($a->get_baseurl() . '/network',(x($_GET, 'file') ? $_GET['file'] : '')); $a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : ''));
} }
function saved_searches($search) { function saved_searches($search) {
$a = get_app();
$srchurl = '/network?f=' $srchurl = '/network?f='
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '') . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
@ -88,7 +90,7 @@ function saved_searches($search) {
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$title' => t('Saved Searches'), '$title' => t('Saved Searches'),
'$add' => t('add'), '$add' => t('add'),
'$searchbox' => search($search,'netsearch-box',$srchurl,true), '$searchbox' => search($search,'netsearch-box',$a->get_baseurl(true) . $srchurl,true),
'$saved' => $saved, '$saved' => $saved,
)); ));
@ -167,38 +169,38 @@ function network_content(&$a, $update = 0) {
$tabs = array( $tabs = array(
array( array(
'label' => t('Commented Order'), 'label' => t('Commented Order'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''), 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?f=&cid=' . $_GET['cid'] : ''),
'sel'=>$all_active, 'sel'=>$all_active,
), ),
array( array(
'label' => t('Posted Order'), 'label' => t('Posted Order'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
'sel'=>$postord_active, 'sel'=>$postord_active,
), ),
array( array(
'label' => t('Personal'), 'label' => t('Personal'),
'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1', 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
'sel' => $conv_active, 'sel' => $conv_active,
), ),
array( array(
'label' => t('New'), 'label' => t('New'),
'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
'sel' => $new_active, 'sel' => $new_active,
), ),
array( array(
'label' => t('Starred'), 'label' => t('Starred'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1', 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
'sel'=>$starred_active, 'sel'=>$starred_active,
), ),
array( array(
'label' => t('Shared Links'), 'label' => t('Shared Links'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1', 'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&bmark=1',
'sel'=>$bookmarked_active, 'sel'=>$bookmarked_active,
), ),
// array( // array(
// 'label' => t('Spam'), // 'label' => t('Spam'),
// 'url'=>$a->get_baseurl() . '/network?f=&spam=1' // 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1'
// 'sel'=> $spam_active, // 'sel'=> $spam_active,
// ), // ),
@ -300,7 +302,7 @@ function network_content(&$a, $update = 0) {
if($update) if($update)
killme(); killme();
notice( t('No such group') . EOL ); notice( t('No such group') . EOL );
goaway($a->get_baseurl() . '/network'); goaway($a->get_baseurl(true) . '/network');
// NOTREACHED // NOTREACHED
} }
@ -332,7 +334,7 @@ function network_content(&$a, $update = 0) {
} }
else { else {
notice( t('Invalid contact.') . EOL); notice( t('Invalid contact.') . EOL);
goaway($a->get_baseurl() . '/network'); goaway($a->get_baseurl(true) . '/network');
// NOTREACHED // NOTREACHED
} }
} }

View file

@ -42,12 +42,12 @@ function notifications_post(&$a) {
intval(local_user()) intval(local_user())
); );
} }
goaway($a->get_baseurl() . '/notifications/intros'); goaway($a->get_baseurl(true) . '/notifications/intros');
} }
if($_POST['submit'] == t('Ignore')) { if($_POST['submit'] == t('Ignore')) {
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1", $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
intval($intro_id)); intval($intro_id));
goaway($a->get_baseurl() . '/notifications/intros'); goaway($a->get_baseurl(true) . '/notifications/intros');
} }
} }
} }
@ -69,32 +69,32 @@ function notifications_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => t('System'), 'label' => t('System'),
'url'=>$a->get_baseurl() . '/notifications/system', 'url'=>$a->get_baseurl(true) . '/notifications/system',
'sel'=> (($a->argv[1] == 'system') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'system') ? 'active' : ''),
), ),
array( array(
'label' => t('Network'), 'label' => t('Network'),
'url'=>$a->get_baseurl() . '/notifications/network', 'url'=>$a->get_baseurl(true) . '/notifications/network',
'sel'=> (($a->argv[1] == 'network') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'network') ? 'active' : ''),
), ),
array( array(
'label' => t('Personal'), 'label' => t('Personal'),
'url'=>$a->get_baseurl() . '/notifications/personal', 'url'=>$a->get_baseurl(true) . '/notifications/personal',
'sel'=> (($a->argv[1] == 'personal') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'personal') ? 'active' : ''),
), ),
array( array(
'label' => t('Home'), 'label' => t('Home'),
'url' => $a->get_baseurl() . '/notifications/home', 'url' => $a->get_baseurl(true) . '/notifications/home',
'sel'=> (($a->argv[1] == 'home') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'home') ? 'active' : ''),
), ),
array( array(
'label' => t('Introductions'), 'label' => t('Introductions'),
'url' => $a->get_baseurl() . '/notifications/intros', 'url' => $a->get_baseurl(true) . '/notifications/intros',
'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''), 'sel'=> (($a->argv[1] == 'intros') ? 'active' : ''),
), ),
array( array(
'label' => t('Messages'), 'label' => t('Messages'),
'url' => $a->get_baseurl() . '/message', 'url' => $a->get_baseurl(true) . '/message',
'sel'=> '', 'sel'=> '',
), ),
); );
@ -244,7 +244,7 @@ function notifications_content(&$a) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -253,7 +253,7 @@ function notifications_content(&$a) {
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -267,7 +267,7 @@ function notifications_content(&$a) {
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -281,7 +281,7 @@ function notifications_content(&$a) {
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments); $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array( $notif_content .= replace_macros($tpl,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => $item_text, '$item_text' => $item_text,
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -314,7 +314,7 @@ function notifications_content(&$a) {
if (count($r) > 0) { if (count($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array( $notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'], '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
'$item_image' => $it['photo'], '$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])), '$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date']) '$item_when' => relative_date($it['date'])
@ -334,7 +334,7 @@ function notifications_content(&$a) {
$notif_tpl = get_markup_template('notifications.tpl'); $notif_tpl = get_markup_template('notifications.tpl');
$myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname']; $myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl);
@ -369,7 +369,7 @@ function notifications_content(&$a) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -378,7 +378,7 @@ function notifications_content(&$a) {
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -392,7 +392,7 @@ function notifications_content(&$a) {
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -406,7 +406,7 @@ function notifications_content(&$a) {
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments); $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array( $notif_content .= replace_macros($tpl,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => $item_text, '$item_text' => $item_text,
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -456,7 +456,7 @@ function notifications_content(&$a) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -465,7 +465,7 @@ function notifications_content(&$a) {
break; break;
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -479,7 +479,7 @@ function notifications_content(&$a) {
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -488,7 +488,7 @@ function notifications_content(&$a) {
break; break;
default: default:
$notif_content .= replace_macros($tpl_item_comments,array( $notif_content .= replace_macros($tpl_item_comments,array(
'$item_link' => $a->get_baseurl().'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])

View file

@ -20,7 +20,7 @@ function notify_init(&$a) {
goaway($r[0]['link']); goaway($r[0]['link']);
} }
goaway($a->get_baseurl()); goaway($a->get_baseurl(true));
} }
if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) {
@ -51,7 +51,7 @@ function notify_content(&$a) {
if (count($r) > 0) { if (count($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array( $notif_content .= replace_macros($not_tpl,array(
'$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'], '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
'$item_image' => $it['photo'], '$item_image' => $it['photo'],
'$item_text' => strip_tags(bbcode($it['msg'])), '$item_text' => strip_tags(bbcode($it['msg'])),
'$item_when' => relative_date($it['date']) '$item_when' => relative_date($it['date'])

View file

@ -240,7 +240,7 @@ function profiles_content(&$a) {
); );
if(! count($r)) { if(! count($r)) {
notice( t('Profile not found.') . EOL); notice( t('Profile not found.') . EOL);
goaway($a->get_baseurl() . '/profiles'); goaway($a->get_baseurl(true) . '/profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -260,7 +260,7 @@ function profiles_content(&$a) {
if($r) if($r)
info( t('Profile deleted.') . EOL); info( t('Profile deleted.') . EOL);
goaway($a->get_baseurl() . '/profiles'); goaway($a->get_baseurl(true) . '/profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -297,9 +297,9 @@ function profiles_content(&$a) {
info( t('New profile created.') . EOL); info( t('New profile created.') . EOL);
if(count($r3) == 1) if(count($r3) == 1)
goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']); goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
goaway($a->get_baseurl() . '/profiles'); goaway($a->get_baseurl(true) . '/profiles');
} }
if(($a->argc > 2) && ($a->argv[1] === 'clone')) { if(($a->argc > 2) && ($a->argv[1] === 'clone')) {
@ -339,9 +339,9 @@ function profiles_content(&$a) {
); );
info( t('New profile created.') . EOL); info( t('New profile created.') . EOL);
if(count($r3) == 1) if(count($r3) == 1)
goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']); goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
goaway($a->get_baseurl() . '/profiles'); goaway($a->get_baseurl(true) . '/profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -373,7 +373,7 @@ function profiles_content(&$a) {
)); ));
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
$a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"js/country.js\" ></script>"; $a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"js/country.js\" ></script>";
$f = get_config('system','birthday_input_format'); $f = get_config('system','birthday_input_format');
@ -425,7 +425,7 @@ function profiles_content(&$a) {
'$lbl_work' => t('Work/employment'), '$lbl_work' => t('Work/employment'),
'$lbl_school' => t('School/education'), '$lbl_school' => t('School/education'),
'$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$profile_id' => $r[0]['id'], '$profile_id' => $r[0]['id'],
'$profile_name' => $r[0]['profile-name'], '$profile_name' => $r[0]['profile-name'],
'$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""), '$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""),
@ -489,7 +489,7 @@ function profiles_content(&$a) {
'$alt' => t('Profile Image'), '$alt' => t('Profile Image'),
'$profile_name' => $rr['profile-name'], '$profile_name' => $rr['profile-name'],
'$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>' '$visible' => (($rr['is-default']) ? '<strong>' . t('visible to everybody') . '</strong>'
: '<a href="' . $a->get_baseurl() . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>') : '<a href="' . $a->get_baseurl(true) . '/profperm/' . $rr['id'] . '" />' . t('Edit visibility') . '</a>')
)); ));
} }
} }

View file

@ -59,7 +59,7 @@ function settings_post(&$a) {
q("DELETE FROM tokens WHERE id='%s' AND uid=%d", q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
dbesc($key), dbesc($key),
local_user()); local_user());
goaway($a->get_baseurl()."/settings/oauth/"); goaway($a->get_baseurl(true)."/settings/oauth/");
return; return;
} }
@ -104,7 +104,7 @@ function settings_post(&$a) {
local_user()); local_user());
} }
} }
goaway($a->get_baseurl()."/settings/oauth/"); goaway($a->get_baseurl(true)."/settings/oauth/");
return; return;
} }
@ -411,7 +411,7 @@ function settings_post(&$a) {
} }
goaway($a->get_baseurl() . '/settings' ); goaway($a->get_baseurl(true) . '/settings' );
return; // NOTREACHED return; // NOTREACHED
} }
@ -435,27 +435,27 @@ function settings_content(&$a) {
$tabs = array( $tabs = array(
array( array(
'label' => t('Account settings'), 'label' => t('Account settings'),
'url' => $a->get_baseurl().'/settings', 'url' => $a->get_baseurl(true).'/settings',
'sel' => (($a->argc == 1)?'active':''), 'sel' => (($a->argc == 1)?'active':''),
), ),
array( array(
'label' => t('Connector settings'), 'label' => t('Connector settings'),
'url' => $a->get_baseurl().'/settings/connectors', 'url' => $a->get_baseurl(true).'/settings/connectors',
'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), 'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''),
), ),
array( array(
'label' => t('Plugin settings'), 'label' => t('Plugin settings'),
'url' => $a->get_baseurl().'/settings/addon', 'url' => $a->get_baseurl(true).'/settings/addon',
'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), 'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
), ),
array( array(
'label' => t('Connections'), 'label' => t('Connections'),
'url' => $a->get_baseurl() . '/settings/oauth', 'url' => $a->get_baseurl(true) . '/settings/oauth',
'sel' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''), 'sel' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''),
), ),
array( array(
'label' => t('Export personal data'), 'label' => t('Export personal data'),
'url' => $a->get_baseurl() . '/uexport', 'url' => $a->get_baseurl(true) . '/uexport',
'sel' => '' 'sel' => ''
) )
); );
@ -517,7 +517,7 @@ function settings_content(&$a) {
$r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d", $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d",
dbesc($a->argv[3]), dbesc($a->argv[3]),
local_user()); local_user());
goaway($a->get_baseurl()."/settings/oauth/"); goaway($a->get_baseurl(true)."/settings/oauth/");
return; return;
} }
@ -533,7 +533,7 @@ function settings_content(&$a) {
$tpl = get_markup_template("settings_oauth.tpl"); $tpl = get_markup_template("settings_oauth.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_oauth"), '$form_security_token' => get_form_security_token("settings_oauth"),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$title' => t('Connected Apps'), '$title' => t('Connected Apps'),
'$add' => t('Add application'), '$add' => t('Add application'),
'$edit' => t('Edit'), '$edit' => t('Edit'),
@ -789,7 +789,7 @@ function settings_content(&$a) {
$theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']); $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
$subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl() . '/profile/' . $nickname : ''); $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl(true) . '/profile/' . $nickname : '');
$tpl_addr = get_markup_template("settings_nick_set.tpl"); $tpl_addr = get_markup_template("settings_nick_set.tpl");
@ -819,7 +819,7 @@ function settings_content(&$a) {
'$ptitle' => t('Account Settings'), '$ptitle' => t('Account Settings'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(true),
'$uid' => local_user(), '$uid' => local_user(),
'$form_security_token' => get_form_security_token("settings"), '$form_security_token' => get_form_security_token("settings"),