[pre-release] dev cms

Page 3 of 5 FirstFirst 12345 LastLast
Results 31 to 45 of 63
  1. #31
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Added the navigation for the news within a new function. What are your thoughts are the size of the navigation panel? Too big? Just right? Give more space for the news panel?

    PHP Code:
        public static function news_navigation ()
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT ID, header FROM www_news ORDER BY ID DESC LIMIT 25';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->store_result();
                if (
    $statement->num_rows 0)
                {
                    
    $statement->bind_result($ID$header);
                    while (
    $statement->fetch())
                    {
                        if (
    $ID == $_GET['sub'] || $_GET['sub'] == NULL && $ID == $statement->num_rows)
                        {
                            
    $result .= ($header.'<br /><br />');
                        }
                        else
                        {
                            
    $result .= ('<a href="'.$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self">'.$header.'</a><br /><br />');
                        }
                    }
                }
                
    $statement->close();
            }
            
            return (
    $result);
        } 
    Attached Thumbnails Attached Thumbnails bigger_tits_pls.png  

  2. #32
    Apprentice Erik Rouw is offline
    MemberRank
    Jun 2013 Join Date
    7Posts

    Re: [pre-release] dev cms

    I am dutch and the cms doesn't works for me

  3. #33
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by Erik Rouw View Post
    I am dutch and the cms doesn't works for me
    These current releases are just patches, they're not a stable release. It's just something that you can either work on, rip or contribute until I release a stable patch that'll allow the user to work with a functional CMS.

    If you look at the index.php you'll notice that some of the code is missing, e.g. staff permissions. You'll also notice that you can freely view every page without having a session because I've commented the define() to stop redirecting you.

    Although thanks for trying it out, just keep checking back to see if a stable release has been made, or help with contributions on how to make the CMS better. (:

    To get the CMS up and running you need to put some configurations into your config.php to enable database activity. (/private/application/config/config.php)

    Secondly to see the classes you can view (/private/application/library/)
    Thirdly if you want to see the HTML or PHP that's being displayed on your web browser you can go to (/private/application/theme/public/ or /private/application/theme/private)
    Public folder is .php and private folder is .tpl (html)

    While I was checking for errors on the login page, I found that I made a mistake or two when I was writing out the variables.

    Old:
    PHP Code:
        if (count($errors) == 0)
        {
            
    define('LOGGED_IN'true);
            if (isset(
    $_POST['login']) || isset($_GET['register']))
            {
                
    $initial1 NULL;
                
    $initial2 NULL;
                
                if (
    $_POST['login'])
                {
                    
    $initial1 $_POST['log_username'];
                    
    $initial1 $_POST['log_password'];
                }
                
                if (
    $_POST['register'])
                {
                    
    $initial1 $_POST['reg_username'];
                    
    $initial1 $_POST['reg_password1'];
                }
                
                
    $_SESSION['username'] = $initial1;
                
    $_SESSION['password'] = $initial2;
            }
            
    header ('Location '.$config['www']['url'].'/?p=me');
            exit;
        } 
    New:
    PHP Code:
        if (count($errors) == 0)
        {
            if (isset(
    $_POST['login']) || isset($_POST['register']))
            {
                
    $initial1 NULL;
                
    $initial2 NULL;
                
                if (
    $_POST['login'])
                {
                    
    $initial1 $_POST['log_username'];
                    
    $initial2 $_POST['log_password'];
                }
                else if (
    $_POST['register'])
                {
                    
    $initial1 $_POST['reg_username'];
                    
    $initial2 $_POST['reg_password1'];
                }
                
                
    $_SESSION['username'] = $initial1;
                
    $_SESSION['password'] = md5($initial2);
                
                require_once (
    'me.php');
                die;
            }
        } 
    The register page works, it's just that the insert function to actually create the fields has not been made, as of yet. So you have to manually place a user field into your user table.

  4. #34
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    I kinda started creating the register function to create accounts, but I think I'm missing a table to insert into or possibly some fields, who knows. Uhm

    PHP Code:
        public function user_register($username$password$email)
        {
            GLOBAL 
    $db;
            
    $query 'INSERT INTO users (username, password, mail, auth_ticket, rank, look, gender, motto, credits, activity_points, last_online, account_created) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('ssssisssiiii'$usernamemd5($password), $email''1'sh-290-80.ch-210-66.hd-180-1.lg-285-82.hr-100-61''M''''500''500'time(), time());
                
    $statement->execute();
                if(
    $statement->fetch())
                {
                    return 
    true;
                    
    $statement->close();
                }
                else
                {
                    return 
    false;
                }
            }
        } 
    I've also assigned the user data to the personal page when you're logged in (attachment is below).

    The things I need to tick off now for the front end to be complete are.. Account, Staff, Users (online), client, finish off maintenance page and I'll just do the layout for shop, coding can be implemented by yourself.

    I'm going to rework the layout for the housekeeping, I noticed that the code ain't compatible for I.E. I'll try to keep the ids and classes normalised with the styling.
    Attached Thumbnails Attached Thumbnails big_tits_happy_days.png  

  5. #35
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Alright I started the layout for users (online) and I came up with this. I also added the search function to the personal page.

    Any contributions to the project would be great, you all have the markup if you want to create any pages jajaa
    Attached Thumbnails Attached Thumbnails latest_tits.png   latest_member.png  

  6. #36
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Oh ye I would like to credit HabbCrazy (habbo fansite) for the backdrop on the skyscrappers, clouds and some various images used. Secondly I would like to credit Habbo for some images being used.

    Here is the markup for the me.tpl small ain't it? :P

    Code:
    <!DOCTYPE html>
    <html lang="en">
    	<head>
    		<title>%NAME%: </title>
    		<link rel="shortcut icon" href="%URL%/public/images/ico/favicon.ico" />
    		<link rel="stylesheet" href="%URL%/public/css/bootstrap.css" type="text/css">
    		<link rel="stylesheet" href="%URL%/public/css/style.css" type="text/css">
    		%META%
    	</head>
    	<body>
    		%HEADER%
    		<div class="container">
    			<div id="container-column-01" class="container-column">
    				<div id="container-body-personal">
    					%PERSONAL%
    				</div>
    				<div class="container-title orange">Hot campaigns</div>
    				<div class="container-body">
    					%CAMPAIGN%
    				</div>
    				<div class="container-title orange">%NAME% search</div>
    				<form action="%URL%/p?=users" method="get" autocomplete="off" class="container-body">
    					<div class="container-body-form">
    						<label>%NAME% name <input type="text" name="users" /></label>
    						<p>Enter a username with 3 characters or more.</p>
    					</div>
    					<input type="submit" value="Submit" class="submit" />
    				</form>
    			</div>
    			<div id="container-column-02" class="container-column">
    				<div id="container-body-news">
    					%NEWS%
    				</div>
    			</div>
    			%ADVERT%
    			%FOOTER%
    		</div>
    	</body>
    </html>
    me.php
    PHP Code:
    <?php
    if (!defined('IN_PAGES'))
    {
        die (
    '<h1>Access denied</h1><p>You do not have the privileges to access this webpage.</p>');
    }

    //if (LOGGED_IN)
    //{
    //    header('Location: '.$config['www']['url'].'/?p=me');
    //    exit;
    //}

    $tpl->Init();
            
    $me = new setTemplate('me');

    $me->SetParam('PERSONAL'$usr->user_personal ($_SESSION['username']));
    $me->SetParam('CAMPAIGN'html::personal_campaign ());
    $me->SetParam('NEWS'html::personal_news ());

    $tpl->AddTemplate($me);
    $tpl->Output();
    ?>
    Last edited by Predict; 01-11-13 at 06:51 PM.

  7. #37
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: [pre-release] dev cms

    Just funny to see how you do return first and then close the statement. which ofcouse, will never be closed like that!

    And nice to see you use mysqli, but keep in mind that fetch isn't something you can use with a insert query :)

  8. #38
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by Joopie View Post
    Just funny to see how you do return first and then close the statement. which ofcouse, will never be closed like that!

    And nice to see you use mysqli, but keep in mind that fetch isn't something you can use with a insert query :)
    True true, I knew something was wrong with the insert jaajaja
    FEEL FREE TO IMPROVE THE SOURCE!

  9. #39
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by Joopie View Post
    Just funny to see how you do return first and then close the statement. which ofcouse, will never be closed like that!

    And nice to see you use mysqli, but keep in mind that fetch isn't something you can use with a insert query :)
    I've looked over each function and placed the close() statement appropriately and alterted some functions that didn't require a return on true and false. E.G.

    PHP Code:
        public function user_id ($username)
        {
            GLOBAL 
    $db;
            
    $query = ('SELECT ID FROM users WHERE username = ? LIMIT 1');
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('s'$username);
                
    $statement->execute();
                
    $statement->bind_result($ID);
                
    $statement->fetch();
                
    $statement->close();
                return (
    $ID);
            }
        } 
    I've also sorted the register function out with the insert.

    PHP Code:
        public function user_register($username$password$email)
        {
            GLOBAL 
    $db;
            
    $query = ('INSERT INTO users (username, password, mail, auth_ticket, rank, look, gender, motto, credits, activity_points, last_online, account_created) VALUES (?, ?, ?, "", "1", "sh-290-80.ch-210-66.hd-180-1.lg-285-82.hr-100-61", "M", "", "500", "500", "'.time().'", "'.time().'")');
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('sss'$usernamemd5($password), $email);
                
    $statement->execute();
                
    $statement->close();
            }
        } 
    If I feel up to it, I'll finish up off the users (online) page with added functions. Be sure to review my code and help improve, thanks!

  10. #40
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Anyway, staff page is here at last.

    PHP Code:
        public static function staff ()
        {
            GLOBAL 
    $config$db;
            
    $query = ('SELECT username, rank, look FROM users WHERE rank >= 4 ORDER BY rank ASC');
            
    $ranks = array(=> "Silver Hobba"=> "Gold Hobba" => "Moderator"=> "Administrator");
            if (
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->store_result();
                if (
    $statement->num_rows 0)
                {
                    
    $statement->bind_result($username$rank$look);
                    while (
    $statement->fetch())
                    {
                        
    $class = ($x == 0) ? 'odd' 'even';
                        
    $result = ('<a href="'.$config['www']['url'].'/?=home&sub='.$username.'" target="_self" class="'.$class.'">
                            <div class="users-image"><img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure='
    .$look.'&direction=2&head_direction=2&size=s&gesture=sml.gif" alt="" /></div>
                            <div class="users-p"><b>'
    .$username.'</b><br />'.$ranks[$rank].'</div>
                        </a>'
    );
                        
    $x++;
                    }
                    
    $statement->close();
                }
                else
                {
                    
    $result = ('<p>We have no staff members managing '.$config['www']['name'].' Hotel.</p>');
                }
            }
            
            return (
    $result);
        } 
    Attached Thumbnails Attached Thumbnails staff_tits.png  

  11. #41
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Alright, I didn't do anything last night cause I went out. ANYWAY.

    I've created the function to show people who are online, including a pagination to limit the number of people shown, per page.

    PHP Code:
        public static function users ($ID NULL)
        {
            GLOBAL 
    $config$db;
            
    $query = ('SELECT count(ID) FROM users WHERE online = "1"');
            if (
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->bind_result($id);
                
    $rows = array();
                while (
    $statement->fetch())
                {
                     
    $rows[] = array('id' => $id);
                }
                
    $statement->close();
                
    $rows $id;
                
    $pages ceil($rows 10);
                for (
    $i 1$i <= $pages$i++)
                {
                    
    $result2 .= '<a href="'.$config['www']['url'].'?p=users&sub='.$i.'" target="_self">'.$i.'</a>';
                }
            }
            
            
    $query = ('SELECT username, look FROM users WHERE online = "1" ORDER BY username ASC LIMIT '.(($ID 1) * 10).', 10');
            if (
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->bind_result($username$look);
                while (
    $statement->fetch())
                {
                    
    $class = ($x == 0) ? 'odd' 'even';
                    
    $result1 .= ('<a href="'.$config['www']['url'].'?p=home&sub='.$username.'" target="_self" class="'.$class.'">
                            <div class="users-image"><img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure='
    .$look.'&direction=2&head_direction=2&size=s&gesture=sml.gif" alt="'.$username.'" /></div>
                            <div class="users-p"><b>'
    .$username.'</b><br />Online</div>
                        </a>'
    );
                    
    $x++;
                }
                
    $statement->close();
            }
            return (
    '<div class="container-title orange">'.$config['www']['name'].'s online</div>
                    <div class="container-body">
                        '
    .$result1.'
                        <div class="container-body-form">Pages: '
    .$result2.'</div>
                    </div>'
    );
        } 
    I'm probably going to review the code for this, but in the mean time, it is what it is.

    Quick review of the code and I've added the latest member function inside, I was planning to do this already. I just wanted to make sure the first part of the code was correct (and working)

    PHP Code:
        public static function users ($ID NULL)
        {
            GLOBAL 
    $config$db;
            if (
    $ID == NULL// LATEST MEMBER
            
    {
                
    $query = ('SELECT username, look FROM users ORDER BY ID DESC LIMIT 1');
                if (
    $statement $db->prepare($query))
                {
                    
    $statement->execute();
                    
    $statement->bind_result($username$look);
                    
    $statement->fetch();
                    
    $statement->close();
                }
                
                return (
    '<a href="'.$config['www']['url'].'?p=home&sub='.$username.'" target="_self" class="odd">
                            <div class="users-image" style="width: 80px;"><img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure='
    .$look.'&direction=2&head_direction=2&size=s&gesture=sml.gif" alt="'.$username.'" /></div>
                            <div class="users-p" style="width: 178px;"><b>'
    .$username.'</b><br />Latest Member</div>
                        </a>'
    );
            }
            else 
    // USERS ONLINE
            
    {
                
    $query = ('SELECT username, look FROM users WHERE online = "1" ORDER BY username ASC LIMIT '.(($ID 1) * 10).', 10');
                if (
    $statement $db->prepare($query))
                {
                    
    $statement->execute();
                    
    $statement->bind_result($username$look);
                    while (
    $statement->fetch())
                    {
                        
    $class = ($x == 0) ? 'odd' 'even';
                        
    $result1 .= ('<a href="'.$config['www']['url'].'?p=home&sub='.$username.'" target="_self" class="'.$class.'">
                            <div class="users-image"><img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure='
    .$look.'&direction=2&head_direction=2&size=s&gesture=sml.gif" alt="'.$username.'" /></div>
                            <div class="users-p"><b>'
    .$username.'</b><br />Online</div>
                        </a>'
    );
                        
    $x++;
                    }
                    
    $statement->close();
                }
                
                
    $query = ('SELECT count(ID) FROM users WHERE online = "1"');
                
    $count = array();
                if (
    $statement $db->prepare($query))
                {
                    
    $statement->execute();
                    
    $statement->bind_result($id);
                    while (
    $statement->fetch())
                    {
                        
    $count[] = array('id' => $id);
                    }
                    
    $statement->close();
                    
    $pages ceil($count $id 10);
                    for (
    $i 1$i <= $pages$i++)
                    {
                        
    $result2 .= '<a href="'.$config['www']['url'].'?p=users&sub='.$i.'" target="_self">'.$i.'</a>';
                    }
                }
                
                return (
    '<div class="container-title orange">'.$config['www']['name'].'s online</div>
                    <div class="container-body">
                        '
    .$result1.'
                        <div class="container-body-form">Pages: '
    .$result2.'</div>
                    </div>'
    );
            }
        } 

  12. #42
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: [pre-release] dev cms

    Do you mind to explain this peace of code, by code I mean the $count part?

    PHP Code:
                    $statement->bind_result($id);
                    while (
    $statement->fetch())
                    {
                        
    $count[] = array('id' => $id);
                    }
                    
    $statement->close();
                    
    $pages ceil($count $id 10); 

  13. #43
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by Joopie View Post
    Do you mind to explain this peace of code, by code I mean the $count part?

    PHP Code:
                    $statement->bind_result($id);
                    while (
    $statement->fetch())
                    {
                        
    $count[] = array('id' => $id);
                    }
                    
    $statement->close();
                    
    $pages ceil($count $id 10); 
    I created the array above the loop (while()) to first set up the appropriate condition because of variable scoping, then with the variable that has [] adds a new element to the array, just like the push(), but without the overhead of calling a function.

    http://us1.php.net/array_push

    PHP Code:
    public static function users_search ()
    {
            GLOBAL 
    $db;
            
    $query = ('SELECT username, look FROM users WHERE username LIKE = ?'); // ADD PAGINATION WITH COUNT(ID) on USERS
            
    if ($statement $db->prepare($query))
            {\
                    
    $statement->bind_param('s'$user);
                    
    $statement->execute();
                    
    $statement->bind_result($username$look);
                    while (
    $statement->fetch())
                    {
                            
    $result .= ('<a href="#" target="_self"><img src="'.$look.'" alt="'.$username.'" /></a>'); //assuming we have our markup
                    
    }
                    
    $statement->close();
            }
           
            return (
    $result);

    I haven't fully finalised the user_search function, as of yet because I didn't have the markup language when I was coding this. I'll implement it and give you guys a heads up on the final result.
    Last edited by Predict; 04-11-13 at 07:51 PM.

  14. #44
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by Predict View Post
    PHP Code:
    public static function users_search ()
    {
            GLOBAL 
    $db;
            
    $query = ('SELECT username, look FROM users WHERE username LIKE = ?'); // ADD PAGINATION WITH COUNT(ID) on USERS
            
    if ($statement $db->prepare($query))
            {\
                    
    $statement->bind_param('s'$user);
                    
    $statement->execute();
                    
    $statement->bind_result($username$look);
                    while (
    $statement->fetch())
                    {
                            
    $result .= ('<a href="#" target="_self"><img src="'.$look.'" alt="'.$username.'" /></a>'); //assuming we have our markup
                    
    }
                    
    $statement->close();
            }
           
            return (
    $result);

    Why are you using GLOBAL and not something like a static core class like this:

    PHP Code:
    <?php

    class Core {

        private static 
    $configuration;
        private static 
    $database;
        private static 
    $settings;

        public static function 
    includeClasses() {
            foreach(
    glob('includes/classes/class.*.php') as $file) {
                if (
    $file == 'includes/classes/class.core.php') {
                    continue;
                }
                
                include(
    $file);
            }
        }
        
        public static function 
    initialize() {
            
    self::$configuration = new Configuration();
            
            
    self::$database = new Database();
            
    self::$settings = new Settings();
        }
        
        public static function 
    getConfiguration() {
            return 
    self::$configuration;
        }
        
        public static function 
    getDatabase() {
            return 
    self::$database;
        }
        
        public static function 
    getSettings() {
            return 
    self::$settings;
        }
    }

    ?>
    default.php:

    PHP Code:
    <?php

    include('includes/classes/class.core.php');

    Core::includeClasses();
    Core::initialize();

    ?>
    (TO BE IMPROVED I KNOW, JUST GIVING EXAMPLE)

  15. #45
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: [pre-release] dev cms

    I think you didn't notice it but I'll tell you why I asked:

    PHP Code:
    $pages ceil($count $id 10); 
    You create a array $count send some random values in a array and then suddenly, you use it as a int/float.



Page 3 of 5 FirstFirst 12345 LastLast

Advertisement