function __construct() { $this->referer = isset($_SESSION['error_uri']) ? $_SESSION['error_uri'] : ''; $this->msg = isset($_SESSION['error_msg']) ? $_SESSION['error_msg'] : 'Error occured'; unset($_SESSION['error_uri']); unset($_SESSION['error_msg']); Ctrl::$setCache = 0; }
protected function init() { Ctrl::$setCache = 0; $this->model = new $this->_model($this->folder); }
public function init() { Ctrl::$setCache = 0; $this->folder->config = array_merge(self::$config, $this->folder->config); $this->model = new $this->_model($this->folder); }
protected static function fetchContent(&$f, &$a, &$p, $main = false) { if (!$f->ctrl) { return array(); } $ctrl = $f->ctrl . 'Controller'; $C = new $ctrl($f, $a, $p); if (!method_exists($C, $a)) { self::$setCache = 0; self::$actionFound = 0; array_unshift($p, $a); $a = 'index'; } $data = $C->{$a}(); if (is_object($data) || is_array($data)) { if (is_array($data) && isset($data['total'])) { $total = $data['total']; $data = $data['data']; } else { $total = 0; } View::$frame = sprintf('tpl/%s%sframe.tpl.php', View::$theme, $f->path); $tpl = sprintf('tpl/%s%s/%s.tpl.php', View::$theme, $f->path, $a); $input = array('folder' => $f, 'params' => $p, 'data' => $data, 'total' => $total); $ret = View::render($tpl, $input); if ($main) { self::$data =& $data; if (User::$id && !in_array($a, array('add', 'edit', 'post')) && method_exists($C, 'panel')) { $ret .= View::renderPanel($C->panel($data)); } } return $ret; } if (strpos($data, '/') === 0 || strpos($data, 'http') === 0) { if (strpos($data, '/user/login') === 0 || strpos($data, '/error/denied') === 0) { $_SESSION['LOGIN_REFERER'] = $_SERVER['REQUEST_URI']; } self::redirect($data); } // anything else echo $data; die; }
public function send() { Ctrl::$setCache = 0; $article = $this->model->getBySlug($this->params[0]); View::$title = $article->subject . ' (Mail)'; if (isset($_POST['submit'])) { if (!strstr($_POST['mailto'], '@') && !strstr($_POST['mailfrom'], '@') && !$_POST['from']) { $_SESSION['ERR_FORM'] = 'Nama dan semua alamat email harus diisi'; return $article; } global $config; $mailfrom = $config['mail']; $headers['From'] = $_POST['mailfrom']; $headers['To'] = $_POST['mailto']; $headers['Subject'] = $config['site'] . ' - ' . $article->subject; $body = sprintf($config['mail']['send_body'], $_POST['from'], $_POST['mailfrom'], $_POST['msg'], $article->subject, $article->lead, $article->permalink); require_once 'Mail.php'; $mail =& Mail::factory('sendmail', array('sendmail_path' => '/usr/sbin/sendmail')); $mail->send($_POST['mailto'], $headers, $body); $_SESSION['ERR_FORM'] = sprintf('Rekomendasi anda sudah dikirim ke %s. Anda dapat mengirim ke rekan yang lain.', $_POST['mailto']); $this->model->mailLog($article->permalink, $_POST); } return $article; }
public function init() { Ctrl::$setCache = 0; }