diff --git a/addon/widgets/widget_friends.php b/addon/widgets/widget_friends.php new file mode 100644 index 00000000..d794f7d2 --- /dev/null +++ b/addon/widgets/widget_friends.php @@ -0,0 +1,28 @@ +profile = $r[0]; + + $o .= ""; + $o .= _abs_url(contact_block()); + $o .= "profile['nickname']."'>". t('Connect on Friendika!') .""; +} \ No newline at end of file diff --git a/addon/widgets/widget_like.php b/addon/widgets/widget_like.php new file mode 100644 index 00000000..9549fc4f --- /dev/null +++ b/addon/widgets/widget_like.php @@ -0,0 +1,12 @@ +Shows likes
Search "; +} + +function widget_args(){ + return Array("KEY"); +} + +function widget_content(&$a, &$o, $conf){ +} \ No newline at end of file diff --git a/addon/widgets/widgets.php b/addon/widgets/widgets.php index 7c75c666..305423cb 100644 --- a/addon/widgets/widgets.php +++ b/addon/widgets/widgets.php @@ -56,6 +56,7 @@ function widgets_settings(&$a,&$o) { $o.='

Widgets:

'; } @@ -92,21 +93,37 @@ function widgets_content(&$a) { $o = ""; -// echo "
"; var_dump($a->argv); die();
+	$widgetfile =dirname(__file__)."/widget_".$a->argv[1].".php";
+	if (file_exists($widgetfile)){
+		require_once($widgetfile);
+	} else {
+		if($a->argv[2]=="cb"){header('HTTP/1.0 400 Bad Request'); killme();}
+		return;
+	}		
+	
+
+
+
+	//echo "
"; var_dump($a->argv); die();
 	if ($a->argv[2]=="cb"){
-		switch($a->argv[1]) {
-			case 'friends': 
-				widget_friends_content($a, $o, $conf);
-				break;
-		}
+		if (!local_user()){
+			if (!isset($_GET['s']))
+				{header('HTTP/1.0 400 Bad Request'); killme();}
+			
+			if (substr($_GET['s'],0,strlen($conf['site'])) !== $conf['site'])
+				{header('HTTP/1.0 400 Bad Request'); killme();}
+		} 
+		widget_content($a, $o, $conf);
 		
 	} else {
 
 		
-		if (isset($_GET['p'])) {
+		if (isset($_GET['p']) && local_user()==$conf['uid'] ) {
 			$o .= "";
 			$o .= "

Preview Widget

"; $o .= ''. t("Plugin Settings") .''; + $o .= "

"; + widget_help($a, $o, $conf); $o .= "

"; $o .= "

Copy and paste this code

" - .htmlspecialchars('') + .htmlspecialchars('') .""; return $o; } @@ -143,31 +165,6 @@ function widgets_content(&$a) { } -function widget_friends_content(&$a, &$o, $conf){ - if (!local_user()){ - if (!isset($_GET['s'])) - header('HTTP/1.0 400 Bad Request'); - - if (substr($_GET['s'],0,strlen($conf['site'])) !== $conf['site']) - header('HTTP/1.0 400 Bad Request'); - } - $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` - LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` - WHERE `user`.`uid` = %s AND `profile`.`is-default` = 1 LIMIT 1", - intval($conf['uid']) - ); - - if(!count($r)) return; - $a->profile = $r[0]; - $o .= ""; - $o .= _abs_url(contact_block()); - $o .= "profile['nickname']."'>". t('Connect on Friendika!') .""; - - -} ?>