function getTopFBPosts($account, $count = 10) { $start = tryGET('start'); $end = tryGet('end'); $token = getFBToken(); if (!isset($token[0])) { DoNotCache("Facebook: Authentication failed"); return null; } //No token $url = "https://graph.facebook.com/{$account}/posts"; $params = array($token[0] => $token[1], "limit" => 100, "fields" => "likes.limit(1).summary(true),shares,actions", "since" => $start, "until" => $end); $result = getAPI($url, $params); if (!isset($result->data)) { return array(); } $rdata = $result->data; usort($rdata, 'fbSort'); $posts = array(); foreach ($rdata as $key => $p) { if ($key < $count) { array_push($posts, $p); } else { break; } } return $posts; }
function getTweetsByDate($user, $start = 0, $end = 0) { if (empty($user)) { return null; } $token = getTwitterToken(); $headers = array("Authorization: Bearer " . $token); $getTweets = array(); if ($start == 0) { $start = time(); } if ($end == 0) { $end = time(); } $max_id = null; //First get each tweet segment needed do { $params = array("count" => 200, "trim_user" => 1, "exclude_replies" => 1, "include_rts" => 0, "user_id" => $user, "max_id" => $max_id); $url = "https://api.twitter.com/1.1/statuses/user_timeline.json"; $tweets = getAPI($url, $params, $headers); $lastDate = -1; if (isset($tweets->errors)) { $err = json_encode($tweets->errors); DoNotCache("Twitter error: {$err}"); continue; } //Skip twitter calls that result in an error if (isset($tweets->curl_error)) { $err = $tweets->curl_error; DoNotCache("Twitter error: {$err}"); continue; } //Skip for curl errors too $len = count($tweets); $last = $tweets[$len - 1]; $lastDate = strtotime($last->created_at); $max_id = $last->id_str; $getTweets = array_merge($getTweets, $tweets); } while ($lastDate > $start); //Trim the rear foreach (array_reverse($getTweets, TRUE) as $k => $t) { if (strtotime($t->created_at) >= $start) { break; } else { unset($getTweets[$k]); } } //Trim the front foreach ($getTweets as $k => $t) { if (strtotime($t->created_at) <= $end) { break; } else { unset($getTweets[$k]); } } $getTweets = array_values($getTweets); return $getTweets; }
function getFilesFromPage($pageName) { $url = API_URL . 'prop=links&titles=' . $pageName . '&plnamespace=6&format=json&pllimit=100'; $file = getAPI($url); if (!is_null(reset($file['query']['pages'])['links'])) { return reset($file['query']['pages'])['links']; } echo 'Files not found in ' . $pageName; exit; }
function getEnvelopeStatus($envelope_id) { // Start API $api = getAPI(); // Create parameters for RequestStatus $requestStatusparams = new RequestStatus(); $requestStatusparams->EnvelopeID = $envelope_id; $result = $api->RequestStatus($requestStatusparams); // Removed the array() around the $api call return $result; }
function getTopIGMedia($userID, $count = 10) { $start = tryGET('start'); $end = tryGET('end'); $url = "https://api.instagram.com/v1/users/{$userID}/media/recent"; $params = array("min_timestamp" => $start, "max_timestamp" => $end, "count" => "200", "client_id" => getIGClientID()); $res = getAPI($url, $params); if (!isset($res->data)) { return DoNotCache(); } $media = $res->data; usort($media, "igSort"); $result = array(); foreach ($media as $key => $p) { if ($key < $count) { array_push($result, $p); } else { break; } } return $result; }
function getTopIGMedia($userID, $count = 10) { $start = tryGET('start'); $end = tryGET('end'); $url = "https://api.instagram.com/v1/users/{$userID}/media/recent"; $params = array("min_timestamp" => $start, "max_timestamp" => $end, "count" => "200", "client_id" => getIGClientID()); $res = getAPI($url, $params); if (!isset($res->data)) { } return null; // return DoNotCache("Couldn't get Instagram Media: " . json_encode($res)); //TODO: Figure out how we can rework IG to work. $media = $res->data; usort($media, "igSort"); $result = array(); foreach ($media as $key => $p) { if ($key < $count) { array_push($result, $p); } else { break; } } return $result; }
function createStatusTable() { $count = count($_SESSION["EnvelopeIDs"]); if (isset($_SESSION["EnvelopeIDs"]) && count($_SESSION["EnvelopeIDs"]) > 0) { $api = getAPI(); $filter = new EnvelopeStatusFilter(); $filter->AccountId = $_SESSION["AccountID"]; $filter->EnvelopeIds = $_SESSION["EnvelopeIDs"]; try { $rsexParams = new RequestStatusesEx(); $rsexParams->EnvelopeStatusFilter = $filter; $statuses = $api->RequestStatusesEx($rsexParams)->RequestStatusesExResult; } catch (SoapFault $e) { $_SESSION["errorMessage"] = $e; header("Location: error.php"); } if (isset($statuses)) { //pr($statuses); ?> <ul class=""> <?php foreach ($statuses->EnvelopeStatuses->EnvelopeStatus as $status) { ?> <li> <span><u><?php echo $status->Subject; ?> </u> [<?php echo $status->Status; ?> ] - <?php echo $status->EnvelopeID; ?> <a href="getstatusofenvelope.php?envelopeid=<?php echo $status->EnvelopeID; ?> " target="_blank" title="Click to see a RequestStatus SOAP return for this Envelope">View RequestStatus</a> <a href="getpdf.php?envelopeid=<?php echo $status->EnvelopeID; ?> " target="_blank" title="Click to download PDF for this Envelope">Download PDF</a></span> <ul> <!-- Recipients --> <li> <span>Recipients (<?php echo count($status->RecipientStatuses->RecipientStatus); ?> )</span> <ul id="<?php echo $status->EnvelopeID; ?> "> <?php foreach ($status->RecipientStatuses->RecipientStatus as $rcpStatus) { ?> <li> <!-- Recipient Name and Start Signing --> <?php echo $rcpStatus->UserName; ?> <a href="embeddocusign.php?from_gsad=1&envelopeID=<?php echo $status->EnvelopeID; ?> &clientID=<?php echo $rcpStatus->ClientUserId; ?> ">Start Signing</a> </li> <?php } ?> </ul> </li> <!-- Documents --> <li> <span>Documents (<?php echo count($status->DocumentStatuses->DocumentStatus); ?> )</span> <ul> <?php foreach ($status->DocumentStatuses->DocumentStatus as $docStatus) { ?> <li> <?php echo $docStatus->Name; ?> </li> <?php } ?> </ul> </li> </ul> </li> <?php } ?> </ul> <?php } } else { // No Envelopes created yet echo '<tr><td><div class="sampleMessage">'; echo ' No envelopes created, yet. Use the tabs to create an Envelope.'; echo '</div></td></tr>'; } }
function getFBToken() { $url = "https://graph.facebook.com/oauth/access_token"; $params = array("client_id" => getFBClientID(), "client_secret" => getFBClientSecret(), "grant_type" => "client_credentials"); $token = getAPI($url, $params); if (isset($token->curl_error)) { return null; } $token = explode('=', $token); return $token; }
function embedSending($envelope) { $api = getAPI(); $ceParams = new CreateEnvelope(); $ceParams->Envelope = $envelope; try { $status = $api->CreateEnvelope($ceParams)->CreateEnvelopeResult; if ($status->Status == EnvelopeStatusCode::Created) { $rstParam = new RequestSenderToken(); $rstParam->AccountID = $envelope->AccountId; $rstParam->EnvelopeID = $status->EnvelopeID; $rstParam->ReturnURL = getCallbackURL("getstatusanddocs.php"); addEnvelopeID($status->EnvelopeID); $_SESSION["embedToken"] = $api->RequestSenderToken($rstParam)->RequestSenderTokenResult; header("Location: embedsending.php?envelopid=" . $status->EnvelopeID . "&accountID=" . $envelope->AccountId . "&source=Document"); } } catch (SoapFault $e) { $_SESSION["errorMessage"] = $e; header("Location: error.php"); } }
function embedSending($templateReferences, $envelopeInfo, $recipients) { $api = getAPI(); $ceParams = new CreateEnvelopeFromTemplates(); $ceParams->EnvelopeInformation = $envelopeInfo; $ceParams->Recipients = $recipients; $ceParams->TemplateReferences = $templateReferences; $ceParams->ActivateEnvelope = false; try { $status = $api->CreateEnvelopeFromTemplates($ceParams)->CreateEnvelopeFromTemplatesResult; if ($status->Status == EnvelopeStatusCode::Created) { $rstParam = new RequestSenderToken(); $rstParam->AccountID = $envelopeInfo->AccountId; $rstParam->EnvelopeID = $status->EnvelopeID; $rstParam->ReturnURL = getCallbackURL("getstatusanddocs.php"); addEnvelopeID($status->EnvelopeID); $_SESSION["embedToken"] = $api->RequestSenderToken($rstParam)->RequestSenderTokenResult; header("Location: embedsending.php?envelopid=" . $status->EnvelopeID . "&accountID=" . $envelope->AccountId . "&source=Document"); } } catch (SoapFault $e) { $_SESSION["errorMessage"] = $e; header("Location: error.php"); } }
/** * @brief 모듈의 action에 해당하는 method를 실행 * * $act값에 의해서 $action_list에 선언된 것들을 실행한다 **/ function proc() { // stop_proc==true이면 그냥 패스 if ($this->stop_proc) { return false; } // addon 실행(called_position 를 before_module_proc로 하여 호출) $called_position = 'before_module_proc'; $oAddonController =& getController('addon'); $addon_file = $oAddonController->getCacheFilePath(); if (file_exists($addon_file)) { @(include $addon_file); } if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) { // 권한 체크 if (!$this->grant->access) { return $this->stop("msg_not_permitted_act"); } // 모듈의 스킨 정보를 연동 (스킨 정보의 테이블 분리로 동작대상 모듈에만 스킨 정보를 싱크시키도록 변경) $oModuleModel =& getModel('module'); $oModuleModel->syncSkinInfoToModuleInfo($this->module_info); Context::set('module_info', $this->module_info); // 실행 $output = $this->{$this->act}(); // act이 없으면 action_forward에서 해당하는 act가 있는지 찾아서 대신 실행 } else { if (Context::isInstalled()) { $oModuleModel =& getModel('module'); $forward = null; // 현재 요청된 action의 대상 모듈을 찾음 // 1. action이름으로 검색 (DB검색 없이 하기 위함) if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\\_]+)(.*)$/', $this->act, $matches)) { $module = strtolower($matches[2] . $matches[3]); $xml_info = $oModuleModel->getModuleActionXml($module); if ($xml_info->action->{$this->act}) { $forward->module = $module; $forward->type = $xml_info->action->{$this->act}->type; $forward->act = $this->act; } } // 2. 1번에서 찾지 못하면 action forward를 검색 if (!$forward) { $forward = $oModuleModel->getActionForward($this->act); } // 찾아진 forward 모듈이 있으면 실행 if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) { $kind = strpos(strtolower($forward->act), 'admin') !== false ? 'admin' : ''; $oModule =& getModule($forward->module, $forward->type, $kind); $xml_info = $oModuleModel->getModuleActionXml($forward->module); $oModule->setAct($forward->act); $oModule->init(); if ($oModule->stop_proc) { return $this->stop($oModule->getMessage()); } $oModule->setModuleInfo($this->module_info, $xml_info); if (isset($xml_info->action->{$forward->act}) && method_exists($oModule, $forward->act)) { $output = $oModule->{$forward->act}(); } else { return $this->stop("msg_module_is_not_exists"); } // forward 모듈의 실행 결과 검사 if ($oModule->stop_proc) { return $this->stop($oModule->getMessage()); } $this->setTemplatePath($oModule->getTemplatePath()); $this->setTemplateFile($oModule->getTemplateFile()); if ($oModule->getLayoutFile()) { $this->setLayoutFile($oModule->getLayoutFile()); } $this->adds($oModule->getVariables()); // forward 모듈을 찾지 못했다면 원 모듈의 default index action을 실행 } else { if ($this->xml_info->default_index_act && method_exists($this, $this->xml_info->default_index_act)) { Context::set('act', $this->act = $this->xml_info->default_index_act); $output = $this->{$this->xml_info->default_index_act}(); } else { return false; } } } else { return false; } } // addon 실행(called_position 를 after_module_proc로 하여 호출) $called_position = 'after_module_proc'; $oAddonController =& getController('addon'); $addon_file = $oAddonController->getCacheFilePath(); if (file_exists($addon_file)) { @(include $addon_file); } if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) { $this->setError($output->getError()); $this->setMessage($output->getMessage()); return false; } // view action이고 결과 출력이 XMLRPC 또는 JSON일 경우 해당 모듈의 api method를 실행 if ($this->module_info->module_type == 'view') { if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') { $oAPI = getAPI($this->module_info->module, 'api'); if (method_exists($oAPI, $this->act)) { $oAPI->{$this->act}($this); } } } return true; }
function voidEnvelope($envelopeID = '') { $api = getAPI(); $voidEnvelopeparams = new VoidEnvelope(); $voidEnvelopeparams->EnvelopeID = $envelopeID; $voidEnvelopeparams->Reason = "Voided from phone call"; // Turn into transcription $response = $api->VoidEnvelope($voidEnvelopeparams); return $response; }
<body> <div class="header"> <h1 class="center huge text">Hummingbird Anipicker!</h1> <form class="align center form" action="index.php" method="get"> <input type="text" name="user" value="<?php echo $_GET['user']; ?> " autofocus placeholder="Type your HB username and press Enter!" /> <input type="checkbox" name="force-to-watch" value="true" <?php echo $_GET['force-to-watch'] ? 'checked' : ''; ?> /><label>Force to Watch</label> </form> <br /> </div> <div class="body"> <?php if (getAPI($_GET['user']) == false) { if (!isset($_GET['user'])) { echo '<h1 class="big text center">No Username Filled in</h1>'; } else { echo '<h1 class="big text center">Unexisting username</h1>'; echo '<h2 class="medium text center">Hummingbird responds with error 404</h2>'; } } else { getRandomAnime(); } ?> </div> </body> </html>
<?php function getAPI($uri) { $CURL_OPTS = array(CURLOPT_USERAGENT => "INNOVA-SDK-1.0.0", CURLOPT_SSL_VERIFYPEER => true, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => 60); $ch = curl_init($uri); curl_setopt_array($ch, $CURL_OPTS); $return["body"] = json_decode(curl_exec($ch), false); $return["httpCode"] = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return $return; } if ($_GET["id"]) { $Data = getAPI("http://www.escuelaamha.com.ar/files/modules/information/api.php?access_token=pepe&id=" . $_GET["id"]); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <input type="text" id="userid" value=""> <br> <button type="button" name="btn" id="btn">Ver Mi Usuario</button> <br> <br> <br> <pre> <?php
/** * excute the member method specified by $act variable * @return boolean true : success false : fail * */ function proc() { // pass if stop_proc is true if ($this->stop_proc) { debugPrint($this->message, 'ERROR'); return FALSE; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return FALSE; } // execute an addon(call called_position as before_module_proc) $called_position = 'before_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); if (FileHandler::exists($addon_file)) { include $addon_file; } if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) { // Check permissions if ($this->module_srl && !$this->grant->access) { $this->stop("msg_not_permitted_act"); return FALSE; } // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) $is_default_skin = !Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N' || Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N'; $usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET')); if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) { $dir = Mobile::isFromMobilePhone() ? 'm.skins' : 'skins'; $valueName = Mobile::isFromMobilePhone() ? 'mskin' : 'skin'; $oModuleModel = getModel('module'); $skinType = Mobile::isFromMobilePhone() ? 'M' : 'P'; $skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType); if ($this->module == 'page') { $this->module_info->{$valueName} = $skinName; } else { $isTemplatPath = strpos($this->getTemplatePath(), '/tpl/') !== FALSE; if (!$isTemplatPath) { $this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName)); } } } $oModuleModel = getModel('module'); $oModuleModel->syncSkinInfoToModuleInfo($this->module_info); Context::set('module_info', $this->module_info); // Run $output = $this->{$this->act}(); } else { return FALSE; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return FALSE; } // execute an addon(call called_position as after_module_proc) $called_position = 'after_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); if (FileHandler::exists($addon_file)) { include $addon_file; } if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) { $this->setError($output->getError()); $this->setMessage($output->getMessage()); if (!$output->toBool()) { return FALSE; } } // execute api methos of the module if view action is and result is XMLRPC or JSON if ($this->module_info->module_type == 'view') { if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') { $oAPI = getAPI($this->module_info->module, 'api'); if (method_exists($oAPI, $this->act)) { $oAPI->{$this->act}($this); } } } return TRUE; }
/** * excute the member method specified by $act variable * @return boolean true : success false : fail **/ function proc() { // pass if stop_proc is true if ($this->stop_proc) { return false; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return false; } // execute an addon(call called_position as before_module_proc) $called_position = 'before_module_proc'; $oAddonController =& getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); @(include $addon_file); if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) { // Check permissions if ($this->module_srl && !$this->grant->access) { $this->stop("msg_not_permitted_act"); return FALSE; } // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) $oModuleModel =& getModel('module'); $oModuleModel->syncSkinInfoToModuleInfo($this->module_info); Context::set('module_info', $this->module_info); // Run $output = $this->{$this->act}(); } else { return false; } // trigger call $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); if (!$triggerOutput->toBool()) { $this->setError($triggerOutput->getError()); $this->setMessage($triggerOutput->getMessage()); return false; } // execute an addon(call called_position as after_module_proc) $called_position = 'after_module_proc'; $oAddonController =& getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); @(include $addon_file); if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) { $this->setError($output->getError()); $this->setMessage($output->getMessage()); if (!$output->toBool()) { return false; } } // execute api methos of the module if view action is and result is XMLRPC or JSON if ($this->module_info->module_type == 'view') { if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') { $oAPI = getAPI($this->module_info->module, 'api'); if (method_exists($oAPI, $this->act)) { $oAPI->{$this->act}($this); } } } return true; }
function getStatus($envelopeID) { $status = null; $api = getAPI(); $rsParams = new RequestStatus(); $rsParams->EnvelopeID = $envelopeID; try { $status = $api->RequestStatus($rsParams)->RequestStatusResult; } catch (SoapFault $e) { $_SESSION["errorMessage"] = $e; header("Location: error.php"); } return $status; }