diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/appman.php | 102 | ||||
-rw-r--r-- | mod/apps.php | 35 | ||||
-rw-r--r-- | mod/chanview.php | 16 | ||||
-rw-r--r-- | mod/display.php | 15 | ||||
-rwxr-xr-x | mod/events.php | 23 | ||||
-rw-r--r-- | mod/home.php | 6 | ||||
-rw-r--r-- | mod/import.php | 8 | ||||
-rw-r--r-- | mod/item.php | 11 | ||||
-rwxr-xr-x | mod/mood.php | 9 | ||||
-rw-r--r-- | mod/notes.php | 4 | ||||
-rw-r--r-- | mod/photo.php | 34 | ||||
-rw-r--r-- | mod/post.php | 22 | ||||
-rw-r--r-- | mod/search.php | 21 | ||||
-rw-r--r-- | mod/settings.php | 9 | ||||
-rwxr-xr-x | mod/setup.php | 18 | ||||
-rw-r--r-- | mod/zfinger.php | 15 |
16 files changed, 279 insertions, 69 deletions
diff --git a/mod/appman.php b/mod/appman.php new file mode 100644 index 000000000..0cc108079 --- /dev/null +++ b/mod/appman.php @@ -0,0 +1,102 @@ +<?php /** @file */ + +require_once('include/apps.php'); + +function appman_post(&$a) { + + if(! local_user()) + return; + + if($_POST['url']) { + $arr = array( + 'uid' => intval($_REQUEST['uid']), + 'url' => escape_tags($_REQUEST['url']), + 'guid' => escape_tags($_REQUEST['guid']), + 'author' => escape_tags($_REQUEST['author']), + 'addr' => escape_tags($_REQUEST['addr']), + 'name' => escape_tags($_REQUEST['name']), + 'desc' => escape_tags($_REQUEST['desc']), + 'photo' => escape_tags($_REQUEST['photo']), + 'version' => escape_tags($_REQUEST['version']), + 'price' => escape_tags($_REQUEST['price']), + 'sig' => escape_tags($_REQUEST['sig']) + ); + + $_REQUEST['appid'] = app_install(local_user(),$arr); + + if(app_installed(local_user(),$arr)) + info( t('App installed.') . EOL); + + return; + } + + + $papp = app_decode($_POST['papp']); + + if(! is_array($papp)) { + notice( t('Malformed app.') . EOL); + return; + } + + if($_POST['install']) { + app_install(local_user(),$papp); + if(app_installed(local_user(),$papp)) + info( t('App installed.') . EOL); + } + + if($_POST['delete']) { + app_destroy(local_user(),$papp); + } + + if($_POST['edit']) { + return; + } + + if($_SESSION['return_url']) + goaway(z_root() . '/' . $_SESSION['return_url']); + goaway(z_root() . '/apps/personal'); + + +} + + +function appman_content(&$a) { + + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return; + } +logger('content'); + $channel = $a->get_channel(); + $app = null; + $embed = null; + if($_REQUEST['appid']) { + $r = q("select * from app where app_id = '%s' and app_channel = %d limit 1", + dbesc($_REQUEST['appid']), + dbesc(local_user()) + ); + if($r) + $app = $r[0]; + $embed = array('embed', t('Embed code'), app_encode($app,true),'', 'onclick="this.select();"'); + + } + + return replace_macros(get_markup_template('app_create.tpl'), array( + + '$banner' => (($app) ? t('Edit App') : t('Create App')), + '$app' => $app, + '$guid' => (($app) ? $app['app_id'] : ''), + '$author' => (($app) ? $app['app_author'] : $channel['channel_hash']), + '$addr' => (($app) ? $app['app_addr'] : $channel['xchan_addr']), + '$name' => array('name', t('Name of app'),(($app) ? $app['app_name'] : ''), t('Required')), + '$url' => array('url', t('Location (URL) of app'),(($app) ? $app['app_url'] : ''), t('Required')), + '$desc' => array('desc', t('Description'),(($app) ? $app['app_desc'] : ''), ''), + '$photo' => array('photo', t('Photo icon URL'),(($app) ? $app['app_photo'] : ''), t('80 x 80 pixels - optional')), + '$version' => array('version', t('Version ID'),(($app) ? $app['app_version'] : ''), ''), + '$price' => array('price', t('Price of app'),(($app) ? $app['app_price'] : ''), ''), + '$page' => array('page', t('Location (URL) to purchase app'),(($app) ? $app['app_page'] : ''), ''), + '$embed' => $embed, + '$submit' => t('Submit') + )); + +} diff --git a/mod/apps.php b/mod/apps.php index 43540a3de..e88c54c66 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -1,16 +1,39 @@ <?php +require_once('include/apps.php'); + function apps_content(&$a) { - $apps = $a->get_apps(); - if(count($apps) == 0) - notice( t('No installed applications.') . EOL); + if(argc() == 1 || (! local_user())) { + + $apps = get_system_apps(); + + // $o .= print_r($apps,true); + + // return $o; + + return replace_macros(get_markup_template('apps.tpl'), array( + '$title' => t('Apps'), + '$apps' => $apps, + )); + } + + if(argc() == 3 && argv(2) == 'edit') + $mode = 'edit'; + else + $mode = 'list'; + $apps = array(); + $list = app_list(local_user()); + if($list) { + foreach($list as $app) { + $apps[] = app_render(app_encode($app),$mode); + } + } - $tpl = get_markup_template("apps.tpl"); - return replace_macros($tpl, array( - '$title' => t('Applications'), + return replace_macros(get_markup_template('myapps.tpl'), array( + '$title' => t('Apps'), '$apps' => $apps, )); diff --git a/mod/chanview.php b/mod/chanview.php index ca3410c8f..449a98bb1 100644 --- a/mod/chanview.php +++ b/mod/chanview.php @@ -84,15 +84,17 @@ function chanview_content(&$a) { $url = zid($url); // let somebody over-ride the iframed viewport presentation + // or let's just declare this a failed experiment. - if((! local_user()) || (get_pconfig(local_user(),'system','chanview_full'))) - goaway($url); +// if((! local_user()) || (get_pconfig(local_user(),'system','chanview_full'))) + + goaway($url); - $o = replace_macros(get_markup_template('chanview.tpl'),array( - '$url' => $url, - '$full' => t('toggle full screen mode') - )); +// $o = replace_macros(get_markup_template('chanview.tpl'),array( +// '$url' => $url, +// '$full' => t('toggle full screen mode') +// )); - return $o; +// return $o; }
\ No newline at end of file diff --git a/mod/display.php b/mod/display.php index f4d4c38c3..8eb271b9c 100644 --- a/mod/display.php +++ b/mod/display.php @@ -77,8 +77,8 @@ function display_content(&$a, $update = 0, $load = false) { $target_item = null; - $r = q("select id, uid, mid, parent_mid, item_restrict from item where mid = '%s' limit 1", - dbesc($item_hash) + $r = q("select id, uid, mid, parent_mid, item_restrict from item where mid like '%s' limit 1", + dbesc($item_hash . '%') ); if($r) { @@ -149,6 +149,10 @@ function display_content(&$a, $update = 0, $load = false) { if($load || ($_COOKIE['jsAvailable'] != 1)) { $r = null; + + require_once('include/identity.php'); + $sys = get_sys_channel(); + if(local_user()) { $r = q("SELECT * from item WHERE item_restrict = 0 @@ -168,16 +172,17 @@ function display_content(&$a, $update = 0, $load = false) { $r = q("SELECT * from item WHERE item_restrict = 0 and mid = '%s' - AND ((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' + AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 ) and owner_xchan in ( " . stream_perms_xchans(($observer) ? PERMS_NETWORK : PERMS_PUBLIC) . " )) + OR owner_xchan = '%s') $sql_extra ) group by mid limit 1", - dbesc($target_item['parent_mid']) + dbesc($target_item['parent_mid']), + dbesc($sys['xchan_hash']) ); } - } else { $r = array(); diff --git a/mod/events.php b/mod/events.php index 8bf8c6ce1..e7b5e35a9 100755 --- a/mod/events.php +++ b/mod/events.php @@ -125,9 +125,10 @@ function events_post(&$a) { $datarray['created'] = $created; $datarray['edited'] = $edited; - $item_id = event_store($datarray); + $event = event_store_event($datarray); + $item_id = event_store_item($datarray,$event); - if(! $cid) + if($share) proc_run('php',"include/notifier.php","event","$item_id"); } @@ -158,10 +159,11 @@ function events_content(&$a) { } - $plaintext = true; + $plaintext = true; + + if(feature_enabled(local_user(),'richtext')) + $plaintext = false; - if(feature_enabled(local_user(),'richtext')) - $plaintext = false; $htpl = get_markup_template('event_head.tpl'); @@ -189,6 +191,10 @@ function events_content(&$a) { $mode = 'edit'; $event_id = argv(2); } + if(argc() > 2 && argv(1) === 'add') { + $mode = 'add'; + $item_id = intval(argv(2)); + } if(argv(1) === 'new') { $mode = 'new'; $event_id = ''; @@ -200,6 +206,11 @@ function events_content(&$a) { } } + if($mode === 'add') { + event_addtocal($item_id,local_user()); + killme(); + } + if($mode == 'view') { @@ -341,7 +352,7 @@ function events_content(&$a) { 'is_first'=>$is_first, 'item'=>$rr, 'html'=>$html, - 'plink' => array($rr['plink'],t('link to source'),'',''), + 'plink' => array($rr['plink'],t('Link to Source'),'',''), ); diff --git a/mod/home.php b/mod/home.php index 05626dcb5..862f6303c 100644 --- a/mod/home.php +++ b/mod/home.php @@ -12,9 +12,11 @@ function home_init(&$a) { $channel = $a->get_channel(); if(local_user() && $channel && $channel['xchan_url']) { - $dest = get_pconfig(local_user(),'system','startpage'); + $dest = $channel['channel_startpage']; if(! $dest) - $dest = z_root() . '/network'; + $dest = get_pconfig(local_user(),'system','startpage'); + if(! $dest) + $dest = z_root() . '/apps'; goaway($dest); } diff --git a/mod/import.php b/mod/import.php index 5b3b53156..d3b237c3a 100644 --- a/mod/import.php +++ b/mod/import.php @@ -254,12 +254,18 @@ function import_post(&$a) { require_once('include/photo/photo_driver.php'); $photos = import_profile_photo($xchan['xchan_photo_l'],$xchan['xchan_hash']); - $r = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' + if($photos[4]) + $photodate = '0000-00-00 00:00:00'; + else + $photodate = $xchan['xchan_photo_date']; + + $r = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s', xchan_photo_date = '%s' where xchan_hash = '%s' limit 1", dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]), dbesc($photos[3]), + dbesc($photodate), dbesc($xchan_hash) ); diff --git a/mod/item.php b/mod/item.php index 164b345f0..68582e580 100644 --- a/mod/item.php +++ b/mod/item.php @@ -440,6 +440,11 @@ function item_post(&$a) { $body = preg_replace_callback('/\[\$b64url(.*?)\[\/(url)\]/ism','red_unescape_codeblock',$body); $body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','red_unescape_codeblock',$body); + // fix any img tags that should be zmg + + $body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$body); + + /** * @@ -847,10 +852,10 @@ function item_content(&$a) { require_once('include/security.php'); if((argc() == 3) && (argv(1) === 'drop') && intval(argv(2))) { + require_once('include/items.php'); - $i = q("select id, uid, author_xchan, owner_xchan, source_xchan, item_restrict from item where id = %d and uid = %d limit 1", - intval(argv(2)), - intval(local_user()) + $i = q("select id, uid, author_xchan, owner_xchan, source_xchan, item_restrict from item where id = %d limit 1", + intval(argv(2)) ); if($i) { diff --git a/mod/mood.php b/mod/mood.php index 5075f622d..5508fcb5a 100755 --- a/mod/mood.php +++ b/mod/mood.php @@ -60,7 +60,7 @@ function mood_init(&$a) { $mid = item_message_id(); - $action = sprintf( t('%1$s is currently %2$s'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]); + $action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]); $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_UNSEEN; if(! $parent_mid) $item_flags |= ITEM_THREAD_TOP; @@ -93,14 +93,7 @@ function mood_init(&$a) { $item_id = $post['item_id']; if($item_id) { -// q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", -// dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id), -// intval($uid), -// intval($item_id) -// ); - proc_run('php',"include/notifier.php","activity", $item_id); - } call_hooks('post_local_end', $arr); diff --git a/mod/notes.php b/mod/notes.php index e21e4386c..84f8a7093 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -1,9 +1,9 @@ <?php /** @file */ function notes_init(&$a) { + if(! local_user()) return; - logger('mod_notes: ' . print_r($_REQUEST,true)); $ret = array('success' => true); if($_REQUEST['note_text'] || $_REQUEST['note_text'] == '') { @@ -18,7 +18,7 @@ function notes_init(&$a) { build_sync_packet(); } - logger('notes saved.'); + logger('notes saved.', LOGGER_DEBUG); json_return_and_die($ret); } diff --git a/mod/photo.php b/mod/photo.php index 1319f9569..9302278b6 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -80,6 +80,22 @@ function photo_init(&$a) { * Other photos */ + /* Check for a cookie to indicate display pixel density, in order to detect high-resolution + displays. This procedure was derived from the "Retina Images" by Jeremey Worboys, + used in accordance with the Creative Commons Attribution 3.0 Unported License. + Project link: https://github.com/Retina-Images/Retina-Images + License link: http://creativecommons.org/licenses/by/3.0/ + */ + $cookie_value = false; + if (isset($_COOKIE['devicePixelRatio'])) { + $cookie_value = intval($_COOKIE['devicePixelRatio']); + } + else { + // Force revalidation of cache on next request + $cache_directive = 'no-cache'; + $status = 'no cookie'; + } + $resolution = 0; if(strpos($photo,'.') !== false) @@ -88,7 +104,23 @@ function photo_init(&$a) { if(substr($photo,-2,1) == '-') { $resolution = intval(substr($photo,-1,1)); $photo = substr($photo,0,-2); + // If viewing on a high-res screen, attempt to serve a higher resolution image: + if ($resolution == 2 && ($cookie_value > 1)) + { + $resolution = 1; + } } + + // If using resolution 1, make sure it exists before proceeding: + if ($resolution == 1) + { + $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1", + dbesc($photo), + intval($resolution) + ); + if (!($r)) + $resolution = 2; + } $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1", dbesc($photo), @@ -125,7 +157,7 @@ function photo_init(&$a) { dbesc($photo), intval($resolution) ); - + if($r) { logger('mod_photo: forbidden. ' . $a->query_string); $observer = $a->get_observer(); diff --git a/mod/post.php b/mod/post.php index 1f817aa40..05053e798 100644 --- a/mod/post.php +++ b/mod/post.php @@ -646,6 +646,28 @@ function post_post(&$a) { intval($hub['hubloc_id']) ); + // a dead hub came back to life - reset any tombstones we might have + + if($hub['hubloc_status'] & HUBLOC_OFFLINE) { + q("update hubloc set hubloc_status = (hubloc_status ^ %d) where hubloc_id = %d limit 1", + intval(HUBLOC_OFFLINE), + intval($hub['hubloc_id']) + ); + if($r[0]['hubloc_flags'] & HUBLOC_FLAGS_ORPHANCHECK) { + q("update hubloc set hubloc_flags = (hubloc_flags ^ %d) where hubloc_id = %d limit 1", + intval(HUBLOC_FLAGS_ORPHANCHECK), + intval($hub['hubloc_id']) + ); + } + q("update xchan set xchan_flags = (xchan_flags ^ %d) where (xchan_flags & %d) and xchan_hash = '%s' limit 1", + intval(XCHAN_FLAGS_ORPHAN), + intval(XCHAN_FLAGS_ORPHAN), + dbesc($hub['hubloc_hash']) + ); + } + + + /** * This hub has now been proven to be valid. * Any hub with the same URL and a different sitekey cannot be valid. diff --git a/mod/search.php b/mod/search.php index 82990913b..2c2e8c86a 100644 --- a/mod/search.php +++ b/mod/search.php @@ -39,7 +39,8 @@ function search_content(&$a,$update = 0, $load = false) { $search = ((x($_GET,'tag')) ? trim(rawurldecode($_GET['tag'])) : ''); } - $o .= search($search,'search-box','/search',((local_user()) ? true : false)); + if((! local_user()) || (! feature_enabled(local_user(),'savedsearch'))) + $o .= search($search,'search-box','/search',((local_user()) ? true : false)); if(strpos($search,'#') === 0) { $tag = true; @@ -114,6 +115,10 @@ function search_content(&$a,$update = 0, $load = false) { $pub_sql = public_permissions_sql(get_observer_hash()); + require_once('include/identity.php'); + + $sys = get_sys_channel(); + if(($update) && ($load)) { $itemspage = get_pconfig(local_user(),'system','itemspage'); $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); @@ -125,24 +130,24 @@ function search_content(&$a,$update = 0, $load = false) { if(local_user()) { $r = q("SELECT distinct mid, item.id as item_id, item.* from item WHERE item_restrict = 0 - AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 ) - OR ( `item`.`uid` = %d )) + AND ((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 ) + OR ( `item`.`uid` = %d )) OR item.owner_xchan = '%s' ) $sql_extra group by mid ORDER BY created DESC $pager_sql ", intval(local_user()), - intval(ABOOK_FLAG_BLOCKED) - + dbesc($sys['xchan_hash']) ); } if($r === null) { $r = q("SELECT distinct mid, item.id as item_id, item.* from item WHERE item_restrict = 0 - AND ((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' + AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 ) and owner_xchan in ( " . stream_perms_xchans(($observer) ? PERMS_NETWORK : PERMS_PUBLIC) . " )) - $pub_sql ) + $pub_sql ) OR owner_xchan = '%s') $sql_extra - group by mid ORDER BY created DESC $pager_sql" + group by mid ORDER BY created DESC $pager_sql", + dbesc($sys['xchan_hash']) ); } } diff --git a/mod/settings.php b/mod/settings.php index 3ab34f145..e1ae0b8ec 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -150,12 +150,12 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','mobile_theme',$mobile_theme); } - $chanview_full = ((x($_POST,'chanview_full')) ? intval($_POST['chanview_full']) : 0); +// $chanview_full = ((x($_POST,'chanview_full')) ? intval($_POST['chanview_full']) : 0); set_pconfig(local_user(),'system','update_interval', $browser_update); set_pconfig(local_user(),'system','itemspage', $itemspage); set_pconfig(local_user(),'system','no_smilies',$nosmile); - set_pconfig(local_user(),'system','chanview_full',$chanview_full); +// set_pconfig(local_user(),'system','chanview_full',$chanview_full); if ($theme == $a->channel['channel_theme']){ @@ -714,7 +714,7 @@ function settings_content(&$a) { $unsupported = file_exists('view/theme/' . $th . '/unsupported'); $is_mobile = file_exists('view/theme/' . $th . '/mobile'); if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ - $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f); + $theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f); if($is_mobile) { $mobile_themes[$f]=$theme_name; } @@ -736,8 +736,6 @@ function settings_content(&$a) { $nosmile = get_pconfig(local_user(),'system','no_smilies'); $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0 - $chanview = intval(get_pconfig(local_user(),'system','chanview_full')); - $theme_config = ""; if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){ require_once($themeconfigfile); @@ -757,7 +755,6 @@ function settings_content(&$a) { '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), - '$chanview_full' => array('chanview_full', t('Do not view remote profiles in frames'), $chanview, t('By default open in a sub-window of your own site')), '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, )); diff --git a/mod/setup.php b/mod/setup.php index 9eccffe75..69e026056 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -45,14 +45,14 @@ function setup_post(&$a) { break; // just in case return don't return :) case 3: $urlpath = $a->get_path(); - $dbhost = notags(trim($_POST['dbhost'])); - $dbport = intval(notags(trim($_POST['dbport']))); - $dbuser = notags(trim($_POST['dbuser'])); - $dbpass = notags(trim($_POST['dbpass'])); - $dbdata = notags(trim($_POST['dbdata'])); - $phpath = notags(trim($_POST['phpath'])); - $adminmail = notags(trim($_POST['adminmail'])); - $siteurl = notags(trim($_POST['siteurl'])); + $dbhost = trim($_POST['dbhost']); + $dbport = intval(trim($_POST['dbport'])); + $dbuser = trim($_POST['dbuser']); + $dbpass = trim($_POST['dbpass']); + $dbdata = trim($_POST['dbdata']); + $phpath = trim($_POST['phpath']); + $adminmail = trim($_POST['adminmail']); + $siteurl = trim($_POST['siteurl']); require_once('include/dba/dba_driver.php'); unset($db); @@ -547,7 +547,7 @@ function check_htaccess(&$checks) { $help = ""; $ssl_error = false; - $url = $a->get_baseurl() . '/test/rewrite'; + $url = $a->get_baseurl() . '/setup/testrewrite'; if (function_exists('curl_init')){ $test = z_fetch_url($url); diff --git a/mod/zfinger.php b/mod/zfinger.php index dcc755992..ddfa37761 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -74,10 +74,15 @@ function zfinger_init(&$a) { */ $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash - where (( channel_pageflags & %d ) or not ( channel_pageflags & %d )) order by channel_id limit 1", - intval(PAGE_SYSTEM), - intval(PAGE_REMOVED) + where ( channel_pageflags & %d ) order by channel_id limit 1", + intval(PAGE_SYSTEM) ); + if(! $r) { + $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash + where not ( channel_pageflags & %d ) order by channel_id limit 1", + intval(PAGE_REMOVED) + ); + } } } else { @@ -116,8 +121,8 @@ function zfinger_init(&$a) { $profile['description'] = $p[0]['pdesc']; $profile['birthday'] = $p[0]['dob']; - if($profile['birthday'] != '0000-00-00') - $profile['next_birthday'] = z_birthday($p[0]['dob'],$e['channel_timezone']); + if(($profile['birthday'] != '0000-00-00') && (($bd = z_birthday($p[0]['dob'],$e['channel_timezone'])) !== '')) + $profile['next_birthday'] = $bd; if($age = age($p[0]['dob'],$e['channel_timezone'],'')) $profile['age'] = $age; |