From 47e3f91012f1feca68150be627fb0f46b79a6492 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 12 May 2014 18:52:57 -0700 Subject: [PATCH] Remove login requirement from plugin and theme browsers. (ie. 'Find Plugins' and 'Find Themes') --- e107_admin/plugin.php | 52 ++++++++++++++++++++++++--------- e107_handlers/e_marketplace.php | 1 + e107_handlers/theme_handler.php | 14 +++++++-- 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index b65e972b1..ecd68cc9a 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -39,8 +39,13 @@ if(e_AJAX_REQUEST && isset($_GET['action'])) // Ajax $string = base64_decode($_GET['src']); parse_str($string, $p); - $mp = $pman->getMarketplace(); - $mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass); + print_a($p); + + // $mp = $pman->getMarketplace(); + // $mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass); + + + // Server flush useless. It's ajax ready state 4, we can't flush (sadly) before that (at least not for all browsers) echo "
Connecting...\n"; flush(); // FIXME change the modal default label, default is Loading...
 		// download and flush
@@ -206,7 +211,8 @@ class pluginManager{
     			"plugin_folder"			=> array("title" => EPL_ADLAN_64, "type"=>"text", "width" => "10%", "thclass" => "middle"),
 				"plugin_category"		=> array("title" => LAN_CATEGORY, "type"=>"text", "width" => "auto", "thclass" => "middle"),
                 "plugin_author"			=> array("title" => EPL_ADLAN_12, "type"=>"text", "width" => "10%", "thclass" => "middle"),
-  				"plugin_price"			=> array("title" => "Price", 	 'nolist'=>true,	"forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "left"),	
+                "plugin_license"		=> array("title" => "License", 	 'nolist'=>true,	"forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "left"),	
+  		//		"plugin_price"			=> array("title" => "Price", 	 'nolist'=>true,	"forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "left"),	
   				"plugin_compatible"		=> array("title" => EPL_ADLAN_13, "type"=>"text", "width" => "5%", "thclass" => "middle"),
 				"plugin_description"	=> array("title" => EPL_ADLAN_14, "type"=>"bbarea", "width" => "30%", "thclass" => "middle center",  'readParms' => 'expand=1&truncate=180&bb=1'),
 				"plugin_compliant"		=> array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""),
@@ -235,7 +241,8 @@ class pluginManager{
 
 		if($this->action == 'online')
 		{
-			$this->fields["plugin_price"]['nolist'] = false; //  = array("title" => "Price", "forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "middle center");		
+		//	$this->fields["plugin_price"]['nolist'] = false; //  = array("title" => "Price", "forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "middle center");		
+			$this->fields["plugin_license"]['nolist'] = false; 
 		}
 
         $keys = array_keys($this -> titlearray);
@@ -410,6 +417,7 @@ class pluginManager{
 		$from = isset($_GET['frm']) ? intval($_GET['frm']) : 0;
 		$srch = preg_replace('/[^\w]/','', vartrue($_GET['srch'])); 
 		
+	
 		$mp = $this->getMarketplace();
 		// auth
 		$mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
@@ -420,27 +428,38 @@ class pluginManager{
 			'params' => array('limit' => 10, 'search' => $srch, 'from' => $from)
 		));
 		$total = $xdata['params']['count'];
+	
 		
 		// OLD BIT OF CODE ------------------------------->
-		/*	
+	/*
 	//	$file = SITEURLBASE.e_PLUGIN_ABS."release/release.php";  // temporary testing
 		$file = "http://e107.org/feed?type=plugin&frm=".$from."&srch=".$srch."&limit=10";
 		
 		$xml->setOptArrayTags('plugin'); // make sure 'plugin' tag always returns an array
 		$xdata = $xml->loadXMLfile($file,'advanced');
 
-		$total = $xdata['@attributes']['total'];*/
+		$total = $xdata['@attributes']['total'];
+		
+		echo 'file='.$file;
+	//	print_a($xdata);
+		
+		$xdata['data'] = $xdata['plugin'];
+		*/
 		// OLD BIT OF CODE END ------------------------------->
-
+		
+		
+// print_a($xdata);
 		 
 		$c = 1;
 		foreach($xdata['data'] as $row)
 		{
 			//$row = $r['@attributes'];
 			
+			//	print_a($row);
+			
 				$badge 		= $this->compatibilityLabel($row['compatibility']);;
 				$featured 	= ($row['featured']== 1) ? " Featured" : '';
-				$price 		= ($row['price'] > 0) ? "".$row['price']." credits" : "Free";
+				$price 		= ($row['price'] > 0) ? "Buy" : "Free";
 			
 				$data[] = array(
 					'plugin_id'				=> $row['params']['id'],
@@ -448,6 +467,7 @@ class pluginManager{
 					'plugin_icon'			=> vartrue($row['icon'],'e-plugins-32'),
 					'plugin_name'			=> stripslashes($row['name']),
 					'plugin_featured'		=> $featured,
+					'plugin_sef'			=> '',
 					'plugin_folder'			=> $row['folder'],
 					'plugin_date'			=> vartrue($row['date']),
 					'plugin_category'		=> vartrue($row['category'], 'n/a'),
@@ -457,9 +477,10 @@ class pluginManager{
 					'plugin_compatible'		=> $badge,
 				
 					'plugin_website'		=> vartrue($row['authorUrl']),
-					//'plugin_url'			=> $row['url'],
+					'plugin_url'			=> $row['urlView'],
 					'plugin_notes'			=> '',
-					'plugin_price'			=> $price 
+				//	'plugin_price'			=> $price,
+					'plugin_license'		=> $price
 				);	
 				
 			$c++;
@@ -508,7 +529,7 @@ class pluginManager{
 				// echo '
v='.$v; $text .= "".$frm->renderValue($v, $_value, $this->fields[$v], $key)."\n"; } - $text .= "".$this->options($val).""; + $text .= "".$this->options($val).""; $text .= ""; } @@ -554,8 +575,13 @@ class pluginManager{ $url = e_SELF.'?action=download&src='.base64_encode($d);//$url.'&action=download'; $id = 'plug_'.$data['plugin_id']; // - $dicon = " "; - return "
+ + // Temporary Pop-up version. + $dicon = ''; + + // $dicon = " "; + + return "
{$dicon}
"; } diff --git a/e107_handlers/e_marketplace.php b/e107_handlers/e_marketplace.php index 116ad2271..b9caca90e 100644 --- a/e107_handlers/e_marketplace.php +++ b/e107_handlers/e_marketplace.php @@ -39,6 +39,7 @@ class e_marketplace { $this->_adapter_name = 'wsdl'; } + } /** diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index f74e8a346..7e861816e 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -533,7 +533,7 @@ class themeHandler 'date' => $r['date'], 'version' => $r['version'], 'thumbnail' => $r['thumbnail'], - //'url' => $r['url'], + 'url' => $r['urlView'], 'author' => $r['author'], 'website' => $r['authorUrl'], 'compatibility' => $r['compatibility'], @@ -1028,6 +1028,7 @@ class themeHandler $id = $frm->name2id($theme['name']); $LAN_DOWNLOAD = ($theme['price'] > 0) ? "Buy/Download" : "Download"; + /* if($this->mp->hasAuthKey()) { $action = 'download'; @@ -1038,13 +1039,20 @@ class themeHandler $action = 'login'; $caption = "Please login to your e107.org account to proceed.."; } - + */ $downloadUrl = e_SELF.'?action='.$action.'&src='.base64_encode($d);//$url.'&action=download'; $infoUrl = $url.'&action=info'; + $viewUrl = $theme['url']; + //$main_icon = " "; - $main_icon = "".$tp->toGlyph('download',array('size'=>'2x'))." "; + // $main_icon = "".$tp->toGlyph('download',array('size'=>'2x'))." "; + + // Temporary Pop-up version. + $main_icon = "".$tp->toGlyph('download',array('size'=>'2x'))." "; + + $info_icon = "".$tp->toGlyph('fa-info-circle',array('size'=>'2x')).""; if($theme['livedemo'])