X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=ed083d6177c2b6eb1dc494ca68343eb4c6ef14b1;hb=35dc4202a253c9e0c43f4bcb7484758114ad18df;hp=d1ab4c7b847c02595946356d3268cf6715d233cc;hpb=d52dad3826ebed717dc7a9d24ac670cdd33e16f8;p=friendica.git diff --git a/boot.php b/boot.php index d1ab4c7b84..ed083d6177 100644 --- a/boot.php +++ b/boot.php @@ -9,9 +9,9 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1309' ); +define ( 'FRIENDICA_VERSION', '2.3.1329' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1138 ); +define ( 'DB_UPDATE_VERSION', 1142 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -73,6 +73,14 @@ define ( 'HOOK_HOOK', 0); define ( 'HOOK_FILE', 1); define ( 'HOOK_FUNCTION', 2); +/** + * DB update return values + */ + +define ( 'UPDATE_SUCCESS', 0); +define ( 'UPDATE_FAILED', 1); + + /** * * page/profile types @@ -193,6 +201,8 @@ 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_JOIN', NAMESPACE_ACTIVITY_SCHEMA . 'join' ); + define ( 'ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post' ); define ( 'ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update' ); define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' ); @@ -205,7 +215,9 @@ define ( 'ACTIVITY_OBJ_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'photo' ); define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' ); define ( 'ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' ); define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' ); +define ( 'ACTIVITY_OBJ_GROUP', NAMESPACE_ACTIVITY_SCHEMA . 'group' ); define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_DFRN . '/tagterm' ); +define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_DFRN . '/profile' ); /** * item weight for query ordering @@ -657,32 +669,29 @@ if(! function_exists('check_config')) { // call the specific update - global $db; - $db->excep(TRUE); - try { - $db->beginTransaction(); - $func = 'update_' . $x; - $func($a); - $db->commit(); - } catch(Exception $ex) { - $db->rollback(); + $func = 'update_' . $x; + $retval = $func(); + if($retval) { //send the administrator an e-mail $email_tpl = get_intltext_template("update_fail_eml.tpl"); - $email_tpl = replace_macros($email_tpl, array( + $email_msg = replace_macros($email_tpl, array( '$sitename' => $a->config['sitename'], '$siteurl' => $a->get_baseurl(), '$update' => $x, - '$error' => $ex->getMessage())); + '$error' => sprintf( t('Update %s failed. See error logs.'), $x) + )); $subject=sprintf(t('Update Error at %s'), $a->get_baseurl()); - mail($a->config['admin_email'], $subject, $text, - 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" - . 'Content-type: text/plain; charset=UTF-8' . "\n" - . 'Content-transfer-encoding: 8bit' ); + mail($a->config['admin_email'], $subject, $email_msg, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); //try the logger - logger('update failed: '.$ex->getMessage().EOL); + logger('CRITICAL: Update Failed: '. $x); } - $db->excep(FALSE); + else + set_config('database','update_' . $x, 'success'); + } } set_config('system','build', DB_UPDATE_VERSION); @@ -724,9 +733,10 @@ if(! function_exists('check_config')) { foreach($installed as $i) { if(! in_array($i['name'],$plugins_arr)) { uninstall_plugin($i['name']); - } - else + } + else { $installed_arr[] = $i['name']; + } } } @@ -935,6 +945,7 @@ if(! function_exists('profile_load')) { } if(($r === false) || (! count($r))) { + logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice( t('Requested profile is not available.') . EOL ); $a->error = 404; return; @@ -1172,11 +1183,7 @@ if(! function_exists('get_birthdays')) { } $classtoday = $istoday ? ' birthday-today ' : ''; if($total) { - $o .= '
' . t('Birthday Reminders') . ' ' . '(' . $total . ')' . '
'; - $o .= ''; } } - return $o; + $tpl = get_markup_template("birthdays_reminder.tpl"); + return replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(), + '$classtoday' => $classtoday, + '$count' => $total, + '$event_reminders' => t('Birthday Reminders'), + '$event_title' => t('Birthdays this week:'), + '$events' => $r, + )); } } @@ -1213,7 +1229,6 @@ if(! function_exists('get_events')) { require_once('include/bbcode.php'); $a = get_app(); - $o = ''; if(! local_user()) return $o; @@ -1240,18 +1255,15 @@ if(! function_exists('get_events')) { if($strt === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) $istoday = true; } - $classtoday = (($istoday) ? ' event-today ' : ''); - - $o .= '
' . t('Event Reminders') . ' ' . '(' . count($r) . ')' . '
'; - $o .= ''; } - return $o; + $tpl = get_markup_template("events_reminder.tpl"); + return replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(), + '$classtoday' => $classtoday, + '$count' => count($r), + '$event_reminders' => t('Event Reminders'), + '$event_title' => t('Events this week:'), + '$events' => $r, + )); } } @@ -1451,16 +1472,19 @@ if(! function_exists('profile_tabs')){ 'label'=>t('Status'), 'url' => $url, 'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''), + 'title' => t('Status Messages and Posts'), ), array( 'label' => t('Profile'), 'url' => $url.'/?tab=profile', 'sel' => ((isset($tab) && $tab=='profile')?'active':''), + 'title' => t('Profile Details'), ), array( 'label' => t('Photos'), 'url' => $a->get_baseurl() . '/photos/' . $nickname, 'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''), + 'title' => t('Photo Albums'), ), ); @@ -1469,11 +1493,13 @@ if(! function_exists('profile_tabs')){ 'label' => t('Events'), 'url' => $a->get_baseurl() . '/events', 'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''), + 'title' => t('Events and Calendar'), ); $tabs[] = array( 'label' => t('Personal Notes'), 'url' => $a->get_baseurl() . '/notes', 'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''), + 'title' => t('Only You Can See This'), ); } @@ -1493,11 +1519,22 @@ function get_my_url() { return false; } -function zrl($s) { +function zrl_init(&$a) { + $tmp_str = get_my_url(); + if(validate_url($tmp_str)) { + proc_run('php','include/gprobe.php',bin2hex($tmp_str)); + $arr = array('zrl' => $tmp_str, 'url' => $a->cmd); + call_hooks('zrl_init',$arr); + } +} + +function zrl($s,$force = false) { if(! strlen($s)) return $s; - if(! strpos($s,'/profile/')) + if((! strpos($s,'/profile/')) && (! $force)) return $s; + if($force && substr($s,-1,1) !== '/') + $s = $s . '/'; $achar = strpos($s,'?') ? '&' : '?'; $mine = get_my_url(); if($mine and ! link_compare($mine,$s))