]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
unique key on a boolean value is not scalable
[quix0rs-gnu-social.git] / lib / util.php
index c20075b305e2e0f1c5c18a0de0a648b19a88280f..97a36296cffc548d111556b364767d54e3fe4f8e 100644 (file)
@@ -95,7 +95,7 @@ function common_element_start($tag, $attrs=NULL) {
 function common_element_end($tag) {
        static $empty_tag = array('base', 'meta', 'link', 'hr',
                                                          'br', 'param', 'img', 'area',
-                                                         'input', 'col'); 
+                                                         'input', 'col');
        global $xw;
        # XXX: check namespace
        if (in_array($tag, $empty_tag)) {
@@ -234,11 +234,7 @@ function common_show_footer() {
        } else {
                $instr = _('**%%site.name%%** is a microblogging service. ');
        }
-       $instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) ' .
-                        'microblogging software, version %s, ' .
-                        'available under the ' .
-                        '[GNU Affero General Public License]' .
-                        '(http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION);
+       $instr .= sprintf(_('It runs the [Laconica](http://laconi.ca/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), LACONICA_VERSION);
     $output = common_markup_to_html($instr);
     common_raw($output);
        common_element_end('div');
@@ -277,7 +273,8 @@ function common_nav_menu() {
                common_menu_item(common_local_url('all', array('nickname' => $user->nickname)),
                                                 _('Home'));
        }
-       common_menu_item(common_local_url('public'), _t('Public'));
+       common_menu_item(common_local_url('public'), _('Public'));
+       common_menu_item(common_local_url('peoplesearch'), _('Search'));
        common_menu_item(common_local_url('doc', array('title' => 'help')),
                                         _('Help'));
        if ($user) {
@@ -460,7 +457,7 @@ function common_set_user($user) {
        } else if (!($user instanceof User)) {
                return false;
        }
-       
+
        if ($user) {
                common_ensure_session();
                $_SESSION['userid'] = $user->id;
@@ -727,6 +724,8 @@ function common_fancy_url($action, $args=NULL) {
                return common_path('settings/'.$action);
         case 'profilesettings':
                return common_path('settings/profile');
+        case 'emailsettings':
+               return common_path('settings/email');
         case 'openidsettings':
                return common_path('settings/openid');
         case 'newnotice':
@@ -826,7 +825,7 @@ function common_date_string($dt) {
        } else if ($diff < 37 * 3600) {
                return _('about a day ago');
        } else if ($diff < 24 * 24 * 3600) {
-               return sprintf(_('about %d days ago', round($diff/(24*3600))));
+               return sprintf(_('about %d days ago'), round($diff/(24*3600)));
        } else if ($diff < 46 * 24 * 3600) {
                return _('about a month ago');
        } else if ($diff < 330 * 24 * 3600) {
@@ -861,6 +860,7 @@ function common_redirect($url, $code=307) {
                                         'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
        common_element('a', array('href' => $url), $url);
        common_end_xml();
+    exit;
 }
 
 function common_save_replies($notice) {
@@ -892,7 +892,7 @@ function common_save_replies($notice) {
                if (!$id) {
                        $last_error = &PEAR::getStaticProperty('DB_DataObject','lastError');
                        common_log(LOG_ERROR, 'DB error inserting reply: ' . $last_error->message);
-                       common_server_error('DB error inserting reply: ' . $last_error->message);
+                       common_server_error(sprintf(_('DB error inserting reply: %s'), $last_error->message));
                        return;
                }
        }
@@ -1060,7 +1060,7 @@ function common_log($priority, $msg, $filename=NULL) {
        if ($logfile) {
                $log = fopen($logfile, "a");
                if ($log) {
-                       static $syslog_priorities = array('LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR', 
+                       static $syslog_priorities = array('LOG_EMERG', 'LOG_ALERT', 'LOG_CRIT', 'LOG_ERR',
                                                                                          'LOG_WARNING', 'LOG_NOTICE', 'LOG_INFO', 'LOG_DEBUG');
                        $output = date('Y-m-d H:i:s') . ' ' . $syslog_priorities[$priority] . ': ' . $msg . "\n";
                        fwrite($log, $output);
@@ -1271,3 +1271,13 @@ function common_markup_to_html($c) {
        $c = preg_replace('/%%(\w+).(\w+)%%/e', 'common_config(\'\\1\', \'\\2\')', $c);
        return Markdown($c);
 }
+
+function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) {
+       $avatar = $profile->getAvatar($size);
+       if ($avatar) {
+               return common_avatar_display_url($avatar);
+       } else {
+               return common_default_avatar($size);
+       }
+}
+       
\ No newline at end of file