• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Gesior AAC 2011 - Needed? Ideas?

Make it for OpenTibia SVN too :)
I think it will be easy to make it work with OpenTibia, because all queries to database will be executed by new classes, not POT. These classes will be more compatible with TFS 0.2, 0.3, 0.4 then POT.
Today I finished and tested new class:
PHP:
<?PHP
class Link extends Errors
{
	private $page = '';
	private $parameters = array();
	private $customParameters = array();
    public function __construct($page = '', $parameters = array(), $custom_parameters = array())
    {
		if(isset($page))
			$this->page = $page;
		if(isset($parameters))
			$this->parameters = $parameters;
		if(isset($custom_parameters))
			$this->customParameters = $custom_parameters;
    }

	public static function getURI()
	{
		static $URI;
		if(!isset($URI))
			$URI = Website::getInstance()->getURI();

		return $URI;
	}

	public static function getUseRewrite()
	{
		static $useRewrite;
		if(!isset($useRewrite))
			$useRewrite = Website::getInstance()->getWebsiteConfig()->getValue('useRewrite');

		return $useRewrite;
	}

    public function setPage(string $page)
    {
		$this->page = $page;
    }

    public function setParameters(Array $parameters)
    {
		$this->parameters = $parameters;
    }

    public function setCustomParameters(Array $custom_parameters)
    {
		$this->customParameters = $custom_parameters;
    }

    public function setParameter($number, $parameter = '')
    {
		$this->parameter[$number] = $parameter;
    }

    public function setCustomParameter($number, $custom_parameter = '')
    {
		$this->customParameter[$number] = $custom_parameter;
    }

    public function getPage()
    {
		return $this->page;
    }

    public function getParameters()
    {
		return $this->parameters;
    }

    public function getCustomParameters()
    {
		return $this->customParameters;
    }

    public function getParameter($number)
    {
		if(isset($this->parameter[$number]))
			return $this->parameter[$number];
		else
		{
			self::addError('#C-6', 'ERROR: Class::Link - getParameter(\$number) Param: <b>' . htmlspecialchars($number) . '</b>');
			return false;
		}
    }

    public function getCustomParameter($number)
    {
		if(isset($this->customParameter[$number]))
			return $this->customParameter[$number];
		else
		{
			self::addError('#C-7', 'ERROR: Class::Link - getCustomParameter(\$number) Param: <b>' . htmlspecialchars($number) . '</b>');
			return false;
		}
	}

    public function getString()
    {
		$ret = $this->getURI();
		if($this->page == '')
			$this->page = PAGE;
		if($this->getUseRewrite())
		{
			$ret .= urlencode($this->page) . '/';
			if(count($this->parameters) > 0)
			{
				foreach($this->parameters as &$value)
					$value = urlencode($value);
				$ret .= implode('/', $this->parameters);
			}
			$ret .= '/';
			$tmp_params = array();
			if(count($this->customParameters) > 0)
				foreach($this->customParameters as $key => $value)
					$tmp_params[] = urlencode($key) . '=' . urlencode($value);
			if(!empty($tmp_params))
				$ret .= '?' . implode('&', $tmp_params);
		}
		else
		{
			$tmp_params[] = 'page=' . urlencode($this->page);
			$tmp_params = array();
			if(count($this->parameters) > 0)
				foreach($this->parameters as $key => $value)
					$tmp_params[] = 'amp' . urlencode($key) . '=' . urlencode($value);
			if(count($this->customParameters) > 0)
				foreach($this->customParameters as $key => $value)
					$tmp_params[] = urlencode($key) . '=' . urlencode($value);
			if(!empty($tmp_params))
				$ret .= '?' . implode('&', $tmp_params);
		}
		return $ret;
	}
	public function __toString()
	{
		return $this->getString();
	}
}
?>
Example with some code:
PHP:
echo new Link('acco   +unt', array('log in')) . '<br>';
echo new Link('account', array('login')) . '<br>';
echo new Link('account', array('login')) . '<br>';
newlay.png
 
All administration options like 'write new news' will be in ./adminpanel/index.php
I want to change website user access to ots flags style, so I have to decide what should be definied by flags:
PHP:
const ACCESS_NONE = 0;
const ACCESS_VIEW_IP = 1; // see IP of player on characters page
const ACCESS_VIEW_ALL_CHARACTERS_FROM_ACCOUNT = 2; // if characters are 'hidden' user can view them anyway
const ACCESS_VIEW_CHARACTERS_BY_IP = 3; // view list of characters from IP
const ACCESS_RELOAD_XML = 4; // can reload XML files from ots directory
const ACCESS_RELOAD_CONFIG = 5; // can reload config file(s) [multiworld], CAN VIEW DATABASE INFORMATIONS
const ACCESS_CAN_SERIALIZE_FILES =6; // can serialize files [it's PHP function that cache files and make them load much faster]

I NEED YOUR IDEAS!
 
LONG_CONSTS_NAMES_ARE_READABLE_FOR_HUMANS_AND_YOU_DO_NOT_HAVE_TO_SEARCH_'WHAT'_'IT'_'DOES'_IN_CODE
?
Short version:
PHP:
const AN = 0; 
const AVI = 1;
const AVACFA = 2;
const AVCBI = 3
const ARX = 4;
const ARC = 5;
const ACSF = 6;
and now code will be more readable:
PHP:
...
if($VISITOR->checkAccess(Visitor::AVI))
{
    $row = new TableRow();
    $row->addCell(new TableCell('IP:'));
    $row->addCell(new TableCell(Functions::otIPtoString($player->getIP())));
    $table->addRow($row);
}
...
Visitor:AVI maybe it's user movie? :rolleyes:
 
Please use bitwise flags rather than just increasing the value by 1 for every new entry.
 
When your installing Geisor the forums shouldn't be in polish. English and that no menu is on polish.

Atleast that its begin from english and then they can translate to Polish if they want.
 
When your installing Geisor the forums shouldn't be in polish. English and that no menu is on polish.

Atleast that its begin from english and then they can translate to Polish if they want.

+1

Will you add a Shop System from the beginning? (So it looks nice..)
 
I think it will be easy to make it work with OpenTibia, because all queries to database will be executed by new classes, not POT. These classes will be more compatible with TFS 0.2, 0.3, 0.4 then POT.
The perfect. I've did modify a lot of queries on POT to make it work with my server but it will be perfect with this new system. Maybe make it without shopsystem :)
 
The perfect. I've did modify a lot of queries on POT to make it work with my server but it will be perfect with this new system. Maybe make it without shopsystem :)
New queries to SQL in classes will select fields specified in config [you can remove from list for example 'avatar', so it will not load by default big BLOB], config will be configurable by adminpanel [for classes Account, Player, Guild, GuildRank, House]
+1
Will you add a Shop System from the beginning? (So it looks nice..)
I will make shop class to add/remove points, add/remove/view transactions history and of course new .lua script, based on this:
http://otland.net/f82/shop-lua-player-name-item-description-website-shop-127774/
+ PHP script to find items in database
When your installing Geisor the forums shouldn't be in polish. English and that no menu is on polish.

Atleast that its begin from english and then they can translate to Polish if they want.
All pages will be in english. I think that it will be possible to add multi-language system easy.
Please use bitwise flags rather than just increasing the value by 1 for every new entry.
Of course I will.
 
have more news for us? :D
Today I will finish Form and Table classes. I want post first release candidate on 1 July.
---------------------
1. I'm looking for someone who know how to configure rewrite mod:
- rewrite all except folders 'static', 'static_safe', 'adminpanel', 'install' to index.php
2. Do you know any good wiki script/website that offer wiki hosting without milions banners?
 
May I recommend using $_SERVER['HTTP_HOST'] and $_SERVER['SCRIPT_NAME'] rather than completely relying on mod_rewrite. You can also use the $_SERVER['PATH_INFO'] if you would like to. You can still create a .htaccess file using mod_rewrite for the sole purpose of removing the file part from your URL. This way, you would not have to rely on mod_rewrite being enabled (it is very rarely disabled by default on web servers, but you should always anticipate the worst.
 
May I recommend using $_SERVER['HTTP_HOST'] and $_SERVER['SCRIPT_NAME'] rather than completely relying on mod_rewrite. You can also use the $_SERVER['PATH_INFO'] if you would like to. You can still create a .htaccess file using mod_rewrite for the sole purpose of removing the file part from your URL. This way, you would not have to rely on mod_rewrite being enabled (it is very rarely disabled by default on web servers, but you should always anticipate the worst.
In acc. maker config is option:
useRewrite
if you don't have rewrite mod 'on', you can set it 'false' in config and it will work without problems.

In scripts I use:
this only in classes
Website::getInstance()->getWebsiteConfig()->getValue('useRewrite')
and:
new Link('account', array('login'))
This is part of class Link:
PHP:
	public function getString()
	{
		$ret = $this->getURI();
		if($this->page == '')
			$this->page = PAGE;
		if($this->getUseRewrite())
		{
			$ret .= urlencode($this->page) . '/';
			if(count($this->parameters) > 0)
			{
				foreach($this->parameters as &$value)
					$value = urlencode($value);
				$ret .= implode('/', $this->parameters);
			}
			$ret .= '/';
			$tmp_params = array();
			if(count($this->customParameters) > 0)
				foreach($this->customParameters as $key => $value)
					$tmp_params[] = urlencode($key) . '=' . urlencode($value);
			if(!empty($tmp_params))
				$ret .= '?' . implode('&', $tmp_params);
		}
		else
		{
			$tmp_params = array();
			$tmp_params[] = 'page=' . urlencode($this->page);
			if(count($this->parameters) > 0)
				foreach($this->parameters as $key => $value)
					$tmp_params[] = 'amp' . urlencode($key) . '=' . urlencode($value);
			if(count($this->customParameters) > 0)
				foreach($this->customParameters as $key => $value)
					$tmp_params[] = urlencode($key) . '=' . urlencode($value);
			if(!empty($tmp_params))
				$ret .= '?' . implode('&', $tmp_params);
		}
		return $ret;
	}
Also, nginx users would have problems with your AAC if you use .htaccess.
No problem :)
--------------------
This is Form class (not finished yet):
PHP:
<?PHP
class Form extends Errors
{
	const FIELD_NONE = 0;
	const FIELD_TEXT = 1;
	const FIELD_TEXTAREA = 2;
	const FIELD_PASSWORD = 3;
	const FIELD_HIDDEN = 4;
	const FIELD_CHECKBOX = 5;
	const FIELD_RADIO = 6;
	const FIELD_SELECT = 7;
	const FIELD_SELECTOPTION = 8;
	const FIELD_SUBMIT = 9;
	const FIELD_IMAGE = 10;

	public $actionPage;
	public $actionParam;
	public $actionParamCustom;
	public $actionUseString = false;
	/*
	* '' by default send data to 'self', but only on pages that don't use custom_params
	* if you use custom params you must use function:
	* setAction(PAGE, $_PARAMS, array(here your custom params))
	* they will be added as hidden data or added to URI [rewrite mode on]
	*/
	public $action = '';
	/*
	* you can use: 'POST', 'GET'
	*/
	public $method = 'POST';
	public $style = '';
	public $class = '';
	public $name = '';
	public $id = '';
	/*
	* you can use: 'multipart/form-data', 'application/x-www-form-urlencoded', 'text/plain'
	*/
	public $enctype = 'multipart/form-data';
	public $onSubmit = '';
	public $onMouseOver = '';
	public $onMouseOut = '';
	public $fields = array();

	public function getString_Form()
	{
		$ret = '<form';
		$action = $this->getAction();
		$ret .= ' action="' . $action['URI'] . '"';
		$ret .= ' method="' . $this->method . '"';
		$ret .= ' enctype="' . $this->enctype . '"';
		$ret .= ' />';
		if(count($action['hiddenFields']) > 0)
			foreach($action['hiddenFields'] as $key => $value)
				$ret .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
		return $ret;
	}
	
	public function getString_FormEnd()
	{
		return '</form>';
	}

	public function getAction()
	{
	 // finish, fix
		if($this->actionUseString)
			return $this->action;
		else
		{
			$_tmp_web = Website::getInstance();
			if(Website::getInstance()->getWebsiteConfig()->getValue('useRewrite'))
			{
				$_tmp_web->getParams()
				$_tmp_web->getURI()
					$this->actionPage = $page;
			$this->actionParam = $param;
			$this->actionParamCustom = $custom_param;
			}
			else
			{
			}
		}
	}

	public function setAction($page, $param = array(), $custom_param = array())
	{
		$this->actionPage = $page;
		$this->actionParam = $param;
		$this->actionParamCustom = $custom_param;
		$this->actionUseString = false;
	}

	public function setActionString($value)
	{
		$this->action = $value;
		$this->actionUseString = true;
	}

	public function getMethod()
	{
		return $this->method;
	}

	public function setMethod($value)
	{
		$this->method = $value;
	}

	public function getStyle()
	{
		return $this->style;
	}

	public function setStyle($value)
	{
		$this->style = $value;
	}

	public function getClass()
	{
		return $this->class;
	}

	public function setClass($value)
	{
		$this->class = $value;
	}

	public function getName()
	{
		return $this->name;
	}

	public function setName($value)
	{
		$this->name = $value;
	}

	public function getId()
	{
		return $this->id;
	}

	public function setId($value)
	{
		$this->id = $value;
	}

	public function getEnctype()
	{
		return $this->enctype;
	}

	public function setEnctype($value)
	{
		$this->enctype = $value;
	}

	public function getOnSubmit()
	{
		return $this->onSubmit;
	}

	public function setOnSubmit($value)
	{
		$this->onSubmit = $value;
	}

	public function getOnMouseOver()
	{
		return $this->onMouseOver;
	}

	public function setOnMouseOver($value)
	{
		$this->onMouseOver = $value;
	}

	public function getOnMouseOut()
	{
		return $this->onMouseOut;
	}

	public function setOnMouseOut($value)
	{
		$this->onMouseOut = $value;
	}

	public function addField($field, $id = null)
	{
		if($field->getType() == self::FIELD_RADIO || $field->getType() == self::FIELD_CHECKBOX)
			if($id == null)
				$this->fields[$field->getName()][] = $field;
			else
				$this->fields[$field->getName()][$id] = $field;
		else
			$this->fields[$field->getName()] = $field;
	}

	public function removeField($name, $id = null)
	{
		if(isset($this->fields[$name]))
			if($id != null)
				@unset($this->fields[$field->getName()][$id]);
			else
				@unset($this->fields[$field->getName()]);
	}

	public function getField($name, $id = null)
	{
		if(isset($this->fields[$name]))
			if($id == null)
				return $this->fields[$name];
			elseif(isset($this->fields[$name][$id]))
				return $this->fields[$name][$id];
			else
				return false;
		else
			return false;
	}

	public function getFields()
	{
		return $this->fields;
	}

	public function setFields($value)
	{
		$this->fields = $value;
	}

	public function getFieldValue($name)
	{
		return $GLOBALS['_' . $this->getMethod()][$name];
	}

	public function isSetFieldValue($name)
	{
		return isset($GLOBALS['_' . $this->getMethod()][$name]);
	}
}

class FormField extends Errors
{
	public $style = '';
	public $class = '';
	public $name = '';
	public $id = '';
	public $value = '';
	public $disabled = false;
	public $onFocus = '';
	public $onBlur = '';
	public $onMouseOver = '';
	public $onMouseOut = '';
	public $onClick = '';
	public $type = Form::FIELD_NONE;


	public function getStyle()
	{
		return $this->style;
	}

	public function setStyle($value)
	{
		$this->style = $value;
	}

	public function getClass()
	{
		return $this->class;
	}

	public function setClass($value)
	{
		$this->class = $value;
	}

	public function getName()
	{
		return $this->name;
	}

	public function setName($value)
	{
		$this->name = $value;
	}

	public function getId()
	{
		return $this->id;
	}

	public function setId($value)
	{
		$this->id = $value;
	}

	public function getValue()
	{
		return $this->value;
	}

	public function setValue($value)
	{
		$this->value = $value;
	}

	public function getDisabled()
	{
		return $this->disabled;
	}

	public function setDisabled($value)
	{
		$this->disabled = $value;
	}

	public function getOnFocus()
	{
		return $this->onFocus;
	}

	public function setOnFocus($value)
	{
		$this->onFocus = $value;
	}

	public function getOnBlur()
	{
		return $this->onBlur;
	}

	public function setOnBlur($value)
	{
		$this->onBlur = $value;
	}

	public function getOnMouseOver()
	{
		return $this->onMouseOver;
	}

	public function setOnMouseOver($value)
	{
		$this->onMouseOver = $value;
	}

	public function getOnMouseOut()
	{
		return $this->onMouseOut;
	}

	public function setOnMouseOut($value)
	{
		$this->onMouseOut = $value;
	}

	public function getOnClick()
	{
		return $this->onClick;
	}

	public function setOnClick($value)
	{
		$this->onClick = $value;
	}

	public function getType()
	{
		return $this->type;
	}

	public function __toString()
	{
		echo 1;
	}
}

class FormField_Text extends FormField
{
	public $type = Form::FIELD_TEXT;
	public $size = 10;
	public $maxlenght = 0;
	public $readonly = false;
}

class FormField_Textarea extends FormField
{
	public $type = Form::FIELD_TEXTAREA;
	public $rows = 1;
	public $cols = 3;
	public $wrap = ''; // off, physical, virtual - it's not valid HTML!
	public $readonly = false;
}

class FormField_Password extends FormField
{
	public $type = Form::FIELD_PASSWORD;
	public $size = 10;
	public $maxlenght = 0;
	public $readonly = false;
}

class FormField_Hidden extends FormField
{
	public $type = Form::FIELD_HIDDEN;

}

class FormField_Checkbox extends FormField
{
	public $type = Form::FIELD_CHECKBOX;
	public $checked = false;
}

class FormField_Radio extends FormField
{
	public $type = Form::FIELD_RADIO;
	public $checked = false;
}

class FormField_Select extends FormField
{
	public $type = Form::FIELD_SELECT;
	public $multiple = false;
	public $size = 0;
	public $onChange = '';
}

class FormField_SelectOption extends FormField
{
	public $type = Form::FIELD_SELECTOPTION;
	public $selected = false;
}

class FormField_Submit extends FormField
{
	public $type = Form::FIELD_SUBMIT;
}

class FormField_Image extends FormField
{
	public $type = Form::FIELD_IMAGE;
	public $src = '';
	public $alt = '';
	public function __toString()
	{

	}
}
?>
 
Yes, but I don't think you quite understood what I was trying to say. You can get the exact same result by using PHP only as you would get from using mod_rewrite in htaccess. Using PHP you are not able to get rid of the filename (e.g. index.php) though and would need .htaccess or a similar system for it.

I made a mistake in my previous post though, I obviously meant $_SERVER['REQUEST_URI'] and not $_SERVER['HTTP_HOST'].
 
Back
Top