diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Pubsites.php | 4 | ||||
-rw-r--r-- | Zotlabs/Render/Theme.php | 44 |
3 files changed, 31 insertions, 21 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 84212270f..d0175549b 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -433,7 +433,7 @@ class Notifier { $env_recips = (($private) ? array() : null); - $details = q("select xchan_hash, xchan_instance_url, xchan_network, xchan_addr, xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . implode(',',$recipients) . ")"); + $details = q("select xchan_hash, xchan_instance_url, xchan_network, xchan_addr, xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . protect_sprintf(implode(',',$recipients)) . ")"); $recip_list = array(); @@ -500,7 +500,7 @@ class Notifier { // Now we have collected recipients (except for external mentions, FIXME) // Let's reduce this to a set of hubs; checking that the site is not dead. - $r = q("select hubloc.*, site.site_crypto, site.site_flags from hubloc left join site on site_url = hubloc_url where hubloc_hash in (" . implode(',',$recipients) . ") + $r = q("select hubloc.*, site.site_crypto, site.site_flags from hubloc left join site on site_url = hubloc_url where hubloc_hash in (" . protect_sprintf(implode(',',$recipients)) . ") and hubloc_error = 0 and hubloc_deleted = 0 and ( site_dead = 0 OR site_dead is null ) " ); diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index ef02cf099..daec5dde3 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -30,7 +30,7 @@ class Pubsites extends \Zotlabs\Web\Controller { if($ret['success']) { $j = json_decode($ret['body'],true); if($j) { - $o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Stats') . '</td><td>' . t('Software') . '</td>'; + $o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><!--td>' . t('Stats') . '</td--><td>' . t('Software') . '</td>'; if($rating_enabled) $o .= '<td colspan="2">' . t('Ratings') . '</td>'; $o .= '</tr>'; @@ -55,7 +55,7 @@ class Pubsites extends \Zotlabs\Web\Controller { $location = '<br /> '; } $urltext = str_replace(array('https://'), '', $jj['url']); - $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>'; + $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><!--td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td--><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>'; if($rating_enabled) $o .= '<td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links ; $o .= '</tr>'; diff --git a/Zotlabs/Render/Theme.php b/Zotlabs/Render/Theme.php index 3a0116abe..09cc7a4d4 100644 --- a/Zotlabs/Render/Theme.php +++ b/Zotlabs/Render/Theme.php @@ -2,6 +2,8 @@ namespace Zotlabs\Render; +use App; + class Theme { @@ -11,17 +13,28 @@ class Theme { static $session_theme = null; static $session_mobile_theme = null; - static $base_themes = array('redbasic'); + /** + * @brief Array with base or fallback themes. + */ + static $base_themes = array('redbasic'); + + /** + * @brief Figure out the best matching theme and return it. + * + * The theme will depend on channel settings, mobile, session, core compatibility, etc. + * + * @return array + */ static public function current(){ - self::$system_theme = ((isset(\App::$config['system']['theme'])) + self::$system_theme = ((isset(\App::$config['system']['theme'])) ? \App::$config['system']['theme'] : ''); - self::$session_theme = ((isset($_SESSION) && x($_SESSION,'theme')) + self::$session_theme = ((isset($_SESSION) && x($_SESSION, 'theme')) ? $_SESSION['theme'] : self::$system_theme); - self::$system_mobile_theme = ((isset(\App::$config['system']['mobile_theme'])) + self::$system_mobile_theme = ((isset(\App::$config['system']['mobile_theme'])) ? \App::$config['system']['mobile_theme'] : ''); - self::$session_mobile_theme = ((isset($_SESSION) && x($_SESSION,'mobile_theme')) + self::$session_mobile_theme = ((isset($_SESSION) && x($_SESSION, 'mobile_theme')) ? $_SESSION['mobile_theme'] : self::$system_mobile_theme); $page_theme = null; @@ -66,7 +79,7 @@ class Theme { $chosen_theme = $page_theme; } } - if(array_key_exists('theme_preview',$_GET)) + if(array_key_exists('theme_preview', $_GET)) $chosen_theme = $_GET['theme_preview']; // Allow theme selection of the form 'theme_name:schema_name' @@ -91,14 +104,12 @@ class Theme { } // Worst case scenario, the default base theme or themes don't exist; perhaps somebody renamed it/them. - - // Find any theme at all and use it. - - $fallback = array_merge(glob('view/theme/*/css/style.css'),glob('view/theme/*/php/style.php')); - if(count($fallback)) - return(array(str_replace('view/theme/','', substr($fallback[0],0,-14)))); + // Find any theme at all and use it. + $fallback = array_merge(glob('view/theme/*/css/style.css'), glob('view/theme/*/php/style.php')); + if(count($fallback)) + return(array(str_replace('view/theme/', '', substr($fallback[0], 0, -14)))); } @@ -107,12 +118,11 @@ class Theme { * * Provide a sane default if nothing is chosen or the specified theme does not exist. * - * @param bool $installing default false + * @param bool $installing (optional) default false, if true return the name of the first base theme * * @return string */ - - function url($installing = false) { + static public function url($installing = false) { if($installing) return self::$base_themes[0]; @@ -125,9 +135,10 @@ class Theme { $opts = ''; $opts = ((\App::$profile_uid) ? '?f=&puid=' . \App::$profile_uid : ''); - $schema_str = ((x(\App::$layout,'schema')) ? '&schema=' . App::$layout['schema'] : ''); + $schema_str = ((x(\App::$layout,'schema')) ? '&schema=' . App::$layout['schema'] : ''); if(($s) && (! $schema_str)) $schema_str = '&schema=' . $s; + $opts .= $schema_str; if(file_exists('view/theme/' . $t . '/php/style.php')) @@ -139,7 +150,6 @@ class Theme { function debug() { logger('system_theme: ' . self::$system_theme); logger('session_theme: ' . self::$session_theme); - } } |