From 02483e4c949609a848626fc4e5b17e723fb429b9 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 12 Mar 2012 15:08:41 +0100 Subject: [PATCH 1/3] widgets: only local user can change settings --- widgets/widgets.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/widgets/widgets.php b/widgets/widgets.php index 27cabfd69..47a6e48a6 100755 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -19,7 +19,8 @@ function widgets_uninstall() { function widgets_settings_post(){ - + if(! local_user()) + return; if (isset($_POST['widgets-submit'])){ del_pconfig(local_user(), 'widgets', 'key'); From 266eba9aeaf2ed061c66a415b79aad12ae357a93 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 12 Mar 2012 15:09:58 +0100 Subject: [PATCH 2/3] rembemberoid: save openid url in cookie on user request and use it to automatically login --- rememberoid/rememberoid.php | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 rememberoid/rememberoid.php diff --git a/rememberoid/rememberoid.php b/rememberoid/rememberoid.php new file mode 100644 index 000000000..36f42c368 --- /dev/null +++ b/rememberoid/rememberoid.php @@ -0,0 +1,44 @@ + + */ + + +function rememberoid_install(){ + register_hook('init_1','addon/rememberoid/rememberoid.php','rememberoid_init'); + register_hook('logging_out','addon/rememberoid/rememberoid.php','rememberoid_logout'); + register_hook('login_hook','addon/rememberoid/rememberoid.php','rememberoid_form'); +} + +function rememberoid_uninstall(){ + unregister_hook('init_1','addon/rememberoid/rememberoid.php','rememberoid_init'); + unregister_hook('logging_out','addon/rememberoid/rememberoid.php','rememberoid_logout'); + unregister_hook('login_hook','addon/rememberoid/rememberoid.php','rememberoid_form'); +} + +function rememberoid_init(&$a) { + if (x($_COOKIE, "remember_oid") && !x($_SESSION['openid']) && !x($_SESSION,'authenticated') && !x($_POST,'auth-params') && $a->module === 'home' ){ + $_POST['openid_url'] = $_COOKIE["remember_oid"]; + $_POST['auth-params'] = 1; + } + if (x($_POST,'auth-params') && $_POST['openid_url'] && $_POST['openid_url']!="" && $_POST['remember_oid']){ + setcookie('remember_oid', $_POST['openid_url'], time()+60*60*24*30, "/"); + } +} + +function rememberoid_logout(&$a) { + setcookie("rembember_oid", "", time()-3600); +} + +function rememberoid_form(&$a, &$o){ + $tpl = get_markup_template("field_checkbox.tpl"); + $html = replace_macros($tpl, array( + '$field' => array('remember_oid', t("Autologin with this OpenId"), false,''), + )); + + $o = preg_replace("|
|", "
".$html, $o); + +} From 5adb4ef80328117d8e196a1f5af75844d1a37eef Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 28 Mar 2012 11:44:04 +0200 Subject: [PATCH 3/3] viewsrc: show message source in a fancybox via ajax --- viewsrc/viewsrc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/viewsrc/viewsrc.php b/viewsrc/viewsrc.php index e39fe8a6a..a610b76ca 100644 --- a/viewsrc/viewsrc.php +++ b/viewsrc/viewsrc.php @@ -11,13 +11,25 @@ function viewsrc_install() { register_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu'); + register_hook('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end'); } function viewsrc_uninstall() { unregister_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu'); + unregister_hook('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end'); + } +function viewsrc_page_end(&$a, &$o){ + $a->page['htmlhead'] .= <<< EOS + +EOS; +} function viewsrc_item_photo_menu(&$a,&$b) { if(! local_user())