diff --git a/campcaster/src/modules/htmlUI/var/html/ui_browser.php b/campcaster/src/modules/htmlUI/var/html/ui_browser.php index 31e228d2e..2d4341af2 100644 --- a/campcaster/src/modules/htmlUI/var/html/ui_browser.php +++ b/campcaster/src/modules/htmlUI/var/html/ui_browser.php @@ -72,7 +72,7 @@ if (isset($_REQUEST['popup']) && is_array($_REQUEST['popup'])){ $Smarty->assign('filecount', count($_REQUEST['id'])); $Smarty->assign('idstr', $idstr); } else { - $Smarty->assign('filename', $uiBrowser->_getMDataValue($_REQUEST['id'], UI_MDATA_KEY_TITLE)); + $Smarty->assign('filename', $uiBrowser->getMetadataValue($_REQUEST['id'], UI_MDATA_KEY_TITLE)); } $Smarty->display('popup/deleteItem.tpl'); break; @@ -140,7 +140,7 @@ if (isset($_REQUEST['popup']) && is_array($_REQUEST['popup'])){ break; case "SCHEDULER.removeItem": - $Smarty->assign('playlistName', $uiBrowser->_getMDataValue($_REQUEST['playlistId'], UI_MDATA_KEY_TITLE)); + $Smarty->assign('playlistName', $uiBrowser->getMetadataValue($_REQUEST['playlistId'], UI_MDATA_KEY_TITLE)); $Smarty->display('popup/SCHEDULER.removeItem.tpl'); break; @@ -214,19 +214,21 @@ if (isset($_REQUEST['popup']) && is_array($_REQUEST['popup'])){ break; case 'HUBBROWSE.getResults': + $HUBBROWSE = new uiHubBrowse($uiBrowser); + if (isset($_REQUEST['trtokid'])) { - $Smarty->assign('trtokid',$_REQUEST['trtokid']); - if ($uiBrowser->HUBBROWSE->getSearchResults($_REQUEST['trtokid'])) { - $Smarty->assign('results',true); + $Smarty->assign('trtokid', $_REQUEST['trtokid']); + if ($HUBBROWSE->getSearchResults($_REQUEST['trtokid'])) { + $Smarty->assign('results', true); } else { - $Smarty->assign('results',false); + $Smarty->assign('results', false); } } else { - $Smarty->assign('trtokid',$uiBrowser->HUBBROWSE->searchDB()); - $Smarty->assign('results',false); + $Smarty->assign('trtokid', $HUBBROWSE->searchDB()); + $Smarty->assign('results', false); } - $Smarty->assign('polling_frequency',UI_HUB_POLLING_FREQUENCY); - $Smarty->assign('_prefix','HUBBROWSE'); + $Smarty->assign('polling_frequency', UI_HUB_POLLING_FREQUENCY); + $Smarty->assign('_prefix', 'HUBBROWSE'); $Smarty->display('popup/HUB.getResults.tpl'); break; @@ -320,7 +322,8 @@ if ($uiBrowser->userid) { break; case "HUBBROWSE": - $Smarty->assign('hubBrowseForm', $uiBrowser->HUBBROWSE->browseForm($uiBrowser->id, $ui_fmask)); + $HUBBROWSE = new uiHubBrowse($uiBrowser); + $Smarty->assign('hubBrowseForm', $HUBBROWSE->browseForm($uiBrowser->id, $ui_fmask)); $Smarty->assign('showLibrary', TRUE); $Smarty->assign('isHub', TRUE); break; @@ -341,7 +344,7 @@ if ($uiBrowser->userid) { break; case "_analyzeFile": - $Smarty->assign('_analyzeFile', $uiBrowser->_analyzeFile($uiBrowser->id, 'text')); + $Smarty->assign('_analyzeFile', $uiBrowser->analyzeFile($uiBrowser->id, 'text')); $Smarty->assign('showFile', TRUE); break; diff --git a/campcaster/src/modules/htmlUI/var/html/ui_handler.php b/campcaster/src/modules/htmlUI/var/html/ui_handler.php index c26431489..91a3daac1 100644 --- a/campcaster/src/modules/htmlUI/var/html/ui_handler.php +++ b/campcaster/src/modules/htmlUI/var/html/ui_handler.php @@ -1,6 +1,10 @@ HUBBROWSE->setCategory($_REQUEST); + $HUBBROWSE->setCategory($_REQUEST); break; case "HUBBROWSE.setValue": - $uiHandler->HUBBROWSE->setValue($_REQUEST); + $HUBBROWSE->setValue($_REQUEST); break; case "HUBBROWSE.reOrder": - $uiHandler->HUBBROWSE->reOrder($_REQUEST['by']); + $HUBBROWSE->reOrder($_REQUEST['by']); break; case "HUBBROWSE.setDefaults": - $uiHandler->HUBBROWSE->setDefaults(TRUE); + $HUBBROWSE->setDefaults(TRUE); break; case "HUBBROWSE.setOffset": - $uiHandler->HUBBROWSE->setOffset($_REQUEST['page']); + $HUBBROWSE->setOffset($_REQUEST['page']); break; case "HUBBROWSE.setLimit": - $uiHandler->HUBBROWSE->setLimit($_REQUEST['limit']); + $HUBBROWSE->setLimit($_REQUEST['limit']); break; case "HUBBROWSE.setFiletype": - $uiHandler->HUBBROWSE->setFiletype($_REQUEST['filetype']); + $HUBBROWSE->setFiletype($_REQUEST['filetype']); break; case "HUBSEARCH.newSearch": diff --git a/campcaster/src/modules/htmlUI/var/localizer/Localizer.php b/campcaster/src/modules/htmlUI/var/localizer/Localizer.php index 9e19f1804..103c2da08 100644 --- a/campcaster/src/modules/htmlUI/var/localizer/Localizer.php +++ b/campcaster/src/modules/htmlUI/var/localizer/Localizer.php @@ -5,7 +5,7 @@ * be fast (it gets loaded for every hit to the admin screen), we put it * all in one file. */ - + /** * Includes */ @@ -24,11 +24,11 @@ require_once dirname(__FILE__).'/LanguageMetadata.php'; * * @return void */ -function putGS($p_translateString) +function putGS($p_translateString) { $args = func_get_args(); echo call_user_func_array('getGS', $args); -} // fn putGS +} // fn putGS /** @@ -40,7 +40,7 @@ function putGS($p_translateString) * * @return string */ -function getGS($p_translateString) +function getGS($p_translateString) { global $g_translationStrings, $TOL_Language; $numFunctionArgs = func_num_args(); @@ -68,7 +68,7 @@ function getGS($p_translateString) * @param string $p_key * @return void */ -function regGS($p_key, $p_value) +function regGS($p_key, $p_value) { global $g_translationStrings; if (isset($g_translationStrings[$p_key])) { @@ -87,7 +87,7 @@ function regGS($p_key, $p_value) /** * The Localizer class handles groups of translation tables (LocalizerLanguages). - * This class simply acts as a namespace for a group of static methods. + * This class simply acts as a namespace for a group of static methods. * @package Campware */ class Localizer { @@ -100,13 +100,13 @@ class Localizer { * @return mixed * Will return 'gs' or 'xml' on success, or NULL on failure. */ - function GetMode() + function GetMode() { global $g_localizerConfig; if ($g_localizerConfig['DEFAULT_FILE_TYPE'] != '') { return $g_localizerConfig['DEFAULT_FILE_TYPE']; } - $defaultLang =& new LocalizerLanguage('globals', + $defaultLang = new LocalizerLanguage('globals', $g_localizerConfig['DEFAULT_LANGUAGE']); if ($defaultLang->loadGsFile()) { return 'gs'; @@ -118,8 +118,8 @@ class Localizer { return null; } } // fn GetMode - - + + /** * Load the translation strings into a global variable and return them. * @@ -132,29 +132,29 @@ class Localizer { * * @return void */ - function LoadLanguageFiles($p_prefix, $p_languageCode = null, $p_return = false) + function LoadLanguageFiles($p_prefix, $p_languageCode = null, $p_return = false) { global $g_localizerConfig; - + if ($p_return) { static $g_translationStrings; } else { - global $g_translationStrings; + global $g_translationStrings; } - + if (is_null($p_languageCode)){ $p_languageCode = $g_localizerConfig['DEFAULT_LANGUAGE']; } - + if (!isset($g_translationStrings)) { $g_translationStrings = array(); } $key = $p_prefix."_".$g_localizerConfig['DEFAULT_LANGUAGE']; if (!isset($g_localizerConfig['LOADED_FILES'][$key])) { - $defaultLang =& new LocalizerLanguage($p_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); + $defaultLang = new LocalizerLanguage($p_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); $defaultLang->loadFile(Localizer::GetMode()); - $defaultLangStrings = $defaultLang->getTranslationTable(); + $defaultLangStrings = $defaultLang->getTranslationTable(); // Merge default language strings into the translation array. #$g_translationStrings = array_merge($g_translationStrings, $defaultLangStrings); $g_translationStrings = Localizer::_arrayValuesMerge($g_translationStrings, $defaultLangStrings); @@ -162,31 +162,31 @@ class Localizer { } $key = $p_prefix."_".$p_languageCode; if (!isset($g_localizerConfig['LOADED_FILES'][$key])) { - $userLang =& new LocalizerLanguage($p_prefix, $p_languageCode); - $userLang->loadFile(Localizer::GetMode()); - $userLangStrings = $userLang->getTranslationTable(); + $userLang = new LocalizerLanguage($p_prefix, $p_languageCode); + $userLang->loadFile(Localizer::GetMode()); + $userLangStrings = $userLang->getTranslationTable(); // Merge user strings into translation array. #$g_translationStrings = array_merge($g_translationStrings, $userLangStrings); $g_translationStrings = Localizer::_arrayValuesMerge($g_translationStrings, $userLangStrings); $g_localizerConfig['LOADED_FILES'][$key] = true; - } + } if ($p_return) { return $g_translationStrings; - } + } } // fn LoadLanguageFiles function _arrayValuesMerge($arr1, $arr2) { foreach ($arr2 as $k=>$v) { if (strlen($v)) { - $arr1[$k] = $v; - } - } - - return $arr1; + $arr1[$k] = $v; + } + } + + return $arr1; } - + /** * Compare a particular language's keys with the default language set. * @@ -202,13 +202,13 @@ class Localizer { * * @return array */ - function CompareKeys($p_prefix, $p_data, $p_findExistingKeys = true) + function CompareKeys($p_prefix, $p_data, $p_findExistingKeys = true) { global $g_localizerConfig; - $localData =& new LocalizerLanguage($p_prefix, + $localData = new LocalizerLanguage($p_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); $localData->loadFile(Localizer::GetMode()); - $globaldata =& new LocalizerLanguage($g_localizerConfig['FILENAME_PREFIX_GLOBAL'], + $globaldata = new LocalizerLanguage($g_localizerConfig['FILENAME_PREFIX_GLOBAL'], $g_localizerConfig['DEFAULT_LANGUAGE']); $globaldata->loadFile(Localizer::GetMode()); @@ -227,58 +227,58 @@ class Localizer { return $returnValue; } // fn CompareKeys - + /** * Search through PHP files and find all the strings that need to be translated. * @param string $p_directory - * @return array */ - function FindTranslationStrings($p_prefix, $p_depth=0) + function FindTranslationStrings($p_prefix, $p_depth=0) { global $g_localizerConfig; //Start search here $dir = $g_localizerConfig["mapPrefixToDir"][$p_prefix]['path']; $depth = $g_localizerConfig["mapPrefixToDir"][$p_prefix]['depth']; - + // Scan which files $filePatterns = $g_localizerConfig['mapPrefixToDir'][$p_prefix]['filePatterns']; $execludePattern = $g_localizerConfig['mapPrefixToDir'][$p_prefix]['execlPattern']; - if ($g_localizerConfig['DEBUG']) echo "
Scan files match ".print_r($filePatterns, 1); + if ($g_localizerConfig['DEBUG']) echo "
Scan files match ".print_r($filePatterns, 1); // Scan for what - $funcPatterns = $g_localizerConfig['mapPrefixToDir'][$p_prefix]['funcPatterns']; - if ($g_localizerConfig['DEBUG']) echo "
Scan for ".print_r($funcPatterns, 1); + $funcPatterns = $g_localizerConfig['mapPrefixToDir'][$p_prefix]['funcPatterns']; + if ($g_localizerConfig['DEBUG']) echo "
Scan for ".print_r($funcPatterns, 1); // Get all files in this directory if ($g_localizerConfig['DEBUG']) echo "
Search in: {$g_localizerConfig['BASE_DIR']}$dir Depth: {$depth}"; - $files = File_Find::mapTreeMultiple($g_localizerConfig['BASE_DIR'].$dir, $depth); + $files = File_Find::mapTreeMultiple($g_localizerConfig['BASE_DIR'].$dir, $depth); $files = Localizer::_flatFileList($files); - #print_r($files); - + #print_r($files); + // Get all the Matching files foreach ($filePatterns as $fp) { foreach ($files as $name) { if (preg_match($fp, $name) && !preg_match($execludePattern, $name)) { - $filelist[] = $name; + $filelist[] = $name; } } reset($files); } #print_r($filelist); - + // Read in all the PHP files. $data = array(); - foreach ($filelist as $name) { + foreach ($filelist as $name) { $data = array_merge($data, file($g_localizerConfig['BASE_DIR'].$dir.'/'.$name)); } #print_r($data); // Collect all matches $matches = array(); - - foreach ($data as $line) { - foreach ($funcPatterns as $fp => $pos) { - if (preg_match_all($fp, $line, $m)) { + + foreach ($data as $line) { + foreach ($funcPatterns as $fp => $pos) { + if (preg_match_all($fp, $line, $m)) { foreach ($m[$pos] as $match) { #$match = str_replace("\\\\", "\\", $match); if (strlen($match)) $matches[$match] = $match; @@ -289,63 +289,63 @@ class Localizer { } asort($matches); #print_r($matches); - + return $matches; } // fn FindTranslationStrings - - + + function _flatFileList($files, $appdir='', $init=TRUE) { static $_flatList; if ($init === TRUE) $_flatList = array(); - + foreach ($files as $dir => $name) { - if (is_array($name)) { + if (is_array($name)) { Localizer::_flatFileList($name, $appdir.'/'.$dir, FALSE); } else { - $_flatList[] = $appdir.'/'.$name; + $_flatList[] = $appdir.'/'.$name; } } - return $_flatList; + return $_flatList; } - - + + /** * Return the set of strings in the code that are not in the translation files. * @param string $p_directory - * @return array */ - function FindMissingStrings($p_prefix) + function FindMissingStrings($p_prefix) { global $g_localizerConfig; - + if (empty($p_prefix)) { return array(); } - + $newKeys =& Localizer::FindTranslationStrings($p_prefix); $missingKeys =& Localizer::CompareKeys($p_prefix, $newKeys, false); - $missingKeys = array_unique($missingKeys); + $missingKeys = array_unique($missingKeys); return $missingKeys; } // fn FindMissingStrings - - + + /** * Return the set of strings in the translation files that are not used in the code. * @param string $p_prefix * @param string $p_directory - * @return array */ - function FindUnusedStrings($p_prefix) + function FindUnusedStrings($p_prefix) { global $g_localizerConfig; - + if (empty($p_prefix)) { return array(); } $existingKeys =& Localizer::FindTranslationStrings($p_prefix); - $localData =& new LocalizerLanguage($p_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); + $localData = new LocalizerLanguage($p_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); $localData->loadFile(Localizer::GetMode()); $localTable = $localData->getTranslationTable(); $unusedKeys = array(); @@ -357,8 +357,8 @@ class Localizer { $unusedKeys = array_unique($unusedKeys); return $unusedKeys; } // fn FindUnusedStrings - - + + /** * Update a set of strings in a language file. * @param string $p_prefix @@ -367,7 +367,7 @@ class Localizer { * * @return void */ - function ModifyStrings($p_prefix, $p_languageId, $p_data) + function ModifyStrings($p_prefix, $p_languageId, $p_data) { global $g_localizerConfig; // If we change a string in the default language, @@ -375,11 +375,11 @@ class Localizer { if ($p_languageId == $g_localizerConfig['DEFAULT_LANGUAGE']) { $languages = Localizer::GetAllLanguages(); foreach ($languages as $language) { - + // Load the language file - $source =& new LocalizerLanguage($p_prefix, $language->getLanguageId()); + $source = new LocalizerLanguage($p_prefix, $language->getLanguageId()); $source->loadFile(Localizer::GetMode()); - + // For the default language, we set the key & value to be the same. if ($p_languageId == $language->getLanguageId()) { foreach ($p_data as $pair) { @@ -392,7 +392,7 @@ class Localizer { $source->updateString($pair['key'], $pair['value']); } } - + // Save the file $source->saveFile(Localizer::GetMode()); } @@ -400,33 +400,33 @@ class Localizer { // We only need to change the values in one file. else { // Load the language file - $source =& new LocalizerLanguage($p_prefix, $p_languageId); + $source = new LocalizerLanguage($p_prefix, $p_languageId); $source->loadFile(Localizer::GetMode()); foreach ($p_data as $pair) { $source->updateString($pair['key'], $pair['key'], $pair['value']); } // Save the file - $source->saveFile(Localizer::GetMode()); + $source->saveFile(Localizer::GetMode()); } } // fn ModifyStrings - + /** * Synchronize the positions of the strings to the default language file order. * @param string $p_prefix * @return void */ - function FixPositions($p_prefix) + function FixPositions($p_prefix) { global $g_localizerConfig; - $defaultLanguage =& new LocalizerLanguage($p_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); + $defaultLanguage = new LocalizerLanguage($p_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); $defaultLanguage->loadFile(Localizer::GetMode()); $defaultTranslationTable = $defaultLanguage->getTranslationTable(); $languageIds = Localizer::GetAllLanguages(); foreach ($languageIds as $languageId) { - + // Load the language file - $source =& new LocalizerLanguage($p_prefix, $languageId); + $source = new LocalizerLanguage($p_prefix, $languageId); $source->loadFile(Localizer::GetMode()); $count = 0; @@ -434,13 +434,13 @@ class Localizer { $source->moveString($key, $count); $count++; } - + // Save the file $source->saveFile(Localizer::GetMode()); - } + } } // fn FixPositions - - + + /** * Go through all files matching $p_prefix in $p_directory and add entry(s). * @@ -450,12 +450,12 @@ class Localizer { * * @return void */ - function AddStringAtPosition($p_prefix, $p_position, $p_newKey) + function AddStringAtPosition($p_prefix, $p_position, $p_newKey) { global $g_localizerConfig; $languages = Localizer::GetAllLanguages(); foreach ($languages as $language) { - $source =& new LocalizerLanguage($p_prefix, $language->getLanguageId()); + $source = new LocalizerLanguage($p_prefix, $language->getLanguageId()); $source->loadFile(Localizer::GetMode()); if (is_array($p_newKey)) { foreach (array_reverse($p_newKey) as $key) { @@ -472,7 +472,7 @@ class Localizer { $source->addString($p_newKey, $p_newKey, $p_position); } else { - $source->addString($p_newKey, '', $p_position); + $source->addString($p_newKey, '', $p_position); } } $source->saveFile(Localizer::GetMode()); @@ -487,12 +487,12 @@ class Localizer { * Can be a string or an array of strings. * @return void */ - function RemoveString($p_prefix, $p_key) + function RemoveString($p_prefix, $p_key) { $languages = Localizer::GetAllLanguages(); foreach ($languages as $language) { - $target =& new LocalizerLanguage($p_prefix, $language->getLanguageId()); + $target = new LocalizerLanguage($p_prefix, $language->getLanguageId()); $target->loadFile(Localizer::GetMode()); if (is_array($p_key)) { foreach ($p_key as $key) { @@ -506,7 +506,7 @@ class Localizer { } } // fn RemoveString - + /** * Go through all files matching $p_prefix swap selected entrys. * @@ -516,18 +516,18 @@ class Localizer { * * @return void */ - function MoveString($p_prefix, $p_pos1, $p_pos2) + function MoveString($p_prefix, $p_pos1, $p_pos2) { $languages = Localizer::GetAllLanguages(); foreach ($languages as $language) { - $target =& new LocalizerLanguage($p_prefix, $language->getLanguageId()); + $target = new LocalizerLanguage($p_prefix, $language->getLanguageId()); $target->loadFile(Localizer::GetMode()); $success = $target->moveString($p_pos1, $p_pos2); $target->saveFile(Localizer::GetMode()); } } // fn MoveString - + /** * Get all the languages that the interface supports. * @@ -540,21 +540,21 @@ class Localizer { * @return array * An array of LanguageMetadata objects. */ - function GetAllLanguages($p_mode = null, $p_default=TRUE, $p_completed_only=FALSE) + function GetAllLanguages($p_mode = null, $p_default=TRUE, $p_completed_only=FALSE) { if (is_null($p_mode)) { $p_mode = Localizer::GetMode(); } $className = "LocalizerFileFormat_".strtoupper($p_mode); if (class_exists($className)) { - $object =& new $className(); + $object = new $className(); if (method_exists($object, "getLanguages")) { $languages = $object->getLanguages($p_default, $p_completed_only); } } //$this->m_languageDefs =& $languages; return $languages; - } // fn GetAllLanguages + } // fn GetAllLanguages /** @@ -564,7 +564,7 @@ class Localizer { * @param string $p_pattern * @return array */ - function SearchFilesRecursive($p_startdir, $p_pattern) + function SearchFilesRecursive($p_startdir, $p_pattern) { $structure = File_Find::mapTreeMultiple($p_startdir); @@ -573,9 +573,9 @@ class Localizer { foreach ($structure as $dir => $file) { // it's a directory if (is_array($file)) { - $filelist = array_merge($filelist, + $filelist = array_merge($filelist, Localizer::SearchFilesRecursive($p_startdir.'/'.$dir, $p_pattern)); - } + } else { // it's a file if (preg_match($p_pattern, $file)) { @@ -592,17 +592,17 @@ class Localizer { * @param string $p_languageId * @return void */ - function CreateLanguageFiles($p_languageId) + function CreateLanguageFiles($p_languageId) { global $g_localizerConfig; - + // Make new directory if (!mkdir($g_localizerConfig['TRANSLATION_DIR']."/".$p_languageId)) { return; } - + // Copy files from reference language - + // $className = "LocalizerFileFormat_".strtoupper(Localizer::GetMode()); // foreach ($files as $pathname) { // if ($pathname) { @@ -610,7 +610,7 @@ class Localizer { // $base = $fileNameParts[0]; // $dir = str_replace($g_localizerConfig['BASE_DIR'], '', dirname($pathname)); // // read the default file -// $defaultLang =& new LocalizerLanguage($base, $g_localizerConfig['DEFAULT_LANGUAGE']); +// $defaultLang = new LocalizerLanguage($base, $g_localizerConfig['DEFAULT_LANGUAGE']); // $defaultLang->loadFile(Localizer::GetMode()); // $defaultLang->clearValues(); // $defaultLang->setLanguageId($p_languageId); @@ -622,13 +622,13 @@ class Localizer { // } } // fn CreateLanguageFiles - + /** * Go through subdirectorys and delete language files for given Id. * @param string $p_languageId * @return void */ - function DeleteLanguageFiles($p_languageId) + function DeleteLanguageFiles($p_languageId) { global $g_localizerConfig; $langDir = $g_localizerConfig['TRANSLATION_DIR'].'/'.$p_languageId; @@ -644,6 +644,6 @@ class Localizer { } } } // fn DeleteLanguageFiles - + } // class Localizer ?> \ No newline at end of file diff --git a/campcaster/src/modules/htmlUI/var/localizer/LocalizerFileFormat.php b/campcaster/src/modules/htmlUI/var/localizer/LocalizerFileFormat.php index 87d45cbd8..bd5fab85c 100644 --- a/campcaster/src/modules/htmlUI/var/localizer/LocalizerFileFormat.php +++ b/campcaster/src/modules/htmlUI/var/localizer/LocalizerFileFormat.php @@ -128,7 +128,7 @@ class LocalizerFileFormat_GS extends LocalizerFileFormat { $metadata = array(); foreach ($languages as $language) { - $tmpMetadata =& new LanguageMetadata(); + $tmpMetadata = new LanguageMetadata(); $tmpMetadata->m_englishName = $language['Name']; $tmpMetadata->m_nativeName = $language['NativeName']; $tmpMetadata->m_languageCode = $language['LanguageCode']; @@ -195,7 +195,7 @@ class LocalizerFileFormat_XML extends LocalizerFileFormat { if (file_exists($filePath)) { $xml = File::readAll($filePath); File::close($filePath, FILE_MODE_READ); - $unserializer =& new XML_Unserializer($this->m_unserializeOptions); + $unserializer = new XML_Unserializer($this->m_unserializeOptions); $unserializer->unserialize($xml); $translationArray = $unserializer->getUnserializedData(); @@ -233,7 +233,7 @@ class LocalizerFileFormat_XML extends LocalizerFileFormat { } $saveData = array_merge($saveData, $saveTranslationTable); - $serializer =& new XML_Serializer($this->m_serializeOptions); + $serializer = new XML_Serializer($this->m_serializeOptions); $serializer->serialize($saveData); $xml = $serializer->getSerializedData(); @@ -289,7 +289,7 @@ class LocalizerFileFormat_XML extends LocalizerFileFormat { $xml = File::readAll($fileName); File::rewind($fileName, FILE_MODE_READ); - $handle =& new XML_Unserializer($this->l_unserializeOptions); + $handle = new XML_Unserializer($this->l_unserializeOptions); $handle->unserialize($xml); $arr = $handle->getUnserializedData(); @@ -303,7 +303,7 @@ class LocalizerFileFormat_XML extends LocalizerFileFormat { // just display default language in maintainance mode if ($p_default || $language['Id'] !== $g_localizerConfig['DEFAULT_LANGUAGE']) { list ($langCode, $countryCode) = explode('_', $language['Id']); - $languageDef =& new LanguageMetadata(); + $languageDef = new LanguageMetadata(); $languageDef->m_languageId = $language['Id']; $languageDef->m_languageCode = $langCode; $languageDef->m_countryCode = $countryCode; @@ -330,7 +330,7 @@ class LocalizerFileFormat_XML extends LocalizerFileFormat { $xml = File::readAll($fileName); File::rewind($fileName, FILE_MODE_READ); - $handle =& new XML_Unserializer($this->l_unserializeOptions); + $handle = new XML_Unserializer($this->l_unserializeOptions); $handle->unserialize($xml); $arr = $handle->getUnserializedData(); @@ -346,7 +346,7 @@ class LocalizerFileFormat_XML extends LocalizerFileFormat { 'NativeName' => $new['NativeName'] ); $languages = $this->_xSortArray($languages, 'Id'); - $handle =& new XML_Serializer($this->l_serializeOptions); + $handle = new XML_Serializer($this->l_serializeOptions); $handle->serialize($languages); if (!$xml = $handle->getSerializedData()) { diff --git a/campcaster/src/modules/htmlUI/var/localizer/LocalizerLanguage.php b/campcaster/src/modules/htmlUI/var/localizer/LocalizerLanguage.php index 6f7e2bab3..1a4c8a527 100644 --- a/campcaster/src/modules/htmlUI/var/localizer/LocalizerLanguage.php +++ b/campcaster/src/modules/htmlUI/var/localizer/LocalizerLanguage.php @@ -21,11 +21,11 @@ class LocalizerLanguage { var $m_mode = ''; var $m_prefix = ''; var $m_filePath = ''; - + /** * A LocalizerLanguage is basically a translation table. * - * You can use this class to manipulate the translation table: + * You can use this class to manipulate the translation table: * such as add, delete, and move strings. * * @param string $p_prefix @@ -40,49 +40,49 @@ class LocalizerLanguage { * 2) The two-letter language code, underscore, two-letter country code * (e.g. "en_US") */ - function LocalizerLanguage($p_prefix, $p_languageId = null) + function LocalizerLanguage($p_prefix, $p_languageId = null) { if (!is_null($p_languageId)) { $this->setLanguageId($p_languageId); } $this->m_prefix = $p_prefix; } // constructor - + /** * Return the filename prefix. * @return string */ - function getPrefix() + function getPrefix() { return $this->m_prefix; } // fn getPrefix - - + + /** * This will return 'gs' or 'xml' * @return string */ - function getMode() + function getMode() { return $this->m_mode; } // fn getMode - - + + /** * Set the mode to be 'xml' or 'gs'. * @param string $p_value * @return void */ - function setMode($p_value) + function setMode($p_value) { $p_value = strtolower($p_value); if (($p_value == 'xml') || ($p_value == 'gs')) { $this->m_mode = $p_value; } } // fn setMode - - + + /** * Set the language code - this can take either the two-letter language code * or the LL_CC extended version , where LL is the language code and CC @@ -91,8 +91,8 @@ class LocalizerLanguage { * @param string $p_languageId * @return void */ - function setLanguageId($p_languageId) - { + function setLanguageId($p_languageId) + { if (strlen($p_languageId) > 2) { list ($this->m_languageCode, $this->m_countryCode) = explode('_', $p_languageId); $this->m_languageId = $p_languageId; @@ -100,17 +100,17 @@ class LocalizerLanguage { else { $this->m_languageCode = $p_languageId; $this->m_languageId = $p_languageId; - } + } } // fn setLanguageId - - - /** + + + /** * Register a string in the translation table. * @param string $p_key * @param string $p_value * @return void */ - function registerString($p_key, $p_value) + function registerString($p_key, $p_value) { if (substr($p_value, strlen($p_value)-3) == ":en"){ $p_value = substr($p_value, 0, strlen($p_value)-3); @@ -123,63 +123,63 @@ class LocalizerLanguage { * Return the total number of strings in the translation table. * @return int */ - function getNumStrings() + function getNumStrings() { return count($this->m_translationTable); } // fn getNumStrings - - + + /** * Get the language code that is in the form _. * * @return string */ - function getLanguageId() + function getLanguageId() { return $this->m_languageId; } // fn getLanguageId - - + + /** * Get the two-letter language code for the translation table. * @return string */ - function getLanguageCode() + function getLanguageCode() { return $this->m_languageCode; } // fn getLanguageCode - + /** * Get the two-letter country code. * @return string */ - function getCountryCode() + function getCountryCode() { return $this->m_countryCode; } // fn getCountryCode - - + + /** * Return the file path for the last file loaded. * @return string */ - function getSourceFile() + function getSourceFile() { return $this->m_filePath; } // fn getSourceFile - - + + /** * This is only for use by the LocalizerFileFormat functions. * @access private */ - function _setSourceFile($p_value) + function _setSourceFile($p_value) { $this->m_filePath = $p_value; } // fn _setSourceFile - - + + /** * Return true if this LocalizerLanguage has the exact same * translation strings as the given LocalizerLanguage. @@ -187,7 +187,7 @@ class LocalizerLanguage { * @param LocalizerLanguage $p_localizerLanguage * @return boolean */ - function equal($p_localizerLanguage) + function equal($p_localizerLanguage) { if (count($this->m_translationTable) != count($p_localizerLanguage->m_translationTable)) { return false; @@ -204,20 +204,20 @@ class LocalizerLanguage { } return true; } // fn equal - + /** - * Return a table indexed by the english language name, with the value being the + * Return a table indexed by the english language name, with the value being the * target language equivalent. * * @return array */ - function getTranslationTable() + function getTranslationTable() { return $this->m_translationTable; } - - + + /** * Get the full path to the translation file. * @@ -225,12 +225,12 @@ class LocalizerLanguage { * Either 'gs' or 'xml'. * @return string */ - function getFilePath($p_mode = null) + function getFilePath($p_mode = null) { global $g_localizerConfig; if (is_null($p_mode)) { $p_mode = $this->m_mode; - } + } if ($p_mode == 'xml') { $relativePath = '/'.$this->m_languageId.'/'.$this->m_prefix.'.xml'; } @@ -240,7 +240,7 @@ class LocalizerLanguage { return $g_localizerConfig['TRANSLATION_DIR'].$relativePath; } // fn getFilePath - + /** * Return TRUE if the given string exists in the translation table. * @@ -248,12 +248,12 @@ class LocalizerLanguage { * * @return boolean */ - function keyExists($p_string) + function keyExists($p_string) { return (isset($this->m_translationTable[$p_string])); } // fn stringExists - - + + /** * Add a string to the translation table. * @@ -265,15 +265,15 @@ class LocalizerLanguage { * value as the key. * * @param int $p_position - * Optional. By default the string will be added to the end of the + * Optional. By default the string will be added to the end of the * translation table. * * @return boolean */ - function addString($p_key, $p_value = null, $p_position = null) + function addString($p_key, $p_value = null, $p_position = null) { - if (!is_null($p_position) - && (!is_numeric($p_position) || ($p_position < 0) + if (!is_null($p_position) + && (!is_numeric($p_position) || ($p_position < 0) || ($p_position > count($this->m_translationTable)))) { return false; } @@ -304,8 +304,8 @@ class LocalizerLanguage { return true; } } // fn addString - - + + /** * Get the position of a key or a value. * @param string $p_key @@ -313,7 +313,7 @@ class LocalizerLanguage { * @return mixed * The position of the key/value in the array, FALSE if not found. */ - function getPosition($p_key = null, $p_value = null) + function getPosition($p_key = null, $p_value = null) { $position = 0; if (!is_null($p_key)) { @@ -330,11 +330,11 @@ class LocalizerLanguage { return $position; } $position++; - } + } } return false; } // fn getPosition - + /** * Get the string at the given position. @@ -343,9 +343,9 @@ class LocalizerLanguage { * An array of two elements, the first is the key, the second is the value. * They are indexed by 'key' and 'value'. */ - function getStringAtPosition($p_position) + function getStringAtPosition($p_position) { - if (is_null($p_position) || !is_numeric($p_position) || ($p_position < 0) + if (is_null($p_position) || !is_numeric($p_position) || ($p_position < 0) || ($p_position > count($this->m_translationTable))) { return false; } @@ -355,10 +355,10 @@ class LocalizerLanguage { $value = array_pop($returnValue); return array('key' => $key, 'value' => $value); } // fn getStringAtPosition - - + + /** - * Change the key and optionally the value of the + * Change the key and optionally the value of the * translation string. If the value isnt specified, * it is not changed. If the key does not exist, * it will be added. In this case, you can use p_position @@ -370,7 +370,7 @@ class LocalizerLanguage { * @param int $p_position * @return boolean */ - function updateString($p_oldKey, $p_newKey, $p_value = null, $p_position = null) + function updateString($p_oldKey, $p_newKey, $p_value = null, $p_position = null) { if (!is_string($p_oldKey) || !is_string($p_newKey)) { return false; @@ -390,7 +390,7 @@ class LocalizerLanguage { return true; } } - + // Updating the key (and possibly the value) if (is_null($p_value)) { $p_value = $this->m_translationTable[$p_oldKey]; @@ -400,8 +400,8 @@ class LocalizerLanguage { $success &= $this->addString($p_newKey, $p_value, $position); return $success; } // fn updateString - - + + /** * Move a string to a different position in the translation array. * This allows similiar strings to be grouped together. @@ -412,10 +412,10 @@ class LocalizerLanguage { * @return boolean * TRUE on success, FALSE on failure. */ - function moveString($p_startPositionOrKey, $p_endPosition) + function moveString($p_startPositionOrKey, $p_endPosition) { // Check parameters - if (is_numeric($p_startPositionOrKey) && (($p_startPositionOrKey < 0) + if (is_numeric($p_startPositionOrKey) && (($p_startPositionOrKey < 0) || ($p_startPositionOrKey > count($this->m_translationTable)))) { return false; } @@ -436,11 +436,11 @@ class LocalizerLanguage { else { return false; } - + // Success if we dont have to move the string anywhere if ($startPosition == $p_endPosition) { return true; - } + } // Delete the string in the old position $result = $this->deleteStringAtPosition($startPosition); if (!$result) { @@ -448,7 +448,7 @@ class LocalizerLanguage { } $key = $result['key']; $value = $result['value']; - + // Add the string in the new position $result = $this->addString($key, $value, $p_endPosition); if (!$result) { @@ -456,8 +456,8 @@ class LocalizerLanguage { } return true; } // fn moveString - - + + /** * Delete the string given by $p_key. * @param string $p_key @@ -465,7 +465,7 @@ class LocalizerLanguage { * The deleted string as array('key' => $key, 'value' => $value) on success, * FALSE if it didnt exist. */ - function deleteString($p_key) + function deleteString($p_key) { if (isset($this->m_translationTable[$p_key])) { $value = $this->m_translationTable[$p_key]; @@ -474,17 +474,17 @@ class LocalizerLanguage { } return false; } // fn deleteString - - + + /** * Delete a string at a specific position in the array. * @param int $p_position * @return mixed * The deleted string as array($key, $value) on success, FALSE on failure. */ - function deleteStringAtPosition($p_position) + function deleteStringAtPosition($p_position) { - if (!is_numeric($p_position) || ($p_position < 0) + if (!is_numeric($p_position) || ($p_position < 0) || ($p_position > count($this->m_translationTable))) { return false; } @@ -494,16 +494,16 @@ class LocalizerLanguage { $value = array_pop($returnValue); return array('key' => $key, 'value' => $value); } // fn deleteStringAtPosition - - + + /** * Synchronize the positions of the strings in the translation table * with the positions of the string in the default language translation table. */ - function fixPositions() + function fixPositions() { global $g_localizerConfig; - $defaultLanguage =& new LocalizerLanguage($this->m_prefix, + $defaultLanguage = new LocalizerLanguage($this->m_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); $defaultLanguage->loadFile(Localizer::GetMode()); $defaultTranslationTable = $defaultLanguage->getTranslationTable(); @@ -518,43 +518,43 @@ class LocalizerLanguage { } return $modified; } // fn fixPositions - - + + /** * Sync with the default language file. This means - * adding any missing strings and fixing the positions of the strings to + * adding any missing strings and fixing the positions of the strings to * be the same as the default language file. */ - function syncToDefault() + function syncToDefault() { global $g_localizerConfig; - $defaultLanguage =& new LocalizerLanguage($this->m_prefix, + $defaultLanguage = new LocalizerLanguage($this->m_prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); $defaultLanguage->loadFile(Localizer::GetMode()); $defaultTranslationTable = $defaultLanguage->getTranslationTable(); $count = 0; $modified = false; - foreach ($defaultTranslationTable as $key => $value) { + foreach ($defaultTranslationTable as $key => $value) { if (!isset($this->m_translationTable[$key])) { $this->addString($key, '', $count); $modified = true; } $count++; - } + } if ($g_localizerConfig['DELETE_UNUSED_ON_SYNC'] === true) { - foreach ($this->m_translationTable as $key => $value) { + foreach ($this->m_translationTable as $key => $value) { if (!isset($defaultTranslationTable[$key])) { $this->deleteString($key, '', $count); $modified = true; } $count++; - } + } } - + return ($this->fixPositions() || $modified); } // fn syncToDefault - - + + /** * Find the keys/values that match the given keyword. * @@ -562,7 +562,7 @@ class LocalizerLanguage { * * @return array */ - function search($p_keyword) + function search($p_keyword) { $matches = array(); foreach ($this->m_translationTable as $key => $value) { @@ -572,8 +572,8 @@ class LocalizerLanguage { } return $matches; } // fn search - - + + /** * Load a language file of the given type. * @@ -582,7 +582,7 @@ class LocalizerLanguage { * * @return boolean */ - function loadFile($p_type = null) + function loadFile($p_type = null) { if (is_null($p_type)) { if (!empty($this->m_mode)) { @@ -597,15 +597,15 @@ class LocalizerLanguage { } $className = 'LocalizerFileFormat_'.strtoupper($p_type); if (class_exists($className)) { - $object =& new $className(); + $object = new $className(); if (method_exists($object, 'load')) { return $object->load($this); } } return false; } // fn loadFile - - + + /** * Save the translation table as the given type. * @@ -614,7 +614,7 @@ class LocalizerLanguage { * * @return boolean */ - function saveFile($p_type = null) + function saveFile($p_type = null) { // Figure out the current mode. if (is_null($p_type)) { @@ -631,33 +631,33 @@ class LocalizerLanguage { // Save in the requested mode. $className = 'LocalizerFileFormat_'.strtoupper($p_type); if (class_exists($className)) { - $object =& new $className(); + $object = new $className(); if (method_exists($object, 'save')) { return $object->save($this); } } return false; } // fn saveFile - - + + /** - * Erase all the values in the translation table, but + * Erase all the values in the translation table, but * keep the keys. * @return void */ - function clearValues() + function clearValues() { foreach ($this->m_translationTable as $key => $value) { $this->m_translationTable[$key] = ''; } } // fn clearValues - - + + /** - * For debugging purposes, displays the the translation table + * For debugging purposes, displays the the translation table * in an HTML table. */ - function dumpToHtml() + function dumpToHtml() { echo "
";
     	if (!empty($this->m_filePath)) {
@@ -671,7 +671,7 @@ class LocalizerLanguage {
     	echo "";
     	echo "
"; } // fn dumpToHtml - + } // class LocalizerLanguage ?> \ No newline at end of file diff --git a/campcaster/src/modules/htmlUI/var/localizer/auth.inc.php b/campcaster/src/modules/htmlUI/var/localizer/auth.inc.php index d12c0e41f..fed5cf7e3 100644 --- a/campcaster/src/modules/htmlUI/var/localizer/auth.inc.php +++ b/campcaster/src/modules/htmlUI/var/localizer/auth.inc.php @@ -12,7 +12,7 @@ function login(&$data) } $dbc->setFetchMode(DB_FETCHMODE_ASSOC); - $gb =& new GreenBox($dbc, $config); + $gb = new GreenBox($dbc, $config); if (!$data['PHP_AUTH_USER'] || !$data['PHP_AUTH_PW']) { return FALSE; diff --git a/campcaster/src/modules/htmlUI/var/localizer/maintenance.php b/campcaster/src/modules/htmlUI/var/localizer/maintenance.php index 91bf9d92c..153c89232 100644 --- a/campcaster/src/modules/htmlUI/var/localizer/maintenance.php +++ b/campcaster/src/modules/htmlUI/var/localizer/maintenance.php @@ -1,10 +1,10 @@ m_languageId); ?>m_englishName); ?>m_nativeName); ?> - - + validate()) { - return $form->getSubmitValues(); + return $form->getSubmitValues(); } else { return FALSE; - } + } } - + ?> @@ -44,25 +44,25 @@ class Maintenance {
Add language
addLanguage($values)) { return TRUE; - } - } - - return FALSE; + } + } + + return FALSE; } } -if ($g_localizerConfig['MAINTENANCE']) { +if ($g_localizerConfig['MAINTENANCE']) { ?>
@@ -74,17 +74,17 @@ if ($g_localizerConfig['MAINTENANCE']) {
. */ -function LanguageMenu($p_languageMetadata, $p_selectedValue) +function LanguageMenu($p_languageMetadata, $p_selectedValue) { $options = ''; foreach($p_languageMetadata as $language) { if ($p_selectedValue == $language->getLanguageId()) { $selectedString = 'selected'; - } + } else { $selectedString = ''; } $options .= ''; } return $options; -} // fn LanguageMenu +} // fn LanguageMenu /** * Creates a form for translation. * @param array $p_request */ -function translationForm($p_request) +function translationForm($p_request) { global $g_localizerConfig; - $localizerTargetLanguage = Input::Get('localizer_target_language', 'string', + $localizerTargetLanguage = Input::Get('localizer_target_language', 'string', '', true); - $localizerSourceLanguage = Input::Get('localizer_source_language', 'string', + $localizerSourceLanguage = Input::Get('localizer_source_language', 'string', $g_localizerConfig['DEFAULT_LANGUAGE'], true); if (empty($localizerSourceLanguage)) { - $tmpLanguage =& new LocalizerLanguage(null, $p_request['TOL_Language']); + $tmpLanguage = new LocalizerLanguage(null, $p_request['TOL_Language']); $localizerSourceLanguage = $tmpLanguage->getLanguageId(); } - + $prefix = Input::Get('prefix', 'string', '', true); $screenDropDownSelection = $prefix; - + // Load the language files. //echo "Prefix: $prefix
"; - $sourceLang =& new LocalizerLanguage($prefix, $localizerSourceLanguage); - $targetLang =& new LocalizerLanguage($prefix, $localizerTargetLanguage); - $defaultLang =& new LocalizerLanguage($prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); - + $sourceLang = new LocalizerLanguage($prefix, $localizerSourceLanguage); + $targetLang = new LocalizerLanguage($prefix, $localizerTargetLanguage); + $defaultLang = new LocalizerLanguage($prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); + $mode = Localizer::GetMode(); if (!empty($prefix)) { // If the language files do not exist, create them. @@ -60,7 +60,7 @@ function translationForm($p_request) if (!$targetLang->loadFile($mode)) { $targetLang->saveFile($mode); } - + // Make sure that the languages have the same strings and are in the same // order as the default language file. $modified = $sourceLang->syncToDefault(); @@ -70,10 +70,10 @@ function translationForm($p_request) $modified = $targetLang->syncToDefault(); if ($modified) { $targetLang->saveFile($mode); - } + } } - - + + $defaultStrings = $defaultLang->getTranslationTable(); $searchString = Input::Get('search_string', 'string', '', true); if (!empty($searchString)) { @@ -88,8 +88,8 @@ function translationForm($p_request) $missingStrings = Localizer::FindMissingStrings($prefix); $unusedStrings = Localizer::FindUnusedStrings($prefix); } - - + + // Mapping of language prefixes to human-readable strings. $mapPrefixToDisplay[] = ''; @@ -99,14 +99,14 @@ function translationForm($p_request) // Whether to show translated strings or not. $hideTranslated = ''; - if (isset($p_request['hide_translated'])) { + if (isset($p_request['hide_translated'])) { $hideTranslated = "CHECKED"; - } + } ?> - +
- + @@ -148,7 +148,7 @@ function translationForm($p_request)
@@ -176,20 +176,20 @@ function translationForm($p_request) +
class="input_checkbox" onchange="this.form.submit();"> -
- + - + - + @@ -203,7 +203,7 @@ function translationForm($p_request) - + @@ -216,12 +216,12 @@ function translationForm($p_request)
- + - - 0) && ($screenDropDownSelection != 'globals')) { ?> @@ -237,7 +237,7 @@ function translationForm($p_request) - + - +
@@ -248,16 +248,16 @@ function translationForm($p_request) ?>
- " class="button"> + " class="button">
0) && ($screenDropDownSelection != 'globals')) { ?> @@ -273,7 +273,7 @@ function translationForm($p_request) - + - +
@@ -284,15 +284,15 @@ function translationForm($p_request) ?>
- " class="button"> + " class="button">
@@ -305,11 +305,11 @@ function translationForm($p_request) - $sourceValue) { - + foreach ($sourceStrings as $sourceKey => $sourceValue) { + if (!empty($targetStrings[$sourceKey])) { #$targetValueDisplay = str_replace('"', '"', $targetStrings[$sourceKey]); #$targetValueDisplay = str_replace("\\", "\\\\", $targetValueDisplay); @@ -321,31 +321,31 @@ function translationForm($p_request) $pre = ''; $post = ''; } - + $sourceKeyDisplay = htmlspecialchars(str_replace("\\", "\\\\", $sourceKey)); - + // Dont display translated strings if (isset($p_request['hide_translated']) && !empty($targetStrings[$sourceKey])) { ?> @@ -377,31 +377,31 @@ function translationForm($p_request) can change keys - if ($targetLang->getLanguageId() == $g_localizerConfig['DEFAULT_LANGUAGE']) { + if ($targetLang->getLanguageId() == $g_localizerConfig['DEFAULT_LANGUAGE']) { $fileparms = "localizer_target_language=".$targetLang->getLanguageId() ."&localizer_source_language=".$sourceLang->getLanguageId() ."&prefix=".urlencode($screenDropDownSelection) ."&search_string=".urlencode($searchString); - if (!empty($hideTranslated)) { + if (!empty($hideTranslated)) { $fileparms .= "&hide_translated=on"; } - + if ($count == 0) { // swap last and first entry $prev = count($sourceStrings)-1; $next = $count+1; - } - elseif ($count == count($sourceStrings)-1) { + } + elseif ($count == count($sourceStrings)-1) { // swap last and first entry $prev = $count-1; $next = 0; - } - else { + } + else { // swap entrys linear $prev = $count-1; $next = $count+1; } - + $removeLink = "?action=remove_string&pos=$count&$fileparms" ."&string=".urlencode($sourceKey); $moveUpLink = "?action=move_string&pos1=$count&pos2=$prev&$fileparms"; @@ -420,13 +420,13 @@ function translationForm($p_request) -
- getLanguageId(); ?>: Key: -
- + - - - - +
@@ -467,7 +467,7 @@ function translationForm($p_request)
- + diff --git a/campcaster/src/modules/htmlUI/var/ui_base.inc.php b/campcaster/src/modules/htmlUI/var/ui_base.inc.php index b73877d08..6d37f0042 100644 --- a/campcaster/src/modules/htmlUI/var/ui_base.inc.php +++ b/campcaster/src/modules/htmlUI/var/ui_base.inc.php @@ -115,56 +115,48 @@ function _getNumArr($start, $end, $step=1) */ class uiBase { - var $redirUrl; - 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_; + public $gb; // GreenBox + public $STATIONPREFS; + public $SCRATCHPAD; + public $SEARCH; + public $BROWSE; + // Note: loading HUBBROWSE on every page load slows things down + // a lot. we only load it on demand. + //public $HUBBROWSE; + public $HUBSEARCH; + public $PLAYLIST; + public $SCHEDULER; + public $SUBJECTS; + public $EXCHANGE; + public $TRANSFERS; + public $redirUrl; + public $dbc; + public $config; + public $sessid; + public $userid; + public $login; + public $id; + public $langid; + public $pid; + public $type; + public $fid; + public $homeid; + public $alertMsg; /** - * uiBase - * - * Initialize a new Basis Class including: - * - database initialation - * - GreenBox initialation - * - * @param array $config + * @param array $config * configurartion data */ - function uiBase(&$config) + public function __construct(&$config) { $this->dbc = DB::connect($config['dsn'], TRUE); if (DB::isError($this->dbc)) { die($this->dbc->getMessage()); } $this->dbc->setFetchMode(DB_FETCHMODE_ASSOC); - $this->gb =& new GreenBox($this->dbc, $config); + $this->gb = new GreenBox($this->dbc, $config); $this->config =& $config; - $this->config['accessRawAudioUrl'] = $config['storageUrlPath'].'/xmlrpc/simpleGet.php'; - $this->sessid = isset($_REQUEST[$config['authCookieName']]) ? $_REQUEST[$config['authCookieName']] : null; $this->userid = $this->gb->getSessUserId($this->sessid); @@ -187,21 +179,23 @@ class uiBase $this->homeid = $this->gb->getObjId($this->login, $this->gb->storId); } - $this->InputTextStandardAttrib = array('size'=>UI_INPUT_STANDARD_SIZE, - 'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH); + } + + + public function init() + { $this->STATIONPREFS =& $_SESSION[UI_STATIONINFO_SESSNAME]; - $this->SCRATCHPAD =& new uiScratchPad($this); - $this->SEARCH =& new uiSearch($this); - $this->BROWSE =& new uiBrowse($this); - $this->HUBBROWSE =& new uiHubBrowse($this); - $this->HUBSEARCH =& new uiHubSearch($this); - $this->PLAYLIST =& new uiPlaylist($this); - $this->SCHEDULER =& new uiScheduler($this); - $this->SUBJECTS =& new uiSubjects($this); - $this->EXCHANGE =& new uiExchange($this); - $this->TRANSFERS =& new uiTransfers($this); - $this->_self_ =& $this; - } // fn uiBase + $this->SCRATCHPAD = new uiScratchPad($this); + $this->SEARCH = new uiSearch($this); + $this->BROWSE = new uiBrowse($this); + //$this->HUBBROWSE = new uiHubBrowse($this); + $this->HUBSEARCH = new uiHubSearch($this); + $this->PLAYLIST = new uiPlaylist($this); + $this->SCHEDULER = new uiScheduler($this); + $this->SUBJECTS = new uiSubjects($this); + $this->EXCHANGE = new uiExchange($this); + $this->TRANSFERS = new uiTransfers($this); + } /** @@ -210,7 +204,7 @@ class uiBase * @param array $mask * @param boolean $reload */ - function loadStationPrefs(&$mask, $reload=FALSE) + public function loadStationPrefs(&$mask, $reload=FALSE) { if (!is_array($this->STATIONPREFS) || ($reload === TRUE) ) { $this->STATIONPREFS = array(); @@ -230,8 +224,6 @@ class uiBase /** - * _parseArr2Form - * * Add elements/rules/groups to an given HTML_QuickForm object * * @param HTML_Quickform $form @@ -241,7 +233,7 @@ class uiBase * @param string $side * can be 'client' or 'server' - this is where the form validation occurs. */ - function _parseArr2Form(&$form, &$mask, $side='client') + public static function parseArrayToForm(&$form, &$mask, $side='client') { foreach ($mask as $v) { $attrs = isset($v['attributes']) ? $v['attributes'] : null; @@ -347,7 +339,7 @@ class uiBase reset($mask); $form->validate(); - } // fn _parseArr2Form + } // fn parseArrayToForm /** @@ -356,21 +348,21 @@ class uiBase * @param array $input * array of form-elements */ - function _dateArr2Str(&$input) - { - foreach ($input as $k => $v){ - if (is_array($v)) { - 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']); - } - if ( ( isset($v['H']) ) || isset($v['h'] ) && ( isset($v['i']) ) && ( isset($v['s']) ) ) { - $input[$k] = sprintf('%02d', $v['H'].$v['h']).':'.sprintf('%02d', $v['i']).':'.sprintf('%02d', $v['s']); - } - } - } - - return $input; - } // fn _dateArr2Str +// function _dateArr2Str(&$input) +// { +// foreach ($input as $k => $v){ +// if (is_array($v)) { +// 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']); +// } +// if ( ( isset($v['H']) ) || isset($v['h'] ) && ( isset($v['i']) ) && ( isset($v['s']) ) ) { +// $input[$k] = sprintf('%02d', $v['H'].$v['h']).':'.sprintf('%02d', $v['i']).':'.sprintf('%02d', $v['s']); +// } +// } +// } +// +// return $input; +// } // fn _dateArr2Str /** @@ -380,7 +372,7 @@ class uiBase * local ID of file * @param string $format */ - function _analyzeFile($id, $format) + public function analyzeFile($id, $format) { $ia = $this->gb->analyzeFile($id, $this->sessid); $s = $ia['playtime_seconds']; @@ -404,23 +396,23 @@ class uiBase '; } return FALSE; - } // fn _analyzeFile + } // fn analyzeFile - function _toHex($gunid) + public function toHex($gunid) { $res = $this->dbc->query("SELECT to_hex($gunid)"); $row = $res->fetchRow(); return $row['to_hex']; - } // fn _toHex + } // fn toHex - function _toInt8($gunid) + public function toInt8($gunid) { $res = $this->dbc->query("SELECT x'$gunid'::bigint"); $row = $res->fetchRow(); return $row['int8']; - } // fn _toInt8 + } // fn toInt8 /** @@ -438,7 +430,7 @@ class uiBase * @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) + public 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'] = ''; @@ -447,22 +439,22 @@ class uiBase } // fn _retMsg - function _getMetaInfo($id) + public function getMetaInfo($id) { $type = strtolower($this->gb->getFileType($id)); $data = array('id' => $id, 'gunid' => $this->gb->_gunidFromId($id), - 'title' => $this->_getMDataValue($id, UI_MDATA_KEY_TITLE), - 'creator' => $this->_getMDataValue($id, UI_MDATA_KEY_CREATOR), - 'duration' => $this->_getMDataValue($id, UI_MDATA_KEY_DURATION), + 'title' => $this->getMetadataValue($id, UI_MDATA_KEY_TITLE), + 'creator' => $this->getMetadataValue($id, UI_MDATA_KEY_CREATOR), + 'duration' => $this->getMetadataValue($id, UI_MDATA_KEY_DURATION), 'type' => $type, #'isAvailable' => $type == 'playlist' ? $this->gb->playlistIsAvailable($id, $this->sessid) : NULL, ); return ($data); - } // fn _getMetaInfo + } // fn getMetaInfo - function _getMDataValue($id, $key, $langid=NULL, $deflangid=UI_DEFAULT_LANGID) + public function getMetadataValue($id, $key, $langid=NULL, $deflangid=UI_DEFAULT_LANGID) { if (!$langid) { $langid = $_SESSION['langid']; @@ -473,10 +465,10 @@ class uiBase return $value['value']; } return FALSE; - } // fn _getMDataValue + } // fn getMetadataValue - function _setMDataValue($id, $key, $value, $langid=NULL) + public function setMetadataValue($id, $key, $value, $langid=NULL) { if (!$langid) { $langid = UI_DEFAULT_LANGID; @@ -489,16 +481,14 @@ class uiBase return TRUE; } return FALSE; - } // fn _setMDataValue + } // fn setMetadataValue /** - * Enter description here... - * * @param unknown_type $id * @return string/FALSE */ - function _getFileTitle($id) + private function _getFileTitle($id) { if (is_array($arr = $this->gb->getPath($id))) { $file = array_pop($arr); @@ -508,29 +498,29 @@ class uiBase } // fn _getFileTitle - function _isFolder($id) - { - if (strtolower($this->gb->getFileType($id)) != 'folder') { - return FALSE; - } - return TRUE; - } // fn _isFolder +// function _isFolder($id) +// { +// if (strtolower($this->gb->getFileType($id)) != 'folder') { +// return FALSE; +// } +// return TRUE; +// } // fn _isFolder - function _formElementEncode($str) + public static function formElementEncode($str) { $str = str_replace(':', '__', $str); #$str = str_replace('.', '_', $str); return $str; - } // fn _formElementEncode + } // fn formElementEncode - function _formElementDecode($str) + public static function formElementDecode($str) { $str = str_replace('__', ':', $str); #$str = str_replace('_', '.', $str); return $str; - } // fn _formElementDecode + } // fn formElementDecode } // class uiBase ?> \ No newline at end of file diff --git a/campcaster/src/modules/htmlUI/var/ui_browse.class.php b/campcaster/src/modules/htmlUI/var/ui_browse.class.php index c624d7b3e..b726a81d4 100644 --- a/campcaster/src/modules/htmlUI/var/ui_browse.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_browse.class.php @@ -6,31 +6,31 @@ */ class uiBrowse { - var $Base; // uiBase object - var $prefix; - var $col; - var $criteria; - var $reloadUrl; + public $Base; // uiBase object + private $prefix; + private $col; + private $criteria; + private $reloadUrl; - function uiBrowse(&$uiBase) + public function __construct(&$uiBase) { - $this->Base =& $uiBase; - $this->prefix = 'BROWSE'; - $this->col =& $_SESSION[constant('UI_'.$this->prefix.'_SESSNAME')]['col']; - $this->criteria =& $_SESSION[constant('UI_'.$this->prefix.'_SESSNAME')]['criteria']; - #$this->results =& $_SESSION[constant('UI_'.$this->prefix.'_SESSNAME')]['results']; - $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; + $this->Base =& $uiBase; + $this->prefix = 'BROWSE'; + $this->col =& $_SESSION[constant('UI_'.$this->prefix.'_SESSNAME')]['col']; + $this->criteria =& $_SESSION[constant('UI_'.$this->prefix.'_SESSNAME')]['criteria']; + //$this->results =& $_SESSION[constant('UI_'.$this->prefix.'_SESSNAME')]['results']; + $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; if (empty($this->criteria['limit'])) { - $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT; + $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT; } if (empty($this->criteria['filetype'])) { $this->criteria['filetype'] = UI_FILETYPE_ANY; } if (!is_array($this->col)) { - ## init Categorys + // init Categorys $this->setDefaults(); } } // constructor @@ -89,7 +89,7 @@ class uiBrowse foreach ($mask['pages'] as $key => $val) { foreach ($mask['pages'][$key] as $v){ if (isset($v['type']) && $v['type']) { - $tmp = $this->Base->_formElementEncode($v['element']); + $tmp = uiBase::formElementEncode($v['element']); $mask2['browse_columns']['category']['options'][$tmp] = tra($v['label']); } } @@ -99,22 +99,22 @@ class uiBrowse $form = new HTML_QuickForm('col'.$n, UI_STANDARD_FORM_METHOD, UI_HANDLER); $form->setConstants(array('id' => $id, 'col' => $n, - 'category' => $this->Base->_formElementEncode($this->col[$n]['category']))); + 'category' => uiBase::formElementEncode($this->col[$n]['category']))); $mask2['browse_columns']['value']['options'] = $this->options($this->col[$n]['values']['results']); $mask2['browse_columns']['value']['default'] = $this->col[$n]['form_value']; - $this->Base->_parseArr2Form($form, $mask2['browse_columns']); + uiBase::parseArrayToForm($form, $mask2['browse_columns']); $form->validate(); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['col'.$n]['dynform'] = $renderer->toArray(); } ## form to change limit and file-type $form = new HTML_QuickForm('switch', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask2['browse_global']); + uiBase::parseArrayToForm($form, $mask2['browse_global']); $form->setDefaults(array('limit' => $this->criteria['limit'], 'filetype' => $this->criteria['filetype'])); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['global']['dynform'] = $renderer->toArray(); @@ -123,19 +123,31 @@ class uiBrowse /** + * Set the category for audio file browser. There are three columns + * you can set the category for. + * * @param array $parm + * Has keys: + * int 'col' - the column you are setting the category for + * string 'category' - the category for the given column + * string 'value' - the * @return void */ - function setCategory($parm) + public function setCategory($parm) { - $which = $parm['col']; - $this->col[$which]['category'] = $this->Base->_formElementDecode($parm['category']); - $criteria = isset($this->col[$which]['criteria']) ? $this->col[$which]['criteria'] : null; - $this->col[$which]['values'] = $this->Base->gb->browseCategory($this->col[$which]['category'], $criteria, $this->Base->sessid); +// $reflect = new ReflectionProperty('uiBrowse', 'Base'); +// echo "
";print_r(Reflection::getModifierNames($reflect->getModifiers()));echo "
"; + + $columnNumber = $parm['col']; + $category = $parm['category']; + + $this->col[$columnNumber]['category'] = uiBase::formElementDecode($category); + $criteria = isset($this->col[$columnNumber]['criteria']) ? $this->col[$columnNumber]['criteria'] : null; +// print_r($this->Base->gb); + $this->col[$columnNumber]['values'] = $this->Base->gb->browseCategory($this->col[$columnNumber]['category'], $criteria, $this->Base->sessid); $this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix; - - $this->clearHierarchy($which); + $this->clearHierarchy($columnNumber); #print_r($this->col); } // fn setCategory @@ -150,7 +162,8 @@ class uiBrowse $next = $which + 1; $this->col[$which]['form_value'] = $parm['value'][0]; if ($parm['value'][0] == '%%all%%') { - $this->col[$next]['criteria'] = array('operator' => 'and', 'filetype' => $this->criteria['filetype']); + $this->col[$next]['criteria'] = array('operator' => 'and', + 'filetype' => $this->criteria['filetype']); } else { $this->col[$next]['criteria'] = array( 'operator' => 'and', @@ -158,7 +171,7 @@ class uiBrowse 'conditions' => array_merge( is_array($this->col[$which]['criteria']['conditions']) ? $this->col[$which]['criteria']['conditions'] : array(), array( - array('cat' => $this->Base->_formElementDecode($parm['category']), + array('cat' => uiBase::formElementDecode($parm['category']), 'op' => '=', 'val' => $parm['value'][0] ) @@ -232,7 +245,7 @@ class uiBrowse $this->results['cnt'] = $results['cnt']; foreach ($results['results'] as $rec) { $tmpId = $this->Base->gb->_idFromGunid($rec["gunid"]); - $this->results['items'][] = $this->Base->_getMetaInfo($tmpId); + $this->results['items'][] = $this->Base->getMetaInfo($tmpId); } /* diff --git a/campcaster/src/modules/htmlUI/var/ui_browser.class.php b/campcaster/src/modules/htmlUI/var/ui_browser.class.php index 64e3d9350..5155f280d 100644 --- a/campcaster/src/modules/htmlUI/var/ui_browser.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_browser.class.php @@ -5,7 +5,6 @@ * @version $Revision$ */ class uiBrowser extends uiBase { - var $alertMsg; // --- class constructor --- /** @@ -15,9 +14,9 @@ class uiBrowser extends uiBase { * @param array $config * configurartion data */ - function uiBrowser(&$config) + public function __construct(&$config) { - $this->uiBase($config); + parent::__construct($config); } // constructor @@ -71,12 +70,10 @@ class uiBrowser extends uiBase { function login($mask) { $form = new HTML_QuickForm('login', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->_parseArr2Form($form, $mask['languages']); - $this->_parseArr2Form($form, $mask['login']); - - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask['languages']); + uiBase::parseArrayToForm($form, $mask['login']); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); - return $renderer->toArray(); } // fn login @@ -123,7 +120,7 @@ class uiBrowser extends uiBase { } foreach ($data['listdata'] as $key=>$val) { if ($val['type'] != 'Folder') { - $data['listdata'][$key]['title'] = $this->_getMDataValue($val['id'], UI_MDATA_KEY_TITLE); + $data['listdata'][$key]['title'] = $this->getMetadataValue($val['id'], UI_MDATA_KEY_TITLE); } else { $data['listdata'][$key]['title'] = $val['name']; } @@ -153,8 +150,8 @@ class uiBrowser extends uiBase { $form->setConstants(array('folderId' => $folderId, 'id' => $id, 'act' => $id ? 'editItem' : 'addFileData')); - $this->_parseArr2Form($form, $mask); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn fileForm @@ -177,12 +174,12 @@ class uiBrowser extends uiBase { $const = array('folderId' => $folderId, 'id' => $id, 'act' => $id ? 'editWebstreamData' : 'addWebstreamData', - 'title' => $id ? $this->_getMDataValue($id, UI_MDATA_KEY_TITLE) : NULL, - 'url' => $id ? $this->_getMDataValue($id, UI_MDATA_KEY_URL) : 'http://', - 'length' => $id ? preg_replace("/\.[0-9]{1,6}/", "", $this->_getMDataValue($id, UI_MDATA_KEY_DURATION)) : NULL + 'title' => $id ? $this->getMetadataValue($id, UI_MDATA_KEY_TITLE) : NULL, + 'url' => $id ? $this->getMetadataValue($id, UI_MDATA_KEY_URL) : 'http://', + 'length' => $id ? preg_replace("/\.[0-9]{1,6}/", "", $this->getMetadataValue($id, UI_MDATA_KEY_DURATION)) : NULL ); $form->setConstants($const); - $this->_parseArr2Form($form, $mask); + uiBase::parseArrayToForm($form, $mask); /* $form->addGroupRule('grp', @@ -201,7 +198,7 @@ class uiBrowser extends uiBase { $form->_rules['grp[url]'][1][validation] = 'client'; */ - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn webstreamForm @@ -294,7 +291,7 @@ class uiBrowser extends uiBase { $arr[tra($key)] = $val; } } - $arr[$relations[UI_MDATA_KEY_TITLE]] = $this->_getMDataValue($id, UI_MDATA_KEY_TITLE); + $arr[$relations[UI_MDATA_KEY_TITLE]] = $this->getMetadataValue($id, UI_MDATA_KEY_TITLE); ksort($arr); return array('metadata' => $arr); @@ -316,14 +313,14 @@ class uiBrowser extends uiBase { $langid = $langid ? $langid : UI_DEFAULT_LANGID; $form = new HTML_QuickForm('langswitch', UI_STANDARD_FORM_METHOD, UI_BROWSER); - $this->_parseArr2Form($form, $mask['langswitch']); + uiBase::parseArrayToForm($form, $mask['langswitch']); $form->setConstants(array('target_langid' => $langid)); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['langswitch'] = $renderer->toArray(); $form = new HTML_QuickForm('editMetaData', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->_parseArr2Form($form, $mask['basics']); + uiBase::parseArrayToForm($form, $mask['basics']); $form->setConstants(array('act' => 'editMetaData', 'id' => $id, 'curr_langid' => $langid, @@ -338,20 +335,20 @@ class uiBrowser extends uiBase { if (!is_array($mask['pages'][$key][$k]['attributes'])) { $mask['pages'][$key][$k]['attributes'] = array(); } - $mask['pages'][$key][$k]['element'] = $key.'___'.$this->_formElementEncode($v['element']); - $mask['pages'][$key][$k]['attributes'] = array_merge($mask['pages'][$key][$k]['attributes'], array('onChange' => "spread(this, '".$this->_formElementEncode($v['element'])."')")); + $mask['pages'][$key][$k]['element'] = $key.'___'.uiBase::formElementEncode($v['element']); + $mask['pages'][$key][$k]['attributes'] = array_merge($mask['pages'][$key][$k]['attributes'], array('onChange' => "spread(this, '".uiBase::formElementEncode($v['element'])."')")); ## load data from GreenBox - if ($getval = $this->_getMDataValue($id, $v['element'], $langid, NULL)) { + if ($getval = $this->getMetadataValue($id, $v['element'], $langid, NULL)) { $mask['pages'][$key][$k]['default'] = $getval; $mask['pages'][$key][$k]['attributes']['onFocus'] = 'MData_confirmChange(this)'; } } $form->addElement('static', NULL, NULL, "
"); - $this->_parseArr2Form($form, $mask['pages'][$key]); - $this->_parseArr2Form($form, $mask['buttons']); + uiBase::parseArrayToForm($form, $mask['pages'][$key]); + uiBase::parseArrayToForm($form, $mask['buttons']); $form->addElement('static', NULL, NULL, "
"); } - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['pages'][] = $renderer->toArray(); #print_r($output); @@ -369,8 +366,8 @@ class uiBrowser extends uiBase { $mask[$key]['default'] = $p; } } - $this->_parseArr2Form($form, $mask); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn changeStationPrefs @@ -456,7 +453,7 @@ class uiBrowser extends uiBase { if (strtolower($type) === strtolower(UI_FILETYPE_AUDIOCLIP)) { $m3u = "http://{$_SERVER['SERVER_NAME']}".$this->config['accessRawAudioUrl']."?sessid={$this->sessid}&id=$clipid\n"; } else { - $m3u = $this->_getMDataValue($id, UI_MDATA_KEY_URL); + $m3u = $this->getMetadataValue($id, UI_MDATA_KEY_URL); } touch(UI_TESTSTREAM_MU3_TMP); $handle = fopen(UI_TESTSTREAM_MU3_TMP, "w"); diff --git a/campcaster/src/modules/htmlUI/var/ui_browser_init.php b/campcaster/src/modules/htmlUI/var/ui_browser_init.php index e735f34f9..773468af4 100644 --- a/campcaster/src/modules/htmlUI/var/ui_browser_init.php +++ b/campcaster/src/modules/htmlUI/var/ui_browser_init.php @@ -3,24 +3,26 @@ header("Content-type: text/html; charset=utf-8"); session_start(); ## LS classes/functions ############################################# -require_once dirname(__FILE__).'/ui_conf.php'; -require_once dirname(__FILE__).'/ui_browser.class.php'; +require_once(dirname(__FILE__).'/ui_conf.php'); +require_once(dirname(__FILE__).'/ui_browser.class.php'); ## well known classes ############################################### -require_once dirname(__FILE__).'/Smarty/libs/Smarty.class.php'; -require_once 'HTML/QuickForm/Renderer/ArraySmarty.php'; +require_once(dirname(__FILE__).'/Smarty/libs/Smarty.class.php'); +require_once('HTML/QuickForm/Renderer/ArraySmarty.php'); ## initialize objects ############################################### -$Smarty =& new Smarty; -$uiBrowser =& new uiBrowser($config); -$uiBase =& $uiBrowser; -$jscom =& new jscom(array("jscom_wrapper")); +$Smarty = new Smarty; +$uiBrowser = new uiBrowser($config); +$uiBrowser->init(); + +$uiBase =& $uiBrowser; +$jscom = new jscom(array("jscom_wrapper")); $jscom->handler(); ## load Smarty+filters ############################################## -require_once dirname(__FILE__).'/ui_smartyExtensions.inc.php'; +require_once(dirname(__FILE__).'/ui_smartyExtensions.inc.php'); #$Smarty->load_filter('output', 'trimwhitespace'); #$Smarty->load_filter('post', 'template_marker'); $Smarty->load_filter('output', 'localizer'); diff --git a/campcaster/src/modules/htmlUI/var/ui_calendar.class.php b/campcaster/src/modules/htmlUI/var/ui_calendar.class.php index ed932e1be..146986a5e 100644 --- a/campcaster/src/modules/htmlUI/var/ui_calendar.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_calendar.class.php @@ -6,21 +6,23 @@ */ class uiCalendar { - var $Decade; - var $Year; - var $Month; - var $Week; - var $Day; - var $Hour; + public $Decade; + public $Year; + public $Month; + public $Week; + public $Day; + public $Hour; - function uiCalendar() + public function __construct() { } function buildDecade() { - if (is_array($this->Decade)) return; + if (is_array($this->Decade)) { + return; + } for ($Year = $this->curr['year']-5; $Year<=$this->curr['year']+5; $Year++) { $this->Decade[] = array( @@ -34,14 +36,16 @@ class uiCalendar function buildYear() { - if (is_array($this->Year)) return; + if (is_array($this->Year)) { + return; + } - require_once 'Calendar/Year.php'; - require_once 'Calendar/Month.php'; + require_once('Calendar/Year.php'); + require_once('Calendar/Month.php'); $Year = new Calendar_Year($this->curr['year']); # mark current month - $sel = new Calendar_Month($this->curr['year'], $this->curr['month']); + $sel = new Calendar_Month($this->curr['year'], $this->curr['month']); $selections = array($sel); $Year->build($selections, UI_SCHEDULER_FIRSTWEEKDAY); @@ -57,16 +61,20 @@ class uiCalendar function buildMonth() { - if (is_array($this->Month)) return; + if (is_array($this->Month)) { + return; + } - require_once 'Calendar/Month/Weekdays.php'; - require_once 'Calendar/Day.php'; + require_once('Calendar/Month/Weekdays.php'); + require_once('Calendar/Day.php'); $Month = new Calendar_Month_Weekdays($this->curr['year'], $this->curr['month'], UI_SCHEDULER_FIRSTWEEKDAY); - $Month->build($this->_scheduledDays('month')); ## scheduled days are selected + // scheduled days are selected + $Month->build($this->_scheduledDays('month')); while ($Day = $Month->fetch()) { - $corrMonth = $Day->thisMonth()<=12 ? sprintf('%02d', $Day->thisMonth()) : '01'; ## due to bug in - $corrYear = $Day->thisMonth()<=12 ? $Day->thisYear() : $Day->thisYear()+1; ## Calendar_Month_Weekdays + // Next 2 lines are due to a bug in Calendar_Month_Weekdays + $corrMonth = $Day->thisMonth()<=12 ? sprintf('%02d', $Day->thisMonth()) : '01'; + $corrYear = $Day->thisMonth()<=12 ? $Day->thisYear() : $Day->thisYear()+1; $this->Month[] = array( 'day' => sprintf('%02d', $Day->thisDay()), 'week' => $this->_getWeekNr($Day), @@ -87,9 +95,11 @@ class uiCalendar function buildWeek() { - if (is_array($this->Week)) return; + if (is_array($this->Week)) { + return; + } - require_once 'Calendar/Week.php'; + require_once('Calendar/Week.php'); $Week = new Calendar_Week($this->curr['year'], $this->curr['month'], $this->curr['day'], UI_SCHEDULER_FIRSTWEEKDAY); $Week->build($this->_scheduledDays('week')); @@ -122,8 +132,9 @@ class uiCalendar $Day = new Calendar_Day ($this->curr['year'], $this->curr['month'], $this->curr['day']); $Day->build(); while ($Hour = $Day->fetch()) { - $corrMonth = $Hour->thisMonth()<=12 ? sprintf('%02d', $Hour->thisMonth()) : '01'; ## due to bug in - $corrYear = $Hour->thisMonth()<=12 ? $Day->thisYear() : $Hour->thisYear()+1; ## Calendar_Month_Weekdays + // Next two lines are due to a bug in Calendar_Month_Weekdays + $corrMonth = $Hour->thisMonth()<=12 ? sprintf('%02d', $Hour->thisMonth()) : '01'; + $corrYear = $Hour->thisMonth()<=12 ? $Day->thisYear() : $Hour->thisYear()+1; $this->Day[] = array( 'day' => sprintf('%02d', $Hour->thisDay()), 'week' => $this->_getWeekNr($Hour), @@ -141,7 +152,9 @@ class uiCalendar function buildHour() { - if (is_array($this->Hour)) return; + if (is_array($this->Hour)) { + return; + } require_once('Calendar/Hour.php'); diff --git a/campcaster/src/modules/htmlUI/var/ui_conf.php b/campcaster/src/modules/htmlUI/var/ui_conf.php index 680509cdd..00647a827 100644 --- a/campcaster/src/modules/htmlUI/var/ui_conf.php +++ b/campcaster/src/modules/htmlUI/var/ui_conf.php @@ -124,7 +124,9 @@ $config = array_merge($config, 'file_types' => array( '.mp3', '.wav', - '.ogg' + '.ogg', + '.flac', + '.aac' ), 'stream_types' => array( 'application/ogg', diff --git a/campcaster/src/modules/htmlUI/var/ui_exchange.class.php b/campcaster/src/modules/htmlUI/var/ui_exchange.class.php index 5d0014551..ddca5b8f8 100644 --- a/campcaster/src/modules/htmlUI/var/ui_exchange.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_exchange.class.php @@ -6,11 +6,11 @@ */ class uiExchange { - var $Base; - var $file; - var $folder; + private $Base; + private $file; + private $folder; - function uiExchange(&$uiBase) + public function __construct(&$uiBase) { $this->Base =& $uiBase; $this->file =& $_SESSION['EXCHANGE']['file']; @@ -103,8 +103,8 @@ class uiExchange { include('formmask/exchange.inc.php'); $form = new HTML_QuickForm('BACKUP_Schedule', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask['BACKUP.schedule']); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask['BACKUP.schedule']); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } @@ -113,7 +113,8 @@ class uiExchange /** * Copy a file or directory. * - * @param string $target - path to file or directory + * @param string $target + * path to file or directory * @return boolean */ function copy2target($target) diff --git a/campcaster/src/modules/htmlUI/var/ui_handler.class.php b/campcaster/src/modules/htmlUI/var/ui_handler.class.php index 605cb8223..2c6bb2549 100644 --- a/campcaster/src/modules/htmlUI/var/ui_handler.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_handler.class.php @@ -9,8 +9,8 @@ define('ACTION_BASE', '/actions' ) ; * @version $Revision$ */ class uiHandler extends uiBase { - var $uiBase; - var $redirUrl; + public $uiBase; + public $redirUrl; /** * Initialize a new Browser Class @@ -19,9 +19,9 @@ class uiHandler extends uiBase { * @param array $config * configurartion data */ - function uiHandler($config) + public function __construct($config) { - $this->uiBase($config); + parent::__construct($config); } // constructor @@ -152,12 +152,12 @@ class uiHandler extends uiBase { return FALSE; } - $this->_setMDataValue($r, UI_MDATA_KEY_TITLE, $formdata['mediafile']['name']); + $this->setMetadataValue($r, UI_MDATA_KEY_TITLE, $formdata['mediafile']['name']); $this->transMData($r); // set records in default language too if (UI_UPLOAD_LANGID !== UI_DEFAULT_LANGID) { - $this->_setMDataValue($r, UI_MDATA_KEY_TITLE, $formdata['mediafile']['name'], UI_UPLOAD_LANGID); + $this->setMetadataValue($r, UI_MDATA_KEY_TITLE, $formdata['mediafile']['name'], UI_UPLOAD_LANGID); $this->transMData($r, UI_UPLOAD_LANGID); } @@ -196,20 +196,20 @@ class uiHandler extends uiBase { return; } $this->_setMdataValue($id, UI_MDATA_KEY_DURATION, $this->gb->_secsToPlTime($ia['playtime_seconds'])); - $this->_setMDataValue($id, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_FILE); + $this->setMetadataValue($id, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_FILE); // some data from raw audio if (isset($ia['audio']['channels'])) { - $this->_setMDataValue($id, UI_MDATA_KEY_CHANNELS, $ia['audio']['channels']); + $this->setMetadataValue($id, UI_MDATA_KEY_CHANNELS, $ia['audio']['channels']); } if (isset($ia['audio']['sample_rate'])) { - $this->_setMDataValue($id, UI_MDATA_KEY_SAMPLERATE, $ia['audio']['sample_rate']); + $this->setMetadataValue($id, UI_MDATA_KEY_SAMPLERATE, $ia['audio']['sample_rate']); } if (isset($ia['audio']['bitrate'])) { - $this->_setMDataValue($id, UI_MDATA_KEY_BITRATE, $ia['audio']['bitrate']); + $this->setMetadataValue($id, UI_MDATA_KEY_BITRATE, $ia['audio']['bitrate']); } if (isset($ia['audio']['codec'])) { - $this->_setMDataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']); + $this->setMetadataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']); } // from id3 Tags @@ -256,9 +256,9 @@ class uiHandler extends uiBase { $extent = sprintf('%02d', $formdata['length']['H']).':'.sprintf('%02d', $formdata['length']['i']).':'.sprintf('%02d', $formdata['length']['s']).'.000000'; - $this->_setMDataValue($r, UI_MDATA_KEY_TITLE, $formdata['title']); - $this->_setMDataValue($r, UI_MDATA_KEY_DURATION, $extent); - $this->_setMDataValue($r, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_STREAM); + $this->setMetadataValue($r, UI_MDATA_KEY_TITLE, $formdata['title']); + $this->setMetadataValue($r, UI_MDATA_KEY_DURATION, $extent); + $this->setMetadataValue($r, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_STREAM); $this->redirUrl = UI_BROWSER."?act=addWebstreamMData&id=$r"; if (UI_VERBOSE) { @@ -277,9 +277,9 @@ class uiHandler extends uiBase { } $extent = sprintf('%02d', $formdata['length']['H']).':'.sprintf('%02d', $formdata['length']['i']).':'.sprintf('%02d', $formdata['length']['s']).'.000000'; - $this->_setMDataValue($id, UI_MDATA_KEY_TITLE, $formdata['title']); - $this->_setMDataValue($id, UI_MDATA_KEY_URL, $formdata['url']); - $this->_setMDataValue($id, UI_MDATA_KEY_DURATION, $extent); + $this->setMetadataValue($id, UI_MDATA_KEY_TITLE, $formdata['title']); + $this->setMetadataValue($id, UI_MDATA_KEY_URL, $formdata['url']); + $this->setMetadataValue($id, UI_MDATA_KEY_DURATION, $extent); $this->redirUrl = UI_BROWSER.'?act=editItem&id='.$formdata['id']; if (UI_VERBOSE) { @@ -302,7 +302,7 @@ class uiHandler extends uiBase { foreach ($mask['pages'] as $key => $val) { foreach ($mask['pages'][$key] as $k => $v) { - $formdata[$key.'___'.$this->_formElementEncode($v['element'])] ? $mData[$this->_formElementDecode($v['element'])] = $formdata[$key.'___'.$this->_formElementEncode($v['element'])] : NULL; + $formdata[$key.'___'.uiBase::formElementEncode($v['element'])] ? $mData[uiBase::formElementDecode($v['element'])] = $formdata[$key.'___'.uiBase::formElementEncode($v['element'])] : NULL; } } @@ -311,7 +311,7 @@ class uiHandler extends uiBase { } foreach ($mData as $key => $val) { - $r = $this->_setMDataValue($id, $key, $val, $curr_langid); + $r = $this->setMetadataValue($id, $key, $val, $curr_langid); if (PEAR::isError($r)) { $this->_retMsg('Unable to set "$1" to value "$2".', $key, $val); } @@ -542,7 +542,7 @@ class uiHandler extends uiBase { function _validateForm($formdata, $mask) { $form = new HTML_QuickForm('validation', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->_parseArr2Form($form, $mask, 'server'); + uiBase::parseArrayToForm($form, $mask, 'server'); if (!$form->validate()) { $_SESSION['retransferFormData'] = $_REQUEST; return FALSE; diff --git a/campcaster/src/modules/htmlUI/var/ui_handler_init.php b/campcaster/src/modules/htmlUI/var/ui_handler_init.php index b7803cc7b..d32134513 100644 --- a/campcaster/src/modules/htmlUI/var/ui_handler_init.php +++ b/campcaster/src/modules/htmlUI/var/ui_handler_init.php @@ -7,7 +7,8 @@ require_once(dirname(__FILE__).'/ui_conf.php'); require_once(dirname(__FILE__).'/ui_handler.class.php'); ## initialize objects ############################################### -$uiHandler =& new uiHandler($config); +$uiHandler = new uiHandler($config); +$uiHandler->init(); $uiBase =& $uiHandler; include("../templates/loader/index.tpl"); diff --git a/campcaster/src/modules/htmlUI/var/ui_hubBrowse.class.php b/campcaster/src/modules/htmlUI/var/ui_hubBrowse.class.php index f764a85dc..8290acf78 100644 --- a/campcaster/src/modules/htmlUI/var/ui_hubBrowse.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_hubBrowse.class.php @@ -7,17 +7,17 @@ class uiHubBrowse extends uiBrowse { - function uiHubBrowse(&$uiBase) + public function __construct(&$uiBase) { - $this->Base =& $uiBase; - $this->prefix = 'HUBBROWSE'; - $this->col =& $_SESSION[UI_HUBBROWSE_SESSNAME]['col']; - $this->criteria =& $_SESSION[UI_HUBBROWSE_SESSNAME]['criteria']; - #$this->results =& $_SESSION[UI_HUBBROWSE_SESSNAME]['results']; - $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; + $this->Base =& $uiBase; + $this->prefix = 'HUBBROWSE'; + $this->col =& $_SESSION[UI_HUBBROWSE_SESSNAME]['col']; + $this->criteria =& $_SESSION[UI_HUBBROWSE_SESSNAME]['criteria']; + #$this->results =& $_SESSION[UI_HUBBROWSE_SESSNAME]['results']; + $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; if (empty($this->criteria['limit'])) { - $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT; + $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT; } if (empty($this->criteria['filetype'])) { $this->criteria['filetype'] = UI_FILETYPE_ANY; @@ -53,8 +53,8 @@ class uiHubBrowse extends uiBrowse } $this->results['cnt'] = $results['cnt']; foreach ($results['results'] as $rec) { - // TODO: maybe this _getMetaInfo is not correct for the remote results - $this->results['items'][] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($rec)); + // TODO: maybe this getMetaInfo is not correct for the remote results + $this->results['items'][] = $this->Base->getMetaInfo($this->Base->gb->_idFromGunid($rec)); } $this->pagination($results); // echo 'this->results:'; print_r($this->results); echo "\n"; diff --git a/campcaster/src/modules/htmlUI/var/ui_hubSearch.class.php b/campcaster/src/modules/htmlUI/var/ui_hubSearch.class.php index 69f85cde9..936c203ff 100644 --- a/campcaster/src/modules/htmlUI/var/ui_hubSearch.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_hubSearch.class.php @@ -6,13 +6,13 @@ */ class uiHubSearch extends uiSearch { - function uiHubSearch(&$uiBase) + public function __construct(&$uiBase) { - $this->Base =& $uiBase; - $this->prefix = 'HUBSEARCH'; - #$this->results =& $_SESSION[UI_HUBSEARCH_SESSNAME]['results']; - $this->criteria =& $_SESSION[UI_HUBSEARCH_SESSNAME]['criteria']; - $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; + $this->Base =& $uiBase; + $this->prefix = 'HUBSEARCH'; + #$this->results =& $_SESSION[UI_HUBSEARCH_SESSNAME]['results']; + $this->criteria =& $_SESSION[UI_HUBSEARCH_SESSNAME]['criteria']; + $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; if (empty($this->criteria['limit'])) { $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT; @@ -33,24 +33,24 @@ class uiHubSearch extends uiSearch { function newSearch(&$formdata) { - $this->results = NULL; - $this->criteria['conditions'] = NULL; - $this->criteria['offset'] = NULL; - $this->criteria['form'] = NULL; - $this->criteria['operator'] = $formdata['operator']; - $this->criteria['filetype'] = $formdata['filetype']; - $this->criteria['limit'] = $formdata['limit']; - $this->criteria['counter'] = 0; + $this->results = NULL; + $this->criteria['conditions'] = NULL; + $this->criteria['offset'] = NULL; + $this->criteria['form'] = NULL; + $this->criteria['operator'] = $formdata['operator']; + $this->criteria['filetype'] = $formdata['filetype']; + $this->criteria['limit'] = $formdata['limit']; + $this->criteria['counter'] = 0; // $criteria['form'] is used for retransfer to form $this->criteria['form']['operator'] = $formdata['operator']; $this->criteria['form']['filetype'] = $formdata['filetype']; - $this->criteria['form']['limit'] = $formdata['limit']; + $this->criteria['form']['limit'] = $formdata['limit']; - foreach ($formdata as $key=>$val) { + foreach ($formdata as $key => $val) { if (is_array($val) && $val['active']) { $this->criteria['counter']++; - $this->criteria['conditions'][$key] = array('cat' => $this->Base->_formElementDecode($val[0]), + $this->criteria['conditions'][$key] = array('cat' => uiBase::formElementDecode($val[0]), 'op' => $val[1], 'val' => stripslashes($val[2]) ); @@ -83,7 +83,7 @@ class uiHubSearch extends uiSearch { } foreach ($results['results'] as $rec) { $tmpId = $this->Base->gb->_idFromGunid($rec["gunid"]); - $this->results['items'][] = $this->Base->_getMetaInfo($tmpId); + $this->results['items'][] = $this->Base->getMetaInfo($tmpId); } $this->results['cnt'] = $results['cnt']; @@ -94,16 +94,18 @@ class uiHubSearch extends uiSearch { } // fn searchDB - function getSearchResults($trtokid) { + function getSearchResults($trtokid) + { $this->results = array('page' => $this->criteria['offset']/$this->criteria['limit']); $results = $this->Base->gb->getSearchResults($trtokid); + //echo"
RESULTS:
";print_r($results);echo "
"; if (!is_array($results) || !count($results)) { return false; } $this->results['cnt'] = $results['cnt']; foreach ($results['results'] as $rec) { - // TODO: maybe this _getMetaInfo is not correct for the remote results - $this->results['items'][] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($rec)); + // TODO: maybe this getMetaInfo is not correct for the remote results + $this->results['items'][] = $this->Base->getMetaInfo($this->Base->gb->_idFromGunid($rec)); } $this->pagination($results); //echo 'this->results:'; print_r($this->results); echo "\n"; diff --git a/campcaster/src/modules/htmlUI/var/ui_jscom.php b/campcaster/src/modules/htmlUI/var/ui_jscom.php index c157fba18..d898fa6ca 100644 --- a/campcaster/src/modules/htmlUI/var/ui_jscom.php +++ b/campcaster/src/modules/htmlUI/var/ui_jscom.php @@ -6,12 +6,12 @@ * @version $Revision$ */ class jscom { - var $prefix = 'jsc_'; - var $callables = array(); - var $method = 'POST'; - var $uri = ''; + private $prefix = 'jsc_'; + private $callables = array(); + private $method = 'POST'; + private $uri = ''; - function jscom($calls = NULL, $pars = NULL) + public function __construct($calls = NULL, $pars = NULL) { $this->uri = $_SERVER['REQUEST_URI']; if (!is_null($calls)) { diff --git a/campcaster/src/modules/htmlUI/var/ui_playlist.class.php b/campcaster/src/modules/htmlUI/var/ui_playlist.class.php index 876ef91d7..6dec9d72c 100644 --- a/campcaster/src/modules/htmlUI/var/ui_playlist.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_playlist.class.php @@ -6,23 +6,25 @@ */ class uiPlaylist { - var $Base; - var $activeId; - var $changed; - var $title; - var $duration; - var $token; - var $reloadUrl; - var $redirectUrl; - var $returnUrl; + public $activeId; + public $title; + public $duration; + public $changed; + public $token; - function uiPlaylist(&$uiBase) + private $Base; + private $reloadUrl; + private $redirectUrl; + private $returnUrl; + private $flat; + + public function __construct(&$uiBase) { $this->Base =& $uiBase; $this->activeId =& $_SESSION[UI_PLAYLIST_SESSNAME]['activeId']; $this->changed =& $_SESSION[UI_PLAYLIST_SESSNAME]['changed']; - $this->title = $this->Base->_getMDataValue($this->activeId, UI_MDATA_KEY_TITLE); - $this->duration = $this->Base->_getMDataValue($this->activeId, UI_MDATA_KEY_DURATION); + $this->title = $this->Base->getMetadataValue($this->activeId, UI_MDATA_KEY_TITLE); + $this->duration = $this->Base->getMetadataValue($this->activeId, UI_MDATA_KEY_DURATION); $this->token =& $_SESSION[UI_PLAYLIST_SESSNAME]['token']; $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; $this->redirectUrl = UI_BROWSER.'?popup[]=_2PL.simpleManagement&popup[]=_close'; @@ -100,14 +102,14 @@ class uiPlaylist if (UI_VERBOSE === TRUE) { print_r($token); } - $this->Base->_retMsg('Unable to open playlist "$1".', $this->Base->_getMDataValue($plid, UI_MDATA_KEY_TITLE)); + $this->Base->_retMsg('Unable to open playlist "$1".', $this->Base->getMetadataValue($plid, UI_MDATA_KEY_TITLE)); return FALSE; } $this->token = $token; $this->Base->gb->savePref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY, $plid.':'.$this->token); $this->activeId = $plid; if ($msg && UI_VERBOSE) { - $this->Base->_retMsg('Playlist "$1" opened.', $this->Base->_getMDataValue($plid, UI_MDATA_KEY_TITLE)); + $this->Base->_retMsg('Playlist "$1" opened.', $this->Base->getMetadataValue($plid, UI_MDATA_KEY_TITLE)); } return TRUE; @@ -137,7 +139,7 @@ class uiPlaylist return FALSE; } if ($msg && UI_VERBOSE) { - $this->Base->_retMsg('Playlist "$1" released.', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE)); + $this->Base->_retMsg('Playlist "$1" released.', $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE)); } $this->activeId = NULL; $this->token = NULL; @@ -155,7 +157,7 @@ class uiPlaylist $this->activate($tmpid, FALSE); $this->changed = FALSE; if (UI_VERBOSE) { - $this->Base->_retMsg('Playlist "$1" saved.', $this->Base->_getMDataValue($tmpid, UI_MDATA_KEY_TITLE)); + $this->Base->_retMsg('Playlist "$1" saved.', $this->Base->getMetadataValue($tmpid, UI_MDATA_KEY_TITLE)); } return $this->activeId; @@ -181,7 +183,7 @@ class uiPlaylist return FALSE; } if (UI_VERBOSE) { - $this->Base->_retMsg('Playlist "$1" reverted.', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE)); + $this->Base->_retMsg('Playlist "$1" reverted.', $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE)); } $this->activeId = NULL; $this->token = NULL; @@ -306,8 +308,8 @@ class uiPlaylist return FALSE; } - $this->Base->_setMDataValue($plid, UI_MDATA_KEY_CREATOR, $this->Base->login); - $this->Base->_setMDataValue($plid, UI_MDATA_KEY_DESCRIPTION, tra('created at $1', $datetime)); + $this->Base->setMetadataValue($plid, UI_MDATA_KEY_CREATOR, $this->Base->login); + $this->Base->setMetadataValue($plid, UI_MDATA_KEY_DESCRIPTION, tra('created at $1', $datetime)); if ($this->activate($plid)===FALSE) { return FALSE; @@ -323,18 +325,16 @@ class uiPlaylist } // fn create - function getFlat($id) + public function getFlat($id) { - unset($this->flat); $this->_plwalk($this->getPLArray($id)); - if (is_Array($this->flat)) { + if (count($this->flat) > 0) { reset($this->flat); $this->flat[key($this->flat)]['firstInList'] = true; end($this->flat); $this->flat[key($this->flat)]['lastInList'] = true; reset($this->flat); - return $this->flat; } else { return array(); @@ -342,16 +342,17 @@ class uiPlaylist } // fn getFlat - function _plwalk($arr, $parent=0, $attrs=0) + private function _plwalk($arr, $parent=0, $attrs=0) { - foreach ($arr['children'] as $node=>$sub) { + $this->flat = array(); + foreach ($arr['children'] as $node => $sub) { if ($sub['elementname']===UI_PL_ELEM_PLAYLIST) { $this->_plwalk($sub, $node, $sub['attrs']); } if ($sub['elementname']===UI_FILETYPE_AUDIOCLIP || $sub['elementname']===UI_FILETYPE_PLAYLIST) { #$this->flat["$parent.$node"] = $sub['attrs']; #$this->flat["$parent.$node"]['type'] = $sub['elementname']; - $this->flat[$parent] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($sub['attrs']['id'])); + $this->flat[$parent] = $this->Base->getMetaInfo($this->Base->gb->_idFromGunid($sub['attrs']['id'])); $this->flat[$parent]['attrs'] = $attrs; $this->flat[$parent]['playlength'] = $sub['attrs']['playlength']; } @@ -535,9 +536,9 @@ class uiPlaylist $form->setConstants(array('id' => $id, 'duration' => $duration) ); - $this->Base->_parseArr2Form($form, $mask[$type]); - $this->Base->_parseArr2Form($form, $mask['all']); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask[$type]); + uiBase::parseArrayToForm($form, $mask['all']); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn changeTransitionForm @@ -546,9 +547,9 @@ class uiPlaylist function changeAllTransitionsForm($mask) { $form = new HTML_QuickForm('PL_changeTransition', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask['transition']); - $this->Base->_parseArr2Form($form, $mask['all']); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask['transition']); + uiBase::parseArrayToForm($form, $mask['all']); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn changeAllTransitionsForm @@ -565,13 +566,13 @@ class uiPlaylist } else { $mask['act']['constant'] = 'PL.addItem'; $mask['id']['constant'] = $id; - $mask['playlength']['default'] = substr($this->Base->_getMDataValue($id, UI_MDATA_KEY_DURATION), 0, 8); + $mask['playlength']['default'] = substr($this->Base->getMetadataValue($id, UI_MDATA_KEY_DURATION), 0, 8); $mask['duration']['constant'] = $mask['playlength']['default']; } $form = new HTML_QuickForm('PL_setItemPlaylengthForm', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn setItemPlaylengthForm @@ -584,29 +585,29 @@ class uiPlaylist $langid = $langid ? $langid : UI_DEFAULT_LANGID; foreach ($mask['playlist'] as $k=>$v) { - $mask['playlist'][$k]['element'] = $this->Base->_formElementEncode($v['element']); - if ($getval = $this->Base->_getMDataValue($id, $v['element'], $langid)) { + $mask['playlist'][$k]['element'] = uiBase::formElementEncode($v['element']); + if ($getval = $this->Base->getMetadataValue($id, $v['element'], $langid)) { $mask['playlist'][$k]['default'] = $getval; $mask['playlist'][$k]['attributes']['onFocus'] = 'MData_confirmChange(this)'; }; } $form = new HTML_QuickForm('editMetaData', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask['basics']); - $this->Base->_parseArr2Form($form, $mask['playlist']); - $this->Base->_parseArr2Form($form, $mask['buttons']); + uiBase::parseArrayToForm($form, $mask['basics']); + uiBase::parseArrayToForm($form, $mask['playlist']); + uiBase::parseArrayToForm($form, $mask['buttons']); $form->setConstants(array('act' => 'PL.editMetaData', 'id' => $id, 'curr_langid' => $langid ) ); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['main'] = $renderer->toArray(); $form = new HTML_QuickForm('langswitch', UI_STANDARD_FORM_METHOD, UI_BROWSER); - $this->Base->_parseArr2Form($form, $mask['langswitch']); + uiBase::parseArrayToForm($form, $mask['langswitch']); $form->setConstants(array('target_langid' => $langid)); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['langswitch'] = $renderer->toArray(); @@ -632,7 +633,7 @@ class uiPlaylist } foreach ($mask['playlist'] as $k=>$v) { - $formdata[$this->Base->_formElementEncode($v['element'])] ? $mData[$this->Base->_formElementDecode($v['element'])] = $formdata[$this->Base->_formElementEncode($v['element'])] : NULL; + $formdata[uiBase::formElementEncode($v['element'])] ? $mData[uiBase::formElementDecode($v['element'])] = $formdata[uiBase::formElementEncode($v['element'])] : NULL; } if (!count($mData)) { @@ -699,8 +700,8 @@ class uiPlaylist $mask['act']['constant'] = 'PL.export'; $mask['id']['constant'] = $id; $form = new HTML_QuickForm('PL_exportForm', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn exportForm @@ -710,8 +711,8 @@ class uiPlaylist { $form = new HTML_QuickForm('PL_importForm', UI_STANDARD_FORM_METHOD, UI_HANDLER); //print_r($mask); - $this->Base->_parseArr2Form($form, $mask); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } // fn importForm diff --git a/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php b/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php index 7f301722a..578fb1717 100644 --- a/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php @@ -5,45 +5,42 @@ * @version $Revision$ */ class uiScheduler extends uiCalendar { - var $curr; - var $scheduleAtTime; - var $schedulePrev; - var $scheduleNext; - var $error; - var $Base; - var $reloadUrl; - var $closeUrl; - var $firstDayOfWeek; + public $curr; + private $scheduleAtTime; + private $schedulePrev; + private $scheduleNext; + private $error; + private $Base; + private $reloadUrl; + private $closeUrl; + private $firstDayOfWeek; - function uiScheduler(&$uiBase) + public function __construct(&$uiBase) { - $this->curr =& $_SESSION[UI_CALENDAR_SESSNAME]['current']; + $this->curr =& $_SESSION[UI_CALENDAR_SESSNAME]['current']; $this->scheduleAtTime =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleAtTime']; - $this->schedulePrev =& $_SESSION[UI_CALENDAR_SESSNAME]['schedulePrev']; - $this->scheduleNext =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleNext']; - $this->error =& $_SESSION['SCHEDULER']['error']; - $this->error =& $_SESSION['SCHEDULER']['error']; + $this->schedulePrev =& $_SESSION[UI_CALENDAR_SESSNAME]['schedulePrev']; + $this->scheduleNext =& $_SESSION[UI_CALENDAR_SESSNAME]['scheduleNext']; + $this->error =& $_SESSION['SCHEDULER']['error']; if (!is_array($this->curr)) { - $this->curr['view'] = UI_SCHEDULER_DEFAULT_VIEW; - $this->curr['year'] = strftime("%Y"); - $this->curr['month'] = strftime("%m"); - $this->curr['week'] = strftime("%V"); - $this->curr['day'] = strftime("%d"); - $this->curr['hour'] = strftime("%H"); - $this->curr['dayname'] = strftime("%A"); + $this->curr['view'] = UI_SCHEDULER_DEFAULT_VIEW; + $this->curr['year'] = strftime("%Y"); + $this->curr['month'] = strftime("%m"); + $this->curr['week'] = strftime("%V"); + $this->curr['day'] = strftime("%d"); + $this->curr['hour'] = strftime("%H"); + $this->curr['dayname'] = strftime("%A"); $this->curr['monthname'] = strftime("%B"); - $this->curr['isToday'] = TRUE; + $this->curr['isToday'] = TRUE; } $this->Base =& $uiBase; $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; - $this->closeUrl = UI_BROWSER.'?popup[]=_close'; - - $this->uiCalendar(); + $this->closeUrl = UI_BROWSER.'?popup[]=_close'; + parent::__construct(); $this->initXmlRpc(); - //$this->startDaemon(); } // constructor @@ -298,8 +295,8 @@ class uiScheduler extends uiCalendar { 'end' => substr($val['end'], strpos($val['end'], 'T')+1), 'start_stamp' => $this->_datetime2timestamp($val['start']), 'end_stamp' => $this->_datetime2timestamp($val['end']), - 'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), - 'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), + 'title' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), + 'creator' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), 'type' => 'Playlist' ); } @@ -338,8 +335,8 @@ class uiScheduler extends uiCalendar { 'scheduleid'=> $val['id'], 'start' => substr($val['start'], strpos($val['start'], 'T')+1), 'end' => substr($val['end'], strpos($val['end'], 'T') + 1), - 'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), - 'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), + 'title' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), + 'creator' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), 'type' => 'Playlist', 'endstoday' => strftime('%d', $start) === strftime('%d', $end) ? TRUE : FALSE, 'endshere' => strftime('%H', $start) === strftime('%H', $end) ? TRUE : FALSE @@ -360,8 +357,8 @@ class uiScheduler extends uiCalendar { 'scheduleid'=> $val['id'], 'start' => substr($val['start'], strpos($val['start'], 'T')+1), 'end' => substr($val['end'], strpos($val['end'], 'T') + 1), - 'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), - 'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), + 'title' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), + 'creator' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), 'type' => 'Playlist', 'startsyesterday' => strftime('%d', $start) === strftime('%d', $end) ? FALSE : TRUE, ); @@ -383,8 +380,8 @@ class uiScheduler extends uiCalendar { $items[date('H', $this->_datetime2timestamp($val['start']))][]= array ( 'start' => substr($val['start'], strpos($val['start'], 'T')+1), 'end' => substr($val['end'], strpos($val['end'], 'T') + 1), - 'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), - 'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), + 'title' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), + 'creator' => $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), ); } #print_r($items); @@ -403,8 +400,8 @@ class uiScheduler extends uiCalendar { } foreach ($arr as $key => $val) { - $arr[$key]['title'] = $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE); - $arr[$key]['creator'] = $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR); + $arr[$key]['title'] = $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE); + $arr[$key]['creator'] = $this->Base->getMetadataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR); $arr[$key]['pos'] = $this->_datetime2timestamp($val['start']); $arr[$key]['span'] = date('H', $this->_datetime2timestamp($val['end'])) - date('H', $this->_datetime2timestamp($val['start'])) +1; } @@ -446,7 +443,7 @@ class uiScheduler extends uiCalendar { //print_r($ui_fmask['schedule']); $form = new HTML_QuickForm('schedule', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $ui_fmask['schedule']); + uiBase::parseArrayToForm($form, $ui_fmask['schedule']); $settime = array('H' => $this->scheduleAtTime['hour'], 'i' => $this->scheduleAtTime['minute'], 's' => $this->scheduleAtTime['second'] @@ -459,7 +456,7 @@ class uiScheduler extends uiCalendar { 'date' => $setdate, )); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output = $renderer->toArray(); //print_r($output); @@ -473,8 +470,8 @@ class uiScheduler extends uiCalendar { $this->Base->SCRATCHPAD->addItem($id); $this->availablePlaylists[] = array( 'gunid' => $this->Base->gb->_gunidFromId($id), - 'title' => $this->Base->_getMDataValue($id, UI_MDATA_KEY_TITLE), - 'duration' => $this->Base->_getMDataValue($id, UI_MDATA_KEY_DURATION), + 'title' => $this->Base->getMetadataValue($id, UI_MDATA_KEY_TITLE), + 'duration' => $this->Base->getMetadataValue($id, UI_MDATA_KEY_DURATION), ); return TRUE; } else { @@ -643,6 +640,7 @@ class uiScheduler extends uiCalendar { return array(FALSE); } + $pStampArr = null; foreach ($pArr as $val) { #print_r($val); $pStampArr[] = array('start' => $this->_datetime2timestamp($val['start']), diff --git a/campcaster/src/modules/htmlUI/var/ui_schedulerPhpClient.class.php b/campcaster/src/modules/htmlUI/var/ui_schedulerPhpClient.class.php index 0b0824acc..32f690981 100644 --- a/campcaster/src/modules/htmlUI/var/ui_schedulerPhpClient.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_schedulerPhpClient.class.php @@ -171,45 +171,55 @@ $mdefs = array( class SchedulerPhpClient { /** - * Databases object reference + * Databases object reference + * @var DB */ - var $dbc = NULL; - /** - * Array with methods description - */ - var $mdefs = array(); - /** - * Confiduration array from ../conf.php - */ - var $config = array(); - /** - * XMLRPC client object reference - */ - var $client = NULL; - /** - * Verbosity flag - */ - var $verbose = FALSE; - /** - * XMLRPC debug flag - */ - var $debug = 0; + private $dbc = NULL; /** - * Constructor - please DON'T CALL IT, use factory method instead + * Array with methods description + * @var array + */ + private $mdefs = array(); + + /** + * Confiduration array from ../conf.php + * @var array + */ + private $config = array(); + + /** + * XMLRPC client object reference + * @var XMLRPC_Client + */ + private $client = NULL; + + /** + * Verbosity flag + * @var boolean + */ + private $verbose = FALSE; + + /** + * XMLRPC debug flag + * @var boolean + */ + private $debug = 0; + + /** + * Constructor - please DON'T CALL IT, use factory method instead * - * @param DB $dbc - * @param array $mdefs - * hash array with methods description - * @param array $config - * hash array with configuration - * @param int $debug - * XMLRPC debug flag - * @param boolean $verbose + * @param DB $dbc + * @param array $mdefs + * hash array with methods description + * @param array $config + * hash array with configuration + * @param int $debug + * XMLRPC debug flag + * @param boolean $verbose * verbosity flag */ - function SchedulerPhpClient( - &$dbc, $mdefs, $config, $debug=0, $verbose=FALSE) + public function __construct(&$dbc, $mdefs, $config, $debug=0, $verbose=FALSE) { $this->dbc = $dbc; $this->mdefs = $mdefs; @@ -252,7 +262,7 @@ class SchedulerPhpClient { * verbosity flag * @return object, created object instance */ - function &factory(&$dbc, $mdefs, $config, $debug=0, $verbose=FALSE) + public function &factory(&$dbc, $mdefs, $config, $debug=0, $verbose=FALSE) { $f = ''; foreach ($mdefs as $fn => $farr) { @@ -271,7 +281,7 @@ class SchedulerPhpClient { if (FALSE === eval($e)) { return $dbc->raiseError("Eval failed"); } - $spc =& new SchedulerPhpClientCore( + $spc = new SchedulerPhpClientCore( $dbc, $mdefs, $config, $debug, $verbose); return $spc; } // fn factory @@ -288,7 +298,7 @@ class SchedulerPhpClient { * @return array * PHP hash with response */ - function callMethod($method, $gettedPars) + public function callMethod($method, $gettedPars) { $parr = array(); $XML_RPC_val = new XML_RPC_Value; diff --git a/campcaster/src/modules/htmlUI/var/ui_scratchpad.class.php b/campcaster/src/modules/htmlUI/var/ui_scratchpad.class.php index 63589b2ac..2e0794cdb 100644 --- a/campcaster/src/modules/htmlUI/var/ui_scratchpad.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_scratchpad.class.php @@ -6,14 +6,14 @@ */ class uiScratchPad { - var $Base; - var $items; - var $order; - var $reloadUrl; + private $Base; + private $items; + private $order; + private $reloadUrl; - function uiScratchPad(&$uiBase) + public function __construct(&$uiBase) { - $this->Base =& $uiBase; + $this->Base =& $uiBase; $this->items =& $_SESSION[UI_SCRATCHPAD_SESSNAME]['content']; $this->order =& $_SESSION[UI_SCRATCHPAD_SESSNAME]['order']; $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; @@ -46,8 +46,8 @@ class uiScratchPad foreach ($arr as $gunid) { if (preg_match('/[0-9]{1,20}/', $gunid)) { - if ($this->Base->gb->_idFromGunid($this->Base->_toHex($gunid)) != FALSE) { - if ($i = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($this->Base->_toHex($gunid)))) { + if ($this->Base->gb->_idFromGunid($this->Base->toHex($gunid)) != FALSE) { + if ($i = $this->Base->getMetaInfo($this->Base->gb->_idFromGunid($this->Base->toHex($gunid)))) { $this->items[] = $i; } } @@ -61,7 +61,7 @@ class uiScratchPad { foreach ($this->items as $val) { //$str .= $val['gunid'].':'.$val['added'].' '; ## new format ### - $str .= $this->Base->_toInt8($val['gunid']).' '; ## Akos� old format ### + $str .= $this->Base->toInt8($val['gunid']).' '; ## Akos� old format ### } $this->Base->gb->savePref($this->Base->sessid, UI_SCRATCHPAD_KEY, $str); } // fn save @@ -87,7 +87,7 @@ class uiScratchPad $sp = $this->get(); foreach ($ids as $id) { - $item = $this->Base->_getMetaInfo($id); + $item = $this->Base->getMetaInfo($id); foreach ($sp as $key=>$val) { if ($val['id'] == $item['id']) { @@ -167,7 +167,7 @@ class uiScratchPad function reLoadM() { foreach($this->items as $key=>$val) { - $this->items[$key] = $this->Base->_getMetaInfo($val['id']); + $this->items[$key] = $this->Base->getMetaInfo($val['id']); } } } // class uiScratchPad diff --git a/campcaster/src/modules/htmlUI/var/ui_search.class.php b/campcaster/src/modules/htmlUI/var/ui_search.class.php index d184f135e..ab85fa6b4 100644 --- a/campcaster/src/modules/htmlUI/var/ui_search.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_search.class.php @@ -6,21 +6,21 @@ */ class uiSearch { - var $Base; - var $prefix; - var $criteria; - var $reloadUrl; - var $results; + private $Base; + private $prefix; + private $criteria; + private $reloadUrl; + private $results; - function uiSearch(&$uiBase) + public function __construct(&$uiBase) { - $this->Base =& $uiBase; - $this->prefix = 'SEARCH'; - //$this->results =& $_SESSION[UI_SEARCH_SESSNAME]['results']; - $this->criteria =& $_SESSION[UI_SEARCH_SESSNAME]['criteria']; - $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; + $this->Base =& $uiBase; + $this->prefix = 'SEARCH'; + //$this->results =& $_SESSION[UI_SEARCH_SESSNAME]['results']; + $this->criteria =& $_SESSION[UI_SEARCH_SESSNAME]['criteria']; + $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; if (empty($this->criteria['limit'])) { - $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT; + $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT; } } @@ -47,7 +47,7 @@ class uiSearch function searchForm($id, $mask2) { //print_r($this->criteria['form']); - include dirname(__FILE__).'/formmask/metadata.inc.php'; + include(dirname(__FILE__).'/formmask/metadata.inc.php'); $form = new HTML_QuickForm('search', UI_STANDARD_FORM_METHOD, UI_HANDLER); $counter = isset($this->criteria['counter']) ? $this->criteria['counter'] : 1; $form->setConstants(array('id'=>$id, 'counter'=>$counter)); @@ -55,11 +55,11 @@ class uiSearch foreach ($mask['pages'] as $key=>$val) { foreach ($mask['pages'][$key] as $v){ if (isset($v['type']) && $v['type']) { - $col1[$this->Base->_formElementEncode($v['element'])] = tra($v['label']); + $col1[uiBase::formElementEncode($v['element'])] = tra($v['label']); if (isset($val['relation'])) { - $col2[$this->Base->_formElementEncode($v['element'])] = $mask2['relations'][$v['relation']]; + $col2[uiBase::formElementEncode($v['element'])] = $mask2['relations'][$v['relation']]; } else { - $col2[$this->Base->_formElementEncode($v['element'])] = $mask2['relations']['standard']; + $col2[uiBase::formElementEncode($v['element'])] = $mask2['relations']['standard']; } } }; @@ -101,11 +101,11 @@ class uiSearch $form->addElement('static', 's2', NULL, ""); } - $this->Base->_parseArr2Form($form, $mask2['search']); + uiBase::parseArrayToForm($form, $mask2['search']); $constants = isset($this->criteria['form']) ? $this->criteria['form'] : null; $form->setConstants($constants); $form->validate(); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['dynform'] = $renderer->toArray(); //print_r($output); @@ -134,7 +134,7 @@ class uiSearch foreach ($formdata as $key=>$val) { if (is_array($val) && $val['active']) { $this->criteria['counter']++; - $this->criteria['conditions'][$key] = array('cat' => $this->Base->_formElementDecode($val[0]), + $this->criteria['conditions'][$key] = array('cat' => uiBase::formElementDecode($val[0]), 'op' => $val[1], 'val' => stripslashes($val[2]) ); @@ -152,8 +152,8 @@ class uiSearch function simpleSearchForm($mask) { $form = new HTML_QuickForm('simplesearch', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output = $renderer->toArray(); //print_r($output); @@ -179,7 +179,7 @@ class uiSearch 'op' => constant('UI_SIMPLESEARCH_OP'.$n), 'val' => stripslashes($formdata['criterium']) ); - $this->criteria['form']['row_'.$n]= array(0 => $this->Base->_formElementEncode(constant('UI_SIMPLESEARCH_CAT'.$n)), + $this->criteria['form']['row_'.$n]= array(0 => uiBase::formElementEncode(constant('UI_SIMPLESEARCH_CAT'.$n)), 1 => constant('UI_SIMPLESEARCH_OP'.$n), 2 => stripslashes($formdata['criterium']) ); @@ -206,7 +206,7 @@ class uiSearch } foreach ($results['results'] as $rec) { $tmpId = $this->Base->gb->_idFromGunid($rec["gunid"]); - $this->results['items'][] = $this->Base->_getMetaInfo($tmpId); + $this->results['items'][] = $this->Base->getMetaInfo($tmpId); } $this->results['cnt'] = $results['cnt']; diff --git a/campcaster/src/modules/htmlUI/var/ui_smartyExtensions.inc.php b/campcaster/src/modules/htmlUI/var/ui_smartyExtensions.inc.php index 51d1e2067..1eaedfd56 100644 --- a/campcaster/src/modules/htmlUI/var/ui_smartyExtensions.inc.php +++ b/campcaster/src/modules/htmlUI/var/ui_smartyExtensions.inc.php @@ -1,7 +1,7 @@ register_object('UIBROWSER', $uiBrowser); $Smarty->register_object('BROWSE', $uiBrowser->BROWSE); -$Smarty->register_object('HUBBROWSE', $uiBrowser->HUBBROWSE); +$Smarty->register_object('HUBBROWSE', $HUBBROWSE); $Smarty->register_object('SEARCH', $uiBrowser->SEARCH); $Smarty->register_object('HUBSEARCH', $uiBrowser->HUBSEARCH); $Smarty->register_object('TRANSFERS', $uiBrowser->TRANSFERS); diff --git a/campcaster/src/modules/htmlUI/var/ui_subjects.class.php b/campcaster/src/modules/htmlUI/var/ui_subjects.class.php index d3a996f06..086fe3fd9 100644 --- a/campcaster/src/modules/htmlUI/var/ui_subjects.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_subjects.class.php @@ -6,18 +6,17 @@ */ class uiSubjects { + public $Base; + private $reloadUrl; + private $suRedirUrl; + private $redirUrl; - var $Base; - var $reloadUrl; - var $suRedirUrl; - var $redirUrl; - - function uiSubjects(&$uiBase) + public function __construct(&$uiBase) { - $this->Base =& $uiBase; - $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; + $this->Base =& $uiBase; + $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; $this->suRedirUrl = UI_BROWSER.'?act=SUBJECTS'; - $this->redirUrl = UI_BROWSER.'?act=SUBJECTS'; + $this->redirUrl = UI_BROWSER.'?act=SUBJECTS'; } @@ -50,8 +49,8 @@ class uiSubjects include(dirname(__FILE__). '/formmask/subjects.inc.php'); $form = new HTML_QuickForm('addSubject', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $this->Base->_parseArr2Form($form, $mask[$type]); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + uiBase::parseArrayToForm($form, $mask[$type]); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } @@ -145,9 +144,9 @@ class uiSubjects } else { $mask['chgPasswd']['cancel']['attributes'] = array('onClick' => 'location.href="'.UI_BROWSER.'"'); } - $this->Base->_parseArr2Form($form, $mask['chgPasswd']); + uiBase::parseArrayToForm($form, $mask['chgPasswd']); $form->setConstants(array('login' => $login)); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $renderer = new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); return $renderer->toArray(); } diff --git a/campcaster/src/modules/htmlUI/var/ui_transfers.class.php b/campcaster/src/modules/htmlUI/var/ui_transfers.class.php index 2bfc0609d..9d4ef6e50 100644 --- a/campcaster/src/modules/htmlUI/var/ui_transfers.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_transfers.class.php @@ -7,14 +7,14 @@ */ class uiTransfers { - var $Base; - var $allItems; - var $rows; - var $trShowInfo; - var $reloadUrl; + private $Base; + private $allItems; + private $rows; + private $trShowInfo; + private $reloadUrl; - function uiTransfers(&$uiBase) + public function __construct(&$uiBase) { $this->Base =& $uiBase; $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';