public function render() { $sort = front()->registry()->get('get', 'sort'); $page = front()->registry()->get('get', 'page'); $query = front()->registry()->get('get', 'q'); $this->_body['summarize'] = true; //create a common search //->addFilter('post1.post_type=%s', 'question') //->setColumns(...,'COALESCE(SUM(vote_value), 0) as votes', // '(SELECT COUNT(*) as answers FROM post as post2 // WHERE post2.post_type=\'answer\' AND post2.post_parent=post1.post_id // AND (post2.post_active > 0 OR post2.post_active BETWEEN -1 AND -4)) // AS answers //->addFilter('(post1.post_active = 1 OR post1.post_active BETWEEN -2 AND -1)') ////->sortByVotes('DESC') $search = front()->jobpost()->search()->setColumns('job.*', 'company.*')->setTable('jobpost AS job')->leftJoinOn('company', 'company.company_id= job.jobpost_company')->setGroup('job.jobpost_id')->setRange(self::RANGE); //if this is a search query if (trim($query)) { //set the query and filter $this->_body['query'] = $query; $search->addFilter('(jobpost_title LIKE %s OR jobpost_detail LIKE %s)', '%' . $query . '%', '%' . $query . '%'); } //case for sorting switch ($sort) { case 'new': $search->sortByJobpostCreated('DESC'); break; case 'old': $search->sortByJobpostCreated('ASC'); break; case 'unanswered': $search->sortByJobpostAnswers('ASC'); break; default: // $search->sortByVotes('DESC'); break; } //case for pagination if (is_numeric($page)) { $search->setPage($page); } else { $page = 1; } //now generate the final collection $this->_body['collection'] = $search->getCollection(); //add extra collection details foreach ($this->_body['collection'] as $jobpost) { $author = front()->user()->model($jobpost->getJobpostUser()); $jobpost['user_name'] = $author->getUserName(); } //$jobpost['user_facebook'] = $author->getAttributes('facebook_id'); // $jobpost['user_picture'] = $author->getAttributes('picture'); // $jobpost['tags'] = $jobpost->getCategories(); //create a pagination block $this->_body['pagination'] = front()->template(__DIR__ . '/_pagination.phtml', jquery()->block()->pagination($search->getTotal())->setRange(self::RANGE)->setPage($page)->setUrl('/')->setQuery($_GET)->getVariables()); return $this->_page(); }
protected function _page() { $this->_head['page'] = $this->_class; $page = front()->path('page'); $head = front()->trigger('head')->template($page . '/_head.phtml', $this->_head); $body = front()->trigger('body')->template($page . $this->_template, $this->_body); $foot = front()->trigger('foot')->template($page . '/_foot.phtml', $this->_foot); //page return front()->template($page . '/_page.phtml', array('meta' => $this->_meta, 'title' => $this->_title, 'class' => $this->_class, 'head' => $head, 'body' => $body, 'foot' => $foot)); }
/** * Returns the template variables in key value format * * @param array data * @return array */ public function getVariables() { $tags = array(); //get tag root $root = front()->category()->search()->filterByCategoryParent(0)->filterByCategoryTitle('tag')->setRange(1)->getModel(); //if the root does exist if ($root) { $tags = front()->category()->search()->setColumns('category.*, COUNT(category_id) AS total')->leftJoinOn('relation', "((relation_table1='category' AND " . "relation_id1=category_id AND relation_table2='post') OR " . "(relation_table2='category' AND relation_id2=category_id AND " . "relation_table1='post'))")->filterByCategoryParent($root['category_id'])->setRange(25)->setGroup('category_id')->sortByTotal('DESC')->getCollection(); } return array('tags' => $tags); }
protected function _process() { //get the user $userId = front()->registry()->get('session', 'user')->getUserId(); //create the generic model $username = $_POST['username']; $password = $_POST['username']; $post = front()->jobpost()->model()->setJobpostTitle($_POST['title'])->setJobpostDetail($_POST['detail'])->setJobpostUser($userId)->setJobpostCreated(time())->formatTime('jobpost_created')->copy('jobpost_created', 'jobpost_updated'); //add a success message $_SESSION['messages'][] = array('success', 'Success creating question - ' . $_POST['title'] . '!'); //redirect out front()->redirect('/question/' . $post->getPostSlug()); }
protected function _getContents($path) { try { $library = front()->registry()->get('path', 'library'); $folder = eden('folder', $library . $path); $files = $folder->getFiles(); $folders = $folder->getFolders(); } catch (Exception $e) { return array('folders' => array(), 'files' => array()); } sort($files); sort($folders); return array('folders' => $folders, 'files' => $files); }
protected function _process() { //get the user $userId = front()->registry()->get('session', 'user')->getUserId(); //create the generic model $post = front()->post()->model()->setPostTitle($_POST['title'])->setPostDetail($_POST['detail'])->setPostUser($userId)->setPostType('question')->setPostCreated(time())->formatTime('post_created')->copy('post_created', 'post_updated'); //get tag root $root = front()->category()->search()->filterByCategoryParent(0)->filterByCategoryTitle('tag')->setRange(1)->getModel(); //if the root does not exist if (!$root) { //create it $root = front()->category()->model()->setCategoryTitle('tag')->setCategoryUpdated(time())->formatTime('category_updated')->save(); } //loop through tags $tags = $_POST['tags']; foreach ($tags as $i => $name) { //if there's no name if (!trim($name)) { //skip it unset($tags[$i]); continue; } //we are lower casing all tags $name = strtolower($name); //check to see if tag exists $tag = front()->category()->search()->filterByCategoryParent($root->getCategoryId())->filterByCategoryTitle($name)->setRange(1)->getModel(); //if it doesn't if (!$tag) { //create it $tag = front()->category()->model()->setCategoryTitle($name)->setCategoryParent($root->getCategoryId())->setCategoryUpdated(time())->formatTime('category_updated')->save(); } //replace the tag name with the ID $tags[$i] = $tag->getCategoryId(); } //bulk add tags $post->addCategory(array_values($tags))->save(); //add a success message $_SESSION['messages'][] = array('success', 'Success creating question - ' . $_POST['title'] . '!'); //redirect out front()->redirect('/question/' . $post->getPostSlug()); }
public function getConsumerKey() { $this->_params['scopes'] = implode(', ', $this->_scopes); $url = $this->_debug ? self::CONSUMER_KEY_URL . '?debug=true' : self::CONSUMER_KEY_URL; unset($this->_params['oauth_consumer_key']); front()->output($this->_params); exit; $params = http_build_query($this->_params); $headers = array(); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $curl = Eden_Curl::i()->verifyHost(false)->verifyPeer(false)->setUrl($url)->setPost(true)->setPostFields($params)->setHeaders($headers); //get the response $response = $curl->getResponse(); return $response; }
$country = misc_get_country_by_account($char['account'], $sqlr, $sqlm); $output .= ' <td>' . ($country['code'] ? '<img src="img/flags/' . $country['code'] . '.png" onmousemove="toolTip(\'' . $country['country'] . '\',\'item_tooltip\')" onmouseout="toolTip()" alt="" />' : '-') . '</td>'; } $output .= ' </tr>'; } $output .= ' <tr>'; $output .= ' <td colspan="' . (10 - $showcountryflag) . '" align="right" class="hidden" width="25%">'; $output .= generate_pagination('index.php?start_m=' . $start_m . '&order_by=' . $order_by . '&dir=' . ($dir ? 0 : 1), $total_online, $itemperpage, $start); unset($total_online); $output .= ' </td> </tr> </table> <br /> </center>'; } } //############################################################################# // MAIN //############################################################################# //$action = (isset($_GET['action'])) ? $_GET['action'] : NULL; $lang_index = lang_index(); front($sqlr, $sqlc, $sqlm); //unset($action); unset($action_permission); unset($lang_index); require_once 'footer.php';
protected function _process() { //get the user $userId = front()->registry()->get('session', 'user')->getUserId(); //get the post id from the URL //$jobpost = front()->registry()->get('request', 'variables', 0); //and make it into a model //$jobpost = front()->jobpost()->model($post); $name = addslashes($_POST['name']); $contactnum = addslashes($_POST['contactnum']); $why = addslashes($_POST['whyme']); $iavailability = addslashes($_POST['interviewavailability']); $message = "Hello Joe. Someone actually applied." . " \r\n" . "Name: " . $name . "\r\n" . "Contact:" . $contactnum . "\r\n" . "Is Available . " . $iavailability . "\r\n" . "Why you should choose this applicant? Because:" . $why . "\r\n"; //send a message to joe palala $send = '*****@*****.**'; mail($send, "Application received", $message, 'From: joe@mentorsdojo.com'); $this->_sendEmailToAdminViaSendGrid($send, "Application received", $message); //add a success message for what ever time there is date_default_timezone_set('Asia/Manila'); if ($_POST['gabiorumaga'] == "") { $bati = 'Magandang Gabi'; //assume it is PM } else { //its determined by JS, which sets the value of the input element 'gabiorumaga' depending on the time of day. $bati = 'Magandang ' . $_POST['gabiorumaga']; } $_SESSION['messages']['success'] = array('Thank you po sa pag-apply. ' . $bati); $_SESSION['messages']['more'] = array('Please email your resume with the position in the subject to joe@mentorsdojo.com'); //redirect out front()->redirect('/thanksforapplying'); //$post->getPostSlug()); }
/** * Returns the template variables in key value format * * @param array data * @return array */ public function getVariables() { $users = front()->user()->search()->innerJoinOn('post', 'user_id=post_user')->innerJoinOn('vote', 'post_id=vote_post AND vote_value > 0')->setColumns('user.*', 'COUNT(post_user) AS total')->filterByPostType('answer')->setRange(25)->setGroup('post_user')->sortByTotal('DESC')->getCollection(); return array('users' => $users); }
<?php include 'functions.php'; front('Slider Homepage'); // Defines page head info and title slider(); // Loads slider function ?> <!--OTHER CONTENT--> <?php back(); // Closes body and html
/** * Queries the database * * @param string query * @param array binded value * @return array|object */ public function query($query, array $binds = array()) { if (strpos(strtolower($query), 'insert into') === 0 || strpos(strtolower($query), 'update') === 0 || strpos(strtolower($query), 'delete from') === 0) { //get the table $table = str_replace('insert into ', '', strtolower($query)); $table = str_replace('update ', '', $table); $table = str_replace('delete from ', '', $table); list($table, $trash) = explode(' ', $table, 2); $keys = $this->_cache->getKeys(); //invalidate all selects foreach ($this->_results as $key => $result) { $lower = strtolower($key); if (strpos($lower, 'from ' . $table) !== false || strpos($lower, 'join ' . $table) !== false || preg_match("/from\\s[a-zA-z]+\\." . $table . "\\s/i", $lower) || preg_match("/join\\s[a-zA-z]+\\." . $table . "\\s/i", $lower)) { unset($this->_results[$key]); } } foreach ($keys as $key) { $lower = strtolower($key); if (strpos($lower, 'from ' . $table) !== false || strpos($lower, 'join ' . $table) !== false || preg_match("/from\\s[a-zA-z]+\\." . $table . "\\s/i", $lower) || preg_match("/join\\s[a-zA-z]+\\." . $table . "\\s/i", $lower)) { $this->_cache->remove($key); } } } if (strpos(strtolower($query), 'select') !== 0) { return parent::query($query, $binds); } $key = $this->_getCacheKey($query, $binds); if (isset($this->_results[$key])) { $this->_cacheCount[0]++; $this->_binds = array(); return $this->_results[$key]; } else { if ($this->_cache->keyExists($key)) { $this->_cacheCount[0]++; $this->_binds = array(); return $this->_cache->get($key); } } $results = parent::query($query, $binds); $this->_cacheCount[1]++; $this->_results[$key] = $results; $this->_cache->set($key, time() . '-' . front()->uid(), $results); return $results; }
<?php include 'functions.php'; front('Homepage'); $user = new user(); if (!isset($_POST['submit'])) { ?> <section class="login"> <form action="index.php" method="POST" enctype="multipart/form-data"> <input type="text" class="basic" name="username" placeholder="Username or Email*" required><br/> <input type="password" class="basic" name="pwd1" id="pwd1" placeholder="Password*" required><br/> <input type="submit" class="submit" value='Login' name="submit"> </form> </section> <?php } else { if ($_POST['username'] != "") { $res = $user->userLogin($_REQUEST['username'], $_REQUEST['password']); if ($res == true) { echo "Login Successful!"; } else { echo "Username/Email or Password is incorrect!"; } } } ?>
<?php //--> /* * This file is part a custom application package. * (c) 2011-2012 Openovate Labs */ require '../config.php'; require dirname(__FILE__) . '/../front.php'; /* Get Application -------------------------------*/ print front()->setDebug(E_ALL, true)->setLoader(NULL, '/module')->setPaths()->setFilters(array('Front_Handler'))->trigger('init')->setFacebookApp('236111946483964', 'c89f7ce57b8f31c0e8b457477a65065d')->setDatabase(array('host' => DB_HOST, 'name' => DB_NAME, 'user' => DB_USERNAME, 'pass' => DB_PASSWORD))->setTimezone('Asia/Manila')->trigger('config')->startSession()->trigger('session')->setRequest()->trigger('request')->setResponse('Front_Page_Index')->trigger('response');