/** * @param string $clover * @param string $target * @param string $templatePath * * @throws \InvalidArgumentException */ public function convert($clover, $target, $templatePath = false) { if (is_file($clover) === false) { throw new \InvalidArgumentException(sprintf('"%s" is not a file', $clover)); } if (is_dir($target) === true) { throw new \InvalidArgumentException(sprintf('Target must be empty "%s"', $target)); } $this->render->render($this->hydrator->xmlToDto(simplexml_load_file($clover), new Root()), $target, $templatePath); }
public function mainAction() { // inicialize supporting classes $connection = new Connection(); $email = new Email(); $service = new Service(); $service->showAds = false; $render = new Render(); $response = new Response(); $utils = new Utils(); $wwwroot = $this->di->get('path')['root']; // get valid people $people = $connection->deepQuery("\n\t\t\tSELECT email, username, first_name, last_access\n\t\t\tFROM person\n\t\t\tWHERE active=1\n\t\t\tAND email not in (SELECT DISTINCT email FROM delivery_dropped)\n\t\t\tAND DATE(last_access) > DATE('2016-05-01')\n\t\t\tAND email like '%.cu'\n\t\t\tAND email not like '*****@*****.**'"); // send the remarketing $log = ""; foreach ($people as $person) { // get the email address $newEmail = "apretaste+{$person->username}@gmail.com"; // create the variabels to pass to the template $content = array("newemail" => $newEmail, "name" => $person->first_name); // create html response $response->setEmailLayout("email_simple.tpl"); $response->createFromTemplate('newEmail.tpl', $content); $response->internal = true; $html = $render->renderHTML($service, $response); // send the email $email->sendEmail($person->email, "Sorteando las dificultades, un email lleno de alegria", $html); $log .= $person->email . "\n"; } // saving the log $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/newemail.log"); $logger->log($log); $logger->close(); }
public function mainAction() { // inicialize supporting classes $timeStart = time(); $connection = new Connection(); $email = new Email(); $service = new Service(); $service->showAds = true; $render = new Render(); $response = new Response(); $utils = new Utils(); $wwwroot = $this->di->get('path')['root']; $log = ""; // people who were invited but never used Apretaste $invitedPeople = $connection->deepQuery("\n\t\t\tSELECT invitation_time, email_inviter, email_invited\n\t\t\tFROM invitations \n\t\t\tWHERE used=0 \n\t\t\tAND DATEDIFF(CURRENT_DATE, invitation_time) > 15 \n\t\t\tAND email_invited NOT IN (SELECT DISTINCT email from delivery_dropped)\n\t\t\tAND email_invited NOT IN (SELECT DISTINCT email from remarketing)\n\t\t\tORDER BY invitation_time DESC\n\t\t\tLIMIT 450"); // send the first remarketing $log .= "\nINVITATIONS (" . count($invitedPeople) . ")\n"; foreach ($invitedPeople as $person) { // check number of days since the invitation was sent $datediff = time() - strtotime($person->invitation_time); $daysSinceInvitation = floor($datediff / (60 * 60 * 24)); // validate old invitations to avoid bounces if ($daysSinceInvitation > 60) { // re-validate the email $res = $utils->deepValidateEmail($person->email_invited); // if response not ok or temporal, delete from invitations list if ($res[0] != "ok" && $res[0] != "temporal") { $connection->deepQuery("DELETE FROM invitations WHERE email_invited = '{$person->email_invited}'"); $log .= "\t --skiping {$person->email_invited}\n"; continue; } } // send data to the template $content = array("date" => $person->invitation_time, "inviter" => $person->email_inviter, "invited" => $person->email_invited, "expires" => strtotime('next month')); // create html response $response->createFromTemplate('pendinginvitation.tpl', $content); $response->internal = true; $html = $render->renderHTML($service, $response); // send the invitation email $subject = "Su amigo {$person->email_inviter} esta esperando por usted!"; $email->sendEmail($person->email_invited, $subject, $html); // insert into remarketing table $connection->deepQuery("INSERT INTO remarketing(email, type) VALUES ('{$person->email_invited}', 'INVITE')"); // display notifications $log .= "\t{$person->email_invited}\n"; } // get final delay $timeEnd = time(); $timeDiff = $timeEnd - $timeStart; // printing log $log .= "EXECUTION TIME: {$timeDiff} seconds\n\n"; echo $log; // saving the log $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/remarketing_invitation.log"); $logger->log($log); $logger->close(); // save the status in the database $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='invitation'"); }
public function testExecute() { $name = 'test-name'; $renderedData = '<html>data</html>'; $this->requestMock->expects($this->at(0))->method('getParam')->with('component')->willReturn($name); $this->requestMock->expects($this->at(1))->method('getParam')->with('name')->willReturn($name); $this->responseMock->expects($this->once())->method('appendBody')->with($renderedData); $viewMock = $this->getMock('Magento\\Ui\\Form\\Field', ['render'], [], '', false); $viewMock->expects($this->once())->method('render')->willReturn($renderedData); $this->uiFactoryMock->expects($this->once())->method('createUiComponent')->willReturn($viewMock); $this->assertNull($this->render->execute()); }
public function mainAction() { // inicialize supporting classes $timeStart = time(); $connection = new Connection(); $email = new Email(); $service = new Service(); $service->showAds = true; $render = new Render(); $response = new Response(); $utils = new Utils(); $wwwroot = $this->di->get('path')['root']; $log = ""; // people in the list to be automatically invited $people = $connection->deepQuery("\n\t\t\tSELECT * FROM autoinvitations\n\t\t\tWHERE email NOT IN (SELECT email FROM person)\n\t\t\tAND email NOT IN (SELECT DISTINCT email FROM delivery_dropped)\n\t\t\tAND email NOT IN (SELECT DISTINCT email from remarketing)\n\t\t\tAND error=0\n\t\t\tLIMIT 450"); // send the first remarketing $log .= "\nAUTOMATIC INVITATIONS (" . count($people) . ")\n"; foreach ($people as $person) { // if response not ok, check the email as error $res = $utils->deepValidateEmail($person->email); if ($res[0] != "ok") { $connection->deepQuery("UPDATE autoinvitations SET error=1, processed=CURRENT_TIMESTAMP WHERE email='{$person->email}'"); $log .= "\t --skiping {$person->email}\n"; continue; } // create html response $content = array("email" => $person->email); $response->createFromTemplate('autoinvitation.tpl', $content); $response->internal = true; $html = $render->renderHTML($service, $response); // send invitation email $subject = "Dos problemas, y una solucion"; $email->sendEmail($person->email, $subject, $html); // mark as sent $connection->deepQuery("\n\t\t\t\tSTART TRANSACTION;\n\t\t\t\tDELETE FROM autoinvitations WHERE email='{$person->email}';\n\t\t\t\tINSERT INTO remarketing(email, type) VALUES ('{$person->email}', 'AUTOINVITE');\n\t\t\t\tCOMMIT;"); // display notifications $log .= "\t{$person->email}\n"; } // get final delay $timeEnd = time(); $timeDiff = $timeEnd - $timeStart; // printing log $log .= "EXECUTION TIME: {$timeDiff} seconds\n\n"; echo $log; // saving the log $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/remarketing_autoinvitation.log"); $logger->log($log); $logger->close(); // save the status in the database $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='autoinvitation'"); }
/** * Process the page when its submitted * * @author kuma, salvipascual * @version 1.0 * */ public function processAction() { // get the values from the post $captcha = trim($this->request->getPost('captcha')); $name = trim($this->request->getPost('name')); $inviter = trim($this->request->getPost('email')); $guest = trim($this->request->getPost('guest')); if (!isset($_SESSION['phrase'])) { $_SESSION['phrase'] = uniqid(); } // throw a die() // check all values passed are valid if (strtoupper($captcha) != strtoupper($_SESSION['phrase']) || $name == "" || !filter_var($inviter, FILTER_VALIDATE_EMAIL) || !filter_var($guest, FILTER_VALIDATE_EMAIL)) { die("Error procesando, por favor valla atras y comience nuevamente."); } // params for the response $this->view->name = $name; $this->view->email = $inviter; // create classes needed $connection = new Connection(); $email = new Email(); $utils = new Utils(); $render = new Render(); // do not invite people who are already using Apretaste if ($utils->personExist($guest)) { $this->view->already = true; return $this->dispatcher->forward(array("controller" => "invitar", "action" => "index")); } // send notification to the inviter $response = new Response(); $response->setResponseSubject("Gracias por darle internet a un Cubano"); $response->setEmailLayout("email_simple.tpl"); $response->createFromTemplate("invitationThankYou.tpl", array('num_notifications' => 0)); $response->internal = true; $html = $render->renderHTML(new Service(), $response); $email->sendEmail($inviter, $response->subject, $html); // send invitations to the guest $response = new Response(); $response->setResponseSubject("{$name} le ha invitado a revisar internet desde su email"); $responseContent = array("host" => $name, "guest" => $guest, 'num_notifications' => 0); $response->createFromTemplate("invitation.tpl", $responseContent); $response->internal = true; $html = $render->renderHTML(new Service(), $response); $email->sendEmail($guest, $response->subject, $html); // save all the invitations into the database at the same time $connection->deepQuery("INSERT INTO invitations (email_inviter,email_invited,source) VALUES ('{$inviter}','{$guest}','abroad')"); // redirect to the invite page $this->view->message = true; return $this->dispatcher->forward(array("controller" => "invitar", "action" => "index")); }
public function uploadFile() { $view = \Render::view('sections.file.upload'); $view['section'] = 'upload'; $view['page_id'] = 0; return $view; }
function update($params) { $c = $this->updated_companies[0]; $c->save(); Render::msg($c->getName() . ' Updated.'); $this->redirectTo(array('controller' => 'Company', 'action' => 'show', 'id' => $c->id)); }
public static function post($buffer = '') { if (Router::is_api_request()) { return $buffer; } // additional processes added by ctrls foreach (self::$processes as $proc) { $buffer = $proc($buffer); } // custom angular directives $buffer = preg_replace_callback("/data-(md-[a-z][^=\\s>]*)/", function ($matches) { $name = Filter::snake_to_camel($matches[1]); Render::include_script("app/{$name}"); return $matches[0]; }, $buffer); // assets $buffer = preg_replace_callback("/<--([^-]+)-->/", function ($matches) { return Render::$matches[1](); }, $buffer); // href and src urls $buffer = preg_replace_callback('/="(\\/[^"]*)/', function ($matches) { return '="' . SUBDIR . $matches[1]; }, $buffer); // css urls $buffer = preg_replace_callback("/\\((\\/[^)]*)/", function ($matches) { return "(" . SUBDIR . $matches[1]; }, $buffer); return $buffer; }
public static function get($inputData = array()) { $limitQuery = ""; $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0; $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0; $limitPage = (int) $limitPage > 0 ? $limitPage : 0; $limitPosition = $limitPage * (int) $limitShow; $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}"; $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery; $field = "cronid,timenumber,timetype,timeinterval,last_update,jobdata,date_added,status"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by cronid desc'; $result = array(); $command = "select {$selectFields} from cronjobs {$whereQuery} {$orderBy}"; $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command; $queryCMD .= $limitQuery; $query = Database::query($queryCMD); $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes'; if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['jobdata'])) { $row['jobdata'] = String::jsonToArray($row['jobdata']); } $row['date_addedFormat'] = Render::dateFormat($row['date_added']); $result[] = $row; } } else { return false; } // print_r($result);die(); return $result; }
public function create_one($params = []) { Session::permit_admin(); $class = Filter::controller_model(get_called_class()); $item = $class::create(Record::allow($params, ['name', 'title'])); Render::json($class::read(['*'], $item['id'])); }
/** * Generate bootstrap javascript virtual file * * @return void */ public function init() { $contents = \Render::view('partials.initjs'); $response = \Response::make($contents, 200); $response->header('Content-Type', 'application/javascript'); return $response; }
/** * Listing accounts */ public static function link($link = '') { $share = array(); $data = array(); $task = array(); $service = array(); $backups = array(); $profile = array(); $share = SharesModel::first(array('link' => $link)); if ($share) { $share = $share->toArray(); $data = json_decode($share['data'], true); if (strtotime($share['created_at']) + $share['expires'] > time()) { $task = TasksModel::first($share['task_id'])->toArray(); $service = ServicesModel::first($share['service_id'])->toArray(); $profile = UsersModel::profile($task['user_id']); $backups = call_user_func_array(array('app\\libraries\\' . $service['library'], 'shared'), array($task)); } else { \Util::notice(array('type' => 'danger', 'text' => 'The requested link has expired.')); } } else { \Util::notice(array('type' => 'danger', 'text' => 'The requested link does not exist.')); } $templateData = array('template' => 'shared/content', 'title' => 'Migrate - Shared Data', 'bodyId' => 'shared', 'styles' => array('shared.css'), 'scripts' => array('common/request.js', 'shared.js'), 'share' => $share, 'data' => $data, 'task' => $task, 'service' => $service, 'backups' => $backups, 'profile' => $profile); \Render::layout('template', $templateData); }
/** * [edit description] * @return [type] [description] */ public function edit($page_id, $block_id) { \Pongo::viewShare('page_id', $page_id); \Pongo::viewShare('block_id', $block_id); $block = $this->manager->getBlock($block_id); return \Render::view('sections.blocks.edit', array('block' => $block)); }
public static function antiTampering($tmplData) { //echo "Render::antiTampering()"; Render::error($tmplData, "Detected tampering of data. Stop it!!"); Render::login($tmplData); exit; }
public function html_list($document) { Backend::add('Sub Title', $document->getMeta('name')); Backend::add('TabLinks', $this->getTabLinks(Controller::$action)); Backend::add('Object', $document); Backend::addContent(Render::renderFile('document_list.tpl.php')); }
public static function get($inputData = array()) { $limitQuery = ""; $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0; $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0; $limitPage = (int) $limitPage > 0 ? $limitPage : 0; $limitPosition = $limitPage * (int) $limitShow; $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}"; $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery; $field = "id,parentid,date_added,title,url,status,sort_order"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by id desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "links {$whereQuery}"; $command .= " {$orderBy}"; $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command; $queryCMD .= $limitQuery; $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes'; $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1; $md5Query = md5($queryCMD); if ($cache == 'yes') { // Load dbcache $loadCache = Cache::loadKey('dbcache/system/link/' . $md5Query, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes'; if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['title'])) { $row['title'] = String::decode($row['title']); } if (isset($row['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if (isset($row['url']) && !preg_match('/^http/i', $row['url'])) { if (preg_match('/^\\/(.*?)$/i', $row['url'], $matches)) { $tmp = $matches[1]; $row['urlFormat'] = System::getUrl() . $tmp; } } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/link/' . $md5Query, serialize($result)); // end save return $result; }
function render() { $newest = $_REQUEST['newest']; $items = $this->db->GetAll('SELECT lylina_items.id, lylina_items.url, lylina_items.title, lylina_items.body, UNIX_TIMESTAMP(lylina_items.dt) AS timestamp, lylina_items.viewed, lylina_feeds.url AS feed_url, lylina_feeds.name AS feed_name FROM lylina_items, lylina_feeds WHERE UNIX_TIMESTAMP(lylina_items.dt) > UNIX_TIMESTAMP()-(8*60*60) AND lylina_items.feed_id = lylina_feeds.id ORDER BY lylina_items.dt DESC'); foreach ($items as &$item) { // If we have a newer item, mark it as new if ($newest && $item['id'] > $newest) { $item['new'] = 1; } print "\n"; // Format the date for headers $item['date'] = date('l F j, Y', $item['timestamp']); } $render = new Render(); $render->assign('items', $items); $render->display('items.tpl'); }
public function html_display($content) { Backend::add('Sub Title', 'Revisions for ' . $content->array['name']); Backend::add('content', $content); Backend::add('revisions', $content->object->revisions); Backend::addContent(Render::renderFile('content_revision.display.tpl.php')); return true; }
public function result() { if (!$this->if) { return FALSE; } parent::result(); return TRUE; }
function destroy($params) { $params['id'] ? $clientuser = new ClientUser($params['id']) : bail('no company selected'); $name = $clientuser->getName(); $clientuser->destroy(); Render::msg($name . ' Deleted.', 'bad'); $this->redirectTo(array('controller' => 'ClientUser', 'action' => 'index')); }
public function load() { if ($this->_if) { parent::load(); return TRUE; } return NULL; }
public function load() { ob_start(); parent::load(); $result = ob_get_contents(); ob_end_clean(); return $result; }
public static function get($inputData = array()) { $limitQuery = ""; $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0; $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0; $limitPage = (int) $limitPage > 0 ? $limitPage : 0; $limitPosition = $limitPage * (int) $limitShow; $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}"; $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery; $field = "groupid,group_title,groupdata"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by groupid desc'; $result = array(); $prefix = ''; $prefixall = Database::isPrefixAll(); if ($prefixall != false || $prefixall == 'no') { $prefix = Database::getPrefix(); } $command = "select {$selectFields} from " . $prefix . "usergroups {$whereQuery}"; $command .= " {$orderBy}"; $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command; $queryCMD .= $limitQuery; $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes'; $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : 15; $md5Query = md5($queryCMD); if ($cache == 'yes') { // Load dbcache $loadCache = Cache::loadKey('dbcache/system/usergroup/' . $md5Query, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes'; if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if (isset($row['groupdata'])) { $row['groupdata'] = self::arrayToLine($row['groupdata']); } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/usergroup/' . $md5Query, serialize($result)); // end save return $result; }
public static function get($inputData = array()) { $limitQuery = ""; $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0; $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0; $limitPage = (int) $limitPage > 0 ? $limitPage : 0; $limitPosition = $limitPage * (int) $limitShow; $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}"; $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery; $field = "userid,groupid,username,firstname,lastname,image,email,password,userdata,ip,verify_code,parentid,date_added,forgot_code,forgot_date"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by date_added desc'; $result = array(); $prefix = ''; $prefixall = Database::isPrefixAll(); if ($prefixall != false || $prefixall == 'no') { $prefix = Database::getPrefix(); } $command = "select {$selectFields} from " . $prefix . "users {$whereQuery}"; $command .= " {$orderBy}"; $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command; $queryCMD .= $limitQuery; $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes'; $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1; $md5Query = md5($queryCMD); if ($cache == 'yes') { // Load dbcache $loadCache = Cache::loadKey('dbcache/system/user/' . $md5Query, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } // echo $queryCMD;die(); $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if (isset($row['image'])) { $row['imageFormat'] = self::getAvatar($row['image']); } $result[] = $row; } } else { return false; } // Save dbcache Cache::saveKey('dbcache/system/user/' . $md5Query, serialize($result)); // end save return $result; }
public function getBusinessMessage(Render $class, $layout = NULL) { if ($layout == 'null') { $class->layout = $layout; } $class->set('mensagem', $this->getMessage()); if ($this->getCode() == 112) { die($class->render(array('controller' => 'Erros', 'view' => 'notPermisson'))); } else { if ($this->getCode() == 113) { die($class->render(array('controller' => 'Erros', 'view' => 'notPermisson'))); } else { if ($this->getCode() == 114) { die($class->render(array('controller' => 'Erros', 'view' => 'notPermisson'))); } } } }
public static function get($inputData = array()) { $limitQuery = ""; $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0; $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0; $limitPage = (int) $limitPage > 0 ? $limitPage : 0; $limitPosition = $limitPage * (int) $limitShow; $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}"; $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery; $field = "requestid,userid,total_request,date_added,status,comments"; $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field; $whereQuery = isset($inputData['where']) ? $inputData['where'] : ''; $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by requestid desc'; $result = array(); $command = "select {$selectFields} from " . Database::getPrefix() . "request_payments {$whereQuery}"; $command .= " {$orderBy}"; $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command; $queryCMD .= $limitQuery; $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes'; $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : 1; if ($cache == 'yes') { // Load dbcache $loadCache = DBCache::get($queryCMD, $cacheTime); if ($loadCache != false) { $loadCache = unserialize($loadCache); return $loadCache; } // end load } $query = Database::query($queryCMD); if (isset(Database::$error[5])) { return false; } $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes'; if ((int) $query->num_rows > 0) { while ($row = Database::fetch_assoc($query)) { if (isset($row['comments'])) { $row['comments'] = String::decode($row['comments']); } if (isset($row['date_added'])) { $row['date_addedFormat'] = Render::dateFormat($row['date_added']); } if ($inputData['isHook'] == 'yes') { if (isset($row['comments'])) { $row['comments'] = Shortcode::load($row['comments']); } } $result[] = $row; } } else { return false; } // Save dbcache DBCache::make(md5($queryCMD), $result); // end save return $result; }
public function html_list($result) { Backend::add('Sub Title', $result->getMeta('name')); Backend::add('TabLinks', $this->getTabLinks(Controller::$action)); Backend::addScript(SITE_LINK . '/js/jquery.js'); Backend::addScript(SITE_LINK . '/js/image_list.js'); Backend::addStyle(SITE_LINK . '/css/image_list.css'); Backend::addContent(Render::renderFile('image.list.tpl.php', array('db_object' => $result))); }
/** * [search description] * @return [type] [description] */ public function search() { if ($this->manager->withInputOnly()) { $users = $this->manager->search('users'); return \Render::view('sections.users.index', $users); } else { return \Redirect::route('users'); } }
public function __construct() { try { //rendereiza o construtor da classe pai $empresasRelacionadas = array(); parent::__construct(); $this->empresas_id = Session::read('Empresa.empresas_id'); /* PEGAR O ID DA EMPRESA NA SEÇÃO */ $this->pessoas_id = Session::read('Usuario.pessoas_id'); /* PEGAR O ID DA EMPRESA NA SEÇÃO */ $this->css = array('css/bootstrap', 'bs3/css/bootstrap.min', 'css/bootstrap_papper', 'css/bootstrap-reset', 'font-awesome/css/font-awesome', 'css/style', 'css/style-responsive', 'css/custom', 'js/advanced-datatable/css/demo_page', 'js/advanced-datatable/css/demo_table', 'css/Icomoon/style', 'css/preloader', 'js/data-tables/DT_bootstrap', 'js/bootsAlert/css/bootsAlert', 'js/chosen/chosen'); $this->js = array('js/jquery-1.11.1.min', 'bs3/js/bootstrap.min', 'js/jquery-ui-1.9.2.custom.min', 'js/ajaxForm', 'js/ckeditor/ckeditor', 'js/jquery.scrollTo.min', 'js/jQuery-slimScroll-1.3.0/jquery.slimscroll', 'js/jquery.nicescroll', 'js/dashboard', 'js/sparkline/jquery.sparkline', 'js/advanced-datatable/js/jquery.dataTables.min', 'js/advanced-datatable/js/dataTables.bootstrap.min', 'js/advanced-datatable/js/dataTables.responsive.min', 'js/dynamic_table_init', 'js/jquery.mask.min', 'js/funcoes', 'js/permission_js', 'js/scripts', 'js/bootsAlert/js/bootsAlert', 'js/chosen/chosen.jquery.min'); $this->ACL = new ACL(); $this->Util = new Utils(); $this->Empresa = new Empresa(); /** * definindo a data hora local */ date_default_timezone_set('America/Sao_Paulo'); if (!in_array($this->view, $this->ClasseAllow)) { if (Session::check('Auth') && Session::check('Usuario')) { if ($this->ACL->authenticacaoUser($this->controller, $this->view, Session::read('Usuario.roles_id'))) { Session::isLogged(); } else { //verifica se é um metodo ou pagina if ($this->autoRender == true) { throw new PageException("Pagina {$this->view}.php não encontrada", 405); } } } else { //logica para o usuario publico if ($this->ACL->authenticacaoUser($this->controller, $this->view, 1)) { //header('Location: ' . Router::url() . 'Erros/areaRestrita' ); } else { //verifica se é um metodo ou pagina if ($this->autoRender) { //redireciona para a pagina de area restrita throw new PageException("Pagina {$this->view}.php não encontrada", 405); } } } } /** * variaveis pora todas as areas do sistema */ if (in_array(Session::read('Usuario.roles_id'), array(3, 4))) { $empresasRelacionadas = $this->Empresa->empresasRelacionadas(md5($this->pessoas_id), Session::read('Usuario.roles_id')); } $this->set('empresasRelacionadas', $empresasRelacionadas); $this->set('css', $this->css); } catch (PageException $ex) { echo $ex->pageNotFound(); exit; } catch (Exception $ex) { echo $ex->getTraceAsString(); } }