X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=widgets%2Fwidgets.php;h=e62932448efc5f2badd7d21e7a3a63c8aaf3ce92;hb=718f739df21e2bc0aab97f877f4f36b69dab9800;hp=226a34c060f88c519469c832f1a1f209172e44e0;hpb=97cdca14c46fdda12fa56dd16566f7b08745cfb9;p=friendica-addons.git diff --git a/widgets/widgets.php b/widgets/widgets.php old mode 100644 new mode 100755 index 226a34c0..e6293244 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -1,12 +1,13 @@ */ - - + +use Friendica\Core\PConfig; + function widgets_install() { register_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings'); register_hook('plugin_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post'); @@ -19,7 +20,8 @@ function widgets_uninstall() { function widgets_settings_post(){ - + if(! local_user()) + return; if (isset($_POST['widgets-submit'])){ del_pconfig(local_user(), 'widgets', 'key'); @@ -31,8 +33,8 @@ function widgets_settings(&$a,&$o) { return; - $key = get_pconfig(local_user(), 'widgets', 'key' ); - if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); } + $key = PConfig::get(local_user(), 'widgets', 'key' ); + if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); } $widgets = array(); $d = dir(dirname(__file__)); @@ -50,7 +52,8 @@ function widgets_settings(&$a,&$o) { - $t = file_get_contents( dirname(__file__). "/settings.tpl" ); +# $t = file_get_contents( dirname(__file__). "/settings.tpl" ); + $t = get_markup_template("settings.tpl", "addon/widgets/"); $o .= replace_macros($t, array( '$submit' => t('Generate new key'), '$baseurl' => $a->get_baseurl(),