diff --git a/addon/poormancron/poormancron.php b/addon/poormancron/poormancron.php index 9a8dc1e33f..7611c43bef 100644 --- a/addon/poormancron/poormancron.php +++ b/addon/poormancron/poormancron.php @@ -20,7 +20,7 @@ function poormancron_uninstall() { -function poormancron_hook($a,&$b) { +function poormancron_hook(&$a,&$b) { $now = time(); $lastupdate = get_config('poormancron', 'lastupdate'); @@ -31,7 +31,7 @@ function poormancron_hook($a,&$b) { } } -function poormancron_procrun($a, $argv) { +function poormancron_procrun(&$a, $argv) { logger("poormancron procrun ".implode(", ",$argv)); array_shift($argv); $argc = count($argv); @@ -43,5 +43,4 @@ function poormancron_procrun($a, $argv) { } - ?> diff --git a/addon/twitter/admin.tpl b/addon/twitter/admin.tpl new file mode 100644 index 0000000000..a83eb07a4d --- /dev/null +++ b/addon/twitter/admin.tpl @@ -0,0 +1,3 @@ +{{ inc field_input.tpl with $field=$consumerkey }}{{ endinc }} +{{ inc field_input.tpl with $field=$consumersecret }}{{ endinc }} +
diff --git a/addon/twitter/twitter.php b/addon/twitter/twitter.php index fef6583f6b..3141cf0c94 100644 --- a/addon/twitter/twitter.php +++ b/addon/twitter/twitter.php @@ -47,6 +47,7 @@ function twitter_install() { register_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post'); register_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook'); register_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets'); + register_hook('plugin_admin', 'addon/twitter/twitter.php', 'plugin_admin'); logger("installed twitter"); } @@ -56,6 +57,7 @@ function twitter_uninstall() { unregister_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post'); unregister_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook'); unregister_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets'); + unregister_hook('plugin_admin', 'addon/twitter/twitter.php', 'plugin_admin'); } function twitter_jot_nets(&$a,&$b) { @@ -240,4 +242,19 @@ function twitter_post_hook(&$a,&$b) { } } } - +function plugin_admin_post(&$a){ + $consumerkey = ((x($_POST,'consumerkey')) ? notags(trim($_POST['consumerkey'])) : ''); + $consumersecret = ((x($_POST,'consumersecret')) ? notags(trim($_POST['consumersecret'])): ''); + set_config('twitter','consumerkey',$consumerkey); + set_config('twitter','consumersecret',$consumersecret); + info( t('Settings updated.'). EOL ); +} +function plugin_admin(&$a, &$o){ + $t = file_get_contents( dirname(__file__). "/admin.tpl" ); + $o = replace_macros($t, array( + '$submit' => t('Submit'), + // name, label, value, help, [extra values] + '$consumerkey' => array('consumerkey', t('Consumer key'), get_config('twitter', 'consumerkey' ), ''), + '$consumersecret' => array('consumersecret', t('Consumer secret'), get_config('twitter', 'consumersecret' ), '') + )); +} diff --git a/include/template_processor.php b/include/template_processor.php index 3f79ed5933..a0dfad1697 100644 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -16,7 +16,8 @@ case PREG_BAD_UTF8_ERROR: die('PREG_BAD_UTF8_ERROR'); break; case PREG_BAD_UTF8_OFFSET_ERROR: die('PREG_BAD_UTF8_OFFSET_ERROR'); break; default: - die("Unknown preg error."); + //die("Unknown preg error."); + return; } } diff --git a/mod/admin.php b/mod/admin.php index e452ea856f..3b5315ad59 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -24,7 +24,18 @@ function admin_post(&$a){ break; case 'users': admin_page_users_post($a); - break; + break; + case 'plugins': + if ($a->argc > 2 && + is_file("addon/".$a->argv[2]."/".$a->argv[2].".php")){ + @include_once("addon/".$a->argv[2]."/".$a->argv[2].".php"); + if(function_exists('plugin_admin_post')) { + plugin_admin_post($a); + } + } + goaway($a->get_baseurl() . '/admin/plugins/' . $a->argv[2] ); + return; // NOTREACHED + break; case 'logs': admin_page_logs_post($a); break; @@ -59,6 +70,8 @@ function admin_content(&$a) { foreach ($r as $h){ $plugin = explode("/",$h['file']); $plugin = $plugin[1]; $aside['plugins_admin'][] = Array($a->get_baseurl()."/admin/plugins/".$plugin, $plugin, "plugin"); + // temp plugins with admin + $a->plugins_admin[] = $plugin; } $aside['logs'] = Array($a->get_baseurl()."/admin/logs/", t("Logs"), "logs"); @@ -164,11 +177,10 @@ function admin_page_site_post(&$a){ $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : ''); $global_search_url = ((x($_POST,'directory_search_url'))? notags(trim($_POST['directory_search_url'])) : ''); $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False); - $no_openid = ((x($_POST,'no_openid')) ? True : False); - $no_gravatar = ((x($_POST,'no_gravatar')) ? True : False); - $no_regfullname = ((x($_POST,'no_regfullname')) ? True : False); - $no_utf = ((x($_POST,'no_utf')) ? True : False); - $rino_enc = ((x($_POST,'rino_enc')) ? True : False); + $no_openid = !((x($_POST,'no_openid')) ? True : False); + $no_gravatar = !((x($_POST,'no_gravatar')) ? True : False); + $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False); + $no_utf = !((x($_POST,'no_utf')) ? True : False); $verifyssl = ((x($_POST,'verifyssl')) ? True : False); $proxyuser = ((x($_POST,'proxyuser')) ? notags(trim($_POST['global_search_url'])) : ''); $proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['global_search_url'])) : ''); @@ -210,13 +222,13 @@ function admin_page_site_post(&$a){ set_config('system','no_gravatar', $no_gravatar); set_config('system','no_regfullname', $no_regfullname); set_config('system','proxy', $no_utf); - set_config('system','rino_encrypt', $rino_enc); set_config('system','verifyssl', $verifyssl); set_config('system','proxyuser', $proxyuser); set_config('system','proxy', $proxy); set_config('system','curl_timeout', $timeout); + info( t('Site settings updated.') . EOL); goaway($a->get_baseurl() . '/admin/site' ); return; // NOTREACHED @@ -269,8 +281,12 @@ function admin_page_site(&$a) { '$title' => t('Administration'), '$page' => t('Site'), '$submit' => t('Submit'), + '$registration' => t('Registration'), + '$upload' => t('File upload'), + '$corporate' => t('Corporate/Edu'), + '$advanced' => t('Advanced'), + '$baseurl' => $a->get_baseurl(), - // name, label, value, help string, extra data... '$sitename' => array('sitename', t("Site name"), $a->config['sitename'], ""), '$banner' => array('banner', t("Banner/Logo"), $banner, ""), @@ -290,12 +306,11 @@ function admin_page_site(&$a) { '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), "Disallow users to register additional accounts for use as pages."), - '$no_openid' => array('no_openid', t("No OpenID support"), get_config('system','no_openid'), "Disable OpenID support for registration and logins."), - '$no_gravatar' => array('no_gravatar', t("No Gravatar support"), get_config('system','no_gravatar'), ""), - '$no_regfullname' => array('no_regfullname', t("No fullname check"), get_config('system','no_regfullname'), "If unchecked, force users to registrate with a space between his firsname and lastname in Full name, as an antispam measure"), - '$no_utf' => array('no_utf', t("No UTF-8 Regular expressions"), get_config('system','proxy'), "Default is false (meaning UTF8 regular expressions are supported and working)"), + '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), "OpenID support for registration and logins."), + '$no_gravatar' => array('no_gravatar', t("Gravatar support"), !get_config('system','no_gravatar'), "Search new user's photo on Gravatar."), + '$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), "Force users to registrate with a space between his firsname and lastname in Full name, as an antispam measure"), + '$no_utf' => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','proxy'), "Use PHP UTF8 regular expressions"), - '$rino_enc' => array('rino_enc', t("Enable Rino encrypt"), get_config('system','rino_encrypt'),""), '$verifyssl' => array('verifyssl', t("Verify SSL"), get_config('system','verifyssl'), "If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites."), '$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""), '$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""), @@ -323,7 +338,7 @@ function admin_page_users_post(&$a){ intval( $uid ) ); } - notice( sprintf( tt("%s user blocked", "%s users blocked", count($users)), count($users)) ); + notice( sprintf( tt("%s user blocked", "%s users blocked/unblocked", count($users)), count($users)) ); } if (x($_POST,'page_users_delete')){ require_once("include/Contact.php"); @@ -371,6 +386,7 @@ function admin_page_users(&$a){ intval( 1-$user[0]['blocked'] ), intval( $uid ) ); + notice( sprintf( ($user[0]['blocked']?t("User '%s' unblocked"):t("User '%s' blocked")) , $user[0]['username']) . EOL); }; break; } goaway($a->get_baseurl() . '/admin/users' ); @@ -481,9 +497,11 @@ function admin_page_plugins(&$a){ if ($idx){ unset($a->plugins[$idx]); uninstall_plugin($plugin); + info( sprintf( t("Plugin %s disabled."), $plugin ) ); } else { $a->plugins[] = $plugin; install_plugin($plugin); + info( sprintf( t("Plugin %s enabled."), $plugin ) ); } set_config("system","addon", implode(", ",$a->plugins)); goaway($a->get_baseurl() . '/admin/plugins' ); @@ -506,6 +524,11 @@ function admin_page_plugins(&$a){ $readme = "
". file_get_contents("addon/$plugin/README") ."
"; } + $admin_form=""; + if (in_array($plugin, $a->plugins_admin)){ + call_hooks('plugin_admin', $admin_form); + } + $t = get_markup_template("admin_plugins_details.tpl"); return replace_macros($t, array( '$title' => t('Administration'), @@ -517,6 +540,8 @@ function admin_page_plugins(&$a){ '$status' => $status, '$action' => $action, '$info' => get_plugin_info($plugin), + + '$admin_form' => $admin_form, '$readme' => $readme )); @@ -570,6 +595,7 @@ function admin_page_logs_post(&$a) { } + info( t("Log settings updated.") ); goaway($a->get_baseurl() . '/admin/logs' ); return; // NOTREACHED } diff --git a/view/admin_plugins_details.tpl b/view/admin_plugins_details.tpl index e2c611b236..4bce1dda2b 100644 --- a/view/admin_plugins_details.tpl +++ b/view/admin_plugins_details.tpl @@ -10,7 +10,13 @@ {{ endfor }}

- + + {{ if $admin_form }} +

Settings

+
+ $admin_form +
+ {{ endif }} {{ if $readme }}

Readme

diff --git a/view/admin_site.tpl b/view/admin_site.tpl index dba29f11cb..525dd14ae9 100644 --- a/view/admin_site.tpl +++ b/view/admin_site.tpl @@ -10,7 +10,7 @@
-

Registration

+

$registration

{{ inc field_input.tpl with $field=$register_text }}{{ endinc }} {{ inc field_select.tpl with $field=$register_policy }}{{ endinc }} @@ -18,14 +18,13 @@ {{ inc field_checkbox.tpl with $field=$no_openid }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$no_gravatar }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$no_regfullname }}{{ endinc }} - {{ inc field_checkbox.tpl with $field=$no_utf }}{{ endinc }}
-

Upload

+

$upload

{{ inc field_input.tpl with $field=$maximagesize }}{{ endinc }} -

Corporate/Edu

+

$corporate

{{ inc field_input.tpl with $field=$allowed_sites }}{{ endinc }} {{ inc field_input.tpl with $field=$allowed_email }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$block_public }}{{ endinc }} @@ -35,8 +34,8 @@
-

Advanced

- {{ inc field_checkbox.tpl with $field=$rino_enc }}{{ endinc }} +

$advanced

+ {{ inc field_checkbox.tpl with $field=$no_utf }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$verifyssl }}{{ endinc }} {{ inc field_input.tpl with $field=$proxy }}{{ endinc }} {{ inc field_input.tpl with $field=$proxyuser }}{{ endinc }}