Major changes with LiveSupport local storageServer module.

This commit is contained in:
tomas 2004-09-12 21:55:51 +00:00
parent 53e7a3d8cc
commit 37f30a7efd
28 changed files with 3024 additions and 1217 deletions

View file

@ -1,7 +1,34 @@
<?php
// $Id: alibExCls.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
require_once"alibExTestAuth.php";
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExCls.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
require_once "alibExTestAuth.php";
if(isset($_GET['id']) && is_numeric($_GET['id'])){ $id = $_GET['id']; $list=false; }
else $list=true;
@ -24,7 +51,7 @@ if($list){
}
$d['msg'] = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']);
require_once"alib_f.php";
require_once "alib_f.php";
// template follows:
?>
<html><head>

View file

@ -1,6 +1,33 @@
<?php
// $Id: alibExLogin.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExLogin.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
// prefill data structure for template
$d = array(
@ -20,7 +47,7 @@ if(is_array($_SESSION['lastPost'])) $d = array_merge($d, array(
unset($_SESSION['lastPost']);
#header("Content-type: text/plain"); print_r($d); exit;
require_once"alib_f.php";
require_once "alib_f.php";
// template follows:
?>
<html><head>
@ -100,7 +127,7 @@ Permission matrix for subject: <select name="subj">
<hr>
<a href="../install.php?ak=inst">reset db + test all</a><br/>
<!--<a href="../install.php?ak=inst">reset db + test all</a><br/>-->
<?php if($d['msg']){ //error message printing: ?>
<script type="text/javascript">

View file

@ -1,7 +1,34 @@
<?php
// $Id: alibExPList.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
require_once"alibExTestAuth.php";
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExPList.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
require_once "alibExTestAuth.php";
if(isset($_GET['id']) && is_numeric($_GET['id'])){ $id = $_GET['id']; }
else $id=1;
@ -16,7 +43,7 @@ else $id=1;
);
$d['msg'] = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']);
require_once"alib_f.php";
require_once "alib_f.php";
// template follows:
?>
<html><head>

View file

@ -1,6 +1,33 @@
<?php
// $Id: alibExPMatrix.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExPMatrix.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
$sid=$_GET['subj'];

View file

@ -1,7 +1,34 @@
<?php
// $Id: alibExPerms.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
require_once"alibExTestAuth.php";
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExPerms.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
require_once "alibExTestAuth.php";
if(isset($_GET['id']) && is_numeric($_GET['id'])){
$id = $_GET['id'];
@ -32,7 +59,7 @@ if(!$alib->isClass($id)){
}
$d['msg'] = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']);
require_once"alib_f.php";
require_once "alib_f.php";
// template follows:
?>
<html><head>

View file

@ -1,7 +1,34 @@
<?php
// $Id: alibExSubj.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
require_once"alibExTestAuth.php";
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExSubj.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
require_once "alibExTestAuth.php";
if(isset($_GET['id']) && is_numeric($_GET['id'])){ $id = $_GET['id']; $list=false; }
else $list=true;
@ -23,7 +50,7 @@ if($list){
}
$d['msg'] = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']);
require_once"alib_f.php";
require_once "alib_f.php";
// template follows:
?>
<html><head>

View file

@ -1,5 +1,32 @@
<?php
// $Id: alibExTestAuth.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExTestAuth.php,v $
------------------------------------------------------------------------------*/
$login = $alib->getSessLogin($_REQUEST['alibsid']);
if(!isset($login)||$login==''){
$_SESSION['alertMsg'] = "Login required";

View file

@ -1,7 +1,34 @@
<?php
// $Id: alibExTree.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
require_once"alibExTestAuth.php";
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibExTree.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
require_once "alibExTestAuth.php";
if(isset($_GET['id']) && is_numeric($_GET['id'])) $id = $_GET['id'];
else $id = $alib->getRootNode();
@ -17,9 +44,9 @@ $d = array(
'id' => $id,
'loggedAs' => $login
);
$d['msg'] = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']);
$d['msg'] = preg_replace(array("|\n|","|'|"), array("\\n","\\'"), $_SESSION['alertMsg']); unset($_SESSION['alertMsg']);
require_once"alib_f.php";
require_once "alib_f.php";
// template follows:
?>
<html><head>

View file

@ -1,8 +1,35 @@
<?php
// $Id: alibHttp.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
require_once"alib_h.php";
/*------------------------------------------------------------------------------
#header("Content-type: text/plain"); echo"GET:\n"; print_r($_GET); echo"POST:\n"; print_r($_POST); exit;
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/alibHttp.php,v $
------------------------------------------------------------------------------*/
require_once "alib_h.php";
#echo"<pre>\nGET:\n"; print_r($_GET); echo"POST:\n"; print_r($_POST); exit;
function getPGval($vn, $dfl='')
{
@ -20,11 +47,15 @@ switch($act)
if($sessid = $alib->login($_POST['login'], $_POST['pass'])){
setcookie('alibsid', $sessid);
$redirUrl="alibExTree.php";
}else{ $redirUrl="alibExLogin.php"; $_SESSION['alertMsg']='Login failed.'; }
}else{
$redirUrl="alibExLogin.php"; $_SESSION['alertMsg']='Login failed.';
}
break;
case"logout";
$r = $alib->logout($_REQUEST['alibsid']);
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage().", ".$r->getUserInfo();
if(PEAR::isError($r)){
$_SESSION['alertMsg'] = $r->getMessage().", ".$r->getUserInfo();
}
setcookie('alibsid', '');
$redirUrl="alibExLogin.php";
break;
@ -33,8 +64,17 @@ switch($act)
&& $_POST['type']!=''
&& $_POST['name']!=''
){
$oid = $alib->addObj($_POST['name'], $_POST['type'], $_POST['id'], $_POST['position']);
$alib->addPerm($userid, '_all', $oid);
$position = ($_POST['position']=='I' ? null : $_POST['position']);
$oid = $alib->addObj(
$_POST['name'], $_POST['type'], $_POST['id'], $position
);
if(PEAR::isError($oid)){
$_SESSION['alertMsg'] =
$oid->getMessage().", ".$oid->getUserInfo();
}else $r = $alib->addPerm($userid, '_all', $oid);
if(PEAR::isError($r)){
$_SESSION['alertMsg'] = $r->getMessage().", ".$r->getUserInfo();
}
}else $_SESSION['alertMsg']='Access denied.';
break;
case"deleteNode";
@ -45,10 +85,14 @@ switch($act)
case"addPerm";
$a = $alib->isClass($_POST['id']) ? 'classes':'editPerms';
$id = $alib->isClass($_POST['id']) ? '':$_POST['id'];
if($alib->checkPerm($userid, $a, $id))
$alib->addPerm($_POST['subj'], $_POST['permAction'], $_POST['id'], $_POST['allowDeny']);
else $_SESSION['alertMsg']='Access denied.';
$redirUrl="alibExPerms.php".(($reid=getPGval('reid', '')) ? "?id=$reid":"");
if($alib->checkPerm($userid, $a, $id)){
$alib->addPerm(
$_POST['subj'], $_POST['permAction'],
$_POST['id'], $_POST['allowDeny']
);
}else $_SESSION['alertMsg']='Access denied.';
$redirUrl = "alibExPerms.php".
(($reid=getPGval('reid', '')) ? "?id=$reid":"");
break;
case"removePerm";
$a = $alib->isClass($_REQUEST['oid']) ? 'classes':'editPerms';
@ -56,10 +100,14 @@ switch($act)
if($alib->checkPerm($userid, $a, $oid))
$alib->removePerm($_GET['permid']);
else $_SESSION['alertMsg']='Access denied.';
$redirUrl=($_REQUEST['reurl']==plist ? "alibExPList.php":"alibExPerms.php").(($reid=getPGval('reid', '')) ? "?id=$reid":"");
$redirUrl =
($_REQUEST['reurl']==plist ? "alibExPList.php":"alibExPerms.php").
(($reid=getPGval('reid', '')) ? "?id=$reid":"");
break;
case"checkPerm";
$res = $alib->checkPerm($_POST['subj'], $_POST['permAction'], $_POST['obj']);
$res = $alib->checkPerm(
$_POST['subj'], $_POST['permAction'], $_POST['obj']
);
$_SESSION['alertMsg'] = ($res ? "permitted: ":"DENIED: ").
" {$_POST['permAction']} for ".$alib->getSubjName($_POST['subj']).
" on ".$alib->getObjName($_POST['obj']);
@ -94,13 +142,15 @@ switch($act)
if($alib->checkPerm($userid, 'subjects'))
$alib->addSubj2Gr($_POST['login'], $_POST['gname']);
else $_SESSION['alertMsg']='Access denied.';
$redirUrl="alibExSubj.php".(($id=getPGval('reid', '')) ? "?id=$reid":"");
$redirUrl = "alibExSubj.php".
(($id=getPGval('reid', '')) ? "?id=$reid":"");
break;
case"removeSubjFromGr";
if($alib->checkPerm($userid, 'subjects'))
$alib->removeSubjFromGr($_GET['login'], $_GET['gname']);
else $_SESSION['alertMsg']='Access denied.';
$redirUrl="alibExSubj.php".(($id=getPGval('reid', '')) ? "?id=$reid":"");
$redirUrl = "alibExSubj.php".
(($id=getPGval('reid', '')) ? "?id=$reid":"");
break;
case"addObj2Class";
if($alib->checkPerm($userid, 'classes'))

View file

@ -1,12 +1,40 @@
<?php
// $Id: conf.php,v 1.1 2004/07/23 00:22:13 tomas Exp $
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport 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 LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/example/conf.php,v $
------------------------------------------------------------------------------*/
$config = array(
'dsn' => array( // data source definition
'username' => 'tomash',
'password' => '',
'username' => 'test',
'password' => 'test',
'hostspec' => 'localhost',
'phptype' => 'pgsql',
'database' => 'mdlf'
'database' => 'LiveSupport-test'
),
'tblNamePrefix' => 'al_',
# 'tblNamePrefix' => 'gb_',
@ -18,15 +46,23 @@ $config = array(
'Section' => array('Title', 'Image', 'Par')
),
'allowedActions'=> array(
'RootNode' => array('addChilds', 'editPerms', 'read', 'edit', 'delete', 'classes', 'subjects'),
'Publication' => array('addChilds', 'editPerms', 'read', 'edit', 'delete'),
'Issue' => array('addChilds', 'editPerms', 'read', 'edit', 'delete'),
'Section' => array('addChilds', 'editPerms', 'read', 'edit', 'delete'),
'RootNode' => array(
'addChilds', 'editPerms', 'read', 'edit', 'delete',
'classes', 'subjects'),
'Publication' => array(
'addChilds', 'editPerms', 'read', 'edit', 'delete'),
'Issue' => array(
'addChilds', 'editPerms', 'read', 'edit', 'delete'),
'Section' => array(
'addChilds', 'editPerms', 'read', 'edit', 'delete'),
'Title' => array('editPerms', 'read', 'edit', 'delete'),
'Image' => array('editPerms', 'read', 'edit', 'delete'),
'Par' => array('editPerms', 'read', 'edit', 'delete'),
'_class' => array('addChilds', 'editPerms', 'read', 'edit', 'delete')
'_class' => array(
'addChilds', 'editPerms', 'read', 'edit', 'delete')
),
'allActions'=> array('editPerms', 'addChilds', 'read', 'edit', 'delete', 'classes', 'subjects')
'allActions'=> array(
'editPerms', 'addChilds', 'read', 'edit', 'delete',
'classes', 'subjects')
);
?>