Fixed whitespace to standard coding conventions.
This commit is contained in:
parent
52fe579ce4
commit
8014f94c58
35 changed files with 6072 additions and 6070 deletions
302
htmlUI/Input.php
302
htmlUI/Input.php
|
@ -14,71 +14,71 @@ $g_inputErrors = array();
|
|||
* @package Campsite
|
||||
*/
|
||||
class Input {
|
||||
/**
|
||||
* Please see: {@link http://ca.php.net/manual/en/function.get-magic-quotes-gpc.php
|
||||
* this PHP.net page specifically the user note by php at kaiundina dot de},
|
||||
* for why this is so complicated.
|
||||
*
|
||||
* @param array $p_array
|
||||
* @return array
|
||||
*/
|
||||
function CleanMagicQuotes($p_array)
|
||||
{
|
||||
$gpcList = array();
|
||||
/**
|
||||
* Please see: {@link http://ca.php.net/manual/en/function.get-magic-quotes-gpc.php
|
||||
* this PHP.net page specifically the user note by php at kaiundina dot de},
|
||||
* for why this is so complicated.
|
||||
*
|
||||
* @param array $p_array
|
||||
* @return array
|
||||
*/
|
||||
function CleanMagicQuotes($p_array)
|
||||
{
|
||||
$gpcList = array();
|
||||
|
||||
foreach ($p_array as $key => $value) {
|
||||
$decodedKey = stripslashes($key);
|
||||
if (is_array($value)) {
|
||||
$decodedValue = Input::CleanMagicQuotes($value);
|
||||
} else {
|
||||
$decodedValue = stripslashes($value);
|
||||
}
|
||||
$gpcList[$decodedKey] = $decodedValue;
|
||||
}
|
||||
return $gpcList;
|
||||
} // fn CleanMagicQuotes
|
||||
foreach ($p_array as $key => $value) {
|
||||
$decodedKey = stripslashes($key);
|
||||
if (is_array($value)) {
|
||||
$decodedValue = Input::CleanMagicQuotes($value);
|
||||
} else {
|
||||
$decodedValue = stripslashes($value);
|
||||
}
|
||||
$gpcList[$decodedKey] = $decodedValue;
|
||||
}
|
||||
return $gpcList;
|
||||
} // fn CleanMagicQuotes
|
||||
|
||||
|
||||
/**
|
||||
* Get an input value from the $_REQUEST array and check its type.
|
||||
* The default value is returned if the value is not defined in the
|
||||
* $_REQUEST array, or if the value does not match the required type.
|
||||
*
|
||||
* The type 'checkbox' is special - you cannot specify a default
|
||||
* value for this. The return value will be TRUE or FALSE, but
|
||||
* you can change this by specifying 'numeric' as the 3rd parameter
|
||||
* in which case it will return '1' or '0'.
|
||||
*
|
||||
* Use Input::IsValid() to check if any errors were generated.
|
||||
*
|
||||
* @param string $p_varName
|
||||
* The index into the $_REQUEST array.
|
||||
*
|
||||
* @param string $p_type
|
||||
* The type of data expected; can be:
|
||||
* "int"
|
||||
* "string"
|
||||
* "array"
|
||||
* "checkbox"
|
||||
* "boolean"
|
||||
*
|
||||
* Default is 'string'.
|
||||
*
|
||||
* @param mixed $p_defaultValue
|
||||
* The default value to return if the value is not defined in
|
||||
* the $_REQUEST array, or if the value does not match
|
||||
* the required type.
|
||||
*
|
||||
* @param boolean $p_errorsOk
|
||||
* Set to true to ignore any errors for this variable (i.e.
|
||||
* Input::IsValid() will still return true even if there
|
||||
* are errors for this varaible).
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function Get($p_varName, $p_type = 'string', $p_defaultValue = null, $p_errorsOk = false)
|
||||
{
|
||||
global $g_inputErrors;
|
||||
/**
|
||||
* Get an input value from the $_REQUEST array and check its type.
|
||||
* The default value is returned if the value is not defined in the
|
||||
* $_REQUEST array, or if the value does not match the required type.
|
||||
*
|
||||
* The type 'checkbox' is special - you cannot specify a default
|
||||
* value for this. The return value will be TRUE or FALSE, but
|
||||
* you can change this by specifying 'numeric' as the 3rd parameter
|
||||
* in which case it will return '1' or '0'.
|
||||
*
|
||||
* Use Input::IsValid() to check if any errors were generated.
|
||||
*
|
||||
* @param string $p_varName
|
||||
* The index into the $_REQUEST array.
|
||||
*
|
||||
* @param string $p_type
|
||||
* The type of data expected; can be:
|
||||
* "int"
|
||||
* "string"
|
||||
* "array"
|
||||
* "checkbox"
|
||||
* "boolean"
|
||||
*
|
||||
* Default is 'string'.
|
||||
*
|
||||
* @param mixed $p_defaultValue
|
||||
* The default value to return if the value is not defined in
|
||||
* the $_REQUEST array, or if the value does not match
|
||||
* the required type.
|
||||
*
|
||||
* @param boolean $p_errorsOk
|
||||
* Set to true to ignore any errors for this variable (i.e.
|
||||
* Input::IsValid() will still return true even if there
|
||||
* are errors for this varaible).
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function Get($p_varName, $p_type = 'string', $p_defaultValue = null, $p_errorsOk = false)
|
||||
{
|
||||
global $g_inputErrors;
|
||||
$p_type = strtolower($p_type);
|
||||
|
||||
if ($p_type == 'checkbox') {
|
||||
|
@ -88,99 +88,99 @@ class Input {
|
|||
return isset($_REQUEST[$p_varName]) ? '1' : '0';
|
||||
}
|
||||
}
|
||||
if (!isset($_REQUEST[$p_varName])) {
|
||||
if (!$p_errorsOk) {
|
||||
$g_inputErrors[$p_varName] = 'not set';
|
||||
}
|
||||
return $p_defaultValue;
|
||||
}
|
||||
// Clean the slashes
|
||||
if (get_magic_quotes_gpc()) {
|
||||
if (is_array($_REQUEST[$p_varName])) {
|
||||
$_REQUEST[$p_varName] = Input::CleanMagicQuotes($_REQUEST[$p_varName]);
|
||||
} else {
|
||||
$_REQUEST[$p_varName] = stripslashes($_REQUEST[$p_varName]);
|
||||
}
|
||||
}
|
||||
switch ($p_type) {
|
||||
case 'boolean':
|
||||
$value = strtolower($_REQUEST[$p_varName]);
|
||||
if ( ($value == "true") || (is_numeric($value) && ($value > 0)) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'int':
|
||||
if (!is_numeric($_REQUEST[$p_varName])) {
|
||||
if (!$p_errorsOk) {
|
||||
$g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
|
||||
.', but received type '.gettype($_REQUEST[$p_varName]).'.'
|
||||
.' Value is "'.$_REQUEST[$p_varName].'".';
|
||||
}
|
||||
return $p_defaultValue;
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
if (!is_string($_REQUEST[$p_varName])) {
|
||||
if (!$p_errorsOk) {
|
||||
$g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
|
||||
.', but received type '.gettype($_REQUEST[$p_varName]).'.'
|
||||
.' Value is "'.$_REQUEST[$p_varName].'".';
|
||||
}
|
||||
return $p_defaultValue;
|
||||
}
|
||||
break;
|
||||
case 'array':
|
||||
if (!is_array($_REQUEST[$p_varName])) {
|
||||
// Create an array if it isnt one already.
|
||||
// Arrays are used with checkboxes and radio buttons.
|
||||
// The problem with them is that if there is only one
|
||||
// checkbox, the given value will not be an array. So
|
||||
// we make it easy for the programmer by always returning
|
||||
// an array.
|
||||
$newArray = array();
|
||||
$newArray[] = $_REQUEST[$p_varName];
|
||||
return $newArray;
|
||||
// if (!$p_errorsOk) {
|
||||
// $g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
|
||||
// .', but received type '.gettype($_REQUEST[$p_varName]).'.'
|
||||
// .' Value is "'.$_REQUEST[$p_varName].'".';
|
||||
// }
|
||||
// return $p_defaultValue;
|
||||
}
|
||||
}
|
||||
return $_REQUEST[$p_varName];
|
||||
} // fn get
|
||||
if (!isset($_REQUEST[$p_varName])) {
|
||||
if (!$p_errorsOk) {
|
||||
$g_inputErrors[$p_varName] = 'not set';
|
||||
}
|
||||
return $p_defaultValue;
|
||||
}
|
||||
// Clean the slashes
|
||||
if (get_magic_quotes_gpc()) {
|
||||
if (is_array($_REQUEST[$p_varName])) {
|
||||
$_REQUEST[$p_varName] = Input::CleanMagicQuotes($_REQUEST[$p_varName]);
|
||||
} else {
|
||||
$_REQUEST[$p_varName] = stripslashes($_REQUEST[$p_varName]);
|
||||
}
|
||||
}
|
||||
switch ($p_type) {
|
||||
case 'boolean':
|
||||
$value = strtolower($_REQUEST[$p_varName]);
|
||||
if ( ($value == "true") || (is_numeric($value) && ($value > 0)) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'int':
|
||||
if (!is_numeric($_REQUEST[$p_varName])) {
|
||||
if (!$p_errorsOk) {
|
||||
$g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
|
||||
.', but received type '.gettype($_REQUEST[$p_varName]).'.'
|
||||
.' Value is "'.$_REQUEST[$p_varName].'".';
|
||||
}
|
||||
return $p_defaultValue;
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
if (!is_string($_REQUEST[$p_varName])) {
|
||||
if (!$p_errorsOk) {
|
||||
$g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
|
||||
.', but received type '.gettype($_REQUEST[$p_varName]).'.'
|
||||
.' Value is "'.$_REQUEST[$p_varName].'".';
|
||||
}
|
||||
return $p_defaultValue;
|
||||
}
|
||||
break;
|
||||
case 'array':
|
||||
if (!is_array($_REQUEST[$p_varName])) {
|
||||
// Create an array if it isnt one already.
|
||||
// Arrays are used with checkboxes and radio buttons.
|
||||
// The problem with them is that if there is only one
|
||||
// checkbox, the given value will not be an array. So
|
||||
// we make it easy for the programmer by always returning
|
||||
// an array.
|
||||
$newArray = array();
|
||||
$newArray[] = $_REQUEST[$p_varName];
|
||||
return $newArray;
|
||||
// if (!$p_errorsOk) {
|
||||
// $g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
|
||||
// .', but received type '.gettype($_REQUEST[$p_varName]).'.'
|
||||
// .' Value is "'.$_REQUEST[$p_varName].'".';
|
||||
// }
|
||||
// return $p_defaultValue;
|
||||
}
|
||||
}
|
||||
return $_REQUEST[$p_varName];
|
||||
} // fn get
|
||||
|
||||
|
||||
/**
|
||||
* Return FALSE if any calls to Input::Get() resulted in an error.
|
||||
* @return boolean
|
||||
*/
|
||||
function IsValid()
|
||||
{
|
||||
global $g_inputErrors;
|
||||
if (count($g_inputErrors) > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} // fn isValid
|
||||
/**
|
||||
* Return FALSE if any calls to Input::Get() resulted in an error.
|
||||
* @return boolean
|
||||
*/
|
||||
function IsValid()
|
||||
{
|
||||
global $g_inputErrors;
|
||||
if (count($g_inputErrors) > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} // fn isValid
|
||||
|
||||
|
||||
/**
|
||||
* Return a default error string.
|
||||
* @return string
|
||||
*/
|
||||
function GetErrorString()
|
||||
{
|
||||
global $g_inputErrors;
|
||||
ob_start();
|
||||
print_r($g_inputErrors);
|
||||
$str = ob_get_clean();
|
||||
return $str;
|
||||
} // fn GetErrorString
|
||||
/**
|
||||
* Return a default error string.
|
||||
* @return string
|
||||
*/
|
||||
function GetErrorString()
|
||||
{
|
||||
global $g_inputErrors;
|
||||
ob_start();
|
||||
print_r($g_inputErrors);
|
||||
$str = ob_get_clean();
|
||||
return $str;
|
||||
} // fn GetErrorString
|
||||
|
||||
} // class Input
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class twitter{
|
|||
var $username='';
|
||||
var $password='';
|
||||
var $user_agent='';
|
||||
|
||||
|
||||
///////////////
|
||||
//
|
||||
// I don't know if these headers have become standards yet
|
||||
|
@ -59,16 +59,16 @@ class twitter{
|
|||
var $headers=array('X-Twitter-Client: ',
|
||||
'X-Twitter-Client-Version: ',
|
||||
'X-Twitter-Client-URL: ');
|
||||
|
||||
|
||||
var $responseInfo=array();
|
||||
|
||||
|
||||
|
||||
|
||||
function twitter(){}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
//
|
||||
// Twitter API calls
|
||||
|
@ -91,9 +91,9 @@ class twitter{
|
|||
//
|
||||
//
|
||||
/////////////////////////////////////////
|
||||
|
||||
|
||||
// Updates the authenticating user's status.
|
||||
|
||||
|
||||
// Updates the authenticating user's status.
|
||||
// Requires the status parameter specified below.
|
||||
//
|
||||
// status. (string) Required. The text of your status update. Must not be
|
||||
|
@ -105,7 +105,7 @@ class twitter{
|
|||
$postargs = 'status='.urlencode($status);
|
||||
return $this->process($request,$postargs);
|
||||
}
|
||||
|
||||
|
||||
// Returns the 20 most recent statuses from non-protected users who have
|
||||
// set a custom user icon. Does not require authentication.
|
||||
//
|
||||
|
@ -114,12 +114,13 @@ class twitter{
|
|||
//
|
||||
function publicTimeline($sinceid=false){
|
||||
$qs='';
|
||||
if($sinceid!==false)
|
||||
if($sinceid!==false) {
|
||||
$qs='?since_id='.intval($sinceid);
|
||||
}
|
||||
$request = 'http://twitter.com/statuses/public_timeline.xml'.$qs;
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Returns the 20 most recent statuses posted in the last 24 hours from the
|
||||
// authenticating user and that user's friends. It's also possible to request
|
||||
// another user's friends_timeline via the id parameter below.
|
||||
|
@ -128,21 +129,22 @@ class twitter{
|
|||
// to return the friends_timeline. (set to false if you
|
||||
// want to use authenticated user).
|
||||
// since. (HTTP-formatted date) Optional. Narrows the returned results to just those
|
||||
// statuses created after the specified date.
|
||||
// statuses created after the specified date.
|
||||
//
|
||||
function friendsTimeline($id=false,$since=false){
|
||||
$qs='';
|
||||
if($since!==false)
|
||||
if($since!==false) {
|
||||
$qs='?since='.urlencode($since);
|
||||
|
||||
if($id===false)
|
||||
}
|
||||
|
||||
if($id===false) {
|
||||
$request = 'http://twitter.com/statuses/friends_timeline.xml'.$qs;
|
||||
else
|
||||
} else {
|
||||
$request = 'http://twitter.com/statuses/friends_timeline/'.urlencode($id).'.xml'.$qs;
|
||||
|
||||
}
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Returns the 20 most recent statuses posted in the last 24 hours from the
|
||||
// authenticating user. It's also possible to request another user's timeline
|
||||
// via the id parameter below.
|
||||
|
@ -157,16 +159,17 @@ class twitter{
|
|||
function userTimeline($id=false,$count=20,$since=false){
|
||||
$qs='?count='.intval($count);
|
||||
if($since!==false)
|
||||
$qs .= '&since='.urlencode($since);
|
||||
|
||||
if($id===false)
|
||||
$qs .= '&since='.urlencode($since);
|
||||
|
||||
if($id===false) {
|
||||
$request = 'http://twitter.com/statuses/user_timeline.xml'.$qs;
|
||||
else
|
||||
} else {
|
||||
$request = 'http://twitter.com/statuses/user_timeline/'.urlencode($id).'.xml'.$qs;
|
||||
|
||||
}
|
||||
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Returns a single status, specified by the id parameter below. The status's author
|
||||
// will be returned inline.
|
||||
//
|
||||
|
@ -184,25 +187,25 @@ class twitter{
|
|||
//
|
||||
function friends($id=false){
|
||||
if($id===false)
|
||||
$request = 'http://twitter.com/statuses/friends.xml';
|
||||
$request = 'http://twitter.com/statuses/friends.xml';
|
||||
else
|
||||
$request = 'http://twitter.com/statuses/friends/'.urlencode($id).'.xml';
|
||||
$request = 'http://twitter.com/statuses/friends/'.urlencode($id).'.xml';
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Returns the authenticating user's followers, each with current status inline.
|
||||
//
|
||||
function followers(){
|
||||
$request = 'http://twitter.com/statuses/followers.xml';
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Returns a list of the users currently featured on the site with their current statuses inline.
|
||||
function featured(){
|
||||
$request = 'http://twitter.com/statuses/featured.xml';
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Returns extended information of a given user, specified by ID or screen name as per the required
|
||||
// id parameter below. This information includes design settings, so third party developers can theme
|
||||
// their widgets according to a given user's preferences.
|
||||
|
@ -213,52 +216,54 @@ class twitter{
|
|||
$request = 'http://twitter.com/users/show/'.urlencode($id).'.xml';
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Returns a list of the direct messages sent to the authenticating user.
|
||||
//
|
||||
// since. (HTTP-formatted date) Optional. Narrows the resulting list of direct messages to just those
|
||||
// sent after the specified date.
|
||||
// sent after the specified date.
|
||||
//
|
||||
function directMessages($since=false){
|
||||
$qs='';
|
||||
if($since!==false)
|
||||
if($since!==false) {
|
||||
$qs='?since='.urlencode($since);
|
||||
}
|
||||
$request = 'http://twitter.com/direct_messages.xml'.$qs;
|
||||
return $this->process($request);
|
||||
}
|
||||
|
||||
|
||||
// Sends a new direct message to the specified user from the authenticating user. Requires both the user
|
||||
// and text parameters below.
|
||||
//
|
||||
// user. (string OR int) Required. The ID or screen name of the recipient user.
|
||||
// text. (string) Required. The text of your direct message. Be sure to URL encode as necessary, and keep
|
||||
// it under 140 characters.
|
||||
// it under 140 characters.
|
||||
//
|
||||
function sendDirectMessage($user,$text){
|
||||
$request = 'http://twitter.com/direct_messages/new.xml';
|
||||
$postargs = 'user='.urlencode($user).'&text='.urlencode($text);
|
||||
return $this->process($request,$postargs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// internal function where all the juicy curl fun takes place
|
||||
// this should not be called by anything external unless you are
|
||||
// doing something else completely then knock youself out.
|
||||
function process($url,$postargs=false){
|
||||
|
||||
|
||||
$ch = curl_init($url);
|
||||
|
||||
if($postargs !== false){
|
||||
curl_setopt ($ch, CURLOPT_POST, true);
|
||||
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);
|
||||
}
|
||||
|
||||
if($this->username !== false && $this->password !== false)
|
||||
|
||||
if($this->username !== false && $this->password !== false) {
|
||||
curl_setopt($ch, CURLOPT_USERPWD, $this->username.':'.$this->password);
|
||||
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 0);
|
||||
curl_setopt($ch, CURLOPT_NOBODY, 0);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
|
@ -268,17 +273,17 @@ class twitter{
|
|||
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
|
||||
$this->responseInfo=curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
|
||||
|
||||
if(intval($this->responseInfo['http_code'])==200){
|
||||
if(class_exists('SimpleXMLElement')){
|
||||
$xml = new SimpleXMLElement($response);
|
||||
return $xml;
|
||||
}else{
|
||||
return $response;
|
||||
return $response;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
|
|
|
@ -80,18 +80,18 @@ function _getDArr($format)
|
|||
{
|
||||
#$arr[''] = '00';
|
||||
switch($format) {
|
||||
case 'h':
|
||||
for($n=0; $n<=23; $n++) {
|
||||
$arr[sprintf('%02d', $n)] = sprintf('%02d', $n);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
for($n=0; $n<=23; $n++) {
|
||||
$arr[sprintf('%02d', $n)] = sprintf('%02d', $n);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
case 's':
|
||||
for($n=0; $n<=59; $n++) {
|
||||
$arr[sprintf('%02d', $n)] = sprintf('%02d', $n);
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
case 's':
|
||||
for($n=0; $n<=59; $n++) {
|
||||
$arr[sprintf('%02d', $n)] = sprintf('%02d', $n);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
|
@ -238,9 +238,9 @@ class uiBase
|
|||
'EXCHANGE' => array('class' => 'uiexchange', 'file' => 'ui_exchange.class.php'),
|
||||
'TRANSFERS' => array('class' => 'uitransfers', 'file' => 'ui_transfers.class.php'),
|
||||
'CALENDAR' => array('class' => 'uicalendar', 'file' => 'ui_calendar.class.php'),
|
||||
array('class' => 'jscom', 'file' => 'ui_jscom.php'),
|
||||
array('class' => 'jscom', 'file' => 'ui_jscom.php'),
|
||||
'TWITTER' => array('class' => 'uitwitter', 'file' => 'ui_twitter.class.php'),
|
||||
array('class' => 'twitter', 'file' => 'twitter.class.php')
|
||||
array('class' => 'twitter', 'file' => 'twitter.class.php')
|
||||
);
|
||||
|
||||
|
||||
|
@ -253,8 +253,7 @@ class uiBase
|
|||
global $CC_DBC, $CC_CONFIG;
|
||||
$this->gb = new GreenBox();
|
||||
$CC_CONFIG['accessRawAudioUrl'] = $CC_CONFIG['storageUrlPath'].'/xmlrpc/simpleGet.php';
|
||||
$this->sessid = isset($_REQUEST[$CC_CONFIG['authCookieName']]) ?
|
||||
$_REQUEST[$CC_CONFIG['authCookieName']] : null;
|
||||
$this->sessid = isset($_REQUEST[$CC_CONFIG['authCookieName']]) ? $_REQUEST[$CC_CONFIG['authCookieName']] : null;
|
||||
$this->userid = GreenBox::GetSessUserId($this->sessid);
|
||||
$this->login = Alib::GetSessLogin($this->sessid);
|
||||
if (PEAR::isError($this->login)) {
|
||||
|
@ -269,8 +268,8 @@ class uiBase
|
|||
$this->id = $this->gb->storId;
|
||||
}
|
||||
if (!is_null($this->id)) {
|
||||
$f = StoredFile::Recall($this->id);
|
||||
$this->type = $f->getType();
|
||||
$f = StoredFile::Recall($this->id);
|
||||
$this->type = $f->getType();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,10 +313,10 @@ class uiBase
|
|||
{
|
||||
global $CC_CONFIG;
|
||||
if (!is_array($this->STATIONPREFS) || ($reload === TRUE) ) {
|
||||
$this->STATIONPREFS = array();
|
||||
$this->STATIONPREFS = array();
|
||||
foreach ($mask as $key => $val) {
|
||||
if (isset($val['isPref']) && $val['isPref']) {
|
||||
$setting = $this->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], $val['element']);
|
||||
$setting = $this->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], $val['element']);
|
||||
if (is_string($setting)) {
|
||||
$this->STATIONPREFS[$val['element']] = $setting;
|
||||
} elseif ($val['required']) {
|
||||
|
@ -399,9 +398,9 @@ class uiBase
|
|||
}
|
||||
|
||||
$elem[$v['element']] =& $form->createElement($type,
|
||||
$v['element'],
|
||||
$label,
|
||||
$attrs);
|
||||
$v['element'],
|
||||
$label,
|
||||
$attrs);
|
||||
if (!$groupit) {
|
||||
$form->addElement($elem[$v['element']]);
|
||||
}
|
||||
|
@ -458,21 +457,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
|
||||
|
||||
|
||||
/**
|
||||
|
@ -482,35 +481,35 @@ class uiBase
|
|||
* local ID of file
|
||||
* @param string $format
|
||||
*/
|
||||
// public function analyzeFile($id, $format)
|
||||
// {
|
||||
// $ia = $this->gb->analyzeFile($id, $this->sessid);
|
||||
// $s = $ia['playtime_seconds'];
|
||||
// $extent = date('H:i:s', floor($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.'));
|
||||
//
|
||||
// if ($format=='text') {
|
||||
// return "<div align='left'><pre>".var_export($ia, TRUE)."</pre></div>";
|
||||
// }
|
||||
// return FALSE;
|
||||
// }
|
||||
// public function analyzeFile($id, $format)
|
||||
// {
|
||||
// $ia = $this->gb->analyzeFile($id, $this->sessid);
|
||||
// $s = $ia['playtime_seconds'];
|
||||
// $extent = date('H:i:s', floor($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.'));
|
||||
//
|
||||
// if ($format=='text') {
|
||||
// return "<div align='left'><pre>".var_export($ia, TRUE)."</pre></div>";
|
||||
// }
|
||||
// return FALSE;
|
||||
// }
|
||||
|
||||
|
||||
// public function toHex($gunid)
|
||||
// {
|
||||
// global $CC_DBC;
|
||||
// $res = $CC_DBC->query("SELECT to_hex($gunid)");
|
||||
// $row = $res->fetchRow();
|
||||
// return $row['to_hex'];
|
||||
// }
|
||||
// public function toHex($gunid)
|
||||
// {
|
||||
// global $CC_DBC;
|
||||
// $res = $CC_DBC->query("SELECT to_hex($gunid)");
|
||||
// $row = $res->fetchRow();
|
||||
// return $row['to_hex'];
|
||||
// }
|
||||
|
||||
|
||||
// public function toInt8($gunid)
|
||||
// {
|
||||
// global $CC_DBC;
|
||||
// $res = $CC_DBC->query("SELECT x'$gunid'::bigint");
|
||||
// $row = $res->fetchRow();
|
||||
// return $row['int8'];
|
||||
// }
|
||||
// public function toInt8($gunid)
|
||||
// {
|
||||
// global $CC_DBC;
|
||||
// $res = $CC_DBC->query("SELECT x'$gunid'::bigint");
|
||||
// $row = $res->fetchRow();
|
||||
// return $row['int8'];
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -535,8 +534,8 @@ class uiBase
|
|||
'creator' => $this->gb->getPLMetadataValue($id, UI_MDATA_KEY_CREATOR),
|
||||
'duration' => $this->gb->getPLMetadataValue($id, UI_MDATA_KEY_DURATION),
|
||||
'type' => 'playlist',
|
||||
);
|
||||
return ($data);
|
||||
);
|
||||
return ($data);
|
||||
}
|
||||
|
||||
public function getMetaInfo($id)
|
||||
|
@ -552,8 +551,8 @@ class uiBase
|
|||
'source' => $type == 'audioclip' ? $media->getMetadataValue($id, UI_MDATA_KEY_SOURCE) : NULL,
|
||||
'bitRate' => $type == 'audioclip' ? $media->getMetadataValue($id, UI_MDATA_KEY_BITRATE) : NULL,
|
||||
'sampleRate' => $type == 'audioclip' ? $media->getMetadataValue($id, UI_MDATA_KEY_SAMPLERATE) : NULL,
|
||||
);
|
||||
return ($data);
|
||||
);
|
||||
return ($data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -594,5 +593,5 @@ class uiBase
|
|||
return $str;
|
||||
}
|
||||
|
||||
} // class uiBase
|
||||
?>
|
||||
} // class uiBase
|
||||
?>
|
|
@ -102,7 +102,7 @@ class uiBrowse
|
|||
$this->setCategory(array('col' => $col,
|
||||
'category' => $this->col[$col]['category']));
|
||||
$this->setValue(
|
||||
array('col' => $col,
|
||||
array('col' => $col,
|
||||
'category' => $this->col[$col]['category'],
|
||||
'value' => $this->col[$col]['value']));
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class uiBrowse
|
|||
*/
|
||||
public function getCriteria()
|
||||
{
|
||||
return $this->criteria;
|
||||
return $this->criteria;
|
||||
} // fn getCriteria
|
||||
|
||||
|
||||
|
@ -152,8 +152,8 @@ class uiBrowse
|
|||
'category' => uiBase::formElementEncode($this->col[$n]['category'])));
|
||||
|
||||
$mask2['browse_columns']['value']['options'] = $this->options($this->col[$n]['values']['results']);
|
||||
$mask2['browse_columns']['category']['attributes']['id'] = "category_" . $n;
|
||||
$mask2['browse_columns']['value']['attributes']['id'] = "category_value_" . $n;
|
||||
$mask2['browse_columns']['category']['attributes']['id'] = "category_" . $n;
|
||||
$mask2['browse_columns']['value']['attributes']['id'] = "category_value_" . $n;
|
||||
|
||||
$mask2['browse_columns']['value']['default'] = $this->col[$n]['form_value'];
|
||||
uiBase::parseArrayToForm($form, $mask2['browse_columns']);
|
||||
|
@ -214,7 +214,7 @@ class uiBrowse
|
|||
// reload the values.
|
||||
for ($i = $columnNumber; $i <= 3; $i++) {
|
||||
$browseValues = $this->Base->gb->browseCategory(
|
||||
$this->col[$i]["category"], $tmpCriteria, $this->Base->sessid);
|
||||
$this->col[$i]["category"], $tmpCriteria, $this->Base->sessid);
|
||||
if (!PEAR::isError($browseValues)) {
|
||||
$this->col[$i]['values'] = $browseValues;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ class uiBrowse
|
|||
}
|
||||
|
||||
if($redirect) {
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
}
|
||||
} // fn setCategory
|
||||
|
||||
|
@ -249,10 +249,10 @@ class uiBrowse
|
|||
if ($value == '%%all%%') {
|
||||
unset($this->col[$columnNumber]['criteria']['conditions']);
|
||||
} else {
|
||||
$conditions = array('cat' => uiBase::formElementDecode($category),
|
||||
$conditions = array('cat' => uiBase::formElementDecode($category),
|
||||
'op' => '=',
|
||||
'val' => $value);
|
||||
$this->col[$columnNumber]['criteria']['conditions'] = $conditions;
|
||||
$this->col[$columnNumber]['criteria']['conditions'] = $conditions;
|
||||
}
|
||||
|
||||
// Clear all columns above this one of selected values.
|
||||
|
@ -273,64 +273,64 @@ class uiBrowse
|
|||
for ($tmpColNum = $columnNumber + 1; $tmpColNum <= 3; $tmpColNum++) {
|
||||
$tmpCategory = $this->col[$tmpColNum]['category'];
|
||||
$browseValues = $this->Base->gb->browseCategory(
|
||||
$tmpCategory, $tmpCriteria, $this->Base->sessid);
|
||||
$tmpCategory, $tmpCriteria, $this->Base->sessid);
|
||||
if (!PEAR::isError($browseValues)) {
|
||||
$this->col[$tmpColNum]['values'] = $browseValues;
|
||||
}
|
||||
}
|
||||
|
||||
if($redirect) {
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
}
|
||||
} // fn setValue
|
||||
|
||||
public function refresh($p_param){
|
||||
$category_1 = array(
|
||||
$category_1 = array(
|
||||
'col' => 1,
|
||||
'category' => $p_param['cat1']
|
||||
);
|
||||
);
|
||||
|
||||
$value_1 = array(
|
||||
$value_1 = array(
|
||||
'col' => 1,
|
||||
'category' => $p_param['cat1'],
|
||||
'value' => array(
|
||||
0 => $p_param['val1']
|
||||
)
|
||||
);
|
||||
0 => $p_param['val1']
|
||||
)
|
||||
);
|
||||
|
||||
$category_2 = array(
|
||||
$category_2 = array(
|
||||
'col' => 2,
|
||||
'category' => $p_param['cat2']
|
||||
);
|
||||
);
|
||||
|
||||
$value_2 = array(
|
||||
$value_2 = array(
|
||||
'col' => 2,
|
||||
'category' => $p_param['cat2'],
|
||||
'value' => array(
|
||||
0 => $p_param['val2']
|
||||
)
|
||||
);
|
||||
0 => $p_param['val2']
|
||||
)
|
||||
);
|
||||
|
||||
$category_3 = array(
|
||||
$category_3 = array(
|
||||
'col' => 3,
|
||||
'category' => $p_param['cat3']
|
||||
);
|
||||
);
|
||||
|
||||
$value_3 = array(
|
||||
$value_3 = array(
|
||||
'col' => 3,
|
||||
'category' => $p_param['cat3'],
|
||||
'value' => array(
|
||||
0 => $p_param['val3']
|
||||
)
|
||||
);
|
||||
0 => $p_param['val3']
|
||||
)
|
||||
);
|
||||
|
||||
$this->setCategory($category_1, false);
|
||||
$this->setCategory($category_2, false);
|
||||
$this->setCategory($category_3, false);
|
||||
$this->setCategory($category_1, false);
|
||||
$this->setCategory($category_2, false);
|
||||
$this->setCategory($category_3, false);
|
||||
|
||||
$this->setValue($value_1, false);
|
||||
$this->setValue($value_2, false);
|
||||
$this->setValue($value_3, true);
|
||||
$this->setValue($value_1, false);
|
||||
$this->setValue($value_2, false);
|
||||
$this->setValue($value_3, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -414,10 +414,10 @@ class uiBrowse
|
|||
}
|
||||
|
||||
if (!isset($this->results['pagination'][1])) {
|
||||
$this->results['pagination'][1] = '|<<';
|
||||
$this->results['pagination'][1] = '|<<';
|
||||
}
|
||||
if (!isset($this->results['pagination'][$maxp])) {
|
||||
$this->results['pagination'][$maxp] = '>>|';
|
||||
$this->results['pagination'][$maxp] = '>>|';
|
||||
}
|
||||
$this->results['next'] = ($results['cnt'] > ($this->criteria['offset'] + $this->criteria['limit'])) ? TRUE : FALSE;
|
||||
$this->results['prev'] = ($this->criteria['offset'] > 0) ? TRUE : FALSE;
|
||||
|
@ -490,9 +490,9 @@ class uiBrowse
|
|||
|
||||
for ($n = 1; $n <= 3; $n++) {
|
||||
$browseValues = $this->Base->gb->browseCategory(
|
||||
$this->col[$n]['category'],
|
||||
$tmpCriteria,
|
||||
$this->Base->sessid);
|
||||
$this->col[$n]['category'],
|
||||
$tmpCriteria,
|
||||
$this->Base->sessid);
|
||||
if (!PEAR::isError($browseValues)) {
|
||||
$this->col[$n]['values'] = $browseValues;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ define('ACTION_BASE', '/actions' ) ;
|
|||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
*/
|
||||
class uiHandler extends uiBase {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $redirUrl;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $redirUrl;
|
||||
|
||||
/**
|
||||
* Initialize a new Browser Class
|
||||
|
@ -28,12 +28,12 @@ class uiHandler extends uiBase {
|
|||
|
||||
// --- authentication ---
|
||||
/**
|
||||
* Login to the storageServer.
|
||||
* It set sessid to the cookie with name defined in ../conf.php
|
||||
*
|
||||
* @param array $formdata
|
||||
* The REQUEST array.
|
||||
*/
|
||||
* Login to the storageServer.
|
||||
* It set sessid to the cookie with name defined in ../conf.php
|
||||
*
|
||||
* @param array $formdata
|
||||
* The REQUEST array.
|
||||
*/
|
||||
function login($formdata, $mask)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
@ -65,7 +65,7 @@ class uiHandler extends uiBase {
|
|||
$this->langid = $formdata['langid'];
|
||||
$this->redirUrl = UI_BROWSER.'?popup[]=_2SCHEDULER&popup[]=_close';
|
||||
return TRUE;
|
||||
} // fn login
|
||||
} // fn login
|
||||
|
||||
|
||||
/**
|
||||
|
@ -84,164 +84,164 @@ class uiHandler extends uiBase {
|
|||
session_destroy();
|
||||
|
||||
if ($trigger_login) {
|
||||
$this->redirUrl = UI_BROWSER.'?popup[]=_clear_parent&popup[]=login';
|
||||
$this->redirUrl = UI_BROWSER.'?popup[]=_clear_parent&popup[]=login';
|
||||
} else {
|
||||
$this->redirUrl = UI_BROWSER.'?popup[]=_clear_parent&popup[]=_close';
|
||||
$this->redirUrl = UI_BROWSER.'?popup[]=_clear_parent&popup[]=_close';
|
||||
}
|
||||
} // fn logout
|
||||
|
||||
|
||||
// --- files ---
|
||||
function processFile($audio_file, $caller){
|
||||
function processFile($audio_file, $caller){
|
||||
|
||||
global $CC_CONFIG;
|
||||
global $CC_CONFIG;
|
||||
|
||||
if ($this->testForAudioType($audio_file) === FALSE) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "uses an unsupported file type."}}');
|
||||
}
|
||||
if ($this->testForAudioType($audio_file) === FALSE) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "uses an unsupported file type."}}');
|
||||
}
|
||||
|
||||
$md5 = md5_file($audio_file);
|
||||
$duplicate = StoredFile::RecallByMd5($md5);
|
||||
if ($duplicate) {
|
||||
if (PEAR::isError($duplicate)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' . $duplicate->getMessage() .'}}');
|
||||
}
|
||||
else {
|
||||
$duplicateName = $this->gb->getMetadataValue($duplicate->getId(), UI_MDATA_KEY_TITLE, $this->sessid);
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "An identical audioclip named ' . $duplicateName . ' already exists in the storage server."}}');
|
||||
}
|
||||
}
|
||||
$md5 = md5_file($audio_file);
|
||||
$duplicate = StoredFile::RecallByMd5($md5);
|
||||
if ($duplicate) {
|
||||
if (PEAR::isError($duplicate)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' . $duplicate->getMessage() .'}}');
|
||||
}
|
||||
else {
|
||||
$duplicateName = $this->gb->getMetadataValue($duplicate->getId(), UI_MDATA_KEY_TITLE, $this->sessid);
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "An identical audioclip named ' . $duplicateName . ' already exists in the storage server."}}');
|
||||
}
|
||||
}
|
||||
|
||||
$metadata = camp_get_audio_metadata($audio_file);
|
||||
$metadata = camp_get_audio_metadata($audio_file);
|
||||
|
||||
if (PEAR::isError($metadata)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' + $metadata->getMessage() + '}}');
|
||||
}
|
||||
if (PEAR::isError($metadata)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' + $metadata->getMessage() + '}}');
|
||||
}
|
||||
|
||||
// #2196 no id tag -> use the original filename
|
||||
if (basename($audio_file) == $metadata['dc:title']) {
|
||||
$metadata['dc:title'] = basename($audio_file);
|
||||
$metadata['ls:filename'] = basename($audio_file);
|
||||
}
|
||||
// #2196 no id tag -> use the original filename
|
||||
if (basename($audio_file) == $metadata['dc:title']) {
|
||||
$metadata['dc:title'] = basename($audio_file);
|
||||
$metadata['ls:filename'] = basename($audio_file);
|
||||
}
|
||||
|
||||
// setMetadataBatch doesnt like these values
|
||||
unset($metadata['audio']);
|
||||
unset($metadata['playtime_seconds']);
|
||||
// setMetadataBatch doesnt like these values
|
||||
unset($metadata['audio']);
|
||||
unset($metadata['playtime_seconds']);
|
||||
|
||||
$values = array(
|
||||
$values = array(
|
||||
"filename" => basename($audio_file),
|
||||
"filepath" => $audio_file,
|
||||
"filetype" => "audioclip",
|
||||
"mime" => $metadata["dc:format"],
|
||||
"md5" => $md5
|
||||
);
|
||||
$storedFile = $this->gb->putFile($values, $this->sessid);
|
||||
);
|
||||
$storedFile = $this->gb->putFile($values, $this->sessid);
|
||||
|
||||
if (PEAR::isError($storedFile)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' + $storedFile->getMessage() + '}}');
|
||||
}
|
||||
if (PEAR::isError($storedFile)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": ' + $storedFile->getMessage() + '}}');
|
||||
}
|
||||
|
||||
$result = $storedFile->setMetadataBatch($metadata);
|
||||
$result = $storedFile->setMetadataBatch($metadata);
|
||||
|
||||
return $storedFile->getId();
|
||||
}
|
||||
return $storedFile->getId();
|
||||
}
|
||||
|
||||
function pluploadFile($data)
|
||||
{
|
||||
header('Content-type: text/plain; charset=UTF-8');
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
function pluploadFile($data)
|
||||
{
|
||||
header('Content-type: text/plain; charset=UTF-8');
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
// Settings
|
||||
$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||
$cleanupTargetDir = false; // Remove old files
|
||||
$maxFileAge = 60 * 60; // Temp file age in seconds
|
||||
// Settings
|
||||
$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||
$cleanupTargetDir = false; // Remove old files
|
||||
$maxFileAge = 60 * 60; // Temp file age in seconds
|
||||
|
||||
// 5 minutes execution time
|
||||
@set_time_limit(5 * 60);
|
||||
// 5 minutes execution time
|
||||
@set_time_limit(5 * 60);
|
||||
|
||||
// Get parameters
|
||||
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
||||
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
// Get parameters
|
||||
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
||||
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
|
||||
// Clean the fileName for security reasons
|
||||
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
||||
// Clean the fileName for security reasons
|
||||
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
||||
|
||||
// Create target dir
|
||||
if (!file_exists($targetDir)) {
|
||||
@mkdir($targetDir);
|
||||
}
|
||||
// Create target dir
|
||||
if (!file_exists($targetDir)) {
|
||||
@mkdir($targetDir);
|
||||
}
|
||||
|
||||
// Remove old temp files
|
||||
if (is_dir($targetDir) && ($dir = opendir($targetDir))) {
|
||||
while (($file = readdir($dir)) !== false) {
|
||||
$filePath = $targetDir . DIRECTORY_SEPARATOR . $file;
|
||||
// Remove old temp files
|
||||
if (is_dir($targetDir) && ($dir = opendir($targetDir))) {
|
||||
while (($file = readdir($dir)) !== false) {
|
||||
$filePath = $targetDir . DIRECTORY_SEPARATOR . $file;
|
||||
|
||||
// Remove temp files if they are older than the max age
|
||||
if (preg_match('/\\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge))
|
||||
@unlink($filePath);
|
||||
}
|
||||
// Remove temp files if they are older than the max age
|
||||
if (preg_match('/\\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge))
|
||||
@unlink($filePath);
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
}
|
||||
else {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
else {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
|
||||
}
|
||||
|
||||
// Look for the content type header
|
||||
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||
// Look for the content type header
|
||||
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||
|
||||
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||
|
||||
if (strpos($contentType, "multipart") !== false) {
|
||||
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
// Open temp file
|
||||
$out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen($_FILES['file']['tmp_name'], "rb");
|
||||
if (strpos($contentType, "multipart") !== false) {
|
||||
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
// Open temp file
|
||||
$out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen($_FILES['file']['tmp_name'], "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($out);
|
||||
unlink($_FILES['file']['tmp_name']);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
|
||||
} else {
|
||||
// Open temp file
|
||||
$out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen("php://input", "rb");
|
||||
fclose($out);
|
||||
unlink($_FILES['file']['tmp_name']);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
|
||||
} else {
|
||||
// Open temp file
|
||||
$out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen("php://input", "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($out);
|
||||
return $this->processFile($targetDir . DIRECTORY_SEPARATOR . $fileName);
|
||||
fclose($out);
|
||||
return $this->processFile($targetDir . DIRECTORY_SEPARATOR . $fileName);
|
||||
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
}
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
}
|
||||
|
||||
// Return JSON-RPC response
|
||||
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
|
||||
}
|
||||
// Return JSON-RPC response
|
||||
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides file upload and store it to the storage
|
||||
|
@ -254,7 +254,7 @@ class uiHandler extends uiBase {
|
|||
global $CC_CONFIG;
|
||||
if ($this->testForAudioType($formdata['mediafile']['name']) === FALSE) {
|
||||
if (UI_ERROR) {
|
||||
$this->_retMsg('"$1" uses an unsupported file type.', $formdata['mediafile']['name']);
|
||||
$this->_retMsg('"$1" uses an unsupported file type.', $formdata['mediafile']['name']);
|
||||
}
|
||||
$this->redirUrl = UI_BROWSER."?act=addFileData&folderId=".$formdata['folderId'];
|
||||
return FALSE;
|
||||
|
@ -347,45 +347,45 @@ class uiHandler extends uiBase {
|
|||
* @param unknown_type $langid
|
||||
* @return void
|
||||
*/
|
||||
// function translateMetadata($id, $langid=UI_DEFAULT_LANGID)
|
||||
// {
|
||||
// include(dirname(__FILE__).'/formmask/metadata.inc.php');
|
||||
//
|
||||
// $ia = $this->gb->analyzeFile($id, $this->sessid);
|
||||
// if (PEAR::isError($ia)) {
|
||||
// $this->_retMsg($ia->getMessage());
|
||||
// return;
|
||||
// }
|
||||
// // This is really confusing: the import script does not do it
|
||||
// // this way. Which way is the right way?
|
||||
// $this->setMetadataValue($id, UI_MDATA_KEY_DURATION, Playlist::secondsToPlaylistTime($ia['playtime_seconds']));
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_FILE);
|
||||
//
|
||||
// // some data from raw audio
|
||||
//// if (isset($ia['audio']['channels'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_CHANNELS, $ia['audio']['channels']);
|
||||
//// }
|
||||
//// if (isset($ia['audio']['sample_rate'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_SAMPLERATE, $ia['audio']['sample_rate']);
|
||||
//// }
|
||||
//// if (isset($ia['audio']['bitrate'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_BITRATE, $ia['audio']['bitrate']);
|
||||
//// }
|
||||
//// if (isset($ia['audio']['codec'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']);
|
||||
//// }
|
||||
//
|
||||
// // from id3 Tags
|
||||
// // loop main, music, talk
|
||||
// foreach ($mask['pages'] as $key => $val) {
|
||||
// // loop through elements
|
||||
// foreach ($mask['pages'][$key] as $k => $v) {
|
||||
// if (isset($v['element']) && isset($ia[$v['element']])) {
|
||||
// $this->setMetadataValue($id, $v['element'], $ia[$v['element']], $langid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// function translateMetadata($id, $langid=UI_DEFAULT_LANGID)
|
||||
// {
|
||||
// include(dirname(__FILE__).'/formmask/metadata.inc.php');
|
||||
//
|
||||
// $ia = $this->gb->analyzeFile($id, $this->sessid);
|
||||
// if (PEAR::isError($ia)) {
|
||||
// $this->_retMsg($ia->getMessage());
|
||||
// return;
|
||||
// }
|
||||
// // This is really confusing: the import script does not do it
|
||||
// // this way. Which way is the right way?
|
||||
// $this->setMetadataValue($id, UI_MDATA_KEY_DURATION, Playlist::secondsToPlaylistTime($ia['playtime_seconds']));
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_FILE);
|
||||
//
|
||||
// // some data from raw audio
|
||||
//// if (isset($ia['audio']['channels'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_CHANNELS, $ia['audio']['channels']);
|
||||
//// }
|
||||
//// if (isset($ia['audio']['sample_rate'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_SAMPLERATE, $ia['audio']['sample_rate']);
|
||||
//// }
|
||||
//// if (isset($ia['audio']['bitrate'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_BITRATE, $ia['audio']['bitrate']);
|
||||
//// }
|
||||
//// if (isset($ia['audio']['codec'])) {
|
||||
//// $this->setMetadataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']);
|
||||
//// }
|
||||
//
|
||||
// // from id3 Tags
|
||||
// // loop main, music, talk
|
||||
// foreach ($mask['pages'] as $key => $val) {
|
||||
// // loop through elements
|
||||
// foreach ($mask['pages'][$key] as $k => $v) {
|
||||
// if (isset($v['element']) && isset($ia[$v['element']])) {
|
||||
// $this->setMetadataValue($id, $v['element'], $ia[$v['element']], $langid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -461,15 +461,15 @@ class uiHandler extends uiBase {
|
|||
|
||||
foreach ($mask['pages'] as $key => $val) {
|
||||
foreach ($mask['pages'][$key] as $k => $v) {
|
||||
$element = uiBase::formElementEncode($v['element']);
|
||||
$element = uiBase::formElementEncode($v['element']);
|
||||
if ($formdata[$key.'___'.$element])
|
||||
$mData[uiBase::formElementDecode($v['element'])] = $formdata[$key.'___'.$element];
|
||||
$mData[uiBase::formElementDecode($v['element'])] = $formdata[$key.'___'.$element];
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION["debug"] = $mData;
|
||||
if (!count($mData)) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($mData as $key => $val) {
|
||||
|
@ -491,15 +491,15 @@ class uiHandler extends uiBase {
|
|||
* @param int $id
|
||||
* destination folder id
|
||||
*/
|
||||
// function rename($newname, $id)
|
||||
// {
|
||||
// $r = $this->gb->renameFile($id, $newname, $this->sessid);
|
||||
// if (PEAR::isError($r)) {
|
||||
// $this->_retMsg($r->getMessage());
|
||||
// }
|
||||
// //$this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
|
||||
// $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
|
||||
// } // fn rename
|
||||
// function rename($newname, $id)
|
||||
// {
|
||||
// $r = $this->gb->renameFile($id, $newname, $this->sessid);
|
||||
// if (PEAR::isError($r)) {
|
||||
// $this->_retMsg($r->getMessage());
|
||||
// }
|
||||
// //$this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
|
||||
// $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
|
||||
// } // fn rename
|
||||
|
||||
|
||||
/**
|
||||
|
@ -517,19 +517,19 @@ class uiHandler extends uiBase {
|
|||
$this->redirUrl = UI_BROWSER."?popup[]=_reload_parent&popup[]=_close";
|
||||
|
||||
if (is_array($id)) {
|
||||
$ids = $id;
|
||||
$ids = $id;
|
||||
} else {
|
||||
$ids[] = $id;
|
||||
$ids[] = $id;
|
||||
}
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$media = StoredFile::Recall($id);
|
||||
$r = $media->delete();
|
||||
$media = StoredFile::Recall($id);
|
||||
$r = $media->delete();
|
||||
|
||||
if (PEAR::isError($r)) {
|
||||
$this->_retMsg($r->getMessage());
|
||||
return FALSE;
|
||||
}
|
||||
if (PEAR::isError($r)) {
|
||||
$this->_retMsg($r->getMessage());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -548,9 +548,9 @@ class uiHandler extends uiBase {
|
|||
{
|
||||
$r = $this->gb->access($id, $this->sessid);
|
||||
if (PEAR::isError($r)) {
|
||||
$this->_retMsg($r->getMessage());
|
||||
$this->_retMsg($r->getMessage());
|
||||
} else {
|
||||
echo $r;
|
||||
echo $r;
|
||||
}
|
||||
} // fn getFile
|
||||
|
||||
|
@ -571,24 +571,24 @@ class uiHandler extends uiBase {
|
|||
|
||||
// --- perms ---
|
||||
/**
|
||||
* Add new permission record
|
||||
*
|
||||
* @param int $subj
|
||||
* local user/group id
|
||||
* @param string $permAction
|
||||
* type of action from set predefined in conf.php
|
||||
* @param int $id
|
||||
* local id of file/object
|
||||
* @param char $allowDeny
|
||||
* 'A' or 'D'
|
||||
* @return boolean
|
||||
*/
|
||||
* Add new permission record
|
||||
*
|
||||
* @param int $subj
|
||||
* local user/group id
|
||||
* @param string $permAction
|
||||
* type of action from set predefined in conf.php
|
||||
* @param int $id
|
||||
* local id of file/object
|
||||
* @param char $allowDeny
|
||||
* 'A' or 'D'
|
||||
* @return boolean
|
||||
*/
|
||||
function addPerm($subj, $permAction, $id, $allowDeny)
|
||||
{
|
||||
if (PEAR::isError(
|
||||
$this->gb->addPerm(
|
||||
$subj, $permAction, $id, $allowDeny, $this->sessid
|
||||
)
|
||||
$this->gb->addPerm(
|
||||
$subj, $permAction, $id, $allowDeny, $this->sessid
|
||||
)
|
||||
)) {
|
||||
$this->_retMsg('Access denied.');
|
||||
return FALSE;
|
||||
|
@ -665,14 +665,14 @@ class uiHandler extends uiBase {
|
|||
}
|
||||
}
|
||||
/*
|
||||
foreach($mask as $k) {
|
||||
if ($k['type']=='file' && $k['required']==TRUE) {
|
||||
if ($_FILES[$k['element']]['error']) {
|
||||
$_SESSION['retransferFormData'] = array_merge($_REQUEST, $_FILES);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
} */
|
||||
foreach($mask as $k) {
|
||||
if ($k['type']=='file' && $k['required']==TRUE) {
|
||||
if ($_FILES[$k['element']]['error']) {
|
||||
$_SESSION['retransferFormData'] = array_merge($_REQUEST, $_FILES);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
} */
|
||||
return TRUE;
|
||||
} // fn _validateForm
|
||||
|
||||
|
@ -694,17 +694,17 @@ class uiHandler extends uiBase {
|
|||
foreach ($mask as $key => $val) {
|
||||
if (isset($val['isPref']) && $val['isPref']) {
|
||||
if (!empty($formdata[$val['element']])) {
|
||||
$result = $this->gb->saveGroupPref($this->sessid, $CC_CONFIG['StationPrefsGr'], $val['element'], $formdata[$val['element']]);
|
||||
$result = $this->gb->saveGroupPref($this->sessid, $CC_CONFIG['StationPrefsGr'], $val['element'], $formdata[$val['element']]);
|
||||
if (PEAR::isError($result))
|
||||
$this->_retMsg('Error while saving settings.');
|
||||
$this->_retMsg('Error while saving settings.');
|
||||
} else {
|
||||
$this->gb->delGroupPref($this->sessid, $CC_CONFIG['StationPrefsGr'], $val['element']);
|
||||
}
|
||||
}
|
||||
if (isset($val['type'])
|
||||
&& ($val['type'] == 'file')
|
||||
&& ($val['element'] == "stationlogo")
|
||||
&& !empty($formdata[$val['element']]['name'])) {
|
||||
&& ($val['type'] == 'file')
|
||||
&& ($val['element'] == "stationlogo")
|
||||
&& !empty($formdata[$val['element']]['name'])) {
|
||||
$stationLogoPath = $this->gb->loadGroupPref($CC_CONFIG['StationPrefsGr'], 'stationLogoPath');
|
||||
$filePath = $formdata[$val['element']]['tmp_name'];
|
||||
if (function_exists("getimagesize")) {
|
||||
|
@ -731,7 +731,7 @@ class uiHandler extends uiBase {
|
|||
}
|
||||
|
||||
return TRUE;
|
||||
} // fn changeStationPrefs
|
||||
}
|
||||
|
||||
} // class uiHandler
|
||||
}
|
||||
?>
|
|
@ -14,526 +14,526 @@ if (get_magic_quotes_gpc()) {
|
|||
|
||||
switch ($_REQUEST['act']) {
|
||||
case "login":
|
||||
if ($uiHandler->login($_REQUEST, $ui_fmask["login"]) === TRUE) {
|
||||
$uiHandler->loadStationPrefs($ui_fmask['stationPrefs'], TRUE);
|
||||
# $uiHandler->PLAYLIST->reportLookedPL();
|
||||
$uiHandler->PLAYLIST->loadLookedFromPref();
|
||||
}
|
||||
include(dirname(__FILE__).'/templates/loader/index.tpl');
|
||||
include(dirname(__FILE__).'/templates/popup/_reload_parent.tpl');
|
||||
include(dirname(__FILE__).'/templates/popup/_close.tpl');
|
||||
exit;
|
||||
if ($uiHandler->login($_REQUEST, $ui_fmask["login"]) === TRUE) {
|
||||
$uiHandler->loadStationPrefs($ui_fmask['stationPrefs'], TRUE);
|
||||
# $uiHandler->PLAYLIST->reportLookedPL();
|
||||
$uiHandler->PLAYLIST->loadLookedFromPref();
|
||||
}
|
||||
include(dirname(__FILE__).'/templates/loader/index.tpl');
|
||||
include(dirname(__FILE__).'/templates/popup/_reload_parent.tpl');
|
||||
include(dirname(__FILE__).'/templates/popup/_close.tpl');
|
||||
exit;
|
||||
|
||||
case "logout":
|
||||
$uiHandler->SCRATCHPAD->save();
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->logout();
|
||||
break;
|
||||
$uiHandler->SCRATCHPAD->save();
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->logout();
|
||||
break;
|
||||
|
||||
case "signover":
|
||||
$uiHandler->SCRATCHPAD->save();
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->logout(TRUE);
|
||||
break;
|
||||
$uiHandler->SCRATCHPAD->save();
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->logout(TRUE);
|
||||
break;
|
||||
|
||||
case "plupload":
|
||||
$ui_tmpid = $uiHandler->pluploadFile($_REQUEST);
|
||||
if($ui_tmpid) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
ob_end_clean();
|
||||
$ui_tmpid = $uiHandler->pluploadFile($_REQUEST);
|
||||
if($ui_tmpid) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
die('{"jsonrpc" : "2.0", "error" : {}}');
|
||||
die('{"jsonrpc" : "2.0", "error" : {}}');
|
||||
|
||||
// file/webstream handling
|
||||
// file/webstream handling
|
||||
case "addFileData":
|
||||
if (($ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $ui_fmask["file"])) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
break;
|
||||
if (($ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $ui_fmask["file"])) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
break;
|
||||
|
||||
case "addWebstreamData":
|
||||
$ui_tmpid = $uiHandler->addWebstream($_REQUEST, $ui_fmask['webstream']);
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
break;
|
||||
$ui_tmpid = $uiHandler->addWebstream($_REQUEST, $ui_fmask['webstream']);
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
break;
|
||||
|
||||
case "addWebstreamMData":
|
||||
case "editWebstreamData":
|
||||
$uiHandler->editWebstream($_REQUEST, $ui_fmask['webstream']);
|
||||
$uiHandler->SCRATCHPAD->reloadMetadata();
|
||||
break;
|
||||
$uiHandler->editWebstream($_REQUEST, $ui_fmask['webstream']);
|
||||
$uiHandler->SCRATCHPAD->reloadMetadata();
|
||||
break;
|
||||
|
||||
case "editMetaData":
|
||||
$uiHandler->editMetaData($_REQUEST);
|
||||
$uiHandler->SCRATCHPAD->reloadMetadata();
|
||||
break;
|
||||
$uiHandler->editMetaData($_REQUEST);
|
||||
$uiHandler->SCRATCHPAD->reloadMetadata();
|
||||
break;
|
||||
|
||||
case "rename":
|
||||
$uiHandler->rename($_REQUEST["newname"], $uiHandler->id);
|
||||
break;
|
||||
$uiHandler->rename($_REQUEST["newname"], $uiHandler->id);
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
if ($uiHandler->delete($_REQUEST['id'], $_REQUEST['delOverride'])) {
|
||||
if ($uiHandler->type != 'Folder') {
|
||||
$uiHandler->SCRATCHPAD->removeItems($_REQUEST['id']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
if ($uiHandler->delete($_REQUEST['id'], $_REQUEST['delOverride'])) {
|
||||
if ($uiHandler->type != 'Folder') {
|
||||
$uiHandler->SCRATCHPAD->removeItems($_REQUEST['id']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "addPerm":
|
||||
$uiHandler->addPerm($_REQUEST["subj"], $_REQUEST["permAction"], $uiHandler->id, $_REQUEST["allowDeny"]);
|
||||
break;
|
||||
$uiHandler->addPerm($_REQUEST["subj"], $_REQUEST["permAction"], $uiHandler->id, $_REQUEST["allowDeny"]);
|
||||
break;
|
||||
|
||||
case "removePerm":
|
||||
$uiHandler->removePerm($_REQUEST["permid"], $_REQUEST["oid"]);
|
||||
break;
|
||||
$uiHandler->removePerm($_REQUEST["permid"], $_REQUEST["oid"]);
|
||||
break;
|
||||
|
||||
case "SUBJECTS.addSubj":
|
||||
$uiHandler->SUBJECTS->addSubj($_REQUEST);
|
||||
break;
|
||||
$uiHandler->SUBJECTS->addSubj($_REQUEST);
|
||||
break;
|
||||
|
||||
case "SUBJECTS.removeSubj":
|
||||
$uiHandler->SUBJECTS->removeSubj($_REQUEST);
|
||||
break;
|
||||
$uiHandler->SUBJECTS->removeSubj($_REQUEST);
|
||||
break;
|
||||
|
||||
case "SUBJECTS.addSubj2Gr":
|
||||
$uiHandler->SUBJECTS->addSubj2Gr($_REQUEST);
|
||||
break;
|
||||
$uiHandler->SUBJECTS->addSubj2Gr($_REQUEST);
|
||||
break;
|
||||
|
||||
case "SUBJECTS.removeSubjFromGr":
|
||||
$uiHandler->SUBJECTS->removeSubjFromGr($_REQUEST);
|
||||
break;
|
||||
$uiHandler->SUBJECTS->removeSubjFromGr($_REQUEST);
|
||||
break;
|
||||
|
||||
case "SUBJECTS.chgPasswd":
|
||||
$uiHandler->SUBJECTS->chgPasswd($_REQUEST);
|
||||
break;
|
||||
$uiHandler->SUBJECTS->chgPasswd($_REQUEST);
|
||||
break;
|
||||
|
||||
case "changeStationPrefs":
|
||||
$uiHandler->changeStationPrefs(array_merge($_REQUEST, $_FILES), $ui_fmask["stationPrefs"]);
|
||||
$uiHandler->redirUrl = UI_BROWSER."?act=changeStationPrefs";
|
||||
break;
|
||||
$uiHandler->changeStationPrefs(array_merge($_REQUEST, $_FILES), $ui_fmask["stationPrefs"]);
|
||||
$uiHandler->redirUrl = UI_BROWSER."?act=changeStationPrefs";
|
||||
break;
|
||||
|
||||
case "SP.addItem":
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id'], $_REQUEST['type']);
|
||||
$uiHandler->SCRATCHPAD->setReload();
|
||||
break;
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id'], $_REQUEST['type']);
|
||||
$uiHandler->SCRATCHPAD->setReload();
|
||||
break;
|
||||
|
||||
case "SP.removeItem":
|
||||
$uiHandler->SCRATCHPAD->removeItems($_REQUEST['id']);
|
||||
$uiHandler->SCRATCHPAD->setReload();
|
||||
break;
|
||||
$uiHandler->SCRATCHPAD->removeItems($_REQUEST['id']);
|
||||
$uiHandler->SCRATCHPAD->setReload();
|
||||
break;
|
||||
|
||||
case "SP.reorder":
|
||||
$uiHandler->SCRATCHPAD->reorder($_REQUEST['by']);
|
||||
$uiHandler->SCRATCHPAD->setReload();
|
||||
break;
|
||||
$uiHandler->SCRATCHPAD->reorder($_REQUEST['by']);
|
||||
$uiHandler->SCRATCHPAD->setReload();
|
||||
break;
|
||||
|
||||
case "SEARCH.newSearch":
|
||||
$uiHandler->SEARCH->newSearch($_REQUEST);
|
||||
$uiHandler->SEARCH->newSearch($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "SEARCH.simpleSearch":
|
||||
$uiHandler->SEARCH->simpleSearch($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->SEARCH->simpleSearch($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "SEARCH.reorder":
|
||||
$uiHandler->SEARCH->reorder($_REQUEST['by']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->SEARCH->reorder($_REQUEST['by']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "SEARCH.clear":
|
||||
$uiHandler->SEARCH->clear();
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->SEARCH->clear();
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "SEARCH.setOffset":
|
||||
$uiHandler->SEARCH->setOffset($_REQUEST['page']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->SEARCH->setOffset($_REQUEST['page']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.refresh":
|
||||
$uiHandler->BROWSE->refresh($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
case "BROWSE.refresh":
|
||||
$uiHandler->BROWSE->refresh($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.setCategory":
|
||||
$uiHandler->BROWSE->setCategory($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->BROWSE->setCategory($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.setValue":
|
||||
$uiHandler->BROWSE->setValue($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->BROWSE->setValue($_REQUEST);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.reorder":
|
||||
$uiHandler->BROWSE->reorder($_REQUEST['by']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->BROWSE->reorder($_REQUEST['by']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.setDefaults":
|
||||
$uiHandler->BROWSE->setDefaults(TRUE);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->BROWSE->setDefaults(TRUE);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.setOffset":
|
||||
$uiHandler->BROWSE->setOffset($_REQUEST['page']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->BROWSE->setOffset($_REQUEST['page']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.setLimit":
|
||||
$uiHandler->BROWSE->setLimit($_REQUEST['limit']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->BROWSE->setLimit($_REQUEST['limit']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "BROWSE.setFiletype":
|
||||
$uiHandler->BROWSE->setFiletype($_REQUEST['filetype']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->BROWSE->setFiletype($_REQUEST['filetype']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "BROWSE";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "HUBBROWSE.setCategory":
|
||||
$uiHandler->HUBBROWSE->setCategory($_REQUEST);
|
||||
break;
|
||||
$uiHandler->HUBBROWSE->setCategory($_REQUEST);
|
||||
break;
|
||||
|
||||
case "HUBBROWSE.setValue":
|
||||
$uiHandler->HUBBROWSE->setValue($_REQUEST);
|
||||
break;
|
||||
$uiHandler->HUBBROWSE->setValue($_REQUEST);
|
||||
break;
|
||||
|
||||
case "HUBBROWSE.reorder":
|
||||
$uiHandler->HUBBROWSE->reorder($_REQUEST['by']);
|
||||
break;
|
||||
$uiHandler->HUBBROWSE->reorder($_REQUEST['by']);
|
||||
break;
|
||||
|
||||
case "HUBBROWSE.setDefaults":
|
||||
$uiHandler->HUBBROWSE->setDefaults(TRUE);
|
||||
break;
|
||||
$uiHandler->HUBBROWSE->setDefaults(TRUE);
|
||||
break;
|
||||
|
||||
case "HUBBROWSE.setOffset":
|
||||
$uiHandler->HUBBROWSE->setOffset($_REQUEST['page']);
|
||||
break;
|
||||
$uiHandler->HUBBROWSE->setOffset($_REQUEST['page']);
|
||||
break;
|
||||
|
||||
case "HUBBROWSE.setLimit":
|
||||
$uiHandler->HUBBROWSE->setLimit($_REQUEST['limit']);
|
||||
break;
|
||||
$uiHandler->HUBBROWSE->setLimit($_REQUEST['limit']);
|
||||
break;
|
||||
|
||||
case "HUBBROWSE.setFiletype":
|
||||
$uiHandler->HUBBROWSE->setFiletype($_REQUEST['filetype']);
|
||||
break;
|
||||
$uiHandler->HUBBROWSE->setFiletype($_REQUEST['filetype']);
|
||||
break;
|
||||
|
||||
case "HUBSEARCH.newSearch":
|
||||
$uiHandler->HUBSEARCH->newSearch($_REQUEST);
|
||||
break;
|
||||
$uiHandler->HUBSEARCH->newSearch($_REQUEST);
|
||||
break;
|
||||
|
||||
case "HUBSEARCH.reorder":
|
||||
$uiHandler->HUBSEARCH->reorder($_REQUEST['by']);
|
||||
break;
|
||||
$uiHandler->HUBSEARCH->reorder($_REQUEST['by']);
|
||||
break;
|
||||
|
||||
case "HUBSEARCH.clear":
|
||||
$uiHandler->HUBSEARCH->clear();
|
||||
break;
|
||||
$uiHandler->HUBSEARCH->clear();
|
||||
break;
|
||||
|
||||
case "HUBSEARCH.setOffset":
|
||||
$uiHandler->HUBSEARCH->setOffset($_REQUEST['page']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "HUBSEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->HUBSEARCH->setOffset($_REQUEST['page']);
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "HUBSEARCH";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "TRANSFERS.reorder":
|
||||
$uiHandler->TRANSFERS->reorder($_REQUEST['by']);
|
||||
break;
|
||||
$uiHandler->TRANSFERS->reorder($_REQUEST['by']);
|
||||
break;
|
||||
|
||||
case "TRANSFERS.setOffset":
|
||||
$uiHandler->TRANSFERS->setOffset($_REQUEST['page']);
|
||||
break;
|
||||
$uiHandler->TRANSFERS->setOffset($_REQUEST['page']);
|
||||
break;
|
||||
|
||||
case "TR.pause":
|
||||
case "TR.resume":
|
||||
case "TR.cancel":
|
||||
$ids = '';
|
||||
if (is_array($_REQUEST['id'])) {
|
||||
foreach ($_REQUEST['id'] as $id) {
|
||||
$ids .= '&id[]='.$id;
|
||||
}
|
||||
} else {
|
||||
$ids = '&id='.$_REQUEST['id'];
|
||||
}
|
||||
//echo '<XMP>_REQUEST:'; print_r($_REQUEST); echo "</XMP>\n";
|
||||
$uiHandler->redirUrl = UI_BROWSER."?popup[]={$_REQUEST['act']}{$ids}";
|
||||
break;
|
||||
$ids = '';
|
||||
if (is_array($_REQUEST['id'])) {
|
||||
foreach ($_REQUEST['id'] as $id) {
|
||||
$ids .= '&id[]='.$id;
|
||||
}
|
||||
} else {
|
||||
$ids = '&id='.$_REQUEST['id'];
|
||||
}
|
||||
//echo '<XMP>_REQUEST:'; print_r($_REQUEST); echo "</XMP>\n";
|
||||
$uiHandler->redirUrl = UI_BROWSER."?popup[]={$_REQUEST['act']}{$ids}";
|
||||
break;
|
||||
|
||||
case "TR.cancelConfirm":
|
||||
//echo '<XMP>_REQUEST:'; print_r($_REQUEST); echo "</XMP>\n";
|
||||
$uiHandler->TRANSFERS->doTransportAction($_REQUEST['id'],'cancel');
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
break;
|
||||
//echo '<XMP>_REQUEST:'; print_r($_REQUEST); echo "</XMP>\n";
|
||||
$uiHandler->TRANSFERS->doTransportAction($_REQUEST['id'],'cancel');
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
break;
|
||||
|
||||
case "PL.activate":
|
||||
if ($uiHandler->PLAYLIST->activate($_REQUEST['id']) === TRUE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id'], 'playlist');
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.create":
|
||||
//$ids = (isset($_REQUEST['id']) ? $_REQUEST['id'] : null);
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->create()) !== FALSE) {
|
||||
if ($ids) {
|
||||
//$uiHandler->SCRATCHPAD->addItem($ids);
|
||||
}
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid, 'playlist');
|
||||
}
|
||||
$uiHandler->PLAYLIST->setRedirect('_2PL.editMetaData');
|
||||
break;
|
||||
|
||||
case "PL.addItem":
|
||||
if (isset($_REQUEST['id'])) {
|
||||
if ($uiHandler->PLAYLIST->addItem($_REQUEST['id']) === TRUE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
}
|
||||
if ($uiHandler->PLAYLIST->activate($_REQUEST['id']) === TRUE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id'], 'playlist');
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
|
||||
case "PL.create":
|
||||
//$ids = (isset($_REQUEST['id']) ? $_REQUEST['id'] : null);
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->create()) !== FALSE) {
|
||||
if ($ids) {
|
||||
//$uiHandler->SCRATCHPAD->addItem($ids);
|
||||
}
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid, 'playlist');
|
||||
}
|
||||
$uiHandler->PLAYLIST->setRedirect('_2PL.editMetaData');
|
||||
break;
|
||||
|
||||
case "PL.addItem":
|
||||
if (isset($_REQUEST['id'])) {
|
||||
if ($uiHandler->PLAYLIST->addItem($_REQUEST['id']) === TRUE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
}
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "SPL.addItem":
|
||||
if (isset($_REQUEST['id'])) {
|
||||
if ($uiHandler->PLAYLIST->addItem($_REQUEST['id']) === TRUE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
}
|
||||
if ($uiHandler->PLAYLIST->addItem($_REQUEST['id']) === TRUE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
}
|
||||
}
|
||||
die('{"jsonrpc" : "2.0"}');
|
||||
|
||||
case "PL.setClipLength":
|
||||
$uiHandler->PLAYLIST->setClipLength($_REQUEST['pos'], $_REQUEST['cueIn'], $_REQUEST['cueOut']);
|
||||
break;
|
||||
|
||||
case "PL.setFadeLength":
|
||||
$uiHandler->PLAYLIST->setFadeLength($_REQUEST['pos'], $_REQUEST['fadeIn'], $_REQUEST['fadeOut']);
|
||||
break;
|
||||
case "PL.setClipLength":
|
||||
$uiHandler->PLAYLIST->setClipLength($_REQUEST['pos'], $_REQUEST['cueIn'], $_REQUEST['cueOut']);
|
||||
break;
|
||||
|
||||
case "PL.setFadeLength":
|
||||
$uiHandler->PLAYLIST->setFadeLength($_REQUEST['pos'], $_REQUEST['fadeIn'], $_REQUEST['fadeOut']);
|
||||
break;
|
||||
|
||||
case "PL.removeItem":
|
||||
$uiHandler->PLAYLIST->removeItem($_REQUEST['id']);
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
$uiHandler->PLAYLIST->removeItem($_REQUEST['id']);
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.release":
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.save":
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->save()) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->save()) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.revert":
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->revert()) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->revert()) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.revertANDclose":
|
||||
$uiHandler->PLAYLIST->revert();
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
$uiHandler->PLAYLIST->revert();
|
||||
$uiHandler->PLAYLIST->release();
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case"PL.unlook":
|
||||
$uiHandler->PLAYLIST->loadLookedFromPref();
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
$uiHandler->PLAYLIST->loadLookedFromPref();
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.changeTransition":
|
||||
$uiHandler->PLAYLIST->changeTransition($_REQUEST['id'], $_REQUEST['type'], $_REQUEST['duration']);
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
$uiHandler->PLAYLIST->changeTransition($_REQUEST['id'], $_REQUEST['type'], $_REQUEST['duration']);
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.moveItem":
|
||||
$uiHandler->PLAYLIST->moveItem($_REQUEST['oldPos'], $_REQUEST['newPos']);
|
||||
break;
|
||||
$uiHandler->PLAYLIST->moveItem($_REQUEST['oldPos'], $_REQUEST['newPos']);
|
||||
break;
|
||||
|
||||
case "PL.reorder":
|
||||
$uiHandler->PLAYLIST->reorder($_REQUEST['pl_items']);
|
||||
$uiHandler->PLAYLIST->setReturn();
|
||||
break;
|
||||
$uiHandler->PLAYLIST->reorder($_REQUEST['pl_items']);
|
||||
$uiHandler->PLAYLIST->setReturn();
|
||||
break;
|
||||
|
||||
case "PL.reArrange":
|
||||
$uiHandler->PLAYLIST->reorder($_REQUEST['pl_items']);
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
$uiHandler->PLAYLIST->reorder($_REQUEST['pl_items']);
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.editMetaData":
|
||||
$uiHandler->PLAYLIST->editMetaData($_REQUEST);
|
||||
//$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
break;
|
||||
$uiHandler->PLAYLIST->editMetaData($_REQUEST);
|
||||
//$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
break;
|
||||
|
||||
case "PL.deleteActive":
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->deleteActive()) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->removeItems($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.delete":
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->delete($_REQUEST['id'])) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->removeItems($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->deleteActive()) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->removeItems($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.delete":
|
||||
if (($ui_tmpid = $uiHandler->PLAYLIST->delete($_REQUEST['id'])) !== FALSE) {
|
||||
$uiHandler->SCRATCHPAD->removeItems($ui_tmpid);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setReload();
|
||||
break;
|
||||
|
||||
case "PL.export":
|
||||
$uiHandler->redirUrl = UI_BROWSER."?popup[]=PL.redirect2DownloadExportedFile&id={$_REQUEST['id']}&playlisttype={$_REQUEST['playlisttype']}&exporttype={$_REQUEST['exporttype']}";
|
||||
break;
|
||||
$uiHandler->redirUrl = UI_BROWSER."?popup[]=PL.redirect2DownloadExportedFile&id={$_REQUEST['id']}&playlisttype={$_REQUEST['playlisttype']}&exporttype={$_REQUEST['exporttype']}";
|
||||
break;
|
||||
|
||||
case "PL.import":
|
||||
//echo '_FILES:'; print_r($_FILES);
|
||||
$importedPlaylist = $uiHandler->gb->importPlaylistOpen($uiHandler->sessid);
|
||||
//echo 'importPlaylistOpen:'; print_r($importedPlaylist);
|
||||
copy($_FILES['playlist']['tmp_name'],$importedPlaylist['fname']);
|
||||
$uiHandler->gb->importPlaylistClose($importedPlaylist['token']);
|
||||
$uiHandler->redirUrl = UI_BROWSER."?act=PL.import";
|
||||
break;
|
||||
//echo '_FILES:'; print_r($_FILES);
|
||||
$importedPlaylist = $uiHandler->gb->importPlaylistOpen($uiHandler->sessid);
|
||||
//echo 'importPlaylistOpen:'; print_r($importedPlaylist);
|
||||
copy($_FILES['playlist']['tmp_name'],$importedPlaylist['fname']);
|
||||
$uiHandler->gb->importPlaylistClose($importedPlaylist['token']);
|
||||
$uiHandler->redirUrl = UI_BROWSER."?act=PL.import";
|
||||
break;
|
||||
|
||||
case "SCHEDULER.set":
|
||||
$uiHandler->SCHEDULER->set($_REQUEST);
|
||||
//$uiHandler->SCHEDULER->setReload();
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SCHEDULER";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$uiHandler->SCHEDULER->set($_REQUEST);
|
||||
//$uiHandler->SCHEDULER->setReload();
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SCHEDULER";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "SCHEDULER.setScheduleAtTime":
|
||||
$uiHandler->SCHEDULER->setScheduleAtTime($_REQUEST);
|
||||
$uiHandler->SCHEDULER->setClose();
|
||||
break;
|
||||
$uiHandler->SCHEDULER->setScheduleAtTime($_REQUEST);
|
||||
$uiHandler->SCHEDULER->setClose();
|
||||
break;
|
||||
|
||||
case "SCHEDULER.addItem":
|
||||
$groupId = $uiHandler->SCHEDULER->addItem($_REQUEST);
|
||||
if (PEAR::isError($groupId) && $groupId->getCode() == 555) {
|
||||
$Smarty->assign("USER_ERROR", "Scheduling conflict.");
|
||||
}
|
||||
$groupId = $uiHandler->SCHEDULER->addItem($_REQUEST);
|
||||
if (PEAR::isError($groupId) && $groupId->getCode() == 555) {
|
||||
$Smarty->assign("USER_ERROR", "Scheduling conflict.");
|
||||
}
|
||||
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SCHEDULER";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
$NO_REDIRECT = true;
|
||||
$_REQUEST["act"] = "SCHEDULER";
|
||||
include("ui_browser.php");
|
||||
break;
|
||||
|
||||
case "SCHEDULER.removeItem":
|
||||
$uiHandler->SCHEDULER->removeFromScheduleMethod($_REQUEST['scheduleId']);
|
||||
$uiHandler->SCHEDULER->setReload();
|
||||
break;
|
||||
$uiHandler->SCHEDULER->removeFromScheduleMethod($_REQUEST['scheduleId']);
|
||||
$uiHandler->SCHEDULER->setReload();
|
||||
break;
|
||||
|
||||
case "SCHEDULER.startDaemon":
|
||||
$uiHandler->SCHEDULER->startDaemon(TRUE);
|
||||
$uiHandler->SCHEDULER->setReload();
|
||||
break;
|
||||
$uiHandler->SCHEDULER->startDaemon(TRUE);
|
||||
$uiHandler->SCHEDULER->setReload();
|
||||
break;
|
||||
|
||||
case "SCHEDULER.stopDaemon":
|
||||
$uiHandler->SCHEDULER->stopDaemon(TRUE);
|
||||
$uiHandler->SCHEDULER->setReload();
|
||||
break;
|
||||
$uiHandler->SCHEDULER->stopDaemon(TRUE);
|
||||
$uiHandler->SCHEDULER->setReload();
|
||||
break;
|
||||
|
||||
case 'SCHEDULER.scheduleExportOpen':
|
||||
// Make sure days are always 2 digits.
|
||||
$_REQUEST['fromDay'] = (strlen($_REQUEST['fromDay'])>1)?$_REQUEST['fromDay']:'0'.$_REQUEST['fromDay'];
|
||||
$_REQUEST['toDay'] = (strlen($_REQUEST['toDay'])>1)?$_REQUEST['toDay']:'0'.$_REQUEST['toDay'];
|
||||
$_REQUEST['fromDay'] = (strlen($_REQUEST['fromDay'])>1)?$_REQUEST['fromDay']:'0'.$_REQUEST['fromDay'];
|
||||
$_REQUEST['toDay'] = (strlen($_REQUEST['toDay'])>1)?$_REQUEST['toDay']:'0'.$_REQUEST['toDay'];
|
||||
|
||||
$fromTime = $_REQUEST['fromYear'].'-'.$_REQUEST['fromMonth'].'-'.$_REQUEST['fromDay'].' '
|
||||
.$_REQUEST['fromHour'].':'.$_REQUEST['fromMinute'].':00';
|
||||
$toTime = $_REQUEST['toYear'].'-'.$_REQUEST['toMonth'].'-'.$_REQUEST['toDay'].' '
|
||||
.$_REQUEST['toHour'].':'.$_REQUEST['toMinute'].':00';
|
||||
//echo '<XMP style="background:yellow;">';echo "fromTime:$fromTime | toTime:$toTime";echo'</XMP>'."\n";
|
||||
$uiHandler->SCHEDULER->scheduleExportOpen($fromTime, $toTime);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=SCHEDULER';
|
||||
break;
|
||||
$fromTime = $_REQUEST['fromYear'].'-'.$_REQUEST['fromMonth'].'-'.$_REQUEST['fromDay'].' '
|
||||
.$_REQUEST['fromHour'].':'.$_REQUEST['fromMinute'].':00';
|
||||
$toTime = $_REQUEST['toYear'].'-'.$_REQUEST['toMonth'].'-'.$_REQUEST['toDay'].' '
|
||||
.$_REQUEST['toHour'].':'.$_REQUEST['toMinute'].':00';
|
||||
//echo '<XMP style="background:yellow;">';echo "fromTime:$fromTime | toTime:$toTime";echo'</XMP>'."\n";
|
||||
$uiHandler->SCHEDULER->scheduleExportOpen($fromTime, $toTime);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=SCHEDULER';
|
||||
break;
|
||||
|
||||
case 'SCHEDULER.setImportFile':
|
||||
$uiHandler->SCHEDULER->scheduleImportOpen($_REQUEST['target']);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=SCHEDULER';
|
||||
break;
|
||||
$uiHandler->SCHEDULER->scheduleImportOpen($_REQUEST['target']);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=SCHEDULER';
|
||||
break;
|
||||
|
||||
case 'BACKUP.createBackupOpen':
|
||||
$uiHandler->EXCHANGE->createBackupOpen();
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=BACKUP';
|
||||
break;
|
||||
$uiHandler->EXCHANGE->createBackupOpen();
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=BACKUP';
|
||||
break;
|
||||
|
||||
case 'BACKUP.copy2target':
|
||||
$uiHandler->EXCHANGE->copy2target($_REQUEST['target']);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=BACKUP';
|
||||
break;
|
||||
$uiHandler->EXCHANGE->copy2target($_REQUEST['target']);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=BACKUP';
|
||||
break;
|
||||
|
||||
case 'BACKUP.createBackupClose':
|
||||
$uiHandler->EXCHANGE->createBackupClose();
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=BACKUP';
|
||||
break;
|
||||
$uiHandler->EXCHANGE->createBackupClose();
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=BACKUP';
|
||||
break;
|
||||
|
||||
case 'RESTORE.setBackupFileToRestore':
|
||||
$uiHandler->EXCHANGE->backupRestoreOpen($_REQUEST['target']);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=RESTORE';
|
||||
break;
|
||||
$uiHandler->EXCHANGE->backupRestoreOpen($_REQUEST['target']);
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=RESTORE';
|
||||
break;
|
||||
|
||||
case 'RESTORE.backupRestoreClose':
|
||||
$uiHandler->EXCHANGE->backupRestoreClose();
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=RESTORE';
|
||||
break;
|
||||
$uiHandler->EXCHANGE->backupRestoreClose();
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=RESTORE';
|
||||
break;
|
||||
|
||||
case 'SESSION.CLEAR':
|
||||
$_SESSION = array();
|
||||
die();
|
||||
break;
|
||||
$_SESSION = array();
|
||||
die();
|
||||
break;
|
||||
|
||||
case 'twitter.saveSettings':
|
||||
case 'twitter.saveSettings':
|
||||
$uiHandler->TWITTER->saveSettings();
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?act=twitter.settings';
|
||||
break;
|
||||
break;
|
||||
|
||||
case NULL:
|
||||
if ($uiHandler->userid) {
|
||||
$uiHandler->_retMsg('The uploaded file is bigger than allowed in system settings. See "Help", chapter "Troubleshooting" for more information.');
|
||||
}
|
||||
$uiHandler->redirUrl = UI_BROWSER;
|
||||
if ($_REQUEST['is_popup']) {
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
}
|
||||
break;
|
||||
if ($uiHandler->userid) {
|
||||
$uiHandler->_retMsg('The uploaded file is bigger than allowed in system settings. See "Help", chapter "Troubleshooting" for more information.');
|
||||
}
|
||||
$uiHandler->redirUrl = UI_BROWSER;
|
||||
if ($_REQUEST['is_popup']) {
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$uiHandler->_retMsg(tra('Unknown method: $1', $_REQUEST['act']));
|
||||
$uiHandler->redirUrl = UI_BROWSER;
|
||||
if ($_REQUEST['is_popup']) {
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
}
|
||||
//break;
|
||||
$uiHandler->_retMsg(tra('Unknown method: $1', $_REQUEST['act']));
|
||||
$uiHandler->redirUrl = UI_BROWSER;
|
||||
if ($_REQUEST['is_popup']) {
|
||||
$uiHandler->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
}
|
||||
//break;
|
||||
}
|
||||
|
||||
|
||||
|
@ -544,9 +544,9 @@ if ($uiHandler->alertMsg) {
|
|||
ob_end_flush();
|
||||
if (!isset($NO_REDIRECT)) {
|
||||
if (isset($_REQUEST['target'])) {
|
||||
header('Location: ui_browser.php?act='.$_REQUEST['target']);
|
||||
header('Location: ui_browser.php?act='.$_REQUEST['target']);
|
||||
} else {
|
||||
header("Location: ".$uiHandler->redirUrl);
|
||||
header("Location: ".$uiHandler->redirUrl);
|
||||
}
|
||||
}
|
||||
exit;
|
||||
|
|
|
@ -8,15 +8,15 @@ require_once(dirname(__FILE__)."/../backend/Playlist.php");
|
|||
*/
|
||||
class uiPlaylist
|
||||
{
|
||||
public $activeId;
|
||||
public $title;
|
||||
public $duration;
|
||||
public $activeId;
|
||||
public $title;
|
||||
public $duration;
|
||||
|
||||
private $Base;
|
||||
private $reloadUrl;
|
||||
private $redirectUrl;
|
||||
private $returnUrl;
|
||||
private $flat;
|
||||
private $Base;
|
||||
private $reloadUrl;
|
||||
private $redirectUrl;
|
||||
private $returnUrl;
|
||||
private $flat;
|
||||
|
||||
public function __construct($uiBase)
|
||||
{
|
||||
|
@ -32,11 +32,11 @@ class uiPlaylist
|
|||
|
||||
public function setReload($url=NULL)
|
||||
{
|
||||
if($url)
|
||||
$this->Base->redirUrl = $url;
|
||||
else
|
||||
if($url) {
|
||||
$this->Base->redirUrl = $url;
|
||||
} else {
|
||||
$this->Base->redirUrl = $this->reloadUrl;
|
||||
|
||||
}
|
||||
} // fn setReload
|
||||
|
||||
|
||||
|
@ -94,15 +94,15 @@ class uiPlaylist
|
|||
|
||||
$userid = $this->Base->gb->playlistIsAvailable($plid, $this->Base->sessid);
|
||||
if ($userid !== TRUE) {
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('Playlist has been locked by "$1".', Subjects::GetSubjName($userid));
|
||||
}
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('Playlist has been locked by "$1".', Subjects::GetSubjName($userid));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
$res = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
|
||||
if (PEAR::isError($res) || $res === FALSE) {
|
||||
if (UI_VERBOSE === TRUE) {
|
||||
print_r($res);
|
||||
print_r($res);
|
||||
}
|
||||
$this->Base->_retMsg('Unable to open playlist "$1".', $this->Base->getMetadataValue($plid, UI_MDATA_KEY_TITLE));
|
||||
return FALSE;
|
||||
|
@ -112,7 +112,7 @@ class uiPlaylist
|
|||
$this->activeId = $plid;
|
||||
|
||||
if ($msg && UI_VERBOSE) {
|
||||
$this->Base->_retMsg('Playlist "$1" opened.', $this->Base->getMetadataValue($plid, UI_MDATA_KEY_TITLE));
|
||||
$this->Base->_retMsg('Playlist "$1" opened.', $this->Base->getMetadataValue($plid, UI_MDATA_KEY_TITLE));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -125,17 +125,17 @@ class uiPlaylist
|
|||
// delete PL from session
|
||||
if (!$this->activeId) {
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('There is no playlist available to unlock.');
|
||||
$this->Base->_retMsg('There is no playlist available to unlock.');
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
$res = $this->Base->gb->releaseLockedPlaylist($this->activeId, $this->Base->sessid);
|
||||
if (PEAR::isError($res) || $res === FALSE) {
|
||||
if (UI_VERBOSE === TRUE) {
|
||||
print_r($res);
|
||||
print_r($res);
|
||||
}
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('Unable to release playlist.');
|
||||
$this->Base->_retMsg('Unable to release playlist.');
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ class uiPlaylist
|
|||
{
|
||||
if (is_string($this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
|
||||
if ($setMsg == TRUE) {
|
||||
$this->Base->_retMsg('Found locked playlist.');
|
||||
$this->Base->_retMsg('Found locked playlist.');
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -194,15 +194,15 @@ class uiPlaylist
|
|||
$cueIn = NULL;
|
||||
|
||||
/*
|
||||
gstreamer bug:
|
||||
Warning: The clipEnd can't be bigger than ninety nine percent (99%) of the clipLength,
|
||||
this means also if no clipEnd is defined it should be 00:00:00.000000 and not the clipLength.
|
||||
$clipend = '00:00:00.000000';
|
||||
*/
|
||||
gstreamer bug:
|
||||
Warning: The clipEnd can't be bigger than ninety nine percent (99%) of the clipLength,
|
||||
this means also if no clipEnd is defined it should be 00:00:00.000000 and not the clipLength.
|
||||
$clipend = '00:00:00.000000';
|
||||
*/
|
||||
|
||||
if (!$elemIds) {
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ class uiPlaylist
|
|||
$r = $this->Base->gb->addAudioClipToPlaylist($this->activeId, $elemId, $pos, $fadeIn, $fadeOut, $cliplength, $cueIn, $cueOut);
|
||||
if (PEAR::isError($r)) {
|
||||
if (UI_VERBOSE === TRUE) {
|
||||
print_r($r);
|
||||
print_r($r);
|
||||
}
|
||||
$this->Base->_retMsg('Error while trying to add item to playlist.');
|
||||
return FALSE;
|
||||
|
@ -234,12 +234,12 @@ class uiPlaylist
|
|||
{
|
||||
if (!$positions) {
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
if (!is_array($positions))
|
||||
$positions = array($positions);
|
||||
$positions = array($positions);
|
||||
|
||||
//so the automatic updating of playlist positioning doesn't affect removal.
|
||||
sort($positions);
|
||||
|
@ -312,7 +312,7 @@ class uiPlaylist
|
|||
$response["newPos"] = $newPos;
|
||||
}
|
||||
else{
|
||||
$response["error"] = FALSE;
|
||||
$response["error"] = FALSE;
|
||||
}
|
||||
|
||||
die(json_encode($response));
|
||||
|
@ -364,7 +364,7 @@ class uiPlaylist
|
|||
$form->setConstants(array('act' => 'PL.editMetaData',
|
||||
'id' => $id,
|
||||
'curr_langid' => $langid
|
||||
)
|
||||
)
|
||||
);
|
||||
$renderer = new HTML_QuickForm_Renderer_Array(true, true);
|
||||
$form->accept($renderer);
|
||||
|
@ -402,20 +402,20 @@ class uiPlaylist
|
|||
}
|
||||
|
||||
if (!count($mData)) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($mData as $key => $val) {
|
||||
$r = $this->Base->gb->setPLMetadataValue($id, $key, $val, $curr_langid);
|
||||
if (PEAR::isError($r)) {
|
||||
if (UI_VERBOSE === TRUE) {
|
||||
print_r($r);
|
||||
print_r($r);
|
||||
}
|
||||
$this->Base->_retMsg('Unable to set "$1" to value "$2".', $key, $val);
|
||||
}
|
||||
}
|
||||
if (UI_VERBOSE) {
|
||||
$this->Base->_retMsg('Metadata saved.');
|
||||
$this->Base->_retMsg('Metadata saved.');
|
||||
}
|
||||
|
||||
$this->Base->SCRATCHPAD->reloadMetadata();
|
||||
|
@ -459,7 +459,7 @@ class uiPlaylist
|
|||
function isUsedBy($id)
|
||||
{
|
||||
if (($userid = $this->Base->gb->playlistIsAvailable($id, $this->Base->sessid)) !== TRUE) {
|
||||
return Subjects::GetSubjName($userid);
|
||||
return Subjects::GetSubjName($userid);
|
||||
}
|
||||
return FALSE;
|
||||
} // fn isUsedBy
|
||||
|
|
|
@ -1,36 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
|
||||
|
||||
* @package Campcaster
|
||||
* @subpackage htmlUI
|
||||
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
|
||||
*/
|
||||
* @package Campcaster
|
||||
* @subpackage htmlUI
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
*/
|
||||
class uiScratchPad
|
||||
{
|
||||
/**
|
||||
* @var uiBase
|
||||
*/
|
||||
private $Base;
|
||||
/**
|
||||
* @var uiBase
|
||||
*/
|
||||
private $Base;
|
||||
|
||||
/**
|
||||
* The contents of the scratchpad.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $items;
|
||||
/**
|
||||
* The contents of the scratchpad.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $items;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $order;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $order;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $reloadUrl;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $reloadUrl;
|
||||
|
||||
public function __construct(&$uiBase)
|
||||
{
|
||||
|
@ -77,7 +73,7 @@ class uiScratchPad
|
|||
// get the scratchpad list
|
||||
$arr = explode(' ', $spData);
|
||||
$maxLength = $this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY];
|
||||
$arr = array_slice($arr, 0, $maxLength);
|
||||
$arr = array_slice($arr, 0, $maxLength);
|
||||
foreach ($arr as $item) {
|
||||
//for audiofiles.
|
||||
list($type, $savedId) = explode(":", $item);
|
||||
|
@ -91,8 +87,8 @@ class uiScratchPad
|
|||
else {
|
||||
$gunid = $savedId;
|
||||
if (preg_match('/[0-9]{1,20}/', $gunid)) {
|
||||
$f = StoredFile::RecallByGunid($gunid);
|
||||
//$id = BasicStor::IdFromGunid($this->Base->toHex($gunid));
|
||||
$f = StoredFile::RecallByGunid($gunid);
|
||||
//$id = BasicStor::IdFromGunid($this->Base->toHex($gunid));
|
||||
if (!PEAR::isError($f)) {
|
||||
if ($i = $this->Base->getMetaInfo($f->getId())) {
|
||||
$this->items[] = $i;
|
||||
|
@ -134,13 +130,13 @@ class uiScratchPad
|
|||
{
|
||||
if (!$this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]) {
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('The scratchpad length is not set in system preferences, so it cannot be used.');
|
||||
$this->Base->_retMsg('The scratchpad length is not set in system preferences, so it cannot be used.');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!$ids) {
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -150,16 +146,17 @@ class uiScratchPad
|
|||
|
||||
$scratchpad = $this->get();
|
||||
foreach ($ids as $id) {
|
||||
if($type === 'playlist')
|
||||
if($type === 'playlist') {
|
||||
$item = $this->Base->getPLMetaInfo($id);
|
||||
else
|
||||
} else {
|
||||
$item = $this->Base->getMetaInfo($id);
|
||||
}
|
||||
|
||||
foreach ($scratchpad as $key => $val) {
|
||||
if ($val['id'] == $item['id']) {
|
||||
unset($scratchpad[$key]);
|
||||
if (UI_VERBOSE) {
|
||||
$this->Base->_retMsg('Entry $1 is already on the scratchpad. It has been moved to the top of the list.', $item['title'], $val['added']);
|
||||
$this->Base->_retMsg('Entry $1 is already on the scratchpad. It has been moved to the top of the list.', $item['title'], $val['added']);
|
||||
}
|
||||
} else {
|
||||
#$this->Base->incAccessCounter($id);
|
||||
|
@ -170,11 +167,11 @@ class uiScratchPad
|
|||
|
||||
$maxScratchpadLength = $this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY];
|
||||
for ($n = 0; $n < $maxScratchpadLength; $n++) {
|
||||
if (!isset($scratchpad[$n])) {
|
||||
break;
|
||||
}
|
||||
if (!isset($scratchpad[$n])) {
|
||||
break;
|
||||
}
|
||||
if (is_array($scratchpad[$n])) {
|
||||
$this->items[$n] = $scratchpad[$n];
|
||||
$this->items[$n] = $scratchpad[$n];
|
||||
}
|
||||
}
|
||||
ksort($this->items);
|
||||
|
@ -192,7 +189,7 @@ class uiScratchPad
|
|||
{
|
||||
if (!$ids) {
|
||||
if (UI_WARNING) {
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
$this->Base->_retMsg('No item(s) selected.');
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -232,17 +229,17 @@ class uiScratchPad
|
|||
$curr = $this->order[$by];
|
||||
$this->order = array();
|
||||
if (is_null($curr) || $curr=='DESC') {
|
||||
$this->order[$by] = 'ASC';
|
||||
$this->order[$by] = 'ASC';
|
||||
} else {
|
||||
$this->order[$by] = 'DESC';
|
||||
$this->order[$by] = 'DESC';
|
||||
}
|
||||
switch ($this->order[$by]) {
|
||||
case "ASC":
|
||||
asort($s);
|
||||
break;
|
||||
asort($s);
|
||||
break;
|
||||
case "DESC":
|
||||
arsort($s);
|
||||
break;
|
||||
arsort($s);
|
||||
break;
|
||||
}
|
||||
foreach ($s as $key=>$val) {
|
||||
$res[] = $this->items[$key];
|
||||
|
@ -259,10 +256,11 @@ class uiScratchPad
|
|||
public function reloadMetadata()
|
||||
{
|
||||
foreach ($this->items as $key => $val) {
|
||||
if($val['type'] === 'playlist')
|
||||
if ($val['type'] === 'playlist') {
|
||||
$this->items[$key] = $this->Base->getPLMetaInfo($val['id']);
|
||||
else
|
||||
} else {
|
||||
$this->items[$key] = $this->Base->getMetaInfo($val['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,4 +275,4 @@ class uiScratchPad
|
|||
}
|
||||
|
||||
} // class uiScratchPad
|
||||
?>
|
||||
?>
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
class uiSubjects
|
||||
{
|
||||
public $Base;
|
||||
private $reloadUrl;
|
||||
private $suRedirUrl;
|
||||
private $redirUrl;
|
||||
public $Base;
|
||||
private $reloadUrl;
|
||||
private $suRedirUrl;
|
||||
private $redirUrl;
|
||||
|
||||
public function __construct(&$uiBase)
|
||||
{
|
||||
|
@ -22,19 +22,19 @@ class uiSubjects
|
|||
|
||||
public function setReload()
|
||||
{
|
||||
$this->Base->redirUrl = $this->reloadUrl;
|
||||
$this->Base->redirUrl = $this->reloadUrl;
|
||||
}
|
||||
|
||||
|
||||
public function setSuRedir()
|
||||
{
|
||||
$this->Base->redirUrl = $this->suRedirUrl;
|
||||
$this->Base->redirUrl = $this->suRedirUrl;
|
||||
}
|
||||
|
||||
|
||||
public function setRedir()
|
||||
{
|
||||
$this->Base->redirUrl = $this->redirUrl;
|
||||
$this->Base->redirUrl = $this->redirUrl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,15 +62,15 @@ class uiSubjects
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new user or group (empty password => create group).
|
||||
*
|
||||
* @param array $request
|
||||
* Must have keys -> value:
|
||||
* login - string
|
||||
* passwd - string
|
||||
* @return string
|
||||
*/
|
||||
/**
|
||||
* Create a new user or group (empty password => create group).
|
||||
*
|
||||
* @param array $request
|
||||
* Must have keys -> value:
|
||||
* login - string
|
||||
* passwd - string
|
||||
* @return string
|
||||
*/
|
||||
public function addSubj($request)
|
||||
{
|
||||
include(dirname(__FILE__). '/formmask/subjects.inc.php');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue