public function all() { self::auth(); $categories = WY_Db::all('SELECT * FROM wy_categories ORDER BY cat_id ASC'); $this->layout->pageTitle = 'Wayang CMS - Categories'; $this->layout->content = WY_View::fetch('admin/categories/all', array('categories' => $categories)); }
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(); $user = WY_Db::all('SELECT * FROM `wy_users`'); $this->layout->pageTitle = 'Wayang CMS - Users'; $this->layout->content = WY_View::fetch('admin/users/all', array('user' => $user)); }
public function all() { self::auth(); $comment = WY_Db::all('SELECT wyc.*,wyps.title as ps_title,wypg.title as pg_title FROM wy_comments wyc LEFT JOIN wy_pages wypg ON wypg.page_id=wyc.page_id LEFT JOIN wy_posts wyps ON wyps.post_id=wyc.post_id Order By wyc.c_id ASC'); $this->layout->pageTitle = 'Wayang CMS - Comments'; $this->layout->content = WY_View::fetch('admin/comments/all', array('comment' => $comment)); }
public function sidebar() { $recents = WY_Db::all('select * from wy_posts WHERE published=1 order by date_add'); $lists = WY_Db::all('select * from wy_categories WHERE published=1 order by date_add'); //$labels = WY_Db::all(''); $this->layout->sidebar = WY_View::fetch('themes/default/sidebar', array('recents' => $recents, 'lists' => $lists)); }
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 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)); }