X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=af5c2db0b429cea3f52fafb5a9aae29ba1cc5e60;hb=2825c4957315fab90445bfec5a47bdb64f712355;hp=85b571c828392b6a7ce2868c062d7759f7b23055;hpb=60e0f79b9f9e94b19cc412eac41e5d8f8fec2383;p=friendica.git
diff --git a/boot.php b/boot.php
index 85b571c828..af5c2db0b4 100644
--- a/boot.php
+++ b/boot.php
@@ -6,11 +6,12 @@ require_once('include/plugin.php');
require_once('include/text.php');
require_once("include/pgettext.php");
require_once('include/nav.php');
+require_once('include/cache.php');
-define ( 'FRIENDIKA_PLATFORM', 'Free Friendika');
-define ( 'FRIENDIKA_VERSION', '2.3.1119' );
-define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
-define ( 'DB_UPDATE_VERSION', 1093 );
+define ( 'FRIENDIKA_PLATFORM', 'Friendica');
+define ( 'FRIENDIKA_VERSION', '2.3.1159' );
+define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
+define ( 'DB_UPDATE_VERSION', 1103 );
define ( 'EOL', "
\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -93,7 +94,7 @@ define ( 'PAGE_FREELOVE', 3 );
*/
define ( 'NETWORK_ZOT', 'zot!'); // Zot!
-define ( 'NETWORK_DFRN', 'dfrn'); // Friendika, Mistpark, other DFRN implementations
+define ( 'NETWORK_DFRN', 'dfrn'); // Friendica, Mistpark, other DFRN implementations
define ( 'NETWORK_OSTATUS', 'stat'); // status.net, identi.ca, GNU-social, other OStatus implementations
define ( 'NETWORK_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol
define ( 'NETWORK_DIASPORA', 'dspr'); // Diaspora
@@ -152,6 +153,8 @@ define ( 'ACTIVITY_DISLIKE', NAMESPACE_DFRN . '/dislike' );
define ( 'ACTIVITY_OBJ_HEART', NAMESPACE_DFRN . '/heart' );
define ( 'ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend' );
+define ( 'ACTIVITY_REQ_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'request-friend' );
+define ( 'ACTIVITY_UNFRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'remove-friend' );
define ( 'ACTIVITY_FOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'follow' );
define ( 'ACTIVITY_UNFOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'stop-following' );
define ( 'ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post' );
@@ -188,7 +191,7 @@ function startup() {
set_time_limit(0);
// This has to be quite large to deal with embedded private photos
- ini_set('pcre.backtrack_limit', 350000);
+ ini_set('pcre.backtrack_limit', 500000);
if (get_magic_quotes_gpc()) {
@@ -236,7 +239,7 @@ class App {
public $contacts;
public $page_contact;
public $content;
- public $data;
+ public $data = array();
public $error = false;
public $cmd;
public $argv;
@@ -249,8 +252,10 @@ class App {
public $timezone;
public $interactive = true;
public $plugins;
- public $apps = Array();
+ public $apps = array();
public $identities;
+
+ public $nav_sel;
private $scheme;
private $hostname;
@@ -537,6 +542,8 @@ function check_config(&$a) {
$current = intval(DB_UPDATE_VERSION);
if(($stored < $current) && file_exists('update.php')) {
+ load_config('database');
+
// We're reporting a different version than what is currently installed.
// Run any existing update scripts to bring the database up to current.
@@ -550,6 +557,21 @@ function check_config(&$a) {
for($x = $stored; $x < $current; $x ++) {
if(function_exists('update_' . $x)) {
+
+ // There could be a lot of processes running or about to run.
+ // We want exactly one process to run the update command.
+ // So store the fact that we're taking responsibility
+ // after first checking to see if somebody else already has.
+
+ // If the update fails or times-out completely you may need to
+ // delete the config entry to try again.
+
+ if(get_config('database','update_' . $x))
+ break;
+ set_config('database','update_' . $x, '1');
+
+ // call the specific update
+
$func = 'update_' . $x;
$func($a);
}
@@ -632,31 +654,18 @@ function get_guid($size=16) {
// returns the complete html for inserting into the page
if(! function_exists('login')) {
-function login($register = false) {
+function login($register = false, $hiddens=false) {
$o = "";
- $register_tpl = (($register) ? get_markup_template("register-link.tpl") : "");
-
- $register_html = replace_macros($register_tpl,array(
- '$title' => t('Create a New Account'),
- '$desc' => t('Register')
- ));
-
- $noid = get_config('system','no_openid');
- if($noid) {
- $classname = 'no-openid';
- $namelabel = t('Nickname or Email address: ');
- $passlabel = t('Password: ');
- $login = t('Login');
- }
- else {
- $classname = 'openid';
- $namelabel = t('Nickname/Email/OpenID: ');
- $passlabel = t("Password \x28if not OpenID\x29: ");
- $login = t('Login');
+ $reg = false;
+ if ($register) {
+ $reg = array(
+ 'title' => t('Create a New Account'),
+ 'desc' => t('Register')
+ );
}
- $lostpass = t('Forgot your password?');
- $lostlink = t('Password Reset');
+ $noid = get_config('system','no_openid');
+
if(local_user()) {
$tpl = get_markup_template("logout.tpl");
}
@@ -665,17 +674,23 @@ function login($register = false) {
}
- $o = '';
$o .= replace_macros($tpl,array(
'$logout' => t('Logout'),
- '$register_html' => $register_html,
- '$classname' => $classname,
- '$namelabel' => $namelabel,
- '$passlabel' => $passlabel,
- '$login' => $login,
- '$lostpass' => $lostpass,
- '$lostlink' => $lostlink
+ '$login' => t('Login'),
+
+ '$lname' => array('username', t('Nickname or Email address: ') , '', ''),
+ '$lpassword' => array('password', t('Password: '), '', ''),
+
+ '$openid' => !$noid,
+ '$lopenid' => array('openid_url', t('OpenID: '),'',''),
+
+ '$hiddens' => $hiddens,
+
+ '$register' => $reg,
+
+ '$lostpass' => t('Forgot your password?'),
+ '$lostlink' => t('Password Reset'),
));
call_hooks('login_hook',$o);
@@ -811,6 +826,13 @@ function profile_load(&$a, $nickname, $profile = 0) {
if(! (x($a->page,'aside')))
$a->page['aside'] = '';
+ if(local_user() && local_user() == $a->profile['uid']) {
+ $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'),array(
+ '$editprofile' => t('Edit profile'),
+ '$profid' => $a->profile['id']
+ ));
+ }
+
$block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
$a->page['aside'] .= profile_sidebar($a->profile, $block);
@@ -918,11 +940,17 @@ function profile_sidebar($profile, $block = 0) {
$location = $pdesc = $connect = $gender = $marital = $homepage = False;
}
+ $firstname = ((strpos($profile['name'],' '))
+ ? trim(substr($profile['name'],0,strpos($profile['name'],' '))) : $profile['name']);
+ $lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'],strlen($firstname))));
+
$diaspora = array(
'podloc' => $a->get_baseurl(),
'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ),
'nickname ' => $profile['nickname'],
'fullname' => $profile['name'],
+ 'firstname' => $firstname,
+ 'lastname' => $lastname,
'photo300' => $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg',
'photo100' => $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg',
'photo50' => $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg',
@@ -966,11 +994,12 @@ function get_birthdays() {
return $o;
$bd_format = t('g A l F d') ; // 8 AM Friday January 18
+ $bd_short = t('F d');
$r = q("SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event`
LEFT JOIN `contact` ON `contact`.`id` = `event`.`cid`
WHERE `event`.`uid` = %d AND `type` = 'birthday' AND `start` < '%s' AND `finish` > '%s'
- ORDER BY `start` DESC ",
+ ORDER BY `start` ASC ",
intval(local_user()),
dbesc(datetime_convert('UTC','UTC','now + 6 days')),
dbesc(datetime_convert('UTC','UTC','now'))
@@ -978,25 +1007,34 @@ function get_birthdays() {
if($r && count($r)) {
$total = 0;
- foreach($r as $rr)
+ $now = strtotime('now');
+ $istoday = false;
+ foreach($r as $rr) {
if(strlen($rr['name']))
$total ++;
-
+ if((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now))
+ $istoday = true;
+ }
+ $classtoday = $istoday ? ' birthday-today ' : '';
if($total) {
- $o .= '
"; var_dump($a->user); killme(); + + if (is_null($nickname)) + $nickname = $a->user['nickname']; + + if(x($_GET,'tab')) + $tab = notags(trim($_GET['tab'])); + + $url = $a->get_baseurl() . '/profile/' . $nickname; + + $tabs = array( + array( + 'label'=>t('Status'), + 'url' => $url, + 'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''), + ), + array( + 'label' => t('Profile'), + 'url' => $url.'/?tab=profile', + 'sel' => (($tab=='profile')?'active':''), + ), + array( + 'label' => t('Photos'), + 'url' => $a->get_baseurl() . '/photos/' . $nickname, + 'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''), + ), + ); + + if ($is_owner){ + $tabs[] = array( + 'label' => t('Events'), + 'url' => $a->get_baseurl() . '/events', + 'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''), + ); + $tabs[] = array( + 'label' => t('Personal Notes'), + 'url' => $a->get_baseurl() . '/notes', + 'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''), + ); + } + + $tpl = get_markup_template('common_tabs.tpl'); + return replace_macros($tpl,array('$tabs'=>$tabs)); +}}