public function edit($id) { self::auth(); $user = WY_Db::row('SELECT * FROM `wy_users` WHERE `user_id` = :id', array(':id' => (int) $id)); if (!$user) { $view = new WY_View('404'); $view->render(); exit; } if (WY_Request::isPost()) { $username = $_POST['username']; $email = $_POST['email']; $display = $_POST['display']; $url = $_POST['url']; $level = $_POST['level']; if (isset($_POST['password']) && $_POST['password'] === "") { $sql = "UPDATE `wy_users` SET `username`=:username,`email`=:email,`display_name`=:display,`url`=:url,`status`=:level WHERE `user_id`=:id"; WY_Db::execute($sql, array(':username' => $username, ':email' => $email, ':display' => $display, ':url' => $url, ':level' => $level, ':id' => (int) $id)); } else { $password = $_POST['password']; $sql = "UPDATE `wy_users` SET `username`=:username,`pass`=:password,`email`=:email,`display_name`=:display,`url`=:url,`status`=:level WHERE `user_id`=:id"; WY_Db::execute($sql, array(':username' => $username, ':password' => sha1($password . WY_Config::get('salt')), ':email' => $email, ':display' => $display, ':url' => $url, ':level' => $level, ':id' => (int) $id)); } WY_Response::redirect('admin/users/all'); } $this->layout->pageTitle = 'Wayang CMS - Edit User'; $this->layout->content = WY_View::fetch('admin/users/edit', array('user' => $user)); }
public function edit($id) { self::auth(); $page = WY_Db::row('SELECT * FROM wy_pages WHERE page_id = :id', array(':id' => (int) $id)); if (!$page) { $view = new WY_View('404'); $view->render(); exit; } $isParent = WY_Db::all('SELECT * FROM wy_pages WHERE is_parent = 0 AND page_id <> :id', array(':id' => (int) $id)); $plugins = WY_Db::all("SELECT * FROM `wy_plugins` WHERE `is_active` = 1 ORDER BY plugin_name ASC"); if (WY_Request::isPost()) { $title = $_POST['title']; if (isset($_POST['published'])) { $published = 1; } else { $published = 0; } if (isset($_POST['a_comment'])) { $comment = 1; } else { $comment = 0; } $isParent = $_POST['isParent']; $content = $_POST['content']; $tags = $_POST['tags']; $permalink = strtolower(str_replace(' ', '-', $title)); WY_Db::execute('UPDATE wy_pages SET title = :title, date_modified = NOW(), content = :content, published = :published, is_parent= :is_parent, permalink = :permalink, comment_open = :comment_open, tag = :taglist WHERE page_id = :id', array(':title' => $title, ':published' => $published, ':content' => $content, ':is_parent' => $isParent, ':comment_open' => $comment, ':permalink' => $permalink, ':taglist' => $tags, ':id' => (int) $id)); WY_Response::redirect('admin/pages/all'); } $this->layout->pageTitle = 'Wayang CMS - Pages Edit'; $this->layout->content = WY_View::fetch('admin/pages/edit', array('page' => $page, 'isParent' => $isParent, 'plugins' => $plugins)); }
public function all() { self::auth(); $plugins = WY_Db::all('SELECT * FROM `wy_plugins` ORDER BY `is_active` DESC'); $this->layout->pageTitle = 'Wayang CMS - Plugins'; $this->layout->content = WY_View::fetch('admin/plugins/all', array('plugins' => $plugins)); }
public function index() { $this->menu(); $this->sidebar(); $posts = WY_Db::all('select * from wy_posts WHERE published=1 order by date_add'); $this->layout->content = WY_View::fetch('themes/default/index', array('posts' => $posts)); $this->layout->pageTitle = 'Wayang - Home'; }
public function index($permalink) { $this->menu(); $this->sidebar(); $cats = WY_Db::row("select * from wy_categories WHERE permalink=:permalink", array("permalink" => $permalink)); $posts = WY_Db::all("select * from wy_posts WHERE published=1 AND cat_id=:cat_id order by date_add", array("cat_id" => $cats->cat_id)); $this->layout->content = WY_View::fetch('themes/default/label', array('posts' => $posts, 'cats' => $cats)); $this->layout->pageTitle = 'Wayang - Search '; }
public function index($permalink) { $this->menu(); $this->sidebar(); $post = WY_Db::row("select * from wy_posts where permalink = :permalink", array(':permalink' => $permalink)); $comment = WY_Db::all("SELECT name,date_format(date,'%b %d %Y %h:%i %p') as date,content from wy_comments WHERE post_id =:id", array(':id' => $post->post_id)); $this->layout->content = WY_View::fetch('themes/default/post', array('post' => $post, 'comment' => $comment)); $this->layout->pageTitle = 'Wayang - ' . $post->title; }
public function index() { self::auth(); $pages = WY_Db::row("SELECT COUNT(*) as num FROM wy_pages"); $posts = WY_Db::row("SELECT COUNT(*) as num FROM wy_posts"); $comments = WY_Db::row("SELECT COUNT(*) as num FROM wy_comments"); $users = WY_Db::row("SELECT COUNT(*) as num FROM wy_users"); $this->layout->pageTitle = 'Wayang CMS - Dashboard'; $this->layout->content = WY_View::fetch('admin/home/statistic', array("pages" => $pages, "posts" => $posts, "comments" => $comments, "users" => $users)); }
public function edit($id) { self::auth(); $category = WY_Db::row('SELECT * FROM wy_categories WHERE cat_id = :id', array(':id' => (int) $id)); if (!$category) { $view = new WY_View('404'); $view->render(); exit; } if (WY_Request::isPost()) { $title = $_POST['title']; $published = $_POST['published']; $permalink = strtolower(str_replace(' ', '-', $title)); WY_Db::execute('UPDATE wy_categories SET title = :title, date_modified = NOW(), published = :published, permalink = :permalink WHERE cat_id = :id', array(':title' => $title, ':published' => $published, ':permalink' => $permalink, ':id' => (int) $id)); WY_Response::redirect('admin/categories/all'); } $this->layout->pageTitle = 'Wayang CMS - Edit Category'; $this->layout->content = WY_View::fetch('admin/categories/edit', array('category' => $category)); }
public function edit($id) { self::auth(); $comment = WY_Db::row('SELECT * FROM wy_comments WHERE c_id = :id', array(':id' => (int) $id)); if (!$comment) { $view = new WY_View('404'); $view->render(); exit; } if (WY_Request::isPost()) { $name = $_POST['name']; $email = $_POST['email']; $url = $_POST['url']; $content = $_POST['content']; WY_Db::execute('UPDATE `wy_comments` SET `name`=:name,`email`=:email,`url`=:url,`content`=:content WHERE `c_id` = :id', array(':name' => $name, ':email' => $email, ':url' => $url, ':content' => $content, ':id' => (int) $id)); WY_Response::redirect('admin/comments/all'); } $this->layout->pageTitle = 'Wayang CMS - Edit Comment'; $this->layout->content = WY_View::fetch('admin/comments/edit', array('comment' => $comment)); }
public function index($permalink) { $this->menu(); $this->sidebar(); $page = WY_Db::row("select * from wy_pages where permalink = :permalink", array(':permalink' => $permalink)); if ($page->use_plugin == 0) { $this->layout->content = WY_View::fetch('themes/default/page', array('page' => $page)); $this->layout->pageTitle = 'Wayang - ' . $page->title; } else { $plug = WY_Db::row("select * from wy_plugins where plugin_id = :id", array(':id' => $page->use_plugin)); $this->layout->content = WY_View::fetch('plugins/' . $plug->plugin_path . '/index', array('page' => $page, 'plugin' => $plug)); $this->layout->pageTitle = 'Wayang - ' . $plug->plugin_name; } }
public function edit($id) { self::auth(); $post = WY_Db::row('SELECT * FROM wy_posts WHERE post_id = :id', array(':id' => (int) $id)); if (!$post) { $view = new WY_View('404'); $view->render(); exit; } $cat = WY_Db::all('SELECT * FROM wy_categories'); if (WY_Request::isPost()) { $title = $_POST['title']; if (isset($_POST['published'])) { $published = 1; } else { $published = 0; } if (isset($_POST['a_comment'])) { $comment = 1; } else { $comment = 0; } if ($_POST['permalink'] === "") { $permalink = strtolower(str_replace(' ', '-', $_POST['title'])); } else { $permalink = strtolower(str_replace(' ', '-', $_POST['permalink'])); } $content = $_POST['content']; $tags = $_POST['tags']; $cat_id = $_POST['category']; WY_Db::execute('UPDATE `wy_posts` SET' . '`cat_id` = :cat_id, `title` = :title, `tag` = :tag, `content` = :content, `comment_open` = :comment_open, `permalink` = :permalink, `published` = :published, `date_modified` = NOW() WHERE post_id = :id', array(':cat_id' => $cat_id, ':title' => $title, ':tag' => $tags, ':content' => $content, ':comment_open' => $comment, ':permalink' => $permalink, ':published' => $published, ':id' => (int) $id)); WY_Response::redirect('admin/posts/all'); } $this->layout->pageTitle = 'Wayang CMS - Pages Edit'; $this->layout->content = WY_View::fetch('admin/posts/edit', array('post' => $post, 'cat' => $cat)); }
public function result() { $this->layout->content = WY_View::fetch('install/result'); $this->layout->pageTitle = 'Wayang - Initial Installation'; }
public function all() { self::auth(); $this->layout->pageTitle = 'Wayang CMS - Preferences'; $this->layout->content = WY_View::fetch('admin/sites/prefs'); }
public function newpwd($activation) { $this->layout->pageTitle = 'Wayang CMS - Reset Password'; $this->layout->content = WY_View::fetch('admin/login/new'); }
public function all() { self::auth(); $this->layout->pageTitle = 'Wayang CMS - Themes'; $this->layout->content = WY_View::fetch('admin/themes/all'); }
public function view($id) { //for ajax $this->layout->content = WY_View::fetch('themes/default/comment'); }