diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/cloud.php | 86 | ||||
-rw-r--r-- | mod/impel.php | 113 | ||||
-rw-r--r-- | mod/item.php | 25 | ||||
-rw-r--r-- | mod/mail.php | 5 | ||||
-rw-r--r-- | mod/openid.php | 4 | ||||
-rw-r--r-- | mod/photo.php | 8 | ||||
-rw-r--r-- | mod/photos.php | 118 | ||||
-rw-r--r-- | mod/siteinfo.php | 62 | ||||
-rw-r--r-- | mod/thing.php | 2 |
9 files changed, 248 insertions, 175 deletions
diff --git a/mod/cloud.php b/mod/cloud.php index 1765c0b69..c21c4c4b6 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -1,31 +1,34 @@ <?php /** * @file mod/cloud.php - * @brief Initialize Red Matrix's cloud (SabreDAV) + * @brief Initialize RedMatrix's cloud (SabreDAV). * + * Module for accessing the DAV storage area. */ - use Sabre\DAV; - require_once('vendor/autoload.php'); +use Sabre\DAV; - // workaround for HTTP-auth in CGI mode - if(x($_SERVER,'REDIRECT_REMOTE_USER')) { - $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; - if(strlen($userpass)) { - list($name, $password) = explode(':', $userpass); - $_SERVER['PHP_AUTH_USER'] = $name; - $_SERVER['PHP_AUTH_PW'] = $password; - } - } +// composer autoloader for SabreDAV +require_once('vendor/autoload.php'); - if(x($_SERVER,'HTTP_AUTHORIZATION')) { - $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ; - if(strlen($userpass)) { - list($name, $password) = explode(':', $userpass); - $_SERVER['PHP_AUTH_USER'] = $name; - $_SERVER['PHP_AUTH_PW'] = $password; - } +// workaround for HTTP-auth in CGI mode +if(x($_SERVER, 'REDIRECT_REMOTE_USER')) { + $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; + if(strlen($userpass)) { + list($name, $password) = explode(':', $userpass); + $_SERVER['PHP_AUTH_USER'] = $name; + $_SERVER['PHP_AUTH_PW'] = $password; + } +} + +if(x($_SERVER, 'HTTP_AUTHORIZATION')) { + $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ; + if(strlen($userpass)) { + list($name, $password) = explode(':', $userpass); + $_SERVER['PHP_AUTH_USER'] = $name; + $_SERVER['PHP_AUTH_PW'] = $password; } +} /** * @brief Fires up the SabreDAV server. @@ -33,14 +36,12 @@ * @param App &$a */ function cloud_init(&$a) { - // call ($currenttheme)_init since we're operating outside of index.php - - $theme_info_file = "view/theme/".current_theme()."/php/theme.php"; + $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php"; if (file_exists($theme_info_file)){ require_once($theme_info_file); - if(function_exists(str_replace('-','_',current_theme()) . '_init')) { - $func = str_replace('-','_',current_theme()) . '_init'; + if(function_exists(str_replace('-', '_', current_theme()) . '_init')) { + $func = str_replace('-', '_', current_theme()) . '_init'; $func($a); } } @@ -48,16 +49,15 @@ function cloud_init(&$a) { require_once('include/reddav.php'); if(! is_dir('store')) - os_mkdir('store',STORAGE_DEFAULT_PERMISSIONS,false); + os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false); $which = null; if(argc() > 1) $which = argv(1); $profile = 0; - $channel = $a->get_channel(); - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n" ; + $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n"; if($which) profile_load($a, $which, $profile); @@ -70,12 +70,11 @@ function cloud_init(&$a) { if(local_user()) { $channel = $a->get_channel(); $auth->setCurrentUser($channel['channel_address']); - $auth->channel_name = $channel['channel_address']; $auth->channel_id = $channel['channel_id']; $auth->channel_hash = $channel['channel_hash']; $auth->channel_account_id = $channel['channel_account_id']; if($channel['channel_timezone']) - $auth->timezone = $channel['channel_timezone']; + $auth->setTimezone($channel['channel_timezone']); } $auth->observer = $ob_hash; } @@ -83,13 +82,13 @@ function cloud_init(&$a) { if($_GET['davguest']) $_SESSION['davguest'] = true; - $_SERVER['QUERY_STRING'] = str_replace(array('?f=','&f='),array('',''),$_SERVER['QUERY_STRING']); + $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']); $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']); - $_SERVER['QUERY_STRING'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism','',$_SERVER['QUERY_STRING']); + $_SERVER['QUERY_STRING'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['QUERY_STRING']); - $_SERVER['REQUEST_URI'] = str_replace(array('?f=','&f='),array('',''),$_SERVER['REQUEST_URI']); + $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); - $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism','',$_SERVER['REQUEST_URI']); + $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['REQUEST_URI']); $rootDirectory = new RedDirectory('/', $auth); @@ -101,11 +100,15 @@ function cloud_init(&$a) { $server->addPlugin($lockPlugin); - // The next section of code allows us to bypass prompting for http-auth if a FILE is being accessed anonymously and permissions - // allow this. This way one can create hotlinks to public media files in their cloud and anonymous viewers won't get asked to login. - // If a DIRECTORY is accessed or there are permission issues accessing the file and we aren't previously authenticated via zot, - // prompt for HTTP-auth. This will be the default case for mounting a DAV directory. - // In order to avoid prompting for passwords for viewing a DIRECTORY, add the URL query parameter 'davguest=1' + // The next section of code allows us to bypass prompting for http-auth if a + // FILE is being accessed anonymously and permissions allow this. This way + // one can create hotlinks to public media files in their cloud and anonymous + // viewers won't get asked to login. + // If a DIRECTORY is accessed or there are permission issues accessing the + // file and we aren't previously authenticated via zot, prompt for HTTP-auth. + // This will be the default case for mounting a DAV directory. + // In order to avoid prompting for passwords for viewing a DIRECTORY, add + // the URL query parameter 'davguest=1'. $isapublic_file = false; $davguest = ((x($_SESSION, 'davguest')) ? true : false); @@ -116,22 +119,21 @@ function cloud_init(&$a) { if($x instanceof RedFile) $isapublic_file = true; } - catch ( Exception $e ) { + catch (Exception $e) { $isapublic_file = false; } } if((! $auth->observer) && (! $isapublic_file) && (! $davguest)) { try { - $auth->Authenticate($server, t('Red Matrix - Guests: Username: {your email address}, Password: +++')); + $auth->Authenticate($server, t('RedMatrix - Guests: Username: {your email address}, Password: +++')); } - catch ( Exception $e) { + catch (Exception $e) { logger('mod_cloud: auth exception' . $e->getMessage()); http_status_exit($e->getHTTPCode(), $e->getMessage()); } } - // provide a directory view for the cloud in Red Matrix $browser = new RedBrowser($auth); diff --git a/mod/impel.php b/mod/impel.php new file mode 100644 index 000000000..3c29d7cdb --- /dev/null +++ b/mod/impel.php @@ -0,0 +1,113 @@ +<?php /** @file */ + +// import page design element + + +function impel_init(&$a) { + + $ret = array('success' => false); + + if(! $local_user()) + json_return_and_die($ret); + + $elm = $_REQUEST['element']; + $x = base64_urldecode($elm); + if(! $x) + json_return_and_die($ret); + + $j = json_decode($x,true); + if(! $j) + json_return_and_die($ret); + + + $channel = get_channel(); + + $arr = array(); + + switch($j['type']) { + case 'webpage': + $arr['item_restrict'] = ITEM_WEBPAGE; + $namespace = 'WEBPAGE'; + break; + case 'block': + $arr['item_restrict'] = ITEM_BUILDBLOCK; + $namespace = 'BUILDBLOCK'; + break; + case 'layout': + $arr['item_restrict'] = ITEM_PDL; + $namespace = 'PDL'; + break; + default: + logger('mod_impel: unrecognised element type' . print_r($j,true)); + break; + } + $arr['uid'] = local_user(); + $arr['aid'] = $channel['channel_account_id']; + $arr['title'] = $j['title']; + $arr['body'] = $j['body']; + $arr['term'] = $j['term']; + $arr['owner_xchan'] = get_observer_hash(); + $arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : $get_observer_hash()); + $arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode'); + + if(! $j['mid']) + $j['mid'] = item_message_id(); + + $arr['mid'] = $arr['parent_mid'] = $j['mid']; + + + if($j['pagetitle']) { + require_once('library/urlify/URLify.php'); + $pagetitle = strtolower(URLify::transliterate($j['pagetitle'])); + } + + + + + $channel = get_channel(); + + // Verify ability to use html or php!!! + + $execflag = false; + + if($arr['mimetype'] === 'application/x-php') { + $z = q("select account_id, account_roles from account left join channel on channel_account_id = account_id where channel_id = %d limit 1", + intval(local_user()) + ); + + if($z && ($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) { + $execflag = true; + } + } + + $remote_id = 0; + + $z = q("select * from item_id where $sid = '%s' and service = '%s' and uid = %d limit 1", + dbesc($pagetitle), + dbesc($namespace), + intval(local_user()) + ); + $i = q("select id from item where mid = '%s' and $uid = %d limit 1", + dbesc($arr['mid']), + intval(local_user()) + ); + if($z && $i) { + $remote_id = $z[0]['id']; + $arr['id'] = $i[0]['id']; + $x = item_store_update($arr,$execflag); + } + else { + $x = item_store($arr,$execflag); + } + if($x['success']) + $item_id = $x['item_id']; + + $channel = get_channel(); + + update_remote_id($channel,$item_id,$arr['item_restrict'],$pagetitle,$namespace,$remote_id,$arr['mid']); + + + $ret['success'] = true; + json_return_and_die(true); + +}
\ No newline at end of file diff --git a/mod/item.php b/mod/item.php index 7f25b35b8..2364e6abf 100644 --- a/mod/item.php +++ b/mod/item.php @@ -81,18 +81,22 @@ function item_post(&$a) { $layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): ''); $plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : ''); + // allow API to bulk load a bunch of imported items with sending out a bunch of posts. + $nopush = ((x($_REQUEST,'nopush')) ? intval($_REQUEST['nopush']) : 0); + /* - Check service class limits - */ + * Check service class limits + */ if (local_user() && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) { - $ret=item_check_service_class(local_user(),x($_REQUEST,'webpage')); - if (!$ret['success']) { - notice( t($ret['message']) . EOL) ; - if(x($_REQUEST,'return')) + $ret = item_check_service_class(local_user(),x($_REQUEST,'webpage')); + if (!$ret['success']) { + notice( t($ret['message']) . EOL) ; + if(x($_REQUEST,'return')) goaway($a->get_baseurl() . "/" . $return_path ); killme(); + } } - } + if($pagetitle) { require_once('library/urlify/URLify.php'); $pagetitle = strtolower(URLify::transliterate($pagetitle)); @@ -780,7 +784,9 @@ function item_post(&$a) { update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); - proc_run('php', "include/notifier.php", 'edit_post', $post_id); + if(! $nopush) + proc_run('php', "include/notifier.php", 'edit_post', $post_id); + if((x($_REQUEST,'return')) && strlen($return_path)) { logger('return: ' . $return_path); goaway($a->get_baseurl() . "/" . $return_path ); @@ -866,7 +872,8 @@ function item_post(&$a) { call_hooks('post_local_end', $datarray); - proc_run('php', 'include/notifier.php', $notify_type, $post_id); + if(! $nopush) + proc_run('php', 'include/notifier.php', $notify_type, $post_id); logger('post_complete'); diff --git a/mod/mail.php b/mod/mail.php index d6d802fe7..f4897149a 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -72,7 +72,10 @@ function mail_post(&$a) { if(! ($their_perms & PERMS_W_MAIL)) { notice( t('Selected channel has private message restrictions. Send failed.')); - return; + // reported issue: let's still save the message and continue. We'll just tell them + // that nothing useful is likely to happen. They might have spent hours on it. + // return; + } } diff --git a/mod/openid.php b/mod/openid.php index 2112e0af4..ce7fe22ba 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -127,6 +127,8 @@ function openid_content(&$a) { elseif($photo_other) $pphoto = $photo_other; + $mimetype = guess_image_type($pphoto); + $x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype, xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags) @@ -135,7 +137,7 @@ function openid_content(&$a) { dbesc(''), dbesc(''), dbesc(''), - dbesc('image/jpeg'), + dbesc($mimetype), dbesc($pphoto), dbesc($addr), dbesc($url), diff --git a/mod/photo.php b/mod/photo.php index 9302278b6..0329fe0a8 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -71,7 +71,7 @@ function photo_init(&$a) { } if(! isset($data)) { $data = file_get_contents($default); - $mimetype = 'image/jpeg'; + $mimetype = 'image/png'; } } else { @@ -176,15 +176,15 @@ function photo_init(&$a) { case 4: $data = file_get_contents(get_default_profile_photo()); - $mimetype = 'image/jpeg'; + $mimetype = 'image/png'; break; case 5: $data = file_get_contents(get_default_profile_photo(80)); - $mimetype = 'image/jpeg'; + $mimetype = 'image/png'; break; case 6: $data = file_get_contents(get_default_profile_photo(48)); - $mimetype = 'image/jpeg'; + $mimetype = 'image/png'; break; default: killme(); diff --git a/mod/photos.php b/mod/photos.php index 0ff0e29c9..dc593f22b 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -653,11 +653,8 @@ function photos_content(&$a) { intval($a->pager['itemspage']) ); - $o .= '<div class="section-title-wrapper">'; - $o .= '<h2>' . $album . '</h2>'; - $o .= '<div class="section-title-submenu">'; if($cmd === 'edit') { - if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { + if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { if($a->get_template_engine() === 'internal') { $album_e = template_escape($album); @@ -679,35 +676,21 @@ function photos_content(&$a) { } } else { - if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { + if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { - $o .= '<a href="'. $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '/edit' . '">' . t('Edit Album') . '</a>'; + $edit = array(t('Edit Album'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '/edit'); } } } if($_GET['order'] === 'posted') - $o .= '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a>'; + $order = array(t('Show Newest First'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album)); else - $o .= '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a>'; + $order = array(t('Show Oldest First'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted'); - /* - if($can_post) { - $o .= '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</<a>'; - } - */ - - $o .= '</div>'; // section-title-submenu - $o .= '</div>'; // section-title-wrapper - - $ajaxout = ''; - - $tpl = get_markup_template('photo_album.tpl'); + $photos = array(); if(count($r)) { $twist = 'rotright'; - $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>"; - $o .= '<div id="photo-album-contents">'; - foreach($r as $rr) { if($twist == 'rotright') @@ -720,57 +703,58 @@ function photos_content(&$a) { $imgalt_e = $rr['filename']; $desc_e = $rr['description']; - -// prettyphoto has potential license issues, so we can no longer include it in core -// The following lines would need to be modified so that they are provided in theme specific files -// instead of core modules for themes that wish to make use of prettyphoto. I would suggest -// the feature as a per-theme display option and putting the rel line inside a template. - -// if(feature_enabled($a->data['channel']['channel_id'],'prettyphoto')){ -// $imagelink = ($a->get_baseurl() . '/photo/' . $rr['resource_id'] . '.' . $ext ); -// $rel=("prettyPhoto[pp_gal]"); -// } -// else { - $imagelink = ($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] - . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '')); - $rel=("photo"); -// } - - - $tmp = replace_macros($tpl,array( - '$id' => $rr['id'], - '$twist' => ' ' . $twist . rand(2,4), - '$photolink' => $imagelink, - '$rel' => $rel, - '$phototitle' => t('View Photo'), - '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext, - '$imgalt' => $imgalt_e, - '$desc'=> $desc_e, - '$ext' => $ext, - '$hash'=> $rr['resource_id'], - )); - if($_REQUEST['aj']) - $ajaxout .= $tmp; - else - $o .= $tmp; + $imagelink = ($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] + . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '')); + + $rel=("photo"); + + $photos[] = array( + 'id' => $rr['id'], + 'twist' => ' ' . $twist . rand(2,4), + 'link' => $imagelink, + 'rel' => $rel, + 'title' => t('View Photo'), + 'src' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext, + 'alt' => $imgalt_e, + 'desc'=> $desc_e, + 'ext' => $ext, + 'hash'=> $rr['resource_id'], + ); } } + if($_REQUEST['aj']) { - if(! $r) { - $ajaxout .= '<div id="content-complete"></div>'; - echo $ajaxout; - killme(); + if($photos) { + $o = replace_macros(get_markup_template('photosajax.tpl'),array( + '$photos' => $photos, + )); + } + else { + $o = '<div id="content-complete"></div>'; } - echo $ajaxout; - echo '<script>justifyPhotosAjax();</script>'; + echo $o; + killme(); + } + else { + $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>"; + $tpl = get_markup_template('photo_album.tpl'); + $o .= replace_macros($tpl, array( + '$photos' => $photos, + '$album' => $album, + '$can_post' => $can_post, + '$upload' => array(t('Upload'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), + '$order' => $order, + '$edit' => $edit + )); + + } + + if((! $photos) && ($_REQUEST['aj'])) { + $o .= '<div id="content-complete"></div>'; + echo $o; killme(); } - $o .= '<div id="page-end"></div>'; - $o .= '</div>'; // photo-album-contents - $o .= '<div id="photo-album-end"></div>'; - $o .= '<script>$(document).ready(function() { loadingPage = false; justifyPhotos(); });</script>'; - $o .= '<div id="page-spinner"></div>'; // $o .= paginate($a); return $o; diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 4568906f3..de55c69cf 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -4,7 +4,8 @@ function siteinfo_init(&$a) { if ($a->argv[1]=="json"){ $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); - + $directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_SECONDARY','DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_STANDALONE'); + $sql_extra = ''; $r = q("select * from channel left join account on account_id = channel_account_id where ( account_roles & 4096 ) and account_default_channel = channel_id"); @@ -49,57 +50,20 @@ function siteinfo_init(&$a) { $site_info = get_config('system','info'); $site_name = get_config('system','sitename'); - // Statistics (from statistics.json plugin) + //Statistics + $channels_total_stat = intval(get_config('system','channels_total_stat')); + $channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat')); + $channels_active_monthly_stat = intval(get_config('system','channels_active_monthly_stat')); + $local_posts_stat = intval(get_config('system','local_posts_stat')); - $r = q("select count(channel_id) as channels_total from channel left join account on account_id = channel_account_id - where account_flags = 0 "); - if($r) - $channels_total = intval($r[0]['channels_total']); - - $r = q("select channel_id from channel left join account on account_id = channel_account_id - where account_flags = 0 and account_lastlog > UTC_TIMESTAMP - INTERVAL 6 MONTH"); - if($r) { - $s = ''; - foreach($r as $rr) { - if($s) - $s .= ','; - $s .= intval($rr['channel_id']); - } - $x = q("select uid from item where uid in ( $s ) and (item_flags & %d) and created > UTC_TIMESTAMP - INTERVAL 6 MONTH group by uid", - intval(ITEM_WALL) - ); - if($x) - $channels_active_halfyear = count($x); - } - - $r = q("select channel_id from channel left join account on account_id = channel_account_id - where account_flags = 0 and account_lastlog > UTC_TIMESTAMP - INTERVAL 1 MONTH"); - if($r) { - $s = ''; - foreach($r as $rr) { - if($s) - $s .= ','; - $s .= intval($rr['channel_id']); - } - $x = q("select uid from item where uid in ( $s ) and ( item_flags & %d ) and created > UTC_TIMESTAMP - INTERVAL 1 MONTH group by uid", - intval(ITEM_WALL) - ); - if($x) - $channels_active_monthly = count($x); - } - - $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE (item_flags & %d) ", - intval(ITEM_WALL) - ); - if (is_array($posts)) - $local_posts = intval($posts[0]["local_posts"]); - $data = Array( 'version' => RED_VERSION, 'commit' => $commit, 'url' => z_root(), 'plugins' => $visible_plugins, 'register_policy' => $register_policy[$a->config['system']['register_policy']], + 'directory_mode' => $directory_mode[$a->config['system']['directory_mode']], + 'language' => get_config('system','language'), 'diaspora_emulation' => get_config('system','diaspora_enabled'), 'rss_connections' => get_config('system','feed_contacts'), 'default_service_restrictions' => $service_class, @@ -107,10 +71,10 @@ function siteinfo_init(&$a) { 'site_name' => (($site_name) ? $site_name : ''), 'platform' => RED_PLATFORM, 'info' => (($site_info) ? $site_info : ''), - 'channels_total' => $channels_total, - 'channels_active_halfyear' => $channels_active_halfyear, - 'channels_active_monthly' => $channels_active_monthly, - 'local_posts' => $local_posts + 'channels_total' => $channels_total_stat, + 'channels_active_halfyear' => $channels_active_halfyear_stat, + 'channels_active_monthly' => $channels_active_monthly_stat, + 'local_posts' => $local_posts_stat ); json_return_and_die($data); } diff --git a/mod/thing.php b/mod/thing.php index 73722c5fa..c12976f22 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -67,8 +67,6 @@ function thing_init(&$a) { - - if($term_hash) { $t = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and obj_type = %d and term_hash = '%s' limit 1", intval(TERM_OBJ_THING), |