Example #1
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once __DIR__ . "/app/util/api.php";
require_once __DIR__ . "/templates/head.php";
require_once __DIR__ . "/templates/body.php";
require_once __DIR__ . "/config/luminate.php";
$url = "https://secure2.convio.net/cmp/site/CRSurveyAPI";
$param = array("response_format" => "json", "api_key" => api_key(), "method" => "listSurveys", "published_only" => "true", "list_category_id" => "1761", "list_page_size" => "500", "v" => "1.0");
$res = sendAPI($url, $param);
$jres = json_encode($res);
print "<script>console.log({$jres});</script>";
$surveys = $res->listSurveysResponse->surveys;
if (isset($surveys->surveyName)) {
    $surveys = array($surveys);
}
body_open();
?>

 <form action="upload/" method="post">
   <div id="survey_table">
   <table class="table">
     <tr>
       <th>Surveys</th>
     </tr>
     <?php 
foreach ($surveys as $key => $s) {
    ?>
      <tr>
Example #2
0
  http://opensource.org/licenses/MIT

  --------------------------------------------------------------------- */
define('access', 'API');
require_once 'includes/chevereto.php';
/*** Die, die, die my darling ***/
if (chevereto_config('api_key') == 'my_api_key' and chevereto_config('api_mode') == 'private' and !is_localhost()) {
    chevereto_die(array('Open <code>includes/config.php</code>', 'Edit <code>$config[\'api_key\'] = \'my_api_key\';</code> with a different key.'), 'API key', array('You haven\'t changed the default api key, the API won\'t work until you fix this.'));
}
$key = $_REQUEST['key'];
$to_upload = $_REQUEST['upload'];
$to_resize = $_REQUEST['resize_width'];
$format = $_REQUEST['format'];
$callback = $_REQUEST['callback'];
/*** Checks the auth ***/
if (api_mode('private') and api_key() !== $key and !is_localhost()) {
    $error_key_msg = 'Invalid API key';
    $ERROR_AUTH_API = array('status_code' => 403, 'status_txt' => $error_key_msg);
    switch ($format) {
        default:
        case 'json':
        default:
            json_output($ERROR_AUTH_API, $callback);
            break;
        case 'xml':
            xml_output($ERROR_AUTH_API);
            break;
        case 'txt':
            echo $error_key_msg;
            break;
    }
Example #3
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
require_once __DIR__ . "/../app/util/api.php";
require_once __DIR__ . "/../config/luminate.php";
header('Content-Type: application/json');
$id = $_SESSION["survey_id"];
$token = $_SESSION["sso_token"];
$params = array("response_format" => "json", "api_key" => api_key(), "v" => "1.0", "method" => "submitSurvey", "survey_id" => $id, "sso_auth_token" => $token);
$post = array_merge($params, $_POST);
$url = "https://secure2.convio.net/cmp/site/CRSurveyAPI";
$return = sendAPI($url, $post, true);
print json_encode($return);