/**
  * Initialize the admin controller. Construct a menu to show all admin panels.
  *
  * @return void
  */
 public function init()
 {
     // If the user isn't an administrator, kick them out.
     if (!ET::$session->isAdmin()) {
         $this->redirect(URL("user/login?return=" . urlencode($this->selfURL)));
     }
     parent::init();
     // Construct the menus for the side bar.
     $this->defaultMenu = ETFactory::make("menu");
     $this->menu = ETFactory::make("menu");
     $this->defaultMenu->add("dashboard", "<a href='" . URL("admin/dashboard") . "'><i class='icon-dashboard'></i> " . T("Dashboard") . "</a>");
     $this->defaultMenu->add("settings", "<a href='" . URL("admin/settings") . "'><i class='icon-cog'></i> " . T("Forum Settings") . "</a>");
     $this->defaultMenu->add("appearance", "<a href='" . URL("admin/appearance") . "'><i class='icon-eye-open'></i> " . T("Appearance") . "</a>");
     $this->defaultMenu->add("channels", "<a href='" . URL("admin/channels") . "'><i class='icon-tags'></i> " . T("Channels") . "</a>");
     $this->defaultMenu->add("members", "<a href='" . URL("members") . "'><i class='icon-group'></i> " . T("Members") . "</a>");
     $this->defaultMenu->add("plugins", "<a href='" . URL("admin/plugins") . "'><i class='icon-puzzle-piece'></i> " . T("Plugins") . "</a>");
     $this->defaultMenu->highlight(ET::$controllerName);
     $this->menu->highlight(ET::$controllerName);
     // If new registrations require admin approval, add the 'unapproved' admin page with a count.
     if (C("esoTalk.registration.requireConfirmation") == "approval") {
         $count = ET::SQL()->select("COUNT(1)")->from("member")->where("confirmed", 0)->exec()->result();
         $this->menu->add("unapproved", "<a href='" . URL("admin/unapproved") . "'><i class='icon-lock'></i> " . T("Unapproved") . " <span class='badge'>" . $count . "</span></a>");
     }
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         $this->pushNavigation("admin", "administration", URL($this->selfURL));
     }
     $this->addJSFile("core/js/admin.js");
     $this->addCSSFile("core/skin/admin.css");
     $this->trigger("initAdmin", array($this->menu, $this->defaultMenu));
 }
 public function __construct()
 {
     $this->script_url = URL('file/photos/delete_image');
     $this->upload_dir = public_path() . '/uploads/images/';
     $this->upload_url = URL('/') . '/uploads/images/';
     $this->fileName = 'files';
 }
Example #3
0
function IAUTH_auth($appid, $uid, $rightStr, $state = '', $faile_t = '2036-12-31 23:59:59')
{
    Check($appid, 'appid');
    Check($uid, 'uid');
    if (intval($uid) <= 0) {
        showError('use manage function instead');
    }
    Check($faile_t, 'faile_t');
    $rights = Check($rightStr, 'rights');
    $appType = GetAppInfo($appid, 'app_type');
    IAUTH_remove_auth($uid, $appid);
    if ($appType == 'WSC') {
        Check($state, 'state');
        $callback = GetAppInfo($appid, 'call_back');
        $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t, '', '', $state);
        accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t . ' ' . $state);
        return URL($callback) . 'verifier=' . $verifier . '&state=' . $state;
    }
    if ($appType == 'UAC') {
        $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t);
        accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t);
        return $verifier;
    }
    throw new IAuthException('db error');
}
 public function CORSOptions()
 {
     $statusCode = 204;
     $origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : URL();
     $headers = ['Access-Control-Allow-Origin' => $origin, 'Access-Control-Allow-Methods' => 'GET, PUT, POST, DELETE, OPTIONS', 'Access-Control-Allow-Headers' => 'Origin, Content-Type, Accept, Authorization, X-Requested-With, X-Experience-API-Version, X-Experience-API-Consistent-Through, Updated', 'Access-Control-Allow-Credentials' => 'true'];
     return \Response::make(null, $statusCode, $headers);
 }
 public function index($pageSlug = false)
 {
     list($pageId, $slug) = explode('-', trim($pageSlug));
     if (!is_numeric($pageId)) {
         $this->redirect(URL(""));
     }
     $page = $this->model()->getById((int) $pageId);
     // Stop here with a 404 header if the page wasn't found.
     if (!$page) {
         $this->render404(T("message.pageNotFound"), true);
         return false;
     } elseif (!ET::$session->userId and $page['hideFromGuests']) {
         $this->render404(T("message.pageNotFound"), true);
         return false;
     }
     $this->title = $page["title"];
     if (strlen($page['content']) > 155) {
         $description = substr($page['content'], 0, 155) . " ...";
         $description = str_replace(array("\n\n", "\n"), " ", $description);
     } else {
         $description = $page["content"];
     }
     $this->addToHead("<meta name='description' content='" . sanitizeHTML($description) . "'>");
     $this->data("page", $page);
     $this->render($this->plugin()->getView("page"));
 }
 /**
  * Toggle the user's subscription to a channel.
  *
  * @param int $channelId The ID of the channel to toggle subscription to.
  * @return void
  */
 public function action_subscribe($channelId = "")
 {
     if (!ET::$session->user or !$this->validateToken()) {
         return;
     }
     // If we don't have permission to view this channel, don't proceed.
     if (!ET::channelModel()->hasPermission((int) $channelId, "view")) {
         return;
     }
     // Work out if we're already unsubscribed or not, and switch to the opposite of that.
     $channel = ET::SQL()->select("unsubscribed, lft, rgt")->from("channel c")->from("member_channel mc", "mc.channelId = c.channelId AND mc.memberId = :userId", "left")->bind(":userId", ET::$session->userId)->where("c.channelId", (int) $channelId)->exec()->firstRow();
     // Get all the child channels of this channel.
     $rows = ET::SQL()->select("channelId")->from("channel")->where("lft >= :lft")->bind(":lft", $channel["lft"])->where("rgt <= :rgt")->bind(":rgt", $channel["rgt"])->exec()->allRows();
     $channelIds = array();
     foreach ($rows as $row) {
         $channelIds[] = $row["channelId"];
     }
     // Write to the database.
     ET::channelModel()->setStatus($channelIds, ET::$session->userId, array("unsubscribed" => !$channel["unsubscribed"]));
     // Normally, redirect back to the channel list.
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         redirect(URL("channels"));
     }
     // Otherwise, set a JSON var.
     $this->json("unsubscribed", !$channel["unsubscribed"]);
     $this->render();
 }
Example #7
0
 /**
  * Construct and process the settings form for this skin, and return the path to the view that should be 
  * rendered.
  * 
  * @param ETController $sender The page controller.
  * @return string The path to the settings view to render.
  */
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins");
     $form->setValue("server", C("plugin.SMTP.server"));
     $form->setValue("username", C("plugin.SMTP.username"));
     $form->setValue("password", C("plugin.SMTP.password"));
     $form->setValue("port", C("plugin.SMTP.port"));
     $form->setValue("auth", C("plugin.SMTP.auth"));
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.SMTP.server"] = $form->getValue("server");
         $config["plugin.SMTP.username"] = $form->getValue("username");
         $config["plugin.SMTP.password"] = $form->getValue("password");
         $config["plugin.SMTP.port"] = $form->getValue("port");
         $config["plugin.SMTP.auth"] = $form->getValue("auth");
         if (!$form->errorCount()) {
             // Write the config file.
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("smtpSettingsForm", $form);
     return $this->getView("settings");
 }
Example #8
0
    /**
     *  09/29 v0.1 js 轉址
     *  透過Jbox丟出訊息並轉址
     *  //% 9/30 引入外部檔案的位置暫用絕對路徑,要找方法改為"參數式"或"相對路徑",盡量避免使用絕對路徑
     * 
     *	@param str message : 顯示的訊息
     *  @param str url : 跳轉位址
     *  @param str dir : 登入完成後跳轉位址
     */
    public static function redirect($message = null, $url = null, $dir = null)
    {
        if ($message == null) {
            $message = 'Error. Please retry!';
        }
        if ($url == null) {
            $url = URL('/');
        }
        //若有"登入完成跳轉位址"則接上URL
        if ($dir != null) {
            $url .= '?dir=' . Crypt::encrypt($dir);
        }
        $location = 'location.href = "' . $url . '"';
        //jbox
        $js = 'var myModal = new jBox(\'Modal\', {
					content: \'<h4>' . $message . '</h4>\',
					onCloseComplete : function(){
						' . $location . '
					},
		}).open();';
        $action = '';
        $action .= '<script type="text/javascript" src="http://cindy-lo.tk/js/jquery-1.11.2.min.js"></script>';
        $action .= '<script type="text/javascript" src="http://cindy-lo.tk/js/jbox/jbox.js"></script>';
        $action .= '<link rel="stylesheet" type="text/css" href="http://cindy-lo.tk/js/jbox/jbox.css">';
        $action .= '<div>' . header('Content-type: text/html; charset=UTF-8') . '<script>' . $js . '</script></div>';
        return $action;
    }
 public function getleftmenu()
 {
     if (IS_AJAX) {
         $gid = I('post.gid');
         $controllermod = DD('AdminAuthController');
         $controllerlist = $controllermod->selbygid($gid);
         $ctl_arr = array();
         foreach ($controllerlist as $key => $li) {
             $ctl_arr[$li['id']] = $li;
         }
         $actionmod = DD('AdminAuthAction');
         $actionlist = $actionmod->selbygid($gid, 1);
         $ac_arr = array();
         foreach ($actionlist as $key => $ac) {
             $ac['url'] = URL($ac['group'] . '/' . $ac['controller'] . '/' . $ac['action'], '', $ac['app']);
             $ac_arr[$ac['cid']][] = $ac;
         }
         $menu = array();
         foreach ($ctl_arr as $key => $ca) {
             $ca['child'] = $ac_arr[$key];
             $menu[] = $ca;
         }
         echo json_encode($menu);
     }
 }
 private function _chkauth()
 {
     if (!session('Dream_admin')) {
         redirect(URL('Auth/Login/Login', '', 'Admin.php'));
     }
     $this->LoginAdminInfo = session('Dream_admin');
     $this->assign('LoginAdminInfo', $this->LoginAdminInfo);
 }
 /**
  * Deny all members.
  *
  * @return void
  */
 public function action_denyAll()
 {
     if (!$this->validateToken()) {
         return;
     }
     ET::memberModel()->delete(array("confirmed" => 0));
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
 /**
  * Deny a member; delete their account.
  *
  * @param int $memberId The ID of the member to deny.
  * @return void
  */
 public function action_deny($memberId)
 {
     // Get this member's details. If it doesn't exist or is already approved, show an error.
     if (!($member = ET::memberModel()->getById((int) $memberId)) or $member["confirmed"]) {
         $this->redirect(URL("admin/unapproved"));
         return;
     }
     ET::memberModel()->deleteById($memberId);
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
Example #13
0
 public function handler_userController_initJoin($controller, $form)
 {
     $form->addSection("mscaptcha", T("Solve this"));
     $form->addField("mscaptcha", "mscaptcha", function ($form) {
         return "<div class=\"mscaptcha\"><img class=\"img-mscaptcha\" src=\"" . URL("mscaptcha") . "\" alt=\"MSCaptcha\"><i class=\"icon-spinner mscaptcha-loader\" style=\"display:none;\"> loading...</i><br /><a id=\"mscaptcha-refresh\" href=\"#\" class=\"button\"><i class=\"icon-refresh\"></i></a>" . $form->input("mscaptcha") . "</div>";
     }, function ($form, $key, &$data) {
         if (ET::$session->get('mscaptcha') != $form->getValue($key)) {
             ET::$session->store('inputmscaptha', $form->getValue($key));
             $form->error($key, T("Invalid!, You need calculator? :D"));
         }
     });
 }
Example #14
0
 public function Lang()
 {
     $slug = \Request::segment(1) == 'eng' || \Request::segment(1) == 'home' ? 'slug' : 'eng_slug';
     $slugFind = \Request::segment(1) == 'eng' || \Request::segment(1) == 'home' ? 'eng_slug' : 'slug';
     $url = str_replace(\URL(), '', \URL::previous());
     if ($url == '/eng') {
         return \Redirect('/');
     } else {
         $menu = Menu::where($slug, $url)->first();
         return $url == '/' ? \Redirect('/eng') : \Redirect(\URL($menu[$slugFind]));
     }
 }
 public function run()
 {
     $faker = Faker::create('zh_CN');
     $adminUser = User::where('name', '=', 'admin')->first();
     $adminUserId = isset($adminUser) ? $adminUser->id : 0;
     $publicPath = app('path.public');
     $dirPath = $publicPath . '/uploads/images/fakers';
     $urlDirPath = '/uploads/images/fakers';
     DB::table('pages')->delete();
     foreach (range(1, 100) as $index) {
         Page::create(['title' => 'znyesmaxfine单页' . $index, 'thumb' => URL($urlDirPath . '/' . $faker->image($dirPath, 640, 480, null, false)), 'slug' => '', 'content' => $faker->text, 'user_id' => $adminUserId, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
     }
 }
Example #16
0
 public function index()
 {
     $count = DB()->query("select count(*) as totalnum from articles;");
     $count = $count[0]['totalnum'];
     $page = new \Skschool\Page();
     $page->init($count, 5);
     $url = URL('/page-%5BPAGE%5D.html');
     $show = $page->show($url);
     $list = DB()->query("select * from articles order by id desc limit " . $page->firstRow . ',' . $page->listRows . ";");
     $this->assign('list', $list);
     $this->assign('page', $show);
     $this->display();
 }
 public function delete($pageId = "")
 {
     if (!$this->validateToken()) {
         return;
     }
     // Get this field's details. If it doesn't exist, show an error.
     if (!($page = $this->model()->getById((int) $pageId))) {
         $this->render404();
         return;
     }
     $this->model()->deleteById($page["pageId"]);
     $this->redirect(URL("admin/pages"));
 }
Example #18
0
 public function conversationController_status($sender, $conversationId)
 {
     if (!$sender->validateToken()) {
         return;
     }
     $conversation = ET::conversationModel()->getById((int) $conversationId);
     if (!$conversation || !$conversation["canModerate"]) {
         $sender->renderMessage(T("Error"), T("message.noPermission"));
         return false;
     }
     $model = ET::conversationModel();
     $model->updateById($conversationId, array("status" => $_GET["status"]));
     redirect(URL(R("return", conversationURL($conversationId))));
 }
 /**
  * Perform the upgrade process.
  *
  * @return void
  */
 public function action_index()
 {
     try {
         // Run the upgrade process.
         ET::upgradeModel()->upgrade(C("esoTalk.version"));
         // Update the version and serial in the config file.
         ET::writeConfig(array("esoTalk.version" => ESOTALK_VERSION));
         // Show a success message and redirect.
         $this->message(T("message.upgradeSuccessful"), "success");
         $this->redirect(URL(""));
     } catch (Exception $e) {
         $this->fatalError($e->getMessage());
     }
 }
Example #20
0
 /**
  * SWC側へのリンクurl取得
  * @param type $name
  * @return string
  */
 public static function getSwcUrl($name)
 {
     if ($name == 'login') {
         return SWC_MEMBERS_LOGIN;
     } else {
         if ($name == 'entry') {
             return SWC_MEMBERS_ENTRY;
         } else {
             if ($name == 'logout') {
                 return URL("user/logout?token=" . ET::$session->token);
             }
         }
     }
     return "";
 }
 /**
  * Show the administrator dashboard view.
  *
  * @return void
  */
 public function action_index()
 {
     $this->title = T("Dashboard");
     // Work out a UNIX timestamp of one week ago.
     $oneWeekAgo = time() - 60 * 60 * 24 * 7;
     // Create an array of statistics to show on the dashboard.
     $statistics = array("<a href='" . URL("members") . "'>" . T("Members") . "</a>" => number_format(ET::SQL()->select("COUNT(*)")->from("member")->exec()->result()), T("Conversations") => number_format(ET::SQL()->select("COUNT(*)")->from("conversation")->exec()->result()), T("Posts") => number_format(ET::SQL()->select("COUNT(*)")->from("post")->exec()->result()), T("New members in the past week") => number_format(ET::SQL()->select("COUNT(*)")->from("member")->where(":time<joinTime")->bind(":time", $oneWeekAgo)->exec()->result()), T("New conversations in the past week") => number_format(ET::SQL()->select("COUNT(*)")->from("conversation")->where(":time<startTime")->bind(":time", $oneWeekAgo)->exec()->result()), T("New posts in the past week") => number_format(ET::SQL()->select("COUNT(*)")->from("post")->where(":time<time")->bind(":time", $oneWeekAgo)->exec()->result()));
     // Determine if we should show the welcome sheet.
     if (!C("esoTalk.admin.welcomeShown")) {
         $this->data("showWelcomeSheet", true);
         ET::writeConfig(array("esoTalk.admin.welcomeShown" => true));
     }
     $this->data("statistics", $statistics);
     $this->render("admin/dashboard");
 }
Example #22
0
 public function handler_init($sender)
 {
     ET::$controller->addCSSFile($this->resource("pages.css"), true);
     $model = ET::getInstance("pagesModel");
     $pages = $model->get();
     if ($pages) {
         foreach ($pages as $page) {
             if (ET::$session->userId) {
                 $sender->addToMenu($page['menu'], $page['slug'] . '-page', '<a href="' . URL("pages") . '/' . $page['pageId'] . '-' . $page['slug'] . '">' . $page['title'] . '</a>');
             } elseif ($page['hideFromGuests'] == 0) {
                 $sender->addToMenu($page['menu'], $page['slug'] . '-page', '<a href="' . URL("pages") . '/' . $page['pageId'] . '-' . $page['slug'] . '">' . $page['title'] . '</a>');
             }
         }
     }
 }
Example #23
0
 public function action_conversationController_unanswer($sender, $conversationId)
 {
     $conversation = ET::conversationModel()->getById($conversationId);
     if (!$conversation or !$sender->validateToken()) {
         return;
     }
     // Stop here with an error if the user isn't allowed to mark the conversation as answered.
     if ($conversation["startMemberId"] != ET::$session->userId and !$conversation["canModerate"]) {
         $sender->renderMessage(T("Error"), T("message.noPermission"));
         return false;
     }
     $model = ET::conversationModel();
     $model->updateById($conversation["conversationId"], array("answered" => 0));
     redirect(URL(R("return", conversationURL($conversation["conversationId"], $conversation["title"]))));
 }
Example #24
0
 /**
  * Construct and process the settings form for this skin, and return the path to the view that should be 
  * rendered.
  * 
  * @param ETController $sender The page controller.
  * @return string The path to the settings view to render.
  */
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/appearance");
     $form->setValue("primaryColor", C("skin.Doragon.primaryColor"));
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         $this->writeColors($form->getValue("primaryColor"));
         $sender->message(T("message.changesSaved"), "success autoDismiss");
         $sender->redirect(URL("admin/appearance"));
     }
     $sender->data("skinSettingsForm", $form);
     $sender->addJSFile("core/js/lib/farbtastic.js");
     return $this->view("settings");
 }
 public function run()
 {
     $faker = Faker::create('zh_CN');
     $user = User::where('name', '=', 'user')->first();
     $userId = isset($user) ? $user->id : 0;
     $template = Template::first();
     $templateId = isset($template) ? $template->id : 0;
     $publicPath = app('path.public');
     $dirPath = $publicPath . '/uploads/images/fakers';
     $urlDirPath = '/uploads/images/fakers';
     $end_at = (new DateTime())->modify('+1 Year');
     DB::table('poster_themes')->delete();
     foreach (range(1, 3) as $index) {
         PosterTheme::create(['user_id' => $userId, 'template_id' => $templateId, 'site_url' => $faker->url, 'status' => 1, 'image100x450' => URL($urlDirPath . '/' . $faker->image($dirPath, 100, 450, null, false)), 'image1000x90' => URL($urlDirPath . '/' . $faker->image($dirPath, 1000, 90, null, false)), 'end_at' => $end_at, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
     }
 }
Example #26
0
 /**
  * Handle an incoming request.
  * 處理 request
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $dir = $this->dir($request);
     $myfunc = new MyFunc();
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             /**
              * 未登入狀態,處理轉址至登入頁,並帶入原來要進入的網址
              */
             return $myfunc->redirect('Please Login first!', URL('/user/login'), $dir);
         }
     }
     return $next($request);
 }
Example #27
0
 function get_nav($bid, $maxlevel, $effected_id = 'navlist', $style = 'filetree ', $homefont = '', $recursion = FALSE, $child = '', $enhomefont = '', $lang = '')
 {
     if ($enhomefont) {
         $indexen = '<em>' . $enhomefont . '</em>';
     }
     if ($homefont) {
         $homefont = '<li id="nav_0"><span class="fl_ico"></span><a href="' . URL() . '" title="' . L(HOME_FONT) . '"><span class="fl">' . L(HOME_FONT) . '</span>' . $indexen . '</a></li>';
     }
     $number = 1;
     if (!$child) {
         $child = $this->getchild($bid);
     }
     $total = count($child);
     $effected = $effected_id ? ' id="' . $effected_id . '_box"' : '';
     $class = $style ? ' class="' . $style . '"' : '';
     if (!$recursion) {
         $this->ret .= '<ul' . $effected . $class . '>' . $homefont;
     }
     foreach ($child as $id => $a) {
         @extract($a);
         if (!$this->level) {
             $this->level = $level ? $level + $maxlevel - 1 : $maxlevel;
         }
         $ischild = $this->getchild($id);
         $foldertype = $ischild ? 'folder' : 'file';
         $floder_status = ' id="' . $effected_id . '_' . $id . '"';
         $first = $number == 1 ? 'first ' : '';
         $floder_status .= $number == $total ? ' class="foot ' . $foldertype . '"' : ' class="' . $first . $foldertype . '"';
         $this->ret .= $recursion ? '<ul><li' . $floder_status . '>' : '<li' . $floder_status . '>';
         $recursion = FALSE;
         if ($enhomefont) {
             $enzm = $enname ? '<em>' . $enname . '</em>' : '<em>' . $catdir . '</em>';
         }
         if ($ischild && $level < $this->level) {
             $this->ret .= '<span class="fd_ico"></span><a href="' . $url . '" title="' . $catname . '"><span class="fd">' . $catname . '</span>' . $enzm . '</a>';
             $this->get_nav($id, $maxlevel, $effected_id, $style, '', TRUE, $ischild, $enhomefont, $lang);
         } else {
             $this->ret .= '<span class="fl_ico"></span><a href="' . $url . '" title="' . $catname . '"><span class="fl">' . $catname . '</span>' . $enzm . '</a>';
         }
         $this->ret .= $recursion ? '</li></ul>' : '</li>';
         $number++;
     }
     if (!$recursion) {
         $this->ret .= '</ul>';
     }
     return $this->ret;
 }
 /**
  * Uninstall a language by removing its directory.
  *
  * @param string $language The name of the language.
  * @return void
  */
 public function uninstall($language = "")
 {
     if (!$this->validateToken()) {
         return;
     }
     // Make sure the language exists.
     $languages = ET::getLanguages();
     if (!$language or !in_array($language, $languages)) {
         return;
     }
     // Attempt to remove the directory. If we couldn't, show a "not writable" message.
     if (!is_writable($file = PATH_LANGUAGES) or !is_writable($file = PATH_LANGUAGES . "/{$language}") or !rrmdir($file)) {
         $this->message(sprintf(T("message.notWritable"), $file), "warning");
     } else {
         $this->message(T("message.languageUninstalled"), "success");
     }
     $this->redirect(URL("admin/languages"));
 }
Example #29
0
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins/settings/Signature");
     // Set the values for the sitemap options.
     $form->setValue("characters", C("plugin.Signature.characters", "150"));
     // If the form was submitted...
     if ($form->validPostBack()) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.Signature.characters"] = $form->getValue("characters");
         // Write the config file.
         ET::writeConfig($config);
         $sender->redirect(URL("admin/plugins"));
     }
     $sender->data("SignatureSettingsForm", $form);
     return $this->view("settings");
 }
Example #30
0
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins/settings/GoogleAnalytics");
     $form->setValue("trackingId", C("GoogleAnalytics.trackingId"));
     // If the form was submitted...
     if ($form->validPostBack()) {
         // Construct an array of config options to write.
         $config = array();
         $config["GoogleAnalytics.trackingId"] = $form->getValue("trackingId");
         // Write the config file.
         ET::writeConfig($config);
         $sender->message(T("message.changesSaved"), "success autoDismiss");
         $sender->redirect(URL("admin/plugins"));
     }
     $sender->data("googleAnalyticsSettingsForm", $form);
     return $this->view("settings");
 }