<?php
// QuickTalk 2.5 build:20100924
class cLang
{
// --------
function Add($strType='',$strLang='en',$strId='',$strName='',$bCheck=false)
{
// Check
if ( !is_string($strType) || empty($strType) ) die('cLang->Add: Argument #1 must be a string');
if ( !is_string($strLang) || empty($strLang) ) die('cLang->Add: Argument #2 must be a string');
if ( !is_string($strId) || empty($strId) ) die('cLang->Add: Argument #3 must be a string');
if ( !is_string($strName) || empty($strName) ) die('cLang->Add: Argument #4 must be a string');
// Process
global $oDB;
if ( $bCheck )
{
$oDB->Query('SELECT count(objid) AS countid FROM '.TABLANG.' WHERE objtype="'.$strType.'" AND objlang="'.strtolower($strLang).'" AND objid="'.$strId.'"');
$row=$oDB->Getrow();
if ( $row['countid']!=0 ) return False;
}
$oDB->Query('INSERT INTO '.TABLANG.' (objtype,objlang,objid,objname) VALUES ("'.$strType.'","'.strtolower($strLang).'","'.$strId.'","'.addslashes(QTconv($strName,'5',QTF_CONVERT_AMP,false)).'")');
return true;
}
// --------
function Delete($strType='',$strId='')
{
// Check
if ( is_array($strType) ) $strType = implode('" OR objtype="',$strType);
if ( !is_string($strType) || empty($strType) ) die('cLang->Delete: Argument #1 must be a string');
if ( !is_string($strId) || empty($strId) ) die('cLang->Delete: Argument #2 must be a string');
// Process
global $oDB;
$oDB->Query( 'DELETE FROM '.TABLANG.' WHERE (objtype="'.$strType.'") AND objid="'.$strId.'"' );
}
// --------
}
?>