Exemple #1
0
 public function execute()
 {
     $response = array();
     $ret = Api_Bo_App::setFBML($this->m_uid, $this->getAppId(), $this->m_fbml);
     $response['result'] = $ret !== false ? '1' : '0';
     return $response;
 }
Exemple #2
0
 public function execute()
 {
     $appService = Api_ServiceFactory::create('AppService');
     $domainService = Api_ServiceFactory::create('DomainService');
     $aid = false;
     if (null != $this->m_aid) {
         $aid = $this->m_aid;
     } elseif (null != $this->m_appApiKey) {
         $aid = $appService->getNativeIdByApiKey($this->m_appApiKey);
     } elseif (null != $this->m_canvasName) {
         $aid = $appService->getNativeIdByProperty('canvas_url', $this->m_canvasName);
     }
     if (false !== $aid) {
         // TODO: Is this the right way to check for admin users?
         if ($this->getUserId() > 0 && !Api_Bo_App::checkUserOwnsApp($this->getUserId(), $aid)) {
             throw new Exception('Cannot query for app keys: permission denied');
         }
         $keyService = Api_ServiceFactory::create('KeyService');
         $keysets = $keyService->getAllKeysets($aid);
         $rkeys = array();
         foreach ($keysets as $ks) {
             $arr = array();
             $dkeys = $keyService->getKeyset($ks['domain_id'], $ks['domain_id']);
             $domainKey = $dkeys['api_key'];
             $arr['network_id'] = $domainKey;
             $arr['api_key'] = $ks['api_key'];
             $arr['secret'] = $ks['secret'];
             $rkeys[] = $arr;
         }
         $response = array('resp' => $rkeys);
         return $response;
     }
     throw new Exception("Could not find app with api key '{$this->m_appApiKey}' on network '{$this->m_nid}'");
 }
Exemple #3
0
 /**
  * Turns and authorized interaction into a usable api session. 
  * 
  * @return session key, expires, uid.
  */
 public function execute()
 {
     //       echo " Calling Auth Get Session today ";
     $response = array();
     if ($this->getUserId() == null || $this->getSessionValue(self::SESSION_APPROVED) != true) {
         throw new OpenFBAPIException("Authorization token not approved.", FB_ERROR_CODE_UNKNOWN_ERROR);
     }
     $infinite = false;
     if ($this->getSessionValue(self::SESSION_INFINITE) == 'true') {
         $infinite = true;
     }
     // Create session and return session id.
     session_regenerate_id(true);
     $sid = session_id();
     if ($infinite === true) {
         Session::mark_infinite($sid);
     }
     $this->setSessionValue(self::SESSION_TYPE, self::SESSION_TYPE_VALUE_SESS);
     $this->setSessionValue(self::SESSION_CALL_ID, 0);
     if ($infinite === true) {
         //			error_log("Authorized infinite session for ".$this->getUserId());
         $this->setSessionValue(self::SESSION_EXPIRES, self::SESSION_EXPIRES_VALUE_NEVER);
     } else {
         $this->setSessionValue(self::SESSION_EXPIRES, time() + 24 * 60 * 60);
     }
     $response[self::RESPONSE_SESSION_KEY] = $sid . '-ringside';
     $response[self::RESPONSE_EXPIRES] = $this->getSessionValue(self::SESSION_EXPIRES);
     $response[self::RESPONSE_USER_ID] = $this->getUserId();
     // Persist link to the session information
     $uas = Api_Bo_App::setUserAppSession($this->getAppId(), $this->getUserId(), $infinite, $sid);
     return $response;
 }
Exemple #4
0
 /**
  * Execute the users.hasAppPermission method
  */
 public function execute()
 {
     $response = array();
     // TODO execute permission check.
     $hasApp = Api_Bo_App::isUsersApp($this->m_checkApp, $this->m_uid);
     $response['result'] = $hasApp ? '1' : '0';
     return $response;
 }
 /**
  * Execute the users.hasAppPermission method
  *  
  */
 public function execute()
 {
     $apiKey = $this->getContext()->getApiKey();
     $ret = Api_Bo_App::checkUserHasPermission($apiKey, $this->getUserId(), $this->m_ext_perm, $this->getNetworkId());
     $response = array();
     $response[$this->m_ext_perm] = $ret ? '1' : '0';
     return $response;
 }
 public function execute()
 {
     $prefs = Api_Bo_App::getApplicationPreferences($this->getAppId(), $this->getUserId());
     $value = '';
     if (isset($prefs[$this->m_id])) {
         $value = $prefs[$this->m_id];
     }
     return array("result" => $value);
 }
Exemple #7
0
 /**
  * Execute the api call to get user app list.
  */
 public function execute()
 {
     $apps = Api_Bo_App::getUserApp($this->getUserId(), $this->app_id);
     $response = array();
     if (count($apps) == 0) {
         $response['app'] = array();
     } else {
         $response['app'] = $apps[0];
     }
     return $response;
 }
Exemple #8
0
 /**
  * Gets the fbml for the user
  *
  * @return Array
  */
 public function execute()
 {
     $this->checkDefaultApp($this->m_aid);
     $retVal = array();
     $fbml = Api_Bo_App::getFBML($this->m_uid, $this->m_aid);
     if ($fbml == "") {
         $retVal['result'] = "";
     } else {
         $retVal['result'] = "<![CDATA[" . $fbml . "]]>";
     }
     return $retVal;
 }
 public function execute()
 {
     $prefs = Api_Bo_App::getApplicationPreferences($this->getAppId(), $this->getUserId());
     if (empty($this->m_value)) {
         if (isset($prefs[$this->m_id])) {
             unset($prefs[$this->m_id]);
         }
     } else {
         $prefs[$this->m_id] = $this->m_value;
     }
     Api_Bo_App::saveAppPrefs($this->getAppId(), $this->getUserId(), $prefs);
     return array();
 }
 public function execute()
 {
     // only available for default applications.
     $this->checkDefaultApp();
     $uas = Api_Bo_App::getUserAppSession($this->m_uid, $this->m_aid);
     $response = array();
     if (count($uas) == 0) {
         $response['session'] = '';
     } else {
         $response['infinite'] = $uas[0]['infinite'] == 1 ? 'true' : 'false';
         $response['session_key'] = $uas[0]['session_key'];
     }
     return $response;
 }
 public function execute()
 {
     $prefs = Api_Bo_App::getApplicationPreferences($this->getAppId(), $this->getUserId());
     $response = array();
     foreach ($prefs as $prefId => $prefValue) {
         $row['pref_id'] = $prefId;
         $row['value'] = $prefValue;
         $response[] = $row;
     }
     if (empty($response)) {
         return $response;
     }
     return array("preference" => $response);
 }
Exemple #12
0
 /**
  * Execute the api call to get user app list.
  */
 public function execute()
 {
     $allows_status_update = $this->getBooleanValue($this->getApiParam('allows_status_update', null));
     $allows_create_listing = $this->getBooleanValue($this->getApiParam('allows_create_listing', null));
     $allows_photo_upload = $this->getBooleanValue($this->getApiParam('allows_photo_upload', null));
     $auth_information = $this->getBooleanValue($this->getApiParam('auth_information', null));
     $auth_profile = $this->getBooleanValue($this->getApiParam('auth_profile', null));
     $auth_leftnav = $this->getBooleanValue($this->getApiParam('auth_leftnav', null));
     $auth_newsfeeds = $this->getBooleanValue($this->getApiParam('auth_newsfeeds', null));
     $profile_col = $this->getBooleanValue($this->getApiParam('auth_newsfeeds', null));
     $profile_order = $this->getBooleanValue($this->getApiParam('auth_newsfeeds', null));
     $ret = Api_Bo_App::setUsersApp($this->app_id, $this->getUserId(), $allows_status_update, $allows_create_listing, $allows_photo_upload, $auth_information, $auth_profile, $auth_leftnav, $auth_newsfeeds, $profile_col, $profile_order);
     $response['result'] = $ret > 0 ? '1' : '0';
     return $response;
 }
 /**
  * Execute the users.hasAppPermission method
  */
 public function execute()
 {
     $response = array();
     // TODO execute permission check.
     $userApp = Api_Bo_App::getUserApp($this->m_uid, $this->m_checkApp);
     if (count($userApp) == 0) {
         $response['status'] = 'never';
     } else {
         if ($userApp[0]['enabled'] == 1) {
             $response['status'] = 'enabled';
         } else {
             $response['status'] = 'disabled';
         }
     }
     return $response;
 }
Exemple #14
0
 /**
  * Execute the api call to get user app list.
  */
 public function execute()
 {
     $list = Api_Bo_App::getApplicationListByUserId($this->getUserId());
     $ret = array();
     foreach ($list as $app) {
         $a = $app['RingsideApp'];
         $out = array_merge($app, $a);
         unset($out['RingsideApp']);
         $ret[] = $out;
     }
     $response = array();
     if (!empty($ret)) {
         $response['apps'] = $ret;
     }
     return $response;
 }
Exemple #15
0
 /**
  * Execute the api call to get user app list.
  */
 public function execute()
 {
     Api_Bo_App::removeUsersApp($this->getUserId(), $this->app_id);
     $response['result'] = '1';
     return $response;
 }
 /**
  * Returns an array containing the information on all deployed applications.
  *
  * @return array list of all applications deployed in the server
  */
 public function execute()
 {
     $_appList = Api_Bo_App::getAllApplications();
     return array('application' => $_appList);
 }
Exemple #17
0
 public function testGetAllApplicationsAndKeys()
 {
     $apps = Api_Bo_App::getAllApplicationsAndKeys();
     $this->assertGreaterThan(0, count($apps));
     foreach ($apps as $app) {
         $this->assertArrayHasKey('keys', $app);
     }
 }
Exemple #18
0
 /**
  * Returns an array of all app fbml blocks
  * formatted for display.
  * $location enum(narrow|wide) indicates the style to be used when fbml is returned
  * $arryExcludeAppNames is an array of app names which should not appear in the list
  * 
  */
 function getAllFormattedHtmlForUserOpenSocialApps($location = "narrow", $arryExcludeAppNames = null)
 {
     $userAppList = Api_Bo_App::getApplicationListByUserId($this->uid);
     $this->debug("******************** DUMPING OS userAppList for {$this->uid}" . " which is " . count($userAppList) . " apps");
     $aggregateFbml = "";
     $fbmlArry = array();
     if (!empty($userAppList)) {
         foreach ($userAppList as $index => $appInfo1) {
             $appInfo = $appInfo1['RingsideApp'];
             $this->debug("Processing " . $appInfo['name'] . " " . $appInfo['app_id']);
             $this->debug("{$appInfo1}=" . var_export($appInfo1, true));
             //$returnedFbml=$this->getFbmlForApp($appInfo1['app_id'],$this->uid);
             $app_id = $appInfo1['app_id'];
             $app_name = $appInfo['name'];
             $enabled = true;
             // Don't show this app if it is not open social
             if ($appInfo['canvas_type'] != 2) {
                 $enabled = false;
                 $this->debug("{$app_name} rejected as not open social.");
             }
             if ($enabled) {
                 //$app_appBlock=$this->getFormatedFbmlFromAppName($app_name,$location,true,$returnedFbml);
                 //$fbmlArry=array_merge($fbmlArry,$app_appBlock);
                 $block = array("<div id='app-{$app_name}-header' class='wide_app_header'> ");
                 $block[] = $app_name;
                 //$block[]="<div style='float: right;' ><form id='formmove' name='formmove'  method='post' ><input name='action' type='hidden' value='saveColChange'/><input name='appname' type='hidden' value='$app_name'/><a onClick='form.submit();' href=''> [move] </a></form></div>";
                 $block[] = "</div>";
                 $frameParams = $_REQUEST;
                 $callbackQuery = http_build_query($frameParams);
                 $owner_id = $_REQUEST['id'];
                 if ($owner_id == '') {
                     $owner_id = $this->uid;
                 }
                 // Get api_key
                 $keyService = Api_ServiceFactory::create('KeyService');
                 $domainService = Api_ServiceFactory::create('DomainService');
                 $domainId = $domainService->getNativeIdByName('Ringside');
                 $app_keysArray = $keyService->getKeyset($app_id, $domainId);
                 $app_keys = $app_keysArray;
                 /*
                 		      	 $app_keysArray=Api_Bo_App::getUsersAppKeys($this->uid,$app_id);
                 		      	 $app_keys=$app_keysArray[0];
                 		      	 $this->debug(var_export($app_keysArray,true));
                 		      	 foreach($app_keysArray as $testApp_keys){
                 		      	 	if($testApp_keys['network_id']==$socialApiKey){
                 		      	 		$app_keys=$testApp_keys;
                 		      	 	}
                 		      	 }
                 		      	 $app_keys=$app_keysArray[0];
                 */
                 $this->debug("{$app_keys}=" . var_export($app_keys, true));
                 $social_session = new RingsideSocialSession();
                 $social_session->addApiSessionKey($app_keys['api_key'], $app_keys['secret']);
                 $this->debug("Building Social Session with " . $app_keys['api_key'] . " and " . $app_keys['secret']);
                 $osGadgetUrl = RingsideSocialConfig::$socialRoot . '/gadgets/ifr?view=profile&synd=ringside&fb_sig_api_key=' . $app_keys['api_key'] . '&fb_sig_owner_id=' . $owner_id . '&url=' . urlencode($appInfo['callback_url']) . '&social_session_key=' . $social_session->getSessionKey();
                 $this->debug("osGadgetUrl= {$osGadgetUrl}");
                 $block[] = '<iframe src="' . $osGadgetUrl . '" height="400" width="450"></iframe>';
                 $fbmlArry = array_merge($fbmlArry, $block);
             }
         }
     }
     return $fbmlArry;
 }
Exemple #19
0
<?php

require_once 'ringside/m3/AbstractRest.php';
require_once 'ringside/api/bo/App.php';
$apps = Api_Bo_App::getAllApplicationsAndKeys();
$ajaxUrl = $this->url_for($controller = "apps", $action = null, $only_path = false);
?>
<h1>Applications</h1>
<table style=" background-color: #EEF2F3; border:1px solid black; width:95%; margin: auto;" cellpadding="0" cellspacing="0" >
  <tr>
    <td style="width:10px;overflow: hidden; " valign="top">
      <div id="navcontainerVert">
        <ul id="navlistVert" style="padding:0px;margin:0px;">
              
 
                <?php 
for ($i = 0; $i < count($apps); $i++) {
    ?>
  
                  <li>
                      <a href="#app<?php 
    print $apps[$i]['id'];
    ?>
" id="app<?php 
    print $apps[$i]['id'];
    ?>
" appname="<?php 
    print $apps[$i]['name'];
    ?>
" api_key="<?php 
    print $apps[$i]['keys'][0]['api_key'];
 public function execute()
 {
     $prefs = Api_Bo_App::getApplicationPreferences($this->getAppId(), $this->getUserId());
     if ($this->m_replace == true) {
         $prefs = array();
     }
     foreach ($this->m_prefs as $prefId => $prefValue) {
         if (empty($prefValue)) {
             if (isset($prefs[$prefId])) {
                 unset($prefs[$prefId]);
             }
         } else {
             $prefs[$prefId] = $prefValue;
         }
     }
     Api_Bo_App::saveAppPrefs($this->getAppId(), $this->getUserId(), $prefs);
     return array();
 }