public static function run() { $smarty = \CODOF\Smarty\Single::get_instance(ABSPATH . 'admin/layout/'); $url = RURI; $smarty->assign('home', str_replace('admin/', '', $url)); $smarty->assign('self', $_SERVER['PHP_SELF']); $smarty->assign('token', CODOF\Access\CSRF::get_token()); if (isset($_GET['page']) && isset(codoForumAdmin::$action[$_GET['page']])) { codoForumAdmin::show_layout(codoForumAdmin::$action[$_GET['page']]); } else { codoForumAdmin::show_layout('index'); } }
public function sendDigest() { $smarty = \CODOF\Smarty\Single::get_instance(SYSPATH . 'CODOF/Forum/Notification/Digest/', true); $user = \CODOF\User\User::get(); $smarty->assign('site_title', \CODOF\Util::get_opt('site_title')); $smarty->assign('brand_img', \CODOF\Util::get_opt('brand_img')); $smarty->assign('username', $user->username); $date = date('Y-F-j-S', time()); list($year, $month, $day, $ordinal) = explode("-", $date); $dayInfo = array("year" => $year, "month" => $month, "day" => $day, "ordinal" => $ordinal); $smarty->assign('dayInfo', $dayInfo); $smarty->assign('statistics_img', 'http://i.imgur.com/7sBa4Ow.png'); //RAW $smarty->assign('create_new_img', 'http://i.imgur.com/E0MhBwI.png'); //RAW $notifier = new \CODOF\Forum\Notification\Notifier(); $events = $notifier->get(TRUE, 0, 'asc'); //get all unread notifications $sortedEvents = $this->sort($events); $smarty->assign('events', $sortedEvents); $smarty->assign('new_posts', $this->newPosts . " "); $smarty->assign('new_topics', $this->newTopics . " "); if (empty($events)) { $smarty->assign('nothing_new', true); } else { $smarty->assign('nothing_new', false); } $frequency = $user->prefers('notification_frequency'); $html = $smarty->fetch("{$frequency}.tpl"); $text = $smarty->fetch("{$frequency}Text.tpl"); $this->daily = $html; $this->dailyText = $text; $mailer = new \CODOF\Forum\Notification\Mail(); $mailer->setHTML($mailer->replace_tokens($this->dailyText)); $mailer->to = $user->mail; $mailer->subject = _t('Daily digest - ') . \CODOF\Util::get_opt('site_title'); $mailer->message = $this->daily; $mailer->send_mail(); }
<?php $smarty = \CODOF\Smarty\Single::get_instance(); $db = \DB::getPDO(); if (isset($_POST['captcha_public_key']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) { if (!isset($_POST['captcha'])) { $_POST['captcha'] = 'no'; } foreach ($_POST as $key => $value) { if ($key == 'captcha') { $value = "on" == $value ? "enabled" : "disabled"; } $query = "UPDATE " . PREFIX . "codo_config SET option_value=:value WHERE option_name=:key"; $ps = $db->prepare($query); $ps->execute(array(':key' => $key, ':value' => htmlentities($value, ENT_QUOTES, 'UTF-8'))); } } CODOF\Util::get_config($db); $content = $smarty->fetch('spam/recaptcha.tpl');
public function __construct() { $this->smarty = \CODOF\Smarty\Single::get_instance(); }
public static function get() { self::$smarty = \CODOF\Smarty\Single::get_instance(); return self::$smarty; }