Apparently we do need the StationPrefs group. Since the group name was

hard-coded in everywhere, I didnt detect that this value was used in the app.
I changed the hard-coded values to use the value from the config file instead.

Fixed the Transport.php::xmlrpcCall() function, an object was not being
created before it was used.

Fixed the archive server URLs in the default config files.
This commit is contained in:
paul.baranowski 2010-09-10 15:49:35 -04:00
parent 73d672b552
commit e537255e27
13 changed files with 115 additions and 105 deletions

View File

@ -311,17 +311,18 @@ class uiBase
*/ */
public function loadStationPrefs(&$mask, $reload=FALSE) public function loadStationPrefs(&$mask, $reload=FALSE)
{ {
global $CC_CONFIG;
if (!is_array($this->STATIONPREFS) || ($reload === TRUE) ) { if (!is_array($this->STATIONPREFS) || ($reload === TRUE) ) {
$this->STATIONPREFS = array(); $this->STATIONPREFS = array();
foreach ($mask as $key => $val) { foreach ($mask as $key => $val) {
if (isset($val['isPref']) && $val['isPref']) { if (isset($val['isPref']) && $val['isPref']) {
$setting = $this->gb->loadGroupPref(NULL, 'StationPrefs', $val['element']); $setting = $this->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], $val['element']);
if (is_string($setting)) { if (is_string($setting)) {
$this->STATIONPREFS[$val['element']] = $setting; $this->STATIONPREFS[$val['element']] = $setting;
} elseif ($val['required']) { } elseif ($val['required']) {
// set default values on first login // set default values on first login
$default = isset($val['default'])?$val['default']:null; $default = isset($val['default'])?$val['default']:null;
$this->gb->saveGroupPref($this->sessid, 'StationPrefs', $val['element'], $default); $this->gb->saveGroupPref($this->sessid, $CC_CONFIG['StationPrefsGr'], $val['element'], $default);
$this->STATIONPREFS[$val['element']] = $default; $this->STATIONPREFS[$val['element']] = $default;
} }
} }
@ -529,24 +530,24 @@ class uiBase
public function getMetaInfo($id) public function getMetaInfo($id)
{ {
$type = strtolower(GreenBox::getFileType($id)); $type = strtolower(GreenBox::getFileType($id));
if($type == 'playlist') { if($type == 'playlist') {
require_once("../../../storageServer/var/Playlist.php"); require_once("../../../storageServer/var/Playlist.php");
$playList = new Playlist(GreenBox::GunidFromId($id)); $playList = new Playlist(GreenBox::GunidFromId($id));
$playListData = $playList->export(); $playListData = $playList->export();
for ($i = 1; $i < count($playListData); $i++) { for ($i = 1; $i < count($playListData); $i++) {
$entry = StoredFile::RecallByGunid($playListData["".$i]["gunid"]); $entry = StoredFile::RecallByGunid($playListData["".$i]["gunid"]);
$playListEntries[] = $entry->getName(); $playListEntries[] = $entry->getName();
} }
$_SESSION['mdata'] = $playListEntries; $_SESSION['mdata'] = $playListEntries;
} }
$data = array('id' => $id, $data = array('id' => $id,
'gunid' => BasicStor::GunidFromId($id), 'gunid' => BasicStor::GunidFromId($id),
'title' => $this->getMetadataValue($id, UI_MDATA_KEY_TITLE), 'title' => $this->getMetadataValue($id, UI_MDATA_KEY_TITLE),

View File

@ -296,10 +296,11 @@ class uiBrowser extends uiBase {
function changeStationPrefs(&$mask) function changeStationPrefs(&$mask)
{ {
global $CC_CONFIG;
$form = new HTML_QuickForm('changeStationPrefs', UI_STANDARD_FORM_METHOD, UI_HANDLER); $form = new HTML_QuickForm('changeStationPrefs', UI_STANDARD_FORM_METHOD, UI_HANDLER);
foreach($mask as $key => $val) { foreach($mask as $key => $val) {
$element = isset($val['element']) ? $val['element'] : null; $element = isset($val['element']) ? $val['element'] : null;
$p = $this->gb->loadGroupPref($this->sessid, 'StationPrefs', $element); $p = $this->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], $element);
if (is_string($p)) { if (is_string($p)) {
$mask[$key]['default'] = $p; $mask[$key]['default'] = $p;
} }

View File

@ -696,6 +696,7 @@ class uiHandler extends uiBase {
*/ */
function changeStationPrefs($formdata, $mask) function changeStationPrefs($formdata, $mask)
{ {
global $CC_CONFIG;
$this->redirUrl = UI_BROWSER; $this->redirUrl = UI_BROWSER;
if ($this->_validateForm($formdata, $mask) == FALSE) { if ($this->_validateForm($formdata, $mask) == FALSE) {
@ -705,18 +706,18 @@ class uiHandler extends uiBase {
foreach ($mask as $key => $val) { foreach ($mask as $key => $val) {
if (isset($val['isPref']) && $val['isPref']) { if (isset($val['isPref']) && $val['isPref']) {
if (!empty($formdata[$val['element']])) { if (!empty($formdata[$val['element']])) {
$result = $this->gb->saveGroupPref($this->sessid, 'StationPrefs', $val['element'], $formdata[$val['element']]); $result = $this->gb->saveGroupPref($this->sessid, $CC_CONFIG['StationPrefsGr'], $val['element'], $formdata[$val['element']]);
if (PEAR::isError($result)) if (PEAR::isError($result))
$this->_retMsg('Error while saving settings.'); $this->_retMsg('Error while saving settings.');
} else { } else {
$this->gb->delGroupPref($this->sessid, 'StationPrefs', $val['element']); $this->gb->delGroupPref($this->sessid, $CC_CONFIG['StationPrefsGr'], $val['element']);
} }
} }
if (isset($val['type']) if (isset($val['type'])
&& ($val['type'] == 'file') && ($val['type'] == 'file')
&& ($val['element'] == "stationlogo") && ($val['element'] == "stationlogo")
&& !empty($formdata[$val['element']]['name'])) { && !empty($formdata[$val['element']]['name'])) {
$stationLogoPath = $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'stationLogoPath'); $stationLogoPath = $this->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], 'stationLogoPath');
$filePath = $formdata[$val['element']]['tmp_name']; $filePath = $formdata[$val['element']]['tmp_name'];
if (function_exists("getimagesize")) { if (function_exists("getimagesize")) {
$size = @getimagesize($filePath); $size = @getimagesize($filePath);

View File

@ -1,12 +1,12 @@
<?php <?php
class uiTwitter { class uiTwitter {
private $Base; private $Base;
private $settings = array( private $settings = array(
'bitly-login' => 'campcaster', 'bitly-login' => 'campcaster',
'bitly-apikey' => 'R_2f812152bfc21035468350273ec8ff43' 'bitly-apikey' => 'R_2f812152bfc21035468350273ec8ff43'
); );
/** /**
* Time in sec * Time in sec
* *
@ -19,7 +19,7 @@ class uiTwitter {
$this->Base =& $uiBase; $this->Base =& $uiBase;
$this->loadSettings(); $this->loadSettings();
} }
private static function getSettingFormMask() private static function getSettingFormMask()
{ {
$formmask = array( $formmask = array(
@ -182,7 +182,7 @@ class uiTwitter {
'label' => 'Provider', 'label' => 'Provider',
'options' => array( 'options' => array(
'bit.ly' => 'bit.ly', 'bit.ly' => 'bit.ly',
'tinyurl.com' => 'tinyurl.com', 'tinyurl.com' => 'tinyurl.com',
), ),
'isPref' => true 'isPref' => true
), ),
@ -209,29 +209,30 @@ class uiTwitter {
'label' => 'Submit', 'label' => 'Submit',
) )
); );
return $formmask; return $formmask;
} }
private function loadSettings() private function loadSettings()
{ {
global $CC_CONFIG;
$mask = uiTwitter::getSettingFormMask(); $mask = uiTwitter::getSettingFormMask();
foreach($mask as $key => $val) { foreach($mask as $key => $val) {
if (isset($val['isPref']) && $val['isPref']) { if (isset($val['isPref']) && $val['isPref']) {
$element = preg_replace('/^twitter-/', '', $val['element'], 1); $element = preg_replace('/^twitter-/', '', $val['element'], 1);
$p = $this->Base->gb->loadGroupPref($this->Base->sessid, 'StationPrefs', $val['element']); $p = $this->Base->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], $val['element']);
if (is_string($p)) { if (is_string($p)) {
$this->settings[$element] = $p; $this->settings[$element] = $p;
} }
} }
} }
} }
public function getSettingsForm() public function getSettingsForm()
{ {
$mask = uiTwitter::getSettingFormMask(); $mask = uiTwitter::getSettingFormMask();
$form = new HTML_QuickForm('twitter', UI_STANDARD_FORM_METHOD, UI_HANDLER);# $form = new HTML_QuickForm('twitter', UI_STANDARD_FORM_METHOD, UI_HANDLER);#
foreach($mask as $key => $val) { foreach($mask as $key => $val) {
if (isset($val['isPref']) && $val['isPref'] && !$val['hiddenPref']) { if (isset($val['isPref']) && $val['isPref'] && !$val['hiddenPref']) {
$element = preg_replace('/^twitter-/', '', $val['element']); $element = preg_replace('/^twitter-/', '', $val['element']);
@ -246,48 +247,49 @@ class uiTwitter {
$form->accept($renderer); $form->accept($renderer);
return $renderer->toArray(); return $renderer->toArray();
} }
public function saveSettings() public function saveSettings()
{ {
global $CC_CONFIG;
if ($this->Base->_validateForm($_REQUEST, uiTwitter::getSettingFormMask()) !== TRUE) { if ($this->Base->_validateForm($_REQUEST, uiTwitter::getSettingFormMask()) !== TRUE) {
$this->Base->_retMsg('An error has occured on validating the form.'); $this->Base->_retMsg('An error has occured on validating the form.');
return FALSE; return FALSE;
} }
$mask = uiTwitter::getSettingFormMask(); $mask = uiTwitter::getSettingFormMask();
$form = new HTML_QuickForm('twitter', UI_STANDARD_FORM_METHOD, UI_HANDLER); $form = new HTML_QuickForm('twitter', UI_STANDARD_FORM_METHOD, UI_HANDLER);
uiBase::parseArrayToForm($form, $mask); uiBase::parseArrayToForm($form, $mask);
$formdata = $form->exportValues(); $formdata = $form->exportValues();
foreach ($mask as $key => $val) { foreach ($mask as $key => $val) {
if (isset($val['isPref']) && $val['isPref']) { if (isset($val['isPref']) && $val['isPref']) {
if (!empty($formdata[$val['element']])) { if (!empty($formdata[$val['element']])) {
$result = $this->Base->gb->saveGroupPref($this->Base->sessid, 'StationPrefs', $val['element'], $formdata[$val['element']]); $result = $this->Base->gb->saveGroupPref($this->Base->sessid, $CC_CONFIG['StationPrefsGr'], $val['element'], $formdata[$val['element']]);
if (PEAR::isError($result)) if (PEAR::isError($result))
$this->Base->_retMsg('Error while saving twitter settings.'); $this->Base->_retMsg('Error while saving twitter settings.');
} elseif (!$val['hiddenPref']) { } elseif (!$val['hiddenPref']) {
$this->Base->gb->delGroupPref($this->Base->sessid, 'StationPrefs', $val['element']); $this->Base->gb->delGroupPref($this->Base->sessid, $CC_CONFIG['StationPrefsGr'], $val['element']);
} }
} }
} }
$this->Base->_retMsg('Twitter settings saved.'); $this->Base->_retMsg('Twitter settings saved.');
} }
public function getFeed($p_useSampledata = false) public function getFeed($p_useSampledata = false)
{ {
if ($p_useSampledata) { if ($p_useSampledata) {
$whatsplaying = array( $whatsplaying = array(
"tracktitle" => "Gimme Shelter", "tracktitle" => "Gimme Shelter",
"trackartist" => "The Rolling Stones", "trackartist" => "The Rolling Stones",
"playlisttitle" => "The Blues Hour" "playlisttitle" => "The Blues Hour"
); );
} else { } else {
$whatsplaying = $this->getWhatsplaying($this->settings['offset']); $whatsplaying = $this->getWhatsplaying($this->settings['offset']);
} }
if (!$whatsplaying) { if (!$whatsplaying) {
return; return;
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@ -313,35 +315,35 @@ class uiTwitter {
if ($this->settings['has_trackartist']) { $tweetbody[] = $whatsplaying['trackartist']; } if ($this->settings['has_trackartist']) { $tweetbody[] = $whatsplaying['trackartist']; }
if ($this->settings['has_playlisttitle']) { $tweetbody[] = $whatsplaying['playlisttitle']; } if ($this->settings['has_playlisttitle']) { $tweetbody[] = $whatsplaying['playlisttitle']; }
if ($this->settings['has_stationname']) { $tweetbody[] = $this->Base->STATIONPREFS['stationName']; } if ($this->settings['has_stationname']) { $tweetbody[] = $this->Base->STATIONPREFS['stationName']; }
$tweetbody = implode (". ",$tweetbody); $tweetbody = implode (". ",$tweetbody);
// chop body to fit if necessary // chop body to fit if necessary
if ((strlen($tweetprefix) + strlen($tweetbody) + strlen($tweetsuffix)) > 140) { if ((strlen($tweetprefix) + strlen($tweetbody) + strlen($tweetsuffix)) > 140) {
$tweetbody = substr($tweetbody, 0, (140 - (strlen($tweetprefix) + strlen($tweetsuffix) + 3))) . "..."; $tweetbody = substr($tweetbody, 0, (140 - (strlen($tweetprefix) + strlen($tweetsuffix) + 3))) . "...";
} }
$tweet = $tweetprefix . $tweetbody . $tweetsuffix; $tweet = $tweetprefix . $tweetbody . $tweetsuffix;
return $tweet; return $tweet;
} }
public function shortUrl($p_url) public function shortUrl($p_url)
{ {
switch ($this->settings['shortener-provider']) { switch ($this->settings['shortener-provider']) {
case 'tinyurl.com': case 'tinyurl.com':
$short = file_get_contents('http://tinyurl.com/api-create.php?url='.$p_url); $short = file_get_contents('http://tinyurl.com/api-create.php?url='.$p_url);
break; break;
case 'bit.ly': case 'bit.ly':
$short = file_get_contents("http://api.bit.ly/shorten?version=2.0.1&longUrl={$p_url}&format=text&login={$this->settings['bitly-login']}&apiKey={$this->settings['bitly-apikey']}"); $short = file_get_contents("http://api.bit.ly/shorten?version=2.0.1&longUrl={$p_url}&format=text&login={$this->settings['bitly-login']}&apiKey={$this->settings['bitly-apikey']}");
break; break;
} }
return $short; return $short;
} }
public function getWhatsplaying($p_offset) public function getWhatsplaying($p_offset)
{ {
$timestamp = time() + $p_offset; $timestamp = time() + $p_offset;
@ -362,47 +364,48 @@ class uiTwitter {
if (!$clip['gunid']) { if (!$clip['gunid']) {
return FALSE; return FALSE;
} }
return array( return array(
'tracktitle' => $this->Base->gb->getMetadataValue(BasicStor::IdFromGunid($clip['gunid']), UI_MDATA_KEY_TITLE, $this->Base->sessid), 'tracktitle' => $this->Base->gb->getMetadataValue(BasicStor::IdFromGunid($clip['gunid']), UI_MDATA_KEY_TITLE, $this->Base->sessid),
'trackartist' => $this->Base->gb->getMetadataValue(BasicStor::IdFromGunid($clip['gunid']), UI_MDATA_KEY_CREATOR, $this->Base->sessid), 'trackartist' => $this->Base->gb->getMetadataValue(BasicStor::IdFromGunid($clip['gunid']), UI_MDATA_KEY_CREATOR, $this->Base->sessid),
'playlisttitle' => $this->Base->gb->getMetadataValue(BasicStor::IdFromGunid($pl['playlistId']), UI_MDATA_KEY_TITLE, $this->Base->sessid), 'playlisttitle' => $this->Base->gb->getMetadataValue(BasicStor::IdFromGunid($pl['playlistId']), UI_MDATA_KEY_TITLE, $this->Base->sessid),
); );
} }
public function sendFeed($p_feed) public function sendFeed($p_feed)
{ {
global $CC_CONFIG;
$twitter = new twitter(); $twitter = new twitter();
$twitter->username = $this->settings['login']; $twitter->username = $this->settings['login'];
$twitter->password = $this->settings['password']; $twitter->password = $this->settings['password'];
if ($res = $twitter->update($p_feed)) { if ($res = $twitter->update($p_feed)) {
$this->Base->gb->saveGroupPref($this->Base->sessid, 'StationPrefs', 'twitter-lastupdate', time()); $this->Base->gb->saveGroupPref($this->Base->sessid, $CC_CONFIG['StationPrefsGr'], 'twitter-lastupdate', time());
return $res; return $res;
} }
return false; return false;
} }
public function needsUpdate() public function needsUpdate()
{ {
if (time() - $this->Base->gb->loadGroupPref($this->Base->sessid, 'StationPrefs', 'twitter-lastupdate') + $this->runtime > $this->settings['interval']) { if (time() - $this->Base->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], 'twitter-lastupdate') + $this->runtime > $this->settings['interval']) {
return true; return true;
} }
return false; return false;
} }
public function twitterify($p_string) public function twitterify($p_string)
{ {
$string = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $p_string); $string = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $p_string);
$string = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $string); $string = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $string);
$string = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $string); $string = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $string);
$string = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $string); $string = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $string);
return $string; return $string;
} }
public function isActive() public function isActive()
{ {
return $this->settings['is_active']; return $this->settings['is_active'];
} }
} }

View File

@ -1385,10 +1385,10 @@ class BasicStor {
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
// $res = Subjects::AddSubjectToGroup($login, $CC_CONFIG['StationPrefsGr']); $res = Subjects::AddSubjectToGroup($login, $CC_CONFIG['StationPrefsGr']);
// if (PEAR::isError($res)) { if (PEAR::isError($res)) {
// return $res; return $res;
// } }
// $res = Subjects::AddSubjectToGroup($login, $CC_CONFIG['AllGr']); // $res = Subjects::AddSubjectToGroup($login, $CC_CONFIG['AllGr']);
// if (PEAR::isError($res)) { // if (PEAR::isError($res)) {
// return $res; // return $res;
@ -1926,19 +1926,19 @@ class BasicStor {
// } // }
// Add the "Station Preferences" group // Add the "Station Preferences" group
// if (!empty($CC_CONFIG['StationPrefsGr'])) { if (!empty($CC_CONFIG['StationPrefsGr'])) {
// if (!Subjects::GetSubjId('scheduler')) { if (!Subjects::GetSubjId('scheduler')) {
// echo " * Creating group '".$CC_CONFIG['StationPrefsGr']."'..."; echo " * Creating group '".$CC_CONFIG['StationPrefsGr']."'...";
// $stPrefGr = Subjects::AddSubj($CC_CONFIG['StationPrefsGr']); $stPrefGr = Subjects::AddSubj($CC_CONFIG['StationPrefsGr']);
// if (PEAR::isError($stPrefGr)) { if (PEAR::isError($stPrefGr)) {
// return $stPrefGr; return $stPrefGr;
// } }
// Subjects::AddSubjectToGroup('root', $CC_CONFIG['StationPrefsGr']); Subjects::AddSubjectToGroup('root', $CC_CONFIG['StationPrefsGr']);
// echo "done.\n"; echo "done.\n";
// } else { } else {
// echo " * Skipping: group already exists: '".$CC_CONFIG['StationPrefsGr']."'\n"; echo " * Skipping: group already exists: '".$CC_CONFIG['StationPrefsGr']."'\n";
// } }
// } }
// Add the root user if it doesnt exist yet. // Add the root user if it doesnt exist yet.
$rootUid = Subjects::GetSubjId('root'); $rootUid = Subjects::GetSubjId('root');
@ -1974,7 +1974,7 @@ class BasicStor {
} }
// Need to add 'scheduler' to group StationPrefs // Need to add 'scheduler' to group StationPrefs
//Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['StationPrefsGr']); Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['StationPrefsGr']);
} }

View File

@ -1432,10 +1432,10 @@ class GreenBox extends BasicStor {
* @return string * @return string
* preference value * preference value
*/ */
public function loadGroupPref($sessid, $group, $key) public function loadGroupPref($group, $key)
{ {
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->loadGroupPref($sessid, $group, $key); $res = $pr->loadGroupPref($group, $key);
return $res; return $res;
} // fn loadGroupPref } // fn loadGroupPref

View File

@ -132,16 +132,16 @@ class Prefs {
/** /**
* Read group preference record * Read group preference record
* *
* @param string $sessid
* session id
* @param string $group * @param string $group
* group name * group name
* @param string $key * @param string $key
* preference key * preference key
* @param boolean $returnErrorIfKeyNotExists
* If set to true and the key doesnt exist, return a PEAR error.
* @return string * @return string
* preference value * preference value
*/ */
function loadGroupPref($sessid, $group, $key) function loadGroupPref($group, $key, $returnErrorIfKeyNotExists = true)
{ {
// if sessid is would be used here fix Transport::cronCallMethod ! // if sessid is would be used here fix Transport::cronCallMethod !
$subjid = Subjects::GetSubjId($group); $subjid = Subjects::GetSubjId($group);
@ -157,8 +157,12 @@ class Prefs {
return $val; return $val;
} }
if ($val === FALSE) { if ($val === FALSE) {
return PEAR::raiseError( if ($returnErrorIfKeyNotExists) {
"Prefs::loadGroupPref: invalid preference key", GBERR_PREF); return PEAR::raiseError(
"Prefs::loadGroupPref: invalid preference key", GBERR_PREF);
} else {
return '';
}
} }
return $val; return $val;
} }

View File

@ -199,9 +199,9 @@ class Transport
{ {
require_once('Prefs.php'); require_once('Prefs.php');
$pr = new Prefs($this->gb); $pr = new Prefs($this->gb);
$group = 'StationPrefs'; $group = $CC_CONFIG['StationPrefsGr'];
$key = 'TransportsDenied'; $key = 'TransportsDenied';
$res = $pr->loadGroupPref($sessid, $group, $key); $res = $pr->loadGroupPref($group, $key);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
if ($res->getCode() !== GBERR_PREF) { if ($res->getCode() !== GBERR_PREF) {
return $res; return $res;
@ -863,6 +863,7 @@ class Transport
*/ */
function cronCallMethod($trtok) function cronCallMethod($trtok)
{ {
global $CC_CONFIG;
$trec = TransportRecord::recall($this, $trtok); $trec = TransportRecord::recall($this, $trtok);
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
return $trec; return $trec;
@ -903,9 +904,9 @@ class Transport
case 'waiting': case 'waiting':
require_once('Prefs.php'); require_once('Prefs.php');
$pr = new Prefs($this->gb); $pr = new Prefs($this->gb);
$group = 'StationPrefs'; $group = $CC_CONFIG['StationPrefsGr'];
$key = 'TransportsDenied'; $key = 'TransportsDenied';
$res = $pr->loadGroupPref(NULL/*sessid*/, $group, $key); $res = $pr->loadGroupPref($group, $key);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
if ($res->getCode() !== GBERR_PREF) { if ($res->getCode() !== GBERR_PREF) {
return $res; return $res;
@ -1668,32 +1669,31 @@ class Transport
{ {
global $CC_CONFIG; global $CC_CONFIG;
$xrp = XML_RPC_encode($pars); $xrp = XML_RPC_encode($pars);
$group = 'StationPrefs'; $pr = new Prefs($this->gb);
$group = $CC_CONFIG["StationPrefsGr"];
$key = 'archiveServerLocation'; $key = 'archiveServerLocation';
$archiveUrl = $pr->loadGroupPref(NULL/*sessid*/, $group, $key); $archiveUrl = $pr->loadGroupPref($group, $key, false);
if($archiveUrl){ echo "Archive URL: $archiveUrl\n";
if ($archiveUrl) {
$archiveUrlInfo = parse_url($archiveUrl); $archiveUrlInfo = parse_url($archiveUrl);
if ($archiveUrlInfo['port']) {
if($archiveUrlInfo['port']){
$port = $archiveUrlInfo['port']; $port = $archiveUrlInfo['port'];
} }
else { else {
$port = 80; $port = 80;
} }
$c = new XML_RPC_Client($archiveUrlInfo['path'], $archiveUrlInfo['host'], $port);
$c = new XML_RPC_Client($archiveUrlInfo['path'], $archiveUrlInfo['host'], $port);
} }
else { else {
$c = new XML_RPC_Client( $c = new XML_RPC_Client(
$CC_CONFIG['archiveUrlPath']."/".$CC_CONFIG['archiveXMLRPC'], $CC_CONFIG['archiveUrlPath']."/".$CC_CONFIG['archiveXMLRPC'],
$CC_CONFIG['archiveUrlHost'], $CC_CONFIG['archiveUrlPort'] $CC_CONFIG['archiveUrlHost'], $CC_CONFIG['archiveUrlPort']
); );
} }
$f = new XML_RPC_Message($method, array($xrp)); $f = new XML_RPC_Message($method, array($xrp));
$r = $c->send($f); $r = $c->send($f);
if (!$r) { if (!$r) {

View File

@ -47,7 +47,7 @@ $CC_CONFIG = array(
/* ================================================ storage configuration */ /* ================================================ storage configuration */
'authCookieName'=> 'campcaster_session_id', 'authCookieName'=> 'campcaster_session_id',
//'AdminsGr' => 'Admins', //'AdminsGr' => 'Admins',
//'StationPrefsGr'=> 'StationPrefs', 'StationPrefsGr'=> 'StationPrefs',
//'AllGr' => 'All', //'AllGr' => 'All',
'TrashName' => 'trash_', 'TrashName' => 'trash_',
'storageDir' => dirname(__FILE__).'/../../storageServer/var/stor', 'storageDir' => dirname(__FILE__).'/../../storageServer/var/stor',
@ -129,7 +129,7 @@ $CC_CONFIG['backupTable'] = $CC_CONFIG['tblNamePrefix'].'backup';
$CC_CONFIG['filesSequence'] = $CC_CONFIG['tblNamePrefix']."file_id_seq"; $CC_CONFIG['filesSequence'] = $CC_CONFIG['tblNamePrefix']."file_id_seq";
$CC_CONFIG['sysSubjs'] = array( $CC_CONFIG['sysSubjs'] = array(
'root', /*$CC_CONFIG['AdminsGr'],*/ /*$CC_CONFIG['AllGr'],*/ /*$CC_CONFIG['StationPrefsGr']*/ 'root', /*$CC_CONFIG['AdminsGr'],*/ /*$CC_CONFIG['AllGr'],*/ $CC_CONFIG['StationPrefsGr']
); );
$old_include_path = get_include_path(); $old_include_path = get_include_path();
set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_include_path); set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_include_path);

View File

@ -70,8 +70,8 @@ $CC_CONFIG = array(
'storageUrlPort' => ls_php_port, 'storageUrlPort' => ls_php_port,
/* ================================================ archive configuration */ /* ================================================ archive configuration */
'archiveUrlPath' => 'ls_archiveUrlPath', 'archiveUrlPath' => 'ls_storageUrlPath',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php', 'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
'archiveUrlHost' => 'ls_php_host', 'archiveUrlHost' => 'ls_php_host',
'archiveUrlPort' => ls_php_port, 'archiveUrlPort' => ls_php_port,
'archiveAccountLogin' => 'root', 'archiveAccountLogin' => 'root',

View File

@ -43,8 +43,8 @@ $CC_CONFIG = array(
'storageUrlPort' => ls_php_port, 'storageUrlPort' => ls_php_port,
/* ================================================ archive configuration */ /* ================================================ archive configuration */
'archiveUrlPath' => 'ls_archiveUrlPath', 'archiveUrlPath' => 'ls_storageUrlPath',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php', 'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
'archiveUrlHost' => 'ls_php_host', 'archiveUrlHost' => 'ls_php_host',
'archiveUrlPort' => ls_php_port, 'archiveUrlPort' => ls_php_port,
'archiveAccountLogin' => 'root', 'archiveAccountLogin' => 'root',

View File

@ -412,7 +412,7 @@ if (!camp_db_table_exists($CC_CONFIG['prefTable'])) {
camp_install_query($sql); camp_install_query($sql);
echo " * Inserting starting data into table ".$CC_CONFIG['prefTable']."..."; echo " * Inserting starting data into table ".$CC_CONFIG['prefTable']."...";
//$stPrefGr = Subjects::GetSubjId($CC_CONFIG['StationPrefsGr']); $stPrefGr = Subjects::GetSubjId($CC_CONFIG['StationPrefsGr']);
Prefs::Insert($CC_CONFIG["systemPrefId"], 'stationName', "Radio Station 1"); Prefs::Insert($CC_CONFIG["systemPrefId"], 'stationName', "Radio Station 1");
$genres = file_get_contents( dirname(__FILE__).'/../genres.xml'); $genres = file_get_contents( dirname(__FILE__).'/../genres.xml');
Prefs::Insert($CC_CONFIG["systemPrefId"], 'genres', $genres); Prefs::Insert($CC_CONFIG["systemPrefId"], 'genres', $genres);

View File

@ -2742,7 +2742,7 @@ class XR_LocStor extends LocStor {
} }
require_once(dirname(__FILE__).'/../Prefs.php'); require_once(dirname(__FILE__).'/../Prefs.php');
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->loadGroupPref($r['sessid'], $r['group'], $r['key']); $res = $pr->loadGroupPref($r['group'], $r['key']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
$ec = ( $ec = (