openupload-svn-update Mailing List for Open Upload (Page 15)
Status: Beta
Brought to you by:
tsdogs
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(100) |
Nov
(72) |
Dec
(44) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(7) |
Feb
(47) |
Mar
(30) |
Apr
(11) |
May
(10) |
Jun
(8) |
Jul
(1) |
Aug
(22) |
Sep
|
Oct
|
Nov
(13) |
Dec
|
| 2010 |
Jan
|
Feb
|
Mar
(17) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
(1) |
| 2011 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ts...@us...> - 2008-10-21 18:13:52
|
Revision: 46
http://openupload.svn.sourceforge.net/openupload/?rev=46&view=rev
Author: tsdogs
Date: 2008-10-21 18:13:49 +0000 (Tue, 21 Oct 2008)
Log Message:
-----------
project status update
Modified Paths:
--------------
trunk/CHANGELOG
trunk/TODO
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-10-21 18:11:46 UTC (rev 45)
+++ trunk/CHANGELOG 2008-10-21 18:13:49 UTC (rev 46)
@@ -17,7 +17,8 @@
- Manage profile (password/Name/E-Mail change)
* Database
-- Review DB module functions done 2008.10.17
+- Review DB module functions
+- Updated txtdb with basic api
* Acl for modules and plugins
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-21 18:11:46 UTC (rev 45)
+++ trunk/TODO 2008-10-21 18:13:49 UTC (rev 46)
@@ -10,7 +10,7 @@
- Enable registration with e-mail confirmation
Database
-- re-enable txt module
+- txtdb needs some work
Translation
- Update the translations
@@ -18,6 +18,9 @@
Download
- Change serve file method to not go over the memory php limit and not timeout when serving a file.
+General
+- make sub www folders not accessible by default (some index.php needed)
+
******* MIGHT BE IN RELEASE *******
Registration
- Enable registration moderation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-21 18:11:56
|
Revision: 45
http://openupload.svn.sourceforge.net/openupload/?rev=45&view=rev
Author: tsdogs
Date: 2008-10-21 18:11:46 +0000 (Tue, 21 Oct 2008)
Log Message:
-----------
Implement basic txtdb database api. It works but misses features.
Modified Paths:
--------------
trunk/lib/modules/db/txt.inc.php
Modified: trunk/lib/modules/db/txt.inc.php
===================================================================
--- trunk/lib/modules/db/txt.inc.php 2008-10-21 18:11:02 UTC (rev 44)
+++ trunk/lib/modules/db/txt.inc.php 2008-10-21 18:11:46 UTC (rev 45)
@@ -8,27 +8,101 @@
var $prefix;
function txtDB() {
+ $this->tables = array (
+ "files" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "name", "mime", "description", "size", "remove", "user_id", "ip", "upload_date",
+ )
+
+ ),
+ "users" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "login", "password", "name", "group_id", "email", "lang", "active",
+ ),
+ "auto_increment" => "id",
+ ),
+ "groups" => array (
+ "type" => "file",
+ "fields" => array (
+ "name", "description",
+ ),
+ ),
+ "file_options" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "file_id", "module", "name", "value",
+ ),
+ "auto_increment" => "id",
+ ),
+ "acl" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "module", "action", "group_id", "access",
+ ),
+ "auto_increment" => "id",
+ ),
+ "langs" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "name", "locale", "browser", "charset", "active",
+ ),
+ ),
+ "plugin_acl" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "group_id", "plugin", "access",
+ ),
+ "auto_increment" => "id",
+ ),
+ "plugin_options" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "plugin", "group_id", "option", "value",
+ ),
+ "auto_increment" => "id",
+ ),
+ "banned" => array (
+ "type" => "file",
+ "fields" => array (
+ "id", "ip", "access", "priority",
+ ),
+ "auto_increment" => "id",
+ ),
+ );
}
function readTxt ($file) {
- $x = file_get_contents($file);
- /* split the lines */
+ $x = file($file);
+ /* first line is the structure */
+ $fields = explode('|',chop($x[0]));
$result = array();
- $lines = split("\n",$x);
- foreach ($lines as $l) {
- $r = split("\|",$l,2);
- if (count($r)==2) {
- $result[$r[0]]=$r[1];
+ for ($i=1; $i<count($x); $i++) {
+ $r = explode('|',chop($x[$i]));
+ foreach ($fields as $k => $f) {
+ $row[$f] = $r[$k];
}
+ $result[]=$row;
}
return $result;
}
- function writeTxt($file,$lines) {
+ function writeTxt($file,$rows,$fields) {
$x = '';
- foreach ($lines as $k => $l) {
- $x .= $k.'|'.$l."\n";
+ foreach ($fields as $f) {
+ if ($x!='') $x .= '|';
+ $x .= $f;
}
+ $x .= "\n";
+ foreach ($rows as $row) {
+ $r = '';
+ foreach ($fields as $f) {
+ if ($r!='') $r .= '|';
+ $r .= $row[$f];
+ }
+ $x .= $r."\n";
+ }
file_put_contents($file,$x);
}
@@ -39,79 +113,184 @@
if (!is_dir($this->baseDir)) {
die(tr('ERROR: database folder not found!'));
}
- $dirs = array('users','files','groups');
- foreach ($dirs as $d) {
- if (!is_dir($this->baseDir.'/'.$this->prefix.$d)) {
- if (!mkdir($this->baseDir.'/'.$this->prefix.$d)) {
- die(tr('ERROR: Could not create folder for %1 table!',$d));
+ foreach ($this->tables as $n => $d) {
+ if ($d['type'] == "dir") {
+ if (!is_dir($this->baseDir.'/'.$this->prefix.$n)) {
+ if (!mkdir($this->baseDir.'/'.$this->prefix.$n)) {
+ die(tr('ERROR: Could not create folder for %1 table!',$n));
+ }
}
+ } else if ($d['type'] == "file") {
+ if (!file_exists($this->baseDir.'/'.$this->prefix.$n.'.txt')) {
+ $str = '';
+ foreach ($d['fields'] as $f) {
+ if ($str != '') $str .= '|';
+ $str .= $f;
+ }
+ if (!file_put_contents($this->baseDir.'/'.$this->prefix.$n.'.txt',$str."\n")) {
+ die(tr('ERROR: Could not create file for %1 table!',$n));
+ }
+ }
}
}
}
- function queryUser($login) {
- $file = $this->baseDir.'/'.$this->prefix.'users/'.$login.'.txt';
- if (!file_exists($file)) {
- return array();
- } else {
- $result = $this->readTxt($file);
- if ($result['active']==1)
- return $result;
- else
- return array();
- }
+ function newId($tbl,$field = 'id',$keys = array ()) {
+ return 1;
}
- function addUser($user) {
- /* should compute a real new id */
- $id = randomName(1,20);
- $user['id'] = $id;
- $file = $this->baseDir.'/'.$this->prefix.'users/'.$user['login'].'.txt';
- $this->writeTxt($file,$user);
+ function newRandomId($tbl,$field = 'id') {
+ $found = true;
+ $rows = $this->readTxt($this->baseDir.'/'.$tbl.'.txt');
+ while ($found) {
+ $id = randomName(30,30);
+ $found = false;
+ foreach ($rows as $row) {
+ /* should check for the exsistence */
+ if ($row[$field]==$id) {
+ $found = true;
+ }
+ }
+ }
+ return $id;
}
- function updateUser($user) {
- $file = $this->baseDir.'/'.$this->prefix.'users/'.$user['login'].'.txt';
- $this->writeTxt($file,$user);
+ function count($tbl,$keys = array()) {
+// TODO: check for keys
+ if ($this->tables[$tbl]['type'] == "dir") {
+ $a = scandir($this->baseDir.'/'.$this->prefix.$tbl);
+ return count($a)-2; /* remove . and .. */
+ } else {
+ $a = file($this->baseDir.'/'.$this->prefix.$tbl.'.txt');
+ return count($a)-1; /* remove the first line */
+ }
}
- function deleteUser($user) {
- $file = $this->baseDir.'/'.$this->prefix.'users/'.$user['login'].'.txt';
- unlink($file);
- /* probably should remove all the files uploaded too */
+ function read($tbl,$keys = array(), $sort = array(), $limit = '', $assoc = array()) {
+ $file = $this->baseDir.'/'.$this->prefix.$tbl;
+ if ($this->tables[$tbl]['type']=='dir') {
+
+ } else {
+ $result = array();
+ $rows = $this->readTxt($file.'.txt');
+ foreach ($rows as $row) {
+ $add = true;
+ if (count($keys)>0) {
+ foreach ($keys as $n => $k) {
+ if ($row[$n]!=$k) {
+ $add = false;
+ break;
+ }
+ }
+ }
+ if ($add) {
+ if (count($assoc)) { /* maybe there is a better way to do this? */
+ $str = '$result';
+ foreach ($assoc as $k) {
+ $str .= '[\''.$row[$k].'\']';
+ }
+ $str .= '=$row;';
+ eval($str);
+ } else {
+ $result[] = $row;
+ }
+ }
+ }
+/* need to add the limit and the sorting */
+ }
+ return $result;
}
- function getFileInfo($id) {
- $file = $this->baseDir.'/'.$this->prefix.'files/'.$id.'.txt';
- $finfo = $this->readTxt($file);
- return $finfo;
+ function insert($tbl,$values,$fields = array()) {
+ $file = $this->baseDir.'/'.$tbl;
+ if ($this->tables[$tbl]['type']=='dir') {
+ } else {
+ $rows = $this->readTxt($file.'.txt');
+ $row = array();
+ if ($this->tables[$tbl]['auto_increment']!='') {
+ if (count($rows)>0)
+ $row[$this->tables[$tbl]['auto_increment']]=$rows[count($rows)-1][$this->tables[$tbl]['auto_increment']]+1;
+ else
+ $row[$this->tables[$tbl]['auto_increment']]=1;
+ }
+ if (count($fields)>0) {
+ /* init the values */
+ foreach ($this->tables[$tbl]['fields'] as $f) {
+ if ($this->tables[$tbl]['auto_increment']!=$f)
+ $row[$f]='';
+ }
+ foreach ($fields as $f) {
+ if ($this->tables[$tbl]['auto_increment']!=$f)
+ $row[$f]=$values[$f];
+ }
+ $rows[]=$row;
+ } else {
+ foreach ($this->tables[$tbl]['fields'] as $f) {
+ if ($this->tables[$tbl]['auto_increment']!=$f)
+ $row[$f]=$values[$f];
+ }
+ $rows[]=$row;
+ }
+ $this->writeTxt($file.'.txt',$rows,$this->tables[$tbl]['fields']);
+ }
}
- function newFileId($field = 'id') {
- $found = true;
- /* let's hope we never get the duplicate on 2 or more users uploading at the same time */
- while ($found) {
- $id = randomName(30,30);
- $found = file_exists($this->baseDir.'/'.$this->prefix.'files/'.$id.'.txt');
- }
- return $id;
+ function update($tbl,$values,$keys = array(),$fields = array()) {
+ $file = $this->baseDir.'/'.$tbl;
+ if ($this->tables[$tbl]['type']=='dir') {
+ } else {
+ $rows = $this->readTxt($file.'.txt');
+ foreach ($rows as $i => $r) {
+ $update = true;
+ if (count($keys)>0) {
+ foreach ($keys as $k => $v) {
+ if ($r[$k]!=$v) {
+ $update = false;
+ break;
+ }
+ }
+ }
+ if ($update) {
+ $row = $r;
+ if (count($fields)>0) {
+ foreach ($fields as $f) {
+ $row[$f]=$values[$f];
+ }
+ } else {
+ foreach ($this->tables[$tbl]['fields'] as $f) {
+ $row[$f]=$values[$f];
+ }
+ }
+ $rows[$i]=$row;
+ }
+ }
+ $this->writeTxt($file.'.txt',$rows,$this->tables[$tbl]['fields']);
+ }
}
- function addFile(&$finfo) {
- $finfo['user_id']=$_SESSION['user']['login'];
- $finfo['upload_date']=date('Y-m-d h:i:s');
- $file = $this->baseDir.'/'.$this->prefix.'files/'.$finfo['id'].'.txt';
- $this->writeTxt($file,$finfo);
- return $finfo['id'];
+ function delete($tbl,$keys = array()) {
+ $file = $this->baseDir.'/'.$tbl;
+ if ($this->tables[$tbl]['type']=='dir') {
+ } else {
+ $rows = $this->readTxt($file.'.txt');
+ foreach ($rows as $i => $r) {
+ $delete = true;
+ if (count($keys)>0) {
+ foreach ($keys as $k => $v) {
+ if ($r[$k]!=$v) {
+ $delete = false;
+ break;
+ }
+ }
+ }
+ if ($delete) {
+ unset($rows[$i]);
+ }
+ }
+ $this->writeTxt($file.'.txt',$rows,$this->tables[$tbl]['fields']);
+ }
}
- function addFileOption($finfo,$module,$field) {
- /* this has been saved into the file for now, if needed will split it */
- }
- function removeFile($id) {
- unlink($this->baseDir.'/'.$this->prefix.'files/'.$id.'.txt');
- }
-
}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-21 18:11:07
|
Revision: 44
http://openupload.svn.sourceforge.net/openupload/?rev=44&view=rev
Author: tsdogs
Date: 2008-10-21 18:11:02 +0000 (Tue, 21 Oct 2008)
Log Message:
-----------
check if the password was not set then ignore it
Modified Paths:
--------------
trunk/plugins/password.inc.php
Modified: trunk/plugins/password.inc.php
===================================================================
--- trunk/plugins/password.inc.php 2008-10-18 13:45:17 UTC (rev 43)
+++ trunk/plugins/password.inc.php 2008-10-21 18:11:02 UTC (rev 44)
@@ -27,7 +27,7 @@
}
function downloadRequest($finfo,$acl) {
- if ($finfo['password']!=crypt("",$finfo['password'])) {
+ if (($finfo['password']!='') and ($finfo['password']!=crypt("",$finfo['password'])) ) {
$this->display('downloadRequest');
return false;
}
@@ -37,7 +37,7 @@
function downloadConfirm($finfo,$acl) {
global $_POST;
- if ($finfo['password']!=crypt("",$finfo['password'])) {
+ if (($finfo['password']!='') and ($finfo['password']!=crypt("",$finfo['password'])) ) {
$result = $finfo['password']==crypt($_POST['protect'],$finfo['password']);
if (!$result) app()->error(tr('Wrong password!'));
return $result;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 13:45:21
|
Revision: 43
http://openupload.svn.sourceforge.net/openupload/?rev=43&view=rev
Author: tsdogs
Date: 2008-10-18 13:45:17 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
updated Todo
Modified Paths:
--------------
trunk/TODO
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-18 13:27:59 UTC (rev 42)
+++ trunk/TODO 2008-10-18 13:45:17 UTC (rev 43)
@@ -15,6 +15,9 @@
Translation
- Update the translations
+Download
+- Change serve file method to not go over the memory php limit and not timeout when serving a file.
+
******* MIGHT BE IN RELEASE *******
Registration
- Enable registration moderation
@@ -39,6 +42,7 @@
General
- enable modrewrite mode
+- Upload and download of multiple files at the same time
Users
- manage personal files (if allowed)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 13:28:08
|
Revision: 42
http://openupload.svn.sourceforge.net/openupload/?rev=42&view=rev
Author: tsdogs
Date: 2008-10-18 13:27:59 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Updated changelog
Modified Paths:
--------------
trunk/CHANGELOG
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-10-18 13:27:23 UTC (rev 41)
+++ trunk/CHANGELOG 2008-10-18 13:27:59 UTC (rev 42)
@@ -2,6 +2,8 @@
* Registration
- Check for valid login name
+* Upload
+ - Added main maximum upload file size checks
* Administration: mainly done needs a review in near future
- User administration
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 13:27:32
|
Revision: 41
http://openupload.svn.sourceforge.net/openupload/?rev=41&view=rev
Author: tsdogs
Date: 2008-10-18 13:27:23 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Add maximum file size based on user, if somebody tryes to upload a file via some bots.
Modified Paths:
--------------
trunk/lib/modules/default/files.inc.php
Modified: trunk/lib/modules/default/files.inc.php
===================================================================
--- trunk/lib/modules/default/files.inc.php 2008-10-18 13:23:17 UTC (rev 40)
+++ trunk/lib/modules/default/files.inc.php 2008-10-18 13:27:23 UTC (rev 41)
@@ -67,7 +67,7 @@
if ($_FILES['upload']['error']>0) {
switch ($_FILES['upload']['error']) { /* taken from here: http://it.php.net/manual/en/features.file-upload.errors.php */
case 1: app()->error(tr('Maximum upload size for site wide configuration reached')); break;
- case 2: app()->error(tr('File is too big!')); break;
+ case 2: app()->error(tr('Maximum file size exceeded!')); break;
case 3: app()->error(tr('Partial file transfer error!')); break;
case 4: app()->error(tr('No file was uploaded!')); break;
case 6: app()->error(tr('Missing temporary directory')); break;
@@ -77,6 +77,8 @@
app()->error(tr('Upload failed for Unknonw error code: %1',$_FILES['upload']['error'])); break;
}
$this->nextStep(1);
+ } else if ($_FILES['upload']['size']>app()->user->info('max_upload_size')) {
+ app()->error(tr('Maximum file size exceeded!')); break;
} else {
/* prepare the file */
$tmpname = app()->config['DATA_PATH'].'/tmp/'.randomName();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 13:23:26
|
Revision: 40
http://openupload.svn.sourceforge.net/openupload/?rev=40&view=rev
Author: tsdogs
Date: 2008-10-18 13:23:17 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Add default max file size basic handling
Modified Paths:
--------------
trunk/TODO
trunk/lib/main.inc.php
trunk/templates/default/modules/files/uploadForm.tpl
trunk/www/config.inc.php.example
Added Paths:
-----------
trunk/CHANGELOG
Added: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG (rev 0)
+++ trunk/CHANGELOG 2008-10-18 13:23:17 UTC (rev 40)
@@ -0,0 +1,35 @@
+Changelog before release (0.3?) (updated on 2008.10.18).
+
+* Registration
+ - Check for valid login name
+
+* Administration: mainly done needs a review in near future
+ - User administration
+ - Group administration
+ - File administration
+ - Plugin ACL administration
+ - Rights Administration
+ - Display of actual configuration
+
+* User
+ - Manage profile (password/Name/E-Mail change)
+
+* Database
+- Review DB module functions done 2008.10.17
+
+* Acl for modules and plugins
+
+* Translations
+ - gettext module
+ - array module
+ - initial Italian translation
+
+* Web site
+ - Created index page
+ - Addedd Screen shots
+ - Added mailing lists
+
+* SVN repository
+ - up and running :)
+ - added mailing list to track changes
+
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-18 13:21:09 UTC (rev 39)
+++ trunk/TODO 2008-10-18 13:23:17 UTC (rev 40)
@@ -1,77 +1,82 @@
TODO list not priority ordered.
-UPLOAD
-Display upload progress
+RELEASE: not until api and db are stable.
+******* MUST BE DONE BEFORE RELEASE *******
+Administration
+- Admin of banned IPs
-REGISTRATION
-Registration with e-mail activation
-Check for a valid login value
-Moderation of registrations by admin
+Registration
+- Enable registration moderation
+- Enable registration with e-mail confirmation
-USER
-Manage profile (password/Name/E-Mail change) done 2008.10.16
-Manage personal files (if allowed)
+Database
+- re-enable txt module
-DATABASE
-Review DB module functions done 2008.10.17
-Implement pgsql module
-Additional tables for txt module, needs a review 'cause of db api change.
+Translation
+- Update the translations
-AUTHENTICATION
-LDAP authentication (with OpenLdap and AD) mainly
+******* MIGHT BE IN RELEASE *******
+Registration
+- Enable registration moderation
-ADMIN (mainly done 2008.10.16, though it needs a major revision)
-User administration
-Group administration
-File administration and maintainence
-Plugin administration
+Authentication
+- LDAP authentication for Openldap and AD support
-ADMIN (missing)
-Config administration
-First setup script
-Banned IP amdinistration
-Rights switch mode (to switch from 1 mode to the other)
-Rights better admin tool.
-Language table admin.
-Plugin options
+Database
+- pgsql module
-ACL
-User/Group acl for modules and plugins: done 2008.10.16
+Upload
+- Display upload progress
-DOWNLOAD
-Fix double click on no blockings for download
+Administration
+- Rights switch mode (to switch from 1 mode to the other)
+- Rights better admin tool.
-PLUGINS
-Plugin configuration options
-banned ip probably is better in the main app and not as a plugin.
+Plugins
+- Upload different filesize limiting depending on group
-(Following are some ideas)
-Upload different filesize limiting depending on group
-Download bandwith limiting depending on group (of upload user probably better)
-Download wait time (is this really needed?)
-User additional fields for registration request.
-Antivirus on upload
-Deletion timeout (should it be a plugin? Maybe only for user interaction on it)
+******* OTHER THINGS/IDEAS *******
-TRANSLATIONS (gettext/array)
-Complete implementation: done 2008.10.14
-Translate to italian: in progress 2008.10
-Add a database translator? not until base isn't complete.
+General
+- enable modrewrite mode
-MAINTEINENCE
-Create a script to clean up the files/tmpfiles.
-Manage file deletion timeout probably better to be handled here.
+Users
+- manage personal files (if allowed)
-TEMPLATE
-Create a sample template.
+Administration
+- Review the general administration module
+- First setup script
+- Config administration
+- Language table admin.
+- Plugin options
-LOG
-Activity logging
+Download
+- Fix double click on no blockings for download
-TERMS OF USE
+Plugins
+- Plugin configuration options
+- banned ip probably is better in the main app and not as a plugin.
+- (Following are some ideas)
+ Download bandwith limiting depending on group (of upload user probably better)
+ Download wait time (is this really needed?)
+ User additional fields for registration request.
+ Antivirus on upload
+ Deletion timeout (should it be a plugin? Maybe only for user interaction on it)
-WEB SITE with Screen Shots. basic are up 2008.10
+Translation
+- Add a database translator? not until base isn't complete.
-SVN setup. done 2008.10
+Maintainence
+- Create a script to clean up the files/tmpfiles.
+- Manage file deletion timeout probably better to be handled here.
-RELEASE: not until api and db are not definitive.
+Template
+- Create a sample template.
+
+Documentation
+- All is missing :)
+- Document program api
+
+Others
+- Activity logging
+- Terms of Use for site and registration
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-18 13:21:09 UTC (rev 39)
+++ trunk/lib/main.inc.php 2008-10-18 13:23:17 UTC (rev 40)
@@ -78,6 +78,12 @@
$this->tr->init();
$this->auth->init();
$this->user->init();
+//unset($_SESSION['user']);
+ if ($this->user->info('max_upload_size')==0)
+ $this->user->setInfo('max_upload_size',$this->config['max_upload_size']*1024*1024);
+ ini_set('max_upload_size',$this->user->info('max_upload_size'));
+ ini_set('post_max_size',$this->user->info('max_upload_size'));
+// TODO: should check if this value has been really set or if it was blocked by the PHP
$this->config['modules'][]='files';
$this->config['modules'][]='admin';
@@ -273,7 +279,6 @@
$this->tpl->assign('script',$_SERVER['PHP_SELF']);
$this->tpl->assign('page',$this->page);
-
/* depending on the acl some actions need authentication others don't */
if (!isset($this->actions[$this->action])) {
/* no module can handle this action */
Modified: trunk/templates/default/modules/files/uploadForm.tpl
===================================================================
--- trunk/templates/default/modules/files/uploadForm.tpl 2008-10-18 13:21:09 UTC (rev 39)
+++ trunk/templates/default/modules/files/uploadForm.tpl 2008-10-18 13:23:17 UTC (rev 40)
@@ -10,8 +10,14 @@
<form method="post" enctype='multipart/form-data' action="{$script}" name="uploadform">
<input type="hidden" name="action" value="{$action}">
<input type="hidden" name="step" value="{$nextstep}">
+{if isset($user.max_upload_size)}
+<input type="hidden" name="MAX_FILE_SIZE" value="{$user.max_upload_size}">
+{/if}
{tr}Select the file to be uploaded{/tr}<br>
<input type="file" class="file" size="50" name="upload" onchange="if (this.value!='') unhide();"><br>
+{if isset($user.max_upload_size)}
+<div id="msg">{tr}Maximum allowed upload size{/tr}: {$user.max_upload_size|fsize_format:"MB":0}</div>
+{/if}
{$plugins}
<div id="uploadbutton" style="visibility:hidden"><br>
<a href="{$script}" onclick="document.uploadform.submit();return false;">
Modified: trunk/www/config.inc.php.example
===================================================================
--- trunk/www/config.inc.php.example 2008-10-18 13:21:09 UTC (rev 39)
+++ trunk/www/config.inc.php.example 2008-10-18 13:23:17 UTC (rev 40)
@@ -50,6 +50,9 @@
$CONFIG['plugins'][] = 'password';
$CONFIG['plugins'][] = 'captcha';
+/* Set maximum default upload size in MB*/
+$CONFIG['max_upload_size']=100;
+
/* SITE TITLE */
$CONFIG['site']['title'] = 'Open Upload';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 13:21:22
|
Revision: 39
http://openupload.svn.sourceforge.net/openupload/?rev=39&view=rev
Author: tsdogs
Date: 2008-10-18 13:21:09 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Add upload file error handling.
Modified Paths:
--------------
trunk/lib/modules/default/files.inc.php
Modified: trunk/lib/modules/default/files.inc.php
===================================================================
--- trunk/lib/modules/default/files.inc.php 2008-10-18 12:48:58 UTC (rev 38)
+++ trunk/lib/modules/default/files.inc.php 2008-10-18 13:21:09 UTC (rev 39)
@@ -64,16 +64,31 @@
global $_SERVER;
if (isset($_FILES['upload'])) {
- /* prepare the file */
- $tmpname = app()->config['DATA_PATH'].'/tmp/'.randomName();
- move_uploaded_file($_FILES['upload']['tmp_name'],$tmpname);
- $_SESSION['user']['u']['tmp']=$tmpname;
- $_SESSION['user']['u']['mime']=$_FILES['upload']['type'];
- $_SESSION['user']['u']['name']=$_FILES['upload']['name'];
- $_SESSION['user']['u']['size']=$_FILES['upload']['size'];
- $_SESSION['user']['u']['ip']=$_SERVER['REMOTE_ADDR'];
- $_SESSION['user']['u']['user_id']=app()->user->info('id');
- $this->nextStep(app()->step);
+ if ($_FILES['upload']['error']>0) {
+ switch ($_FILES['upload']['error']) { /* taken from here: http://it.php.net/manual/en/features.file-upload.errors.php */
+ case 1: app()->error(tr('Maximum upload size for site wide configuration reached')); break;
+ case 2: app()->error(tr('File is too big!')); break;
+ case 3: app()->error(tr('Partial file transfer error!')); break;
+ case 4: app()->error(tr('No file was uploaded!')); break;
+ case 6: app()->error(tr('Missing temporary directory')); break;
+ case 7: app()->error(tr('Can\'t write to temporary diretory!')); break;
+ case 8: app()->error(tr('Upload blocked by extension!')); break;
+ default:
+ app()->error(tr('Upload failed for Unknonw error code: %1',$_FILES['upload']['error'])); break;
+ }
+ $this->nextStep(1);
+ } else {
+ /* prepare the file */
+ $tmpname = app()->config['DATA_PATH'].'/tmp/'.randomName();
+ move_uploaded_file($_FILES['upload']['tmp_name'],$tmpname);
+ $_SESSION['user']['u']['tmp']=$tmpname;
+ $_SESSION['user']['u']['mime']=$_FILES['upload']['type'];
+ $_SESSION['user']['u']['name']=$_FILES['upload']['name'];
+ $_SESSION['user']['u']['size']=$_FILES['upload']['size'];
+ $_SESSION['user']['u']['ip']=$_SERVER['REMOTE_ADDR'];
+ $_SESSION['user']['u']['user_id']=app()->user->info('id');
+ $this->nextStep(app()->step);
+ }
} else if (!isset($_SESSION['user']['u'])) {
redirect();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 12:49:07
|
Revision: 38
http://openupload.svn.sourceforge.net/openupload/?rev=38&view=rev
Author: tsdogs
Date: 2008-10-18 12:48:58 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Add login name check and fix login name length
Modified Paths:
--------------
trunk/lib/modules/default/auth.inc.php
Modified: trunk/lib/modules/default/auth.inc.php
===================================================================
--- trunk/lib/modules/default/auth.inc.php 2008-10-18 11:49:03 UTC (rev 37)
+++ trunk/lib/modules/default/auth.inc.php 2008-10-18 12:48:58 UTC (rev 38)
@@ -106,7 +106,12 @@
}
if (strlen($_POST['registerlogin'])<5) {
app()->error(tr('Login name must be at least 5 characters long!'));
+ $failed = true;
}
+ if (ereg_replace('[a-zA-Z0-9_]*','',$_POST['registerlogin'])!='') {
+ app()->error(tr('Login name contains an invalid character. Valid vharacters are %1','[a-z] [0-9] [_]'));
+ $failed = true;
+ }
if ($_POST['registername']=='') {
app()->error(tr('Please insert Full Name'));
$failed = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 11:49:12
|
Revision: 37
http://openupload.svn.sourceforge.net/openupload/?rev=37&view=rev
Author: tsdogs
Date: 2008-10-18 11:49:03 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
updated
Modified Paths:
--------------
trunk/TODO
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-18 11:48:45 UTC (rev 36)
+++ trunk/TODO 2008-10-18 11:49:03 UTC (rev 37)
@@ -26,9 +26,13 @@
File administration and maintainence
Plugin administration
-ADMIN (missint)
+ADMIN (missing)
Config administration
First setup script
+Banned IP amdinistration
+Rights switch mode (to switch from 1 mode to the other)
+Rights better admin tool.
+Language table admin.
Plugin options
ACL
@@ -39,6 +43,7 @@
PLUGINS
Plugin configuration options
+banned ip probably is better in the main app and not as a plugin.
(Following are some ideas)
Upload different filesize limiting depending on group
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 11:48:53
|
Revision: 36
http://openupload.svn.sourceforge.net/openupload/?rev=36&view=rev
Author: tsdogs
Date: 2008-10-18 11:48:45 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Make the requested url the default redirect after login
Modified Paths:
--------------
trunk/lib/main.inc.php
trunk/lib/modules/default/auth.inc.php
trunk/lib/user.inc.php
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-18 11:23:05 UTC (rev 35)
+++ trunk/lib/main.inc.php 2008-10-18 11:48:45 UTC (rev 36)
@@ -299,9 +299,12 @@
$this->display($this->mainPage);
exit(0);
} else {
+ /* save the requested url */
redirect('?action=login');
}
- }
+ }
+ if ($_SERVER['QUERY_STRING']!='')
+ $_SESSION['requested_url']='?'.$_SERVER['QUERY_STRING'];
redirect();
}
$this->initPlugins();
Modified: trunk/lib/modules/default/auth.inc.php
===================================================================
--- trunk/lib/modules/default/auth.inc.php 2008-10-18 11:23:05 UTC (rev 35)
+++ trunk/lib/modules/default/auth.inc.php 2008-10-18 11:48:45 UTC (rev 36)
@@ -68,7 +68,12 @@
return false; /* never reached */
}
/* authentication was successfull */
- redirect();
+ $url = '';
+ if (isset($_SESSION['requested_url'])) {
+ $url = $_SESSION['requested_url'];
+ unset($_SESSION['requested_url']);
+ }
+ redirect($url);
}
function logout() {
Modified: trunk/lib/user.inc.php
===================================================================
--- trunk/lib/user.inc.php 2008-10-18 11:23:05 UTC (rev 35)
+++ trunk/lib/user.inc.php 2008-10-18 11:48:45 UTC (rev 36)
@@ -81,7 +81,7 @@
/* retrieve user info */
$_SESSION['user'] = $this->auth->info($username);;
/* make the post not be resent on refresh */
- redirect();
+ return true;
} else {
// set the error message for the login
app()->error(tr('Login incorrect!'));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 11:23:15
|
Revision: 35
http://openupload.svn.sourceforge.net/openupload/?rev=35&view=rev
Author: tsdogs
Date: 2008-10-18 11:23:05 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
add file ID info in e-mail message
Modified Paths:
--------------
trunk/templates/default/plugins/email/notify.tpl
Modified: trunk/templates/default/plugins/email/notify.tpl
===================================================================
--- trunk/templates/default/plugins/email/notify.tpl 2008-10-18 11:03:43 UTC (rev 34)
+++ trunk/templates/default/plugins/email/notify.tpl 2008-10-18 11:23:05 UTC (rev 35)
@@ -6,6 +6,7 @@
{tr}You are receiving this message because someone uploaded a file on our OpenUpload server for you.{/tr}
+{tr}File ID{/tr}: {$finfo.id}
{tr}File name{/tr}: {$finfo.name}
{tr}File size{/tr}: {$finfo.size|fsize_format}
{tr}Description{/tr}: {$finfo.description}
@@ -87,6 +88,7 @@
<p>{tr}You are receiving this message because someone uploaded a file on our OpenUpload server for you.{/tr}</p>
<table border="0">
+<tr><td>{tr}File ID{/tr}:</td><td>{$finfo.id}</td></tr>
<tr><td>{tr}File name{/tr}:</td><td>{$finfo.name}</td></tr>
<tr><td>{tr}File size{/tr}:</td><td>{$finfo.size|fsize_format}</td></tr>
<tr><td>{tr}Description{/tr}:</td><td>{$finfo.description}</td></tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 11:03:52
|
Revision: 34
http://openupload.svn.sourceforge.net/openupload/?rev=34&view=rev
Author: tsdogs
Date: 2008-10-18 11:03:43 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Update database structure and different preconfigured rights modes.
Added Paths:
-----------
trunk/sql/mysql/1_structure.sql
trunk/sql/mysql/2_base.sql
trunk/sql/mysql/3_mode_private.sql
trunk/sql/mysql/3_mode_public.sql
trunk/sql/mysql/3_mode_restricted.sql
trunk/sql/mysql/3_mode_service.sql
Removed Paths:
-------------
trunk/sql/mysql/openupload.sql
Added: trunk/sql/mysql/1_structure.sql
===================================================================
--- trunk/sql/mysql/1_structure.sql (rev 0)
+++ trunk/sql/mysql/1_structure.sql 2008-10-18 11:03:43 UTC (rev 34)
@@ -0,0 +1,155 @@
+-- phpMyAdmin SQL Dump
+-- version 2.11.3deb1ubuntu1.1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generato il: 18 Ott, 2008 at 11:12 AM
+-- Versione MySQL: 5.0.51
+-- Versione PHP: 5.2.4-2ubuntu5.3
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+--
+-- Database: `openupload`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `acl`
+--
+
+CREATE TABLE IF NOT EXISTS `acl` (
+ `id` int(11) NOT NULL auto_increment,
+ `module` varchar(100) NOT NULL,
+ `action` varchar(100) NOT NULL,
+ `group_id` varchar(50) NOT NULL,
+ `access` varchar(10) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `banned`
+--
+
+CREATE TABLE IF NOT EXISTS `banned` (
+ `id` int(11) NOT NULL auto_increment,
+ `ip` varchar(50) NOT NULL,
+ `access` varchar(50) NOT NULL,
+ `priority` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `files`
+--
+
+CREATE TABLE IF NOT EXISTS `files` (
+ `id` varchar(100) NOT NULL,
+ `name` varchar(200) NOT NULL,
+ `mime` varchar(200) NOT NULL,
+ `description` tinytext NOT NULL,
+ `size` int(12) NOT NULL,
+ `remove` varchar(100) NOT NULL,
+ `user_id` int(11) NOT NULL,
+ `ip` varchar(40) NOT NULL,
+ `upload_date` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `file_options`
+--
+
+CREATE TABLE IF NOT EXISTS `file_options` (
+ `id` bigint(20) NOT NULL auto_increment,
+ `file_id` varchar(100) NOT NULL,
+ `module` varchar(50) NOT NULL,
+ `name` varchar(50) NOT NULL,
+ `value` varchar(200) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `file_id` (`file_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `groups`
+--
+
+CREATE TABLE IF NOT EXISTS `groups` (
+ `name` varchar(50) NOT NULL,
+ `description` varchar(250) default NULL,
+ PRIMARY KEY (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `langs`
+--
+
+CREATE TABLE IF NOT EXISTS `langs` (
+ `id` varchar(10) NOT NULL,
+ `name` varchar(100) NOT NULL,
+ `locale` varchar(10) NOT NULL,
+ `browser` varchar(200) default NULL,
+ `charset` varchar(50) NOT NULL,
+ `active` tinyint(1) NOT NULL default '1',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `plugin_acl`
+--
+
+CREATE TABLE IF NOT EXISTS `plugin_acl` (
+ `id` int(11) NOT NULL auto_increment,
+ `group_id` varchar(50) NOT NULL,
+ `plugin` varchar(100) NOT NULL,
+ `access` varchar(10) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `group_id` (`group_id`,`plugin`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `plugin_options`
+--
+
+CREATE TABLE IF NOT EXISTS `plugin_options` (
+ `id` int(11) NOT NULL auto_increment,
+ `plugin` varchar(100) NOT NULL,
+ `group_id` varchar(100) NOT NULL,
+ `option` varchar(100) NOT NULL,
+ `value` text,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
+
+-- --------------------------------------------------------
+
+--
+-- Struttura della tabella `users`
+--
+
+CREATE TABLE IF NOT EXISTS `users` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `login` varchar(100) NOT NULL,
+ `password` varchar(100) NOT NULL,
+ `name` varchar(200) NOT NULL,
+ `group_id` varchar(50) NOT NULL default 'unregistered',
+ `email` varchar(250) NOT NULL,
+ `lang` varchar(10) NOT NULL default 'en',
+ `active` tinyint(3) unsigned NOT NULL default '1',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `login` (`login`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
Added: trunk/sql/mysql/2_base.sql
===================================================================
--- trunk/sql/mysql/2_base.sql (rev 0)
+++ trunk/sql/mysql/2_base.sql 2008-10-18 11:03:43 UTC (rev 34)
@@ -0,0 +1,59 @@
+-- phpMyAdmin SQL Dump
+-- version 2.11.3deb1ubuntu1.1
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generato il: 18 Ott, 2008 at 11:15 AM
+-- Versione MySQL: 5.0.51
+-- Versione PHP: 5.2.4-2ubuntu5.3
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+--
+-- Database: `openupload`
+--
+
+--
+-- Dump dei dati per la tabella `banned`
+--
+
+INSERT INTO `banned` (`id`, `ip`, `access`, `priority`) VALUES(1, '127.0.0.1', 'allow', 1);
+INSERT INTO `banned` (`id`, `ip`, `access`, `priority`) VALUES(2, '0.0.0.0/0', 'allow', 9999999);
+
+--
+-- Dump dei dati per la tabella `groups`
+--
+
+INSERT INTO `groups` (`name`, `description`) VALUES('admins', 'Administrators group');
+INSERT INTO `groups` (`name`, `description`) VALUES('registered', 'Registered Users');
+INSERT INTO `groups` (`name`, `description`) VALUES('unregistered', 'Unregistered users');
+
+--
+-- Dump dei dati per la tabella `langs`
+--
+
+INSERT INTO `langs` (`id`, `name`, `locale`, `browser`, `charset`, `active`) VALUES('en', 'English', 'en_EN', '[en];[en-EN]', 'iso-8559-1', 1);
+INSERT INTO `langs` (`id`, `name`, `locale`, `browser`, `charset`, `active`) VALUES('it', 'Italiano', 'it_IT.utf8', '[it];[it-IT]', 'utf8', 1);
+
+--
+-- Dump dei dati per la tabella `users`
+--
+
+INSERT INTO `users` (`id`, `login`, `password`, `name`, `group_id`, `email`, `lang`, `active`) VALUES(1, 'admin', '$1$sLCQ3aFR$rCIb4Owhgi3mIHgYnbA351', 'Administrator', 'admins', 'ope...@yo...', 'en', 1);
+
+--
+-- Dump dei dati per la tabella `acl`
+--
+
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(1, '*', '*', 'admins', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(2, 'admin', '*', 'admins', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(3, 'admin', '*', '*', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(4, 'auth', 'login', 'unregistered', 'allow');
+
+--
+-- Dump dei dati per la tabella `plugin_acl`
+--
+
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(1, 'admins', 'password', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(2, 'admins', 'captcha', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(3, 'admins', 'email', 'enable');
Added: trunk/sql/mysql/3_mode_private.sql
===================================================================
--- trunk/sql/mysql/3_mode_private.sql (rev 0)
+++ trunk/sql/mysql/3_mode_private.sql 2008-10-18 11:03:43 UTC (rev 34)
@@ -0,0 +1,16 @@
+--
+-- Dump dei dati per la tabella `acl`
+--
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(5, 'auth', 'register', '*', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(6, 'auth', '*', 'unregistered', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(7, 'auth', '*', '*', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(8, 'files', '*', 'unregistered', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(9, 'files', '*', '*', 'allow');
+
+--
+-- Dump dei dati per la tabella `plugin_acl`
+--
+
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(4, 'registered', 'password', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(5, 'registered', 'captcha', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(6, 'registered', 'email', 'enable');
\ No newline at end of file
Added: trunk/sql/mysql/3_mode_public.sql
===================================================================
--- trunk/sql/mysql/3_mode_public.sql (rev 0)
+++ trunk/sql/mysql/3_mode_public.sql 2008-10-18 11:03:43 UTC (rev 34)
@@ -0,0 +1,14 @@
+--
+-- Dump dei dati per la tabella `acl`
+--
+
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(5, 'auth', '*', '*', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(6, 'files', '*', '*', 'allow');
+
+--
+-- Dump dei dati per la tabella `plugin_acl`
+--
+
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(4, 'unregistered', 'password', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(5, 'unregistered', 'captcha', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(6, 'unregistered', 'email', 'enable');
Added: trunk/sql/mysql/3_mode_restricted.sql
===================================================================
--- trunk/sql/mysql/3_mode_restricted.sql (rev 0)
+++ trunk/sql/mysql/3_mode_restricted.sql 2008-10-18 11:03:43 UTC (rev 34)
@@ -0,0 +1,18 @@
+--
+-- Dump dei dati per la tabella `acl`
+--
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(5, 'auth', 'register', '*', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(6, 'auth', '*', 'unregistered', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(7, 'auth', '*', '*', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(8, 'files', 'd', 'unregistered', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(9, 'files', 'g', 'unregistered', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(10, 'files', '*', 'unregistered', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(11, 'files', '*', '*', 'allow');
+
+--
+-- Dump dei dati per la tabella `plugin_acl`
+--
+
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(4, 'registered', 'password', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(5, 'registered', 'captcha', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(6, 'registered', 'email', 'enable');
Added: trunk/sql/mysql/3_mode_service.sql
===================================================================
--- trunk/sql/mysql/3_mode_service.sql (rev 0)
+++ trunk/sql/mysql/3_mode_service.sql 2008-10-18 11:03:43 UTC (rev 34)
@@ -0,0 +1,19 @@
+--
+-- Dump dei dati per la tabella `acl`
+--
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(5, 'auth', 'register', 'unregistered', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(6, 'auth', '*', 'unregistered', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(7, 'auth', 'register', '*', 'deny');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(8, 'auth', '*', '*', 'allow');
+INSERT INTO `acl` (`id`, `module`, `action`, `group_id`, `access`) VALUES(9, 'files', '*', '*', 'allow');
+
+--
+-- Dump dei dati per la tabella `plugin_acl`
+--
+
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(4, 'registered', 'password', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(5, 'registered', 'captcha', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(6, 'registered', 'email', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(7, 'unregistered', 'mimetypes', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(8, 'unregistered', 'captcha', 'enable');
+INSERT INTO `plugin_acl` (`id`, `group_id`, `plugin`, `access`) VALUES(9, 'unregistered', 'password', 'enable');
Deleted: trunk/sql/mysql/openupload.sql
===================================================================
--- trunk/sql/mysql/openupload.sql 2008-10-18 11:02:31 UTC (rev 33)
+++ trunk/sql/mysql/openupload.sql 2008-10-18 11:03:43 UTC (rev 34)
@@ -1,267 +0,0 @@
--- MySQL dump 10.11
---
--- Host: localhost Database: openupload_empty
--- ------------------------------------------------------
--- Server version 5.0.51a-3ubuntu5.3
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Table structure for table `acl`
---
-
-DROP TABLE IF EXISTS `acl`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `acl` (
- `module` varchar(100) NOT NULL,
- `action` varchar(100) NOT NULL,
- `group_id` varchar(50) NOT NULL,
- `access` varchar(10) NOT NULL,
- PRIMARY KEY (`module`,`action`,`group_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `acl`
---
-
-LOCK TABLES `acl` WRITE;
-/*!40000 ALTER TABLE `acl` DISABLE KEYS */;
-INSERT INTO `acl` VALUES ('*','*','admins','allow'),('admin','*','unregisterd','deny'),('admin','*','registered','deny'),('files','*','unregistered','allow'),('files','*','registered','allow'),('auth','*','registered','allow'),('auth','*','unregistered','allow'),('auth','register','*','deny'),('auth','register','unregistered','deny'),('auth','login','*','deny'),('auth','login','unregistered','allow'),('auth','logout','unregistered','deny'),('auth','logout','*','allow');
-/*!40000 ALTER TABLE `acl` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `banned`
---
-
-DROP TABLE IF EXISTS `banned`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `banned` (
- `id` int(11) NOT NULL auto_increment,
- `ip` varchar(50) NOT NULL,
- `access` varchar(50) NOT NULL,
- `priority` int(11) NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `banned`
---
-
-LOCK TABLES `banned` WRITE;
-/*!40000 ALTER TABLE `banned` DISABLE KEYS */;
-INSERT INTO `banned` VALUES (2,'0.0.0.0/0','allow',9999999),(1,'127.0.0.1','allow',1);
-/*!40000 ALTER TABLE `banned` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `file_options`
---
-
-DROP TABLE IF EXISTS `file_options`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `file_options` (
- `id` bigint(20) NOT NULL auto_increment,
- `file_id` varchar(100) NOT NULL,
- `module` varchar(50) NOT NULL,
- `name` varchar(50) NOT NULL,
- `value` varchar(200) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `file_id` (`file_id`)
-) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `file_options`
---
-
-LOCK TABLES `file_options` WRITE;
-/*!40000 ALTER TABLE `file_options` DISABLE KEYS */;
-/*!40000 ALTER TABLE `file_options` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `files`
---
-
-DROP TABLE IF EXISTS `files`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `files` (
- `id` varchar(100) NOT NULL,
- `name` varchar(200) NOT NULL,
- `mime` varchar(200) NOT NULL,
- `description` tinytext NOT NULL,
- `size` int(12) NOT NULL,
- `remove` varchar(100) NOT NULL,
- `user_id` int(11) NOT NULL,
- `upload_date` datetime NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `files`
---
-
-LOCK TABLES `files` WRITE;
-/*!40000 ALTER TABLE `files` DISABLE KEYS */;
-/*!40000 ALTER TABLE `files` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `groups`
---
-
-DROP TABLE IF EXISTS `groups`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `groups` (
- `name` varchar(50) NOT NULL,
- `description` varchar(250) default NULL,
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `groups`
---
-
-LOCK TABLES `groups` WRITE;
-/*!40000 ALTER TABLE `groups` DISABLE KEYS */;
-INSERT INTO `groups` VALUES ('admins','Administrators group'),('registered','Registered Users'),('unregistered','Unregistered users');
-/*!40000 ALTER TABLE `groups` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `langs`
---
-
-DROP TABLE IF EXISTS `langs`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `langs` (
- `id` varchar(10) NOT NULL,
- `name` varchar(100) NOT NULL,
- `locale` varchar(10) NOT NULL,
- `browser` varchar(200) default NULL,
- `charset` varchar(50) NOT NULL,
- `active` tinyint(1) NOT NULL default '1',
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `langs`
---
-
-LOCK TABLES `langs` WRITE;
-/*!40000 ALTER TABLE `langs` DISABLE KEYS */;
-INSERT INTO `langs` VALUES ('en','English','en_EN','[en];[en_EN]','iso-8559-1',1),('it','Italiano','it_IT.utf8','[it];[it_IT]','iso-8559-1',1);
-/*!40000 ALTER TABLE `langs` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `plugin_acl`
---
-
-DROP TABLE IF EXISTS `plugin_acl`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `plugin_acl` (
- `group_id` varchar(50) NOT NULL,
- `plugin` varchar(100) NOT NULL,
- `access` varchar(10) NOT NULL,
- PRIMARY KEY (`group_id`,`plugin`,`access`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `plugin_acl`
---
-
-LOCK TABLES `plugin_acl` WRITE;
-/*!40000 ALTER TABLE `plugin_acl` DISABLE KEYS */;
-INSERT INTO `plugin_acl` VALUES ('admins','captcha','enable'),('admins','email','enable'),('admins','password','enable'),('registered','captcha','enable'),('registered','email','enable'),('registered','password','enable'),('unregistered','captcha','enable'),('unregistered','mimetypes','enable'),('unregistered','password','disable');
-/*!40000 ALTER TABLE `plugin_acl` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `plugin_oprions`
---
-
-DROP TABLE IF EXISTS `plugin_oprions`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `plugin_oprions` (
- `plugin` varchar(100) NOT NULL,
- `group_id` varchar(100) NOT NULL,
- `option` varchar(100) NOT NULL,
- `value` varchar(100) NOT NULL,
- PRIMARY KEY (`plugin`,`group_id`,`option`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `plugin_oprions`
---
-
-LOCK TABLES `plugin_oprions` WRITE;
-/*!40000 ALTER TABLE `plugin_oprions` DISABLE KEYS */;
-/*!40000 ALTER TABLE `plugin_oprions` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `users`
---
-
-DROP TABLE IF EXISTS `users`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `users` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `login` varchar(100) NOT NULL,
- `password` varchar(100) NOT NULL,
- `name` varchar(200) NOT NULL,
- `group_id` varchar(50) NOT NULL default 'unregistered',
- `email` varchar(250) NOT NULL,
- `active` tinyint(3) unsigned NOT NULL default '1',
- PRIMARY KEY (`id`),
- KEY `login` (`login`)
-) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='MyShare Users';
-SET character_set_client = @saved_cs_client;
-
---
--- Dumping data for table `users`
---
-
-LOCK TABLES `users` WRITE;
-/*!40000 ALTER TABLE `users` DISABLE KEYS */;
-INSERT INTO `users` VALUES (1,'admin','$1$IGgMd3Qo$f06LS1O.VmX57A18CkSuD1','Administrator','admins','ad...@yo...',1);
-/*!40000 ALTER TABLE `users` ENABLE KEYS */;
-UNLOCK TABLES;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2008-10-15 13:13:57
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-18 11:02:33
|
Revision: 33
http://openupload.svn.sourceforge.net/openupload/?rev=33&view=rev
Author: tsdogs
Date: 2008-10-18 11:02:31 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
fix a redirection loop when default action is not allowed.
Modified Paths:
--------------
trunk/lib/main.inc.php
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-17 18:24:09 UTC (rev 32)
+++ trunk/lib/main.inc.php 2008-10-18 11:02:31 UTC (rev 33)
@@ -285,6 +285,23 @@
$group = $this->user->group();
if ($this->checkACL($group,$mname,$this->action)!='allow') {
+ if ($this->config['defaultaction']==$this->action) {
+ /* this is the default action, but the user does not have permissions on it */
+ /* check if login is allowed (it should always be */
+ if ($this->checkACL($group,'auth','login')!='allow') {
+ /* Login is not allowed there is an error, display the default page with a warning */
+ $this->tpl->assign('user',$this->user->info());
+ $this->tpl->assign('langs',$this->langs);
+ unset($_SESSION['user']['messages']);
+ unset($_SESSION['user']['errors']);
+ $this->page['content']=tr('THERE HAS BEEN A PERMISSION ERROR. PLEASE TRY ONE OF THE ALLOWED OPTIONS!');
+ $this->tpl->assign('page',$this->page);
+ $this->display($this->mainPage);
+ exit(0);
+ } else {
+ redirect('?action=login');
+ }
+ }
redirect();
}
$this->initPlugins();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-17 18:24:13
|
Revision: 32
http://openupload.svn.sourceforge.net/openupload/?rev=32&view=rev
Author: tsdogs
Date: 2008-10-17 18:24:09 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
Enable debug_acl to put information when it should deny (with $CONFIG['debug_acl']=true)
Modified Paths:
--------------
trunk/lib/main.inc.php
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-17 18:21:54 UTC (rev 31)
+++ trunk/lib/main.inc.php 2008-10-17 18:24:09 UTC (rev 32)
@@ -248,7 +248,7 @@
echo '<pre>ACL: '.$result.' - group: '.$group.', module: '.$module.', action: '.$action."\n";
print_r($this->acl);
echo '</pre>';
- exit;
+ $result = 'allow';
}
return $result;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-17 18:21:56
|
Revision: 31
http://openupload.svn.sourceforge.net/openupload/?rev=31&view=rev
Author: tsdogs
Date: 2008-10-17 18:21:54 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
Fix language detection init order.
Modified Paths:
--------------
trunk/lib/main.inc.php
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-17 18:12:38 UTC (rev 30)
+++ trunk/lib/main.inc.php 2008-10-17 18:21:54 UTC (rev 31)
@@ -68,11 +68,6 @@
$this->user->setInfo('lang',$_GET['lang']);
}
- $this->tr->init();
- $this->auth->init();
- $this->user->init();
-
-
/* configure the language */
if ($this->user->info('lang')=='') {
$lang = $this->getBrowserLang();
@@ -80,6 +75,10 @@
$this->user->setInfo('lang',$lang);
}
+ $this->tr->init();
+ $this->auth->init();
+ $this->user->init();
+
$this->config['modules'][]='files';
$this->config['modules'][]='admin';
$this->config['modules'][]='auth';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-17 18:12:47
|
Revision: 30
http://openupload.svn.sourceforge.net/openupload/?rev=30&view=rev
Author: tsdogs
Date: 2008-10-17 18:12:38 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
Add mailing list info
Modified Paths:
--------------
web/index.html
Modified: web/index.html
===================================================================
--- web/index.html 2008-10-17 18:08:10 UTC (rev 29)
+++ web/index.html 2008-10-17 18:12:38 UTC (rev 30)
@@ -110,6 +110,7 @@
<ul>
<LI><a href=""><a href="http://sourceforge.net/project/screenshots.php?group_id=242018&ssid=92531" target="_new">Screenshots</a></LI>
<LI><a href="http://sourceforge.net/project/showfiles.php?group_id=242018" target="_new">Download</a></LI>
+<LI><a href="http://sourceforge.net/mail/?group_id=242018" target="_new">Mailing lists</a></LI>
<LI><a href="http://openupload.svn.sourceforge.net/viewvc/openupload/" target="_new">SVN Code</a></LI>
<LI><a href="http://www.sourceforge.net/projects/openupload">SF.Net Project Page</a></LI>
</ul>
@@ -141,6 +142,12 @@
<div id="text">No release is available for now, check out svn for an overview.</div>
</div>
<div id="section">
+<div id="title">Mailing lists</div>
+<div id="text">There are 2 mailing lists now. 1 for svn commit traking, and one open for general discussion.<br>
+To report bugs, get support, or simply let me know how you are using this software
+<a href="https://lists.sourceforge.net/lists/listinfo/openupload-devel">click here</a>.</div>
+</div>
+<div id="section">
<div id="title">SVN</div>
<div id="text">To checkout svn:<br>
<pre>svn co https://openupload.svn.sourceforge.net/svnroot/openupload/trunk openupload</pre>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-17 18:08:13
|
Revision: 29
http://openupload.svn.sourceforge.net/openupload/?rev=29&view=rev
Author: tsdogs
Date: 2008-10-17 18:08:10 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
Reimplement the database api and fix accordingly, split the user from the classes, some other fixes
Modified Paths:
--------------
trunk/TODO
trunk/lib/classes.inc.php
trunk/lib/general.inc.php
trunk/lib/main.inc.php
trunk/lib/modules/auth/default.inc.php
trunk/lib/modules/db/mysql.inc.php
trunk/lib/modules/default/admin.inc.php
trunk/lib/modules/default/auth.inc.php
trunk/lib/modules/default/files.inc.php
trunk/lib/modules/tr/array.inc.php
trunk/lib/modules/tr/gettext.inc.php
trunk/plugins/banned.inc.php
Added Paths:
-----------
trunk/data/tmp/
trunk/lib/user.inc.php
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/TODO 2008-10-17 18:08:10 UTC (rev 29)
@@ -9,26 +9,30 @@
Moderation of registrations by admin
USER
-Manage profile (password/Name/E-Mail change)
+Manage profile (password/Name/E-Mail change) done 2008.10.16
Manage personal files (if allowed)
DATABASE
+Review DB module functions done 2008.10.17
Implement pgsql module
-Additional tables for txt module, needs a review.
+Additional tables for txt module, needs a review 'cause of db api change.
AUTHENTICATION
LDAP authentication (with OpenLdap and AD) mainly
-ADMIN
+ADMIN (mainly done 2008.10.16, though it needs a major revision)
User administration
Group administration
File administration and maintainence
+Plugin administration
+
+ADMIN (missint)
Config administration
-Plugin administration
First setup script
+Plugin options
ACL
-User/Group acl for modules and plugins: partially done 2008.10
+User/Group acl for modules and plugins: done 2008.10.16
DOWNLOAD
Fix double click on no blockings for download
@@ -36,18 +40,18 @@
PLUGINS
Plugin configuration options
-(Followings are some ideas)
+(Following are some ideas)
Upload different filesize limiting depending on group
Download bandwith limiting depending on group (of upload user probably better)
Download wait time (is this really needed?)
-User additional fields fot registration request.
+User additional fields for registration request.
Antivirus on upload
Deletion timeout (should it be a plugin? Maybe only for user interaction on it)
TRANSLATIONS (gettext/array)
-Complete implementation: done 2008.10
-Translate to italian: done 2008.10
-Add a database translator?
+Complete implementation: done 2008.10.14
+Translate to italian: in progress 2008.10
+Add a database translator? not until base isn't complete.
MAINTEINENCE
Create a script to clean up the files/tmpfiles.
@@ -61,8 +65,8 @@
TERMS OF USE
-WEB SITE with Screen Shots
+WEB SITE with Screen Shots. basic are up 2008.10
-SVN setup
+SVN setup. done 2008.10
-RELEASE
+RELEASE: not until api and db are not definitive.
Modified: trunk/lib/classes.inc.php
===================================================================
--- trunk/lib/classes.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/classes.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -11,6 +11,7 @@
}
class authBase {
+var $features = array();
function authBase() {
}
@@ -20,7 +21,7 @@
class dbBase {
- function dbBase() {
+ function dbBase($config = array()) {
}
@@ -28,118 +29,42 @@
}
- function addFile($info = array()) {
+ function newId($tbl,$field = 'id',$keys = array ()) {
+ app()->error('Please reimplement: '.$this->name.' newId');
+ return 0;
}
- function addFileOption($info = array(),$module,$field) {
+ function newRandomId($tbl,$field = 'id') {
+ app()->error('Please reimplement: '.$this->name.' newRandomId');
+ $id = randomName(30,30);
+ return $id;
}
- function removeFile($id) {
+ function count($tbl,$keys = array()) {
+ app()->error('Please reimplement: '.$this->name.' count');
+ return 0;
}
-
- function getFileInfo($id = 0) {
+
+ function read($tbl,$keys = array(), $sort = array(), $limit = '', $assoc = array()) {
+ app()->error('Please reimplement: '.$this->name.' read');
return array();
}
-
- function userInfo($login) {
- return array();
- }
-
- function addUser($info) {
- }
-
- function deleteUser($login) {
- }
-}
-
-class User {
- function User() {
+ function insert($tbl,$values,$fields = array()) {
+ app()->error('Please reimplement: '.$this->name.' insert');
+ return false;
}
- function init() {
- $this->auth = app()->auth;
- /* setup the user if not yet done */
- }
-
- function logout() {
- global $_SESSION;
-
- $messages = $_SESSION['user']['messages'];
- $errors = $_SESSION['user']['errors'];
- unset($_SESSION['user']);
- $_SESSION['user']['messages'] = $messages;
- $_SESSION['user']['errors'] = $errors;
- redirect('?action=login');
- }
-
- function loggedin() {
- global $_SESSION;
- if (isset($_SESSION['user']['login']) and $_SESSION['user']['login']!='') {
- return true;
- }
+ function update($tbl,$values,$keys = array(),$fields = array()) {
+ app()->error('Please reimplement: '.$this->name.' update');
return false;
}
-
- function userInfo($field = '') {
- if ($field != '') {
- return $_SESSION['user'][$field];
- } else {
- return $_SESSION['user'];
- }
- }
- function userGroup() {
- if ($this->userInfo('group_id')!='')
- $group = $this->userInfo('group_id');
- else
- $group = app()->config['register']['nologingroup'];
- return $group;
- }
-
- function setUserInfo($user) {
- $_SESSION['user']=$user;
- }
-
- function authenticate() {
- global $_SESSION;
- global $_GET;
- global $_POST;
-
- /* logout if requested */
- if (isset($_GET['logout'])) {
- $this->logout();
- }
-
- /* if already authenticated return */
- if ($this->loggedin())
- return true;
-
- // if it's logging in save user and pwd
- if (isset($_POST['username'])) {
- $username = $_POST['username'];
- $password = $_POST['pwd'];
- }
-
-
- if ($username != '') {
- // use the default authentication method
- $res = $this->auth->authenticate($username,$password);
- if ($res) {
- $_SESSION['user']['login']=$username;
- /* retrieve user info */
- $info = $this->auth->userinfo($username);
- //unset($info['password']);
- $_SESSION['user'] = $info;
- /* make the post not be resent on refresh */
- redirect();
- } else {
- // set the error message for the login
- app()->error(tr('Login incorrect!'));
- }
- }
+ function delete($tbl,$keys = array()) {
+ app()->error('Please reimplement: '.$this->name.' delete');
return false;
}
+
}
class OpenUploadModule {
Modified: trunk/lib/general.inc.php
===================================================================
--- trunk/lib/general.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/general.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -7,6 +7,7 @@
define('SMARTY_DIR', $CONFIG['INSTALL_ROOT'].'/lib/smarty/');
require(SMARTY_DIR . 'Smarty.class.php');
require_once($CONFIG['INSTALL_ROOT'].'/lib/classes.inc.php');
+require_once($CONFIG['INSTALL_ROOT'].'/lib/user.inc.php');
require_once($CONFIG['INSTALL_ROOT'].'/lib/main.inc.php');
/* check if the selected template needs personalizations code of some sort */
@@ -30,6 +31,7 @@
//echo 'redirect '.$url; exit;
/* there might be problems with urls containing other urls but this is not my case
anyway! */
+//echo '<pre>'; print_r( debug_backtrace()); echo '</pre>'; exit();
if (strpos('http://',$url)===FALSE and strpos('https://',$url)===FALSE) {
header('location: '.$_SERVER['PHP_SELF'].$url);
} else {
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/main.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -33,8 +33,8 @@
$dbtype = $this->config['database']['type'];
require_once($this->config['INSTALL_ROOT'].'/lib/modules/db/'.$dbtype.'.inc.php');
$dbmname = $dbtype.'DB';
- $this->db = new $dbmname();
- $this->db->init($this->config['database']['prefix']);
+ $this->db = new $dbmname($this->config['database']);
+ $this->db->init(); /* open db connection */
/* authentication module */
if (isset($this->config['auth'])) {
@@ -46,7 +46,8 @@
$auth = $authmname.'Auth';
$this->auth = new $auth();
- $this->user = new User();
+ $this->user = new OpenUploadUser();
+ $this->user->auth = &$this->auth;
/* translation module */
if (isset($this->config['translator'])) {
@@ -58,27 +59,27 @@
$tr = $trname.'Translator';
$this->tr = new $tr();
- $this->langs = $this->db->loadTable('langs','','','id');
+ $this->langs = $this->db->read('langs',array(),array('id'),'',array('id'));
/* check if it was forced */
if (isset($_GET['lang'])) {
- $user = $this->user->userInfo();
+ $user = $this->user->info();
$user['lang']=$_GET['lang'];
- $this->user->setUserInfo($user);
+ $this->user->setInfo('lang',$_GET['lang']);
}
+ $this->tr->init();
+ $this->auth->init();
+ $this->user->init();
+
+
/* configure the language */
- if ($this->user->userInfo('lang')=='') {
+ if ($this->user->info('lang')=='') {
$lang = $this->getBrowserLang();
- $user = $this->user->userInfo();
- $user['lang']=$lang;
- $this->user->setUserInfo($user);
+ $user = $this->user->info();
+ $this->user->setInfo('lang',$lang);
}
- $this->tr->init();
- $this->auth->init();
- $this->user->init();
-
$this->config['modules'][]='files';
$this->config['modules'][]='admin';
$this->config['modules'][]='auth';
@@ -163,7 +164,7 @@
foreach ($this->modules as $m) {
foreach ($m->actions as $k => $a) {
if (isset($m->menu[$k])) {
- $group = app()->user->userGroup();
+ $group = app()->user->group();
if ($this->checkACL($group,$m->name,$k) == 'allow') {
$this->menu[$k]=$m->menu[$k];
}
@@ -206,7 +207,7 @@
/* check plugin acl */
$acl = 'disable'; /* disabled by default */
if (isset($this->pluginAcl[$plugin->name])) {
- $acl = $this->pluginAcl[$plugin->name];
+ $acl = $this->pluginAcl[$plugin->name]['access'];
}
if (!$plugin->$action($finfo,$acl)) {
if ($stop) return false;
@@ -220,30 +221,36 @@
function loadACL() {
/* loads the acl from the db */
- $group = $this->user->userGroup();
- $this->acl = $this->db->loadACL($group);
- $this->pluginAcl = $this->db->loadPluginAcl($group);
+ $group = $this->user->group();
+ $this->acl = array_merge($this->db->read('acl',array('group_id' => $group),array('module','action'),'',
+ array('group_id','module','action')),
+ $this->db->read('acl',array('group_id' => '*'),array('module','action'),'',
+ array('group_id','module','action')));
+ $this->pluginAcl = $this->db->read('plugin_acl',array('group_id' => $group),array('plugin'),'',array('plugin'));
}
function checkACL($group,$module,$action) {
$result = 'deny'; /* not defined are denyed by default */
if (isset($this->acl[$group][$module][$action])) {
- $result = $this->acl[$group][$module][$action];
+ $result = $this->acl[$group][$module][$action]['access'];
} else if (isset($this->acl[$group][$module]['*'])) {
- $result = $this->acl[$group][$module]['*'];
+ $result = $this->acl[$group][$module]['*']['access'];
} else if (isset($this->acl[$group]['*']['*'])) {
- $result = $this->acl[$group]['*']['*'];
+ $result = $this->acl[$group]['*']['*']['access'];
} else if (isset($this->acl['*'][$module][$action])) {
$result = $this->acl['*'][$module][$action];
} else if (isset($this->acl['*'][$module]['*'])) {
- $result = $this->acl['*'][$module]['*'];
+ $result = $this->acl['*'][$module]['*']['access'];
} else if (isset($this->acl['*']['*']['*'])) {
- $result = $this->acl['*']['*']['*']; /* this should be avoided imho */
+ $result = $this->acl['*']['*']['*']['access']; /* this should be avoided imho */
}
if ($this->config['debug_acl'] and $result == 'deny') {
- echo 'group: '.$group.'<br>'; print_r($this->acl); exit;
- }
+ echo '<pre>ACL: '.$result.' - group: '.$group.', module: '.$module.', action: '.$action."\n";
+ print_r($this->acl);
+ echo '</pre>';
+ exit;
+ }
return $result;
}
@@ -276,7 +283,7 @@
/* get the handling module */
$mname = $this->actions[$this->action];
$m = &$this->modules[$mname];
- $group = $this->user->userGroup();
+ $group = $this->user->group();
if ($this->checkACL($group,$mname,$this->action)!='allow') {
redirect();
@@ -300,7 +307,7 @@
$m->$fun();
/* now display the final page */
- $this->tpl->assign('user',$this->user->userInfo());
+ $this->tpl->assign('user',$this->user->info());
$this->tpl->assign('langs',$this->langs);
unset($_SESSION['user']['messages']);
unset($_SESSION['user']['errors']);
Modified: trunk/lib/modules/auth/default.inc.php
===================================================================
--- trunk/lib/modules/auth/default.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/modules/auth/default.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -1,8 +1,12 @@
<?php
/* use the db to Authenticate users */
class defaultAuth extends authBase {
-
+var $db;
+var $userfields;
+
function defaultAuth() {
+ $this->userfields = array('id','login','password','name','group_id','email','lang','active');
+ $this->features = array('info','add', 'update', 'delete');
}
function init() {
@@ -10,22 +14,34 @@
}
function authenticate($login,$password) {
- $res = $this->db->queryUser($login);
- //echo crypt($password); exit;
- if ($res['login']==$login and crypt($password,$res['password'])==$res['password']) {
+ $res = $this->db->read('users',array('login' => $login, 'active' => 1));
+ $user = $res[0];
+ if ($user['login']==$login and crypt($password,$user['password'])==$user['password']) {
return true;
}
return false;
}
-
- function userInfo($login) {
- $result = $this->db->queryUser($login);
- return $result;
+
+ function info($login) {
+ $result = $this->db->read('users',array('login' => $login));
+ return $result[0];
}
- function addUser($user) {
+ function add($user) {
$user['password']=crypt($user['password']);
- $this->db->addUser($user);
+ $this->db->insert('users',$user,$this->userfields);
}
+
+ function update($user,$pwd = false) {
+ if ($pwd) {
+ $user['password']=crypt($user['password']);
+ }
+ $this->db->update('users',$user,array('id' => $user['id']),$this->userfields);
+ }
+
+ function delete($id) {
+ $this->db->delete('users',array('id' => $id));
+ }
}
+
?>
\ No newline at end of file
Modified: trunk/lib/modules/db/mysql.inc.php
===================================================================
--- trunk/lib/modules/db/mysql.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/modules/db/mysql.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -2,93 +2,43 @@
class mysqlDB extends dbBase {
var $db;
var $prefix;
+ var $config;
- function mysqlDB($prefix = '') {
- $this->prefix = $prefix;
+ function mysqlDB($config) {
+ $this->prefix = $config['prefix'];
+ $this->config = $config;
}
function init() {
/* connect to the database */
- mysql_connect(app()->config['database']['host'],app()->config['database']['user'],app()->config['database']['password'])
+ mysql_connect($this->config['host'],$this->config['user'],$this->config['password'])
or die(tr('ERROR: connection to database failed!'));
- $this->db = mysql_select_db(app()->config['database']['name']);// or die('ERROR: database could not be opened');
+ $this->db = mysql_select_db($this->config['name']);// or die('ERROR: database could not be opened');
}
- function getLang($lang) {
- $sql = 'select * from '.$this->prefix.'langs where id="'.$lang.'"';
- $res = mysql_query($sql);
- if (mysql_num_rows($res)>0) {
- $result = mysql_fetch_assoc($res);
- mysql_free_result($res);
- return $result;
- } else {
- return array();
- }
- }
- function queryUser($login,$active = true) {
-
- $sql = 'select * from '.$this->prefix.'users where login="'.mysql_real_escape_string($login).'"';
- if ($active) $sql .= ' and active=1';
- $res = mysql_query($sql);
- if (mysql_num_rows($res)>0) {
- $result = mysql_fetch_assoc($res);
- mysql_free_result($res);
- return $result;
- } else {
- return array();
+ function newId($tbl,$field = 'id',$keys = array ()) {
+ $sql = 'SELECT max('.$field.') as newid FROM '.$this->prefix.$tbl;
+ if (count($keys)>0) {
+ $where = '';
+ foreach ($keys as $k => $v) {
+ if ($where != '') $where .= ' AND ';
+ $where .= $k.'="'.(mysql_real_escape_string($v)).'"';
+ }
+ $sql .= ' WHERE '.$where;
}
- }
-
- function addUser($user) {
- $e = 'mysql_real_escape_string';
- $sql = 'insert into '.$this->prefix.'users (id,login,password,name,group_id,email,lang,active) values
- (NULL,"'.$e($user['login']).'","'.$e($user['password']).'","'.$e($user['name']).'","'.$e($user['group_id']).'","'
- .$e($user['email']).'","'.$e($user['lang']).'","'.$e($user['active']).'")';
- mysql_query($sql);
- }
-
- function updateUser($user) {
- $e = 'mysql_real_escape_string';
- $sql = 'update '.$this->prefix.'users set
- password="'.$e($user['password']).'",group_id="'.$e($user['group_id']).'",name="'.$e($user['name']).
- '",email="'.$e($user['email']).'",lang="'.$e($user['lang']).'",active="'.$e($user['active']).'"'.
- 'where login="'.$user['login'].'"';
- mysql_query($sql);
- }
-
- function deleteUser($login) {
- $e = 'mysql_real_escape_string';
- $sql = 'delete from '.$this->prefix.'users where login="'.$login.'"';
- mysql_query($sql);
- }
-
- function getFileInfo($id) {
- $sql = 'select * from '.$this->prefix.'files where id="'.mysql_real_escape_string($id).'"';
-
$res = mysql_query($sql);
- if (mysql_num_rows($res)==1) {
- $result = mysql_fetch_assoc($res);
- } else {
- $result = array();
- }
+ $newid = mysql_fetch_assoc($res);
mysql_free_result($res);
- /* now add the additional info */
- $sql = 'select name,value from '.$this->prefix.'file_options where file_id="'.mysql_real_escape_string($id).'"';
- $res = mysql_query($sql);
- while ($row = mysql_fetch_assoc($res)) {
- $result[$row['name']]=$row['value'];
- }
- mysql_free_result($res);
- return $result;
+ return $id['newid']+1;
}
-
- function newFileId($field = 'id') {
+
+ function newRandomId($tbl,$field = 'id') {
$found = true;
while ($found) {
$id = randomName(30,30);
- $sql = 'select '.$field.' from '.$this->prefix.'files where id="'.mysql_real_escape_string($id).'"';
+ $sql = 'SELECT '.$field.' FROM '.$this->prefix.$tbl.' WHERE '.$field.'="'.$id.'"';
$res = mysql_query($sql);
$found = mysql_num_rows($res)>0;
mysql_free_result($res);
@@ -96,112 +46,125 @@
return $id;
}
- function addFile(&$finfo) {
- $e = 'mysql_real_escape_string';
- $sql = 'insert into '.$this->prefix.'files (id,name,mime,description,size,remove,user_id,ip,upload_date)
- values ("'.$e($finfo['id']).'","'.$e($finfo['name']).'","'.$e($finfo['mime']).'","'.$e($finfo['description']).
- '","'.$e($finfo['size']).'","'.$e($finfo['remove']).'","'.$finfo['user_id'].'","'.$finfo['ip'].'",now())';
- /* now ask the plugins for additional options */
- mysql_query($sql);
- return $finfo['id'];
- }
-
- function addFileOption($finfo,$module,$field) {
- $sql = 'insert into '.$this->prefix.'file_options (id,file_id,module,name,value)
- values ("null","'.$finfo['id'].'","'.$module.'","'.$field.'","'.mysql_real_escape_string($finfo[$field]).'")';
- /* now ask the plugins for additional options */
- mysql_query($sql);
- }
-
- function removeFile($id) {
- $sql = 'delete '.$this->prefix.'file_options
- where file_id="'.mysql_real_escape_string($id).'"';
- mysql_query($sql);
- $sql = 'delete '.$this->prefix.'files
- where id="'.mysql_real_escape_string($id).'"';
- mysql_query($sql);
- }
-
- function loadAcl($group) {
- $sql = 'select * from '.$this->prefix.'acl where (group_id="'.$group.'" or group_id="*") order by group_id,module,action';
- $res = mysql_query($sql);
- $acl = array();
- while ($row = mysql_fetch_assoc($res)) {
- $acl[$row['group_id']][$row['module']][$row['action']]=$row['access'];
+ function count($tbl,$keys = array()) {
+ $sql = 'SELECT count(*) AS num FROM '.$this->prefix.$tbl;
+ if (count($keys)>0) {
+ $where = '';
+ foreach ($keys as $k => $v) {
+ if ($where != '') $where .= ' AND ';
+ $where .= $k.'="'.(mysql_real_escape_string($v)).'"';
+ }
+ $sql .= ' WHERE '.$where;
}
- mysql_free_result($res);
- return $acl;
- }
- function loadPluginAcl($group) {
- $sql = 'select plugin,access from '.$this->prefix.'plugin_acl where group_id="'.$group.'" group by plugin';
$res = mysql_query($sql);
- $plugins = array();
- while ($row = mysql_fetch_assoc($res)) {
- $plugins[$row['plugin']] = $row['access'];
- }
+ $row = mysql_fetch_assoc($res);
mysql_free_result($res);
- return $plugins;
+ return $row['num'];
}
- function loadTable($tbl,$sort = '',$limit = '',$key = '') {
- $sql = 'select * from '.$this->prefix.$tbl;
- if ($sort!='') $sql .= ' order by '.$sort;
- if ($limit!='') $sql .= ' limit '.$limit;
+ function read($tbl,$keys = array(), $sort = array(), $limit = '', $assoc = array()) {
+ $sql = 'SELECT * FROM '.$this->prefix.$tbl;
+ if (count($keys)>0) {
+ $where = '';
+ foreach ($keys as $k => $v) {
+ if ($where != '') $where .= ' AND ';
+ $where .= $k.'="'.(mysql_real_escape_string($v)).'"';
+ }
+ $sql .= ' WHERE '.$where;
+ }
+ if (count($sort)>0) {
+ $sorting = '';
+ foreach ($sort as $s) {
+ if ($sorting!='') $sorting.=',';
+ $sorting .= $s;
+ }
+ $sql .= ' ORDER BY '.$sorting;
+ }
+ if ($limit != '') {
+ $sql .= ' LIMIT '.$limit;
+ }
$res = mysql_query($sql);
$result = array();
while ($row = mysql_fetch_assoc($res)) {
- if ($key!='')
- $result[$row[$key]] = $row;
- else
+ if (count($assoc)) { /* maybe there is a better way to do this? */
+ $str = '$result';
+ foreach ($assoc as $k) {
+ $str .= '[\''.$row[$k].'\']';
+ }
+ $str .= '=$row;';
+ eval($str);
+ } else {
$result[] = $row;
+ }
}
mysql_free_result($res);
return $result;
}
- function getRecord($tbl,$key,$val) {
- $sql = 'select * from '.$this->prefix.$tbl.' where '.$key.'="'.$val.'"';
- $res = mysql_query($sql);
- $result = mysql_fetch_assoc($res);
+ function insert($tbl,$values,$fields = array()) {
+ $sql = 'INSERT INTO '.$this->prefix.$tbl;
+ $flist = '';
+ $vlist = '';
+ if (count($fields)>0) {
+ foreach ($fields as $f) {
+ if ($flist!='') $flist .= ',';
+ if ($vlist!='') $vlist .= ',';
+ $flist .= $f;
+ $vlist .= '"'.mysql_real_escape_string($values[$f]).'"';
+ }
+ } else {
+ foreach ($values as $k => $v) {
+ if ($flist!='') $flist .= ',';
+ if ($vlist!='') $vlist .= ',';
+ $flist .= $k;
+ $vlist .= '"'.mysql_real_escape_string($v).'"';
+ }
+ }
+ $sql .= ' ('.$flist.') VALUES ('.$vlist.')';
+echo $sql;
+ $res = mysql_query($sql);
mysql_free_result($res);
- return $result;
}
- function updateRecord($tbl,$vals,$key,$val) {
- $values = '';
-
- foreach ($vals as $k => $v) {
- if ($values != '') $values .= ',';
- $values .= $k.'="'.$v.'"';
+ function update($tbl,$values,$keys = array(),$fields = array()) {
+ $sql = 'UPDATE '.$this->prefix.$tbl;
+ $set = '';
+ if (count($fields)>0) {
+ foreach ($fields as $f) {
+ if ($set!='') $set .= ',';
+ $set .= $f.'="'.mysql_real_escape_string($values[$f]).'"';
+ }
+ } else {
+ foreach ($values as $k => $v) {
+ if ($set!='') $set .= ',';
+ $set .= $k.'="'.mysql_real_escape_string($v).'"';
+ }
}
- $sql = 'update '.$this->prefix.$tbl.' set '.$values.' where '.$key.'="'.$val.'"';
- mysql_query($sql);
- }
-
- function insertRecord($tbl,$vals) {
- $values = ''; $fields = '';
-
- foreach ($vals as $k => $v) {
- if ($values != '') $values .= ',';
- if ($fields != '') $fields .= ',';
- $fields .= $k;
- $values .= '"'.$v.'"';
+ $sql .= ' SET '.$set;
+ if (count($keys)>0) { /* should always be */
+ $where = '';
+ foreach ($keys as $k => $v) {
+ if ($where != '') $where .= ' AND ';
+ $where .= $k.'="'.mysql_real_escape_string($v).'"';
+ }
+ $sql .= ' WHERE '.$where;
}
- $sql = 'insert into '.$this->prefix.$tbl.' ('.$fields.') values ('.$values.')';
- mysql_query($sql);
+ $res = mysql_query($sql);
+ mysql_free_result($res);
}
- function deleteRecord($tbl,$key,$val) {
- $sql = 'delete from '.$this->prefix.$tbl.' where '.$key.'="'.$val.'"';
- mysql_query($sql);
- }
-
- function countRecords($tbl) {
- $sql = 'select count(*) as num from '.$this->prefix.$tbl;
+ function delete($tbl,$keys = array()) {
+ $sql = 'DELETE FROM '.$this->prefix.$tbl;
+ if (count($keys)>0) {
+ $where = '';
+ foreach ($keys as $k => $v) {
+ if ($where != '') $where .= ' AND ';
+ $where .= $k.'="'.mysql_real_escape_string($v).'"';
+ }
+ $sql .= ' WHERE '.$where;
+ }
$res = mysql_query($sql);
- $row = mysql_fetch_assoc($res);
mysql_free_result($res);
- return $row['num'];
}
}
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/modules/default/admin.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -67,14 +67,14 @@
function users() {
/* List the users */
- $users = app()->db->loadTable('users','login');
+ $users = app()->db->read('users',array(),array('login'));
$this->tpl->assign('users',$users);
}
function useradd() {
global $_POST;
- $groups = app()->db->loadTable('groups','name');
+ $groups = app()->db->read('groups',array(),array('name'));
$this->tpl->assign('groups',$groups);
if (isset($_POST['adduserlogin'])) {
/* add the user */
@@ -101,8 +101,8 @@
$error = true;
}
if (!$error) {
- $user['password']=crypt($_POST['adduserpassword']);
- app()->db->addUser($user);
+ $user['password']=$_POST['adduserpassword'];
+ app()->auth->add($user);
/* redirect */
$this->nextStep(1);
}
@@ -118,7 +118,7 @@
global $_GET;
if (isset($_GET['id'])) {
- app()->db->deleteUser($_GET['id']);
+ app()->auth->delete($_GET['id']);
}
$this->nextStep(1);
}
@@ -128,10 +128,11 @@
if (isset($_GET['id'])) {
$active=$_GET['active']==1?0:1;
- $user = app()->db->queryUser($_GET['id'],false);
+ $user = app()->db->read('users',array('login' => $_GET['id']));
+ $user = $user[0];
if ($user['login']==$_GET['id']) {
$user['active']=$active;
- app()->db->updateUser($user);
+ app()->auth->update($user,false);
}
}
$this->nextStep(1);
@@ -141,10 +142,11 @@
global $_GET;
global $_POST;
/* edit the user */
- $groups = app()->db->loadTable('groups','name');
+ $groups = app()->db->read('groups',array(),array('name'));
$this->tpl->assign('groups',$groups);
if (isset($_POST['login'])) {
- $user = app()->db->queryUser($_POST['login'],false);
+ $user = app()->db->read('users',array('login' => $_POST['login']));
+ $user = $user[0];
$user['name']=$_POST['editusername'];
$user['group_id']=$_POST['editusergroup'];
$user['email']=$_POST['edituseremail'];
@@ -167,18 +169,19 @@
$error = true;
}
if (!$error) {
- app()->db->updateUser($user);
+ app()->auth->update($user);
/* redirect */
$this->nextStep(1);
}
} else {
- $user = app()->db->queryUser($_GET['id'],false);
+ $user = app()->db->read('users',array('login' => $_GET['id']));
+ $user = $user[0];
}
$this->tpl->assign('edituser',$user);
}
function groups() {
- $groups = app()->db->loadTable('groups','name');
+ $groups = app()->db->read('groups',array(),array('name'));
$this->tpl->assign('groups',$groups);
}
@@ -189,7 +192,7 @@
$group['name']=$_POST['addgroupname'];
$group['description']=$_POST['addgroupdescription'];
if ($group['name']!='') {
- app()->db->insertRecord('groups',$group);
+ app()->db->insert('groups',$group);
$this->nextStep(1);
} else {
app()->error(tr('Please provide a valid group name!'));
@@ -202,11 +205,12 @@
global $_POST;
global $_GET;
- $group = app()->db->getRecord('groups','name',$_GET['id']);
+ $group = app()->db->read('groups',array('name' => $_GET['id']));
+ $group = $group[0];
if (isset($_POST['editgroupname'])) {
$group['name']=$_POST['editgroupname'];
$group['description']=$_POST['editgroupdescription'];
- app()->db->updateRecord('groups',$group,'name',$group['name']);
+ app()->db->update('groups',$group,array('name' => $group['name']));
$this->nextStep(1);
}
app()->tpl->assign('group',$group);
@@ -216,17 +220,17 @@
global $_GET;
/* should check if sub users exsist */
if (isset($_GET['id'])) {
- app()->db->deleteRecord('groups','name',$_GET['id']);
+ app()->db->delete('groups',array('name' => $_GET['id']));
/* delete all the rights of the group */
- app()->db->deleteRecord('acl','group_id',$_GET['id']);
+ app()->db->delete('acl',array('group_id' => $_GET['id']));
}
$this->nextStep(1);
}
function rights() {
- $groups = app()->db->loadTable('groups','name');
+ $groups = app()->db->read('groups',array(),array('name'));
$this->tpl->assign('groups',$groups);
- $rights = app()->db->loadTable('acl','group_id,module');
+ $rights = app()->db->read('acl',array(),array('group_id','module'));
$this->tpl->assign('rights',$rights);
}
@@ -236,8 +240,8 @@
$modules = app()->config['modules'];
$modules['*']='*';
$this->tpl->assign('modules',$modules);
- $groups = app()->db->loadTable('groups','name');
- $groups['*']='*';
+ $groups = app()->db->read('groups',array(),array('name'));
+ $groups[]='*';
$this->tpl->assign('groups',$groups);
$access['allow']=tr('Allow');
$access['deny']=tr('Deny');
@@ -252,7 +256,7 @@
$right['module']=$_POST['addrightmodule'];
$right['action']=$_POST['addrightaction'];
$right['access']=$_POST['addrightaccess'];
- app()->db->insertRecord('acl',$right);
+ app()->db->insert('acl',$right);
$this->nextStep(1);
}
app()->tpl->assign('right',$right);
@@ -262,24 +266,26 @@
global $_POST;
global $_GET;
- $right = app()->db->getRecord('acl','id',$_GET['id']);
+ $right = app()->db->read('acl',array('id' => $_GET['id']));
+ $right = $right[0];
$modules = app()->config['modules'];
$modules['*']='*';
$this->tpl->assign('modules',$modules);
- $groups = app()->db->loadTable('groups','name');
- $groups['*']='*';
+ $groups = app()->db->read('groups',array(),array('name'));
+ $groups[]='*';
$this->tpl->assign('groups',$groups);
$access['allow']=tr('Allow');
$access['deny']=tr('Deny');
$this->tpl->assign('access',$access);
if (isset($_POST['editaclid'])) {
- $right = app()->db->getRecord('acl','id',$_POST['editaclid']);
+ $right = app()->db->read('acl',array('id' => $_POST['editaclid']));
+ $right = $right[0];
$right['group_id']=$_POST['editrightgroup'];
$right['module']=$_POST['editrightmodule'];
$right['action']=$_POST['editrightaction'];
$right['access']=$_POST['editrightaccess'];
- app()->db->updateRecord('acl',$right,'id',$_POST['editaclid']);
- $this->nextStep(1);
+ app()->db->update('acl',$right,array('id' => $_POST['editaclid']));
+ $this->nextStep(1);
}
app()->tpl->assign('right',$right);
}
@@ -288,7 +294,7 @@
global $_GET;
/* should check if sub users exsist */
if (isset($_GET['id'])) {
- app()->db->deleteRecord('acl','id',$_GET['id']);
+ app()->db->delete('acl',array('id' => $_GET['id']));
$this->nextStep(1);
}
}
@@ -301,12 +307,12 @@
$page=$_GET['page'];
}
$limit = ($NUM*($page-1)).','.$NUM;
- $count = app()->db->countRecords('files');
+ $count = app()->db->count('files');
$this->tpl->assign('pages',ceil($count / $NUM)+1);
$this->tpl->assign('pagen',$page);
- $users = app()->db->loadTable('users','login','','id');
+ $users = app()->db->read('users',array(),array('login'),'',array('id'));
$this->tpl->assign('users',$users);
- $files = app()->db->loadTable('files','upload_date desc',$limit);
+ $files = app()->db->read('files',array(),array('upload_date desc'),$limit);
$this->tpl->assign('files',$files);
}
@@ -314,7 +320,7 @@
global $_GET;
if ($_GET['id']!='') {
- app()->db->deleteFile($_GET['id']);
+ app()->db->delete('files',array('id' => $_GET['id']));
/* TODO: remove the file */
}
}
@@ -333,7 +339,7 @@
}
function pluginsacl() {
- $plugins = app()->db->loadTable('plugin_acl','plugin');
+ $plugins = app()->db->read('plugin_acl',array(),array('plugin'));
$this->tpl->assign('plugins_acl',$plugins);
}
@@ -342,7 +348,7 @@
$plugins = app()->config['plugins'];
$this->tpl->assign('pluginslist',$plugins);
- $groups = app()->db->loadTable('groups','name');
+ $groups = app()->db->read('groups',array(),array('name'));
$this->tpl->assign('groups',$groups);
$access['enable']=tr('Enable');
$access['disable']=tr('Disable');
@@ -353,7 +359,7 @@
$plugin['group_id']=$_POST['addplugingroup'];
$plugin['plugin']=$_POST['addpluginplugin'];
$plugin['access']=$_POST['addpluginaccess'];
- app()->db->insertRecord('plugin_acl',$plugin);
+ app()->db->insert('plugin_acl',$plugin);
$this->nextStep(1);
}
app()->tpl->assign('plugin',$plugin);
@@ -363,20 +369,22 @@
global $_POST;
global $_GET;
- $plugin = app()->db->getRecord('plugin_acl','id',$_GET['id']);
+ $plugin = app()->db->read('plugin_acl',array('id' => $_GET['id']));
+ $plugin = $plugin[0];
$plugins = app()->config['plugins'];
$this->tpl->assign('pluginslist',$plugins);
- $groups = app()->db->loadTable('groups','name');
+ $groups = app()->db->read('groups',array(),array('name'));
$this->tpl->assign('groups',$groups);
$access['enable']=tr('Enable');
$access['disable']=tr('Disable');
$this->tpl->assign('access',$access);
if (isset($_POST['editpluginid'])) {
- $plugin = app()->db->getRecord('plugin_acl','id',$_POST['editpluginid']);
+ $plugin = app()->db->read('plugin_acl',array('id' => $_POST['editpluginid']));
+ $plugin = $plugin[0];
$plugin['group_id']=$_POST['editplugingroup'];
$plugin['plugin']=$_POST['editpluginplugin'];
$plugin['access']=$_POST['editpluginaccess'];
- app()->db->updateRecord('plugin_acl',$plugin,'id',$_POST['editpluginid']);
+ app()->db->update('plugin_acl',$plugin,array('id' => $_POST['editpluginid']));
$this->nextStep(1);
}
app()->tpl->assign('plugin',$plugin);
@@ -386,7 +394,7 @@
global $_GET;
/* should check if sub users exsist */
if (isset($_GET['id'])) {
- app()->db->deleteRecord('plugin_acl','id',$_GET['id']);
+ app()->db->delete('plugin_acl',array('id' => $_GET['id']));
}
$this->nextStep(1);
}
Modified: trunk/lib/modules/default/auth.inc.php
===================================================================
--- trunk/lib/modules/default/auth.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/modules/default/auth.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -41,7 +41,7 @@
$this->menu['profile']=tr('Preferences');
$this->menu['logout']=tr('Logout');
}
- $this->tpl->assign('register',app()->checkACL(app()->user->userGroup(),'auth','register')=='allow');
+ $this->tpl->assign('register',app()->checkACL(app()->user->group(),'auth','register')=='allow');
}
@@ -94,7 +94,7 @@
if (isset($_POST['registerlogin'])) {
/* check for the unique login */
- $u = app()->auth->userInfo($_POST['registerlogin']);
+ $u = app()->auth->info($_POST['registerlogin']);
if ($u['login']!='') {
app()->error(tr('Username already taken, choose a new value'));
$failed = true;
@@ -133,7 +133,7 @@
}
if ($failed)
$this->prevStep(1); /* back to registration form */
- app()->auth->addUser($user);
+ app()->auth->add($user);
} else {
$this->prevStep(1); /* back to registration form */
}
@@ -155,13 +155,13 @@
}
function profile() {
- $user = app()->user->userInfo();
+ $user = app()->user->info();
$this->tpl->assign('puser',$user);
}
function profileedit() {
global $_POST;
- $user = app()->user->userInfo();
+ $user = app()->user->info();
if (isset($_POST['username'])) {
/* check for valid values*/
if ($_POST['username']=='') {
@@ -188,12 +188,12 @@
$error = true;
} else {
app()->message(tr('Password has been changed!'));
- $user['password']=crypt($_POST['newpassword']);
+ $user['password']=$_POST['newpassword'];
}
}
if (!$error) {
- app()->db->updateUser($user);
- app()->user->setUserInfo($user);
+ app()->auth->update($user);
+ app()->user->set($user);
$this->nextStep(1);
}
}
Modified: trunk/lib/modules/default/files.inc.php
===================================================================
--- trunk/lib/modules/default/files.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/modules/default/files.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -72,7 +72,7 @@
$_SESSION['user']['u']['name']=$_FILES['upload']['name'];
$_SESSION['user']['u']['size']=$_FILES['upload']['size'];
$_SESSION['user']['u']['ip']=$_SERVER['REMOTE_ADDR'];
- $_SESSION['user']['u']['user_id']=app()->user->userInfo('id');
+ $_SESSION['user']['u']['user_id']=app()->user->info('id');
$this->nextStep(app()->step);
} else if (!isset($_SESSION['user']['u'])) {
redirect();
@@ -102,13 +102,18 @@
if (!$result)
$this->prevStep();
/* everything ok then add the file */
- $finfo['id']= app()->db->newFileId();
- $finfo['remove']= app()->db->newFileId('remove');
- app()->db->addFile($finfo);
+ $finfo['id']= app()->db->newRandomId('files','id');
+ $finfo['remove']= app()->db->newRandomId('files','remove');
+ $finfo['upload_date'] = date('Y-m-d H:i:s');
+ app()->db->insert('files',$finfo,array('id','name','mime','description','size','remove','user_id','ip','upload_date'));
foreach (app()->plugins as $plugin) {
if (count($plugin->fields)>0) {
foreach ($plugin->fields as $f) {
- app()->db->addFileOption($finfo,$plugin->name,$f);
+ $pinfo['file_id'] = $finfo['id'];
+ $pinfo['module'] = $plugin->name;
+ $pinfo['name']=$f;
+ $pinfo['value']=$finfo[$f];
+ app()->db->insert('file_options',$pinfo,array('file_id','module','name','value'));
}
}
}
@@ -132,6 +137,16 @@
}
}
+ function loadFile($id) {
+ $finfo = app()->db->read('files',array('id'=>$id));
+ $finfo = $finfo[0];
+ $pinfo = app()->db->read('file_options',array('file_id' => $id));
+ foreach ($pinfo as $v) {
+ $finfo[$v['name']]=$v['value'];
+ }
+ return $finfo;
+ }
+
function downloadForm() {
global $_SESSION;
global $_GET;
@@ -157,7 +172,7 @@
}
/* check if download exsists, and what are the properties */
if ($id != '') {
- $finfo = app()->db->getFileInfo($id);
+ $finfo = $this->loadFile($id);
if ($finfo['id']!=$id) {
app()->error(tr('Requested file does not exsist!'));
$this->prevStep();
@@ -236,7 +251,7 @@
}
/* check if download exsists, and what are the properties */
if ($id != '') {
- $finfo = app()->db->getFileInfo($id);
+ $finfo = $this->loadFile($id);
if ($finfo['id']!=$id) {
app()->error(tr('Wrong file id!'));
redirect();
Modified: trunk/lib/modules/tr/array.inc.php
===================================================================
--- trunk/lib/modules/tr/array.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/modules/tr/array.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -10,8 +10,8 @@
}
function init() {
- $locale = app()->user->userInfo('lang');
- $lang = app()->db->getLang($locale);
+ $locale = app()->user->info('lang');
+ $lang = app()->langs[$locale];
$tr = array();
$this->files['openupload']=app()->config['INSTALL_ROOT'].'/locale/'.$lang['id'].'.inc.php';
if (file_exists($this->files['openupload'])) {
@@ -19,7 +19,8 @@
$this->TR['openupload']=$tr;
}
$tr = array();
- $this->files['template']=app()->config['INSTALL_ROOT'].'/templates/'.app()->config['site']['template'].'/locale/'.$lang['id'].'.inc.php';
+ $this->files['template']=app()->config['INSTALL_ROOT'].'/templates/'.app()->config['site']['template'].
+ '/locale/'.$lang['id'].'.inc.php';
if (file_exists($this->files['template'])) {
require_once($this->files['template']);
$this->TR['template']=$tr;
Modified: trunk/lib/modules/tr/gettext.inc.php
===================================================================
--- trunk/lib/modules/tr/gettext.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/lib/modules/tr/gettext.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -8,8 +8,8 @@
}
function init() {
- $locale = app()->user->userInfo('lang');
- $lang = app()->db->getLang($locale);
+ $locale = app()->user->info('lang');
+ $lang = app()->langs[$locale];
putenv("LANG=".$lang['locale']);
bindtextdomain('openupload',app()->config['INSTALL_ROOT'].'/locale');
bindtextdomain('template',app()->config['INSTALL_ROOT'].'/templates/'.app()->config['site']['template'].'/locale');
Added: trunk/lib/user.inc.php
===================================================================
--- trunk/lib/user.inc.php (rev 0)
+++ trunk/lib/user.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -0,0 +1,94 @@
+<?php
+
+/* User info is stored in the session */
+
+class OpenUploadUser {
+ function OpenUploadUser() {
+ }
+
+ function init() {
+ /* setup the user */
+ }
+
+ function logout() {
+ global $_SESSION;
+
+ $messages = $_SESSION['user']['messages'];
+ $errors = $_SESSION['user']['errors'];
+ unset($_SESSION['user']);
+ $_SESSION['user']['messages'] = $messages;
+ $_SESSION['user']['errors'] = $errors;
+ redirect('?action=login');
+ }
+
+ function loggedin() {
+ global $_SESSION;
+ if (isset($_SESSION['user']['login']) and $_SESSION['user']['login']!='') {
+ return true;
+ }
+ return false;
+ }
+
+ function info($field = '') {
+ if ($field != '') {
+ return $_SESSION['user'][$field];
+ } else {
+ return $_SESSION['user'];
+ }
+ }
+
+ function group() {
+ if ($this->info('group_id')!='')
+ $group = $this->info('group_id');
+ else
+ $group = app()->config['register']['nologingroup'];
+ return $group;
+ }
+
+ function setInfo($name,$value) {
+ $_SESSION['user'][$name]=$value;
+ }
+
+ function set($user) {
+ $_SESSION['user']=$user;
+ }
+
+ function authenticate() {
+ global $_SESSION;
+ global $_GET;
+ global $_POST;
+
+ /* logout if requested */
+ if (isset($_GET['logout'])) {
+ $this->logout();
+ }
+
+ /* if already authenticated return */
+ if ($this->loggedin())
+ return true;
+
+ // if it's logging in save user and pwd
+ if (isset($_POST['username'])) {
+ $username = $_POST['username'];
+ $password = $_POST['pwd'];
+ }
+
+ if ($username != '') {
+ // use the default authentication method
+ $res = $this->auth->authenticate($username,$password);
+ if ($res) {
+ $_SESSION['user']['login']=$username;
+ /* retrieve user info */
+ $_SESSION['user'] = $this->auth->info($username);;
+ /* make the post not be resent on refresh */
+ redirect();
+ } else {
+ // set the error message for the login
+ app()->error(tr('Login incorrect!'));
+ }
+ }
+ return false;
+ }
+}
+
+?>
\ No newline at end of file
Modified: trunk/plugins/banned.inc.php
===================================================================
--- trunk/plugins/banned.inc.php 2008-10-16 18:56:05 UTC (rev 28)
+++ trunk/plugins/banned.inc.php 2008-10-17 18:08:10 UTC (rev 29)
@@ -9,7 +9,7 @@
function init() {
global $_SERVER;
- $this->banned = app()->db->loadTable('banned','priority');
+ $this->banned = app()->db->read('banned',array(),array('priority'));
/* now check if the ip has been banned display the banned template */
foreach ($this->banned as $row) {
if ($this->matchIP($_SERVER['REMOTE_ADDR'],$row['ip'])) {
@@ -91,7 +91,8 @@
function fileaction() {
global $_GET;
if (isset($_GET['ip'])) {
- $ban = app()->db->getRecord('banned','ip',$_GET['ip']);
+ $ban = app()->db->read('banned',array('ip' => $_GET['ip']));
+ $ban = $ban[0];
if ($ban['ip']!=$_GET['ip']) {
$ban['id']='';
$ban['priority']='1'; /* maybe a bigger one is better */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-16 18:56:15
|
Revision: 28
http://openupload.svn.sourceforge.net/openupload/?rev=28&view=rev
Author: tsdogs
Date: 2008-10-16 18:56:05 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Add the language selection on main template.
Modified Paths:
--------------
trunk/lib/main.inc.php
trunk/templates/default/index.tpl
trunk/www/templates/default/main.css
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-16 18:45:05 UTC (rev 27)
+++ trunk/lib/main.inc.php 2008-10-16 18:56:05 UTC (rev 28)
@@ -60,6 +60,13 @@
$this->langs = $this->db->loadTable('langs','','','id');
+ /* check if it was forced */
+ if (isset($_GET['lang'])) {
+ $user = $this->user->userInfo();
+ $user['lang']=$_GET['lang'];
+ $this->user->setUserInfo($user);
+ }
+
/* configure the language */
if ($this->user->userInfo('lang')=='') {
$lang = $this->getBrowserLang();
Modified: trunk/templates/default/index.tpl
===================================================================
--- trunk/templates/default/index.tpl 2008-10-16 18:45:05 UTC (rev 27)
+++ trunk/templates/default/index.tpl 2008-10-16 18:56:05 UTC (rev 28)
@@ -7,6 +7,13 @@
<!-- header -->
<div id="header">
<div id="logo"><img src="{$page.template}/img/openupload.jpg" border="0"></div>
+<div id="langs">
+<ul>
+{foreach from=$langs item=l name=c}
+<li {if $smarty.foreach.c.last} style="border: 0px"{/if}><a href="{$script}?lang={$l.id}">{$l.name}</a></li>
+{/foreach}
+</ul>
+</div>
<div id="userinfo">
{$user.name}
</div>
Modified: trunk/www/templates/default/main.css
===================================================================
--- trunk/www/templates/default/main.css 2008-10-16 18:45:05 UTC (rev 27)
+++ trunk/www/templates/default/main.css 2008-10-16 18:56:05 UTC (rev 28)
@@ -7,12 +7,31 @@
float:left;
}
#userinfo {
+ clear: right;
float: right;
height: 20px;
vertical-align: bottom;
- margin-top: 60px;
+ margin-top: 40px;
margin-right: 20px;
}
+#langs {
+ float: right;
+ height: 20px;
+ vertical-align: top;
+ margin-top: 0px;
+ margin-right: 20px;
+}
+#langs ul {
+ list-style:none;
+ margin: 0;
+ padding: 0;
+}
+#langs li {
+ display: inline;
+ padding-right: 8px;
+ padding-left: 8px;
+ border-right: 1px solid #000000;
+}
#title {
background-color: #3161cf;
color: #ffffff;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-16 18:45:16
|
Revision: 27
http://openupload.svn.sourceforge.net/openupload/?rev=27&view=rev
Author: tsdogs
Date: 2008-10-16 18:45:05 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Add user language preference and browser language detection
Modified Paths:
--------------
trunk/lib/general.inc.php
trunk/lib/main.inc.php
trunk/lib/modules/db/mysql.inc.php
trunk/lib/modules/default/admin.inc.php
trunk/lib/modules/default/auth.inc.php
trunk/templates/default/modules/admin/useradd.tpl
trunk/templates/default/modules/admin/useredit.tpl
trunk/templates/default/modules/auth/profile.tpl
trunk/templates/default/modules/auth/profileedit.tpl
trunk/templates/default/modules/auth/registerForm.tpl
Modified: trunk/lib/general.inc.php
===================================================================
--- trunk/lib/general.inc.php 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/lib/general.inc.php 2008-10-16 18:45:05 UTC (rev 27)
@@ -46,7 +46,6 @@
return $result;
}
-
function translate($txt,$domain,$args) {
/* now we retrieve the translated message */
$txt = app()->tr->translate($txt,$domain);
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/lib/main.inc.php 2008-10-16 18:45:05 UTC (rev 27)
@@ -28,10 +28,6 @@
$this->tpl->caching = $this->config['site']['caching'];
$this->page['template']= $this->config['WWW_ROOT'].'/templates/'.$this->config['site']['template'];
- /* initialize the application components */
- if (!isset($_SESSIO['user']['lang'])) {
- $_SESSION['user']['lang']='en';
- }
/* include the class first */
$dbtype = $this->config['database']['type'];
@@ -49,10 +45,8 @@
require_once($this->config['INSTALL_ROOT'].'/lib/modules/auth/'.$authmname.'.inc.php');
$auth = $authmname.'Auth';
$this->auth = new $auth();
- $this->auth->init();
$this->user = new User();
- $this->user->init();
/* translation module */
if (isset($this->config['translator'])) {
@@ -63,7 +57,20 @@
require_once($this->config['INSTALL_ROOT'].'/lib/modules/tr/'.$trname.'.inc.php');
$tr = $trname.'Translator';
$this->tr = new $tr();
+
+ $this->langs = $this->db->loadTable('langs','','','id');
+
+ /* configure the language */
+ if ($this->user->userInfo('lang')=='') {
+ $lang = $this->getBrowserLang();
+ $user = $this->user->userInfo();
+ $user['lang']=$lang;
+ $this->user->setUserInfo($user);
+ }
+
$this->tr->init();
+ $this->auth->init();
+ $this->user->init();
$this->config['modules'][]='files';
$this->config['modules'][]='admin';
@@ -73,6 +80,31 @@
$this->initModules();
}
+ function getBrowserLang() {
+ global $_SERVER;
+
+ /* calculate preferred language */
+ $langs = str_replace(' ','',strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
+ $langs = explode(',',$langs);
+ foreach ($langs as $ls) {
+ $language = explode(';',$ls);
+ foreach ($language as $l) {
+ foreach ($this->langs as $ml) {
+ if (strpos(strtolower($ml['browser']),'['.$l.']')!==FALSE) {
+ return $ml['id'];
+ }
+ if (strpos($l,'-')) {
+ $x = explode('-',$l);
+ if (strpos(strtolower($ml['browser']),'['.$x[0].']')!==FALSE) {
+ return $ml['id'];
+ }
+ }
+ }
+ }
+ }
+ return $this->config['defaultlang'];
+ }
+
function fetch($tname) {
if (file_exists($this->tpl->template_dir.'/'.$this->config['site']['template'].'/'.$tname.'.tpl')) {
return $this->tpl->fetch($this->config['site']['template'].'/'.$tname.'.tpl');
@@ -261,7 +293,8 @@
$m->$fun();
/* now display the final page */
- $this->tpl->assign('user',$_SESSION['user']);
+ $this->tpl->assign('user',$this->user->userInfo());
+ $this->tpl->assign('langs',$this->langs);
unset($_SESSION['user']['messages']);
unset($_SESSION['user']['errors']);
$this->tpl->assign('plugins',$this->pluginHTML);
Modified: trunk/lib/modules/db/mysql.inc.php
===================================================================
--- trunk/lib/modules/db/mysql.inc.php 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/lib/modules/db/mysql.inc.php 2008-10-16 18:45:05 UTC (rev 27)
@@ -43,9 +43,9 @@
function addUser($user) {
$e = 'mysql_real_escape_string';
- $sql = 'insert into '.$this->prefix.'users (id,login,password,name,group_id,email,active) values
+ $sql = 'insert into '.$this->prefix.'users (id,login,password,name,group_id,email,lang,active) values
(NULL,"'.$e($user['login']).'","'.$e($user['password']).'","'.$e($user['name']).'","'.$e($user['group_id']).'","'
- .$e($user['email']).'","'.$e($user['active']).'")';
+ .$e($user['email']).'","'.$e($user['lang']).'","'.$e($user['active']).'")';
mysql_query($sql);
}
@@ -53,7 +53,7 @@
$e = 'mysql_real_escape_string';
$sql = 'update '.$this->prefix.'users set
password="'.$e($user['password']).'",group_id="'.$e($user['group_id']).'",name="'.$e($user['name']).
- '",email="'.$e($user['email']).'",active="'.$e($user['active']).'"'.
+ '",email="'.$e($user['email']).'",lang="'.$e($user['lang']).'",active="'.$e($user['active']).'"'.
'where login="'.$user['login'].'"';
mysql_query($sql);
}
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/lib/modules/default/admin.inc.php 2008-10-16 18:45:05 UTC (rev 27)
@@ -83,6 +83,7 @@
$user['group_id']=$_POST['addusergroup'];
$user['email']=$_POST['adduseremail'];
$user['active']=$_POST['adduseractive'];
+ $user['lang']=$_POST['adduserlang'];
$error = false;
if (strlen($_POST['adduserlogin'])<5) {
app()->error('login name must be at least 5 char long!');
@@ -147,6 +148,7 @@
$user['name']=$_POST['editusername'];
$user['group_id']=$_POST['editusergroup'];
$user['email']=$_POST['edituseremail'];
+ $user['lang']=$_POST['edituserlang'];
$user['active']=$_POST['edituseractive'];
$error = false;
if ($_POST['edituserpassword']!='') {
Modified: trunk/lib/modules/default/auth.inc.php
===================================================================
--- trunk/lib/modules/default/auth.inc.php 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/lib/modules/default/auth.inc.php 2008-10-16 18:45:05 UTC (rev 27)
@@ -122,6 +122,7 @@
$user['name'] = $_POST['registername'];
$user['password'] = $_POST['registerpassword'];
$user['email'] = $_POST['registeremail'];
+ $user['lang'] = $_POST['registerlang'];
$user['group_id'] = app()->config['register']['default_group'];
$user['active'] = 1;
$result = app()->pluginAction('registerConfirm',$user);
@@ -161,7 +162,6 @@
function profileedit() {
global $_POST;
$user = app()->user->userInfo();
-echo 'pwd:'.$user['password'];
if (isset($_POST['username'])) {
/* check for valid values*/
if ($_POST['username']=='') {
@@ -173,6 +173,7 @@
app()->error(tr('Please enter a valid e-mail address!'));
$error=true;
}
+ $user['lang']=$_POST['userlang'];
$user['email']=$_POST['useremail'];
if ($_POST['newpassword']!='') {
$error = false;
@@ -192,6 +193,7 @@
}
if (!$error) {
app()->db->updateUser($user);
+ app()->user->setUserInfo($user);
$this->nextStep(1);
}
}
Modified: trunk/templates/default/modules/admin/useradd.tpl
===================================================================
--- trunk/templates/default/modules/admin/useradd.tpl 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/templates/default/modules/admin/useradd.tpl 2008-10-16 18:45:05 UTC (rev 27)
@@ -14,6 +14,9 @@
<option value="{$g.name}" {if $g.name==$adduser.group_id} selected{/if}>{$g.description}</option>
{/foreach}
</select></td></tr>
+<tr><td>{tr}Preferred language{/tr}:</td><td> <select name="adduserlang">
+{foreach from=$langs item=l}<option value="{$l.id}" {if $adduser.lang==$l.id}selected{/if}>{$l.name}</option>{/foreach}
+</select></td></tr>
<tr><td>{tr}Active{/tr}:</td><td><input type="checkbox" name="adduseractive" value="1" {if $adduser.active==1}checked{/if}></td></tr>
<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Add{/tr}"></td></tr>
</table>
Modified: trunk/templates/default/modules/admin/useredit.tpl
===================================================================
--- trunk/templates/default/modules/admin/useredit.tpl 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/templates/default/modules/admin/useredit.tpl 2008-10-16 18:45:05 UTC (rev 27)
@@ -14,6 +14,9 @@
<option value="{$g.name}" {if $g.name==$edituser.group_id} selected{/if}>{$g.description}</option>
{/foreach}
</select></td></tr>
+<tr><td>{tr}Preferred language{/tr}:</td><td> <select name="edituserlang">
+{foreach from=$langs item=l}<option value="{$l.id}" {if $edituser.lang==$l.id}selected{/if}>{$l.name}</option>{/foreach}
+</select></td></tr>
<tr><td>{tr}Active{/tr}:</td><td><input type="checkbox" name="edituseractive" value="1" {if $edituser.active==1}checked{/if}></td></tr>
<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Confirm{/tr}"></td></tr>
</table>
Modified: trunk/templates/default/modules/auth/profile.tpl
===================================================================
--- trunk/templates/default/modules/auth/profile.tpl 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/templates/default/modules/auth/profile.tpl 2008-10-16 18:45:05 UTC (rev 27)
@@ -2,6 +2,7 @@
<tr><td>{tr}Login name{/tr}:</td><td>{$puser.login}</td></tr>
<tr><td>{tr}Full Name{/tr}:</td><td>{$puser.name}</td></tr>
<tr><td>{tr}e-mail{/tr}:</td><td>{$puser.email}</td></tr>
+<tr><td>{tr}Language{/tr}:</td><td>{$langs[$puser.lang].name}</td></tr>
<tr><td colspan="2"><hr></td></tr>
<tr><td colspan="2"><a href="{$script}?action={$action}&step={$nextstep}">{tr}Change{/tr}</td></tr>
</table>
\ No newline at end of file
Modified: trunk/templates/default/modules/auth/profileedit.tpl
===================================================================
--- trunk/templates/default/modules/auth/profileedit.tpl 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/templates/default/modules/auth/profileedit.tpl 2008-10-16 18:45:05 UTC (rev 27)
@@ -5,6 +5,9 @@
<tr><td>{tr}Login name{/tr}:</td><td>{$puser.login}</td></tr>
<tr><td>{tr}Full Name{/tr}:</td><td><input type="text" name="username" value="{$puser.name}"></td></tr>
<tr><td>{tr}e-mail{/tr}:</td><td><input type="text" name="useremail" value="{$puser.email}"></td></tr>
+<tr><td>{tr}Preferred language{/tr}:</td><td> <select name="userlang">
+{foreach from=$langs item=l}<option value="{$l.id}" {if $user.lang==$l.id}selected{/if}>{$l.name}</option>{/foreach}
+</select></td></tr>
<tr><td colspan="2"><hr></td></tr>
<tr><td>{tr}Old password{/tr}:</td><td><input type="password" name="oldpassword" value=""></td></tr>
<tr><td>{tr}New password{/tr}:</td><td><input type="password" name="newpassword" value=""></td></tr>
Modified: trunk/templates/default/modules/auth/registerForm.tpl
===================================================================
--- trunk/templates/default/modules/auth/registerForm.tpl 2008-10-16 17:46:16 UTC (rev 26)
+++ trunk/templates/default/modules/auth/registerForm.tpl 2008-10-16 18:45:05 UTC (rev 27)
@@ -7,7 +7,9 @@
<tr><td>{tr}Retype Password{/tr}:</td><td><input type="password" name="registerrepassword"></td></tr>
<tr><td>{tr}Full Name{/tr}:</td><td><input type="text" name="registername" value="{$register.name}"></td></tr>
<tr><td>{tr}e-mail{/tr}:</td><td><input type="text" name="registeremail" value="{$register.email}"></td></tr>
-<!--<tr><td>{tr}Preferred language{/tr}: <select name="registerlang"></select></td></tr>-->
+<tr><td>{tr}Preferred language{/tr}:</td><td> <select name="registerlang">
+{foreach from=$langs item=l}<option value="{$l.id}" {if $user.lang==$l.id}selected{/if}>{$l.name}</option>{/foreach}
+</select></td></tr>
{$plugins}
<tr><td colspan="2" align="right"><input type="submit" class="submit" value="Register"></td></tr>
</table>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-16 17:46:23
|
Revision: 26
http://openupload.svn.sourceforge.net/openupload/?rev=26&view=rev
Author: tsdogs
Date: 2008-10-16 17:46:16 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Add user preferences management.
Modified Paths:
--------------
trunk/lib/classes.inc.php
trunk/lib/main.inc.php
trunk/lib/modules/default/auth.inc.php
Added Paths:
-----------
trunk/templates/default/modules/auth/profile.tpl
trunk/templates/default/modules/auth/profileedit.tpl
Modified: trunk/lib/classes.inc.php
===================================================================
--- trunk/lib/classes.inc.php 2008-10-16 16:57:18 UTC (rev 25)
+++ trunk/lib/classes.inc.php 2008-10-16 17:46:16 UTC (rev 26)
@@ -129,7 +129,7 @@
$_SESSION['user']['login']=$username;
/* retrieve user info */
$info = $this->auth->userinfo($username);
- unset($info['password']);
+ //unset($info['password']);
$_SESSION['user'] = $info;
/* make the post not be resent on refresh */
redirect();
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-16 16:57:18 UTC (rev 25)
+++ trunk/lib/main.inc.php 2008-10-16 17:46:16 UTC (rev 26)
@@ -66,8 +66,8 @@
$this->tr->init();
$this->config['modules'][]='files';
+ $this->config['modules'][]='admin';
$this->config['modules'][]='auth';
- $this->config['modules'][]='admin';
$this->loadACL();
$this->initModules();
Modified: trunk/lib/modules/default/auth.inc.php
===================================================================
--- trunk/lib/modules/default/auth.inc.php 2008-10-16 16:57:18 UTC (rev 25)
+++ trunk/lib/modules/default/auth.inc.php 2008-10-16 17:46:16 UTC (rev 26)
@@ -6,6 +6,10 @@
1 => "loginForm",
2 => "authenticate",
),
+ "profile" => array (
+ 1 => "profile",
+ 2 => "profileedit",
+ ),
"logout" => array (
1 => "logout",
),
@@ -24,6 +28,9 @@
"register" => array (
"title" => tr("User registration"),
),
+ "profile" => array (
+ "title" => tr("User options"),
+ ),
);
}
@@ -31,6 +38,7 @@
if (!app()->user->loggedin()) {
$this->menu['login']=tr('Login');
} else {
+ $this->menu['profile']=tr('Preferences');
$this->menu['logout']=tr('Logout');
}
$this->tpl->assign('register',app()->checkACL(app()->user->userGroup(),'auth','register')=='allow');
@@ -145,5 +153,49 @@
}
+ function profile() {
+ $user = app()->user->userInfo();
+ $this->tpl->assign('puser',$user);
+ }
+
+ function profileedit() {
+ global $_POST;
+ $user = app()->user->userInfo();
+echo 'pwd:'.$user['password'];
+ if (isset($_POST['username'])) {
+ /* check for valid values*/
+ if ($_POST['username']=='') {
+ app()->error(tr('Full Name cannot be empty!'));
+ $error = true;
+ } else
+ $user['name']=$_POST['username'];
+ if (!validEmail($_POST['useremail'])) {
+ app()->error(tr('Please enter a valid e-mail address!'));
+ $error=true;
+ }
+ $user['email']=$_POST['useremail'];
+ if ($_POST['newpassword']!='') {
+ $error = false;
+ if (strlen($_POST['newpassword'])<5) {
+ app()->error(tr('Password must be at least 5 charaters long!'));
+ $error = true;
+ } else if (crypt($_POST['oldpassword'],$user['password'])!=$user['password']) {
+ app()->error(tr('Old password is wrong!'));
+ $error = true;
+ } else if ($_POST['newpassword']!=$_POST['confirmpassword']) {
+ app()->error(tr('New passwords do not match!'));
+ $error = true;
+ } else {
+ app()->message(tr('Password has been changed!'));
+ $user['password']=crypt($_POST['newpassword']);
+ }
+ }
+ if (!$error) {
+ app()->db->updateUser($user);
+ $this->nextStep(1);
+ }
+ }
+ $this->tpl->assign('puser',$user);
+ }
}
?>
\ No newline at end of file
Added: trunk/templates/default/modules/auth/profile.tpl
===================================================================
--- trunk/templates/default/modules/auth/profile.tpl (rev 0)
+++ trunk/templates/default/modules/auth/profile.tpl 2008-10-16 17:46:16 UTC (rev 26)
@@ -0,0 +1,7 @@
+<table border="0" width="300">
+<tr><td>{tr}Login name{/tr}:</td><td>{$puser.login}</td></tr>
+<tr><td>{tr}Full Name{/tr}:</td><td>{$puser.name}</td></tr>
+<tr><td>{tr}e-mail{/tr}:</td><td>{$puser.email}</td></tr>
+<tr><td colspan="2"><hr></td></tr>
+<tr><td colspan="2"><a href="{$script}?action={$action}&step={$nextstep}">{tr}Change{/tr}</td></tr>
+</table>
\ No newline at end of file
Added: trunk/templates/default/modules/auth/profileedit.tpl
===================================================================
--- trunk/templates/default/modules/auth/profileedit.tpl (rev 0)
+++ trunk/templates/default/modules/auth/profileedit.tpl 2008-10-16 17:46:16 UTC (rev 26)
@@ -0,0 +1,14 @@
+<form action="{$script}" method="POST">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<table border="0" width="300">
+<tr><td>{tr}Login name{/tr}:</td><td>{$puser.login}</td></tr>
+<tr><td>{tr}Full Name{/tr}:</td><td><input type="text" name="username" value="{$puser.name}"></td></tr>
+<tr><td>{tr}e-mail{/tr}:</td><td><input type="text" name="useremail" value="{$puser.email}"></td></tr>
+<tr><td colspan="2"><hr></td></tr>
+<tr><td>{tr}Old password{/tr}:</td><td><input type="password" name="oldpassword" value=""></td></tr>
+<tr><td>{tr}New password{/tr}:</td><td><input type="password" name="newpassword" value=""></td></tr>
+<tr><td>{tr}Retype password{/tr}:</td><td><input type="password" name="confirmpassword" value=""></td></tr>
+<tr><td><a href="{$script}?action={$action}&step=1"><< {tr}Cancel{/tr}</td>
+ <td align="right"><input type="submit" class="submit" value="{tr}Confirm{/tr}"></td></tr>
+</table>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-16 16:57:26
|
Revision: 25
http://openupload.svn.sourceforge.net/openupload/?rev=25&view=rev
Author: tsdogs
Date: 2008-10-16 16:57:18 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Complete administration (it needs a better organization though)
Modified Paths:
--------------
trunk/lib/classes.inc.php
trunk/lib/main.inc.php
trunk/lib/modules/db/mysql.inc.php
trunk/lib/modules/default/admin.inc.php
trunk/lib/modules/default/files.inc.php
trunk/plugins/banned.inc.php
trunk/templates/default/modules/admin/groups.tpl
trunk/templates/default/modules/admin/plugins.tpl
trunk/templates/default/modules/admin/rights.tpl
trunk/templates/default/modules/admin/users.tpl
trunk/www/templates/default/main.css
Added Paths:
-----------
trunk/templates/default/modules/admin/files.tpl
trunk/templates/default/modules/admin/pluginoptions.tpl
trunk/templates/default/modules/admin/pluginsacl.tpl
trunk/www/templates/default/img/admin/ban.png
Modified: trunk/lib/classes.inc.php
===================================================================
--- trunk/lib/classes.inc.php 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/lib/classes.inc.php 2008-10-16 16:57:18 UTC (rev 25)
@@ -163,6 +163,9 @@
redirect('?action='.$action.'&step='.$step);
}
+ function fileaction() {
+ }
+
function init() {
}
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/lib/main.inc.php 2008-10-16 16:57:18 UTC (rev 25)
@@ -146,7 +146,7 @@
$pname = $plugin."Plugin";
$newp = new $pname();
$newp->name = $plugin;
- $this->plugins[] = $newp;
+ $this->plugins[$plugin] = $newp;
} else {
$this->error(tr('plugin include file not found: %1',$plugin));
}
Modified: trunk/lib/modules/db/mysql.inc.php
===================================================================
--- trunk/lib/modules/db/mysql.inc.php 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/lib/modules/db/mysql.inc.php 2008-10-16 16:57:18 UTC (rev 25)
@@ -98,9 +98,9 @@
function addFile(&$finfo) {
$e = 'mysql_real_escape_string';
- $sql = 'insert into '.$this->prefix.'files (id,name,mime,description,size,remove,user_id,upload_date)
+ $sql = 'insert into '.$this->prefix.'files (id,name,mime,description,size,remove,user_id,ip,upload_date)
values ("'.$e($finfo['id']).'","'.$e($finfo['name']).'","'.$e($finfo['mime']).'","'.$e($finfo['description']).
- '","'.$e($finfo['size']).'","'.$e($finfo['remove']).'","'.$_SESSION['user']['id'].'",now())';
+ '","'.$e($finfo['size']).'","'.$e($finfo['remove']).'","'.$finfo['user_id'].'","'.$finfo['ip'].'",now())';
/* now ask the plugins for additional options */
mysql_query($sql);
return $finfo['id'];
@@ -143,13 +143,17 @@
return $plugins;
}
- function loadTable($tbl,$sort = '') {
+ function loadTable($tbl,$sort = '',$limit = '',$key = '') {
$sql = 'select * from '.$this->prefix.$tbl;
if ($sort!='') $sql .= ' order by '.$sort;
+ if ($limit!='') $sql .= ' limit '.$limit;
$res = mysql_query($sql);
$result = array();
while ($row = mysql_fetch_assoc($res)) {
- $result[] = $row;
+ if ($key!='')
+ $result[$row[$key]] = $row;
+ else
+ $result[] = $row;
}
mysql_free_result($res);
return $result;
@@ -191,6 +195,14 @@
$sql = 'delete from '.$this->prefix.$tbl.' where '.$key.'="'.$val.'"';
mysql_query($sql);
}
+
+ function countRecords($tbl) {
+ $sql = 'select count(*) as num from '.$this->prefix.$tbl;
+ $res = mysql_query($sql);
+ $row = mysql_fetch_assoc($res);
+ mysql_free_result($res);
+ return $row['num'];
+ }
}
?>
\ No newline at end of file
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/lib/modules/default/admin.inc.php 2008-10-16 16:57:18 UTC (rev 25)
@@ -10,12 +10,20 @@
),
"adminplugins" => array (
1 => "plugins",
+ ),
+ "adminpluginsacl" => array (
+ 1 => "pluginsacl",
2 => "pluginadd",
3 => "pluginedit",
4 => "plugindel",
),
+ "adminpluginsoptions" => array (
+ 1 => "pluginoptions",
+ ),
"adminfiles" => array (
1 => "files",
+ 2 => "filedel",
+ 3 => "filesplugin",
),
"adminusers" => array (
1 => "users",
@@ -279,19 +287,54 @@
/* should check if sub users exsist */
if (isset($_GET['id'])) {
app()->db->deleteRecord('acl','id',$_GET['id']);
+ $this->nextStep(1);
}
- $this->nextStep(1);
}
function files() {
+ $NUM = 50;
+ $page = 1;
+ if (isset($_GET['page'])) {
+ $page=$_GET['page'];
+ }
+ $limit = ($NUM*($page-1)).','.$NUM;
+ $count = app()->db->countRecords('files');
+ $this->tpl->assign('pages',ceil($count / $NUM)+1);
+ $this->tpl->assign('pagen',$page);
+ $users = app()->db->loadTable('users','login','','id');
+ $this->tpl->assign('users',$users);
+ $files = app()->db->loadTable('files','upload_date desc',$limit);
+ $this->tpl->assign('files',$files);
}
+ function filedel() {
+ global $_GET;
+
+ if ($_GET['id']!='') {
+ app()->db->deleteFile($_GET['id']);
+ /* TODO: remove the file */
+ }
+ }
+
+ function filesplugin() {
+ global $_GET;
+ if (isset($_GET['plugin'])) {
+ if (isset(app()->plugins[$_GET['plugin']])) {
+ app()->plugins[$_GET['plugin']]->fileaction();
+ }
+ }
+ $this->nextStep(1);
+ }
+
function plugins() {
- /* */
+ }
+
+ function pluginsacl() {
$plugins = app()->db->loadTable('plugin_acl','plugin');
$this->tpl->assign('plugins_acl',$plugins);
}
+
function pluginadd() {
global $_POST;
@@ -346,6 +389,9 @@
$this->nextStep(1);
}
+ function pluginoptions() {
+ }
+
function settings() {
$this->tpl->assign('config',app()->config);
}
Modified: trunk/lib/modules/default/files.inc.php
===================================================================
--- trunk/lib/modules/default/files.inc.php 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/lib/modules/default/files.inc.php 2008-10-16 16:57:18 UTC (rev 25)
@@ -61,6 +61,7 @@
function uploadOptions() {
global $_SESSION;
global $_FILES;
+ global $_SERVER;
if (isset($_FILES['upload'])) {
/* prepare the file */
@@ -70,6 +71,8 @@
$_SESSION['user']['u']['mime']=$_FILES['upload']['type'];
$_SESSION['user']['u']['name']=$_FILES['upload']['name'];
$_SESSION['user']['u']['size']=$_FILES['upload']['size'];
+ $_SESSION['user']['u']['ip']=$_SERVER['REMOTE_ADDR'];
+ $_SESSION['user']['u']['user_id']=app()->user->userInfo('id');
$this->nextStep(app()->step);
} else if (!isset($_SESSION['user']['u'])) {
redirect();
Modified: trunk/plugins/banned.inc.php
===================================================================
--- trunk/plugins/banned.inc.php 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/plugins/banned.inc.php 2008-10-16 16:57:18 UTC (rev 25)
@@ -87,5 +87,22 @@
else
return false;
}
+
+ function fileaction() {
+ global $_GET;
+ if (isset($_GET['ip'])) {
+ $ban = app()->db->getRecord('banned','ip',$_GET['ip']);
+ if ($ban['ip']!=$_GET['ip']) {
+ $ban['id']='';
+ $ban['priority']='1'; /* maybe a bigger one is better */
+ $ban['ip']=$_GET['ip'];
+ $ban['access']='deny';
+ app()->db->insertRecord('banned',$ban);
+ app()->message(tr('IP %1 has been banned!',$_GET['ip']));
+ } else {
+ app()->error(tr('IP %1 was already in state: %2!',$_GET['ip'],$ban['access']));
+ }
+ }
+ }
}
?>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/files.tpl
===================================================================
--- trunk/templates/default/modules/admin/files.tpl (rev 0)
+++ trunk/templates/default/modules/admin/files.tpl 2008-10-16 16:57:18 UTC (rev 25)
@@ -0,0 +1,38 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+<br>
+{if $pages>2}
+<center>{section name=page loop=$pages start=1 max=20}
+{if $pagen==$smarty.section.page.index}
+<b style="font-size: 12pt">{$smarty.section.page.index}</b>
+{else}
+<a style="font-size: 12pt" href="{$script}?action={$action}&page={$smarty.section.page.index}">{$smarty.section.page.index}</a>
+{/if}
+
+{/section} </center>
+{/if}
+<br>
+<table border="0" id="dbtable">
+<tr>
+ <th width="10">S</th>
+ <th width="50">Id</th> <AZ
+ <th width="200">Name</th>
+ <th width="100">User</th>
+ <th width="100">IP</th>
+ <th width="200">Upload Date</th>
+ <th width="100">Actions</th>
+</tr>
+{foreach from=$files item=f}
+{cycle values="row1,row2" advance=true assign=rid}
+<tr>
+ <td id="{$rid}"><input type="checkbox" name="file_{$f.id}" value="1"></td>
+ <td id="{$rid}">{$f.id}</td>
+ <td id="{$rid}">{$f.name}</td>
+ <td id="{$rid}">{$users[$f.user_id].login}</td>
+ <td id="{$rid}" style="text-align: left"><a title="ban IP {$f.ip}" href="{$script}?action={$action}&step=3&plugin=banned&ip={$f.ip}">
+ <img align="right" src="{$page.template}/img/admin/ban.png" ></a>{$f.ip} </td>
+ <td id="{$rid}">{$f.upload_date}</td>
+ <td id="{$rid}">
+ <a title="delete" href="{$script}?action={$action}&step=4&id={$f.id}"><img src="{$page.template}/img/admin/delete.png"></a></td>
+</tr>
+{/foreach}
+</table>
\ No newline at end of file
Modified: trunk/templates/default/modules/admin/groups.tpl
===================================================================
--- trunk/templates/default/modules/admin/groups.tpl 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/templates/default/modules/admin/groups.tpl 2008-10-16 16:57:18 UTC (rev 25)
@@ -12,11 +12,12 @@
<th width="100">Actions</th>
</tr>
{foreach from=$groups item=g}
+{cycle values="row1,row2" advance=true assign=rid}
<tr>
- <td id="row1"><input type="checkbox" name="group_{$g.name}" value="1"></td>
- <td id="row1" style="text-align:left"><a href="{$script}?action=admingroups&step=3&id={$g.name}">{$g.name}</a></td>
- <td id="row1">{$g.description}</td>
- <td id="row1">
+ <td id="{$rid}"><input type="checkbox" name="group_{$g.name}" value="1"></td>
+ <td id="{$rid}" style="text-align:left"><a href="{$script}?action=admingroups&step=3&id={$g.name}">{$g.name}</a></td>
+ <td id="{$rid}">{$g.description}</td>
+ <td id="{$rid}">
<a href="{$script}?action={$action}&step=3&id={$g.name}"><img src="{$page.template}/img/admin/edit_group.png"></a>
<a href="{$script}?action={$action}&step=4&id={$g.name}"><img src="{$page.template}/img/admin/delete_group.png"></a></td>
Added: trunk/templates/default/modules/admin/pluginoptions.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginoptions.tpl (rev 0)
+++ trunk/templates/default/modules/admin/pluginoptions.tpl 2008-10-16 16:57:18 UTC (rev 25)
@@ -0,0 +1,3 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+<br>
+<h1>To be implemented!!!</h1>
\ No newline at end of file
Modified: trunk/templates/default/modules/admin/plugins.tpl
===================================================================
--- trunk/templates/default/modules/admin/plugins.tpl 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/templates/default/modules/admin/plugins.tpl 2008-10-16 16:57:18 UTC (rev 25)
@@ -1,29 +1,9 @@
{include file="default/modules/admin/adminmenu.tpl"}
-<div id="toolbar">
-<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{$page.template}/img/admin/plugins.png"></a>
-<img src="{$page.template}/img/admin/tdelete.png">
-</div>
<br>
-<table border="0" id="dbtable">
+<table border="0" width="400" height="200">
<tr>
- <th width="10">S</th>
- <th width="30">ID</th>
- <th width="100">Plugin</th>
- <th width="100">Group</th>
- <th width="100">Access</th>
- <th width="100">Actions</th>
+ <td align="center"><a href="{$script}?action=adminpluginsacl"><img src="{$page.template}/img/admin/plugins.png" border="0" ><br>{tr}Plugins ACL{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminpluginsoptions"><img src="{$page.template}/img/admin/plugins.png" border="0" align="center"><br>{tr}Plugins Options{/tr}</a></td>
</tr>
-{foreach from=$plugins_acl item=p}
-<tr>
- <td id="row1"><input type="checkbox" name="p_{$p.id}" value="1"></td>
- <td id="row1" style="text-align:left"><a href="{$script}?action={$action}&step=3&id={$p.id}">{$p.id}</a></td>
- <td id="row1">{$p.plugin}</td>
- <td id="row1">{$p.group_id}</td>
- <td id="row1">{$p.access}</td>
- <td id="row1">
- <a href="{$script}?action={$action}&step=3&id={$p.id}"><img src="{$page.template}/img/admin/edit_plugin.png"></a>
-
- <a href="{$script}?action={$action}&step=4&id={$p.id}"><img src="{$page.template}/img/admin/delete.png"></a></td>
-</tr>
-{/foreach}
+{$plugins}
</table>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/pluginsacl.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginsacl.tpl (rev 0)
+++ trunk/templates/default/modules/admin/pluginsacl.tpl 2008-10-16 16:57:18 UTC (rev 25)
@@ -0,0 +1,30 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+<div id="toolbar">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{$page.template}/img/admin/plugins.png"></a>
+<img src="{$page.template}/img/admin/tdelete.png">
+</div>
+<br>
+<table border="0" id="dbtable">
+<tr>
+ <th width="10">S</th>
+ <th width="30">ID</th>
+ <th width="100">Plugin</th>
+ <th width="100">Group</th>
+ <th width="100">Access</th>
+ <th width="100">Actions</th>
+</tr>
+{foreach from=$plugins_acl item=p}
+{cycle values="row1,row2" advance=true assign=rid}
+<tr>
+ <td id="{$rid}"><input type="checkbox" name="p_{$p.id}" value="1"></td>
+ <td id="{$rid}" style="text-align:left"><a href="{$script}?action={$action}&step=3&id={$p.id}">{$p.id}</a></td>
+ <td id="{$rid}">{$p.plugin}</td>
+ <td id="{$rid}">{$p.group_id}</td>
+ <td id="{$rid}">{$p.access}</td>
+ <td id="{$rid}">
+ <a href="{$script}?action={$action}&step=3&id={$p.id}"><img src="{$page.template}/img/admin/edit_plugin.png"></a>
+
+ <a href="{$script}?action={$action}&step=4&id={$p.id}"><img src="{$page.template}/img/admin/delete.png"></a></td>
+</tr>
+{/foreach}
+</table>
\ No newline at end of file
Modified: trunk/templates/default/modules/admin/rights.tpl
===================================================================
--- trunk/templates/default/modules/admin/rights.tpl 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/templates/default/modules/admin/rights.tpl 2008-10-16 16:57:18 UTC (rev 25)
@@ -15,14 +15,15 @@
<th width="100">Actions</th>
</tr>
{foreach from=$rights item=r}
+{cycle values="row1,row2" advance=true assign=rid}
<tr>
- <td id="row1"><input type="checkbox" name="right_{$r.id}" value="1"></td>
- <td id="row1"><a href="{$script}?action={$action}&step=3&id={$r.id}">{$r.id}</a></td>
- <td id="row1">{$r.group_id}</td>
- <td id="row1">{$r.module}</td>
- <td id="row1">{$r.action}</td>
- <td id="row1">{$r.access}</td>
- <td id="row1">
+ <td id="{$rid}"><input type="checkbox" name="right_{$r.id}" value="1"></td>
+ <td id="{$rid}"><a href="{$script}?action={$action}&step=3&id={$r.id}">{$r.id}</a></td>
+ <td id="{$rid}">{$r.group_id}</td>
+ <td id="{$rid}">{$r.module}</td>
+ <td id="{$rid}">{$r.action}</td>
+ <td id="{$rid}">{$r.access}</td>
+ <td id="{$rid}">
<a href="{$script}?action={$action}&step=3&id={$r.id}"><img src="{$page.template}/img/admin/edit_right.png"></a>
<a href="{$script}?action={$action}&step=4&id={$r.id}"><img src="{$page.template}/img/admin/delete.png"></a></td>
Modified: trunk/templates/default/modules/admin/users.tpl
===================================================================
--- trunk/templates/default/modules/admin/users.tpl 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/templates/default/modules/admin/users.tpl 2008-10-16 16:57:18 UTC (rev 25)
@@ -15,17 +15,18 @@
<th width="100">Actions</th>
</tr>
{foreach from=$users item=u}
+{cycle values="row1,row2" advance=true assign=rid}
<tr>
- <td id="row1"><input type="checkbox" name="user_{$u.login}" value="1"></td>
- <td id="row1"><a href="{$script}?action={$action}&step=3&id={$u.login}">{$u.login}</a></td>
- <td id="row1">{$u.name}</td>
- <td id="row1">{$u.group_id}</td>
- <td id="row1">{$u.email}</td>
- <td id="row1"><a href="{$script}?action={$action}&step=5&id={$u.login}&active={$u.active}">
+ <td id="{$rid}"><input type="checkbox" name="user_{$u.login}" value="1"></td>
+ <td id="{$rid}"><a href="{$script}?action={$action}&step=3&id={$u.login}">{$u.login}</a></td>
+ <td id="{$rid}">{$u.name}</td>
+ <td id="{$rid}">{$u.group_id}</td>
+ <td id="{$rid}">{$u.email}</td>
+ <td id="{$rid}"><a href="{$script}?action={$action}&step=5&id={$u.login}&active={$u.active}">
<img src="{$page.template}/img/admin/active{$u.active}.png">
</a>
</td>
- <td id="row1">
+ <td id="{$rid}">
<a href="{$script}?action={$action}&step=3&id={$u.login}"><img src="{$page.template}/img/admin/edit_user.png"></a>
<a href="{$script}?action={$action}&step=4&id={$u.login}"><img src="{$page.template}/img/admin/delete_user.png"></a></td>
Added: trunk/www/templates/default/img/admin/ban.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/ban.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/www/templates/default/main.css
===================================================================
--- trunk/www/templates/default/main.css 2008-10-16 11:23:11 UTC (rev 24)
+++ trunk/www/templates/default/main.css 2008-10-16 16:57:18 UTC (rev 25)
@@ -150,8 +150,11 @@
padding: 2px;
background-color: #fafafa;
text-align: center;
+ vertical-align: center;
}
-#datatable #row2 {
- background-color: #adadad;
+#dbtable #row2 {
+ padding: 2px;
+ background-color: #ededed;
text-align: center;
+ vertical-align: center;
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-16 11:23:13
|
Revision: 24
http://openupload.svn.sourceforge.net/openupload/?rev=24&view=rev
Author: tsdogs
Date: 2008-10-16 11:23:11 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
add ignore of smarty compiled templates
Property Changed:
----------------
trunk/templates_c/
Property changes on: trunk/templates_c
___________________________________________________________________
Added: svn:ignore
+ %%*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-16 11:18:56
|
Revision: 23
http://openupload.svn.sourceforge.net/openupload/?rev=23&view=rev
Author: tsdogs
Date: 2008-10-16 11:18:52 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Add administration of: groups, rights, plugins and a settings display page
Added Paths:
-----------
trunk/templates/default/modules/admin/groups.tpl
trunk/templates/default/modules/admin/pluginedit.tpl
Added: trunk/templates/default/modules/admin/groups.tpl
===================================================================
--- trunk/templates/default/modules/admin/groups.tpl (rev 0)
+++ trunk/templates/default/modules/admin/groups.tpl 2008-10-16 11:18:52 UTC (rev 23)
@@ -0,0 +1,25 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+<div id="toolbar">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{$page.template}/img/admin/tadd_group.png"></a>
+<img src="{$page.template}/img/admin/tdelete_group.png">
+</div>
+<br>
+<table border="0" id="dbtable">
+<tr>
+ <th width="10">S</th>
+ <th width="100">Name</th>
+ <th width="200">Description</th>
+ <th width="100">Actions</th>
+</tr>
+{foreach from=$groups item=g}
+<tr>
+ <td id="row1"><input type="checkbox" name="group_{$g.name}" value="1"></td>
+ <td id="row1" style="text-align:left"><a href="{$script}?action=admingroups&step=3&id={$g.name}">{$g.name}</a></td>
+ <td id="row1">{$g.description}</td>
+ <td id="row1">
+ <a href="{$script}?action={$action}&step=3&id={$g.name}"><img src="{$page.template}/img/admin/edit_group.png"></a>
+
+ <a href="{$script}?action={$action}&step=4&id={$g.name}"><img src="{$page.template}/img/admin/delete_group.png"></a></td>
+</tr>
+{/foreach}
+</table>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/pluginedit.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginedit.tpl (rev 0)
+++ trunk/templates/default/modules/admin/pluginedit.tpl 2008-10-16 11:18:52 UTC (rev 23)
@@ -0,0 +1,28 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
+<form action="{$script}" method="post">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<input type="hidden" name="editpluginid" value="{$plugin.id}">
+<table border="0">
+<tr><td>{tr}Plugin{/tr}:</td><td>
+<select name="editpluginplugin">
+{foreach from=$pluginslist item=p}
+<option value="{$p}" {if $p==$plugin.plugin}selected{/if}>{$p}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Group{/tr}:</td><td>
+<select name="editplugingroup">
+{foreach from=$groups item=g}
+<option value="{$g.name}" {if $g.name==$plugin.group_id}selected{/if}>{$g.name}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Access{/tr}:</td><td>
+<select name="editpluginaccess">
+{foreach from=$access item=a key=k}
+<option value="{$k}" {if $k==$plugin.access}selected{/if}>{$a}</option>
+{/foreach}
+</select></td></tr>
+<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Confirm{/tr}"></td></tr>
+</table>
+</form>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-16 11:17:48
|
Revision: 22
http://openupload.svn.sourceforge.net/openupload/?rev=22&view=rev
Author: tsdogs
Date: 2008-10-16 11:17:43 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Add administration of: groups, rights, plugins and a settings display page
Modified Paths:
--------------
trunk/lib/modules/db/mysql.inc.php
trunk/lib/modules/default/admin.inc.php
trunk/templates/default/modules/admin/adminmenu.tpl
trunk/templates/default/modules/admin/useradd.tpl
trunk/templates/default/modules/admin/useredit.tpl
trunk/templates/default/modules/admin/users.tpl
Added Paths:
-----------
trunk/templates/default/modules/admin/groupadd.tpl
trunk/templates/default/modules/admin/groupedit.tpl
trunk/templates/default/modules/admin/pluginadd.tpl
trunk/templates/default/modules/admin/plugins.tpl
trunk/templates/default/modules/admin/rightadd.tpl
trunk/templates/default/modules/admin/rightedit.tpl
trunk/templates/default/modules/admin/rights.tpl
trunk/templates/default/modules/admin/settings.tpl
trunk/www/templates/default/img/admin/delete.png
trunk/www/templates/default/img/admin/delete_group.png
trunk/www/templates/default/img/admin/edit_group.png
trunk/www/templates/default/img/admin/edit_plugin.png
trunk/www/templates/default/img/admin/edit_right.png
trunk/www/templates/default/img/admin/tadd_group.png
trunk/www/templates/default/img/admin/tadd_right.png
trunk/www/templates/default/img/admin/tdelete.png
trunk/www/templates/default/img/admin/tdelete_group.png
Modified: trunk/lib/modules/db/mysql.inc.php
===================================================================
--- trunk/lib/modules/db/mysql.inc.php 2008-10-15 18:15:51 UTC (rev 21)
+++ trunk/lib/modules/db/mysql.inc.php 2008-10-16 11:17:43 UTC (rev 22)
@@ -146,7 +146,6 @@
function loadTable($tbl,$sort = '') {
$sql = 'select * from '.$this->prefix.$tbl;
if ($sort!='') $sql .= ' order by '.$sort;
-
$res = mysql_query($sql);
$result = array();
while ($row = mysql_fetch_assoc($res)) {
@@ -155,6 +154,43 @@
mysql_free_result($res);
return $result;
}
+
+ function getRecord($tbl,$key,$val) {
+ $sql = 'select * from '.$this->prefix.$tbl.' where '.$key.'="'.$val.'"';
+ $res = mysql_query($sql);
+ $result = mysql_fetch_assoc($res);
+ mysql_free_result($res);
+ return $result;
+ }
+
+ function updateRecord($tbl,$vals,$key,$val) {
+ $values = '';
+
+ foreach ($vals as $k => $v) {
+ if ($values != '') $values .= ',';
+ $values .= $k.'="'.$v.'"';
+ }
+ $sql = 'update '.$this->prefix.$tbl.' set '.$values.' where '.$key.'="'.$val.'"';
+ mysql_query($sql);
+ }
+
+ function insertRecord($tbl,$vals) {
+ $values = ''; $fields = '';
+
+ foreach ($vals as $k => $v) {
+ if ($values != '') $values .= ',';
+ if ($fields != '') $fields .= ',';
+ $fields .= $k;
+ $values .= '"'.$v.'"';
+ }
+ $sql = 'insert into '.$this->prefix.$tbl.' ('.$fields.') values ('.$values.')';
+ mysql_query($sql);
+ }
+
+ function deleteRecord($tbl,$key,$val) {
+ $sql = 'delete from '.$this->prefix.$tbl.' where '.$key.'="'.$val.'"';
+ mysql_query($sql);
+ }
}
?>
\ No newline at end of file
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-10-15 18:15:51 UTC (rev 21)
+++ trunk/lib/modules/default/admin.inc.php 2008-10-16 11:17:43 UTC (rev 22)
@@ -10,6 +10,9 @@
),
"adminplugins" => array (
1 => "plugins",
+ 2 => "pluginadd",
+ 3 => "pluginedit",
+ 4 => "plugindel",
),
"adminfiles" => array (
1 => "files",
@@ -23,9 +26,15 @@
),
"admingroups" => array (
1 => "groups",
+ 2 => "groupadd",
+ 3 => "groupedit",
+ 4 => "groupdel",
),
"adminrights" => array (
1 => "rights",
+ 2 => "rightadd",
+ 3 => "rightedit",
+ 4 => "rightdel",
),
);
@@ -159,18 +168,186 @@
}
function groups() {
+ $groups = app()->db->loadTable('groups','name');
+ $this->tpl->assign('groups',$groups);
}
+ function groupadd() {
+ global $_POST;
+
+ if (isset($_POST['addgroupname'])) {
+ $group['name']=$_POST['addgroupname'];
+ $group['description']=$_POST['addgroupdescription'];
+ if ($group['name']!='') {
+ app()->db->insertRecord('groups',$group);
+ $this->nextStep(1);
+ } else {
+ app()->error(tr('Please provide a valid group name!'));
+ }
+ }
+ app()->tpl->assign('group',$group);
+ }
+
+ function groupedit() {
+ global $_POST;
+ global $_GET;
+
+ $group = app()->db->getRecord('groups','name',$_GET['id']);
+ if (isset($_POST['editgroupname'])) {
+ $group['name']=$_POST['editgroupname'];
+ $group['description']=$_POST['editgroupdescription'];
+ app()->db->updateRecord('groups',$group,'name',$group['name']);
+ $this->nextStep(1);
+ }
+ app()->tpl->assign('group',$group);
+ }
+
+ function groupdel() {
+ global $_GET;
+ /* should check if sub users exsist */
+ if (isset($_GET['id'])) {
+ app()->db->deleteRecord('groups','name',$_GET['id']);
+ /* delete all the rights of the group */
+ app()->db->deleteRecord('acl','group_id',$_GET['id']);
+ }
+ $this->nextStep(1);
+ }
+
function rights() {
+ $groups = app()->db->loadTable('groups','name');
+ $this->tpl->assign('groups',$groups);
+ $rights = app()->db->loadTable('acl','group_id,module');
+ $this->tpl->assign('rights',$rights);
}
+ function rightadd() {
+ global $_POST;
+
+ $modules = app()->config['modules'];
+ $modules['*']='*';
+ $this->tpl->assign('modules',$modules);
+ $groups = app()->db->loadTable('groups','name');
+ $groups['*']='*';
+ $this->tpl->assign('groups',$groups);
+ $access['allow']=tr('Allow');
+ $access['deny']=tr('Deny');
+ $this->tpl->assign('access',$access);
+ $right['module']='*';
+ $right['group_id']='*';
+ $right['action']='*';
+ $right['access']='deny';
+ if (isset($_POST['addrightgroup'])) {
+ $right['id']='';
+ $right['group_id']=$_POST['addrightgroup'];
+ $right['module']=$_POST['addrightmodule'];
+ $right['action']=$_POST['addrightaction'];
+ $right['access']=$_POST['addrightaccess'];
+ app()->db->insertRecord('acl',$right);
+ $this->nextStep(1);
+ }
+ app()->tpl->assign('right',$right);
+ }
+
+ function rightedit() {
+ global $_POST;
+ global $_GET;
+
+ $right = app()->db->getRecord('acl','id',$_GET['id']);
+ $modules = app()->config['modules'];
+ $modules['*']='*';
+ $this->tpl->assign('modules',$modules);
+ $groups = app()->db->loadTable('groups','name');
+ $groups['*']='*';
+ $this->tpl->assign('groups',$groups);
+ $access['allow']=tr('Allow');
+ $access['deny']=tr('Deny');
+ $this->tpl->assign('access',$access);
+ if (isset($_POST['editaclid'])) {
+ $right = app()->db->getRecord('acl','id',$_POST['editaclid']);
+ $right['group_id']=$_POST['editrightgroup'];
+ $right['module']=$_POST['editrightmodule'];
+ $right['action']=$_POST['editrightaction'];
+ $right['access']=$_POST['editrightaccess'];
+ app()->db->updateRecord('acl',$right,'id',$_POST['editaclid']);
+ $this->nextStep(1);
+ }
+ app()->tpl->assign('right',$right);
+ }
+
+ function rightdel() {
+ global $_GET;
+ /* should check if sub users exsist */
+ if (isset($_GET['id'])) {
+ app()->db->deleteRecord('acl','id',$_GET['id']);
+ }
+ $this->nextStep(1);
+ }
+
function files() {
+
}
function plugins() {
+ /* */
+ $plugins = app()->db->loadTable('plugin_acl','plugin');
+ $this->tpl->assign('plugins_acl',$plugins);
}
+ function pluginadd() {
+ global $_POST;
+ $plugins = app()->config['plugins'];
+ $this->tpl->assign('pluginslist',$plugins);
+ $groups = app()->db->loadTable('groups','name');
+ $this->tpl->assign('groups',$groups);
+ $access['enable']=tr('Enable');
+ $access['disable']=tr('Disable');
+ $this->tpl->assign('access',$access);
+ $plugin['access']='disable';
+ if (isset($_POST['addplugingroup'])) {
+ $plugin['id']='';
+ $plugin['group_id']=$_POST['addplugingroup'];
+ $plugin['plugin']=$_POST['addpluginplugin'];
+ $plugin['access']=$_POST['addpluginaccess'];
+ app()->db->insertRecord('plugin_acl',$plugin);
+ $this->nextStep(1);
+ }
+ app()->tpl->assign('plugin',$plugin);
+ }
+
+ function pluginedit() {
+ global $_POST;
+ global $_GET;
+
+ $plugin = app()->db->getRecord('plugin_acl','id',$_GET['id']);
+ $plugins = app()->config['plugins'];
+ $this->tpl->assign('pluginslist',$plugins);
+ $groups = app()->db->loadTable('groups','name');
+ $this->tpl->assign('groups',$groups);
+ $access['enable']=tr('Enable');
+ $access['disable']=tr('Disable');
+ $this->tpl->assign('access',$access);
+ if (isset($_POST['editpluginid'])) {
+ $plugin = app()->db->getRecord('plugin_acl','id',$_POST['editpluginid']);
+ $plugin['group_id']=$_POST['editplugingroup'];
+ $plugin['plugin']=$_POST['editpluginplugin'];
+ $plugin['access']=$_POST['editpluginaccess'];
+ app()->db->updateRecord('plugin_acl',$plugin,'id',$_POST['editpluginid']);
+ $this->nextStep(1);
+ }
+ app()->tpl->assign('plugin',$plugin);
+ }
+
+ function plugindel() {
+ global $_GET;
+ /* should check if sub users exsist */
+ if (isset($_GET['id'])) {
+ app()->db->deleteRecord('plugin_acl','id',$_GET['id']);
+ }
+ $this->nextStep(1);
+ }
+
function settings() {
+ $this->tpl->assign('config',app()->config);
}
}
Modified: trunk/templates/default/modules/admin/adminmenu.tpl
===================================================================
--- trunk/templates/default/modules/admin/adminmenu.tpl 2008-10-15 18:15:51 UTC (rev 21)
+++ trunk/templates/default/modules/admin/adminmenu.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -1,6 +1,11 @@
<div id="menu">
<ul>
+ <li><a href="{$script}?action=adminsettings">{tr}Settings{/tr}</a></li>
+ <li><a href="{$script}?action=adminplugins">{tr}Plugins{/tr}</a></li>
+ <li><a href="{$script}?action=adminfiles">{tr}Files{/tr}</a></li>
<li><a href="{$script}?action=adminusers">{tr}Users{/tr}</a></li>
+ <li><a href="{$script}?action=admingroups">{tr}Groups{/tr}</a></li>
+ <li><a href="{$script}?action=adminrights">{tr}Rights{/tr}</a></li>
</ul>
</div>
<hr>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/groupadd.tpl
===================================================================
--- trunk/templates/default/modules/admin/groupadd.tpl (rev 0)
+++ trunk/templates/default/modules/admin/groupadd.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,11 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
+<form action="{$script}" method="post">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<table border="0">
+<tr><td>{tr}Name{/tr}:</td><td><input type="text" name="addgroupname" value="{$group.name}"></td></tr>
+<tr><td>{tr}Description{/tr}:</td><td><input type="text" name="addgroupdescription" value="{$group.description}"></td></tr>
+<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Add{/tr}"></td></tr>
+</table>
+</form>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/groupedit.tpl
===================================================================
--- trunk/templates/default/modules/admin/groupedit.tpl (rev 0)
+++ trunk/templates/default/modules/admin/groupedit.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,12 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
+<form action="{$script}" method="post">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<input type="hidden" name="editgroupname" value="{$group.name}">
+<table border="0">
+<tr><td>{tr}Name{/tr}:</td><td>{$group.name}</td></tr>
+<tr><td>{tr}Description{/tr}:</td><td><input type="text" name="editgroupdescription" value="{$group.description}"></td></tr>
+<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Confirm{/tr}"></td></tr>
+</table>
+</form>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/pluginadd.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginadd.tpl (rev 0)
+++ trunk/templates/default/modules/admin/pluginadd.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,27 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
+<form action="{$script}" method="post">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<table border="0">
+<tr><td>{tr}Plugin{/tr}:</td><td>
+<select name="addpluginplugin">
+{foreach from=$pluginslist item=p}
+<option value="{$p}" {if $p==$plugin.plugin}selected{/if}>{$p}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Group{/tr}:</td><td>
+<select name="addplugingroup">
+{foreach from=$groups item=g}
+<option value="{$g.name}" {if $g.name==$plugin.group_id}selected{/if}>{$g.name}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Access{/tr}:</td><td>
+<select name="addpluginaccess">
+{foreach from=$access item=a key=k}
+<option value="{$k}" {if $k==$plugin.access}selected{/if}>{$a}</option>
+{/foreach}
+</select></td></tr>
+<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Add{/tr}"></td></tr>
+</table>
+</form>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/plugins.tpl
===================================================================
--- trunk/templates/default/modules/admin/plugins.tpl (rev 0)
+++ trunk/templates/default/modules/admin/plugins.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,29 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+<div id="toolbar">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{$page.template}/img/admin/plugins.png"></a>
+<img src="{$page.template}/img/admin/tdelete.png">
+</div>
+<br>
+<table border="0" id="dbtable">
+<tr>
+ <th width="10">S</th>
+ <th width="30">ID</th>
+ <th width="100">Plugin</th>
+ <th width="100">Group</th>
+ <th width="100">Access</th>
+ <th width="100">Actions</th>
+</tr>
+{foreach from=$plugins_acl item=p}
+<tr>
+ <td id="row1"><input type="checkbox" name="p_{$p.id}" value="1"></td>
+ <td id="row1" style="text-align:left"><a href="{$script}?action={$action}&step=3&id={$p.id}">{$p.id}</a></td>
+ <td id="row1">{$p.plugin}</td>
+ <td id="row1">{$p.group_id}</td>
+ <td id="row1">{$p.access}</td>
+ <td id="row1">
+ <a href="{$script}?action={$action}&step=3&id={$p.id}"><img src="{$page.template}/img/admin/edit_plugin.png"></a>
+
+ <a href="{$script}?action={$action}&step=4&id={$p.id}"><img src="{$page.template}/img/admin/delete.png"></a></td>
+</tr>
+{/foreach}
+</table>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/rightadd.tpl
===================================================================
--- trunk/templates/default/modules/admin/rightadd.tpl (rev 0)
+++ trunk/templates/default/modules/admin/rightadd.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,28 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
+<form action="{$script}" method="post">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<table border="0">
+<tr><td>{tr}Group{/tr}:</td><td>
+<select name="addrightgroup">
+{foreach from=$groups item=g}
+<option value="{$g.name}" {if $g.name==$right.group_id}selected{/if}>{$g.name}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Module{/tr}:</td><td>
+<select name="addrightmodule">
+{foreach from=$modules item=m}
+<option value="{$m}" {if $m==$right.module}selected{/if}>{$m}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Action{/tr}:</td><td><input type="text" name="addrightaction" value="{$right.action}"></td></tr>
+<tr><td>{tr}Access{/tr}:</td><td>
+<select name="addrightaccess">
+{foreach from=$access item=a key=k}
+<option value="{$k}" {if $k==$right.access}selected{/if}>{$a}</option>
+{/foreach}
+</select></td></tr>
+<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Add{/tr}"></td></tr>
+</table>
+</form>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/rightedit.tpl
===================================================================
--- trunk/templates/default/modules/admin/rightedit.tpl (rev 0)
+++ trunk/templates/default/modules/admin/rightedit.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,29 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
+<form action="{$script}" method="post">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<input type="hidden" name="editaclid" value="{$right.id}">
+<table border="0">
+<tr><td>{tr}Group{/tr}:</td><td>
+<select name="editrightgroup">
+{foreach from=$groups item=g}
+<option value="{$g.name}" {if $g.name==$right.group_id}selected{/if}>{$g.name}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Module{/tr}:</td><td>
+<select name="editrightmodule">
+{foreach from=$modules item=m}
+<option value="{$m}" {if $m==$right.module}selected{/if}>{$m}</option>
+{/foreach}
+</select></td></tr>
+<tr><td>{tr}Action{/tr}:</td><td><input type="text" name="editrightaction" value="{$right.action}"></td></tr>
+<tr><td>{tr}Access{/tr}:</td><td>
+<select name="editrightaccess">
+{foreach from=$access item=a key=k}
+<option value="{$k}" {if $k==$right.access}selected{/if}>{$a}</option>
+{/foreach}
+</select></td></tr>
+<tr><td colspan="2" align=right><input type="submit" class="submit" value="{tr}Confirm{/tr}"></td></tr>
+</table>
+</form>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/rights.tpl
===================================================================
--- trunk/templates/default/modules/admin/rights.tpl (rev 0)
+++ trunk/templates/default/modules/admin/rights.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,31 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+<div id="toolbar">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{$page.template}/img/admin/tadd_right.png"></a>
+<img src="{$page.template}/img/admin/tdelete.png">
+</div>
+<br>
+<table border="0" id="dbtable">
+<tr>
+ <th width="10">S</th>
+ <th width="50">Id</th>
+ <th width="200">Group</th>
+ <th width="100">Module</th>
+ <th width="100">Action</th>
+ <th width="200">Right</th>
+ <th width="100">Actions</th>
+</tr>
+{foreach from=$rights item=r}
+<tr>
+ <td id="row1"><input type="checkbox" name="right_{$r.id}" value="1"></td>
+ <td id="row1"><a href="{$script}?action={$action}&step=3&id={$r.id}">{$r.id}</a></td>
+ <td id="row1">{$r.group_id}</td>
+ <td id="row1">{$r.module}</td>
+ <td id="row1">{$r.action}</td>
+ <td id="row1">{$r.access}</td>
+ <td id="row1">
+ <a href="{$script}?action={$action}&step=3&id={$r.id}"><img src="{$page.template}/img/admin/edit_right.png"></a>
+
+ <a href="{$script}?action={$action}&step=4&id={$r.id}"><img src="{$page.template}/img/admin/delete.png"></a></td>
+</tr>
+{/foreach}
+</table>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/settings.tpl
===================================================================
--- trunk/templates/default/modules/admin/settings.tpl (rev 0)
+++ trunk/templates/default/modules/admin/settings.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -0,0 +1,22 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
+Please edit the config.inc.php to change settings for now.<br>
+<br/>
+This are the configured settings for a review:<br>
+
+<table border="1">
+{foreach from=$config item=c key=k}
+<tr><td valign="top"><b>{$k} :</b></td><td>
+{if is_array($c)}
+<table border="0">
+{foreach from=$c item=sc key=sk}
+<tr><td>{$sk} :</td><td>{if $sk==='password'}*no display*{else}{$sc|escape}{/if}</td></tr>
+{/foreach}
+</table>
+{else}
+{if $k==='password'}*no display*{else}{$c|escape}{/if}
+{/if}
+</td></tr>
+{/foreach}
+</table>
+<br/><br/><br/><br/>
\ No newline at end of file
Modified: trunk/templates/default/modules/admin/useradd.tpl
===================================================================
--- trunk/templates/default/modules/admin/useradd.tpl 2008-10-15 18:15:51 UTC (rev 21)
+++ trunk/templates/default/modules/admin/useradd.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -1,3 +1,5 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+
<form action="{$script}" method="post">
<input type="hidden" name="action" value="{$action}">
<input type="hidden" name="step" value="{$step}">
Modified: trunk/templates/default/modules/admin/useredit.tpl
===================================================================
--- trunk/templates/default/modules/admin/useredit.tpl 2008-10-15 18:15:51 UTC (rev 21)
+++ trunk/templates/default/modules/admin/useredit.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -1,3 +1,4 @@
+{include file="default/modules/admin/adminmenu.tpl"}
<form action="{$script}" method="post">
<input type="hidden" name="action" value="{$action}">
<input type="hidden" name="step" value="{$step}">
Modified: trunk/templates/default/modules/admin/users.tpl
===================================================================
--- trunk/templates/default/modules/admin/users.tpl 2008-10-15 18:15:51 UTC (rev 21)
+++ trunk/templates/default/modules/admin/users.tpl 2008-10-16 11:17:43 UTC (rev 22)
@@ -17,7 +17,7 @@
{foreach from=$users item=u}
<tr>
<td id="row1"><input type="checkbox" name="user_{$u.login}" value="1"></td>
- <td id="row1"><a href="{$script}?action=adminusers&step=3&id={$u.login}">{$u.login}</a></td>
+ <td id="row1"><a href="{$script}?action={$action}&step=3&id={$u.login}">{$u.login}</a></td>
<td id="row1">{$u.name}</td>
<td id="row1">{$u.group_id}</td>
<td id="row1">{$u.email}</td>
Added: trunk/www/templates/default/img/admin/delete.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/delete.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/delete_group.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/delete_group.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/edit_group.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/edit_group.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/edit_plugin.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/edit_plugin.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/edit_right.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/edit_right.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tadd_group.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tadd_group.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tadd_right.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tadd_right.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tdelete.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tdelete.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tdelete_group.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tdelete_group.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|