Example #1
0
 public function display()
 {
     $template = new Template();
     $template->load("plugins");
     $plugins = new PluginList();
     $plugins->loadAll();
     foreach ($plugins->plugins as $plugin) {
         $index = $template->add_loop_item("PLUGINS");
         if (isset($_GET['activate']) && $_GET['activate'] == $plugin->path) {
             $plugin->activate();
         } elseif (isset($_GET['deactivate']) && $_GET['deactivate'] == $plugin->path) {
             $plugin->deactivate();
         }
         $template->assign_loop_var("PLUGINS", $index, "NAME", htmlentities($plugin->name));
         $template->assign_loop_var("PLUGINS", $index, "PATH", htmlentities($plugin->path));
         $template->assign_loop_var("PLUGINS", $index, "DESCRIPTION", htmlentities($plugin->getDescription()));
         $template->assign_loop_var("PLUGINS", $index, "VERSION", $plugin->version);
         $template->assign_loop_var("PLUGINS", $index, "AUTHORLINK", $plugin->authorLink);
         $template->assign_loop_var("PLUGINS", $index, "AUTHORNAME", htmlentities($plugin->authorName));
         $template->assign_loop_var("PLUGINS", $index, "LICENSE", htmlentities($plugin->license));
         $template->assign_loop_var("PLUGINS", $index, "LICENSEURL", htmlentities($plugin->licenseUrl));
         if ($plugin->isActivated()) {
             $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "deactivate=" . urlencode($plugin->path));
             $disable = Language::DirectTranslateHtml("DISABLE");
             $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $disable . "</a>");
         } else {
             $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "activate=" . urlencode($plugin->path));
             $enable = Language::DirectTranslateHtml("ENABLE");
             $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $enable . "</a>");
         }
     }
     $template->assign_var("HOST", Settings::getValue("host"));
     $template->assign_var("APIKEY", Settings::getValue("apikey"));
     $template->output();
 }
Example #2
0
 public function display()
 {
     $template = new Template();
     $template->load("plugin_contactform_contactform");
     $template->show_if('SHOWFORM', true);
     $template->show_if('SHOWMESSAGE', false);
     if (isset($_POST["contactformsubmit"]) && $_POST["url"] == "" && $_POST["inputspamcontrol"] == $_SESSION["plugin_contactform_result"]) {
         $settings = Settings::getRootInstance()->specify("plugin", "contactform");
         $plugin_contactform_receiver = $settings->get("contactform_mail");
         $plugin_contactform_sendername = $_POST['inputname'];
         $plugin_contactform_sendermail = $_POST['inputmail'];
         $plugin_contactform_text = $_POST['inputtext'];
         $plugin_contactform_subject = Language::DirectTranslate("plugin_contactform_pagetypetitle") . " " . Settings::getInstance()->get("title");
         mail($plugin_contactform_receiver, $plugin_contactform_subject, $plugin_contactform_text, "From: {$plugin_contactform_sendername} <{$plugin_contactform_sendermail}>");
         $_SESSION['plugin_contactform_result'] = "";
         $template->show_if('SHOWFORM', false);
         $template->show_if('SHOWMESSAGE', true);
         $template->assign_var("SUCCESSMESSAGE", $settings->get("contactform_successmessage"));
     }
     $plugin_contactform_numberone = rand(1, 10);
     $plugin_contactform_numbertwo = rand(1, 10);
     $_SESSION['plugin_contactform_result'] = $plugin_contactform_numberone + $plugin_contactform_numbertwo;
     $template->assign_var('FORMURL', UrlRewriting::GetUrlByAlias($this->page->alias));
     $template->assign_var('NUMBER1', $plugin_contactform_numberone);
     $template->assign_var('NUMBER2', $plugin_contactform_numbertwo);
     Cache::clear();
     echo $template->getCode();
 }
Example #3
0
 public function load()
 {
     $this->headline = Language::DirectTranslate("plugin_menulistwidget_menus");
     if (Cache::contains("menu", "widget_" . $_GET['dir'])) {
         $this->content = Cache::getData("menu", "widget_" . $_GET['dir']);
     } else {
         if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
             $_GET['dir'] = "";
         }
         $template = new Template();
         $template->load("plugin_menulistwidget_menulist");
         $newmenuurl = UrlRewriting::GetUrlByAlias("admin/newmenu");
         $template->assign_var("NEWMENUURL", $newmenuurl);
         $menus = sys::getMenues($_GET['dir']);
         foreach ($menus as $menu) {
             $index = $template->add_loop_item("MENUS");
             $template->assign_loop_var("MENUS", $index, "ID", $menu->id);
             $template->assign_loop_var("MENUS", $index, "TITLE", $menu->name);
             $template->assign_loop_var("MENUS", $index, "PAGES", $menu->count);
             $editurl = UrlRewriting::GetUrlByAlias("admin/editmenu", "menu=" . $menu->id);
             $template->assign_loop_var("MENUS", $index, "EDITURL", $editurl);
             $deleteurl = UrlRewriting::GetUrlByAlias("admin/deletemenu", "menu=" . $menu->id);
             $template->assign_loop_var("MENUS", $index, "DELETEURL", $deleteurl);
         }
         if (!$menus) {
             $template->assign_var("NOMENUS", Language::DirectTranslate("plugin_menulistwidget_no_menus"));
         } else {
             $template->assign_var("NOMENUS", "");
         }
         $this->content = $template->getCode();
         Cache::setData("menu", "widget_" . $_GET['dir'], $this->content);
     }
 }
Example #4
0
 /**
  *
  * @return string
  */
 public function getCode()
 {
     if (isset($_POST['save'])) {
         foreach ($_POST as $property => $value) {
             if ($property != "save" && $property != "roles") {
                 $settings = Settings::getRootInstance()->specify($this->areaType, $this->area);
                 if ($this->dir != "" && $this->dir != "/") {
                     $settings = $settings->dir($this->dir);
                 }
                 $settings->set($property, $value, $this->role);
             }
         }
         Settings::forceReload();
         Cache::clear();
         Language::GetGlobal()->ClearCache();
         if (@header("Location:" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']))) {
             exit;
         } else {
             die("<script>window.location.href = '" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']) . "';</script>");
         }
         $changed = true;
     }
     $template = new Template();
     $template->load($this->template);
     if ($this->area != "global" || $this->areaType != "global") {
         $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
     } else {
         $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
     }
     $roles = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}roles ORDER BY name");
     if ($roles) {
         foreach ($roles as $role) {
             if ($this->role == $role->id) {
                 $roleselector .= "<option value=\"" . $role->id . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>";
             } else {
                 $roleselector .= "<option value=\"" . $role->id . "\">" . $role->name . "</option>";
             }
         }
     }
     $roleselector .= "</select>";
     $template->assign_var("ROLES", $roleselector);
     if ($this->area != "global" || $this->areaType != "global") {
         $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=" . $this->role . "&save_settings=1");
     } else {
         $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "role=" . $this->role . "&save_settings=1");
     }
     $rows = Settings::getRootInstance()->specify($this->areaType, $this->area)->dir($this->dir)->getRows($this->role);
     if ($rows) {
         foreach ($rows as $row) {
             $index = $template->add_loop_item("SETTINGS");
             $template->assign_loop_var("SETTINGS", $index, "PROPERTY", $row['name']);
             $template->assign_loop_var("SETTINGS", $index, "DESCRIPTION", htmlentities($row['description']));
             $control = new $row['type']();
             $control->name = $row['name'];
             $control->value = $row['value'];
             $template->assign_loop_var("SETTINGS", $index, "CONTROL", $control->getCode());
         }
     }
     return $template->getCode();
 }
 public function display()
 {
     $language = new Language($_GET['language']);
     if (isset($_POST['translation'])) {
         $language->updateTranslation($_GET['token'], $_POST['translation']);
         Cache::clear("language");
     }
     $template = new Template();
     $template->load("translationtokeneditor");
     $template->assign_var("ORIGINAL", Language::DirectTranslate($_GET['token']));
     $template->assign_var("TRANSLATION", $language->getString($_GET['token']));
     $template->output();
 }
Example #6
0
 public function load()
 {
     $dir = '';
     if (isset($_GET['dir']) && substr($_GET['dir'], 0, 1) != '.') {
         $dir = $_GET['dir'];
     }
     $this->headline = Language::DirectTranslate("plugin_pagelistwidget_pages");
     if (Cache::contains("page", "widget_" . $dir)) {
         $this->content = Cache::getData("page", "widget_" . $dir);
     } else {
         $template = new Template();
         $template->load("plugin_pagelistwidget_pagelist");
         $pages = Page::getPagesByDir($dir);
         if (substr($dir, 0, 1) == "/") {
             $shortdir = substr($dir, 1);
         } else {
             $shortdir = $dir;
         }
         if ($pages) {
             foreach ($pages as $page) {
                 $shortalias = substr($page->alias, strlen($shortdir));
                 if (substr($shortalias, 0, 1) == "/") {
                     $shortalias = substr($shortalias, 1);
                 } else {
                     $shortalias = $shortalias;
                 }
                 if (!strpos($shortalias, "/")) {
                     $host = Settings::getInstance()->get("host");
                     $index = $template->add_loop_item("PAGES");
                     $template->assign_loop_var("PAGES", $index, "TITLE", $page->title);
                     $template->assign_loop_var("PAGES", $index, "ALIAS", $shortalias);
                     $editurl = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias);
                     $template->assign_loop_var("PAGES", $index, "EDITURL", $editurl);
                     $deleteurl = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . $page->alias);
                     $template->assign_loop_var("PAGES", $index, "DELETEURL", $deleteurl);
                     $showurl = UrlRewriting::GetUrlByAlias($page->alias);
                     $template->assign_loop_var("PAGES", $index, "SHOWURL", $showurl);
                 }
             }
             $template->assign_var("NOPAGES", "");
         } else {
             $template->assign_var("NOPAGES", Language::DirectTranslate("plugin_pagelistwidget_no_pages"));
         }
         $this->content = $template->getCode();
         if (isset($_GET['dir'])) {
             Cache::setData("page", "widget_" . $_GET['dir'], $this->content);
         }
     }
 }
Example #7
0
 public function display()
 {
     $rolelist = new Template();
     $rolelist->load("role_list");
     $actions = ActionList::get("rolelist");
     if (isset($_POST['insert'])) {
         $role = new Role();
         $role->name = $_POST['insert'];
         $role->insert();
     }
     if (isset($_GET['delete'])) {
         $role = new Role();
         $role->ID = $_GET['delete'];
         $role->delete();
     }
     $table = new Table();
     $id = new TableColumn("id", Language::DirectTranslate("ID"));
     $id->autoWidth = true;
     $name = new TableColumn("name", Language::DirectTranslate("NAME"));
     $table->columns->add($id);
     $table->columns->add($name);
     $table->name = "{'dbprefix'}roles";
     $table->actions = "rolelist";
     $table->orderBy = "name";
     $table->cacheName = "rolelist";
     $rolelist->assign_var("TABLE", $table->getCode());
     $rolelist->output();
 }
Example #8
0
 public function display()
 {
     $template = new Template();
     $template->load("plugin_changepassword_changepassword");
     $template->show_if('PASSWORD_WRONG', false);
     $template->show_if('SUCCESSFUL', false);
     $template->show_if('OLD_PASSWORD_WRONG', false);
     if (isset($_REQUEST['old_password']) && !empty($_REQUEST['old_password']) && is_string($_REQUEST['old_password']) && isset($_REQUEST['new_password']) && !empty($_REQUEST['new_password']) && is_string($_REQUEST['new_password']) && isset($_REQUEST['confirm_password']) && !empty($_REQUEST['confirm_password']) && is_string($_REQUEST['confirm_password'])) {
         $old_password = DataBase::Current()->EscapeString($_REQUEST['old_password']);
         $new_password = DataBase::Current()->EscapeString($_REQUEST['new_password']);
         $confirm_password = DataBase::Current()->EscapeString($_REQUEST['confirm_password']);
         if ($new_password != $confirm_password) {
             $template->show_if('PASSWORD_WRONG', true);
         } else {
             $password = DataBase::Current()->EscapeString(md5($new_password . Settings::getInstance()->get("salt")));
             $old_password = DataBase::Current()->EscapeString(md5($old_password . Settings::getInstance()->get("salt")));
             $db_password = DataBase::Current()->ReadField("SELECT `password` FROM `{'dbprefix'}user` WHERE `id` = '" . User::Current()->id . "'; ");
             if ($db_password && $db_password != null) {
                 if ($db_password != $old_password) {
                     $template->show_if('OLD_PASSWORD_WRONG', true);
                 } else {
                     DataBase::Current()->Execute("UPDATE `{'dbprefix'}user` SET `password` = '" . $password . "' WHERE `id` = '" . User::Current()->id . "'; ");
                     $template->show_if('SUCCESSFUL', true);
                     EventManager::raiseEvent("plugin_changepassword_change", array('old_password' => $old_password, 'new_password' => $password, 'userid' => User::Current()->id));
                     Cache::clear("tables", "userlist");
                 }
             } else {
                 //Der User ist nicht in der Datenbank aufgeführt.
             }
         }
     }
     $template->assign_var('ACTION', UrlRewriting::GetUrlByAlias($this->page->alias));
     echo $template->getCode();
 }
Example #9
0
 public function display()
 {
     $template = new Template();
     $template->load("message");
     if (ImageServer::insert($_POST['path'], $_POST['name'], $_POST['description'])) {
         $template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_ADDED"));
         $redirect = UrlRewriting::GetUrlByAlias("admin/home", "dir=" . urlencode($_SESSION['dir']));
         if (isset($_POST['referrer'])) {
             $redirect = $_POST['referrer'];
         }
         echo "<script type='text/javascript'>setTimeout('window.location.href= \\'" . $redirect . "\\'', 1000)</script>";
     } else {
         $template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_NOT_ADDED"));
     }
     $template->output();
 }
Example #10
0
 public function display()
 {
     $template = new Template();
     if (!isset($_GET['delete'])) {
         $template->load("menu_delete");
         $template->assign_var("CANCELURL", "javascript:history.back()");
         $template->assign_var("DELETEURL", $this->page->GetUrl("menu=" . urlencode($_GET['menu']) . "&delete=true"));
     } else {
         $template->load("message");
         if (Menu::delete(DataBase::Current()->EscapeString($_GET['menu']))) {
             $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_DELETED"));
         } else {
             $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_DELETED"));
         }
     }
     $template->output();
 }
Example #11
0
 /**
  *
  * @return string
  */
 public function getCode()
 {
     $template = new Template();
     $template->load("control_skinselector");
     $template->assign_var("NAME", $this->name);
     $template->assign_var("SELECTORNAME", $this->type);
     $template->assign_var("VALUE", $this->value);
     $template->assign_var("HOST", Settings::getValue("host"));
     $template->assign_var("CURRENTSKINNAME", SkinController::getSkinName($this->value));
     $i = 0;
     foreach (SkinController::getInstalledSkins() as $skin) {
         $index = $template->add_loop_item("SKINS");
         $template->assign_loop_var("SKINS", $index, "SELECTORNAME", $this->type);
         $template->assign_loop_var("SKINS", $index, "INDEX", $i);
         $template->assign_loop_var("SKINS", $index, "SKINID", $skin->id);
         $template->assign_loop_var("SKINS", $index, "SKINNAME", $skin->name);
         $i++;
     }
     return $template->getCode();
 }
Example #12
0
 public function display()
 {
     $template = new Template();
     $template->load("menu_new");
     $template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false);
     $template->show_if("SUCCEEDED", false);
     if ($_GET['blank'] == true) {
         $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu", "blank=true"));
     } else {
         $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu"));
     }
     if (isset($_POST['name'])) {
         $template->show_if("SUCCEEDED", true);
         $id = Menu::create($_POST['name'], $_SESSION['dir']);
         if (!$id) {
             $template->load("message");
             $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_CREATED"));
         }
     }
     $template->output();
 }
Example #13
0
 protected function upload()
 {
     $template = new Template();
     $template->load("upload");
     $template->assign_var("REFERRER", $_POST['referrer']);
     $template->show_if("SHOW_MEDIALIBARY", false);
     if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) {
         mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']);
     }
     if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) {
         $name = $_FILES['file']['name'];
         $template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED")));
         $path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
         if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) {
             $template->show_if("SHOW_MEDIALIBARY", true);
             $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage"));
             $template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
         }
     } else {
         if (FileServer::$uploadFailure != "") {
             $template->assign_var("MESSAGE", FileServer::$uploadFailure);
         } else {
             $template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED"));
         }
     }
     $template->output();
 }
Example #14
0
 public function display()
 {
     $template = new Template();
     $template->load("new_form");
     $template->show_if("SUCCEEDED", false);
     $template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false);
     if ($_GET['blank'] == true) {
         $url = UrlRewriting::GetUrlByAlias("admin/newform", "blank=true");
     } else {
         $url = UrlRewriting::GetUrlByAlias("admin/newform");
     }
     $template->assign_var("URL", $url);
     if (isset($_POST['name'])) {
         $template->show_if("SUCCEEDED");
         $id = Form::create($_POST['name'], $_SESSION['dir']);
         if (!$id) {
             $template->load("message");
             $template->assign_var("MESSAGE", $language->getString("FORM_NOT_CREATED"));
         }
     }
     $template->output();
 }
Example #15
0
 /**
  *
  * @param Actionlist $actions
  * @return string
  */
 public function getEditableCode(Actionlist $actions)
 {
     $template = new Template();
     $template->load("menuentry_editable");
     $template->assign_var("ID", $this->id);
     $template->assign_var("TITLE", $this->title);
     if ($this->type == 0) {
         $template->assign_var("SELECTEDINTERNAL", " selected=\"1\"");
         $selector = new PageSelector();
         $selector->name = $this->id . '_href';
         $selector->value = $this->href;
         $template->assign_var("VALUECONTROL", $selector->getCode());
         $template->assign_var("SELECTEDEXTERNAL", "");
         $template->assign_var("SELECTEDSUBMENU", "");
     } else {
         if ($this->type == 1) {
             $template->assign_var("SELECTEDEXTERNAL", " selected=\"1\"");
             $template->assign_var("SELECTEDINTERNAL", "");
             $template->assign_var("SELECTEDSUBMENU", "");
             $template->assign_var("VALUECONTROL", "<input name=\"" . $this->id . "_href\" value=\"" . $this->href . "\" />");
         } else {
             if ($this->type == 2) {
                 $template->assign_var("SELECTEDSUBMENU", " selected=\"1\"");
                 $template->assign_var("SELECTEDINTERNAL", "");
                 $template->assign_var("SELECTEDEXTERNAL", "");
                 $selector = new MenueSelector();
                 $selector->name = $this->id . '_href';
                 $selector->value = $this->href;
                 $template->assign_var("VALUECONTROL", $selector->getCode());
             }
         }
     }
     $params = array();
     $params['menu'] = $this->menu;
     $params['ID'] = $this->id;
     $template->assign_var("ACTIONS", $actions->getCode($params));
     return $template->getCode();
 }
Example #16
0
 public function load()
 {
     $this->headline = Language::DirectTranslate("plugin_formlistwidget_forms");
     if (isset($_POST['plugin_formlistwidget_deleteid'])) {
         $form = new Form($_POST['plugin_formlistwidget_deleteid']);
         $form->Delete();
     }
     $template = new Template();
     $template->load("plugin_formlistwidget_formlist");
     $forms = Form::getByDir($_GET['dir']);
     if ($forms) {
         foreach ($forms as $form) {
             $index = $template->add_loop_item("FORMS");
             $template->assign_loop_var("FORMS", $index, "NAME", $form->name);
             $template->assign_loop_var("FORMS", $index, "EDITURL", UrlRewriting::GetUrlByAlias("admin/formedit", "form=" . $form->id));
             $template->assign_loop_var("FORMS", $index, "ID", $form->id);
         }
         $template->assign_var("NOFORMS", "");
     } else {
         $template->assign_var("NOFORMS", Language::DirectTranslate("plugin_formlistwidget_no_forms"));
     }
     $this->content = $template->getCode();
 }
Example #17
0
 /**
  *
  * @return string
  */
 public function getEditableCode()
 {
     $template = new Template();
     $template->load("listpage");
     if ($list = unserialize($this->page->getEditorContent($this))) {
         $template->assign_var("SELECT", str_replace('\\\'', '\'', $list->fillSelect));
         $template->assign_var("TEMPLATE", $list->template);
     } else {
         $template->assign_var("SELECT", "");
         $template->assign_var("TEMPLATE", "");
     }
     $template->assign_var("HOST", Settings::getInstance()->get("host"));
     $template->assign_var("ALIAS", $this->page->alias);
     $url = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $this->page->alias);
     $template->assign_var("URL", $url);
     $template->assign_var("LANG", Settings::getInstance()->get("language"));
     return $template->getCode();
 }
Example #18
0
 /**
  *
  * @return string
  */
 public function getEditableCode()
 {
     $template = new Template();
     $template->load("control_wysiwyg");
     $template->assign_var("CONTENT", $this->page->getEditorContent($this));
     $template->assign_var("HOST", Settings::getInstance()->get("host"));
     $template->assign_var("ALIAS", $this->page->alias);
     $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $this->page->alias));
     $template->assign_var("LANG", strtolower(Settings::getInstance()->get("language")));
     $template->assign_var("PREVIEWURL", $this->page->GetUrl());
     return $template->getCode();
 }
Example #19
0
 public function display()
 {
     $userlist = new Template();
     $userlist->load("user_list");
     $userlist->assign_var("URL", $this->page->GetUrl());
     if (isset($_POST['insert'])) {
         $user = new User();
         $user->name = $_POST['name'];
         $user->role = $_POST['new_user_role'];
         $user->email = $_POST['email'];
         if (!$user->insert($_POST['password'])) {
             $userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_CREATED"));
         }
     }
     if (isset($_GET['delete'])) {
         $user = new User();
         $user->id = $_GET['delete'];
         if (!$user->delete()) {
             $userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_DELETED"));
         }
     }
     $userlist->assign_var("MSG", "");
     Cache::clear("tables", "userlist");
     $table = new Table();
     $id = new TableColumn("id", Language::DirectTranslate("ID"));
     $id->autoWidth = true;
     $name = new TableColumn("name", Language::DirectTranslate("NAME"));
     $role = new TableColumn("role", Language::DirectTranslate("ROLE"), "IFNULL((SELECT name FROM {'dbprefix'}roles WHERE id = {'dbprefix'}user.role),'')");
     $email = new TableColumn("email", Language::DirectTranslate("EMAIL"));
     $created = new TableColumn("create_timestamp", Language::DirectTranslate("CREATED_ON"));
     $created->autoWidth = true;
     $access = new TableColumn("last_access_timestamp", Language::DirectTranslate("LAST_ACCESS"));
     $access->autoWidth = true;
     $table->columns->add($id);
     $table->columns->add($name);
     $table->columns->add($role);
     $table->columns->add($email);
     $table->columns->add($created);
     $table->columns->add($access);
     $table->name = "{'dbprefix'}user";
     $table->actions = "userlist";
     $table->orderBy = "name";
     $table->cacheName = "userlist";
     $userlist->assign_var("TABLE", $table->getCode());
     $roles = new RoleSelector();
     $roles->hideSpecialRoles = true;
     $roles->name = "new_user_role";
     $userlist->assign_var("ROLES", $roles->getCode());
     $userlist->output();
 }
Example #20
0
 /**
  *
  * @return string 
  */
 public function getCode()
 {
     $outerTemplate = new Template();
     $outerTemplate->load("list");
     $outerTemplate->assign_var("NAME", $this->name);
     $outerTemplate->assign_var("STYLE", $this->getListStyle());
     if ($rows = DataBase::Current()->ReadRows($this->fillSelect)) {
         foreach ($rows as $row) {
             $index = $outerTemplate->add_loop_item("ITEMS");
             $innerTemplate = new Template();
             $innerTemplate->load($this->template);
             $vars = get_object_vars($row);
             foreach ($vars as $key => $value) {
                 $innerTemplate->assign_var(strtoupper($key), $value);
             }
             $outerTemplate->assign_loop_var("ITEMS", $index, "ITEM", $innerTemplate->getCode($this->escape));
         }
     }
     $res = $outerTemplate->getCode();
     return $res;
 }
Example #21
0
 /**
  *
  * @return string
  */
 public function getCode()
 {
     $template = new Template();
     $template->load("widget_" . $this->displayType);
     $template->assign_var("HEADLINE", $this->headline);
     $template->assign_var("CONTENT", $this->content);
     $template->assign_var("MINWIDTH", $this->minwidth);
     $template->show_if("HASMINWIDTH", $this->minwidth != -1);
     $template->assign_var("MAXWIDTH", $this->maxwidth);
     $template->show_if("HASMAXWIDTH", $this->maxwidth != -1);
     $template->assign_var("MINHEIGHT", $this->minheight);
     $template->show_if("HASMINHEIGHT", $this->minheight != -1);
     $template->assign_var("MAXHEIGHT", $this->maxheight);
     $template->show_if("HASMAXHEIGHT", $this->maxheight != -1);
     return $template->getCode();
 }
Example #22
0
 public function display()
 {
     $page = new Page();
     $page->loadProperties(DataBase::Current()->EscapeString($_GET['site']));
     $host = Settings::getInstance()->get("host");
     if (!isset($_GET['delete'])) {
         $template = new Template();
         $template->load("site_delete");
         $template->assign_var("TITLE", $page->title);
         $home = UrlRewriting::GetUrlByAlias("admin/home");
         $template->assign_var("SITESURL", $home);
         $delete = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . urlencode($_GET['site']) . "&delete=true");
         $template->assign_var("DELETEURL", $delete);
         $template->output();
     } else {
         if ($page->delete()) {
             $template = new Template();
             $template->load("message");
             $message = str_ireplace("{VAR:TITLE}", $page->title, Language::GetGlobal()->getString("PAGE_DELETED"));
             $template->assign_var("MESSAGE", $message);
             $template->output();
         }
     }
 }
Example #23
0
<?php

// deuxième page
include 'include_dao.php';
session_start();
// on precise le repertoire où se trouve les fichiers templates et le répértoire où on met les fichiers compilés (cache)
$template = new Template('template', 'cache');
// on precise la variable langage
$template->set_language_var($lang);
page_header('Supprimer une note', 'Supprimer une note', 'SUPPRIMERNOTE');
page_footer();
$template->set_filenames(array('body' => 'supprimernote.html'));
$submit = isset($_POST['submit']);
$id = $_GET['idLigne'];
$template->assign_var('IDLIGNE', $id);
if ($submit) {
    $frais = new LignefraisMySqlDAO();
    $fraisQuery = $frais->delete($id);
    header('Location: gererbordereau.php');
}
$template->display('body');
Example #24
0
$template = new Template('data/templates/' . $utilisateur->template());
$template->set_filenames(array('root' => 'root.tpl', 'index' => 'index.tpl', 'projet' => 'projet.tpl', 'edit_projet' => 'edit_projet.tpl', 'liste_projets' => 'liste_projets.tpl', 'demande' => 'demande.tpl', 'edit_demande' => 'edit_demande.tpl', 'liste_demandes' => 'liste_demandes.tpl', 'versions' => 'versions.tpl', 'connexion' => 'connexion.tpl', 'deconnexion' => 'deconnexion.tpl', 'perso' => 'perso.tpl', 'admin' => 'admin.tpl', 'edit_user' => 'edit_user.tpl'));
$template->set_rootdir('inc');
$template->set_filenames(array('rss' => 'rss.tpl'));
// Fonction d'erreur utilisant le template
$erreur = false;
function erreur_fatale($msg)
{
    global $template;
    $template->assign_block_vars('MSG_ERREUR', array('DESCR' => $msg));
    header('Content-type: text/html; charset=utf-8');
    $template->pparse('root');
    exit(0);
}
// Variables globales, ie communes à tous les modules
$template->assign_var('TITRE', $conf['titre']);
$template->assign_var('TEMPLATE_URL', 'data/templates/' . $utilisateur->template());
// Menu
$template->assign_block_vars('MENU', array('LIEN' => 'index.php', 'TEXTE' => 'Accueil'));
$template->assign_block_vars('MENU', array('LIEN' => 'index.php?mod=liste_projets', 'TEXTE' => 'Projets'));
// Connexion
if ($utilisateur->estAnonyme()) {
    $template->assign_block_vars('MENU2_CONN', array());
} else {
    $template->assign_block_vars('MENU2_DECO', array('PSEUDO' => $utilisateur->pseudo()));
}
// Page d'administration
if ($utilisateur->autorise(PERM_MANAGE_USERS) || $utilisateur->autorise(PERM_MANAGE_PROJECT)) {
    $template->assign_block_vars('LIEN_ADMIN', array());
}
if (in_array($mod, array('index', 'projet', 'liste_projets', 'edit_projet', 'versions', 'demande', 'liste_demandes', 'edit_demande', 'connexion', 'deconnexion', 'perso', 'admin', 'edit_user'))) {
 /**
  * Get the form for comment
  *
  *
  * @param unknown $idEvenement
  * @param unknown $fields
  * @param string $ty : type of comment
  * @return string
  */
 public function getFormComment($idEvenement, $fields, $ty = '')
 {
     $t = new Template('modules/archi/templates/');
     $labelButton = "Ajouter un commentaire";
     $type = $ty == '' ? 0 : $ty;
     $classButton = 'addCommentButtonWrapper';
     $auth = new ArchiAuthentification();
     if ($auth->estConnecte()) {
         $t->set_filenames(array('formComment' => 'comment/comment.tpl'));
         $url = "";
         $userId = $auth->getIdUtilisateur();
         $utilisateur = new archiUtilisateur();
         $utilisateur->setUserId($userId);
         $nom = $utilisateur->getNom();
         $prenom = $utilisateur->getPrenom();
         $email = $utilisateur->getEmail();
         $urlProfilePic = $utilisateur->getImageAvatar(array('idUtilisateur' => $userId));
         $profileAlt = $prenom . " " . $nom;
         if ($ty == '') {
             $array_type = array();
             $url = $this->creerUrl('enregistreCommentaire', '', array());
             $labelButton .= " sur l'adresse";
             $classButton .= " addCommentAdresseButtonWrapper";
         } else {
             $array_type = array('type' => array('id' => 'type', 'type' => 'hidden', 'value' => $type));
             $url = $this->creerUrl('enregistreCommentaireEvenement', '', array());
         }
         $inputs = array('nom' => array('id' => 'nom', 'type' => 'hidden', 'value' => $nom), 'prenom' => array('id' => 'prenom', 'type' => 'hidden', 'value' => $prenom), 'email' => array('id' => 'email', 'type' => 'hidden', 'value' => $email), 'idEvenementGroupeAdresse' => array('id' => 'idEvenementGroupeAdresse', 'type' => 'hidden', 'value' => $idEvenement));
         $inputs = array_merge($inputs, $array_type);
         foreach ($inputs as $input) {
             $t->assign_block_vars('input', $input);
         }
         $t->assign_vars(array('urlRedirect' => $url, 'name' => 'formAjoutCommentaire', 'urlProfilePic' => $urlProfilePic, 'profileAlt' => $profileAlt, 'labelButton' => $labelButton, 'classButton' => $classButton, 'idEvenement' => $idEvenement));
     } else {
         $t->set_filenames(array('formComment' => 'comment/notconnected.tpl'));
         $urlConnexion = $this->creerUrl('', 'authentification');
         $urlInscription = $this->creerUrl('', 'inscription');
         if ($ty == '') {
             $labelButton .= " sur l'adresse";
             $classButton .= " addCommentAdresseButtonWrapper";
         }
         $t->assign_vars(array('urlInscription' => $urlInscription, 'urlConnexion' => $urlConnexion, 'labelButton' => $labelButton, 'classButton' => $classButton, 'idEvenement' => $idEvenement));
     }
     //Setting CSS class for opening the form
     if (isset($this->variablesGet['commentFormActive']) && $this->variablesGet['commentFormActive']) {
         if ($this->variablesGet['commentFormActive'] == $idEvenement) {
             $t->assign_var('classWrappingDiv', 'active');
         }
     }
     ob_start();
     $t->pparse('formComment');
     $html .= ob_get_contents();
     ob_end_clean();
     return $html;
 }
Example #26
0
<?php

// deuxième page
include 'include_dao.php';
session_start();
// on precise le repertoire où se trouve les fichiers templates et le répértoire où on met les fichiers compilés (cache)
$template = new Template('template', 'cache');
$template->assign_var('LOG', FALSE);
// on precise la variable langage
$template->set_language_var($lang);
page_header('Déconnection', 'Déconnection', 'DECONNECTION');
page_footer();
$submit = isset($_POST['submit']);
if ($submit) {
    session_start();
    session_unset();
    session_destroy();
    header('Location: index.php');
}
if (isset($_SESSION['Nom'])) {
    $template->assign_var('LOG', TRUE);
    $template->assign_var('MESSAGE', "Vous allez être déconnecté, confirmer ?<br /><br />");
} else {
    $template->assign_var('MESSAGE', "Vous n'êtes pas connecté !<br /><br />");
}
$template->set_filenames(array('body' => 'deconnection.html'));
$template->display('body');
Example #27
0
<?php

// deuxième page
include 'include_dao.php';
session_start();
// on precise le repertoire où se trouve les fichiers templates et le répértoire où on met les fichiers compilés (cache)
$template = new Template('template', 'cache');
$template->assign_var('LOG', FALSE);
$template->assign_var('ONUPDATE', FALSE);
$template->assign_var('UPDATESUCCES', FALSE);
$template->assign_var('UPDATEFAIL', FALSE);
// on precise la variable langage
$template->set_language_var($lang);
page_header('Mon profil', 'Mon profil', 'PROFIL');
page_footer();
$template->set_filenames(array('body' => 'profil.html'));
$submitRequest = isset($_POST['request']);
$submit = isset($_POST['submit']);
if ($submit) {
    $nom = $_POST['nom'];
    $prenom = $_POST['prenom'];
    $sexe = $_POST['sexe'];
    $date = $_POST['ddn'];
    $type = $_POST['type'];
    $adresse = $_POST['adresse'];
    $cp = $_POST['cp'];
    $ville = $_POST['ville'];
    $nmdp = $_POST['npwd'];
    $mdp = $_POST['pwd'];
    $demandeur = new DemandeurMySqlDAO();
    $demandeurQuery = $demandeur->queryByNom($nom);
Example #28
0
<?php

// deuxième page
include 'include_dao.php';
session_start();
// on precise le repertoire ou se trouve les fichiers templates et le répèrtoire ou on met les fichiers compilés (cache)
$template = new Template('template', 'cache');
$template->assign_var('LOG', FALSE);
$template->assign_var('LICENCE', FALSE);
// on precise la variable langage
$template->set_language_var($lang);
page_header('Gérer mes licences', 'Gérer mes licences', 'GERERLICENCES');
page_footer();
$template->set_filenames(array('body' => 'gererlicence.html'));
$adherents = new AdherentMySqlDAO();
if (isset($_SESSION['Nom'])) {
    $template->assign_var('LOG', TRUE);
    $adherentsQuery = $adherents->queryByIdDemandeur($_SESSION['idDemandeur']);
    if (is_null($adherentsQuery) == false) {
        $template->assign_var('LICENCE', TRUE);
        $clubs = new ClubMySqlDAO();
        $clubQuery = $clubs->queryAll();
        $ligue = new LigueMySqlDAO();
        $ligueQuery = $ligue->queryAll();
        foreach ($adherentsQuery as $key => $value) {
            $template->assign_block_vars('adherents', array('ID' => $value->idAdherent, 'NOM' => $value->nom, 'PRENOM' => $value->prenom, 'CLUB' => $clubQuery[$value->idCLub - 1]->nom, 'LIGUE' => $ligueQuery[$clubQuery[$value->idCLub - 1]->idLigue - 1]->libelle, 'NUMLICENCE' => $value->numLicence, 'ID' => $value->idAdherent));
        }
    } else {
        $template->assign_var('MESSAGE', "Aucune licence enregistrée, veuillez vous rendre <a href='ajouterlicence.php'>ici</a> afin d'en ajouter une.");
    }
} else {
Example #29
0
<?php

// deuxième page
include 'include_dao.php';
session_start();
// on precise le repertoire où se trouve les fichiers templates et le répértoire où on met les fichiers compilés (cache)
$template = new Template('template', 'cache');
$template->assign_var('UPDATESUCCES', FALSE);
// on precise la variable langage
$template->set_language_var($lang);
page_header('Modifier une note', 'Modifier une note', 'MODIFIERNOTE');
page_footer();
$template->set_filenames(array('body' => 'modifiernote.html'));
$submit = isset($_POST['submit']);
$id = $_GET['idLigne'];
$template->assign_var('IDLIGNE', $id);
if ($submit) {
    $date = $_POST['date'];
    $annee = $_POST['annee'];
    $motif = $_POST['idmotif'];
    $trajet = $_POST['trajet'];
    $kms = $_POST['kms'];
    $cpeages = $_POST['cpeages'];
    $crepas = $_POST['crepas'];
    $chebergement = $_POST['chebergement'];
    $indemnites = new IndemniteMySqlDAO();
    $indemniteQuery = $indemnites->queryByAnnee($annee);
    $ligne = new LignefraisMySqlDAO();
    $FraisInsert = new Lignefrai();
    $FraisInsert->idLigne = $id;
    $FraisInsert->date = $date;
Example #30
0
        Authentication::suspendUser($_POST['user']);
        $successAlert = 1;
    }
    // Deal with unban form
    if ($_GET['action'] == 'unban' && isset($_POST['unbanID'])) {
        Authentication::reinstateUser($_POST['unbanID']);
        $successAlert = 1;
    }
    if ($_GET['action'] == 'deactivate' && isset($_POST['uid'])) {
        Authentication::deactivateUser($_POST['uid']);
        $successAlert = 1;
    }
}
$sqlSuspend = "SELECT * FROM `users` WHERE `suspended` = '0'";
$resultSuspend = openRailwayCore::dbQuery($sqlSuspend);
$sqlReinstate = "SELECT * FROM `users` WHERE `suspended` = '1'";
$resultReinstate = openRailwayCore::dbQuery($sqlReinstate);
$main = new Template();
$main->set_custom_template("includes/", 'default');
$main->assign_var('ROOT', ROOT);
while ($accountSuspend = mysql_fetch_assoc($resultSuspend)) {
    $main->assign_block_vars('user_loop', array('UID' => $accountSuspend['user_id'], 'NAME' => $accountSuspend['username'], 'SID' => $accountSuspend['staff_id']));
}
while ($accountReinstate = mysql_fetch_assoc($resultReinstate)) {
    $main->assign_block_vars('user_sus_loop', array('UID' => $accountReinstate['user_id'], 'NAME' => $accountReinstate['username'], 'SID' => $accountReinstate['staff_id']));
}
if (mysql_num_rows($resultReinstate) == 0) {
    $main->assign_block_vars('if_no_results', array());
}
$main->set_filenames(array('main' => "usr_ban.html"));
$main->display('main');