]> git.mxchange.org Git - friendica-addons.git/blobdiff - startpage/startpage.php
Use Login module
[friendica-addons.git] / startpage / startpage.php
index e0d822ac27594dfb83f85f70930ccc1552c57b39..b0ee04cb794be8eafc164cafd699a5a8eb8f8a94 100644 (file)
@@ -4,9 +4,10 @@
  * Description: Set a preferred page to load on login from home page
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
- * 
+ *
  */
 
+use Friendica\Core\PConfig;
 
 function startpage_install() {
        register_hook('home_init', 'addon/startpage/startpage.php', 'startpage_home_init');
@@ -27,12 +28,9 @@ function startpage_home_init($a, $b) {
        if(! local_user())
                return;
 
-       $page = get_pconfig(local_user(),'startpage','startpage');
+       $page = PConfig::get(local_user(),'startpage','startpage');
        if(strlen($page)) {
-               $slash = ((strpos($page,'/') === 0) ? true : false);
-               if(stristr($page,'://'))
-                       goaway($page);
-               goaway($a->get_baseurl() . (($slash) ? '' : '/') . $page);
+               goaway($page);
        }
        return;
 }
@@ -50,13 +48,13 @@ function startpage_settings_post($a,$post) {
        if(! local_user())
                return;
        if($_POST['startpage-submit'])
-               set_pconfig(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
+               PConfig::set(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
 }
 
 
 /**
  *
- * Called from the Plugin Setting form. 
+ * Called from the Plugin Setting form.
  * Add our own settings info to the page.
  *
  */
@@ -74,7 +72,7 @@ function startpage_settings(&$a,&$s) {
 
        /* Get the current state of our config variable */
 
-       $page = get_pconfig(local_user(),'startpage','startpage');
+       $page = PConfig::get(local_user(),'startpage','startpage');
 
 
        /* Add some HTML to the existing form */