Added in class member variables, fixed warnings about undefined values, prettied up the code to Campware coding conventions.
This commit is contained in:
parent
601d88fe37
commit
5b86229054
1 changed files with 206 additions and 109 deletions
|
@ -20,32 +20,30 @@ function errCallBack($err)
|
||||||
|
|
||||||
function _getLanguages()
|
function _getLanguages()
|
||||||
{
|
{
|
||||||
$languages =& $_SESSION[UI_LOCALIZATION_SESSNAME]['languages'];
|
$languages =& $_SESSION[UI_LOCALIZER_SESSNAME]['languages'];
|
||||||
|
|
||||||
if (!is_array($languages)) {
|
if (!is_array($languages)) {
|
||||||
include_once dirname(__FILE__).'/localizer/loader.inc.php';
|
include_once dirname(__FILE__).'/localizer/loader.inc.php';
|
||||||
foreach (getLanguages() as $k => $lang) {
|
foreach (getLanguages() as $k => $lang) {
|
||||||
$languages[$lang->m_languageId] = $lang->m_nativeName;
|
$languages[$lang->m_languageId] = $lang->m_nativeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $languages;
|
return $languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tra
|
|
||||||
*
|
|
||||||
* Translate the given string using localisation files.
|
* Translate the given string using localisation files.
|
||||||
*
|
*
|
||||||
* @param input string, string to translate
|
* @param string $input - string to translate
|
||||||
* @return string, translated string
|
* @return string, translated string
|
||||||
*/
|
*/
|
||||||
function tra($input)
|
function tra($input)
|
||||||
{
|
{
|
||||||
global $uiBase;
|
global $uiBase;
|
||||||
|
|
||||||
if (UI_LOCALIZER_SESSNAME) {
|
if (defined(UI_LOCALIZER_SESSNAME)) {
|
||||||
$GS =& $_SESSION[UI_LOCALIZATION_SESSNAME]['GS'];
|
$GS =& $_SESSION[UI_LOCALIZER_SESSNAME]['GS'];
|
||||||
} else {
|
} else {
|
||||||
static $GS;
|
static $GS;
|
||||||
}
|
}
|
||||||
|
@ -54,23 +52,24 @@ function tra($input)
|
||||||
#echo "load translation";
|
#echo "load translation";
|
||||||
include_once dirname(__FILE__).'/localizer/loader.inc.php';
|
include_once dirname(__FILE__).'/localizer/loader.inc.php';
|
||||||
#echo $uiBase->langid;
|
#echo $uiBase->langid;
|
||||||
$GS = loadTranslations($uiBase->langid);
|
$GS = loadTranslations($uiBase->langid);
|
||||||
#print_r($GS);
|
#print_r($GS);
|
||||||
}
|
}
|
||||||
## end init ####################################
|
## end init ####################################
|
||||||
|
|
||||||
if ($GS[$input])
|
if (isset($GS[$input]) && !empty($GS[$input])) {
|
||||||
$input = $GS[$input];
|
$input = $GS[$input];
|
||||||
|
}
|
||||||
$nr = func_num_args();
|
$nr = func_num_args();
|
||||||
if ($nr > 1)
|
if ($nr > 1) {
|
||||||
for ($i = 1; $i < $nr; $i++){
|
for ($i = 1; $i < $nr; $i++){
|
||||||
$name = '$'.$i;
|
$name = '$'.$i;
|
||||||
$val = func_get_arg($i);
|
$val = func_get_arg($i);
|
||||||
$input = str_replace($name, $val, $input);
|
$input = str_replace($name, $val, $input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $input;
|
return $input;
|
||||||
}
|
} // fn tra
|
||||||
|
|
||||||
|
|
||||||
function _getDArr($format)
|
function _getDArr($format)
|
||||||
|
@ -92,7 +91,8 @@ function _getDArr($format)
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
} // fn _getDArr
|
||||||
|
|
||||||
|
|
||||||
function _getNumArr($start, $end, $step=1)
|
function _getNumArr($start, $end, $step=1)
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,8 @@ function _getNumArr($start, $end, $step=1)
|
||||||
$arr[$n] = $n;
|
$arr[$n] = $n;
|
||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
} // fn _getNumArr
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uiBase class
|
* uiBase class
|
||||||
|
@ -122,6 +123,31 @@ class uiBase
|
||||||
*/
|
*/
|
||||||
var $redirUrl;
|
var $redirUrl;
|
||||||
var $alertMsg;
|
var $alertMsg;
|
||||||
|
var $dbc;
|
||||||
|
var $gb; // GreenBox
|
||||||
|
var $config;
|
||||||
|
var $sessid;
|
||||||
|
var $userid;
|
||||||
|
var $login;
|
||||||
|
var $langid;
|
||||||
|
var $id;
|
||||||
|
var $pid;
|
||||||
|
var $type;
|
||||||
|
var $fid;
|
||||||
|
var $homeid;
|
||||||
|
var $InputTextStandardAttrib;
|
||||||
|
var $STATIONPREFS;
|
||||||
|
var $SCRATCHPAD;
|
||||||
|
var $SEARCH;
|
||||||
|
var $BROWSE;
|
||||||
|
var $HUBBROWSE;
|
||||||
|
var $HUBSEARCH;
|
||||||
|
var $PLAYLIST;
|
||||||
|
var $SCHEDULER;
|
||||||
|
var $SUBJECTS;
|
||||||
|
var $EXCHANGE;
|
||||||
|
var $TRANSFERS;
|
||||||
|
var $_self_;
|
||||||
|
|
||||||
function uiBase(&$config)
|
function uiBase(&$config)
|
||||||
{
|
{
|
||||||
|
@ -135,18 +161,30 @@ class uiBase
|
||||||
|
|
||||||
$this->config['accessRawAudioUrl'] = $config['storageUrlPath'].'/xmlrpc/simpleGet.php';
|
$this->config['accessRawAudioUrl'] = $config['storageUrlPath'].'/xmlrpc/simpleGet.php';
|
||||||
|
|
||||||
$this->sessid = $_REQUEST[$config['authCookieName']];
|
$this->sessid = isset($_REQUEST[$config['authCookieName']]) ?
|
||||||
|
$_REQUEST[$config['authCookieName']] : null;
|
||||||
$this->userid = $this->gb->getSessUserId($this->sessid);
|
$this->userid = $this->gb->getSessUserId($this->sessid);
|
||||||
$this->login = $this->gb->getSessLogin($this->sessid);
|
$this->login = $this->gb->getSessLogin($this->sessid);
|
||||||
|
if (PEAR::isError($this->login)) {
|
||||||
|
$this->login = null;
|
||||||
|
}
|
||||||
$this->langid =& $_SESSION['langid'];
|
$this->langid =& $_SESSION['langid'];
|
||||||
|
|
||||||
$this->id = $_REQUEST['id'] ? $_REQUEST['id'] : $this->gb->getObjId($this->login, $this->gb->storId);
|
if (!is_null($this->login)) {
|
||||||
$this->pid = $this->gb->getparent($this->id) != 1 ? $this->gb->getparent($this->id) : FALSE;
|
if (isset($_REQUEST['id'])) {
|
||||||
$this->type = $this->gb->getFileType($this->id);
|
$this->id = $_REQUEST['id'];
|
||||||
$this->fid = $this->type=='Folder' ? $this->id : $this->pid;
|
} else {
|
||||||
$this->homeid = $this->gb->getObjId($this->login, $this->gb->storId);
|
$this->id = $this->gb->getObjId($this->login, $this->gb->storId);
|
||||||
$this->InputTextStandardAttrib = array('size' =>UI_INPUT_STANDARD_SIZE,
|
}
|
||||||
'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH);
|
$this->pid = $this->gb->getparent($this->id) != 1 ?
|
||||||
|
$this->gb->getparent($this->id) : FALSE;
|
||||||
|
$this->type = $this->gb->getFileType($this->id);
|
||||||
|
$this->fid = ($this->type == 'Folder') ? $this->id : $this->pid;
|
||||||
|
$this->homeid = $this->gb->getObjId($this->login, $this->gb->storId);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->InputTextStandardAttrib = array('size'=>UI_INPUT_STANDARD_SIZE,
|
||||||
|
'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH);
|
||||||
$this->STATIONPREFS =& $_SESSION[UI_STATIONINFO_SESSNAME];
|
$this->STATIONPREFS =& $_SESSION[UI_STATIONINFO_SESSNAME];
|
||||||
$this->SCRATCHPAD =& new uiScratchPad($this);
|
$this->SCRATCHPAD =& new uiScratchPad($this);
|
||||||
$this->SEARCH =& new uiSearch($this);
|
$this->SEARCH =& new uiSearch($this);
|
||||||
|
@ -159,16 +197,21 @@ class uiBase
|
||||||
$this->EXCHANGE =& new uiExchange($this);
|
$this->EXCHANGE =& new uiExchange($this);
|
||||||
$this->TRANSFERS =& new uiTransfers($this);
|
$this->TRANSFERS =& new uiTransfers($this);
|
||||||
$this->_self_ =& $this;
|
$this->_self_ =& $this;
|
||||||
}
|
} // fn uiBase
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load system preferences.
|
||||||
|
*
|
||||||
|
* @param array $mask
|
||||||
|
* @param boolean $reload
|
||||||
|
*/
|
||||||
function loadStationPrefs(&$mask, $reload=FALSE)
|
function loadStationPrefs(&$mask, $reload=FALSE)
|
||||||
{
|
{
|
||||||
if (!is_array($this->STATIONPREFS) || $reload===TRUE) {
|
if (!is_array($this->STATIONPREFS) || ($reload === TRUE) ) {
|
||||||
$this->STATIONPREFS = array();
|
$this->STATIONPREFS = array();
|
||||||
foreach ($mask as $key=>$val) {
|
foreach ($mask as $key => $val) {
|
||||||
if ($val['isPref']) {
|
if (isset($val['isPref']) && $val['isPref']) {
|
||||||
if (is_string($setting = $this->gb->loadGroupPref(NULL, 'StationPrefs', $val['element']))) {
|
if (is_string($setting = $this->gb->loadGroupPref(NULL, 'StationPrefs', $val['element']))) {
|
||||||
$this->STATIONPREFS[$val['element']] = $setting;
|
$this->STATIONPREFS[$val['element']] = $setting;
|
||||||
} elseif ($val['required']){
|
} elseif ($val['required']){
|
||||||
|
@ -179,7 +222,7 @@ class uiBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // fn loadStationPrefs
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,47 +230,76 @@ class uiBase
|
||||||
*
|
*
|
||||||
* Add elements/rules/groups to an given HTML_QuickForm object
|
* Add elements/rules/groups to an given HTML_QuickForm object
|
||||||
*
|
*
|
||||||
* @param form object, reference to HTML_QuickForm object
|
* @param HTML_Quickform $form - reference to HTML_QuickForm object
|
||||||
* @param mask array, reference to array defining to form elements
|
* @param array $mask - reference to array defining the form elements
|
||||||
* @param side string, side where the validation should beeing
|
* @param string $side - can be 'client' or 'server' - this is where the form validation occurs.
|
||||||
*/
|
*/
|
||||||
function _parseArr2Form(&$form, &$mask, $side='client')
|
function _parseArr2Form(&$form, &$mask, $side='client')
|
||||||
{
|
{
|
||||||
foreach($mask as $k=>$v) {
|
foreach ($mask as $v) {
|
||||||
|
$attrs = isset($v['attributes']) ? $v['attributes'] : null;
|
||||||
|
$type = isset($v['type']) ? $v['type'] : null;
|
||||||
|
$label = isset($v['label']) ? tra($v['label']) : '';
|
||||||
|
$required = (isset($v['required']) && $v['required']);
|
||||||
|
$groupit = (isset($v['groupit']) && $v['groupit']);
|
||||||
|
|
||||||
## add elements ########################
|
## add elements ########################
|
||||||
if ($v['type']=='radio') {
|
if ($type == 'radio') {
|
||||||
foreach($v['options'] as $rk=>$rv) {
|
foreach ($v['options'] as $textLabel => $radioValue) {
|
||||||
$radio[] =& $form->createElement($v['type'], NULL, NULL, $rv, $rk, $v['attributes']);
|
$radio[] =& $form->createElement($type, NULL, NULL, $textLabel, $radioValue, $attrs);
|
||||||
}
|
}
|
||||||
$form->addGroup($radio, $v['element'], tra($v['label']));
|
$form->addGroup($radio, $v['element'], $label);
|
||||||
unset($radio);
|
unset($radio);
|
||||||
|
} elseif ($type == 'select') {
|
||||||
|
$elem[$v['element']] =& $form->createElement($type, $v['element'], $label, $v['options'], $attrs);
|
||||||
|
|
||||||
} elseif ($v['type']=='select') {
|
$multiple = isset($v['multiple']) && $v['multiple'];
|
||||||
$elem[$v['element']] =& $form->createElement($v['type'], $v['element'], tra($v['label']), $v['options'], $v['attributes']);
|
$elem[$v['element']]->setMultiple($multiple);
|
||||||
$elem[$v['element']]->setMultiple($v['multiple']);
|
|
||||||
if (isset($v['selected'])) $elem[$v['element']]->setSelected($v['selected']);
|
|
||||||
if (!$v['groupit']) $form->addElement($elem[$v['element']]);
|
|
||||||
|
|
||||||
} elseif ($v['type']=='date') {
|
if (isset($v['selected'])) {
|
||||||
$elem[$v['element']] =& $form->createElement($v['type'], $v['element'], tra($v['label']), $v['options'], $v['attributes']);
|
$elem[$v['element']]->setSelected($v['selected']);
|
||||||
if (!$v['groupit']) $form->addElement($elem[$v['element']]);
|
}
|
||||||
|
if (!$groupit) {
|
||||||
|
$form->addElement($elem[$v['element']]);
|
||||||
|
}
|
||||||
|
} elseif ($type == 'date') {
|
||||||
|
$elem[$v['element']] =& $form->createElement($type, $v['element'], $label, $v['options'], $attrs);
|
||||||
|
if (!$groupit) {
|
||||||
|
$form->addElement($elem[$v['element']]);
|
||||||
|
}
|
||||||
|
} elseif ( ($type == 'checkbox') || ($type == 'static') ) {
|
||||||
|
$elem[$v['element']] =& $form->createElement($type, $v['element'], $label, tra($v['text']), $attrs);
|
||||||
|
if (!$groupit) {
|
||||||
|
$form->addElement($elem[$v['element']]);
|
||||||
|
}
|
||||||
|
} elseif (!is_null($type)) {
|
||||||
|
if (is_null($attrs)) {
|
||||||
|
$attrs = array();
|
||||||
|
}
|
||||||
|
if (in_array($type, array('text','file','password'))) {
|
||||||
|
$addAttrs = array('size' => UI_INPUT_STANDARD_SIZE,
|
||||||
|
'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH);
|
||||||
|
$attrs = array_merge($addAttrs, $attrs);
|
||||||
|
} elseif ($type=='textarea') {
|
||||||
|
$addAttrs = array('rows'=>UI_TEXTAREA_STANDART_ROWS,
|
||||||
|
'cols'=>UI_TEXTAREA_STANDART_COLS);
|
||||||
|
$attrs = array_merge($addAttrs, $attrs);
|
||||||
|
} elseif (in_array($type, array('button', 'submit', 'reset'))) {
|
||||||
|
$addAttrs = array('class'=>UI_BUTTON_STYLE);
|
||||||
|
$attrs = array_merge($addAttrs, $attrs);
|
||||||
|
}
|
||||||
|
|
||||||
} elseif ($v['type']=='checkbox' || $v['type']=='static') {
|
$elem[$v['element']] =& $form->createElement($type,
|
||||||
$elem[$v['element']] =& $form->createElement($v['type'], $v['element'], tra($v['label']), tra($v['text']), $v['attributes']);
|
$v['element'],
|
||||||
if (!$v['groupit']) $form->addElement($elem[$v['element']]);
|
$label,
|
||||||
|
$attrs);
|
||||||
} elseif (isset($v['type'])) {
|
if (!$groupit) {
|
||||||
if (!is_array($v['attributes'])) $v['attributes'] = array();
|
$form->addElement($elem[$v['element']]);
|
||||||
$elem[$v['element']] =& $form->createElement($v['type'], $v['element'], tra($v['label']),
|
}
|
||||||
($v[type]=='text' || $v['type']=='file' || $v['type']=='password') ? array_merge(array('size'=>UI_INPUT_STANDARD_SIZE, 'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH), $v['attributes']) :
|
|
||||||
($v['type']=='textarea' ? array_merge(array('rows'=>UI_TEXTAREA_STANDART_ROWS, 'cols'=>UI_TEXTAREA_STANDART_COLS), $v['attributes']) :
|
|
||||||
($v['type']=='button' || $v['type']=='submit' || $v['type']=='reset' ? array_merge(array('class'=>UI_BUTTON_STYLE), $v['attributes']) : $v['attributes']))
|
|
||||||
);
|
|
||||||
if (!$v['groupit']) $form->addElement($elem[$v['element']]);
|
|
||||||
}
|
}
|
||||||
## add required rule ###################
|
## add required rule ###################
|
||||||
if ($v['required']) {
|
if ($required) {
|
||||||
$form->addRule($v['element'], isset($v['requiredmsg']) ? tra($v['requiredmsg']) : tra('Missing value for $1', tra($v['label'])), 'required', NULL, $side);
|
$form->addRule($v['element'], isset($v['requiredmsg']) ? tra($v['requiredmsg']) : tra('Missing value for $1', $label), 'required', NULL, $side);
|
||||||
}
|
}
|
||||||
## add constant value ##################
|
## add constant value ##################
|
||||||
if (isset($v['constant'])) {
|
if (isset($v['constant'])) {
|
||||||
|
@ -238,46 +310,47 @@ class uiBase
|
||||||
$form->setDefaults(array($v['element']=>$v['default']));
|
$form->setDefaults(array($v['element']=>$v['default']));
|
||||||
}
|
}
|
||||||
## add other rules #####################
|
## add other rules #####################
|
||||||
if ($v['rule']) {
|
if (isset($v['rule']) && $v['rule']) {
|
||||||
$form->addRule($v['element'], isset($v['rulemsg']) ? tra($v['rulemsg']) : tra('$1 must be $2', tra($v['element']), tra($v['rule'])), $v['rule'] ,$v['format'], $side);
|
$form->addRule($v['element'], isset($v['rulemsg']) ? tra($v['rulemsg']) : tra('$1 must be $2', tra($v['element']), tra($v['rule'])), $v['rule'] ,$v['format'], $side);
|
||||||
}
|
}
|
||||||
## add group ###########################
|
## add group ###########################
|
||||||
if (is_array($v['group'])) {
|
if (isset($v['group']) && is_array($v['group'])) {
|
||||||
foreach($v['group'] as $val) {
|
foreach ($v['group'] as $val) {
|
||||||
$groupthose[] =& $elem[$val];
|
$groupthose[] =& $elem[$val];
|
||||||
}
|
}
|
||||||
$form->addGroup($groupthose, $v['name'], tra($v['label']), $v['seperator'], $v['appendName']);
|
$groupName = isset($v['name']) ? $v['name'] : null;
|
||||||
if ($v['rule']) {
|
$seperator = isset($v['seperator']) ? $v['seperator'] : null;
|
||||||
|
$appendName = isset($v['appendName']) ? $v['appendName'] : null;
|
||||||
|
$form->addGroup($groupthose, $groupName, $label, $seperator, $appendName);
|
||||||
|
if (isset($v['rule']) && $v['rule']) {
|
||||||
$form->addRule($v['name'], isset($v['rulemsg']) ? tra($v['rulemsg']) : tra('$1 must be $2', tra($v['name'])), $v['rule'], $v['format'], $side);
|
$form->addRule($v['name'], isset($v['rulemsg']) ? tra($v['rulemsg']) : tra('$1 must be $2', tra($v['name'])), $v['rule'], $v['format'], $side);
|
||||||
}
|
}
|
||||||
if ($v['grouprule']) {
|
if (isset($v['grouprule']) && $v['grouprule']) {
|
||||||
$form->addGroupRule($v['name'], $v['arg1'], $v['grouprule'], $v['format'], $v['howmany'], $side, $v['reset']);
|
$form->addGroupRule($v['name'], $v['arg1'], $v['grouprule'], $v['format'], $v['howmany'], $side, $v['reset']);
|
||||||
}
|
}
|
||||||
unset($groupthose);
|
unset($groupthose);
|
||||||
}
|
}
|
||||||
## check error on type file ##########
|
## check error on type file ##########
|
||||||
if ($v['type']=='file') {
|
if ($type == 'file') {
|
||||||
if ($_POST[$v['element']]['error']) {
|
if (isset($_POST[$v['element']]['error'])) {
|
||||||
$form->setElementError($v['element'], isset($v['requiredmsg']) ? tra($v['requiredmsg']) : tra('Missing value for $1', tra($v['label'])));
|
$form->setElementError($v['element'], isset($v['requiredmsg']) ? tra($v['requiredmsg']) : tra('Missing value for $1', $label));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reset($mask);
|
reset($mask);
|
||||||
$form->validate();
|
$form->validate();
|
||||||
}
|
} // fn _parseArr2Form
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _dateArr2Str
|
* Converts date-array from form into string
|
||||||
*
|
*
|
||||||
* Converts date-array from form into string
|
* @param array $input - array of form-elements
|
||||||
*
|
|
||||||
* @param input array, array of form-elements
|
|
||||||
*/
|
*/
|
||||||
function _dateArr2Str(&$input)
|
function _dateArr2Str(&$input)
|
||||||
{
|
{
|
||||||
foreach ($input as $k=>$v){
|
foreach ($input as $k => $v){
|
||||||
if (is_array($v)) {
|
if (is_array($v)) {
|
||||||
if ( ( isset($v['d']) ) && ( isset($v['M']) || isset($v['m']) ) && ( isset($v['Y']) || isset($v['y']) ) ) {
|
if ( ( isset($v['d']) ) && ( isset($v['M']) || isset($v['m']) ) && ( isset($v['Y']) || isset($v['y']) ) ) {
|
||||||
$input[$k] = $v['Y'].$v['y'].'-'.sprintf('%02d', $v['M'].$v['m']).'-'.sprintf('%02d', $v['d']);
|
$input[$k] = $v['Y'].$v['y'].'-'.sprintf('%02d', $v['M'].$v['m']).'-'.sprintf('%02d', $v['d']);
|
||||||
|
@ -289,16 +362,14 @@ class uiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
return $input;
|
return $input;
|
||||||
}
|
} // fn _dateArr2Str
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _analyzeFile
|
|
||||||
*
|
|
||||||
* Call getid3 library to analyze media file and show some results
|
* Call getid3 library to analyze media file and show some results
|
||||||
*
|
*
|
||||||
* @param $id int local ID of file
|
* @param int $id local ID of file
|
||||||
* @param $format string
|
* @param string $format
|
||||||
*/
|
*/
|
||||||
function _analyzeFile($id, $format)
|
function _analyzeFile($id, $format)
|
||||||
{
|
{
|
||||||
|
@ -322,34 +393,48 @@ class uiBase
|
||||||
<dcterms:extent>'.$extent.'</dcterms:extent>
|
<dcterms:extent>'.$extent.'</dcterms:extent>
|
||||||
</metadata>
|
</metadata>
|
||||||
</audioClip>';
|
</audioClip>';
|
||||||
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
} // fn _analyzeFile
|
||||||
|
|
||||||
|
|
||||||
function _toHex($gunid)
|
function _toHex($gunid)
|
||||||
{
|
{
|
||||||
$res = $this->dbc->query("SELECT to_hex($gunid)");
|
$res = $this->dbc->query("SELECT to_hex($gunid)");
|
||||||
$row = $res->fetchRow();
|
$row = $res->fetchRow();
|
||||||
|
|
||||||
return $row['to_hex'];
|
return $row['to_hex'];
|
||||||
}
|
} // fn _toHex
|
||||||
|
|
||||||
|
|
||||||
function _toInt8($gunid)
|
function _toInt8($gunid)
|
||||||
{
|
{
|
||||||
$res = $this->dbc->query("SELECT x'$gunid'::bigint");
|
$res = $this->dbc->query("SELECT x'$gunid'::bigint");
|
||||||
$row = $res->fetchRow();
|
$row = $res->fetchRow();
|
||||||
|
|
||||||
return $row['int8'];
|
return $row['int8'];
|
||||||
}
|
} // fn _toInt8
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an alert message to the session var.
|
||||||
|
*
|
||||||
|
* @param string $msg
|
||||||
|
* @param string $p1
|
||||||
|
* @param string $p2
|
||||||
|
* @param string $p3
|
||||||
|
* @param string $p4
|
||||||
|
* @param string $p5
|
||||||
|
* @param string $p6
|
||||||
|
* @param string $p7
|
||||||
|
* @param string $p8
|
||||||
|
* @param string $p9
|
||||||
|
*/
|
||||||
function _retMsg($msg, $p1=NULL, $p2=NULL, $p3=NULL, $p4=NULL, $p5=NULL, $p6=NULL, $p7=NULL, $p8=NULL, $p9=NULL)
|
function _retMsg($msg, $p1=NULL, $p2=NULL, $p3=NULL, $p4=NULL, $p5=NULL, $p6=NULL, $p7=NULL, $p8=NULL, $p9=NULL)
|
||||||
{
|
{
|
||||||
|
if (!isset($_SESSION['alertMsg'])) {
|
||||||
|
$_SESSION['alertMsg'] = '';
|
||||||
|
}
|
||||||
$_SESSION['alertMsg'] .= tra($msg, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9).'\n';
|
$_SESSION['alertMsg'] .= tra($msg, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9).'\n';
|
||||||
}
|
} // fn _retMsg
|
||||||
|
|
||||||
|
|
||||||
function _getMetaInfo($id)
|
function _getMetaInfo($id)
|
||||||
|
@ -364,34 +449,45 @@ class uiBase
|
||||||
#'isAvailable' => $type == 'playlist' ? $this->gb->playlistIsAvailable($id, $this->sessid) : NULL,
|
#'isAvailable' => $type == 'playlist' ? $this->gb->playlistIsAvailable($id, $this->sessid) : NULL,
|
||||||
);
|
);
|
||||||
return ($data);
|
return ($data);
|
||||||
}
|
} // fn _getMetaInfo
|
||||||
|
|
||||||
|
|
||||||
function _getMDataValue($id, $key, $langid=NULL, $deflangid=UI_DEFAULT_LANGID)
|
function _getMDataValue($id, $key, $langid=NULL, $deflangid=UI_DEFAULT_LANGID)
|
||||||
{
|
{
|
||||||
if (!$langid) $langid = $_SESSION['langid'];
|
if (!$langid) {
|
||||||
|
$langid = $_SESSION['langid'];
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($arr = $this->gb->getMDataValue($id, $key, $this->sessid, $langid, $deflangid))) {
|
if (is_array($arr = $this->gb->getMDataValue($id, $key, $this->sessid, $langid, $deflangid))) {
|
||||||
$value = current($arr);
|
$value = current($arr);
|
||||||
return $value['value'];
|
return $value['value'];
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
} // fn _getMDataValue
|
||||||
|
|
||||||
|
|
||||||
function _setMDataValue($id, $key, $value, $langid=NULL)
|
function _setMDataValue($id, $key, $value, $langid=NULL)
|
||||||
{
|
{
|
||||||
if (!$langid) $langid = UI_DEFAULT_LANGID;
|
if (!$langid) {
|
||||||
if (ini_get('magic_quotes_gpc')) $value = str_replace("\'", "'", $value);
|
$langid = UI_DEFAULT_LANGID;
|
||||||
|
}
|
||||||
|
if (ini_get('magic_quotes_gpc')) {
|
||||||
|
$value = str_replace("\'", "'", $value);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->gb->setMDataValue($id, $key, $this->sessid, $value, $langid)) {
|
if ($this->gb->setMDataValue($id, $key, $this->sessid, $value, $langid)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
} // fn _setMDataValue
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter description here...
|
||||||
|
*
|
||||||
|
* @param unknown_type $id
|
||||||
|
* @return string/FALSE
|
||||||
|
*/
|
||||||
function _getFileTitle($id)
|
function _getFileTitle($id)
|
||||||
{
|
{
|
||||||
if (is_array($arr = $this->gb->getPath($id))) {
|
if (is_array($arr = $this->gb->getPath($id))) {
|
||||||
|
@ -399,7 +495,7 @@ class uiBase
|
||||||
return $file['name'];
|
return $file['name'];
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
} // fn _getFileTitle
|
||||||
|
|
||||||
|
|
||||||
function _isFolder($id)
|
function _isFolder($id)
|
||||||
|
@ -408,7 +504,7 @@ class uiBase
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
} // fn _isFolder
|
||||||
|
|
||||||
|
|
||||||
function _formElementEncode($str)
|
function _formElementEncode($str)
|
||||||
|
@ -416,7 +512,7 @@ class uiBase
|
||||||
$str = str_replace(':', '__', $str);
|
$str = str_replace(':', '__', $str);
|
||||||
#$str = str_replace('.', '_', $str);
|
#$str = str_replace('.', '_', $str);
|
||||||
return $str;
|
return $str;
|
||||||
}
|
} // fn _formElementEncode
|
||||||
|
|
||||||
|
|
||||||
function _formElementDecode($str)
|
function _formElementDecode($str)
|
||||||
|
@ -424,6 +520,7 @@ class uiBase
|
||||||
$str = str_replace('__', ':', $str);
|
$str = str_replace('__', ':', $str);
|
||||||
#$str = str_replace('_', '.', $str);
|
#$str = str_replace('_', '.', $str);
|
||||||
return $str;
|
return $str;
|
||||||
}
|
} // fn _formElementDecode
|
||||||
}
|
|
||||||
|
} // class uiBase
|
||||||
?>
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue