Got rid of copyright notice in files, we will just have one that covers all files at the root of the package. Converted comments to Phpdocumentor format. Added @author, @version, @package, and @subpackage doc tags. Reformatted code to Campware PHP coding conventions.
This commit is contained in:
parent
ed31251b46
commit
8d5bc9f865
|
@ -1,33 +1,4 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
require_once 'subj.php';
|
||||
|
||||
define('USE_ALIB_CLASSES', TRUE);
|
||||
|
@ -35,14 +6,16 @@ define('ALIBERR_NOTLOGGED', 30);
|
|||
define('ALIBERR_NOTEXISTS', 31);
|
||||
|
||||
/**
|
||||
* Alib class
|
||||
* Alib class
|
||||
*
|
||||
* authentication/authorization class
|
||||
* Authentication/authorization class
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @see Subjects
|
||||
* @see GreenBox
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @package Campcaster
|
||||
* @subpackage Alib
|
||||
* @see Subjects
|
||||
* @see GreenBox
|
||||
*/
|
||||
class Alib extends Subjects{
|
||||
var $permTable;
|
||||
|
@ -54,7 +27,7 @@ class Alib extends Subjects{
|
|||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object $dbc DB
|
||||
* @param DB $dbc
|
||||
* @param array $config
|
||||
*/
|
||||
function Alib(&$dbc, $config)
|
||||
|
@ -74,7 +47,8 @@ class Alib extends Subjects{
|
|||
*
|
||||
* @param string $login
|
||||
* @param string $pass
|
||||
* @return boolean/sessionId/err
|
||||
* @return mixed
|
||||
* boolean/sessionId/err
|
||||
*/
|
||||
function login($login, $pass)
|
||||
{
|
||||
|
@ -166,11 +140,15 @@ class Alib extends Subjects{
|
|||
/**
|
||||
* Insert permission record
|
||||
*
|
||||
* @param int $sid - local user/group id
|
||||
* @param int $sid
|
||||
* local user/group id
|
||||
* @param string $action
|
||||
* @param int $oid - local object id
|
||||
* @param string $type - 'A'|'D' (allow/deny)
|
||||
* @return int - local permission id
|
||||
* @param int $oid
|
||||
* local object id
|
||||
* @param string $type
|
||||
* 'A'|'D' (allow/deny)
|
||||
* @return int
|
||||
* local permission id
|
||||
*/
|
||||
function addPerm($sid, $action, $oid, $type='A')
|
||||
{
|
||||
|
@ -188,9 +166,12 @@ class Alib extends Subjects{
|
|||
/**
|
||||
* Remove permission record
|
||||
*
|
||||
* @param int $permid OPT - local permission id
|
||||
* @param int $subj OPT - local user/group id
|
||||
* @param int $obj OPT - local object id
|
||||
* @param int $permid
|
||||
* (optional) local permission id
|
||||
* @param int $subj
|
||||
* (optional) local user/group id
|
||||
* @param int $obj
|
||||
* (optional) local object id
|
||||
* @return boolean/error
|
||||
*/
|
||||
function removePerm($permid=NULL, $subj=NULL, $obj=NULL)
|
||||
|
@ -217,8 +198,10 @@ class Alib extends Subjects{
|
|||
/**
|
||||
* Return object related with permission record
|
||||
*
|
||||
* @param int $permid - local permission id
|
||||
* @return int - local object id
|
||||
* @param int $permid
|
||||
* local permission id
|
||||
* @return int
|
||||
* local object id
|
||||
*/
|
||||
function _getPermOid($permid)
|
||||
{
|
||||
|
@ -242,10 +225,14 @@ class Alib extends Subjects{
|
|||
* 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, optional (default: root node)
|
||||
* @return boolean/err
|
||||
* @param int $sid
|
||||
* subject id (user or group id)
|
||||
* @param string $action
|
||||
* from set defined in config
|
||||
* @param int $oid
|
||||
* object id, optional (default: root node)
|
||||
* @return mixed
|
||||
* boolean/err
|
||||
*/
|
||||
function checkPerm($sid, $action, $oid=NULL)
|
||||
{
|
||||
|
@ -335,7 +322,8 @@ class Alib extends Subjects{
|
|||
* Remove all permissions on object and then remove object itself
|
||||
*
|
||||
* @param int $id
|
||||
* @return void/error
|
||||
* @return mixed
|
||||
* void/error
|
||||
*/
|
||||
function removeObj($id)
|
||||
{
|
||||
|
@ -352,7 +340,8 @@ class Alib extends Subjects{
|
|||
* Remove all permissions of subject and then remove subject itself
|
||||
*
|
||||
* @param string $login
|
||||
* @return void/error
|
||||
* @return mixed
|
||||
* void/error
|
||||
*/
|
||||
function removeSubj($login)
|
||||
{
|
||||
|
@ -371,6 +360,7 @@ class Alib extends Subjects{
|
|||
return parent::removeSubj($login, $uid);
|
||||
} // fn removeSubj
|
||||
|
||||
|
||||
/* ------------------------------------------------------------- sessions */
|
||||
/**
|
||||
* Get login from session id (token)
|
||||
|
@ -515,8 +505,10 @@ class Alib extends Subjects{
|
|||
/**
|
||||
* Dump all permissions for debug
|
||||
*
|
||||
* @param string $indstr // indentation string
|
||||
* @param string $ind // actual indentation
|
||||
* @param string $indstr
|
||||
* indentation string
|
||||
* @param string $ind
|
||||
* actual indentation
|
||||
* @return string
|
||||
*/
|
||||
function dumpPerms($indstr=' ', $ind='')
|
||||
|
|
|
@ -1,47 +1,22 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once "m2tree.php";
|
||||
|
||||
/**
|
||||
* ObjClass class
|
||||
* ObjClass class
|
||||
*
|
||||
* class for 'object classes' handling - i.e. groups of object in tree
|
||||
* A class for 'object classes' handling - i.e. groups of object in tree
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @see Mtree
|
||||
* @see Subj
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @package Campcaster
|
||||
* @subpackage Alib
|
||||
* @see Mtree
|
||||
* @see Subj
|
||||
*/
|
||||
class ObjClasses extends M2tree{
|
||||
var $classTable;
|
||||
var $cmembTable;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -56,6 +31,7 @@ class ObjClasses extends M2tree{
|
|||
$this->cmembTable = $config['tblNamePrefix'].'cmemb';
|
||||
}
|
||||
|
||||
|
||||
/* ======================================================= public methods */
|
||||
|
||||
/**
|
||||
|
@ -67,15 +43,20 @@ class ObjClasses extends M2tree{
|
|||
function addClass($cname)
|
||||
{
|
||||
$id = $this->dbc->nextId("{$this->treeTable}_id_seq");
|
||||
if(PEAR::isError($id)) return $id;
|
||||
if (PEAR::isError($id)) {
|
||||
return $id;
|
||||
}
|
||||
$r = $this->dbc->query("
|
||||
INSERT INTO {$this->classTable} (id, cname)
|
||||
VALUES ($id, '$cname')
|
||||
");
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove class by name
|
||||
*
|
||||
|
@ -85,10 +66,13 @@ class ObjClasses extends M2tree{
|
|||
function removeClass($cname)
|
||||
{
|
||||
$cid = $this->getClassId($cname);
|
||||
if(PEAR::isError($cid)) return($cid);
|
||||
if (PEAR::isError($cid)) {
|
||||
return($cid);
|
||||
}
|
||||
return $this->removeClassById($cid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove class by id
|
||||
*
|
||||
|
@ -99,13 +83,18 @@ class ObjClasses extends M2tree{
|
|||
{
|
||||
$r = $this->dbc->query("DELETE FROM {$this->cmembTable}
|
||||
WHERE cid=$cid");
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$r = $this->dbc->query("DELETE FROM {$this->classTable}
|
||||
WHERE id=$cid");
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add object to class
|
||||
*
|
||||
|
@ -117,10 +106,13 @@ class ObjClasses extends M2tree{
|
|||
{
|
||||
$r = $this->dbc->query("INSERT INTO {$this->cmembTable} (cid, objid)
|
||||
VALUES ($cid, $oid)");
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove object from class
|
||||
*
|
||||
|
@ -132,10 +124,13 @@ class ObjClasses extends M2tree{
|
|||
{
|
||||
$r = $this->dbc->query("DELETE FROM {$this->cmembTable}
|
||||
WHERE objid=$oid".(is_null($cid)? '':" AND cid=$cid"));
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------- object tree */
|
||||
|
||||
/**
|
||||
|
@ -147,10 +142,13 @@ class ObjClasses extends M2tree{
|
|||
function removeObj($id)
|
||||
{
|
||||
$r = $this->removeObjFromClass($id);
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return parent::removeObj($id);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------- info methods */
|
||||
|
||||
/**
|
||||
|
@ -166,6 +164,7 @@ class ObjClasses extends M2tree{
|
|||
WHERE cname='$cname'");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get class name from id
|
||||
*
|
||||
|
@ -178,6 +177,7 @@ class ObjClasses extends M2tree{
|
|||
$query = "SELECT cname FROM {$this->classTable} WHERE id=$id");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true is object is class
|
||||
*
|
||||
|
@ -188,10 +188,13 @@ class ObjClasses extends M2tree{
|
|||
{
|
||||
$r = $this->dbc->getOne("SELECT count(*) FROM {$this->classTable}
|
||||
WHERE id=$id");
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return ($r > 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all classes
|
||||
*
|
||||
|
@ -202,6 +205,7 @@ class ObjClasses extends M2tree{
|
|||
return $this->dbc->getAll("SELECT * FROM {$this->classTable}");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all objects in class
|
||||
*
|
||||
|
@ -215,6 +219,7 @@ class ObjClasses extends M2tree{
|
|||
WHERE cm.cid=$id AND cm.objid=t.id");
|
||||
}
|
||||
|
||||
|
||||
/* =============================================== test and debug methods */
|
||||
|
||||
/**
|
||||
|
@ -237,6 +242,7 @@ class ObjClasses extends M2tree{
|
|||
return $r;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete all classes and membeship records
|
||||
*
|
||||
|
@ -247,6 +253,8 @@ class ObjClasses extends M2tree{
|
|||
$this->dbc->query("DELETE FROM {$this->classTable}");
|
||||
parent::reset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert test data
|
||||
*
|
||||
|
@ -263,13 +271,16 @@ class ObjClasses extends M2tree{
|
|||
$this->tdata['classes'] = $o;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make basic test
|
||||
*
|
||||
*/
|
||||
function test()
|
||||
{
|
||||
if(PEAR::isError($p = parent::test())) return $p;
|
||||
if (PEAR::isError($p = parent::test())) {
|
||||
return $p;
|
||||
}
|
||||
$this->deleteData();
|
||||
$this->testData();
|
||||
$this->test_correct = "Sections a (2), Class 2 (2)\n";
|
||||
|
@ -280,14 +291,17 @@ class ObjClasses extends M2tree{
|
|||
$this->test_correct .= "Class 2 (1)\n";
|
||||
$this->test_dump .= $this->dumpClasses();
|
||||
$this->deleteData();
|
||||
if($this->test_dump==$this->test_correct){
|
||||
if ($this->test_dump==$this->test_correct) {
|
||||
$this->test_log.="class: OK\n"; return TRUE;
|
||||
}else return PEAR::raiseError(
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
'ObjClasses::test:', 1, PEAR_ERROR_DIE, '%s'.
|
||||
"<pre>\ncorrect:\n{$this->test_correct}\n".
|
||||
"dump:\n{$this->test_dump}\n</pre>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create tables + initialize
|
||||
*
|
||||
|
@ -311,6 +325,8 @@ class ObjClasses extends M2tree{
|
|||
$this->dbc->query("CREATE UNIQUE INDEX {$this->cmembTable}_idx
|
||||
ON {$this->cmembTable} (objid, cid)");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Drop tables etc.
|
||||
*
|
||||
|
@ -321,5 +337,5 @@ class ObjClasses extends M2tree{
|
|||
$this->dbc->query("DROP TABLE {$this->cmembTable}");
|
||||
parent::uninstall();
|
||||
}
|
||||
}
|
||||
} // class ObjClasses
|
||||
?>
|
|
@ -1,32 +1,8 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
require_once "alib_h.php";
|
||||
require_once "alibExTestAuth.php";
|
||||
|
||||
|
@ -75,7 +51,7 @@ require_once "alib_f.php";
|
|||
<?php }?>
|
||||
<a href="alibExSubj.php">User/Group editor</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
<h1>Class editor</h1>
|
||||
|
||||
<?php if($list){?>
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
require_once "alib_h.php";
|
||||
|
||||
// prefill data structure for template
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once "alib_h.php";
|
||||
require_once "alibExTestAuth.php";
|
||||
|
||||
|
@ -65,7 +42,7 @@ require_once "alib_f.php";
|
|||
<a href="alibExCls.php">Class editor</a><br>
|
||||
<a href="alibExSubj.php">User/group editor</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
<h1>Subject permission list</h1>
|
||||
|
||||
<h2>Permissions for subject <?php echo$d['name']?>:</h2>
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
require_once "alib_h.php";
|
||||
|
||||
$sid=$_GET['subj'];
|
||||
|
@ -34,7 +10,7 @@ $sid=$_GET['subj'];
|
|||
$all = $alib->getAllObjects();
|
||||
foreach($alib->getClasses() as $cl)
|
||||
$all[] = array('name'=>$cl['cname']." (class)", 'id'=>$cl['id']);
|
||||
|
||||
|
||||
foreach($all as $it){
|
||||
$aa=array();
|
||||
foreach($alib->getAllActions() as $a){
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once "alib_h.php";
|
||||
require_once "alibExTestAuth.php";
|
||||
|
||||
|
@ -84,7 +61,7 @@ require_once "alib_f.php";
|
|||
<a href="alibExCls.php">Class editor</a><br>
|
||||
<a href="alibExSubj.php">User/Group editor</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
<h1>Permission editor</h1>
|
||||
<?php if(is_array($d['path'])){?>
|
||||
<h2><a href="alibExTree.php?id=<?php echo$d['id']?>" title="Tree editor">Path</a>:
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once "alib_h.php";
|
||||
require_once "alibExTestAuth.php";
|
||||
|
||||
|
@ -74,7 +51,7 @@ require_once "alib_f.php";
|
|||
<?php }?>
|
||||
<a href="alibExCls.php">Class editor</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
<h1>User/Group editor</h1>
|
||||
|
||||
<?php if($list){?>
|
||||
|
|
|
@ -1,36 +1,13 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
<?php
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
$login = $alib->getSessLogin($_REQUEST['alibsid']);
|
||||
if(!isset($login)||$login==''){
|
||||
$_SESSION['alertMsg'] = "Login required";
|
||||
header("Location: alibExLogin.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
?>
|
|
@ -1,32 +1,9 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once "alib_h.php";
|
||||
require_once "alibExTestAuth.php";
|
||||
|
||||
|
@ -70,7 +47,7 @@ require_once "alib_f.php";
|
|||
<a href="alibExCls.php">Class editor</a><br>
|
||||
<a href="alibExSubj.php">User/Group editor</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
<h1>Tree editor</h1>
|
||||
<h3>Path:
|
||||
<?php if(is_array($d['path'])) foreach($d['path'] as $k=>$it) {?>
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
<?php
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
require_once "alib_h.php";
|
||||
|
||||
#echo"<pre>\nGET:\n"; print_r($_GET); echo"POST:\n"; print_r($_POST); exit;
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
$config = array(
|
||||
'dsn' => array( // data source definition
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
header ("location: alibExLogin.php");
|
||||
die;
|
||||
|
||||
?>
|
||||
?>
|
|
@ -1,33 +1,3 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
?>
|
||||
<html><head>
|
||||
<title>ALib module</title>
|
||||
<meta name="author" content="$Author$"/>
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<?
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
require_once '../example/conf.php';
|
||||
require_once 'DB.php';
|
||||
require_once '../alib.php';
|
||||
|
@ -55,9 +31,9 @@ $dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
|||
|
||||
$alib =& new Alib($dbc, $config);
|
||||
|
||||
echo "\n\n======\n".
|
||||
echo "\n\n======\n".
|
||||
"This is Alib standalone installation script, it is NOT needed to run ".
|
||||
"for Livesupport.\nAlib is automatically used by storageServer without it.".
|
||||
"for Campcaster.\nAlib is automatically used by storageServer without it.".
|
||||
"\n======\n\n";
|
||||
|
||||
echo "Alib: uninstall ...\n";
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<?
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
require_once '../example/conf.php';
|
||||
require_once 'DB.php';
|
||||
require_once '../alib.php';
|
||||
|
@ -59,4 +35,4 @@ echo "Trying to uninstall all ...\n";
|
|||
$alib->uninstall();
|
||||
|
||||
$dbc->disconnect();
|
||||
?>
|
||||
?>
|
|
@ -2,12 +2,12 @@
|
|||
define('ALIBERR_MTREE', 10);
|
||||
|
||||
/**
|
||||
* M2tree class
|
||||
* M2tree class
|
||||
*
|
||||
* class for tree hierarchy stored in db
|
||||
* A class for tree hierarchy stored in db.
|
||||
*
|
||||
* example config: example/conf.php<br>
|
||||
* example minimal config:
|
||||
* example config: example/conf.php<br>
|
||||
* example minimal config:
|
||||
* <pre><code>
|
||||
* $config = array(
|
||||
* 'dsn' => array( // data source definition
|
||||
|
@ -21,12 +21,16 @@ define('ALIBERR_MTREE', 10);
|
|||
* 'RootNode' =>'RootNode',
|
||||
* );
|
||||
* </code></pre>
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @see ObjClasses
|
||||
* Original author Tom Hlava
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @package Campcaster
|
||||
* @subpackage Alib
|
||||
* @see ObjClasses
|
||||
*
|
||||
* Original author Tom Hlava
|
||||
*/
|
||||
class M2tree{
|
||||
class M2tree {
|
||||
/**
|
||||
* Database object container
|
||||
*/
|
||||
|
@ -53,11 +57,10 @@ class M2tree{
|
|||
var $rootNodeName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor
|
||||
*
|
||||
* @param dbc object
|
||||
* @param config array
|
||||
* @return this
|
||||
* @param DB $dbc
|
||||
* @param array $config
|
||||
*/
|
||||
function M2tree(&$dbc, $config)
|
||||
{
|
||||
|
@ -71,13 +74,17 @@ class M2tree{
|
|||
|
||||
/* ======================================================= public methods */
|
||||
/**
|
||||
* Add new object of specified type to the tree under specified parent
|
||||
* node
|
||||
* Add new object of specified type to the tree under specified parent
|
||||
* node
|
||||
*
|
||||
* @param string $name, mnemonic name for new object
|
||||
* @param string $type, type of new object
|
||||
* @param int $parid, optional, parent id
|
||||
* @return int/err - new id of inserted object or PEAR::error
|
||||
* @param string $name
|
||||
* mnemonic name for new object
|
||||
* @param string $type
|
||||
* type of new object
|
||||
* @param int $parid
|
||||
* optional, parent id
|
||||
* @return mixed
|
||||
* int/err - new id of inserted object or PEAR::error
|
||||
*/
|
||||
function addObj($name, $type, $parid = NULL)
|
||||
{
|
||||
|
@ -138,14 +145,16 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Remove specified object
|
||||
* Remove specified object
|
||||
*
|
||||
* @param int $oid, object id to remove
|
||||
* @return boolean/err - TRUE or PEAR::error
|
||||
* @param int $oid
|
||||
* object id to remove
|
||||
* @return mixed
|
||||
* boolean/err - TRUE or PEAR::error
|
||||
*/
|
||||
function removeObj($oid)
|
||||
{
|
||||
if ($oid == $this->getRootNode()){
|
||||
if ($oid == $this->getRootNode()) {
|
||||
return $this->dbc->raiseError(
|
||||
"M2tree::removeObj: Can't remove root"
|
||||
);
|
||||
|
@ -154,7 +163,7 @@ class M2tree{
|
|||
if ($this->dbc->isError($dir)) {
|
||||
return $dir;
|
||||
}
|
||||
foreach ($dir as $k => $ch){
|
||||
foreach ($dir as $k => $ch) {
|
||||
$r = $this->removeObj($ch['id']);
|
||||
if ($this->dbc->isError($r)) {
|
||||
return $r;
|
||||
|
@ -172,24 +181,28 @@ class M2tree{
|
|||
DELETE FROM {$this->structTable}
|
||||
WHERE objid=$oid
|
||||
");
|
||||
if($this->dbc->isError($r)) return $r;
|
||||
if ($this->dbc->isError($r)) return $r;
|
||||
*/
|
||||
return TRUE;
|
||||
} // fn removeObj
|
||||
|
||||
|
||||
/**
|
||||
* Create copy of specified object and insert copy to new position
|
||||
* recursively
|
||||
* Create copy of specified object and insert copy to new position
|
||||
* recursively
|
||||
*
|
||||
* @param oid int, source object id
|
||||
* @param newParid int, destination parent id
|
||||
* @param after null, dummy argument for back-compatibility
|
||||
* @return int/err - new id of inserted object or PEAR::error
|
||||
* @param int $oid
|
||||
* source object id
|
||||
* @param int $newParid
|
||||
* destination parent id
|
||||
* @param null $after
|
||||
* dummy argument for back-compatibility
|
||||
* @return mixed
|
||||
* int/err - new id of inserted object or PEAR::error
|
||||
*/
|
||||
function copyObj($oid, $newParid, $after=NULL)
|
||||
{
|
||||
if (TRUE === ($r = $this->isChildOf($newParid, $oid, TRUE))){
|
||||
if (TRUE === ($r = $this->isChildOf($newParid, $oid, TRUE))) {
|
||||
return $this->dbc->raiseError(
|
||||
"M2tree::copyObj: Can't copy into itself"
|
||||
);
|
||||
|
@ -230,7 +243,7 @@ class M2tree{
|
|||
return $nid;
|
||||
}
|
||||
// optionally insert children recursively:
|
||||
foreach ($dir as $k => $item){
|
||||
foreach ($dir as $k => $item) {
|
||||
$r = $this->copyObj($item['id'], $nid);
|
||||
if ($this->dbc->isError($r)) {
|
||||
return $r;
|
||||
|
@ -241,11 +254,12 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Move subtree to another node without removing/adding
|
||||
* Move subtree to another node without removing/adding
|
||||
*
|
||||
* @param oid int
|
||||
* @param newParid int
|
||||
* @param after null, dummy argument for back-compatibility
|
||||
* @param int $oid
|
||||
* @param int $newParid
|
||||
* @param null $after
|
||||
* dummy argument for back-compatibility
|
||||
* @return boolean/err
|
||||
*/
|
||||
function moveObj($oid, $newParid, $after=NULL)
|
||||
|
@ -281,7 +295,7 @@ class M2tree{
|
|||
if ($this->dbc->isError($xid)) {
|
||||
return $this->_dbRollback($xid);
|
||||
}
|
||||
if ($name != $name0){
|
||||
if ($name != $name0) {
|
||||
$r = $this->renameObj($oid, $name);
|
||||
if ($this->dbc->isError($r)) {
|
||||
return $this->_dbRollback($r);
|
||||
|
@ -301,11 +315,14 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Rename of specified object
|
||||
* Rename of specified object
|
||||
*
|
||||
* @param int $oid, object id to rename
|
||||
* @param string $newName, new name
|
||||
* @return boolean/err - True or PEAR::error
|
||||
* @param int $oid
|
||||
* object id to rename
|
||||
* @param string $newName
|
||||
* new name
|
||||
* @return mixed
|
||||
* boolean/err - True or PEAR::error
|
||||
*/
|
||||
function renameObj($oid, $newName)
|
||||
{
|
||||
|
@ -338,11 +355,14 @@ class M2tree{
|
|||
|
||||
/* --------------------------------------------------------- info methods */
|
||||
/**
|
||||
* Search for child id by name in sibling set
|
||||
* Search for child id by name in sibling set
|
||||
*
|
||||
* @param string $name, searched name
|
||||
* @param int $parId, optional, parent id (default is root node)
|
||||
* @return int/null/err - child id (if found) or null or PEAR::error
|
||||
* @param string $name
|
||||
* searched name
|
||||
* @param int $parId
|
||||
* optional, parent id (default is root node)
|
||||
* @return mixed
|
||||
* int/null/err - child id (if found) or null or PEAR::error
|
||||
*/
|
||||
function getObjId($name, $parId = null)
|
||||
{
|
||||
|
@ -365,11 +385,13 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get one value for object by id (default: get name)
|
||||
* Get one value for object by id (default: get name)
|
||||
*
|
||||
* @param int $oid
|
||||
* @param string $fld, optional, requested field (default: name)
|
||||
* @return string/err
|
||||
* @param int $oid
|
||||
* @param string $fld
|
||||
* optional, requested field (default: name)
|
||||
* @return mixed
|
||||
* string/err
|
||||
*/
|
||||
function getObjName($oid, $fld='name')
|
||||
{
|
||||
|
@ -382,10 +404,10 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get object type by id.
|
||||
* Get object type by id.
|
||||
*
|
||||
* @param int $oid
|
||||
* @return string/err
|
||||
* @param int $oid
|
||||
* @return string/err
|
||||
*/
|
||||
function getObjType($oid)
|
||||
{
|
||||
|
@ -394,10 +416,10 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get parent id
|
||||
* Get parent id
|
||||
*
|
||||
* @param int $oid
|
||||
* @return int/err
|
||||
* @param int $oid
|
||||
* @return int/err
|
||||
*/
|
||||
function getParent($oid)
|
||||
{
|
||||
|
@ -410,12 +432,13 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get array of nodes in object's path from root node
|
||||
* Get array of nodes in object's path from root node
|
||||
*
|
||||
* @param int $oid
|
||||
* @param string $flds, optional
|
||||
* @param boolean $withSelf - flag for include specified object to the path
|
||||
* @return array/err
|
||||
* @param int $oid
|
||||
* @param string $flds, optional
|
||||
* @param boolean $withSelf
|
||||
* flag for include specified object to the path
|
||||
* @return array/err
|
||||
*/
|
||||
function getPath($oid, $flds='id', $withSelf=TRUE)
|
||||
{
|
||||
|
@ -426,13 +449,17 @@ class M2tree{
|
|||
WHERE objid=$oid
|
||||
ORDER BY coalesce(level, 0) DESC
|
||||
");
|
||||
if($this->dbc->isError($path)) return $path;
|
||||
if($withSelf){
|
||||
if ($this->dbc->isError($path)) {
|
||||
return $path;
|
||||
}
|
||||
if ($withSelf) {
|
||||
$r = $this->dbc->getRow("
|
||||
SELECT $flds FROM {$this->treeTable}
|
||||
WHERE id=$oid
|
||||
");
|
||||
if($this->dbc->isError($r)) return $r;
|
||||
if ($this->dbc->isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
array_push($path, $r);
|
||||
}
|
||||
return $path;
|
||||
|
@ -440,12 +467,14 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get array of childnodes
|
||||
* Get array of childnodes
|
||||
*
|
||||
* @param int $oid
|
||||
* @param string $flds, optional, comma separated list of requested fields
|
||||
* @param string $order, optional, fieldname for order by clause
|
||||
* @return array/err
|
||||
* @param int $oid
|
||||
* @param string $flds
|
||||
* optional, comma separated list of requested fields
|
||||
* @param string $order
|
||||
* optional, fieldname for order by clause
|
||||
* @return array/err
|
||||
*/
|
||||
function getDir($oid, $flds='id', $order='name')
|
||||
{
|
||||
|
@ -461,14 +490,17 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get level of object relatively to specified root
|
||||
* Get level of object relatively to specified root
|
||||
*
|
||||
* @param int $oid, object id
|
||||
* @param string $flds, list of field names for select
|
||||
* @param int $oid
|
||||
* object id
|
||||
* @param string $flds
|
||||
* list of field names for select
|
||||
* (optional - default: 'level')
|
||||
* @param int $rootId, root for relative levels
|
||||
* @param int $rootId
|
||||
* root for relative levels
|
||||
* (optional - default: NULL - use root of whole tree)
|
||||
* @return hash-array with field name/value pairs
|
||||
* @return hash-array with field name/value pairs
|
||||
*/
|
||||
function getObjLevel($oid, $flds='level', $rootId=NULL)
|
||||
{
|
||||
|
@ -490,19 +522,23 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get subtree of specified node
|
||||
* Get subtree of specified node
|
||||
*
|
||||
* @param int $oid, optional, default: root node
|
||||
* @param boolean $withRoot, optional, include/exclude specified node
|
||||
* @param int $rootId, root for relative levels, optional
|
||||
* @return array/err
|
||||
* @param int $oid
|
||||
* optional, default: root node
|
||||
* @param boolean $withRoot
|
||||
* optional, include/exclude specified node
|
||||
* @param int $rootId
|
||||
* root for relative levels, optional
|
||||
* @return mixed
|
||||
* array/err
|
||||
*/
|
||||
function getSubTree($oid=NULL, $withRoot=FALSE, $rootId=NULL)
|
||||
{
|
||||
if(is_null($oid)) $oid = $this->getRootNode();
|
||||
if(is_null($rootId)) $rootId = $oid;
|
||||
if (is_null($oid)) $oid = $this->getRootNode();
|
||||
if (is_null($rootId)) $rootId = $oid;
|
||||
$r = array();
|
||||
if($withRoot){
|
||||
if ($withRoot) {
|
||||
$r[] = $re = $this->getObjLevel($oid, 'id, name, level', $rootId);
|
||||
} else {
|
||||
$re=NULL;
|
||||
|
@ -516,7 +552,7 @@ class M2tree{
|
|||
}
|
||||
foreach ($dirarr as $k => $snod) {
|
||||
$re = $this->getObjLevel($snod['id'], 'id, name, level', $rootId);
|
||||
if($this->dbc->isError($re)) {
|
||||
if ($this->dbc->isError($re)) {
|
||||
return $re;
|
||||
}
|
||||
# $re['level'] = intval($re['level'])+1;
|
||||
|
@ -529,16 +565,19 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Returns true if first object if child of second one
|
||||
* Returns true if first object if child of second one
|
||||
*
|
||||
* @param int $oid, object id of tested object
|
||||
* @param int $parid, object id of parent
|
||||
* @param boolean $indirect, test indirect or only direct relation
|
||||
* @return boolean
|
||||
* @param int $oid
|
||||
* object id of tested object
|
||||
* @param int $parid
|
||||
* object id of parent
|
||||
* @param boolean $indirect
|
||||
* test indirect or only direct relation
|
||||
* @return boolean
|
||||
*/
|
||||
function isChildOf($oid, $parid, $indirect=FALSE)
|
||||
{
|
||||
if (!$indirect){
|
||||
if (!$indirect) {
|
||||
$paridD = $this->getParent($oid);
|
||||
if ($this->dbc->isError($paridD)) {
|
||||
return $paridD;
|
||||
|
@ -560,9 +599,9 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get id of root node
|
||||
* Get id of root node
|
||||
*
|
||||
* @return int/err
|
||||
* @return int/err
|
||||
*/
|
||||
function getRootNode()
|
||||
{
|
||||
|
@ -571,9 +610,9 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Get all objects in the tree as array of hashes
|
||||
* Get all objects in the tree as array of hashes
|
||||
*
|
||||
* @return array/err
|
||||
* @return array/err
|
||||
*/
|
||||
function getAllObjects()
|
||||
{
|
||||
|
@ -604,11 +643,12 @@ class M2tree{
|
|||
/* ==================================================== "private" methods */
|
||||
|
||||
/**
|
||||
* Cut subtree of specified object from tree.
|
||||
* Preserve subtree structure.
|
||||
* Cut subtree of specified object from tree.
|
||||
* Preserve subtree structure.
|
||||
*
|
||||
* @param int $oid, object id
|
||||
* @return boolean
|
||||
* @param int $oid
|
||||
* object id
|
||||
* @return boolean
|
||||
*/
|
||||
function _cutSubtree($oid)
|
||||
{
|
||||
|
@ -638,17 +678,19 @@ class M2tree{
|
|||
/**
|
||||
* Paste subtree previously cut by _cutSubtree method into main tree
|
||||
*
|
||||
* @param int $oid, object id
|
||||
* @param int $newParid, destination object id
|
||||
* @param int $oid
|
||||
* object id
|
||||
* @param int $newParid
|
||||
* destination object id
|
||||
* @return boolean
|
||||
*/
|
||||
function _pasteSubtree($oid, $newParid)
|
||||
{
|
||||
$dataArr = array();
|
||||
// build data ($dataArr) for INSERT:
|
||||
foreach ($this->getSubTree($oid, TRUE) as $o){
|
||||
foreach ($this->getSubTree($oid, TRUE) as $o) {
|
||||
$l = intval($o['level'])+1;
|
||||
for ($p = $newParid; !is_null($p); $p=$this->getParent($p), $l++){
|
||||
for ($p = $newParid; !is_null($p); $p=$this->getParent($p), $l++) {
|
||||
$rid = $this->dbc->nextId("{$this->structTable}_id_seq");
|
||||
if ($this->dbc->isError($rid)) {
|
||||
return $rid;
|
||||
|
@ -672,17 +714,18 @@ class M2tree{
|
|||
|
||||
|
||||
/**
|
||||
* Do SQL rollback and return PEAR::error
|
||||
* Do SQL rollback and return PEAR::error
|
||||
*
|
||||
* @param object/string $r, error object or error message
|
||||
* @return err
|
||||
* @param object/string $r
|
||||
* error object or error message
|
||||
* @return err
|
||||
*/
|
||||
function _dbRollback($r)
|
||||
{
|
||||
$this->dbc->query("ROLLBACK");
|
||||
if ($this->dbc->isError($r)) {
|
||||
return $r;
|
||||
} elseif(is_string($r)) {
|
||||
} elseif (is_string($r)) {
|
||||
$msg = basename(__FILE__)."::".get_class($this).": $r";
|
||||
} else {
|
||||
$msg = basename(__FILE__)."::".get_class($this).": unknown error";
|
||||
|
@ -694,18 +737,21 @@ class M2tree{
|
|||
/* ==================================================== auxiliary methods */
|
||||
|
||||
/**
|
||||
* Human readable dump of subtree - for debug
|
||||
* Human readable dump of subtree - for debug
|
||||
*
|
||||
* @param int $oid, start object id
|
||||
* @param string $indstr, indentation string
|
||||
* @param string $ind, aktual indentation
|
||||
* @return string
|
||||
* @param int $oid
|
||||
* start object id
|
||||
* @param string $indstr
|
||||
* indentation string
|
||||
* @param string $ind
|
||||
* actual indentation
|
||||
* @return string
|
||||
*/
|
||||
function dumpTree($oid=NULL, $indstr=' ', $ind='',
|
||||
$format='{name}({id})', $withRoot=TRUE)
|
||||
{
|
||||
$r='';
|
||||
foreach($st = $this->getSubTree($oid, $withRoot) as $o){
|
||||
foreach ($st = $this->getSubTree($oid, $withRoot) as $o) {
|
||||
if ($this->dbc->isError($st)) {
|
||||
return $st;
|
||||
}
|
||||
|
|
|
@ -1,32 +1,4 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once "class.php";
|
||||
define('ALIBERR_NOTGR', 20);
|
||||
define('ALIBERR_BADSMEMB', 21);
|
||||
|
@ -40,6 +12,8 @@ define('ALIBERR_BADSMEMB', 21);
|
|||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
* @package Campcaster
|
||||
* @subpackage Alib
|
||||
* @see ObjClasses
|
||||
* @see Alib
|
||||
*/
|
||||
|
@ -68,9 +42,12 @@ class Subjects extends ObjClasses {
|
|||
* Add new subject
|
||||
*
|
||||
* @param string $login
|
||||
* @param string $pass, optional
|
||||
* @param string $realname, optional
|
||||
* @param boolean $passenc, optional, password already encrypted if true
|
||||
* @param string $pass
|
||||
* optional
|
||||
* @param string $realname
|
||||
* optional
|
||||
* @param boolean $passenc
|
||||
* optional, password already encrypted if true
|
||||
* @return int/err
|
||||
*/
|
||||
function addSubj($login, $pass=NULL, $realname='', $passenc=FALSE)
|
||||
|
@ -101,7 +78,8 @@ class Subjects extends ObjClasses {
|
|||
* Remove subject by uid or by login
|
||||
*
|
||||
* @param string $login
|
||||
* @param int $uid, optional, default: null
|
||||
* @param int $uid
|
||||
* optional, default: null
|
||||
* @return boolean/err
|
||||
*/
|
||||
function removeSubj($login, $uid=NULL)
|
||||
|
@ -132,7 +110,8 @@ class Subjects extends ObjClasses {
|
|||
* Check login and password
|
||||
*
|
||||
* @param string $login
|
||||
* @param string $pass, optional
|
||||
* @param string $pass
|
||||
* optional
|
||||
* @return boolean/int/err
|
||||
*/
|
||||
function authenticate($login, $pass='')
|
||||
|
@ -152,7 +131,8 @@ class Subjects extends ObjClasses {
|
|||
* Set lastlogin or lastfail timestamp
|
||||
*
|
||||
* @param string $login
|
||||
* @param boolean $failed, true=> set lastfail, false=> set lastlogin
|
||||
* @param boolean $failed
|
||||
* true=> set lastfail, false=> set lastlogin
|
||||
* @return boolean/int/err
|
||||
*/
|
||||
function setTimeStamp($login, $failed=FALSE)
|
||||
|
@ -172,9 +152,12 @@ class Subjects extends ObjClasses {
|
|||
* Change user password
|
||||
*
|
||||
* @param string $login
|
||||
* @param string $oldpass, old password (optional for 'superuser mode')
|
||||
* @param string $pass, optional
|
||||
* @param boolean $passenc, optional, password already encrypted if true
|
||||
* @param string $oldpass
|
||||
* old password (optional for 'superuser mode')
|
||||
* @param string $pass
|
||||
* optional
|
||||
* @param boolean $passenc
|
||||
* optional, password already encrypted if true
|
||||
* @return boolean/err
|
||||
*/
|
||||
function passwd($login, $oldpass=null, $pass='', $passenc=FALSE)
|
||||
|
@ -386,8 +369,10 @@ class Subjects extends ObjClasses {
|
|||
/**
|
||||
* Return true if uid is [id]direct member of gid
|
||||
*
|
||||
* @param int $uid, local user id
|
||||
* @param int $gid, local group id
|
||||
* @param int $uid
|
||||
* local user id
|
||||
* @param int $gid
|
||||
* local group id
|
||||
* @return boolean
|
||||
*/
|
||||
function isMemberOf($uid, $gid)
|
||||
|
@ -412,8 +397,10 @@ class Subjects extends ObjClasses {
|
|||
*
|
||||
* @param int $uid
|
||||
* @param int $gid
|
||||
* @param int $level, optional
|
||||
* @param int $mid, optional
|
||||
* @param int $level
|
||||
* optional
|
||||
* @param int $mid
|
||||
* optional
|
||||
* @return int/err
|
||||
*/
|
||||
function _addMemb($uid, $gid, $level=0, $mid='null')
|
||||
|
@ -474,7 +461,8 @@ class Subjects extends ObjClasses {
|
|||
* List [in]direct members of group
|
||||
*
|
||||
* @param int $gid
|
||||
* @param int $uid, optional
|
||||
* @param int $uid
|
||||
* optional
|
||||
* @return array/err
|
||||
*/
|
||||
function _listMemb($gid, $uid=NULL)
|
||||
|
@ -490,7 +478,8 @@ class Subjects extends ObjClasses {
|
|||
* List groups where uid is [in]direct member
|
||||
*
|
||||
* @param int $gid
|
||||
* @param int $uid, optional
|
||||
* @param int $uid
|
||||
* optional
|
||||
* @return array/err
|
||||
*/
|
||||
function _listRMemb($uid, $gid=NULL)
|
||||
|
@ -580,8 +569,10 @@ class Subjects extends ObjClasses {
|
|||
/**
|
||||
* Dump subjects for debug
|
||||
*
|
||||
* @param string $indstr // indentation string
|
||||
* @param string $ind // aktual indentation
|
||||
* @param string $indstr
|
||||
* indentation string
|
||||
* @param string $ind
|
||||
* actual indentation
|
||||
* @return string
|
||||
*/
|
||||
function dumpSubjects($indstr=' ', $ind='')
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
include_once "xmlrpc.inc";
|
||||
include_once "xmlrpcs.inc";
|
||||
require_once "../example/alib_h.php";
|
||||
|
@ -45,7 +21,7 @@ function v2xr($var, $struct=true){
|
|||
|
||||
/**
|
||||
* XMLRPC interface for Alib class<br>
|
||||
* only for testing now (with example) - LiveSupport uses special interface
|
||||
* only for testing now (with example) - Campcaster uses special interface
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
|
|
|
@ -1,33 +1,4 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
header ("location: xr_cli_test.php");
|
||||
die;
|
||||
?>
|
||||
?>
|
|
@ -1,32 +1,8 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the Campcaster project.
|
||||
http://campcaster.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
Campcaster is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Campcaster is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Campcaster; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author$
|
||||
Version : $Revision$
|
||||
Location : $URL$
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
include("xmlrpc.inc");
|
||||
|
||||
$host = "localhost";
|
||||
|
@ -78,7 +54,7 @@ switch($ak){
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<html><head>
|
||||
<title>Alib XMLRPC test client</title>
|
||||
|
|
Loading…
Reference in New Issue