Example #1
0
 function index()
 {
     ll('pagination');
     lm('news_model');
     $query = $this->news_model->getNewsPubListQuery();
     $config['base_url'] = site_url('page/index');
     $config['total_rows'] = $query->num_rows();
     $config['per_page'] = 20;
     $config['uri_segment'] = 3;
     $config['full_tag_open'] = '<div class="cf"><ul class="pagination pagination_bottom tac">';
     $config['full_tag_close'] = '</ul></div>';
     $config['first_tag_close'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     $config['cur_tag_open'] = '<li class="current"><a href="javascript:void(0)">';
     $config['cur_tag_close'] = '</a></li>';
     $this->pagination->initialize($config);
     $data['news'] = $this->news_model->getNewsPubListQuery($config['per_page'], $this->uri->segment(3))->result_array();
     $data['pagelinks'] = $this->pagination->create_links();
     lfv('page/page_index', $data);
 }
Example #2
0
function lfv($view, $vars = array(), $return = FALSE)
{
    $CI =& get_instance();
    ll('frontview');
    $CI->frontview->header($view);
    lv($view, $vars, $return);
    $CI->frontview->footer($view);
}
Example #3
0
 function __construct()
 {
     $this->ci =& get_instance();
     $this->ci->load->helper('bcore');
     $this->ci->load->config('oauth');
     $this->sitesConfig = $this->ci->config->item('sites_enabled');
     ll('oauth_client');
     $this->oauth_client = $this->ci->oauth_client;
 }
Example #4
0
/**
 * 投过标的、管理员、卖家可以看结果。
 * @param unknown_type $uid
 * @param unknown_type $did
 * @return boolean
 */
function canAccessDomainBidList($uid, $did)
{
    $CI =& get_instance();
    ll('ion_auth');
    if (!uli()) {
        return false;
    }
    if ($CI->ion_auth->is_admin()) {
        return true;
    }
    lm('domain_model');
    if ($CI->domain_model->isDomainBelongtoUser($did, $uid)) {
        return true;
    }
    lm('bid_model');
    if ($CI->bid_model->getUserDidDetailQuery($uid, $did)->num_rows() > 0) {
        return true;
    }
    return false;
}
Example #5
0
 public function index($exception)
 {
     // データベースダウン
     if (strpos($exception->getMessage(), 'mongodb') !== false) {
         return ll('Sorry, Database is down...');
     }
     $title = ll('Error');
     $errorMessage = ll('Sorry, Internal Server Error.');
     if ($exception instanceof NotFoundError) {
         header("HTTP/1.0 404 Not Found");
         header("Status: 404 Not Found");
         $title = ll('Not Found.');
         $errorMessage = ll('Not Found.');
     }
     if ($exception instanceof UserError) {
         $errorMessage = $exception->getMessage();
     } else {
         if (defined('DEBUG') && DEBUG) {
             $errorMessage .= ' (' . $exception->getMessage() . ')';
         }
     }
     return compact('exception', 'title', 'errorMessage');
 }
Example #6
0
 function index()
 {
     ll('Form_validation');
     $params = array('sidebar' => array(0 => 'system', 1 => 3), 'position' => array(anchor('backend/pw', '修改密码')));
     $this->load->vars($params);
     $val = $this->form_validation;
     // Set form validation rules
     $val->set_rules('old_password', '旧密码', 'trim|required|xss_clean|min_length[' . $this->min_password . ']|max_length[' . $this->max_password . ']');
     $val->set_rules('password', '密码', 'trim|required|xss_clean|min_length[' . $this->min_password . ']|max_length[' . $this->max_password . ']|matches[confirm_password]');
     $val->set_rules('confirm_password', '确认密码', 'trim|required|xss_clean');
     if ($val->run()) {
         if ($this->tank_auth->change_password($val->set_value('old_password'), $val->set_value('password'))) {
             $this->tank_auth->logout();
             redirect('admin');
             //$data['auth_message'] = '修改成功。';
         } else {
             $data['auth_message'] = '修改失败,请确认旧密码输入正确。';
         }
         // Load registration success page
         lav('admin/pw/index', $data);
     } else {
         lav('admin/pw/index');
     }
 }
Example #7
0
<h2><?php 
echo f('controller.name');
?>
</h2>

<fieldset>
    <?php 
echo f('form.ro', @$entry);
?>
</fieldset>

<div class="row">
    <a href="<?php 
echo f('controller.url');
?>
" class="button"><?php 
ll('Back to List');
?>
</a>
</div>
Example #8
0
 public function to_s()
 {
     return ll();
 }
Example #9
0
<h2><?php 
echo f('controller.name');
?>
</h2>

<form action="?confirm" method="POST">
    <fieldset>
        <?php 
ll('Are you sure want to delete?');
?>
    </fieldset>

    <input type="submit" value="<?php 
ll('OK');
?>
">
    <a href="<?php 
echo f('controller.url');
?>
" class="button"><?php 
ll('Cancel');
?>
</a>
</form>
Example #10
0
<?php

/**
 * radium: the most RAD PHP Framework
 *
 * @copyright Copyright 2012, Playwell Inc.
 * @license   http://opensource.org/licenses/bsd-license.php The BSD License
 */
?>
<ul class="breadcrumb">
	<li><?php 
echo $this->html->link(ll('Home'), '');
?>
 <span class="divider">/</span></li>
	<li class="active"><?php 
ee(ll('Error'));
?>
</li>
</ul>
<section>
	<h2><?php 
ee($title);
?>
</h2>
	<p><?php 
ee($errorMessage);
?>
</p>
</section>
Example #11
0
	<h2><?php 
echo ll('Welcome to radium PHP Framework!');
?>
</h2>
	<article>
		<ul>
			<li><?php 
echo $this->html->link(ll('Hello World'), 'hello_world');
?>
</li>
			<li><?php 
echo $this->html->link('Not Exist Page', 'example');
?>
</li>
			<li><?php 
echo $this->html->link(ll('Request Headers'), 'hello_world/headers');
?>
</li>
			<li><?php 
echo $this->html->link('Routes Test 1', 's/barfoo');
?>
</li>
			<li><?php 
echo $this->html->link('Routes Test 2', 'hello');
?>
</li>
			<li><?php 
echo $this->html->link('JSON Render Test', 'hello_world/show_json/foobar');
?>
</li>
		</ul>
Example #12
0
 function SendAPIRequest($url, $method, $parameters, $oauth, $options, &$response)
 {
     $this->response_status = 0;
     ll('http');
     $this->ci->http->debug = $this->debug && $this->debug_http;
     $this->ci->http->log_debug = true;
     $this->ci->http->sasl_authenticate = 0;
     $this->ci->http->user_agent = $this->oauth_user_agent;
     if ($this->debug) {
         $this->OutputDebug('Accessing the ' . $options['Resource'] . ' at ' . $url);
     }
     $arguments = array();
     $method = strtoupper($method);
     $authorization = '';
     $type = isset($options['RequestContentType']) ? strtolower(trim(strtok($options['RequestContentType'], ';'))) : 'application/x-www-form-urlencoded';
     if ($this->url_parameters && count($parameters)) {
         $first = strpos($url, '?') === false;
         foreach ($parameters as $parameter => $value) {
             $url .= ($first ? '?' : '&') . UrlEncode($parameter) . '=' . UrlEncode($value);
         }
         $parameters = array();
     }
     if (isset($oauth)) {
         $values = array('oauth_consumer_key' => $this->client_id, 'oauth_nonce' => md5(uniqid(rand(), true)), 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => time(), 'oauth_version' => '1.0');
         $value_parameters = $type !== 'application/x-www-form-urlencoded' ? array() : $parameters;
         $values = array_merge($values, $oauth, $value_parameters);
         $uri = strtok($url, '?');
         $sign = $method . '&' . $this->Encode($uri) . '&';
         $first = true;
         $sign_values = $values;
         $u = parse_url($url);
         if (isset($u['query'])) {
             parse_str($u['query'], $q);
             foreach ($q as $parameter => $value) {
                 $sign_values[$parameter] = $value;
             }
         }
         KSort($sign_values);
         foreach ($sign_values as $parameter => $value) {
             $sign .= $this->Encode(($first ? '' : '&') . $parameter . '=' . $this->Encode($value));
             $first = false;
         }
         $key = $this->Encode($this->client_secret) . '&' . $this->Encode($this->access_token_secret);
         $values['oauth_signature'] = base64_encode($this->HMAC('sha1', $sign, $key));
         if ($this->authorization_header) {
             $authorization = 'OAuth';
             $first = true;
             foreach ($values as $parameter => $value) {
                 $authorization .= ($first ? ' ' : ',') . $parameter . '="' . $this->Encode($value) . '"';
                 $first = false;
             }
         } else {
             if ($method === 'GET') {
                 $first = strcspn($url, '?') == strlen($url);
                 foreach ($values as $parameter => $value) {
                     $url .= ($first ? '?' : '&') . $parameter . '=' . $this->Encode($value);
                     $first = false;
                 }
                 $post_values = array();
             } else {
                 $post_values = $values;
             }
         }
     }
     if (strlen($error = $this->ci->http->GetRequestArguments($url, $arguments))) {
         return $this->SetError('it was not possible to open the ' . $options['Resource'] . ' URL: ' . $error);
     }
     if (strlen($error = $this->ci->http->Open($arguments))) {
         return $this->SetError('it was not possible to open the ' . $options['Resource'] . ' URL: ' . $error);
     }
     $arguments['RequestMethod'] = $method;
     switch ($type) {
         case 'application/x-www-form-urlencoded':
             if (isset($options['RequestBody'])) {
                 return $this->SetError('the request body is defined automatically from the parameters');
             }
             $arguments['PostValues'] = $parameters;
             break;
         case 'application/json':
             $arguments['Headers']['Content-Type'] = $options['RequestContentType'];
             if (!isset($options['RequestBody'])) {
                 $arguments['Body'] = json_encode($parameters);
                 break;
             }
         default:
             if (!isset($options['RequestBody'])) {
                 return $this->SetError('it was not specified the body value of the of the API call request');
             }
             $arguments['Headers']['Content-Type'] = $options['RequestContentType'];
             $arguments['Body'] = $options['RequestBody'];
             break;
     }
     $arguments['Headers']['Accept'] = isset($options['Accept']) ? $options['Accept'] : '*/*';
     if (strlen($authorization)) {
         $arguments['Headers']['Authorization'] = $authorization;
     } else {
         if (strlen($this->headerKey)) {
             $this->GetAccessToken($access_token);
             $arguments['Headers']['Authorization'] = $this->headerKey . ' ' . $access_token['value'];
         }
     }
     if (strlen($error = $this->ci->http->SendRequest($arguments)) || strlen($error = $this->ci->http->ReadReplyHeaders($headers))) {
         $this->ci->http->Close();
         return $this->SetError('it was not possible to retrieve the ' . $options['Resource'] . ': ' . $error);
     }
     $error = $this->ci->http->ReadWholeReplyBody($data);
     $this->ci->http->Close();
     if (strlen($error)) {
         return $this->SetError('it was not possible to access the ' . $options['Resource'] . ': ' . $error);
     }
     $this->response_status = intval($this->ci->http->response_status);
     $content_type = isset($headers['content-type']) ? strtolower(trim(strtok($headers['content-type'], ';'))) : 'unspecified';
     if (!strlen($this->content_type)) {
         $this->content_type = isset($headers['content-type']) ? strtolower(trim(strtok($headers['content-type'], ';'))) : 'unspecified';
     }
     switch ($this->content_type) {
         case 'text/javascript':
         case 'application/json':
         case 'application/x-www-form-urlencoded':
         case 'text/plain':
         case 'text/html':
             if ($object = @json_decode($data)) {
                 if (!function_exists('json_decode')) {
                     return $this->SetError('the JSON extension is not available in this PHP setup');
                 }
                 switch (GetType($object)) {
                     case 'object':
                         if (!isset($options['ConvertObjects']) || !$options['ConvertObjects']) {
                             $response = $object;
                         } else {
                             $response = array();
                             foreach ($object as $property => $value) {
                                 $response[$property] = $value;
                             }
                         }
                         break;
                     case 'array':
                         $response = $object;
                         break;
                     default:
                         if (!isset($object)) {
                             return $this->SetError('it was not returned a valid JSON definition of the ' . $options['Resource'] . ' values');
                         }
                         $response = $object;
                         break;
                 }
             } elseif (strpos($data, '=') !== false) {
                 parse_str($data, $response);
             } else {
                 $response = $data;
             }
             break;
         default:
             $response = $data;
             break;
     }
     if ($this->response_status >= 200 && $this->response_status < 300) {
         $this->access_token_error = '';
     } else {
         $this->access_token_error = 'it was not possible to access the ' . $options['Resource'] . ': it was returned an unexpected response status ' . $this->ci->http->response_status . ' Response: ' . $data;
         if ($this->debug) {
             $this->OutputDebug('Could not retrieve the OAuth access. Error: ' . $this->access_token_error);
         }
         if (isset($options['FailOnAccessError']) && $options['FailOnAccessError']) {
             $this->error = $this->access_token_error;
             return false;
         }
     }
     return true;
 }
Example #13
0
 function creditlog()
 {
     ll('pagination');
     lm('bid_model');
     lm('user_creditlog_model');
     lm('user_profile_model');
     $query = $this->user_creditlog_model->getUserCreditLogListQuery(uid());
     $config['base_url'] = site_url('profile/in');
     $config['total_rows'] = $query->num_rows();
     $config['per_page'] = 20;
     $config['uri_segment'] = 3;
     $config['full_tag_open'] = '<div class="cf"><ul class="pagination pagination_bottom tac">';
     $config['full_tag_close'] = '</ul></div>';
     $config['first_tag_close'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     $config['cur_tag_open'] = '<li class="current"><a href="javascript:void(0)">';
     $config['cur_tag_close'] = '</a></li>';
     $this->pagination->initialize($config);
     $data['userprofile'] = $this->user_profile_model->getUserProfileArray(uid());
     $data['creditlog'] = $this->user_creditlog_model->getUserCreditLogListQuery(uid(), $config['per_page'], $this->uri->segment(3))->result_array();
     $data['pagelinks'] = $this->pagination->create_links();
     lfv('profile/profile_creditlog', $data);
 }
Example #14
0
<?php

/**
 * radium: the most RAD PHP Framework
 *
 * @copyright Copyright 2012, Playwell Inc.
 * @license   http://opensource.org/licenses/bsd-license.php The BSD License
 */
?>
<ul class="breadcrumb">
	<li><?php 
echo $this->html->link(ll('Home'), '');
?>
 <span class="divider">/</span></li>
	<li class="active">Routes Test 1</li>
</ul>
<section>
	<h2><?php 
ee(ll('Show'));
?>
</h2>
	<article><?php 
echo $this->html->escape($str);
?>
</article>
</section>
Example #15
0
 function login()
 {
     ll('oauth_lib');
     $this->oauth_lib->login('alipay');
 }
Example #16
0
            <tr>
                <th style="width:1px"><input type="checkbox"></th>
                <?php 
echo $self->renderColumns();
?>
                <?php 
echo $self->renderAction();
?>
            </tr>
        </thead>
        <tbody>
            <?php 
if ($self->isEmpty($entries)) {
    ?>
                <tr><td style="text-align: center" colspan="100"><?php 
    ll('No row available');
    ?>
</td></tr>
            <?php 
} else {
    ?>
                <?php 
    foreach ($entries as $key => $entry) {
        ?>
                <tr>
                    <td><input type="checkbox"></td>
                    <?php 
        echo $self->renderColumns($entry);
        ?>
                    <?php 
        echo $self->renderAction($entry);
Example #17
0
 * @license   http://opensource.org/licenses/bsd-license.php The BSD License
 */
?>
<ul class="breadcrumb">
	<li><?php 
echo $this->html->link(ll('Home'), '');
?>
 <span class="divider">/</span></li>
	<li class="active"><?php 
ee(ll('Hello World!'));
?>
</li>
</ul>
<section>
	<h2><?php 
ee(ll('Hello World!'));
?>
</h2>
	
	<?php 
for ($i = 0; $i < 100; $i++) {
    ?>
	<p><?php 
    ee(ll('Hello World!'));
    ?>
</p>
	<?php 
}
?>
</section>
Example #18
0
<h2><?php 
echo f('controller.name');
?>
</h2>

<div>
    <a href="<?php 
echo f('controller.url', '/null/create');
?>
" class="button"><?php 
ll('Add');
?>
</a>
</div>

<?php 
echo f('table', $entries);