public function latest()
 {
     $user_repo = $this->getP3();
     if (!$user_repo) {
         echo json_encode(array('error' => 'Please enter the name of the package as vercingetorix:test'));
     } else {
         $colons = explode(':', $user_repo);
         $user = $colons[0];
         $repo = isset($colons[1]) ? $colons[1] : false;
         if (!$repo || $user == '' || $repo == '') {
             echo json_encode(array('error' => 'Please enter the name of the package as vercingetorix:test'));
         } else {
             $packages = new packages($this->getDb());
             $package = $packages->select('*', 'WHERE user="******" AND repo="' . $repo . '"');
             if (!isset($package[0]['id'])) {
                 echo json_encode(array('error' => 'The package does not exist'));
             } else {
                 $url = 'http://github.com/api/v2/json/repos/show/' . $user . '/' . $repo . '/tags';
                 $cache = new Cache();
                 $data = $cache->get($url, 43200);
                 if (!$data) {
                     $data = file_get_contents($url);
                     $cache->set($url, $data);
                 }
                 $data = json_decode($data, true);
                 $tags_list = isset($data['tags']) ? $data['tags'] : array();
                 $tags = array_keys($tags_list);
                 sort($tags);
                 $latest = false;
                 foreach ($tags as $tag) {
                     if (strpos(strtolower($tag), 'beta') === false && strpos(strtolower($tag), 'rc1') === false && strpos(strtolower($tag), 'rc2') === false && strpos(strtolower($tag), 'pr') === false) {
                         $latest = $tag;
                     }
                 }
                 if (!$latest) {
                     echo json_encode(array('error' => 'There are no releases for this package'));
                 } else {
                     echo json_encode(array('error' => '', 'url' => 'http://github.com/' . $user . '/' . $repo . '/tarball/' . $latest, 'user' => $user, 'repo' => $repo, 'version' => $latest));
                 }
             }
         }
     }
 }
Example #2
0
 public function paypalpost()
 {
     /*
     			$package_data = $db->getRows('SELECT * FROM packages WHERE id IN ('.implode(",",$array_pack_id).')');
                        
                        print_r($package_data);
                        
                        foreach ($package_data as $package_data) {
                            	$query = "INSERT INTO orders (user_id,order_id,order_data,order_total) VALUES ('".$_SESSION['agent']['user_id']."','".$_POST['txn_id']."','".$package_data['title']."','".$package_data['price']."')";
                                    mysql_query($query);
                        }
     */
     /*
     $name= 	Input::get("name");
     $sql="INSERT INTO test (name) VALUES ('".$name."')";
     $status= DB::INSERT(DB::raw($sql));
     	if ($status=1)
     	return "Records insterted successfully". $status;
     	else
     		return "problem inserting records in DB";
     */
     $agent_id = Input::get('agent_id');
     $package_id = Input::get('package_id');
     $txn_id = Input::get("txn_id");
     $purchasedPacks = null;
     $values = explode(',', $package_id);
     $packages = packages::whereIn('id', $values)->get();
     foreach ($packages as $pack) {
         $purchasedPacks = $purchasedPacks . $pack['package'] . "<BR>";
     }
     return 'Agent_id is ' . $agent_id . ' Packages Bought are <BR>' . $purchasedPacks . ' based on Transaction_id ' . $txn_id;
     //AFTER RETREIVING VALUES NOW YOU NEED SEARCH CORRECT PACKAGE TITLE AND PRICE AND INSERT INTO ORDERS TABLE WITH
     //CORRECT TXN_IDS AND AGENT_ID
     //User will pass $array_pack_id, $_SESSION['agent']['user_id'],$_POST['txn_id'],$package_data['title'],$package_data['price']
 }
Example #3
0
 public function packages()
 {
     $jsonVariable;
     $packages = packages::get();
     return $packages;
 }
Example #4
0
 public function selectpackages($pkg_type, $country_id)
 {
     $banner_pkg = packages::where('pkg_type', '=', $pkg_type)->where('country_id', '=', $country_id)->get();
     return $banner_pkg;
 }