diff --git a/application/configs/conf.php b/application/configs/conf.php index 98abc5e24..f43dde788 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -1,41 +1,56 @@ $values['database'], + + // Set the URL of your installation + 'storageUrlHost' => 'localhost', + 'storageUrlPort' => 80, // Name of the web server user 'webServerUser' => 'www-data', +// *********************************************************************** + // STOP CUSTOMIZING HERE + // + // You don't need to touch anything below this point. + // *********************************************************************** + + 'baseFilesDir' => $baseFilesDir, + // main directory for storing binary media files + 'storageDir' => "$baseFilesDir/stor", + + // Database config + 'dsn' => $values['database'], + // prefix for table names in the database 'tblNamePrefix' => 'cc_', /* ================================================ storage configuration */ 'apiKey' => $values['api_key'], - 'apiPath' => '/api/', - 'baseFilesDir' => $baseFilesDir, - // main directory for storing binary media files - 'storageDir' => "$baseFilesDir/stor", - "rootDir" => __DIR__."/../..", 'pearPath' => dirname(__FILE__).'/../../library/pear', 'zendPath' => dirname(__FILE__).'/../../library/Zend', 'phingPath' => dirname(__FILE__).'/../../library/phing', - // secret token cookie name - 'authCookieName'=> 'campcaster_session_id', - // name of admin group //'AdminsGr' => 'Admins', @@ -44,47 +59,6 @@ $CC_CONFIG = array( // name of 'all users' group //'AllGr' => 'All', - 'TrashName' => 'trash_', - - // enable/disable validator - 'validate' => TRUE, - - // enable/disable safe delete (move to trash) - 'useTrash' => FALSE, - - /* ==================================================== URL configuration */ - // path-URL-part of storageServer base dir - 'storageUrlPath' => '/campcaster/backend', - - // XMLRPC server script address relative to storageUrlPath - 'storageXMLRPC' => 'xmlrpc/xrLocStor.php', - - // host and port of storageServer - 'storageUrlHost' => 'localhost', - 'storageUrlPort' => 80, - - /* ================================================ remote link configuration */ - // path-URL-part of remote server base dir - 'archiveUrlPath' => '/campcaster/backend', - - // XMLRPC server script address relative to archiveUrlPath - 'archiveXMLRPC' => 'xmlrpc/xrLocStor.php', - - // host and port of archiveServer - 'archiveUrlHost' => 'localhost', -// 'archiveUrlHost' => '192.168.30.166', - 'archiveUrlPort' => 80, - - // account info for login to archive - 'archiveAccountLogin' => 'root', - 'archiveAccountPass' => 'q', - - /* ============================================== scheduler configuration */ - 'schedulerUrlPath' => '', - 'schedulerXMLRPC' => 'RC2', - 'schedulerUrlHost' => 'localhost', - 'schedulerUrlPort' => 3344, - 'schedulerPass' => 'change_me', /* ==================================== application-specific configuration */ 'objtypes' => array( @@ -92,22 +66,16 @@ $CC_CONFIG = array( 'File' => array(), 'audioclip' => array(), 'playlist' => array(), -// 'Replica' => array(), ), 'allowedActions'=> array( 'File' => array('editPrivs', 'write', 'read'), 'audioclip' => array('editPrivs', 'write', 'read'), 'playlist' => array('editPrivs', 'write', 'read'), -// 'Replica' => array('editPrivs', 'write', 'read'), -// '_class' => array('editPrivs', 'write', 'read'), ), 'allActions' => array( - 'editPrivs', 'write', 'read', /*'classes',*/ 'subjects' + 'editPrivs', 'write', 'read', 'subjects' ), - /* ============================================== auxiliary configuration */ - 'tmpRootPass' => 'q', - /* =================================================== cron configuration */ 'cronUserName' => 'www-data', # 'lockfile' => dirname(__FILE__).'/cron/cron.lock', diff --git a/application/controllers/ApiController.php b/application/controllers/ApiController.php index 22c97fe2e..b173fa563 100644 --- a/application/controllers/ApiController.php +++ b/application/controllers/ApiController.php @@ -31,7 +31,7 @@ class ApiController extends Zend_Controller_Action print 'You are not allowed to access this resource.'; exit; } - $jsonStr = json_encode(array("version"=>CAMPCASTER_VERSION)); + $jsonStr = json_encode(array("version"=>AIRTIME_VERSION)); echo $jsonStr; } diff --git a/application/controllers/LoginController.php b/application/controllers/LoginController.php index df0f0c2d2..3d93fea00 100644 --- a/application/controllers/LoginController.php +++ b/application/controllers/LoginController.php @@ -61,7 +61,8 @@ class LoginController extends Zend_Controller_Action $this->view->message = $message; $this->view->form = $form; - + $this->view->airtimeVersion = AIRTIME_VERSION; + $this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE; } public function logoutAction() diff --git a/application/models/Alib.php b/application/models/Alib.php index 5a465c965..751ab3996 100644 --- a/application/models/Alib.php +++ b/application/models/Alib.php @@ -18,99 +18,6 @@ class Alib { /* ----------------------------------------------- session/authentication */ - /** - * Authenticate and create session - * - * @param string $login - * @param string $pass - * @return boolean|sessionId|PEAR_Error - */ - public static function Login($login, $pass) - { - global $CC_CONFIG, $CC_DBC; - if (FALSE === Subjects::Authenticate($login, $pass)) { - Subjects::SetTimeStamp($login, TRUE); - return FALSE; - } - $sessid = Alib::_createSessid(); - if (PEAR::isError($sessid)) { - return $sessid; - } - $userid = Subjects::GetSubjId($login); - $sql = "INSERT INTO ".$CC_CONFIG['sessTable']." (sessid, userid, login, ts)" - ." VALUES('$sessid', '$userid', '$login', now())"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - Subjects::SetTimeStamp($login, FALSE); - return $sessid; - } // fn login - - - /** - * Logout and destroy session - * - * @param string $sessid - * @return true|PEAR_Error - */ - public static function Logout($sessid) - { - global $CC_CONFIG, $CC_DBC; - $ct = Alib::CheckAuthToken($sessid); - if ($ct === FALSE) { - return PEAR::raiseError("Alib::logout: not logged ($sessid)", - ALIBERR_NOTLOGGED, PEAR_ERROR_RETURN); - } elseif (PEAR::isError($ct)) { - return $ct; - } else { - $sql = "DELETE FROM ".$CC_CONFIG['sessTable'] - ." WHERE sessid='$sessid'"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - } // fn logout - - - /** - * Return true if the token is valid - * - * @param string $sessid - * @return boolean|PEAR_Error - */ - private static function CheckAuthToken($sessid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['sessTable'] - ." WHERE sessid='$sessid'"; - $c = $CC_DBC->getOne($sql); - return ($c == 1 ? TRUE : (PEAR::isError($c) ? $c : FALSE )); - } //fn checkAuthToken - - - /** - * Set valid token in alib object - * - * @param string $sessid - * @return TRUE|PEAR_Error - */ - // public function setAuthToken($sessid) - // { - // $r = $this->checkAuthToken($sessid); - // if (PEAR::isError($r)) { - // return $r; - // } - // if (!$r) { - // return PEAR::raiseError("ALib::setAuthToken: invalid token ($sessid)"); - // } - // //$this->sessid = $sessid; - // return TRUE; - // } // fn setAuthToken - - /* -------------------------------------------------------- authorization */ /** * Insert permission record @@ -172,170 +79,10 @@ class Alib { } // fn removePerm - /** - * Return object related with permission record - * - * @param int $permid - * local permission id - * @return int - * local object id - */ - public static function GetPermOid($permid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT obj FROM ".$CC_CONFIG['permTable']." WHERE permid=$permid"; - $res = $CC_DBC->getOne($sql); - return $res; - } // fn GetPermOid - - - /** - * Check if specified subject have permission to specified action - * on specified object - * - * Look for sequence of corresponding permissions and order it by - * relevence, then test the most relevant for result. - * High relevence have direct permission (directly for specified subject - * and object. Relevance order is done by level distance in the object - * tree, level distance in subjects (user/group system). - * Similar way is used for permissions related to object classes. - * But class-related permissions have lower priority then - * object-tree-related. - * Support for object classes can be disabled by USE_ALIB_CLASSES const. - * - * @param int $sid - * subject id (user or group id) - * @param string $action - * from set defined in config - * @param int $oid - * object id (default: root node) - * @return boolean|PEAR_Error - */ - public static function CheckPerm($sid, $action, $oid=NULL) - { - return TRUE; - // global $CC_DBC; - // global $CC_CONFIG; - // if (!is_numeric($sid)) { - // return FALSE; - // } - //// if (is_null($oid) or $oid=='') { - //// $oid = M2tree::GetRootNode(); - //// } - //// if (PEAR::isError($oid)) { - //// return $oid; - //// } - // if (!is_numeric($oid)) { - // return FALSE; - // } - // // query construction - // // shortcuts: - // // p: permTable, - // // s: subjTable, m smembTable, - // // t: treeTable ts: structTable, - // // c: classTable, cm: cmembTable - // // main query elements: - // $q_flds = "m.level , p.subj, s.login, action, p.type, p.obj"; - // $q_from = $CC_CONFIG['permTable']." p "; - // // joins for solving users/groups: - // $q_join = "LEFT JOIN ".$CC_CONFIG['subjTable']." s ON s.id=p.subj "; - // $q_join .= "LEFT JOIN ".$CC_CONFIG['smembTable']." m ON m.gid=p.subj "; - // $q_cond = "p.action in('_all', '$action') AND - // (s.id=$sid OR m.uid=$sid) "; - // // coalesce -1 for higher priority of nongroup rows: - // // action DESC order for lower priority of '_all': - // $q_ordb = "ORDER BY coalesce(m.level,-1), action DESC, p.type DESC"; - // $q_flds0 = $q_flds; - // $q_from0 = $q_from; - // $q_join0 = $q_join; - // $q_cond0 = $q_cond; - // $q_ordb0 = $q_ordb; - // // joins for solving object tree: - // $q_flds .= ", t.name, ts.level as tlevel"; - // //$q_join .= "LEFT JOIN ".$CC_CONFIG['treeTable']." t ON t.id=p.obj "; - // //$q_join .= "LEFT JOIN ".$CC_CONFIG['structTable']." ts ON ts.parid=p.obj "; - // //$q_cond .= " AND (t.id=$oid OR ts.objid=$oid)"; - // // action DESC order is hack for lower priority of '_all': - // $q_ordb = "ORDER BY coalesce(ts.level,0), m.level, action DESC, p.type DESC"; - // // query by tree: - // $query1 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb"; - // $r1 = $CC_DBC->getAll($query1); - // if (PEAR::isError($r1)) { - // return($r1); - // } - // // if there is row with type='A' on the top => permit - // //$AllowedByTree = - // // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='A'); - // //$DeniedByTree = - // // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='D'); - // - // if (!USE_ALIB_CLASSES) { - // return $AllowedbyTree; - // } - // - // // joins for solving object classes: - // $q_flds = $q_flds0.", c.cname "; - // $q_join = $q_join0."LEFT JOIN ".$CC_CONFIG['classTable']." c ON c.id=p.obj "; - // $q_join .= "LEFT JOIN ".$CC_CONFIG['cmembTable']." cm ON cm.cid=p.obj "; - // $q_cond = $q_cond0." AND (c.id=$oid OR cm.objid=$oid)"; - // $q_ordb = $q_ordb0; - // // query by class: - // $query2 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb"; - // $r2 = $CC_DBC->getAll($query2); - // if (PEAR::isError($r2)) { - // return $r2; - // } - // $AllowedByClass = - // (is_array($r2) && count($r2)>0 && $r2[0]['type']=='A'); - // // not used now: - // // $DeniedByClass = - // // (is_array($r2) && count($r2)>0 && $r2[0]['type']=='D'); - // $res = ($AllowedByTree || (!$DeniedByTree && $AllowedByClass)); - // return $res; - } // fn CheckPerm - - /* ---------------------------------------------------------- object tree */ - /** - * Remove all permissions on object and then remove object itself - * - * @param int $id - * @return void|PEAR_Error - */ - public static function RemoveObj($id) - { - $r = Alib::RemovePerm(NULL, NULL, $id); - return $r; - } // fn removeObj - /* --------------------------------------------------------- users/groups */ - /** - * Remove all permissions of subject and then remove subject itself - * - * @param string $login - * @return void|PEAR_Error - */ - public static function RemoveSubj($login) - { - global $CC_CONFIG, $CC_DBC; - $uid = Subjects::GetSubjId($login); - if (PEAR::isError($uid)) { - return $uid; - } - if (is_null($uid)){ - return $CC_DBC->raiseError("Alib::removeSubj: Subj not found ($login)", - ALIBERR_NOTEXISTS, PEAR_ERROR_RETURN); - } - $r = Alib::RemovePerm(NULL, $uid); - if (PEAR::isError($r)) { - return $r; - } - return Subjects::RemoveSubj($login, $uid); - } // fn RemoveSubj - - /* ------------------------------------------------------------- sessions */ /** * Get login from session id (token) @@ -411,9 +158,6 @@ class Alib { $sql = "SELECT *" ." FROM ".$CC_CONFIG['permTable'] ." WHERE p.subj=$sid"; - // $sql = "SELECT t.name, t.type as otype , p.*" - // ." FROM ".$CC_CONFIG['permTable']." p, ".$CC_CONFIG['treeTable']." t" - // ." WHERE t.id=p.obj AND p.subj=$sid"; $a1 = $CC_DBC->getAll($sql); return $a1; } // fn GetSubjPerms @@ -425,31 +169,6 @@ class Alib { * (only very simple structure definition - in $CC_CONFIG - supported now) */ - /** - * Get all actions - * - * @return array - */ - public static function GetAllActions() - { - global $CC_CONFIG; - return $CC_CONFIG['allActions']; - } // fn GetAllActions - - - /** - * Get all allowed actions on specified object type. - * - * @param string $type - * @return array - */ - public static function GetAllowedActions($type) - { - global $CC_CONFIG; - return $CC_CONFIG['allowedActions'][$type]; - } // fn GetAllowedActions - - /* ====================================================== private methods */ /** @@ -473,149 +192,4 @@ class Alib { } // fn _createSessid - /* =============================================== test and debug methods */ - - /** - * Dump all permissions for debug - * - * @param string $indstr - * indentation string - * @param string $ind - * actual indentation - * @return string - */ - public static function DumpPerms($indstr=' ', $ind='') - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT s.login, p.action, p.type" - ." FROM ".$CC_CONFIG['permTable']." p, ".$CC_CONFIG['subjTable']." s" - ." WHERE s.id=p.subj" - ." ORDER BY p.permid"; - $arr = $CC_DBC->getAll($sql); - if (PEAR::isError($arr)) { - return $arr; - } - $r = $ind.join(', ', array_map(create_function('$v', - 'return "{$v[\'login\']}/{$v[\'action\']}/{$v[\'type\']}";' - ), - $arr - ))."\n"; - return $r; - } // fn dumpPerms - - - /** - * Delete everything form the permission table and session table. - * - * @return void - */ - public static function DeleteData() - { - global $CC_CONFIG, $CC_DBC; - $CC_DBC->query("DELETE FROM ".$CC_CONFIG['permTable']); - $CC_DBC->query("DELETE FROM ".$CC_CONFIG['sessTable']); - Subjects::DeleteData(); - } // fn deleteData - - - /** - * Insert test permissions - * - * @return array - */ - public static function TestData() - { - global $CC_CONFIG, $CC_DBC; - $tdata = Subjects::TestData(); - $t =& $tdata['tree']; - $c =& $tdata['classes']; - $s =& $tdata['subjects']; - $CC_DBC->setErrorHandling(PEAR_ERROR_PRINT); - $perms = array( - array($s['root'], '_all', $t['root'], 'A'), - array($s['test1'], '_all', $t['pa'], 'A'), - array($s['test1'], 'read', $t['s2b'], 'D'), - array($s['test2'], 'addChilds', $t['pa'], 'D'), - array($s['test2'], 'read', $t['i2'], 'A'), - array($s['test2'], 'edit', $t['s1a'], 'A'), - array($s['test1'], 'addChilds', $t['s2a'], 'D'), - array($s['test1'], 'addChilds', $t['s2c'], 'D'), - array($s['gr2'], 'addChilds', $t['i2'], 'A'), - array($s['test3'], '_all', $t['t1'], 'D'), - ); - if (USE_ALIB_CLASSES){ - $perms[] = array($s['test3'], 'read', $c['cl_sa'], 'D'); - $perms[] = array($s['test4'], 'editPerms', $c['cl2'], 'A'); - } - foreach ($perms as $p){ - $o[] = $r = Alib::AddPerm($p[0], $p[1], $p[2], $p[3]); - if (PEAR::isError($r)) { - return $r; - } - } - $tdata['perms'] = $o; - return $tdata; - } // fn testData - - - /** - * Make basic test - * - * @return boolean|PEAR_Error - */ - public static function Test() - { - $p = Subjects::test(); - if (PEAR::isError($p)) { - return $p; - } - Alib::DeleteData(); - $tdata = Alib::TestData(); - if (PEAR::isError($tdata)) { - return $tdata; - } - $test_correct = "root/_all/A, test1/_all/A, test1/read/D,". - " test2/addChilds/D, test2/read/A, test2/edit/A,". - " test1/addChilds/D, test1/addChilds/D, gr2/addChilds/A,". - " test3/_all/D"; - if (USE_ALIB_CLASSES){ - $test_correct .= ", test3/read/D, test4/editPerms/A"; - } - $test_correct .= "\nno, yes\n"; - $r = Alib::DumpPerms(); - if (PEAR::isError($r)) { - return $r; - } - $test_dump = $r. - (Alib::CheckPerm( - $tdata['subjects']['test1'], 'read', - $tdata['tree']['t1'] - )? 'yes':'no').", ". - (Alib::CheckPerm( - $tdata['subjects']['test1'], 'addChilds', - $tdata['tree']['i2'] - )? 'yes':'no')."\n" - ; - Alib::RemovePerm($tdata['perms'][1]); - Alib::RemovePerm($tdata['perms'][3]); - $test_correct .= "root/_all/A, test1/read/D,". - " test2/read/A, test2/edit/A,". - " test1/addChilds/D, test1/addChilds/D, gr2/addChilds/A,". - " test3/_all/D"; - if (USE_ALIB_CLASSES) { - $test_correct .= ", test3/read/D, test4/editPerms/A"; - } - $test_correct .= "\n"; - $test_dump .= Alib::DumpPerms(); - Alib::DeleteData(); - if ($test_dump == $test_correct) { - $test_log .= "alib: OK\n"; - return TRUE; - } else { - return PEAR::raiseError('Alib::test', 1, PEAR_ERROR_DIE, '%s'. - "
\ncorrect:\n{$test_correct}\n".
- "dump:\n{$test_dump}\n\n");
- }
- } // fn test
-
} // class Alib
diff --git a/application/models/BasicStor.php b/application/models/BasicStor.php
index 5809879dc..b26b6ef80 100644
--- a/application/models/BasicStor.php
+++ b/application/models/BasicStor.php
@@ -215,74 +215,6 @@ class BasicStor {
// }
- /**
- * Delete file
- *
- * @param int $id
- * Virtual file's local id
- * @param boolean $forced
- * If true don't use trash
- * @return true|PEAR_Error
- */
- // public function bsDeleteFile($id, $forced=FALSE)
- // {
- // global $CC_CONFIG;
- // // full delete:
- // if (!$CC_CONFIG['useTrash'] || $forced) {
- // $res = BasicStor::RemoveObj($id, $forced);
- // return $res;
- // }
- //
- // $storedFile = StoredFile::Recall($id);
- //
- // if (is_null($storedFile) || PEAR::isError($storedFile)) {
- // return $storedFile;
- // }
- // if ($storedFile->isAccessed()) {
- // return PEAR::raiseError(
- // 'Cannot delete an object that is currently accessed.'
- // );
- // }
- // // move to trash:
- // switch (BasicStor::GetObjType($id)) {
- //
- // case "audioclip":
- // $playLists = $storedFile->getPlaylists();
- // $item_gunid = $storedFile->getGunid();
- // if( $playLists != NULL) {
- //
- // foreach($playLists as $key=>$val) {
- // $playList_id = BasicStor::IdFromGunidBigInt($val["gunid"]);
- // $playList_titles[] = BasicStor::bsGetMetadataValue($playList_id, "dc:title");
- // }
- // return PEAR::raiseError(
- // 'Please remove this song from all playlists: ' . join(",", $playList_titles)
- // );
- // }
- // break;
- //
- // case "playlist":
- // if($storedFile->isScheduled()) {
- // return PEAR::raiseError(
- // 'Cannot delete an object that is scheduled to play.'
- // );
- // }
- // break;
- //
- // case "webstream":
- //
- // break;
- // default:
- // }
- //
- // $res = $storedFile->setState('deleted');
- // if (PEAR::isError($res)) {
- // return $res;
- // }
- //
- // return TRUE;
- // }
-
/* ----------------------------------------------------- put, access etc. */
/**
@@ -1788,51 +1720,6 @@ class BasicStor {
}
- /**
- * Remove user by login
- *
- * @param string $login
- * @return boolean|PEAR_Error
- */
- public function removeSubj($login)
- {
- global $CC_CONFIG, $CC_DBC;
- if (FALSE !== array_search($login, $CC_CONFIG['sysSubjs'])) {
- return $CC_DBC->raiseError(
- "BasicStor::removeSubj: cannot remove system user/group");
- }
- $uid = Subjects::GetSubjId($login);
- if (PEAR::isError($uid)) {
- return $uid;
- }
- $res = $CC_DBC->query("
- DELETE FROM ".$CC_CONFIG['accessTable']." WHERE owner=$uid
- ");
- if (PEAR::isError($res)) {
- return $res;
- }
- $res = Alib::RemoveSubj($login);
- if (PEAR::isError($res)) {
- return $res;
- }
- return TRUE;
- }
-
-
- /**
- * Authenticate and create session
- *
- * @param string $login
- * @param string $pass
- * @return boolean|sessionId|PEAR_Error
- */
- function login($login, $pass)
- {
- $r = Alib::Login($login, $pass);
- return $r;
- }
-
-
/* ================================================== "protected" methods */
/**
* Check authorization - auxiliary method
@@ -1862,13 +1749,6 @@ class BasicStor {
$acts = array($acts);
}
$perm = true;
- // foreach ($acts as $i => $action) {
- // $res = Alib::CheckPerm($userid, $action, $pars[$i]);
- // if (PEAR::isError($res)) {
- // return $res;
- // }
- // $perm = $perm && $res;
- // }
if ($perm) {
return TRUE;
}
@@ -2031,89 +1911,6 @@ class BasicStor {
/* ---------------------------------------- redefined "protected" methods */
- /**
- * Copy virtual file.
- * Redefined from parent class.
- *
- * @return int
- * New object local id
- */
- // protected static function CopyObj($id, $newParid, $after=NULL)
- // {
- // switch (BasicStor::GetObjType($id)) {
- // case "audioclip":
- // case "playlist":
- // case "webstream":
- // $storedFile = StoredFile::Recall($id);
- // if (is_null($storedFile) || PEAR::isError($storedFile)) {
- // return $storedFile;
- // }
- // $ac2 = StoredFile::CopyOf($storedFile, $nid);
- // //$ac2->setName(M2tree::GetObjName($nid));
- // break;
- // case "File":
- // default:
- // }
- // return $nid;
- // }
-
-
- /**
- * Remove virtual file.\ncorrect:\n{$test_correct}\n".
-// "dump:\n{$test_dump}\n\n");
-// }
- } // fn test
-
} // class Subjects
diff --git a/application/models/tests/transTest.php b/application/models/tests/transTest.php
deleted file mode 100644
index daaf98bda..000000000
--- a/application/models/tests/transTest.php
+++ /dev/null
@@ -1,142 +0,0 @@
-\n");
-PEAR::setErrorHandling(PEAR_ERROR_RETURN);
-$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
-$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
-$gb = new GreenBox();
-$tr = new Transport($gb);
-$ls = new LocStor();
-@unlink($CC_CONFIG['transDir']."/activity.log");
-@unlink($CC_CONFIG['transDir']."/debug.log");
-$tr->_cleanUp();
-
-$gunid = 'a23456789abcdefb';
-$mediaFile = '../tests/ex1.mp3';
-$mdataFile = '../tests/mdata1.xml';
-
-// Test remote search
-$result = $tr->remoteSearch("");
-if (PEAR::isError($result)) {
- echo $result->message."\n";
-} else {
- var_dump($result);
-}
-
-// ========== STORE ==========
-
-echo"# Store: ";
-//$parid = $gb->_getHomeDirIdFromSess($sessid);
-$values = array(
- "filename" => "xx1.mp3",
- "filepath" => $mediaFile,
- "metadata" => $mdataFile,
- "gunid" => $gunid,
- "filetype" => "audioclip"
-);
-$storedFile = StoredFile::Insert($values);
-if (PEAR::isError($storedFile)) {
- if ($storedFile->getCode()!=GBERR_GUNID) {
- echo "ERROR: ".$storedFile->getMessage()."\n";
- exit(1);
- }
-}
-$oid = $storedFile->getId();
-$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; echo `$comm`;
-echo "$oid\n";
-
-// ========== DELETE FROM HUB ==========
-echo"# loginToArchive: ";
-$r = $tr->loginToArchive();
-if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."\n"; exit(1); }
-echo "{$r['sessid']}\n";
-$asessid = $r['sessid'];
-echo"# deleteAudioClip on Hub: ";
-$r = $tr->xmlrpcCall(
- 'archive.deleteAudioClip',
- array(
- 'sessid' => $asessid,
- 'gunid' => $gunid,
- 'forced' => TRUE,
- )
-);
-if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."\n"; if($r->getCode()!=800+GBERR_FILENEX) exit(1); }
-else{ echo " {$r['status']}\n"; }
-echo"# logoutFromArchive: ";
-$r = $tr->logoutFromArchive($asessid);
-if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."\n"; exit(1); }
-var_export($r); echo"\n";
-
-
-// ========== UPLOAD ==========
-echo "# UPLOAD test:\n";
-echo"# uploadAudioClip2Hub: ";
-$r = $gb->upload2Hub($gunid);
-if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
-var_export($r); echo"\n";
-$trtok = $r;
-
-echo"# logout: "; $r = Alib::Logout($sessid);
-if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
-echo "$r\n";
-#$trtok='280a6f1c18389620';
-
-for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++, sleep(2)){
- echo"# getTransportInfo: "; $r = $gb->getTransportInfo($trtok);
- if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
- $state = $r['state'];
- echo "# state=$state, title={$r['title']}\n";
-}
-if($state=='failed') exit(1);
-
-// === DELETE LOCAL ===
-echo "# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
-echo "# Delete: "; $r = $ls->deleteAudioClip($sessid, $gunid, TRUE);
-if (PEAR::isError($r)) {
- echo "ERROR: ".$r->getMessage()."\n";
- exit(1);
-}
-echo "$r\n";
-echo "# logout: "; $r = Alib::Logout($sessid);
-if (PEAR::isError($r)) {
- echo "ERROR: ".$r->getMessage()."\n";
- exit(1);
-}
-echo "$r\n";
-$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23";
-echo `$comm`;
-
-// === DOWNLOAD ===
-echo "# DOWNLOAD test:\n";
-echo"# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
-
-echo"# downloadAudioClipFromHub: ";
-$r = $gb->downloadFromHub($sessid, $gunid);
-if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
-var_export($r); echo"\n";
-$trtok = $r;
-
-echo"# logout: "; $r = Alib::Logout($sessid);
-if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
-echo "$r\n";
-
-for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++, sleep(2)){
- echo"# getTransportInfo: "; $r = $gb->getTransportInfo($trtok);
- if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
- $state = $r['state'];
- echo "# state=$state, title={$r['title']}\n";
-}
-if($state=='failed') exit(1);
-
-$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; echo `$comm`;
-
-if(file_exists("../trans/log")) echo `tail -n 25 ../trans/log`;
-echo "#Transport test: OK.\n\n";
-*/
diff --git a/application/models/tests/webstreamTest.php b/application/models/tests/webstreamTest.php
deleted file mode 100644
index 6b84f6524..000000000
--- a/application/models/tests/webstreamTest.php
+++ /dev/null
@@ -1,61 +0,0 @@
-\n");
-PEAR::setErrorHandling(PEAR_ERROR_RETURN);
-$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
-$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
-$gb = new GreenBox();
-
-#$gunid = "123456789abcdee0";
-$gunid = "";
-#$mdataFileLP = '../tests/mdata1.xml';
-$mdataFileLP = NULL;
-
-echo "# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
-$parid = $gb->_getHomeDirId($sessid);
-
-echo "# storeWebstream: ";
-$r = $gb->storeWebstream(
- $parid, 'test stream', $mdataFileLP, $sessid, $gunid, 'http://localhost/y');
-if (PEAR::isError($r)) {
- echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n";
- exit(1);
-}
-echo "";
-var_dump($r);
-//$id = BasicStor::IdFromGunid($gunid);
-$id = $r;
-
-echo "# getMdata: ";
-$r = $gb->getMetadata($id, $sessid);
-if (PEAR::isError($r)) {
- echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n";
- exit(1);
-}
-echo "\n$r\n";
-
-echo "# deleteFile: ";
-$r = $gb->deleteFile($id, $sessid);
-if (PEAR::isError($r)) {
- echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n";
- exit(1);
-}
-echo "\n$r\n";
-
-echo "# logout: ";
-$r = Alib::Logout($sessid);
-if (PEAR::isError($r)) {
- echo "ERROR: ".$r->getMessage()."\n";
- exit(1);
-}
-echo "$r\n";
-
-echo "#storeWebstream test: OK.\n\n"
-*/
diff --git a/application/views/scripts/login/index.phtml b/application/views/scripts/login/index.phtml
index 6731be3f5..6a7476d10 100644
--- a/application/views/scripts/login/index.phtml
+++ b/application/views/scripts/login/index.phtml
@@ -7,5 +7,5 @@
form; ?>
-