/**
  * beforeFilter
  *
  * @param \Cake\Event\Event $event Event instance
  * @return void
  */
 public function beforeFilter(Event $event)
 {
     pr("AppPlusPlus component beforeFilter()");
     // no special action neeeded
     if ($this->_controller->request->is('api')) {
         return;
     }
     // Disallow access to actions that don't make sense after being logged in.
     $allowed = ['Accounts' => ['login', 'lost_password', 'register']];
     // return for now, until we integrate user model into plugin or require
     // it in the application.
     if (empty($this->_controller->Auth->user('id'))) {
         return;
     }
     //if (!$this->_controller->AuthUser->id()) {
     if (!$this->_controller->Auth->user('id')) {
         return;
     }
     // disallow access to actions that don't make sense after the user has
     // already logged in.
     foreach ($allowed as $controller => $actions) {
         if ($this->name === $controller && in_array($this->request->action, $actions)) {
             $this->Flash->message('The page you tried to access is not relevant if you are already logged in. Redirected to main page.', 'info');
             return $this->redirect($this->_controller->Auth->config('loginRedirect'));
         }
     }
 }
 public function get_article_asc()
 {
     $query = "SELECT * FROM Aset ORDER BY Aset_ID ASC LIMIT 2";
     pr($query);
     // $result = $this->fetch($query,0);
     // return $result;
 }
 public function createAction()
 {
     /**
      
      $authentication = new AuthenticationService(Application $app);
      $authentication->setController($controller);
      $authentication->setEntityClass('\Application\Model\Entity\Client');
      
      $auth = $this->get('service_locator')->locate('auth', $this);
      
      excel = $this->get('service_locator')->locate('excel', $options);
      
      $auth->get('token');
     */
     $formBulder = $this->get('form.factory');
     $client = new Client();
     $ClientForm = $formBulder->createBuilder(new ClientType(), $client)->getForm();
     $clientUser = new ClientUser();
     $UserClientForm = $formBulder->createBuilder(new ClientUserType($this->get('doctrine.entity_manager')), $clientUser)->getForm();
     $ClientForm->handleRequest($this->request);
     $UserClientForm->handleRequest($this->request);
     if ($this->request->isMethod('post')) {
         pr($client);
         pr($clientUser);
         exit;
     }
     return $this->render('Application::Client::create', array('form_client' => $ClientForm->createView(), 'form_client_user' => $UserClientForm->createView()));
 }
示例#4
0
 public function __construct()
 {
     //session_start();
     session_start();
     $this->_db = DB::getInstance();
     //$this->_sessionName = Config::get('session/session_name');
     //$this->_cookieName = Config::get('remember/cookie_name');
     $this->url = $this->parseUrl();
     pr($this->parsedUrl);
     //$this->constructCAV();
     /*
                     require_once APP_PATH.DS.'controllers'.DS.$this->controller.'.php';
                     $this->controller = new $this->controller;
                     
        
     		if (method_exists($this->controller, $this->method)
     		&& is_callable(array($this->controller, $this->method)))
     		{
        call_user_func_array(array($this->controller,$this->method),array($this->param));
     		} else {
     		    die_err(500,'err_50928');  
     		}
     * 
     */
 }
示例#5
0
 /**
  * ->processQueueCallback(function (\Dja\Db\Model\Metadata $metadata, \Doctrine\DBAL\Schema\Table $table, array $sql, \Doctrine\DBAL\Connection $db) {})
  * @param callable|\Closure $callBack
  */
 public function processQueueCallback(\Closure $callBack)
 {
     $callbackQueue = [];
     while (count($this->generateQueue)) {
         $modelName = array_shift($this->generateQueue);
         try {
             /** @var Metadata $metadata */
             $metadata = $modelName::metadata();
             $tblName = $metadata->getDbTableName();
             if ($this->db->getSchemaManager()->tablesExist($tblName)) {
                 continue;
             }
             if (isset($this->generated[$tblName])) {
                 continue;
             }
             $table = $this->metadataToTable($metadata);
             $this->generated[$tblName] = 1;
             $sql = $this->dp->getCreateTableSQL($table, AbstractPlatform::CREATE_INDEXES);
             array_unshift($callbackQueue, [$metadata, $table, $sql]);
             $fks = $table->getForeignKeys();
             if (count($fks)) {
                 $sql = [];
                 foreach ($fks as $fk) {
                     $sql[] = $this->dp->getCreateForeignKeySQL($fk, $table);
                 }
                 array_push($callbackQueue, [$metadata, $table, $sql]);
             }
         } catch (\Exception $e) {
             pr($e->__toString());
         }
     }
     foreach ($callbackQueue as $args) {
         $callBack($args[0], $args[1], $args[2], $this->db);
     }
 }
示例#6
0
 public function testQuickSort()
 {
     $is = $this->Sort->quickSort($this->examples[0]);
     $expected = array(1, 2, 3, 4, 6, 11, 16, 50, 58, 66, 69, 99);
     pr($is);
     $this->assertEquals($is, $expected);
 }
    public function lvFeeCC()
    {
        global $db;
        $objResto = new MasterRestaurantModel();
        $q = "SELECT name, cc_fee FROM {$objResto->table_name} ORDER BY cc_fee DESC ";
        $arrQuery = $db->query($q, 2);
        pr($arrQuery);
        $t = time();
        ?>
        <h2>
            List view Restaurant (Fee Credit Card)
        </h2>
        <div class="table-responsive">

            <table id="table_lvCC_<?php 
        echo $t;
        ?>
" class="table table-bordered table-striped table-hover crud-table"
                   style="background-color: white;">
                <tbody>
                <tr>
                    <th id="h_id_name_<?php 
        echo $t;
        ?>
">Restaurant</th>
                    <th id="h_id_discount_<?php 
        echo $t;
        ?>
">Fee</th>
                </tr>
                <?php 
        foreach ($arrQuery as $key => $val) {
            ?>
                    <tr id="lv_<?php 
            echo $val->name . $t;
            ?>
">
                        <td id="restaurant_<?php 
            echo $val->name . $t;
            ?>
"> <?php 
            echo $val->name;
            ?>
</td>
                        <td id="disc_<?php 
            echo $val->name . $t;
            ?>
"> <?php 
            echo $val->cc_fee;
            ?>
</td>
                    </tr>
                    <?php 
        }
        ?>
                </tbody>
            </table>
        </div>
        <?php 
    }
示例#8
0
 public function login($__user = null, $password = null, $remember = false)
 {
     if (!$__user && !$password && $this->exists()) {
         Session::put($this->_sessionName, $this->data()->id);
     } else {
         $user = $this->find($__user);
     }
     if ($user) {
         if ($this->data()->password === Hash::make($password, $this->data()->salt)) {
             Session::put($this->_sessionName, $this->data()->id);
             $remember = true;
             if ($remember) {
                 //echo 'remember!';
                 $hash = Hash::unique();
                 $hashCheck = $this->_db->get('user_sessions', array('user_id', '=', $this->data()->id));
                 if (!$hashCheck->count()) {
                     $this->_db->insert('user_sessions', array('user_id' => $this->data()->id, 'hash' => $hash));
                 } else {
                     $hash = $hashCheck->first()->hash;
                 }
                 Cookie::put($this->_cookieName, $hash, Config::get('remember.cookie_expiry'));
             }
             return true;
         } else {
             pr('NO PASS');
         }
     }
     return false;
 }
 /**
  * 
  * @param <type> $attachments
  * @return string html block of attachments
  */
 public function listAttachments($attachments = array())
 {
     if (empty($attachments) || !is_array($attachments)) {
         return false;
     }
     $return = array();
     foreach ($attachments as $attachment) {
         switch ($attachment['type']) {
             case 'jpeg':
             case 'gif':
                 $data = $this->__imageAttachment($attachment);
                 break;
             case 'msword':
             case 'pdf':
                 $data = $this->__fileAttachment($attachment);
                 break;
             default:
                 pr($attachment);
                 exit;
                 break;
         }
         $return[] = $this->__addAttachment($attachment, $data);
     }
     if (!empty($return)) {
         return sprintf('<ul class="attachments"><li>%s</li></ul>', implode('</li><li>', $return));
     }
     return false;
 }
 public function sendMail()
 {
     $mailer = new Email();
     $mailer->transport('smtp');
     $email_to = '*****@*****.**';
     $replyToEmail = "*****@*****.**";
     $replyToEmailName = 'Info';
     $fromEmail = "*****@*****.**";
     $fromEmailName = "Xuan";
     $emailSubject = "Demo mail";
     //$view_link = Router::url('/', true);
     $params_name = 'XuanNguyen';
     $view_link = Router::url(['language' => $this->language, 'controller' => 'frontend', 'action' => 'view_email', 'confirmation', $params_name], true);
     $sentMailSatus = array();
     if (!empty($email_to)) {
         //emailFormat text, html or both.
         $mailer->template('content', 'template')->emailFormat('html')->subject($emailSubject)->viewVars(['data' => ['language' => $this->language, 'mail_template' => 'confirmation', 'email_vars' => ['view_link' => $view_link, 'name' => $params_name]]])->from([$fromEmail => $fromEmailName])->replyTo([$replyToEmail => $replyToEmailName])->to($email_to);
         if ($mailer->send()) {
             $sentMailSatus = 1;
         } else {
             $sentMailSatus = 0;
         }
     }
     pr($sentMailSatus);
     exit;
 }
示例#11
0
function mailqueue_callback($args)
{
    if (!$args) {
        echo "NOT ARGS IN CALLBACK:";
        pr($args);
        die;
        //return false;
    }
    global $container_options;
    $log = array();
    $log['args'] = $args;
    $contanier = new Mail_Queue_Container_db($container_options);
    $obj = $contanier->getMailById($args['id']);
    if (!$obj) {
        echo "NOT OBJ IN CALLBACK:";
        pr($obj);
        die;
        //return false;
    }
    $log['mailObject'] = (array) $obj;
    $headers = $obj->headers;
    $subject = $obj->headers['Subject'];
    $body = $obj->body;
    $mail_headers = '';
    foreach ($headers as $key => $value) {
        $mail_headers .= "{$key}:{$value}\n";
    }
    $mail = $mail_headers . "\n" . $body;
    $decoder = new Mail_mimeDecode($mail);
    if (!$decoder) {
        echo "NOT DECODER IN CALLBACK";
        pr($decoder);
        die;
        //return false;
    }
    $decoded = $decoder->decode(array('include_bodies' => TRUE, 'decode_bodies' => TRUE, 'decode_headers' => TRUE));
    $body = $decoded->body;
    $esmtp_id = $args['queued_as'];
    if (isset($args['greeting'])) {
        $greeting = $args['greeting'];
        $greets = explode(' ', $greeting);
        $server = $greets[0];
    } else {
        $server = 'localhost';
    }
    $log['serverResponse'] = compact('server', 'esmtp_id');
    $res = sq("update mail_queue set log = '" . serialize($log) . "' where id = " . $args['id']);
    if (!$res) {
        echo "NOT RES IN CALLBACK";
        pr($res);
        die;
        //return false;
    }
    if (CRON) {
        echo "Email ID " . $args['id'] . "\n";
        echo "Log:\n\n";
        print_r($log);
        echo "\n\n";
    }
}
示例#12
0
 /**
  * test if things are working
  */
 public final function testEvent()
 {
     echo '<h1>your event is working</h1>';
     echo '<p>The following events are available for use in the Infinitas core</p>';
     pr($this->availableEvents());
     exit;
 }
 function create()
 {
     $dir = new Folder(APP);
     $files = $dir->findRecursive('.*');
     $data_array = array();
     foreach ($files as $file) {
         $file_parts = pathinfo($file);
         if (isset($file_parts['extension']) && ($file_parts['extension'] == "php" || $file_parts['extension'] == "ctp")) {
             $data = file_get_contents($file);
             $pattern = "~(__\\('|__\\(\")(.*?)(\\'\\)|\",|\\',|\"\\)|\" \\)|\\' \\))~";
             preg_match_all($pattern, $data, $matches);
             $data_array = array_filter(array_merge($data_array, $matches[2]));
         }
     }
     $data_array = array_unique($data_array);
     pr($data_array);
     $filename = 'adefault.po';
     $file = new File(APP . "/Locale" . DS . $filename);
     foreach ($data_array as $string) {
         $file->write('msgid "' . $string . '"' . "\n");
         $file->write('msgstr "' . $string . '"' . "\n\n");
         echo $string;
     }
     $file->close();
     die;
 }
 /**
  * upgrade method
  *
  * Using reflection API retrieve list of methods, that have `@since` comment
  * set to value no lower than requested version and call these methods.
  *
  * @param int $target_ver Target version, to upgrade to
  *
  * @return bool Success
  */
 public function upgrade($target_ver = NULL)
 {
     if (NULL === $target_ver) {
         $target_ver = AI1EC_DB_VERSION;
     }
     $target_ver = (int) $target_ver;
     $curr_class = get_class($this);
     $reflection = new ReflectionClass($this);
     $method_list = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
     $since_regex = '#@since\\s+(\\d+)[^\\d]#sx';
     foreach ($method_list as $method) {
         if ($method->getDeclaringClass()->getName() !== $curr_class || ($name = $method->getName()) === __FUNCTION__) {
             continue;
         }
         $doc_comment = $method->getDocComment();
         if (!preg_match($since_regex, $doc_comment, $matches)) {
             continue;
         }
         $since = (int) $matches[1];
         try {
             if ($since <= $target_ver && !$this->{$name}()) {
                 return false;
             }
         } catch (Ai1ec_Database_Schema_Exception $exception) {
             pr((string) $exception);
             return false;
         }
     }
     return true;
 }
示例#15
0
 public function index()
 {
     $data = $this->testimonial_model->get_testimonial();
     pr($data['data']);
     echo "<br>";
     echo $data['nav'];
 }
 function addProduct()
 {
     $category = _p('category');
     $name = _p('name');
     $description = _p('description');
     $meta_desc = _p('meta_descriptoion');
     $meta_key = _p('meta_keywords');
     $model = _p('model');
     $sku = _p('sku');
     $upc = _p('upc');
     $ean = _p('ean');
     $jan = _p('jan');
     $isbn = _p('isbn');
     $mpn = _p('mpn');
     $weight = _p('weight');
     $weight_class = _p('weight_class');
     $length = _p('length');
     $width = _p('width');
     $height = _p('height');
     $length_class = _p('length_class');
     $location = _p('location');
     $price = _p('price');
     $quantity = _p('quantity');
     $minimum = _p('minimum');
     $substract = _p('substract');
     $shipping = _p('shipping');
     $status = _p('status');
     $date_added = date('Y-m-d H:i:s');
     $pathUpload = "";
     $image = uploadFile('gambar', $pathUpload, 'image');
     $query_product = "INSERT INTO ck_product (`model`, `sku`, `upc`, `ean`, `jan`, `isbn`, `mpn`, `location`, `quantity`, `image`, `shipping`, `price`, `weight`, `weight_class_id`, `length`, `width`, `height`, `length_class_id`, `subtract`, `minimum`, `sort_order`, `status`, `date_added`) VALUES ('{$model}', '{$sku}', '{$upc}', '{$ean}', '{$jan}', '{$isbn}', '{$mpn}', '{$location}', {$quantity}, '{$image}', '{$shipping}', {$price}, {$weight}, '{$weight_class}', {$length}, {$width}, {$height}, '{$length_class}', '{$substract}', {$minimum}, '', {$status}, '{$date_added}' )";
     echo "<br />" . $query_product;
     echo "<br />";
     pr($image);
 }
示例#17
0
/**
 * Handy function that will print the GET params
 * if there are any
 */
function printGet()
{
    if (count($_GET) > 0) {
        echo "<h2>Query: ?" . $_SERVER['QUERY_STRING'] . "</h2>";
        pr($_GET);
    }
}
示例#18
0
 public function userListByDepartment()
 {
     pr($this->request->data);
     $dptId = $this->request->data['dept'];
     $userList = $this->BrokerEmployee->find('all', array('conditions' => array('BrokerEmployee.agency_dept_id' => $dptId), 'fields' => array('BrokerEmployee.id, BrokerEmployee.name')));
     return new CakeResponse(array('type' => 'application/json', 'body' => json_encode($userList)));
 }
示例#19
0
    /**
     *
     */
    protected function send()
    {
        if (!attrib('to') || !attrib('body')) {
            pr(<<<'EOD'
------------------------------------------------------------
arguments:
    --to            send to email address
    --subject       email subject
    --body          email content message

example:
    php send --to xxx@gmail.com --subject "hello" --body "hi"
    php send --to xxx@gmail.com --body "$(cat message.txt)"
------------------------------------------------------------
EOD
);
            exit;
        }
        $getFrom = function () {
            $fromEmail = conf('gmail.email');
            $fromName = conf('gmail.name');
            return "{$fromName} <{$fromEmail}>";
        };
        $to = attrib('to');
        $subject = attrib('subject', 'not-subject');
        $body = attrib('body');
        $result = \GmailManager::sendMessage($getFrom(), $to, $subject, $body);
        if ($result) {
            pr('Send success');
        } else {
            pr('Send fail !');
        }
    }
 /**
  * Receives auth response and does validation
  */
 public function callback()
 {
     $response = null;
     /**
      * Fetch auth response, based on transport configuration for callback
      */
     switch (Configure::read('Opauth.callback_transport')) {
         case 'session':
             if (!session_id()) {
                 session_start();
             }
             if (isset($_SESSION['opauth'])) {
                 $response = $_SESSION['opauth'];
                 unset($_SESSION['opauth']);
             }
             break;
         case 'post':
             $response = unserialize(base64_decode($_POST['opauth']));
             break;
         case 'get':
             $response = unserialize(base64_decode($_GET['opauth']));
             break;
         default:
             echo '<strong style="color: red;">Error: </strong>Unsupported callback_transport.' . "<br>\n";
             break;
     }
     /**
      * Check if it's an error callback
      */
     if (isset($response) && is_array($response) && array_key_exists('error', $response)) {
         // Error
         $response['validated'] = false;
     } else {
         $this->_loadOpauth();
         if (empty($response['auth']) || empty($response['timestamp']) || empty($response['signature']) || empty($response['auth']['provider']) || empty($response['auth']['uid'])) {
             $response['error'] = array('provider' => $response['auth']['provider'], 'code' => 'invalid_auth_missing_components', 'message' => 'Invalid auth response: Missing key auth response components.');
             $response['validated'] = false;
         } elseif (!$this->Opauth->validate(sha1(print_r($response['auth'], true)), $response['timestamp'], $response['signature'], $reason)) {
             $response['error'] = array('provider' => $response['auth']['provider'], 'code' => 'invalid_auth_failed_validation', 'message' => 'Invalid auth response: ' . $reason);
             $response['validated'] = false;
         } else {
             $response['validated'] = true;
         }
     }
     pr('here it is');
     /**
      * Redirect user to /opauth-complete
      * with validated response data available as POST data
      * retrievable at $this->data at your app's controller
      */
     $completeUrl = Configure::read('Opauth._cakephp_plugin_complete_url');
     if (empty($completeUrl)) {
         $completeUrl = Router::url('/opauth-complete');
     }
     $CakeRequest = new CakeRequest('/opauth-complete');
     $CakeRequest->data = $response;
     $Dispatcher = new Dispatcher();
     $Dispatcher->dispatch($CakeRequest, new CakeResponse());
     exit;
 }
示例#21
0
 function teste($id)
 {
     $this->loadModel('Paciente');
     $idConvenio = $this->Paciente->getConvenioIdPacientePorId($id);
     pr($idConvenio);
     exit;
 }
示例#22
0
 function getCartContent($session_id, $user_id = null, $recursion = null)
 {
     //$cartContent = array();
     /*
     		$sql = "SELECT ct.id, ct.product_id, ct.ct_qty, pd.pd_name, pd.pd_description, pd.pd_price, pd.pd_image, pd.category_id
     		FROM carts ct, products pd, categories cat
     		WHERE ct_session_id = '$session_id' AND
     		ct.product_id = pd.id AND
     		cat.id = pd.category_id";
     		
     		$results = $this->query($sql);
     		foreach ($results as $result){
     			$cartContent[] = $result;
     		}*/
     //opcijska nastavitev kako globoko naj isce cakephp s funkcijo find
     if (isset($recursion) && !empty($recursion)) {
         pr($recursion);
         //die;
         $this->recursive = $recursion;
     } else {
         $this->recursive = 2;
     }
     //$this->recursive = 1;
     if (!empty($user_id)) {
         $cartContent = $this->find('all', array('conditions' => array('OR' => array('Cart.user_id' => $user_id, 'Cart.ct_session_id' => $session_id))));
     } else {
         $cartContent = $this->find('all', array('conditions' => array('Cart.ct_session_id' => $session_id)));
     }
     return $cartContent;
 }
示例#23
0
 function notify($config)
 {
     $this->busy = $payment_config['account'];
     $req = 'cmd=_notify-validate';
     foreach ($_POST as $key => $value) {
         $value = urlencode(stripslashes($value));
         $req .= "&{$key}={$value}";
     }
     // post back to PayPal system to validate
     $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
     $fp = fsockopen('www.paypal.com/cn', 80, $errno, $errstr, 30);
     $test = array();
     $test['item_name'] = $_POST['item_name'];
     $test['item_number'] = $_POST['item_number'];
     $test['payment_status'] = $_POST['payment_status'];
     $test['payment_amount'] = $_POST['mc_gross'];
     $test['payment_currency'] = $_POST['mc_currency'];
     $test['txn_id'] = $_POST['txn_id'];
     $test['receiver_email'] = $_POST['receiver_email'];
     $test['payer_email'] = $_POST['payer_email'];
     $test['order_sn'] = $_POST['invoice'];
     $test['memo'] = !empty($_POST['memo']) ? $_POST['memo'] : '';
     $test['action_note'] = $test['txn_id'] . '(paypal 交易号)' . $test['memo'];
     $this->response = $test;
     pr($this->response);
 }
示例#24
0
    public static function display()
    {
        echo '<div style=" min-height:100%; position: fixed; background-color: #f7f7f7; background-image: -moz-linear-gradient(-90deg, #e4e4e4, #ffffff); background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e4e4e4), to(#ffffff)); top:30px; bottom: 0; left:0; margin:0; padding: 0; z-index: 6000000; width: 100%; font: 12px Verdana, Arial, sans-serif; text-align: left; color: #2f2f2f;">
					<div style="display: block; background-color: #2F2F2F; padding: 8px 20px; position: fixed; top: 0; left:0; width: 100%; font: 11px Verdana, Arial, sans-serif; text-align: left; color: #EEEEEE;">
						asdf
					</div>';
        echo timeEnd(TIMESTART) / 1000;
        pr(get_included_files());
        echo self::convertSize(memory_get_usage());
        echo '</div>
			  <div style="position: fixed; background-color: #f7f7f7; background-image: -moz-linear-gradient(-90deg, #e4e4e4, #ffffff); background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e4e4e4), to(#ffffff)); bottom: 0; left:0; margin:0; padding: 0; z-index: 6000000; width: 100%; border-top: 1px solid #bbb; font: 11px Verdana, Arial, sans-serif; text-align: left; color: #2f2f2f;">
			  	<span style="white-space:nowrap; color:#2f2f2f; display:inline-block; min-height:24px; border-right:1px solid #cdcdcd; padding:8px 7px 1px 4px; ">
		     		Cute Profiler
				</span>
				<span style="white-space:nowrap; color:#2f2f2f; display:inline-block; min-height:24px; border-right:1px solid #cdcdcd; padding:8px 7px 1px 4px; ">
		     		<span><a href="#" style="color: #2f2f2f">PHP ' . phpversion() . '</a></span>
					<span style="margin: 0; padding: 0; color: #979696;">|</span>
					<span style="color: #a33">xdebug</span>
					<span style="margin: 0; padding: 0; color: #979696">|</span>
					<span style="color: #759e1a">accel</span>
				</span>
				<span style="display:block; position:absolute; top:10px; right:30px; width:14px; height:14px; cursor: pointer;">
					close
				</span>
			  </div>';
    }
 public function save($form_data, $additional = array())
 {
     $mail = new cs_mail();
     $mail->set_from_email($this->_environment->getCurrentUser()->getEmail());
     $mail->set_from_name($this->_environment->getCurrentUser()->getFullName());
     $roomId = null;
     if (isset($additional['roomId']) && !empty($additional['roomId'])) {
         $roomId = $additional['roomId'];
     }
     if (!empty($form_data['reciever'])) {
         $recipients = implode(', ', $form_data['reciever']);
         $mail->set_to($recipients);
     } else {
         $list = $this->getRecieverList($roomId);
         if (count($list) == 1) {
             $mail->set_to($list[0]['value']);
         } else {
             //no reciever checked
             $this->_popup_controller->setErrorReturn(112, 'no reciever checked');
         }
     }
     $context_item = $this->_environment->getCurrentContextItem();
     $mail->set_message($form_data['mailcontent']);
     $mail->set_subject($form_data['subject']);
     $success = $mail->send();
     if ($success) {
         $this->_popup_controller->setSuccessfullDataReturn('mail send successfully');
     } else {
         //TODO: Error handling
         pr($mail);
     }
 }
示例#26
0
 /**
  * Displays a view
  *
  * @return void
  * @throws NotFoundException When the view file could not be found
  *	or MissingViewException in debug mode.
  */
 public function display()
 {
     $this->loadModel('First');
     pr($this->First->find('all'));
     die;
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
示例#27
0
文件: pubtest.php 项目: fixbugs/tips
 public function pc()
 {
     pr('ok');
     //$this->load->library('mobile_detect');
     //$detect = $this->mobile_detect->getTabletDevices();
     //var_dump($detect);
 }
示例#28
0
文件: statsrv.php 项目: philum/cms
function statsrv_build($p, $o)
{
    $dr = '/var/log/apache2';
    //$f='error.log';
    $f = 'access.log';
    //$f='other_vhosts_access.log';
    //$r=explore($dr); p($r);
    //echo $d=file_get_contents($dr.'/'.$f,FALSE,NULL,100,1000);
    $d = file_get_contents($dr . '/' . $f, NULL, NULL, 0, 10000);
    /*$d='w41k.com:80 66.249.67.73 - - [11/Jun/2015:18:09:14 +0200] "GET /34758 HTTP/1.1" 403 505 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" [2] => w41k.com:80 85.170.69.142 - -';*/
    $r = explode("\n", $d);
    //p($r);
    foreach ($r as $k => $v) {
        //$ra=explode('-',$v);
        $rb = explode(' ', $v);
        //p($rb);
        $ip = $rb[1];
        $day = substr($rb[4], 1);
        $pag = $rb[7];
        $day = stsrv_date($day);
        $day = mkday($day, 'ymdHis');
        $ret[] = array($ip, $day, $pag);
        //$ret[$ip][]=array($day,$pag);
    }
    pr($ret);
    //
    //echo count($ret);
    return $ret;
}
示例#29
0
 public static function testSQL()
 {
     $options = [];
     $q = Processor::table('Customer_lubri')->where('member_id', 'NOT LIKE', 'CT%')->where(self::getOr($options))->orderBy('member_id', 'DESC');
     pr(get_class($q));
     dd(Processor::toSql($q));
 }
示例#30
0
 public function loadDataFromRateChart($region, $supplier, $product_type)
 {
     $query = "select grc.* from quote_gas_rate_chart grc where grc.price_code like '%{$region}%' and grc.supplier_id='{$supplier}' and grc.quote_product_id = '{$product_type}' limit 1";
     pr($query);
     $result = $this->query($query);
     return $result;
 }