Example #1
0
 /**
     @param $a the token passed back from the oAuth Provider, typically $_GET['oauth_token']
 */
 public function getAccessToken($a = null)
 {
     $uri = self::TOKEN_ACCESS_URI;
     $arg = array('client_id' => $this->_oauth_client_id, 'client_secret' => $this->_oauth_client_secret, 'grant_type' => 'authorization_code', 'redirect_uri' => $a['redirect_uri'], 'code' => $a['code']);
     $res = radix_http::get($uri . '?' . http_build_query($arg));
     radix::dump($res);
     $ret = json_decode($res['body'], true);
     return $ret;
 }
Example #2
0
 public function search($arg)
 {
     if (is_string($arg)) {
         $arg['q'] = $arg;
     }
     // http://ils-server:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on
     $this->_curl_exec($this->_host . '/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on');
     radix::dump($this);
 }
Example #3
0
 /**
  */
 function fetch($uri, $post = null, $verb = null, $head = null)
 {
     if (empty($post)) {
         $post = array();
     }
     if (empty($verb)) {
         $verb = 'GET';
     }
     if (empty($head)) {
         $head = array('User-Agent' => USER_AGENT);
     }
     try {
         // $ret = $this->_oauth->getAccessToken($uri);
         $this->_oauth->fetch($uri, $post, $verb, $head);
         // radix::dump($this->_oauth->debugInfo);
         // $inf = $this->_oauth->getLastResponseInfo();
         $res = $this->_oauth->getLastResponse();
         return json_decode($res, true);
     } catch (Exception $e) {
         radix::dump($this->_oauth->debugInfo);
     }
 }
Example #4
0
<?php

/**
	Payment Notification Hook for Gumroad
	Webhook for Gumroad
	@see https://gumroad.com/settings/developer
	@see https://gumroad.com/ping
	@see https://gumroad.com/webhooks
*/
if (empty($_GET['salt'])) {
    radix::bail(400);
}
_api_log_request();
/*
* order_number
* seller_id
* product_id
* product_permalink
* email (the email of the buyer)
* full_name (if present, the name of the buyer)
* price (the price paid, in USD cents)
* variants (if present, an array of each variant choice: ['blue', 'small'])
* offer_code (if present)
* test (if you are buying your own product, for testing purposes)
* custom_fields (if present, a dictionary {'name' : 'john smith', 'spouse name' : 'jane smith'})
* shipping_information (if present, a dictionary)
* is_recurring_charge (if relevant, a boolean)
* is_preorder_authorization (if relevant, a boolean)
* revenue_share_amount_cents (if releva
*/
// If it's a Webhook Request?
Example #5
0
<?php

/**
    Email Compose View

    Compose a plain text message

    @copyright    2008 Edoceo, Inc
    @package    edoceo-imperium
    @link       http://imperium.edoceo.com
    @since      File available since Release 1013
*/
echo '<form action="' . radix::link('/email/send') . '" enctype="" method="post">';
echo '<table>';
//if (!empty($this->EmailMessage->RecipientList)) {
//  echo '<tr><td class="b r">To:</td><td>' . $this->formSelect('to_s',$this->EmailMessage->to,array('style'=>'width: 50%;'),$this->EmailMessage->RecipientList) . '</td></tr>';
//  $this->EmailMessage->to = null;
//}
//echo '<tr><td class="b r">To:</td><td>' . $this->formText('to_t',$this->EmailMessage->to,array('style'=>'width: 50%;')) . '</td></tr>';
echo '<tr>';
echo '<td class="l">To:</td><td><input id="rcpt" name="rcpt" type="text" value="' . html($this->EmailMessage['rcpt']) . '" /></td>';
echo '</tr>';
echo '<tr><td class="b r">Subject:</td><td>' . radix_html_form::text('subj', $this->EmailMessage['subj']) . '</td></tr>';
echo '<tr><td class="b r">Message:</td><td>' . radix_html_form::textarea('body', $this->EmailMessage['body'], array('style' => 'height: 25em;', 'wrap' => 'off')) . '</td></tr>';
echo '</table>';
echo '<div class="cmd">';
echo '<button class="exec" name="a" value="send">Send</button>';
echo '</div>';
echo '</form>';
?>
Example #6
0
 /**
     Send
 */
 public function textSend($a)
 {
     // $api = sprintf('SMS/Messages/%s.json',$sid);
     $r = $this->post('SMS/Messages.json', $a);
     radix::dump($r);
     return $r;
 }
Example #7
0
 /**
     Read a Message by UUID
     @return Text Object
 */
 function textRead($id)
 {
     $uri = self::_uri('Message/' . $id);
     $ch = self::_curl_init($uri);
     $ret = self::_curl_exec($ch);
     radix::dump($ret);
     if ($ret['info']['http_code'] == 200 && $ret['info']['content_type'] == 'application/json') {
         $ret = json_decode($ret['body'], true);
     }
     return $ret;
 }
Example #8
0
<?php

/**
	Account Form Index View
*/
if (!acl::may('/account/tax-form')) {
    radix_session::flash('fail', 'Access Denied');
    radix::redirect();
}
$_ENV['h1'] = $_ENV['title'] = array('Accounting', 'Tax Forms');
$res = radix_db_sql::fetchAll("select id,name from account_tax_form order by name");
echo '<p>Choose a Tax Form to Print!</p>';
echo '<ul>';
foreach ($res as $i => $f) {
    echo '<li><a href="' . radix::link('/account/tax-form/view?id=' . $f['id']) . '">' . $f['name'] . '</a></li>';
}
echo '</ul>';
Example #9
0
<?php

/**
	Account Tax Forms View

	@copyright	2008 Edoceo, Inc
	@package	edoceo-imperium
	@link	   http://imperium.edoceo.com
	@since	  File available since Release 1013
*/
$_ENV['title'] = array('Account', 'Tax Forms', $this->Form['name'], $this->date_alpha_f);
echo '<form action="" class="np" method="get">';
echo '<div>';
echo radix_html_form::hidden('id', $_GET['id']);
echo radix::block('account-period-input');
echo '</div>';
echo '</form>';
// radix::dump($this->LineList);
echo '<table>';
foreach ($this->LineList as $item) {
    // Skip Zero Balance
    if ($item['balance'] == 0) {
        //continue;
    }
    // Tax Line
    echo "<tr><th class='l' colspan='2'>" . $item['name'] . "</th><th class='r'>" . number_format($item['balance'], 2) . "</th></tr>";
    // Accounts that lead to this conculsion
    foreach ($item['accounts'] as $a) {
        echo "<tr><td>&nbsp;</td><td>" . $a['name'] . "</td><td class='r'>" . number_format($a['balance'], 2) . "</td></tr>";
    }
}
Example #10
0
<?php

/**
    @file
    @brief List of Files
*/
// echo $this->paginationControl($this->Page,'All','../elements/page-control.phtml');
$FileList = Radix\DB\SQL::fetch('SELECT * FROM base_file WHERE link IS NULL ORDER BY name');
echo radix::block('file-list', $FileList);
// echo $this->paginationControl($this->Page,'All','../elements/page-control.phtml');
Example #11
0
 /**
     Sends the Results from the exec() and view() as page
     @return 200|404
 */
 static function send()
 {
     ob_start();
     // Bail on Error?
     // die('self::$_view_res ' . self::$_view_res . "\n");
     if (self::$_view_res !== self::OK) {
         $v = self::$_view_res;
         self::$_view_res = self::OK;
         radix::bail($v);
         return 0;
     }
     $list = array(sprintf('%s/theme/%s.php', self::$root, self::$theme_name));
     if (self::$view->_include($list)) {
         ob_end_flush();
         return 0;
     }
     // No Layout? Use This Built-In
     if (empty($_ENV['title'])) {
         $_ENV['title'] = 'radix';
     }
     echo "<!doctype html>\n";
     echo "<html>\n";
     echo '<head><meta http-equiv="content-type" content="text/html;charset=utf-8" />';
     echo '<title>' . $_ENV['title'] . '</title>';
     echo '</head><body>';
     echo '<div>' . self::$view->body . '</div>';
     echo '</body></html>';
     ob_end_flush();
 }
Example #12
0
 /**
  */
 static function makeThumb($src, $dst, $dst_w, $dst_h)
 {
     list($src_w, $src_h, $type, $attr) = getimagesize($src);
     switch ($type) {
         case IMAGETYPE_GIF:
             $src_i = imagecreatefromgif($src);
             break;
         case IMAGETYPE_JPEG:
             $src_i = imagecreatefromjpeg($src);
             break;
         case IMAGETYPE_PNG:
             $src_i = imagecreatefrompng($src);
             break;
         default:
             throw new \Exception("Invalid Image Type: {$type}", __LINE__);
     }
     imagealphablending($src_i, true);
     //Radix::dump("Source: $src_w x $src_h");
     //Radix::dump("Target: $dst_w x $dst_h");
     // Image Must be Sized to Fit in the $w, $h box
     // if (($src_w > $dst_w) || ($src_h > $dst_h)) {
     $new_size = max($src_w / $dst_w, $src_h / $dst_h);
     //  / max($dst_w,$dst_h);
     //Radix::dump("Scale: $new_size");
     $new_w = min($dst_w, ceil($src_w / $new_size));
     $new_h = min($dst_h, ceil($src_h / $new_size));
     //Radix::dump("Result: $new_w x $new_h");
     // Calculate Centered Location
     $off_x = ($dst_w - $new_w) / 2;
     $off_y = ($dst_h - $new_h) / 2;
     //Radix::dump("Offset: $off_x x $off_y");
     // $dst_i = imagecreatetruecolor($new_w,$new_h);
     $dst_i = imagecreatetruecolor($dst_w, $dst_h);
     // And Make a Transparent Background
     imagealphablending($dst_i, false);
     imagesavealpha($dst_i, true);
     $tbg = imagecolorallocatealpha($dst_i, 255, 255, 255, 127);
     imagefilledrectangle($dst_i, 0, 0, $dst_w, $dst_h, $tbg);
     // Copy & Center
     imagecopyresampled($dst_i, $src_i, $off_x, $off_y, 0, 0, $new_w, $new_h, $src_w, $src_h);
     $ret = imagepng($dst_i, $dst);
     radix::dump($ret);
     imagedestroy($src_i);
     imagedestroy($dst_i);
     if ($ret !== true) {
         $x = error_get_last();
         throw new \Exception($x['message'], __LINE__);
     }
     // }
     return $ret;
 }
Example #13
0
    echo '<input name="a" type="submit" value="Download">';
    echo '<input name="a" type="submit" value="Delete">';
}
echo '</div>';
echo '</form>';
$mime0 = strtok($this->File['kind'], '/');
$mime1 = strtok($this->File['kind']);
switch ($mime0) {
    case 'audio':
        echo '<h2>Audio Preview</h2>';
        echo '<div class="c">';
        echo '<audio controls preload src="' . radix::link('/file/download?id=' . $this->File['id']) . '"></audio>';
        echo '</div>';
        break;
    case 'image':
        echo '<h2>Preview</h2>';
        echo '<div class="c">';
        echo '<img src="' . radix::link('/file/download?a=preview&id=' . $this->File['id']) . '">';
        echo '</div>';
        break;
    default:
        echo '<h2>Preview</h2>';
        // $src = $this->appurl . '/file/download?a=preview&id=' . $this->File->id;
        echo '<div class="c">';
        echo '<a href="' . radix::link('/file/download?id=' . $this->File['id']) . '">Download</a>';
        echo '</div>';
}
// History
$args = array('list' => $this->File->getHistory());
echo radix::block('diff-list', $args);