예제 #1
0
 public function add()
 {
     self::auth();
     if (WY_Request::isPost()) {
         $author = WY_Session::get('display');
         $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('INSERT INTO `wy_posts`' . '(`cat_id`, `title`, `tag`, `date_add`, `author`, `content`, `comment_open`, `permalink`, `published`) ' . 'VALUES ' . '(:cat_id,:title,:tag,NOW(),:author,:content,:comment_open,:permalink,:published)', array(':cat_id' => $cat_id, ':title' => $title, ':tag' => $tags, ':author' => $author, ':content' => $content, ':comment_open' => $comment, ':permalink' => $permalink, ':published' => $published));
         WY_Response::redirect('admin/posts/all');
     }
     $cat = WY_Db::all('SELECT * FROM wy_categories WHERE published = 1');
     $this->layout->pageTitle = 'Wayang CMS - Post Add';
     $this->layout->content = WY_View::fetch('admin/posts/new', array('cat' => $cat));
 }
예제 #2
0
 public function add()
 {
     self::auth();
     if (WY_Request::isPost()) {
         $author = WY_Session::get('display');
         $title = $_POST['title'];
         if (isset($_POST['published'])) {
             $published = 1;
         } else {
             $published = 0;
         }
         if (isset($_POST['a_comment'])) {
             $comment = 1;
         } else {
             $comment = 0;
         }
         $plugin = $_POST['plugin'];
         $content = $_POST['content'];
         $isParent = $_POST['isParent'];
         $tags = $_POST['tags'];
         $permalink = strtolower(str_replace(' ', '-', $title));
         WY_Db::execute('INSERT INTO `wy_pages`' . '(`author`, `title`, `date_add`, `content`, `comment_open`, `published`, `use_plugin`, `is_parent`, `permalink`, `tag`) ' . 'VALUES ' . '(:author,:title,NOW(),:content,:comment_open,:published,:use_plugin,:is_parent,:permalink,:taglist)', array(':author' => $author, ':title' => $title, ':content' => $content, ':comment_open' => $comment, ':published' => $published, ':use_plugin' => $plugin, ':is_parent' => $isParent, ':permalink' => $permalink, ':taglist' => $tags));
         WY_Response::redirect('admin/pages/all');
     }
     $isParent = WY_Db::all('SELECT * FROM wy_pages WHERE is_parent = 0');
     $plugins = WY_Db::all("SELECT * FROM `wy_plugins` WHERE `is_active` = 1 ORDER BY plugin_name ASC");
     $this->layout->pageTitle = 'Wayang CMS - Pages Add';
     $this->layout->content = WY_View::fetch('admin/pages/new', array('isParent' => $isParent, 'plugins' => $plugins));
 }
예제 #3
0
 public function pwd()
 {
     self::auth();
     $user = WY_Db::row('SELECT * FROM `wy_users` WHERE `user_id` = :id', array(':id' => (int) WY_Session::get('user_id')));
     if (!$user) {
         $view = new WY_View('404');
         $view->render();
         exit;
     }
     if (WY_Request::isPost()) {
         $username = $_POST['username'];
         $npass = $_POST['npassword'];
         $cpass = $_POST['cpassword'];
         $sql = "UPDATE `wy_users` SET `pass`=:password WHERE `username`=:username";
         WY_Db::execute($sql, array(':password' => sha1($npass . WY_Config::get('salt')), ':username' => $username));
         WY_Response::redirect('admin/users/all');
     }
     $this->layout->pageTitle = 'Wayang CMS - Change User Password';
     $this->layout->content = WY_View::fetch('admin/users/password', array('user' => $user));
 }
예제 #4
0
 public function run()
 {
     if (WY_Request::isPost()) {
         $table_sql = array();
         $migration = new WY_Migration();
         $table_sql[] = $migration->createTable('wy_users', array('user_id' => 'pk', 'username' => 'string NOT NULL', 'pass' => 'string NOT NULL', 'email' => 'string NOT NULL', 'url' => 'string NOT NULL', 'date_registered' => 'datetime NOT NULL', 'activation' => 'string DEFAULT NULL', 'status' => 'string NOT NULL', 'display_name' => 'string NOT NULL'));
         $table_sql[] = $migration->createTable('wy_categories', array('cat_id' => 'pk', 'title' => 'string NOT NULL', 'date_add' => 'datetime NOT NULL', 'published' => 'tinyint(4) NOT NULL DEFAULT 0', 'date_modified' => 'datetime NULL', 'permalink' => 'string NOT NULL'));
         $table_sql[] = $migration->createTable('wy_comments', array('c_id' => 'pk', 'name' => 'string NOT NULL', 'email' => 'string NOT NULL', 'url' => 'string NOT NULL', 'date' => 'datetime NOT NULL', 'content' => 'text NOT NULL', 'post_id' => 'integer NULL', 'page_id' => 'integer NULL', 'ip' => 'varchar(15) NOT NULL', 'is_parent' => 'integer NOT NULL DEFAULT 0'));
         $table_sql[] = $migration->createTable('wy_pages', array('page_id' => 'pk', 'author' => 'integer NOT NULL', 'title' => 'string NOT NULL', 'date_add' => 'datetime NOT NULL', 'content' => 'longtext DEFAULT NULL', 'comment_open' => 'tinyint(4) NOT NULL', 'published' => 'tinyint(4) NOT NULL', 'date_modified' => 'datetime NULL', 'use_plugin' => 'string NULL', 'is_parent' => 'integer NOT NULL', 'permalink' => 'string NOT NULL', 'tag' => 'string NOT NULL'));
         $table_sql[] = $migration->createTable('wy_plugins', array('plugin_id' => 'pk', 'plugin_name' => 'string NOT NULL', 'plugin_path' => 'string NOT NULL', 'is_active' => 'tinyint(4) NOT NULL'));
         $table_sql[] = $migration->createTable('wy_posts', array('post_id' => 'pk', 'title' => 'string NOT NULL', 'cat_id' => 'integer NOT NULL', 'tag' => 'string NOT NULL', 'date_add' => 'datetime NOT NULL', 'author' => 'integer NOT NULL', 'content' => 'longtext NOT NULL', 'comment_open' => 'tinyint(4) NOT NULL', 'comment_count' => 'integer NOT NULL', 'permalink' => 'string NOT NULL', 'published' => 'tinyint(4) NOT NULL', 'date_modified' => 'datetime DEFAULT NULL'));
         $table_sql[] = $migration->createTable('wy_settings', array('id' => 'pk', 'key' => 'string NOT NULL', 'value' => 'string NULL', 'is_auto' => 'varchar(4) NULL'));
         $table_sql[] = $migration->createTable('wy_themes', array('themes_id' => 'pk', 'themes_name' => 'string NOT NULL', 'themes_path' => 'string NOT NULL', 'is_active' => 'tinyint(4) NOT NULL'));
         $table_sql[] = $migration->createTable('wy_usermetas', array('um_id' => 'pk', 'user_id' => 'integer NOT NULL', 'key_name' => 'string NOT NULL', 'key_value' => 'string NULL'));
         foreach ($table_sql as $sql) {
             WY_Db::execute($sql);
         }
         WY_Db::execute('INSERT INTO wy_users 
             (`username`, `pass`, `email`, `url`, `date_registered`, `status`, `display_name`) 
             VALUES
             (' . $this->quote(WY_Session::get('install.username')) . ', 
             ' . $this->quote(sha1(WY_Session::get('install.password') . WY_Config::get('salt'))) . ', 
             ' . $this->quote(WY_Session::get('install.email')) . ', 
             ' . $this->quote(WY_Session::get('install.url')) . ', NOW(), 
             "admin", ' . $this->quote(WY_Session::get('install.display_name')) . ')');
         WY_Db::execute("INSERT INTO `wy_categories`(`title`, `date_add`, `published`, `permalink`) " . "VALUES " . "('Uncategories',NOW(),1,'uncategories')");
         WY_Db::execute('INSERT INTO `wy_pages`' . '(`author`, `title`, `date_add`, `content`, `comment_open`, `published`, `use_plugin`, `is_parent`, `permalink`, `tag`) ' . 'VALUES ' . '(:author,:title,NOW(),:content,:comment_open,:published,:use_plugin,:is_parent,:permalink,:taglist)', array(':author' => (int) 1, ':title' => "First Page", ':content' => "<p style='text-align:justify'>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of &quot;de Finibus Bonorum et Malorum&quot; (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, &quot;Lorem ipsum dolor sit amet..&quot;, comes from a line in section 1.10.32.</p>\r\n                                <p style='text-align:justify'>The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from &quot;de Finibus Bonorum et Malorum&quot; by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</p>\r\n                                ", ':comment_open' => (int) 0, ':published' => (int) 1, ':use_plugin' => (int) 0, ':is_parent' => (int) 0, ':permalink' => "first-page", ':taglist' => "First Page, Page"));
         WY_Db::execute('INSERT INTO `wy_posts`' . '(`cat_id`, `title`, `tag`, `date_add`, `author`, `content`, `comment_open`, `permalink`, `published`) ' . 'VALUES ' . '(:cat_id,:title,:tag,NOW(),:author,:content,:comment_open,:permalink,:published)', array(':cat_id' => 1, ':title' => "First Post", ':tag' => "Post, First Post", ':author' => (int) 1, ':content' => "<p style='text-align:justify'>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of &quot;de Finibus Bonorum et Malorum&quot; (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, &quot;Lorem ipsum dolor sit amet..&quot;, comes from a line in section 1.10.32.</p>\r\n                                <p style='text-align:justify'>The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from &quot;de Finibus Bonorum et Malorum&quot; by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</p>\r\n                                ", ':comment_open' => (int) 1, ':permalink' => "first-post", ':published' => (int) 1));
         WY_Response::redirect('install/result');
     }
     $this->layout->content = WY_View::fetch('install/run');
     $this->layout->pageTitle = 'Wayang - Initial Installation';
 }
예제 #5
0
" class="btn btn-lg btn-primary btn-block">Register</a>-->
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-11 col-lg-offset-1">
                    <a href="<?php 
echo $router->generate('admin-reset-password');
?>
" class="btn btn-sm btn-warning" ><span class="glyphicon glyphicon-question-sign"></span> Forgot Password</a>
                    <a href="<?php 
echo $router->generate('home');
?>
" class="btn btn-sm btn-default"><span class="glyphicon glyphicon-globe"></span> Go to Website</a>
                </div>
            </div>
        </form>
        <?php 
if (WY_Session::has_flash('error')) {
    ?>
            <div class="alert alert-dismissable alert-danger">
                <button type="button" class="close" data-dismiss="alert">×</button>
                <?php 
    echo WY_Session::get_flash('error');
    ?>
            </div>
        <?php 
}
?>
    </div>
</div>
예제 #6
0
 public function logout()
 {
     WY_Session::destroy();
     WY_Response::redirect('login');
 }
예제 #7
0
 /**
  * Memeriksa apakah pengguna saat ini telah ter-otentikasi dengan benar
  * @return boolean
  */
 public static function is_authenticated()
 {
     return WY_Session::get('authenticated', false);
 }
예제 #8
0
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand brand-admin" href="<?php 
echo $router->generate('admin-home');
?>
"><img src="<?php 
echo WY_Request::base_url();
?>
/assets/images/wy-logo.png"/> Wayang CMS Administration</a>
            </div>

            <ul class="nav navbar-top-links navbar-right">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa  fa-user "></i> Welcome <?php 
echo WY_Session::get('display');
?>
 <i class="fa  fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="<?php 
echo $router->generate('home');
?>
"><i class="fa  fa-globe "></i> View Website</a></li>
                        <li class="divider"></li>
                        <!--<li>
                            <a href="<?php 
echo $router->generate('admin-users-profile');
?>
"><i class="fa  fa-user "></i> User Profile</a>
                        </li>-->