' . $str . '
';
- }
- return $o;
-}}
// wrapper to load a view template, checking for alternate
@@ -1667,13 +1849,19 @@ function format_like($cnt,$arr,$type,$id) {
if(! function_exists('load_view_file')) {
function load_view_file($s) {
+ global $lang, $a;
+ if(! isset($lang))
+ $lang = 'en';
$b = basename($s);
$d = dirname($s);
- $lang = get_config('system','language');
- if($lang === false)
- $lang = 'en';
if(file_exists("$d/$lang/$b"))
return file_get_contents("$d/$lang/$b");
+
+ $theme = current_theme();
+
+ if(file_exists("$d/theme/$theme/$b"))
+ return file_get_contents("$d/theme/$theme/$b");
+
return file_get_contents($s);
}}
@@ -1757,29 +1945,6 @@ return str_replace ("%","=",rawurlencode($s));
}}
-if(! function_exists('like_puller')) {
-function like_puller($a,$item,&$arr,$mode) {
-
- $url = '';
- $sparkle = '';
- $verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
-
- if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
- $url = $item['author-link'];
- if(($item['network'] === 'dfrn') && (! $item['self']) && ($item['author-link'] == $item['url'])) {
- $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
- $sparkle = ' class="sparkle" ';
- }
- if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
- $arr[$item['parent'] . '-l'] = array();
- if(! isset($arr[$item['parent']]))
- $arr[$item['parent']] = 1;
- else
- $arr[$item['parent']] ++;
- $arr[$item['parent'] . '-l'][] = '';
+ $o .= '
';
$o .= '
';
@@ -1849,6 +2005,35 @@ function contact_block() {
}}
+if(! function_exists('micropro')) {
+function micropro($contact, $redirect = false, $class = '') {
+
+ if($class)
+ $class = ' ' . $class;
+
+ $url = $contact['url'];
+ $sparkle = '';
+
+ if($redirect) {
+ $a = get_app();
+ $redirect_url = $a->get_baseurl() . '/redir/' . $contact['id'];
+ if(local_user() && ($contact['uid'] == local_user()) && ($contact['network'] === 'dfrn')) {
+ $url = $redirect_url;
+ $sparkle = ' sparkle';
+ }
+ }
+ $click = ((x($contact,'click')) ? ' onclick="' . $contact['click'] . '" ' : '');
+ if($click)
+ $url = '';
+ return '
' . "\r\n";
+}}
+
+
+
if(! function_exists('search')) {
function search($s) {
$a = get_app();
@@ -1918,7 +2103,7 @@ function aes_encrypt($val,$ky)
if(! function_exists('linkify')) {
function linkify($s) {
- $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", '
$1', $s);
+ $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%\$\!\+]*)/", '
$1', $s);
return($s);
}}
@@ -1940,8 +2125,11 @@ function smilies($s) {
$a = get_app();
return str_replace(
- array( ':-)', ';-)', ':-(', ':(', ':-P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
+ array( '<3', '</3', '<\\3', ':-)', ';-)', ':-(', ':(', ':-P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
array(
+ '
',
+ '
',
+ '
',
'
',
'
',
'
',
@@ -2062,7 +2250,7 @@ function profile_sidebar($profile) {
$tabs = '';
- $photo = '
';
+ $photo = '
';
$connect = (($profile['uid'] != local_user()) ? '
' . t('Connect') . '' : '');
@@ -2090,9 +2278,9 @@ function profile_sidebar($profile) {
$pubkey = ((x($profile,'pubkey') == 1) ? '
' . $profile['pubkey'] . '
' : '');
- $marital = ((x($profile,'marital') == 1) ? '
♥ ' . t('Status:') . ' ' . $profile['marital'] . '
' . t('Birthdays this week:') . '
';
+ $total = 0;
+ foreach($r as $rr)
+ if(strlen($rr['name']))
+ $total ++;
+
+ $o .= '
' . t('Birthday Reminders') . ' ' . '(' . $total . ')' . '
';
+ $o .= '
' . t('Birthdays this week:') . '
';
$o .= '
' . t("\x28Adjusted for local time\x29") . '
';
$o .= '
';
foreach($r as $rr) {
+ if(! strlen($rr['name']))
+ continue;
$now = strtotime('now');
$today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false);
@@ -2229,7 +2424,7 @@ function get_birthdays() {
. '
' ;
}
- $o .= '
';
+ $o .= '';
}
return $o;
@@ -2259,10 +2454,15 @@ function link_compare($a,$b) {
if(! function_exists('prepare_body')) {
function prepare_body($item) {
+ return prepare_text($item['body']);
+}}
+
+if(! function_exists('prepare_text')) {
+function prepare_text($text) {
require_once('include/bbcode.php');
- $s = smilies(bbcode($item['body']));
+ $s = smilies(bbcode($text));
return $s;
}}
@@ -2281,46 +2481,56 @@ function prepare_body($item) {
* $cmd and string args are surrounded with ""
*/
-if(! function_exists('run_proc')) {
+if(! function_exists('proc_run')) {
function proc_run($cmd){
+
+ $a = get_app();
+
$args = func_get_args();
call_hooks("proc_run", $args);
+
+ if(count($args) && $args[0] === 'php')
+ $args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
- foreach ($args as &$arg){
- if(is_string($arg)) $arg='"'.$arg.'"';
+ foreach ($args as $arg){
+ $arg = escapeshellarg($arg);
}
$cmdline = implode($args," ");
proc_close(proc_open($cmdline." &",array(),$foo));
}}
-/*
- * Return full URL to theme which is currently in effect.
- * Provide a sane default if nothing is chosen or the specified theme does not exist.
- */
-
-if(! function_exists('current_theme_url')) {
-function current_theme_url() {
-
+if(! function_exists('current_theme')) {
+function current_theme(){
$app_base_themes = array('duepuntozero', 'loozah');
-
+
$a = get_app();
-
+
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
$theme_name = ((x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
-
+
if($theme_name && file_exists('view/theme/' . $theme_name . '/style.css'))
- return($a->get_baseurl() . '/view/theme/' . $theme_name . '/style.css');
-
+ return($theme_name);
+
foreach($app_base_themes as $t) {
if(file_exists('view/theme/' . $t . '/style.css'))
- return($a->get_baseurl() . '/view/theme/' . $t . '/style.css');
- }
-
+ return($t);
+ }
+
$fallback = glob('view/theme/*/style.css');
if(count($fallback))
- return($a->get_baseurl() . $fallback[0]);
+ return (str_replace('view/theme/','', str_replace("/style.css","",$fallback[0])));
-
+}}
+
+/*
+* Return full URL to theme which is currently in effect.
+* Provide a sane default if nothing is chosen or the specified theme does not exist.
+*/
+if(! function_exists('current_theme_url')) {
+function current_theme_url() {
+ global $a;
+ $t = current_theme();
+ return($a->get_baseurl() . '/view/theme/' . $t . '/style.css');
}}
if(! function_exists('feed_birthday')) {
@@ -2407,3 +2617,51 @@ function feed_salmonlinks($nick) {
return $salmon;
}}
+if(! function_exists('get_plink')) {
+function get_plink($item) {
+ $a = get_app();
+ $plink = (((x($item,'plink')) && (! $item['private'])) ? '