DaLightz
See ya'll in the afterlife.
- May 19, 2012
- 1,136
- 262
Goodluck with that. That means you have to make an emu class, online users class etc etc..I'll edit it and stuff and make it Habbo Related.
Goodluck with that. That means you have to make an emu class, online users class etc etc..I'll edit it and stuff and make it Habbo Related.
If you release the CMS to the public, they can edit/make it whatever they want.
<?php
/*------------------------------------------------------------------------|
| Devour CMS - Copyright (c) Josh Priestley 2012 |
| ------------------------------------------------------------------------|
| Permission is hereby granted, free of charge, to any person obtaining a |
| copy of this software and associated documentation files |
| (the "Software"), to deal in the Software without restriction, |
| including without limitation the rights to use, copy, modify, merge, |
| publish, distribute, sublicense, and/or sell copies of the Software, |
| and to permit persons to whom the Software is furnished to do so, |
| subject to the following conditions: |
| ------------------------------------------------------------------------|
| The above copyright notice and this permission notice shall be included |
| in all copies or substantial portions of the Software. |
| ------------------------------------------------------------------------|
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| ------------------------------------------------------------------------|
/*
* Begin start of template class
*/
class dCMS_template
{
public $output;
public $file;
public $values = array();
public function __construct()
{
/*
* Global Params
*/
global $config;
$this->setParam('updates', $config['update']['enabled']);
$this->setParam('template', $config['site']['template']);
$this->setParam('site_url', $config['site']['url']);
$this->setParam('site_name', $config['site']['name']);
$this->setParam('max_acc', $config['account']['maxAcc']);
$this->setParam('def_rank', $config['account']['defRank']);
$this->setParam('owner', $config['owner']['username']);
$this->setParam('maint_status', $config['maint']['enabled']);
$this->setParam('maint_msgEn', $config['maint']['msgEn']);
$this->setParam('maint_msg', $config['maint']['msg']);
}
public function beginTPL($file)
{
global $core, $config;
$this->file = $file;
$this->output = file_get_contents($this->file.'.tpl');
}
public function setParam($key, $value)
{
$this->values[$key] = $value;
}
public function output()
{
foreach($this->values as $key => $value)
{
$tagsToReplace = '{'.$key.'}';
$this->output = str_replace($tagsToReplace, $value, $this->output);
}
return $this->output;
}
}
?>
Updates
I've began the template class, i've decided to do a .tpl type system with ajustments of my own. The class is very messy and needs editing, the class was also originally based on something I found on Youtube, although the class is just temperory so its easier to get visual things done. Here's the class so far.
PHP:<?php /*------------------------------------------------------------------------| | Devour CMS - Copyright (c) Josh Priestley 2012 | | ------------------------------------------------------------------------| | Permission is hereby granted, free of charge, to any person obtaining a | | copy of this software and associated documentation files | | (the "Software"), to deal in the Software without restriction, | | including without limitation the rights to use, copy, modify, merge, | | publish, distribute, sublicense, and/or sell copies of the Software, | | and to permit persons to whom the Software is furnished to do so, | | subject to the following conditions: | | ------------------------------------------------------------------------| | The above copyright notice and this permission notice shall be included | | in all copies or substantial portions of the Software. | | ------------------------------------------------------------------------| | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | | ------------------------------------------------------------------------| /* * Begin start of template class */ class dCMS_template { public $output; public $file; public $values = array(); public function __construct() { /* * Global Params */ global $config; $this->setParam('updates', $config['update']['enabled']); $this->setParam('template', $config['site']['template']); $this->setParam('site_url', $config['site']['url']); $this->setParam('site_name', $config['site']['name']); $this->setParam('max_acc', $config['account']['maxAcc']); $this->setParam('def_rank', $config['account']['defRank']); $this->setParam('owner', $config['owner']['username']); $this->setParam('maint_status', $config['maint']['enabled']); $this->setParam('maint_msgEn', $config['maint']['msgEn']); $this->setParam('maint_msg', $config['maint']['msg']); } public function beginTPL($file) { global $core, $config; $this->file = $file; $this->output = file_get_contents($this->file.'.tpl'); } public function setParam($key, $value) { $this->values[$key] = $value; } public function output() { foreach($this->values as $key => $value) { $tagsToReplace = '{'.$key.'}'; $this->output = str_replace($tagsToReplace, $value, $this->output); } return $this->output; } } ?>
Good Luck. I'd love to see a picture of your progress.
Thanks for your support and your development on this wonderful CMS.
<?php
/*------------------------------------------------------------------------|
| Devour CMS - Copyright (c) Josh Priestley 2012 |
| ------------------------------------------------------------------------|
| Permission is hereby granted, free of charge, to any person obtaining a |
| copy of this software and associated documentation files |
| (the "Software"), to deal in the Software without restriction, |
| including without limitation the rights to use, copy, modify, merge, |
| publish, distribute, sublicense, and/or sell copies of the Software, |
| and to permit persons to whom the Software is furnished to do so, |
| subject to the following conditions: |
| ------------------------------------------------------------------------|
| The above copyright notice and this permission notice shall be included |
| in all copies or substantial portions of the Software. |
| ------------------------------------------------------------------------|
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| ------------------------------------------------------------------------|
/*
* Begin start of template class
*/
class dCMS_template
{
public $output;
public $file;
public $values = array();
/*
* Functions automatically implemented
*/
public function __construct()
{
global $config, $user;
$this->executeTime = microtime(true);
$this->setParam('updates', $config['update']['enabled']);
$this->setParam('template', $config['site']['template']);
$this->setParam('site_url', $config['site']['url']);
$this->setParam('site_name', $config['site']['name']);
$this->setParam('max_acc', $config['account']['maxAcc']);
$this->setParam('def_rank', $config['account']['defRank']);
$this->setParam('owner', $config['owner']['username']);
$this->setParam('maint_status', $config['maint']['enabled']);
$this->setParam('maint_msgEn', $config['maint']['msgEn']);
$this->setParam('maint_msg', $config['maint']['msg']);
$this->setParam('username', $user->username);
}
/*
* Write a string in the php file
*/
public function write($value)
{
$this->output .= $value;
}
/*
* Begin a .tpl file
*/
public function beginTPL($file)
{
global $core, $config;
$this->file = $file;
if(file_exists('_tpl/'.$this->file.'.tpl'))
{
$str = '';
ob_start();
include('_tpl/'.$this->file.'.tpl');
$str .= ob_get_contents();
ob_end_clean();
$this->output .= $str;
}
else
{
$core->Redirect('../template-error');
exit;
}
}
/*
* Set a param using {param}
*/
public function setParam($key, $value)
{
$this->values[$key] = $value;
}
/*
* Output the page
*/
public function output()
{
foreach($this->values as $key => $value)
{
$tagsToReplace = '{'.$key.'}';
$this->output = str_ireplace($tagsToReplace, $value, $this->output);
}
$this->write('<!--- Devour CMS took '.(microtime(true) - $this->executeTime).'s to load --->');
echo $this->output;
}
}
?>
|----------------------------------------------------------------------------|
| ------------------------- DevourCMS Read Me File ------------------------- |
|----------------------------------------------------------------------------|
| Special thanks to; |
| - Jian Ting for things from RibbonCMS |
| - Kryptos for snippets and ideas from Rev |
| - Neesha Rakhara for helping me |
|----------------------------------------------------------------------------|
Special shoutout for the amazing community at Devbest.com
How to install -
NOTES:
- This is for people using Xampp / Apache
- The CMS can be used with IIS with the URL Rewrite add-on
STEPS:
1 - Extract the contents of DevourCMS 1.0.zip to htdocs/wwwroot.
2 - Create a MySQL database, name it anything of your choice
3 - Head on over to http://localhost/_install/step1
4 - Complete the installation, making sure everything is correct
5 - Go to http://localhost OR your site URL and be amazed
- If you find any bugs, please PM me 'Zeus' on Devbest.com with the error
- Suggesstions are also accepted at http://devbest.com/threads/dev-devourcms-v1-0-0-php-oop-mysqli.18666/
Making templates for DevourCMS -
NOTES:
- Making a template requires no knowledge of PHP, just how to call pages
- This only explains the index, but all other files are the same
- If you can't understand the tutorial, check out the original theme and edit that
If you need to make a template for Devour CMS, there are several set pages that you should use, they are
- Index
- Register
You can also create other pages and they will work all the same too.
STEPS:
1 - Create a new folder with the name for your skin in _template/_skins/
2 - Create an extra two folders in there called _tpl and _static
3 - In the _tpl folder create a file named index.tpl and style it to your choice using HTML
4 - The _static folder can be used for CSS, jQuery etc
5 - Next, go to the directory of your theme and make a file named index.php
6 - Make the file look like this;
<?php
require_once '../../../_inc/class.core.php';
if($user->LoggedIn)
{
$core->redirect('../home');
exit;
}
define('Devour','1');
$tpl->beginTPL('index');
$tpl->output();
?>
7 - You can also adjust it to your liking with plugins and param setting which are explained later on
8 - Go to localhost/index.php and see your new, awesome theme!
Setting params in DevourCMS -
NOTES:
- This tutorial can be only used in the template .php file
- Params only work in the .tpl files
- A param is set like {value}
STEPS:
1 - Go to the php file in your template where you want to set the param
2 - You should see something like this in that file
beginTPL('index');
$tpl->output();
3 - In the middle of that put something like this
$tpl->setParam('VALUE','WHAT IT DOES/SAY');
4 - You should have something like this
beginTPL('index');
$tpl->setParam('VALUE','WHAT IT DOES/SAY');
$tpl->output();
5 - Check the param is working by going into the corresponding .tpl file and using that param
6 - If it doesn't work, try again
ALL DEFAULT PARAMS:
- {updates} - Returns 1 or 0 depending on your $config['update']['enabled']
- {template} - Returns the $config['site']['template'] value
- {site_url} - Returns your site URL
- {site_name} - Returns your site name
- {max_acc} - Returns the value of $config['account']['maxAcc']
- {def_rank} - Returns the value of $config['account']['defRank']
- {owner} - Returns the owner of your site
- {maint_status} - Returns 1 or 0 depending on your $config['maint']['enabled']
- {maint_msgEn} - Returns 1 or 0 depending on your $config['maint']['msgEn']
- {maint_msg} - Returns your maintenance message of $config['maint']['msg']
- {username} - Returns a users username (Guest if not logged in, specified username if logged in)
Making plugins for DevourCMS -
// STILL TO DO
The whole point in an OPEN-SOURCED CMS is to make as much changes as you want. I dont see the point releasing the source if we have to ask to edit itIt's still licensed and specifies in the documentation that a part of using Devour CMS is to agree not to re-release or edit and release without permission prior to doing so, simple as that. End of.
The whole point in an OPEN-SOURCED CMS is to make as much changes as you want. I dont see the point releasing the source if we have to ask to edit it
You already said it was open sourced. But you said he needed to ask before editingI can confirm that the CMS will be open sourced. People can edit it to their liking, providing I get credits of course