'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'
';
+ }
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
@@ -41,5 +46,4 @@ function home_content(&$a) {
return $o;
-
}}
diff --git a/mod/ignored.php b/mod/ignored.php
index ba55c55e3..5e8411e37 100644
--- a/mod/ignored.php
+++ b/mod/ignored.php
@@ -5,22 +5,27 @@ function ignored_init(&$a) {
$ignored = 0;
- if(! local_user())
+ if (! local_user()) {
killme();
- if($a->argc > 1)
+ }
+ if ($a->argc > 1) {
$message_id = intval($a->argv[1]);
- if(! $message_id)
+ }
+ if (! $message_id) {
killme();
+ }
$r = q("SELECT `ignored` FROM `thread` WHERE `uid` = %d AND `iid` = %d LIMIT 1",
intval(local_user()),
intval($message_id)
);
- if(! dbm::is_result($r))
+ if (! dbm::is_result($r)) {
killme();
+ }
- if(! intval($r[0]['ignored']))
+ if (! intval($r[0]['ignored'])) {
$ignored = 1;
+ }
$r = q("UPDATE `thread` SET `ignored` = %d WHERE `uid` = %d and `iid` = %d",
intval($ignored),
@@ -30,12 +35,12 @@ function ignored_init(&$a) {
// See if we've been passed a return path to redirect to
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
- if($return_path) {
+ if ($return_path) {
$rand = '_=' . time();
if(strpos($return_path, '?')) $rand = "&$rand";
else $rand = "?$rand";
- goaway($a->get_baseurl() . "/" . $return_path . $rand);
+ goaway(App::get_baseurl() . "/" . $return_path . $rand);
}
// the json doesn't really matter, it will either be 0 or 1
diff --git a/mod/install.php b/mod/install.php
index b5af1373a..b13da8c28 100755
--- a/mod/install.php
+++ b/mod/install.php
@@ -11,17 +11,16 @@ function install_init(&$a){
echo "ok";
killme();
}
-
+
// We overwrite current theme css, because during install we could not have a working mod_rewrite
// so we could not have a css at all. Here we set a static css file for the install procedure pages
$a->config['system']['theme'] = "../install";
- $a->theme['stylesheet'] = $a->get_baseurl()."/view/install/style.css";
-
-
-
+ $a->theme['stylesheet'] = App::get_baseurl()."/view/install/style.css";
+
global $install_wizard_pass;
- if (x($_POST,'pass'))
+ if (x($_POST,'pass')) {
$install_wizard_pass = intval($_POST['pass']);
+ }
}
@@ -52,7 +51,7 @@ function install_post(&$a) {
$r = q("CREATE DATABASE '%s'",
dbesc($dbdata)
);
- if($r) {
+ if ($r) {
unset($db);
$db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
} else {
@@ -63,7 +62,7 @@ function install_post(&$a) {
return;
}
}*/
- if(get_db_errno()) {
+ if (get_db_errno()) {
$a->data['db_conn_failed']=true;
}
@@ -107,17 +106,18 @@ function install_post(&$a) {
$result = file_put_contents('.htconfig.php', $txt);
- if(! $result) {
+ if (! $result) {
$a->data['txt'] = $txt;
}
$errors = load_database($db);
- if($errors)
+ if ($errors) {
$a->data['db_failed'] = $errors;
- else
+ } else {
$a->data['db_installed'] = true;
+ }
return;
break;
@@ -125,10 +125,11 @@ function install_post(&$a) {
}
function get_db_errno() {
- if(class_exists('mysqli'))
+ if (class_exists('mysqli')) {
return mysqli_connect_errno();
- else
+ } else {
return mysql_errno();
+ }
}
function install_content(&$a) {
@@ -140,23 +141,23 @@ function install_content(&$a) {
- if(x($a->data,'db_conn_failed')) {
+ if (x($a->data,'db_conn_failed')) {
$install_wizard_pass = 2;
$wizard_status = t('Could not connect to database.');
}
- if(x($a->data,'db_create_failed')) {
+ if (x($a->data,'db_create_failed')) {
$install_wizard_pass = 2;
$wizard_status = t('Could not create table.');
}
$db_return_text="";
- if(x($a->data,'db_installed')) {
+ if (x($a->data,'db_installed')) {
$txt = '
';
$txt .= t('Your Friendica site database has been installed.') . EOL;
$db_return_text .= $txt;
}
- if(x($a->data,'db_failed')) {
+ if (x($a->data,'db_failed')) {
$txt = t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL;
$txt .= t('Please see the file "INSTALL.txt".') . EOL ."
" ;
$txt .= "
".$a->data['db_failed'] . "
". EOL ;
@@ -176,7 +177,7 @@ function install_content(&$a) {
}
}
- if(x($a->data,'txt') && strlen($a->data['txt'])) {
+ if (x($a->data,'txt') && strlen($a->data['txt'])) {
$db_return_text .= manual_config($a);
}
@@ -205,16 +206,19 @@ function install_content(&$a) {
check_keys($checks);
- if(x($_POST,'phpath'))
+ if (x($_POST,'phpath')) {
$phpath = notags(trim($_POST['phpath']));
+ }
check_php($phpath, $checks);
- check_htaccess($checks);
+ check_htaccess($checks);
+ /// @TODO Maybe move this out?
function check_passed($v, $c){
- if ($c['required'])
+ if ($c['required']) {
$v = $v && $c['status'];
+ }
return $v;
}
$checkspassed = array_reduce($checks, "check_passed", true);
@@ -231,7 +235,7 @@ function install_content(&$a) {
'$next' => t('Next'),
'$reload' => t('Check again'),
'$phpath' => $phpath,
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => App::get_baseurl(),
));
return $o;
}; break;
@@ -265,7 +269,7 @@ function install_content(&$a) {
'$lbl_10' => t('Please select a default timezone for your website'),
- '$baseurl' => $a->get_baseurl(),
+ '$baseurl' => App::get_baseurl(),
'$phpath' => $phpath,
@@ -305,7 +309,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(),
+ '$baseurl' => App::get_baseurl(),
@@ -343,7 +347,7 @@ function check_php(&$phpath, &$checks) {
$passed = strlen($phpath);
}
$help = "";
- if(!$passed) {
+ if (!$passed) {
$help .= t('Could not find a command line version of PHP in the web server PATH.'). EOL;
$help .= t("If you don't have a command line version of PHP installed on server, you will not be able to run background polling via cron. See 'Setup the poller'") . EOL ;
$help .= EOL . EOL ;
@@ -370,7 +374,7 @@ function check_php(&$phpath, &$checks) {
}
- if($passed2) {
+ if ($passed2) {
$str = autoname(8);
$cmd = "$phpath testargs.php $str";
$result = trim(shell_exec($cmd));
@@ -392,15 +396,17 @@ function check_keys(&$checks) {
$res = false;
- if(function_exists('openssl_pkey_new'))
- $res=openssl_pkey_new(array(
- 'digest_alg' => 'sha1',
- 'private_key_bits' => 4096,
- 'encrypt_key' => false ));
+ if (function_exists('openssl_pkey_new')) {
+ $res = openssl_pkey_new(array(
+ 'digest_alg' => 'sha1',
+ 'private_key_bits' => 4096,
+ 'encrypt_key' => false
+ ));
+ }
// Get private key
- if(! $res) {
+ if (! $res) {
$help .= t('Error: the "openssl_pkey_new" function on this system is not able to generate encryption keys'). EOL;
$help .= t('If running under Windows, please see "http://www.php.net/manual/en/openssl.installation.php".');
}
@@ -420,7 +426,7 @@ function check_funcs(&$checks) {
check_add($ck_funcs, t('XML PHP module'), true, true, "");
check_add($ck_funcs, t('iconv module'), true, true, "");
- if(function_exists('apache_get_modules')){
+ if (function_exists('apache_get_modules')){
if (! in_array('mod_rewrite',apache_get_modules())) {
check_add($ck_funcs, t('Apache mod_rewrite module'), false, true, t('Error: Apache webserver mod-rewrite module is required but not installed.'));
} else {
@@ -428,31 +434,31 @@ function check_funcs(&$checks) {
}
}
- if(! function_exists('curl_init')){
+ if (! function_exists('curl_init')){
$ck_funcs[0]['status']= false;
$ck_funcs[0]['help']= t('Error: libCURL PHP module required but not installed.');
}
- if(! function_exists('imagecreatefromjpeg')){
+ if (! function_exists('imagecreatefromjpeg')){
$ck_funcs[1]['status']= false;
$ck_funcs[1]['help']= t('Error: GD graphics PHP module with JPEG support required but not installed.');
}
- if(! function_exists('openssl_public_encrypt')) {
+ if (! function_exists('openssl_public_encrypt')) {
$ck_funcs[2]['status']= false;
$ck_funcs[2]['help']= t('Error: openssl PHP module required but not installed.');
}
- if(! function_exists('mysqli_connect')){
+ if (! function_exists('mysqli_connect')){
$ck_funcs[3]['status']= false;
$ck_funcs[3]['help']= t('Error: mysqli PHP module required but not installed.');
}
- if(! function_exists('mb_strlen')){
+ if (! function_exists('mb_strlen')){
$ck_funcs[4]['status']= false;
$ck_funcs[4]['help']= t('Error: mb_string PHP module required but not installed.');
}
- if(! function_exists('mcrypt_create_iv')){
+ if (! function_exists('mcrypt_create_iv')){
$ck_funcs[5]['status']= false;
$ck_funcs[5]['help']= t('Error: mcrypt PHP module required but not installed.');
}
- if(! function_exists('iconv_strlen')){
+ if (! function_exists('iconv_strlen')){
$ck_funcs[7]['status']= false;
$ck_funcs[7]['help']= t('Error: iconv PHP module required but not installed.');
}
@@ -487,7 +493,7 @@ function check_funcs(&$checks) {
function check_htconfig(&$checks) {
$status = true;
$help = "";
- if( (file_exists('.htconfig.php') && !is_writable('.htconfig.php')) ||
+ if ((file_exists('.htconfig.php') && !is_writable('.htconfig.php')) ||
(!file_exists('.htconfig.php') && !is_writable('.')) ) {
$status=false;
@@ -504,7 +510,7 @@ function check_htconfig(&$checks) {
function check_smarty3(&$checks) {
$status = true;
$help = "";
- if( !is_writable('view/smarty3') ) {
+ if (!is_writable('view/smarty3') ) {
$status=false;
$help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
@@ -518,14 +524,14 @@ function check_smarty3(&$checks) {
}
function check_htaccess(&$checks) {
- $a = get_app();
$status = true;
$help = "";
- if (function_exists('curl_init')){
- $test = fetch_url($a->get_baseurl()."/install/testrewrite");
+ if (function_exists('curl_init')) {
+ $test = fetch_url(App::get_baseurl()."/install/testrewrite");
- if ($test!="ok")
- $test = fetch_url(normalise_link($a->get_baseurl()."/install/testrewrite"));
+ if ($test!="ok") {
+ $test = fetch_url(normalise_link(App::get_baseurl()."/install/testrewrite"));
+ }
if ($test!="ok") {
$status = false;
@@ -534,6 +540,7 @@ function check_htaccess(&$checks) {
check_add($checks, t('Url rewrite is working'), $status, true, $help);
} else {
// cannot check modrewrite if libcurl is not installed
+ /// @TODO Maybe issue warning here?
}
}
@@ -550,8 +557,7 @@ function check_imagik(&$checks) {
}
if ($imagick == false) {
check_add($checks, t('ImageMagick PHP extension is not installed'), $imagick, false, "");
- }
- else {
+ } else {
check_add($checks, t('ImageMagick PHP extension is installed'), $imagick, false, "");
if ($imagick) {
check_add($checks, t('ImageMagick supports GIF'), $gif, false, "");
@@ -559,8 +565,6 @@ function check_imagik(&$checks) {
}
}
-
-
function manual_config(&$a) {
$data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
$o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
@@ -599,8 +603,7 @@ function load_database($db) {
}
function what_next() {
- $a = get_app();
- $baseurl = $a->get_baseurl();
+ $baseurl = App::get_baseurl();
return
t('
What next
')
."
".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.')
diff --git a/mod/invite.php b/mod/invite.php
index ccf876c7c..441d39e6e 100644
--- a/mod/invite.php
+++ b/mod/invite.php
@@ -11,7 +11,7 @@ require_once('include/email.php');
function invite_post(&$a) {
- if(! local_user()) {
+ if (! local_user()) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -19,14 +19,15 @@ function invite_post(&$a) {
check_form_security_token_redirectOnErr('/', 'send_invite');
$max_invites = intval(get_config('system','max_invites'));
- if(! $max_invites)
+ if (! $max_invites) {
$max_invites = 50;
+ }
$current_invites = intval(get_pconfig(local_user(),'system','sent_invites'));
- if($current_invites > $max_invites) {
+ if ($current_invites > $max_invites) {
notice( t('Total invitation limit exceeded.') . EOL);
return;
- };
+ }
$recips = ((x($_POST,'recipients')) ? explode("\n",$_POST['recipients']) : array());
@@ -34,23 +35,24 @@ function invite_post(&$a) {
$total = 0;
- if(get_config('system','invitation_only')) {
+ if (get_config('system','invitation_only')) {
$invonly = true;
$x = get_pconfig(local_user(),'system','invites_remaining');
- if((! $x) && (! is_site_admin()))
+ if ((! $x) && (! is_site_admin())) {
return;
+ }
}
- foreach($recips as $recip) {
+ foreach ($recips as $recip) {
$recip = trim($recip);
- if(! valid_email($recip)) {
+ if (! valid_email($recip)) {
notice( sprintf( t('%s : Not a valid email address.'), $recip) . EOL);
continue;
}
-
- if($invonly && ($x || is_site_admin())) {
+
+ if ($invonly && ($x || is_site_admin())) {
$code = autoname(8) . srand(1000,9999);
$nmessage = str_replace('$invite_code',$code,$message);
@@ -59,16 +61,17 @@ function invite_post(&$a) {
dbesc(datetime_convert())
);
- if(! is_site_admin()) {
+ if (! is_site_admin()) {
$x --;
- if($x >= 0)
+ if ($x >= 0) {
set_pconfig(local_user(),'system','invites_remaining',$x);
- else
+ } else {
return;
+ }
}
- }
- else
+ } else {
$nmessage = $message;
+ }
$res = mail($recip, email_header_encode( t('Please join us on Friendica'),'UTF-8'),
$nmessage,
@@ -76,7 +79,7 @@ function invite_post(&$a) {
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit' );
- if($res) {
+ if ($res) {
$total ++;
$current_invites ++;
set_pconfig(local_user(),'system','sent_invites',$current_invites);
@@ -84,8 +87,7 @@ function invite_post(&$a) {
notice( t('Invitation limit exceeded. Please contact your site administrator.') . EOL);
return;
}
- }
- else {
+ } else {
notice( sprintf( t('%s : Message delivery failed.'), $recip) . EOL);
}
@@ -97,7 +99,7 @@ function invite_post(&$a) {
function invite_content(&$a) {
- if(! local_user()) {
+ if (! local_user()) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -105,39 +107,39 @@ function invite_content(&$a) {
$tpl = get_markup_template('invite.tpl');
$invonly = false;
- if(get_config('system','invitation_only')) {
+ if (get_config('system','invitation_only')) {
$invonly = true;
$x = get_pconfig(local_user(),'system','invites_remaining');
- if((! $x) && (! is_site_admin())) {
+ if ((! $x) && (! is_site_admin())) {
notice( t('You have no more invitations available') . EOL);
return '';
}
}
$dirloc = get_config('system','directory');
- if(strlen($dirloc)) {
- if($a->config['register_policy'] == REGISTER_CLOSED)
+ if (strlen($dirloc)) {
+ if ($a->config['register_policy'] == REGISTER_CLOSED) {
$linktxt = sprintf( t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), $dirloc . '/siteinfo');
- elseif($a->config['register_policy'] != REGISTER_CLOSED)
- $linktxt = sprintf( t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), $a->get_baseurl())
+ } elseif($a->config['register_policy'] != REGISTER_CLOSED) {
+ $linktxt = sprintf( t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), App::get_baseurl())
. "\r\n" . "\r\n" . sprintf( t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'),$dirloc . '/siteinfo');
- }
- else {
+ }
+ } else {
$o = t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
return $o;
}
$o = replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("send_invite"),
- '$invite' => t('Send invitations'),
- '$addr_text' => t('Enter email addresses, one per line:'),
- '$msg_text' => t('Your message:'),
- '$default_message' => t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n"
+ '$invite' => t('Send invitations'),
+ '$addr_text' => t('Enter email addresses, one per line:'),
+ '$msg_text' => t('Your message:'),
+ '$default_message' => t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n"
. $linktxt
. "\r\n" . "\r\n" . (($invonly) ? t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') .t('Once you have registered, please connect with me via my profile page at:')
- . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname']
+ . "\r\n" . "\r\n" . App::get_baseurl() . '/profile/' . $a->user['nickname']
. "\r\n" . "\r\n" . t('For more information about the Friendica project and why we feel it is important, please visit http://friendica.com') . "\r\n" . "\r\n" ,
- '$submit' => t('Submit')
+ '$submit' => t('Submit')
));
return $o;
diff --git a/mod/item.php b/mod/item.php
index 9ef82616c..b902f1e35 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -59,13 +59,14 @@ function item_post(&$a) {
// Check for doubly-submitted posts, and reject duplicates
// Note that we have to ignore previews, otherwise nothing will post
// after it's been previewed
- if(!$preview && x($_REQUEST['post_id_random'])) {
- if(x($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
+ if (!$preview && x($_REQUEST['post_id_random'])) {
+ if (x($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
logger("item post: duplicate post", LOGGER_DEBUG);
- item_post_return($a->get_baseurl(), $api_source, $return_path);
+ item_post_return(App::get_baseurl(), $api_source, $return_path);
}
- else
+ else {
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
+ }
}
/**
@@ -82,18 +83,20 @@ function item_post(&$a) {
$r = false;
$objecttype = null;
- if($parent || $parent_uri) {
+ if ($parent || $parent_uri) {
$objecttype = ACTIVITY_OBJ_COMMENT;
- if(! x($_REQUEST,'type'))
+ if (! x($_REQUEST,'type')) {
$_REQUEST['type'] = 'net-comment';
+ }
- if($parent) {
+ if ($parent) {
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
intval($parent)
);
- } elseif($parent_uri && local_user()) {
+ }
+ elseif ($parent_uri && local_user()) {
// This is coming from an API source, and we are logged in
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent_uri),
@@ -105,17 +108,18 @@ function item_post(&$a) {
if (dbm::is_result($r)) {
$parid = $r[0]['parent'];
$parent_uri = $r[0]['uri'];
- if($r[0]['id'] != $r[0]['parent']) {
+ if ($r[0]['id'] != $r[0]['parent']) {
$r = q("SELECT * FROM `item` WHERE `id` = `parent` AND `parent` = %d LIMIT 1",
intval($parid)
);
}
}
- if(! dbm::is_result($r)) {
+ if (! dbm::is_result($r)) {
notice( t('Unable to locate original post.') . EOL);
- if(x($_REQUEST,'return'))
+ if (x($_REQUEST,'return')) {
goaway($return_path);
+ }
killme();
}
$parent_item = $r[0];
@@ -125,7 +129,7 @@ function item_post(&$a) {
//if(($parid) && ($parid != $parent))
$thr_parent = $parent_uri;
- if($parent_item['contact-id'] && $uid) {
+ if ($parent_item['contact-id'] && $uid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($parent_item['contact-id']),
intval($uid)
@@ -448,13 +452,15 @@ function item_post(&$a) {
$objecttype = ACTIVITY_OBJ_IMAGE;
- foreach($images as $image) {
- if(! stristr($image,$a->get_baseurl() . '/photo/'))
+ foreach ($images as $image) {
+ if (! stristr($image,App::get_baseurl() . '/photo/')) {
continue;
+ }
$image_uri = substr($image,strrpos($image,'/') + 1);
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
- if(! strlen($image_uri))
+ if (! strlen($image_uri)) {
continue;
+ }
$srch = '<' . intval($contact_id) . '>';
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
@@ -464,8 +470,9 @@ function item_post(&$a) {
intval($profile_uid)
);
- if(! dbm::is_result($r))
+ if (! dbm::is_result($r)) {
continue;
+ }
$r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ",
@@ -638,9 +645,10 @@ function item_post(&$a) {
intval($mtch)
);
if (dbm::is_result($r)) {
- if(strlen($attachments))
+ if (strlen($attachments)) {
$attachments .= ',';
- $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
+ }
+ $attachments .= '[attach]href="' . App::get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
}
$body = str_replace($match[1],'',$body);
}
@@ -648,14 +656,17 @@ function item_post(&$a) {
$wall = 0;
- if($post_type === 'wall' || $post_type === 'wall-comment')
+ if ($post_type === 'wall' || $post_type === 'wall-comment') {
$wall = 1;
+ }
- if(! strlen($verb))
+ if (! strlen($verb)) {
$verb = ACTIVITY_POST ;
+ }
- if ($network == "")
+ if ($network == "") {
$network = NETWORK_DFRN;
+ }
$gravity = (($parent) ? 6 : 0 );
@@ -669,8 +680,9 @@ function item_post(&$a) {
$uri = (($message_id) ? $message_id : item_new_uri($a->get_hostname(),$profile_uid, $guid));
// Fallback so that we alway have a thr-parent
- if(!$thr_parent)
+ if (!$thr_parent) {
$thr_parent = $uri;
+ }
$datarray = array();
$datarray['uid'] = $profile_uid;
@@ -732,7 +744,7 @@ function item_post(&$a) {
// $datarray['prvnets'] = $user['prvnets'];
$datarray['parent-uri'] = ($parent == 0) ? $uri : $parent_item['uri'];
- $datarray['plink'] = $a->get_baseurl().'/display/'.urlencode($datarray['guid']);
+ $datarray['plink'] = App::get_baseurl().'/display/'.urlencode($datarray['guid']);
$datarray['last-child'] = 1;
$datarray['visible'] = 1;
@@ -765,8 +777,9 @@ function item_post(&$a) {
}
$json = array('cancel' => 1);
- if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
- $json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
+ if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) {
+ $json['reload'] = App::get_baseurl() . '/' . $_REQUEST['jsreload'];
+ }
echo json_encode($json);
killme();
@@ -938,7 +951,7 @@ function item_post(&$a) {
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $datarray,
- 'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']),
+ 'link' => App::get_baseurl().'/display/'.urlencode($datarray['guid']),
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
@@ -952,7 +965,7 @@ function item_post(&$a) {
// Store the comment signature information in case we need to relay to Diaspora
- diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id);
+ Diaspora::store_comment_signature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id);
} else {
$parent = $post_id;
@@ -970,7 +983,7 @@ function item_post(&$a) {
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $datarray,
- 'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']),
+ 'link' => App::get_baseurl().'/display/'.urlencode($datarray['guid']),
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
@@ -991,14 +1004,14 @@ function item_post(&$a) {
continue;
$disclaimer = '
' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'),$a->user['username'])
. ' ';
- $disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
+ $disclaimer .= sprintf( t('You may visit them online at %s'), App::get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
$disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$datarray['title']=='') {
$subject = email_header_encode($datarray['title'],'UTF-8');
} else {
$subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8');
}
- $link = '
';
+ $link = '
';
$html = prepare_body($datarray);
$message = '' . $link . $html . $disclaimer . '';
include_once('include/html2plain.php');
@@ -1038,7 +1051,7 @@ function item_post(&$a) {
logger('post_complete');
- item_post_return($a->get_baseurl(), $api_source, $return_path);
+ item_post_return(App::get_baseurl(), $api_source, $return_path);
// NOTREACHED
}
@@ -1048,13 +1061,14 @@ function item_post_return($baseurl, $api_source, $return_path) {
if($api_source)
return;
- if($return_path) {
+ if ($return_path) {
goaway($return_path);
}
$json = array('success' => 1);
- if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
+ if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) {
$json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
+ }
logger('post_json: ' . print_r($json,true), LOGGER_DEBUG);
@@ -1066,15 +1080,16 @@ function item_post_return($baseurl, $api_source, $return_path) {
function item_content(&$a) {
- if((! local_user()) && (! remote_user()))
+ if ((! local_user()) && (! remote_user())) {
return;
+ }
require_once('include/security.php');
$o = '';
- if(($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
+ if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
$o = drop_item($a->argv[2], !is_ajax());
- if (is_ajax()){
+ if (is_ajax()) {
// ajax return: [, 0 (no perm) | ]
echo json_encode(array(intval($a->argv[2]), intval($o)));
killme();
@@ -1087,6 +1102,7 @@ function item_content(&$a) {
* This function removes the tag $tag from the text $body and replaces it with
* the appropiate link.
*
+ * @param App $a Application instance @TODO is unused in this function's scope (excluding included files)
* @param unknown_type $body the text to replace the tag in
* @param string $inform a comma-seperated string containing everybody to inform
* @param string $str_tags string to add the tag to
@@ -1104,13 +1120,14 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
$r = null;
//is it a person tag?
- if(strpos($tag,'@') === 0) {
+ if (strpos($tag,'@') === 0) {
//is it already replaced?
- if(strpos($tag,'[url=')) {
+ if (strpos($tag,'[url=')) {
//append tag to str_tags
- if(!stristr($str_tags,$tag)) {
- if(strlen($str_tags))
+ if (!stristr($str_tags,$tag)) {
+ if (strlen($str_tags)) {
$str_tags .= ',';
+ }
$str_tags .= $tag;
}
diff --git a/mod/like.php b/mod/like.php
index 8d383b9ab..cbab9185e 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -24,7 +24,7 @@ function like_content(&$a) {
// See if we've been passed a return path to redirect to
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
- like_content_return($a->get_baseurl(), $return_path);
+ like_content_return(App::get_baseurl(), $return_path);
killme(); // NOTREACHED
// return; // NOTREACHED
}
diff --git a/mod/localtime.php b/mod/localtime.php
index d1453bc52..ce6bf84a1 100644
--- a/mod/localtime.php
+++ b/mod/localtime.php
@@ -36,7 +36,7 @@ function localtime_content(&$a) {
$o .= '