diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/AConfig.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/Apps.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/System.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Acl.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Admin.php | 40 | ||||
-rw-r--r-- | Zotlabs/Module/Channel.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Connedit.php | 8 | ||||
-rw-r--r-- | Zotlabs/Module/Directory.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Help.php | 9 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 5 | ||||
-rw-r--r-- | Zotlabs/Module/Pubsites.php | 14 | ||||
-rw-r--r-- | Zotlabs/Module/Rate.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Ratings.php | 14 | ||||
-rw-r--r-- | Zotlabs/Module/Register.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Rpost.php | 5 | ||||
-rw-r--r-- | Zotlabs/Module/Settings.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Setup.php | 26 | ||||
-rw-r--r-- | Zotlabs/Render/Comanche.php | 65 | ||||
-rwxr-xr-x | Zotlabs/Render/SmartyTemplate.php | 11 |
20 files changed, 164 insertions, 64 deletions
diff --git a/Zotlabs/Lib/AConfig.php b/Zotlabs/Lib/AConfig.php index 24ec97dfa..ab8648a18 100644 --- a/Zotlabs/Lib/AConfig.php +++ b/Zotlabs/Lib/AConfig.php @@ -15,7 +15,7 @@ class AConfig { } static public function Set($account_id,$family,$key,$value) { - return XConfig::Get('a_' . $account_id,$family,$key,$value); + return XConfig::Set('a_' . $account_id,$family,$key,$value); } static public function Delete($account_id,$family,$key) { diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 19ed1b612..a646d8a30 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -112,7 +112,7 @@ class Apps { static public function app_name_compare($a,$b) { - return strcmp($a['name'],$b['name']); + return strcasecmp($a['name'],$b['name']); } diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index 4479bf597..6ccfd664c 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -45,7 +45,7 @@ class System { static public function get_server_role() { if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['server_role']) return \App::$config['system']['server_role']; - return 'pro'; + return 'standard'; } static public function get_std_version() { diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 03dc6c5d3..8c62f4de9 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -72,6 +72,7 @@ class Acl extends \Zotlabs\Web\Controller { ); $permitted = ids_to_array($x,'xchan'); + } @@ -249,7 +250,7 @@ class Acl extends \Zotlabs\Web\Controller { ); if($z) { foreach($z as $zz) { - if(in_array($zz['id'],$permitted)) { + if(in_array($zz['hash'],$permitted)) { $r[] = $zz; } } diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 085d13fd7..fa4f32c8c 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -268,6 +268,8 @@ class Admin extends \Zotlabs\Web\Controller { check_form_security_token_redirectOnErr('/admin/site', 'admin_site'); $sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : ''); + $server_role = ((x($_POST,'server_role')) ? notags(trim($_POST['server_role'])) : 'standard'); + $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false); $admininfo = ((x($_POST,'admininfo')) ? trim($_POST['admininfo']) : false); $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : ''); @@ -287,8 +289,6 @@ class Admin extends \Zotlabs\Web\Controller { $mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0); $directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : ''); $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : ''); - $allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : ''); - $not_allowed_email = ((x($_POST,'not_allowed_email')) ? notags(trim($_POST['not_allowed_email'])) : ''); $force_publish = ((x($_POST,'publish_all')) ? True : False); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); $login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False); @@ -308,6 +308,8 @@ class Admin extends \Zotlabs\Web\Controller { $feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0); $verify_email = ((x($_POST,'verify_email')) ? 1 : 0); + + set_config('system', 'server_role', $server_role); set_config('system', 'feed_contacts', $feed_contacts); set_config('system', 'delivery_interval', $delivery_interval); set_config('system', 'delivery_batch_count', $delivery_batch_count); @@ -353,8 +355,6 @@ class Admin extends \Zotlabs\Web\Controller { set_config('system','account_abandon_days', $abandon_days); set_config('system','register_text', $register_text); set_config('system','allowed_sites', $allowed_sites); - set_config('system','allowed_email', $allowed_email); - set_config('system','not_allowed_email', $not_allowed_email); set_config('system','publish_all', $force_publish); set_config('system','disable_discover_tab', $disable_discover_tab); if ($global_directory == '') { @@ -481,6 +481,12 @@ class Admin extends \Zotlabs\Web\Controller { // now invert the logic for the setting. $discover_tab = (1 - $discover_tab); + $server_roles = [ + 'basic' => t('Basic/Minimal Social Networking'), + 'standard' => t('Standard Configuration (default)'), + 'pro' => t('Professional') + ]; + $homelogin = get_config('system','login_on_homepage'); $enable_context_help = get_config('system','enable_context_help'); @@ -498,6 +504,9 @@ class Admin extends \Zotlabs\Web\Controller { '$baseurl' => z_root(), // name, label, value, help string, extra data... '$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''), + + '$server_role' => array('server_role', t("Server Configuration/Role"), get_config('system','server_role'),'',$server_roles), + '$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), @@ -514,8 +523,6 @@ class Admin extends \Zotlabs\Web\Controller { '$mirror_frontpage' => array('mirror_frontpage', t("Preserve site homepage URL"), get_config('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')), '$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')), '$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")), - '$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")), - '$not_allowed_email' => array('not_allowed_email', t("Not allowed email domains"), get_config('system','not_allowed_email'), t("Comma separated list of domains which are not allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains, unless allowed domains have been defined.")), '$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")), '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")), '$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')), @@ -591,8 +598,12 @@ class Admin extends \Zotlabs\Web\Controller { function admin_page_security_post(&$a){ check_form_security_token_redirectOnErr('/admin/security', 'admin_security'); - logger('post: ' . print_r($_POST,true)); - + $allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : ''); + $not_allowed_email = ((x($_POST,'not_allowed_email')) ? notags(trim($_POST['not_allowed_email'])) : ''); + + set_config('system','allowed_email', $allowed_email); + set_config('system','not_allowed_email', $not_allowed_email); + $block_public = ((x($_POST,'block_public')) ? True : False); set_config('system','block_public',$block_public); @@ -758,6 +769,8 @@ class Admin extends \Zotlabs\Web\Controller { '$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently authenticated.")), '$transport_security' => array('transport_security', t('Set "Transport Security" HTTP header'),intval(get_config('system','transport_security_header')),''), '$content_security' => array('content_security', t('Set "Content Security Policy" HTTP header'),intval(get_config('system','content_security_policy')),''), + '$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")), + '$not_allowed_email' => array('not_allowed_email', t("Not allowed email domains"), get_config('system','not_allowed_email'), t("Comma separated list of domains which are not allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains, unless allowed domains have been defined.")), '$whitelisted_sites' => array('whitelisted_sites', t('Allow communications only from these sites'), $whitesites_str, t('One site per line. Leave empty to allow communication from anywhere by default')), '$blacklisted_sites' => array('blacklisted_sites', t('Block communications from these sites'), $blacksites_str, ''), '$whitelisted_channels' => array('whitelisted_channels', t('Allow communications only from these channels'), $whitechannels_str, t('One channel (hash) per line. Leave empty to allow from any channel by default')), @@ -1275,19 +1288,27 @@ class Admin extends \Zotlabs\Web\Controller { if (x($_GET,"a") && $_GET['a']=="t"){ check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't'); - + $pinstalled = false; // Toggle plugin status $idx = array_search($plugin, \App::$plugins); if ($idx !== false){ unset(\App::$plugins[$idx]); uninstall_plugin($plugin); + $pinstalled = false; info( sprintf( t("Plugin %s disabled."), $plugin ) ); } else { \App::$plugins[] = $plugin; install_plugin($plugin); + $pinstalled = true; info( sprintf( t("Plugin %s enabled."), $plugin ) ); } set_config("system","addon", implode(", ",\App::$plugins)); + + if($pinstalled) { + @require_once("addon/$plugin/$plugin.php"); + if(function_exists($plugin.'_plugin_admin')) + goaway(z_root() . '/admin/plugins/' . $plugin); + } goaway(z_root() . '/admin/plugins' ); } // display plugin details @@ -1341,6 +1362,7 @@ class Admin extends \Zotlabs\Web\Controller { '$str_minversion' => t('Minimum project version: '), '$str_maxversion' => t('Maximum project version: '), '$str_minphpversion' => t('Minimum PHP version: '), + '$str_serverroles' => t('Compatible Server Roles: '), '$str_requires' => t('Requires: '), '$disabled' => t('Disabled - version incompatibility'), diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 59cb9f06c..be65354a9 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -140,7 +140,8 @@ class Channel extends \Zotlabs\Web\Controller { 'profile_uid' => \App::$profile['profile_uid'], 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', - 'bbcode' => true + 'bbcode' => true, + 'jotnets' => true ); $o .= status_editor($a,$x); diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 217249469..43feac189 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -663,13 +663,9 @@ class Connedit extends \Zotlabs\Web\Controller { $rating_text = $xl[0]['xlink_rating_text']; } - $poco_rating = get_config('system','poco_rating_enable'); + $rating_enabled = get_config('system','rating_enabled'); - // if unset default to enabled - if($poco_rating === false) - $poco_rating = true; - - if($poco_rating) { + if($rating_enabled) { $rating = replace_macros(get_markup_template('rating_slider.tpl'),array( '$min' => -10, '$val' => $rating_val diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index 560038ffc..84d40a166 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -239,7 +239,7 @@ class Directory extends \Zotlabs\Web\Controller { $page_type = ''; - if($rr['total_ratings']) + if($rr['total_ratings'] && get_config('system','rating_enabled')) $total_ratings = sprintf( tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']); else $total_ratings = ''; diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 35ed0c894..e9441bbdf 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -73,7 +73,8 @@ class Display extends \Zotlabs\Web\Controller { 'expanded' => true, 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', - 'bbcode' => true + 'bbcode' => true, + 'jotnets' => true ); $o = '<div id="jot-popup">'; diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index cc46c550b..241354d07 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -31,13 +31,14 @@ class Help extends \Zotlabs\Web\Controller { if($r) { $o .= '<ul class="help-searchlist">'; foreach($r as $rr) { - $dirname = dirname($rr['sid']); - $fname = basename($rr['sid']); + $dirname = dirname($rr['v']); + $fname = basename($rr['v']); $fname = substr($fname,0,strrpos($fname,'.')); $path = trim(substr($dirname,4),'/'); - $o .= '<li><a href="help/' . (($path) ? $path . '/' : '') . $fname . '" >' . ucwords(str_replace('_',' ',notags($fname))) . '</a><br />' . - str_replace('$Projectname',\Zotlabs\Lib\System::get_platform_name(),substr($rr['text'],0,200)) . '...<br /><br /></li>'; + $o .= '<li><a href="help/' . (($path) ? $path . '/' : '') . $fname . '" >' . ucwords(str_replace('_',' ',notags($fname))) . '</a><br />' + . '<b><i>' . 'help/' . (($path) ? $path . '/' : '') . $fname . '</i></b><br />' . + '...' . str_replace('$Projectname',\Zotlabs\Lib\System::get_platform_name(),$rr['text']) . '...<br /><br /></li>'; } $o .= '</ul>'; diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 0128adc2c..50bb05075 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -159,7 +159,7 @@ class Network extends \Zotlabs\Web\Controller { 'allow_gid' => $channel['channel_allow_gid'], 'deny_cid' => $channel['channel_deny_cid'], 'deny_gid' => $channel['channel_deny_gid'] - ); + ); $private_editing = ((($group || $cid) && (! intval($_GET['pf']))) ? true : false); @@ -176,7 +176,8 @@ class Network extends \Zotlabs\Web\Controller { 'profile_uid' => local_channel(), 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', - 'bbcode' => true + 'bbcode' => true, + 'jotnets' => true ); if($deftag) $x['pretext'] = $deftag; diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index 0dda08e6d..35a305130 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -16,7 +16,9 @@ class Pubsites extends \Zotlabs\Web\Controller { $url = $directory['url'] . '/dirsearch'; } $url .= '/sites'; - + + $rating_enabled = get_config('system','rating_enabled'); + $o .= '<div class="generic-content-wrapper">'; $o .= '<div class="section-title-wrapper"><h2>' . t('Public Hubs') . '</h2></div>'; @@ -28,7 +30,10 @@ 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><td colspan="2">' . t('Ratings') . '</td></tr>'; + $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>'; if($j['sites']) { foreach($j['sites'] as $jj) { $m = parse_url($jj['url']); @@ -44,7 +49,10 @@ 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']) . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links . '</tr>'; + $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']) . '</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/Module/Rate.php b/Zotlabs/Module/Rate.php index 2f769b36b..c03aaa54f 100644 --- a/Zotlabs/Module/Rate.php +++ b/Zotlabs/Module/Rate.php @@ -119,8 +119,8 @@ class Rate extends \Zotlabs\Web\Controller { // return; // } - $poco_rating = get_config('system','poco_rating_enable'); - if((! $poco_rating) && ($poco_rating !== false)) { + $rating_enabled = get_config('system','rating_enabled'); + if(! $rating_enabled) { notice('Ratings are disabled on this site.'); return; } @@ -141,11 +141,7 @@ class Rate extends \Zotlabs\Web\Controller { $rating_text = ''; } - // if unset default to enabled - if($poco_rating === false) - $poco_rating = true; - - if($poco_rating) { + if($rating_enabled) { $rating = replace_macros(get_markup_template('rating_slider.tpl'),array( '$min' => -10, '$val' => $rating_val diff --git a/Zotlabs/Module/Ratings.php b/Zotlabs/Module/Ratings.php index 969fb5015..055b16ca3 100644 --- a/Zotlabs/Module/Ratings.php +++ b/Zotlabs/Module/Ratings.php @@ -21,12 +21,9 @@ class Ratings extends \Zotlabs\Web\Controller { if($x) $url = $x['url']; - $poco_rating = get_config('system','poco_rating_enable'); - // if unset default to enabled - if($poco_rating === false) - $poco_rating = true; + $rating_enabled = get_config('system','rating_enabled'); - if(! $poco_rating) + if(! $rating_enabled) return; if(argc() > 1) @@ -87,12 +84,9 @@ class Ratings extends \Zotlabs\Web\Controller { return; } - $poco_rating = get_config('system','poco_rating_enable'); - // if unset default to enabled - if($poco_rating === false) - $poco_rating = true; + $rating_enabled = get_config('system','rating_enabled'); - if(! $poco_rating) + if(! $rating_enabled) return; $site_target = ((array_key_exists('target',\App::$data) && array_key_exists('site_url',\App::$data['target'])) ? diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 4cdd27001..0b16d4a66 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -38,7 +38,7 @@ class Register extends \Zotlabs\Web\Controller { } - function post() { + function post() { $max_dailies = intval(get_config('system','max_daily_registrations')); if($max_dailies) { diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php index 525f053de..1349cd1c5 100644 --- a/Zotlabs/Module/Rpost.php +++ b/Zotlabs/Module/Rpost.php @@ -126,7 +126,10 @@ class Rpost extends \Zotlabs\Web\Controller { 'source' => ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : ''), 'return_path' => 'rpost/return', 'bbco_autocomplete' => 'bbcode', - 'bbcode' => true + 'editor_autocomplete'=> true, + 'bbcode' => true, + 'jotnets' => true + ); $editor = status_editor($a,$x); diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 2679b364b..bd16b930e 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -1028,7 +1028,7 @@ class Settings extends \Zotlabs\Web\Controller { $theme_config = theme_content($a); } -logger('schemas: ' . print_r($schemas,true)); + // logger('schemas: ' . print_r($schemas,true)); $tpl = get_markup_template("settings_display.tpl"); $o = replace_macros($tpl, array( diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index 4553b6866..610f3c4f4 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -43,11 +43,12 @@ class Setup extends \Zotlabs\Web\Controller { killme(); } - if (x($_POST, 'pass')) + if (x($_POST, 'pass')) { $this->install_wizard_pass = intval($_POST['pass']); - else + } + else { $this->install_wizard_pass = 1; - + } } /** @@ -73,7 +74,9 @@ class Setup extends \Zotlabs\Web\Controller { $phpath = trim($_POST['phpath']); $adminmail = trim($_POST['adminmail']); $siteurl = trim($_POST['siteurl']); - $advanced = ((intval($_POST['advanced'])) ? 1 : 0); + $server_role = trim($_POST['server_role']); + if(! $server_role) + $server_role = 'standard'; // $siteurl should not have a trailing slash @@ -101,7 +104,9 @@ class Setup extends \Zotlabs\Web\Controller { $timezone = notags(trim($_POST['timezone'])); $adminmail = notags(trim($_POST['adminmail'])); $siteurl = notags(trim($_POST['siteurl'])); - $advanced = ((intval($_POST['advanced'])) ? 'pro' : 'basic'); + $server_role = notags(trim($_POST['server_role'])); + if(! $server_role) + $server_role = 'standard'; if($siteurl != z_root()) { $test = z_fetch_url($siteurl."/setup/testrewrite"); @@ -130,7 +135,7 @@ class Setup extends \Zotlabs\Web\Controller { '$dbpass' => $dbpass, '$dbdata' => $dbdata, '$dbtype' => $dbtype, - '$server_role' => $advanced, + '$server_role' => $server_role, '$timezone' => $timezone, '$siteurl' => $siteurl, '$site_id' => random_string(), @@ -327,6 +332,12 @@ class Setup extends \Zotlabs\Web\Controller { $siteurl = notags(trim($_POST['siteurl'])); $timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles'); + $server_roles = [ + 'basic' => t('Basic/Minimal Social Networking'), + 'standard' => t('Standard Configuration (default)'), + 'pro' => t('Professional') + ]; + $tpl = get_markup_template('install_settings.tpl'); $o .= replace_macros($tpl, array( '$title' => $install_title, @@ -344,7 +355,8 @@ class Setup extends \Zotlabs\Web\Controller { '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), - '$advanced' => array('advanced', t('Enable $Projectname <strong>advanced</strong> features?'), 1, t('Some advanced features, while useful - may be best suited for technically proficient audiences')), + + '$server_role' => array('server_role', t("Server Configuration/Role"), 'standard','',$server_roles), '$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()), diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index 820897ee9..91f0ce33a 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -99,18 +99,73 @@ class Comanche { } } - + function get_condition_var($v) { + if($v) { + $x = explode('.',$v); + if($x[0] == 'config') + return get_config($x[1],$x[2]); + elseif($x[0] === 'observer') { + if(count($x) > 1) { + $y = \App::get_observer(); + if(! $y) + return false; + if($x[1] == 'address') + return $y['xchan_addr']; + elseif($x[1] == 'name') + return $y['xchan_name']; + return false; + } + return get_observer_hash(); + } + else + return false; + } + return false; + } function test_condition($s) { - // This is extensible. The first version of variable testing supports tests of the form + // This is extensible. The first version of variable testing supports tests of the forms: + // [if $config.system.foo == baz] which will check if get_config('system','foo') is the string 'baz'; + // [if $config.system.foo != baz] which will check if get_config('system','foo') is not the string 'baz'; + // You may check numeric entries, but these checks are evaluated as strings. + // [if $config.system.foo {} baz] which will check if 'baz' is an array element in get_config('system','foo') + // [if $config.system.foo {*} baz] which will check if 'baz' is an array key in get_config('system','foo') // [if $config.system.foo] which will check for a return of a true condition for get_config('system','foo'); // The values 0, '', an empty array, and an unset value will all evaluate to false. - if(preg_match("/[\$]config[\.](.*?)/",$s,$matches)) { - $x = explode('.',$s); - if(get_config($x[1],$x[2])) + if(preg_match('/[\$](.*?)\s\=\=\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if($x == trim($matches[2])) + return true; + return false; + } + if(preg_match('/[\$](.*?)\s\!\=\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if($x != trim($matches[2])) + return true; + return false; + } + + if(preg_match('/[\$](.*?)\s\{\}\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if(is_array($x) && in_array(trim($matches[2]),$x)) + return true; + return false; + } + + if(preg_match('/[\$](.*?)\s\{\*\}\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if(is_array($x) && array_key_exists(trim($matches[2]),$x)) + return true; + return false; + } + + if(preg_match('/[\$](.*?)/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if($x) return true; + return false; } return false; diff --git a/Zotlabs/Render/SmartyTemplate.php b/Zotlabs/Render/SmartyTemplate.php index 532d6e42f..7abe0731c 100755 --- a/Zotlabs/Render/SmartyTemplate.php +++ b/Zotlabs/Render/SmartyTemplate.php @@ -15,7 +15,10 @@ class SmartyTemplate implements TemplateEngine { ? \App::$config['system']['smarty3_folder'] : ''); if (!$basecompiledir) $basecompiledir = str_replace('Zotlabs','',dirname(__dir__)) . "/" . TEMPLATE_BUILD_PATH; if (!is_dir($basecompiledir)) { - echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> does not exist."; killme(); + @os_mkdir(TEMPLATE_BUILD_PATH, STORAGE_DEFAULT_PERMISSIONS, true); + if (!is_dir($basecompiledir)) { + echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> does not exist."; killme(); + } } if(!is_writable($basecompiledir)){ echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> must be writable by webserver."; killme(); @@ -27,6 +30,12 @@ class SmartyTemplate implements TemplateEngine { public function replace_macros($s, $r) { $template = ''; + + // these are available for use in all templates + + $r['$z_baseurl'] = z_root(); + $r['$z_server_role'] = \Zotlabs\Lib\System::get_server_role(); + if(gettype($s) === 'string') { $template = $s; $s = new SmartyInterface(); |