Location: PHPKode > projects > PBBoard > PBBoard_v2.1.4/Upload/setup/common.php
<?php

$DIR = dirname( __FILE__ );
$DIR = str_replace('setup','',$DIR);

define('DIR',$DIR . '/');

define('STOP_STYLE',false);
define('JAVASCRIPT_PowerCode',false);
define('INSTALL',true);

if (!is_array($CALL_SYSTEM))
{
	$CALL_SYSTEM = array();
}

$CALL_SYSTEM['GROUP'] 		= 	true;
$CALL_SYSTEM['MEMBER'] 		= 	true;
$CALL_SYSTEM['INFO'] 		= 	true;
$CALL_SYSTEM['SECTION'] 	= 	true;


if (!defined('IN_ADMIN'))
{
	$CALL_SYSTEM['ADS'] 		= 	true;
	$CALL_SYSTEM['ONLINE'] 		= 	true;
	$CALL_SYSTEM['STYLE'] 		= 	true;
    $CALL_SYSTEM['SECTION'] 	= 	true;

}

// Can't live without this file :)
include('../../pbboard.class.php');
// Use the class in this file instead of use (X)HTML directly
include('pbboard_display.class.php');

// The master object
$PowerBB = new PowerBB;

$PowerBB->html = new PowerBBdisplay;

class PowerBBInstall
{
	function add_field($param)
	{
		global $PowerBB;

		$query = $PowerBB->DB->sql_query('ALTER TABLE ' . $param['table'] . ' ADD ' . $param['field_name'] . ' ' . $param['field_des']);

		return ($query) ? true : false;
	}

	 function error($msg,$no_header = false,$no_style = false)
    {
    	global $PowerBB;

    	if (!$no_header and $no_style)
    	{
    		$this->ShowHeader('error');
    	}

  		$this->msg($msg,$no_style);
  		$this->stop($no_style);
 	}

	function rename_field($param)
	{
		global $PowerBB;

		$query = $PowerBB->DB->sql_query('ALTER TABLE ' . $param['old_name'] . ' RENAME ' . $param['new_name']);

		return ($query) ? true : false;
	}

	function drop_field($param)
	{
		global $PowerBB;

		$query = $PowerBB->DB->sql_query("ALTER TABLE " . $param['table_name'] . " DROP " . $param['field_name']);

		return ($query) ? true : false;
	}

	function change_field($param)
	{
		global $PowerBB;

		$query = $PowerBB->DB->sql_query("ALTER TABLE " . $param['table_name'] . " CHANGE " . $param['field_name'] . " " . $param['field_name'] . " " . $param['change']);

		return ($query) ? true : false;
	}

	function create_table($param)
	{
		global $PowerBB;

		$sql_statement = 'CREATE TABLE ' . $param['table_name'] . ' (';

		$x = 0;
		$z = sizeof($param['fields']);

		foreach ($param['fields'] as $f)
		{
			$sql_statement .= $f;

		    if ($x < $z-1)
		    {
		    	$x += 1;

		       	$sql_statement .= ',';
		    }
		}

		$sql_statement .= ') TYPE = MYISAM AUTO_INCREMENT=1';

		$query = $PowerBB->DB->sql_query($sql_statement);

		return ($query) ? true : false;
	}

	function drop_table($table_name)
	{
		global $PowerBB;

		$query = $PowerBB->DB->sql_query("DROP TABLE " . $table_name);

		return ($query) ? true : false;
	}

		function truncate_table($table_name)
	{
		global $PowerBB;

		$query = $PowerBB->DB->sql_query("TRUNCATE TABLE " . $table_name);

		return ($query) ? true : false;
	}

	function rename_table($old,$new)
	{
		global $PowerBB;

		$query = $PowerBB->DB->sql_query("RENAME TABLE " . $old  . " TO " . $new);

		return ($query) ? true : false;
	}

	 function UpdateSectionGroupCache($param)
 	{
  		if (!isset($param)
 			or !is_array($param))
 		{
 			$param = array();
 		}

 		$cache = $this->CreateSectionGroupCache($param);

 		$UpdateArr 									= 	array();
 		$UpdateArr['field']							=	array();
 		$UpdateArr['field']['sectiongroup_cache'] 	= 	$cache;
 		$UpdateArr['where'] 						= 	array('id',$param['id']);

 		$update = $this->Engine->section->UpdateSection($UpdateArr);

 		return ($update) ? true : false;
 	}

   function UpdateSection($param)
 	{
 		if (!isset($param)
 			or !is_array($param))
 		{
 			$param = array();
 		}

		$query = $this->Engine->records->Update($this->Engine->table['section'],$param['field'],$param['where']);

		return ($query) ? true : false;
 	}




}

@header('Content-Type: text/html; charset=UTF-8');
$langchoose = $PowerBB->_POST['lang'].$PowerBB->_GET['lang'];
	if ($langchoose=='en')
	{
	$PowerBB->html->lang 					= 	array();
	$PowerBB->html->lang['direction']		=	'ltr';
	$PowerBB->html->lang['languagecode']	=	'en';
	$PowerBB->html->lang['charset']		=	'UTF-8';
	$PowerBB->html->lang['yes']			=	'Yes';
	$PowerBB->html->lang['align']			=	'left';
	$PowerBB->html->lang['no']			=	'No';
	$PowerBB->html->lang['send']			=	'Continued';
	$PowerBB->html->lang['reset']			=	'reset fields';
	}
	elseif ($langchoose=='ar')
	{
	$PowerBB->html->lang 					= 	array();
	$PowerBB->html->lang['direction']		=	'rtl';
	$PowerBB->html->lang['languagecode']	=	'ar';
	$PowerBB->html->lang['charset']		=	'UTF-8';
	$PowerBB->html->lang['yes']			=	'نعم';
	$PowerBB->html->lang['align']			=	'right';
	$PowerBB->html->lang['no']			=	'لا';
	$PowerBB->html->lang['send']			=	'استكمال..';
	$PowerBB->html->lang['reset']			=	'اعادة الحقول';
	}
	else
	{
	$PowerBB->html->lang 					= 	array();
	$PowerBB->html->lang['direction']		=	'rtl';
	$PowerBB->html->lang['languagecode']	=	'en';
	$PowerBB->html->lang['charset']		=	'UTF-8';
	$PowerBB->html->lang['yes']			=	'نعم';
	$PowerBB->html->lang['align']			=	'right';
	$PowerBB->html->lang['no']			=	'لا';
	$PowerBB->html->lang['send']			=	'موافق - Continued';
	$PowerBB->html->lang['reset']			=	'اعادة الحقول';
    }
$PowerBB->html->stylesheet = '../../setup/setup.css';

?>
Return current item: PBBoard