Thread: [Openupload-svn-update] SF.net SVN: openupload:[5] trunk
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2008-10-15 13:39:28
|
Revision: 5
http://openupload.svn.sourceforge.net/openupload/?rev=5&view=rev
Author: tsdogs
Date: 2008-10-15 13:39:24 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
Reorganization
Added Paths:
-----------
trunk/INSTALL
trunk/LICENSE
trunk/README
trunk/TODO
trunk/index.php
trunk/www/
Copied: trunk/INSTALL (from rev 1, INSTALL)
===================================================================
--- trunk/INSTALL (rev 0)
+++ trunk/INSTALL 2008-10-15 13:39:24 UTC (rev 5)
@@ -0,0 +1,30 @@
+This is a preliminary version of the notes
+
+Installation notes
+
+Multisite installation
+1. Download the source from http:/www.sf.net/projects/openupload
+2. Untar the file
+ tar xzf <release>.tar.gz
+3. Copy all files to somewhere which is not accessible from the web (i.e. /usr/local/share/openupload)
+4. Copy the www/ files into the web server folder (i.e. /var/www/html) or create a web server alias to point to the www/ folder
+5. copy the www/config.inc.php.example and edit it to suit your installation
+6. Make sure the web server is able to write to the data directory
+7. Create the database
+ mysql:
+ - create the db and the user
+ create database <database>;
+ grant all privileges on <database>.* to '<user>'@'localhost' deintified by '<password>';
+ - import the database schema and default config options
+ mysql <database> -u <user> -p < sql/mysql/openupload.sql
+
+8. Point your browser to http://localhost/<wherever>
+
+BIG FAT NOTE:
+The program will work even if you copy the whole folder into the web server root or a subdiretory.
+But:
+- You should make sure the files are not directly accessible via WEB
+ More specifically:
+ "data" directory where files are stored
+ "txtdb" if a flat txt database is used
+
Copied: trunk/LICENSE (from rev 1, LICENSE)
===================================================================
--- trunk/LICENSE (rev 0)
+++ trunk/LICENSE 2008-10-15 13:39:24 UTC (rev 5)
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
Copied: trunk/README (from rev 1, README)
===================================================================
--- trunk/README (rev 0)
+++ trunk/README 2008-10-15 13:39:24 UTC (rev 5)
@@ -0,0 +1,34 @@
+NAME:
+
+ OpenUpload - Share your big files over the internet service
+
+VERSION: 0.3
+
+AUTHORS:
+OpenUpload (http://openupload.sf.net/)
+ Copyright: 2008 Alessandro Briosi <ts...@br...>
+
+ADDITIONAL AUTHORS:
+Smarty (http://www.smarty.net/):
+ Copyright: 2001-2005 New Digital Group, Inc. (LGPL 2.1+)
+
+Securimage (http://www.phpcaptcha.org) (Used by captcha plugin):
+ Copyright: 2007 Drew Phillips (LGPL 2.1+)
+
+Crystal Project Icons (http://www.everaldo.com) (Used in default template)
+ Copyright: Copyright (c) 2006-2007 Everaldo Coelho
+
+
+DESCRIPTION:
+
+ What is OpenUpload?
+
+ It is a php web application to handle a files upload/download service.
+ It aims to be customizable/extendible.
+ It can be used inside enterprises for sharing files fast with customers.
+
+
+COPYRIGHT:
+ Copyright (c) 2008 Alessandro Briosi. All rights reserved.
+ This software is released under the GNU General Public License.
+ Please read the disclaimer at the top of the index.php file.
Copied: trunk/TODO (from rev 1, TODO)
===================================================================
--- trunk/TODO (rev 0)
+++ trunk/TODO 2008-10-15 13:39:24 UTC (rev 5)
@@ -0,0 +1,68 @@
+TODO list not priority ordered.
+
+UPLOAD
+Display upload progress
+
+REGISTRATION
+Registration with e-mail activation
+Check for a valid login value
+Moderation of registrations by admin
+
+USER
+Manage profile (password/Name/E-Mail change)
+Manage personal files (if allowed)
+
+DATABASE
+Implement pgsql module
+Additional tables for txt module, needs a review.
+
+AUTHENTICATION
+LDAP authentication (with OpenLdap and AD) mainly
+
+ADMIN
+User administration
+Group administration
+File administration and maintainence
+Config administration
+Plugin administration
+First setup script
+
+ACL
+User/Group acl for modules and plugins: partially done 2008.10
+
+DOWNLOAD
+Fix double click on no blockings for download
+
+PLUGINS
+Plugin configuration options
+
+(Followings 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.
+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?
+
+MAINTEINENCE
+Create a script to clean up the files/tmpfiles.
+Manage file deletion timeout probably better to be handled here.
+
+TEMPLATE
+Create a sample template.
+
+LOG
+Activity logging
+
+TERMS OF USE
+
+WEB SITE with Screen Shots
+
+SVN setup
+
+RELEASE
Copied: trunk/index.php (from rev 1, index.php)
===================================================================
--- trunk/index.php (rev 0)
+++ trunk/index.php 2008-10-15 13:39:24 UTC (rev 5)
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Project: OpenUpload
+ * File: index.php
+ *
+ * LICENSE:
+ *
+ * Copyright 2008 Alessandro Briosi
+ *
+ * This file is part of OpenUpload.
+ *
+ * OpenUpload is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenUpload is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with OpenUpload; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @link http://openupload.sf.net/
+ * @copyright 2008 Alessandro Briosi
+ * @author Alessandro Briosi <tsdogs at briosix dot org>
+ * @package OpenUpload
+ * @version 0.3
+ */
+
+ require_once('www/index.php');
+?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-15 13:54:56
|
Revision: 8
http://openupload.svn.sourceforge.net/openupload/?rev=8&view=rev
Author: tsdogs
Date: 2008-10-15 13:53:52 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
First svn commit
Added Paths:
-----------
trunk/data/
trunk/lib/
trunk/lib/classes.inc.php
trunk/lib/general.inc.php
trunk/lib/main.inc.php
trunk/lib/modules/
trunk/lib/smarty/
trunk/locale/
trunk/locale/en.inc.php
trunk/locale/it/
trunk/locale/it.inc.php
trunk/locale/tools/
trunk/plugins/
trunk/plugins/banned.inc.php
trunk/plugins/captcha.inc.php
trunk/plugins/email.inc.php
trunk/plugins/mimetypes.inc.php
trunk/plugins/password.inc.php
trunk/plugins/securimage/
trunk/sql/
trunk/sql/mysql/
trunk/templates/
trunk/templates/default/
trunk/templates_c/
trunk/txtdb/
trunk/www/templates/default/img/admin/files.png
trunk/www/templates/default/img/admin/groups.png
trunk/www/templates/default/img/admin/plugins.png
trunk/www/templates/default/img/admin/rights.png
trunk/www/templates/default/img/admin/settings.png
trunk/www/templates/default/img/admin/users.png
trunk/www/templates/default/img/download.png
trunk/www/templates/default/img/openupload.jpg
trunk/www/templates/default/img/upload.png
trunk/www/templates/default/main.css
Added: trunk/lib/classes.inc.php
===================================================================
--- trunk/lib/classes.inc.php (rev 0)
+++ trunk/lib/classes.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,203 @@
+<?php
+
+class translatorBase {
+ function translatorBase() {}
+
+ function init() {}
+
+ function translate($txt) {
+ return $txt;
+ }
+}
+
+class authBase {
+
+ function authBase() {
+ }
+
+
+}
+
+class dbBase {
+
+ function dbBase() {
+
+ }
+
+ function init() {
+
+ }
+
+ function addFile($info = array()) {
+ }
+
+ function addFileOption($info = array(),$module,$field) {
+ }
+
+ function removeFile($id) {
+ }
+
+ function getFileInfo($id = 0) {
+ return array();
+ }
+
+ function userInfo($login) {
+ return array();
+ }
+
+ function addUser($info) {
+ }
+
+ function deleteUser($login) {
+ }
+
+}
+
+class User {
+ function User() {
+ }
+
+ 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;
+ }
+ 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!'));
+ }
+ }
+ return false;
+ }
+}
+
+class OpenUploadModule {
+var $actions = array();
+var $access = array();
+var $page = array();
+var $tpl;
+
+ function OpenUploadMoule() {
+ }
+
+ function nextStep($step = 0, $action = '') {
+ $step = $step==0?app()->step+1:$step;
+ $action = $action==''?app()->action:$action;
+ redirect('?action='.$action.'&step='.$step);
+ }
+
+ function prevStep() {
+ $step = app()->step>1?app()->step-1:1;
+ $action = app()->action;
+ redirect('?action='.$action.'&step='.$step);
+ }
+
+ function init() {
+ }
+
+}
+
+class OpenUploadPlugin {
+ var $pluginHTML = '';
+ var $messageHTML;
+ var $name;
+ var $fields = array();
+
+ function MySharePlugin() {
+ }
+
+ function assign($name, $value) {
+ app()->tpl->assign($name,$value);
+ }
+
+ function display($tpl) {
+ $this->pluginHTML .= app()->fetch('plugins/'.$this->name.'/'.$tpl);
+ }
+
+ function init() {
+ }
+
+/* functions that can be called
+ * all functions receive an array with the parameters
+ * some of them are called with an empty array = no params
+ * auth module = loginForm, authenticate, logout,
+ * registerForm, registerConfirm, registerEnable
+ * files module = uploadRequest, uploadOptions, uploadConfirm, UploadFileInfo,
+ * downloadForm, downloadRequest, downloadConfirm, serveFile,
+ * removeRequest, removeResult
+ */
+
+}
+
+?>
\ No newline at end of file
Added: trunk/lib/general.inc.php
===================================================================
--- trunk/lib/general.inc.php (rev 0)
+++ trunk/lib/general.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,196 @@
+<?php
+/* Main library containing the general code for the application */
+
+ob_start();
+session_start();
+
+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/main.inc.php');
+
+/* check if the selected template needs personalizations code of some sort */
+if (file_exists($CONFIG['INSTALL_ROOT'].'/templates/'.$CONFIG['site']['template'].'/init.inc.php')) {
+ include ($CONFIG['INSTALL_ROOT'].'/templates/'.$CONFIG['site']['template'].'/init.inc.php');
+}
+
+/*************************************************************************************
+ * GLOBAL FUNCTIONS *
+ *************************************************************************************/
+
+function app() {
+ global $application;
+
+ return $application;
+}
+
+function redirect($url = '') {
+ global $_SERVER;
+ ob_clean();
+//echo 'redirect '.$url; exit;
+ /* there might be problems with urls containing other urls but this is not my case
+ anyway! */
+ if (strpos('http://',$url)===FALSE and strpos('https://',$url)===FALSE) {
+ header('location: '.$_SERVER['PHP_SELF'].$url);
+ } else {
+ header('location: '.$url);
+ }
+ exit(0);
+}
+
+function randomName($min = 10, $max = 20) {
+ $result = '';
+ for ($i = 1; $i<rand($min,$max); $i++) {
+ $result.= rand(0,9);
+ }
+ return $result;
+}
+
+
+function translate($txt,$domain,$args) {
+ /* now we retrieve the translated message */
+ $txt = app()->tr->translate($txt,$domain);
+ /* if there are arguments replace them */
+ if (count($args)>0) {
+ $trargs = array();
+ $i = 1;
+ foreach ($args as $a) {
+ $trargs['%'.$i]=$a;
+ $i++;
+ }
+ $txt = strtr($txt,$trargs);
+ }
+ /* return the trasnalted text */
+ return $txt;
+}
+/**
+ * @name tr
+ * @param $txt
+ * @param ...
+ * @description translates a string either from template or from code.
+ *
+ */
+function tr($txt) {
+ /* now we retrieve the translated message */
+ $args = array();
+ if (func_num_args()>1) {
+ $args = func_get_args();
+ array_shift($args);
+ }
+ $txt = translate($txt,'openupload',$args);
+ return $txt;
+}
+
+/**
+Validate an email address.
+Provide email address (raw input)
+Returns true if the email address has the email
+address format and the domain exists.
+Note: taken from here: http://www.linuxjournal.com/article/9585
+*/
+function validEmail($email)
+{
+ $isValid = true;
+ $atIndex = strrpos($email, "@");
+ if (is_bool($atIndex) && !$atIndex)
+ {
+ $isValid = false;
+ }
+ else
+ {
+ $domain = substr($email, $atIndex+1);
+ $local = substr($email, 0, $atIndex);
+ $localLen = strlen($local);
+ $domainLen = strlen($domain);
+ if ($localLen < 1 || $localLen > 64)
+ {
+ // local part length exceeded
+ $isValid = false;
+ }
+ else if ($domainLen < 1 || $domainLen > 255)
+ {
+ // domain part length exceeded
+ $isValid = false;
+ }
+ else if ($local[0] == '.' || $local[$localLen-1] == '.')
+ {
+ // local part starts or ends with '.'
+ $isValid = false;
+ }
+ else if (preg_match('/\\.\\./', $local))
+ {
+ // local part has two consecutive dots
+ $isValid = false;
+ }
+ else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain))
+ {
+ // character not valid in domain part
+ $isValid = false;
+ }
+ else if (preg_match('/\\.\\./', $domain))
+ {
+ // domain part has two consecutive dots
+ $isValid = false;
+ }
+ else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
+ str_replace("\\\\","",$local)))
+ {
+ // character not valid in local part unless
+ // local part is quoted
+ if (!preg_match('/^"(\\\\"|[^"])+"$/',
+ str_replace("\\\\","",$local)))
+ {
+ $isValid = false;
+ }
+ }
+ if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A")))
+ {
+ // domain not found in DNS
+ $isValid = false;
+ }
+ }
+ return $isValid;
+}
+
+/* this function generates a mail from a template */
+function sendmail($from,$reply,$to,$subject,$template, $attach = array()) {
+ $tpl = &app()->tpl;
+ $tpl->assign('subject',$subject);
+ $tpl->assign('from',$from);
+ $tpl->assign('to',$to);
+ /* generate a boundary */
+ $bound1 = "==Multipart_Bounday_x".md5(time())."x";
+ /* generate a second boundary for the alternativa */
+ $header = "From: ".$from."\nReply-To: ".$reply."\n";
+ $header .= "Mime-Version: 1.0\n";
+ if (count($attach)>0) {
+ $bound2 = "==Multipart_Bounday_z".md5(time())."z";
+ $header .= "Content-Type: multipart/mixed;\n boundary=\"".$bound1."\"";
+ } else {
+ $bound2 = $bound1;
+ $header .= "Content-Type: multipart/alternative;\n boundary=\"".$bound1."\"";
+ }
+ $tpl->assign('boudary',$bound2);
+ $msg = app()->fetch($template);
+
+ /* now add the attachements */
+ if (count($attach)>0) {
+ foreach ($attach as $a) {
+ $msg .="--".$bound1."\n";
+ $msg .="Content-Type: ".$a['mime'].";\n name=\"".$a['name']."\"\n";
+ $msg .="Content-Disposition: attachment; filename=\"".$a['name']."\"\n";
+ $msg .="Content-Transfer-Encoding: base64\n\n";
+ $msg .=chunk_split(base64_encode(file_get_contents($a['file'])));
+ }
+ $msg .="\n--".$bound1."--\n";
+ $msg .="\n--".$bound2."--\n";
+ } else {
+ $msg .="\n--".$bound1."--\n";
+ }
+ return mail($to,$subject,$msg,$header,'-f "'.$from.'"');
+}
+
+
+
+
+?>
Added: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php (rev 0)
+++ trunk/lib/main.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,274 @@
+<?php
+
+class Application {
+ var $db; /* database */
+ var $auth; /* authentication */
+ var $tr; /* trasnlation */
+ var $config; /* condifuration */
+ var $user; /* user */
+ var $modules; /* modules */
+ var $actions; /* actions related to modules */
+ var $plugins; /* plugins for modules */
+ var $page; /* page global config */
+ var $acl; /* module acl */
+ var $pluginAcl; /* plugin acl */
+
+ function Application($CONFIG) {
+ global $application;
+
+ $application = $this;
+ $this->config = $CONFIG;
+
+ /* initialize template engine */
+ $this->tpl = new Smarty();
+ $this->tpl->template_dir = $this->config['INSTALL_ROOT'].'/templates';
+ $this->tpl->compile_dir = $this->config['INSTALL_ROOT'].'/templates_c/';
+ $this->tpl->config_dir = SMARTY_DIR.'/config';
+ $this->tpl->cache_dir = $this->config['INSTALL_ROOT'].'/cache';
+ $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']='it';
+ }
+
+ /* include the class first */
+ $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']);
+
+ /* authentication module */
+ if (isset($this->config['auth'])) {
+ $authmname = $this->config['auth'];
+ } else {
+ $authmname = 'default';
+ }
+ 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'])) {
+ $trname = $this->config['translator'];
+ } else {
+ $trname = 'gettext';
+ }
+ require_once($this->config['INSTALL_ROOT'].'/lib/modules/tr/'.$trname.'.inc.php');
+ $tr = $trname.'Translator';
+ $this->tr = new $tr();
+ $this->tr->init();
+
+ $this->config['modules'][]='files';
+ $this->config['modules'][]='auth';
+ $this->config['modules'][]='admin';
+
+ $this->loadACL();
+ $this->initModules();
+ }
+
+ 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');
+ } else {
+ return $this->tpl->fetch('default/'.$tname.'.tpl');
+ }
+ }
+
+ function display($tname) {
+ if (file_exists($this->tpl->template_dir.'/'.$this->config['site']['template'].'/'.$tname.'.tpl')) {
+ $this->tpl->display($this->config['site']['template'].'/'.$tname.'.tpl');
+ } else {
+ $this->tpl->display('default/'.$tname.'.tpl');
+ }
+ }
+
+ function message($msg) {
+ global $_SESSION;
+ $_SESSION['user']['messages'][] = $msg;
+ }
+
+ function error($msg) {
+ global $_SESSION;
+ $_SESSION['user']['errors'][] = $msg;
+ }
+
+ function initModules() {
+ /* initialize configured modules */
+ foreach ($this->config['modules'] as $module) {
+ /* create and initialize the module */
+ require_once($this->config['INSTALL_ROOT'].'/lib/modules/default/'.$module.'.inc.php');
+ $m = $module.'Module';
+ $m = new $m();
+ $m->name = $module;
+ $m->tpl = &$this->tpl;
+ foreach ($m->actions as $k => $l) {
+ $this->actions[$k] = $m->name;
+ $this->modules[$module] = $m;
+ }
+ }
+ foreach ($this->modules as $m) {
+ $m->init();
+ }
+ }
+
+ function initMenu($auth = false) {
+
+ $this->menu = array();
+ foreach ($this->modules as $m) {
+ foreach ($m->actions as $k => $a) {
+ if (isset($m->menu[$k])) {
+ $group = app()->user->userGroup();
+ if ($this->checkACL($group,$m->name,$k) == 'allow') {
+ $this->menu[$k]=$m->menu[$k];
+ }
+ }
+ }
+ }
+ $this->tpl->assign('menu',$this->menu);
+ }
+
+ function initPlugins() {
+ /* initialize plugin system */
+
+ $this->plugins = array();
+ /* load the plugins */
+ foreach ($this->config['plugins'] as $plugin) {
+ /* include the file */
+ if (file_exists($this->config['INSTALL_ROOT'].'/plugins/'.$plugin.'.inc.php')) {
+ require_once($this->config['INSTALL_ROOT'].'/plugins/'.$plugin.'.inc.php');
+ $pname = $plugin."Plugin";
+ $newp = new $pname();
+ $newp->name = $plugin;
+ $this->plugins[] = $newp;
+ } else {
+ $this->error(tr('plugin include file not found: %1',$plugin));
+ }
+ }
+ foreach ($this->plugins as $plugin) {
+ $plugin->init();
+ }
+ }
+
+ function pluginAction($action,&$finfo,$stop = true) {
+ $this->pluginHTML = '';
+ $result = true;
+
+ if (!is_array($this->plugins))
+ return true;
+ foreach ($this->plugins as $plugin) {
+ if (method_exists($plugin,$action)) {
+ /* check plugin acl */
+ $acl = 'disable'; /* disabled by default */
+ if (isset($this->pluginAcl[$plugin->name])) {
+ $acl = $this->pluginAcl[$plugin->name];
+ }
+ if (!$plugin->$action($finfo,$acl)) {
+ if ($stop) return false;
+ $result = false;
+ }
+ $this->pluginHTML .= $plugin->pluginHTML;
+ }
+ }
+ return $result;
+ }
+
+ function loadACL() {
+ /* loads the acl from the db */
+ $group = $this->user->userGroup();
+ $this->acl = $this->db->loadACL($group);
+ $this->pluginAcl = $this->db->loadPluginAcl($group);
+ }
+
+ 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];
+ } else if (isset($this->acl[$group][$module]['*'])) {
+ $result = $this->acl[$group][$module]['*'];
+ } else if (isset($this->acl[$group]['*']['*'])) {
+ $result = $this->acl[$group]['*']['*'];
+ } else if (isset($this->acl['*'][$module][$action])) {
+ $result = $this->acl['*'][$module][$action];
+ } else if (isset($this->acl['*'][$module]['*'])) {
+ $result = $this->acl['*'][$module]['*'];
+ } else if (isset($this->acl['*']['*']['*'])) {
+ $result = $this->acl['*']['*']['*']; /* this should be avoided imho */
+ }
+
+ if ($this->config['debug_acl'] and $result == 'deny') {
+ echo 'group: '.$group.'<br>'; print_r($this->acl); exit;
+ }
+
+ return $result;
+ }
+
+ function run($action = '',$step = 0) {
+ global $_SERVER;
+ global $_SESSION;
+
+ $this->mainPage = 'index';
+
+ /* setup the template variable */
+ if (!isset($this->config['defaultaction'])) $this->config['defaultaction']='u';
+
+ $this->action= $action=='' ? $this->config['defaultaction']:$action;
+ $this->step= $step==0 ?1:$step;
+
+ $this->tpl->assign('action',$this->action);
+ $this->tpl->assign('step',$this->step);
+ $this->tpl->assign('nextstep',$this->step+1);
+ $this->tpl->assign('site',$this->config['site']);
+ $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 */
+ redirect();
+ }
+ /* get the handling module */
+ $mname = $this->actions[$this->action];
+ $m = &$this->modules[$mname];
+ $group = $this->user->userGroup();
+
+ if ($this->checkACL($group,$mname,$this->action)!='allow') {
+ redirect();
+ }
+ $this->initPlugins();
+
+ $this->initMenu($this->user->loggedin());
+
+ /* now run the module */
+ if (isset($m->actions[$this->action][$this->step])) {
+ $fun = $m->actions[$this->action][$this->step];
+ } else {
+ $fun = $m->actions[$this->action][1];
+ }
+ if (isset($m->page[$this->action])) {
+ foreach ($m->page[$this->action] as $k => $v) {
+ $this->page[$k] = $v;
+ }
+ }
+ $this->tpl->assign('user',$_SESSION['user']);
+ $m->$fun();
+
+ /* now display the final page */
+ $this->tpl->assign('user',$_SESSION['user']);
+ unset($_SESSION['user']['messages']);
+ unset($_SESSION['user']['errors']);
+ $this->tpl->assign('plugins',$this->pluginHTML);
+ $this->page['content']=$this->fetch('modules/'.$m->name.'/'.$fun);
+ $this->tpl->assign('page',$this->page);
+ $this->display($this->mainPage);
+ }
+}
+
+?>
Added: trunk/locale/en.inc.php
===================================================================
--- trunk/locale/en.inc.php (rev 0)
+++ trunk/locale/en.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,3 @@
+<?php
+// english is default, don't translate
+?>
\ No newline at end of file
Added: trunk/locale/it.inc.php
===================================================================
--- trunk/locale/it.inc.php (rev 0)
+++ trunk/locale/it.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,20 @@
+<?php
+$tr['Login']='Accedi';
+$tr['File upload']='Carica file';
+$tr['File download']='Scarica file';
+$tr['File Removal']='Rimuovi file';
+$tr['File Upload']='Carica file';
+$tr['User registration']='Registrazione utente';
+$tr['Carica file']='Carica file';
+$tr['Accedi']='Accedi';
+$tr['Login name must be at least 5 characters long!']='Il Nome utente deve essere lungo almeno 5 caratteri!';
+$tr['Please insert Full Name']='Inserire il nome completo';
+$tr['Please insert a valid e-mail!']='Inserire un indirizzo e-mail valido!';
+$tr['Password must be at least 5 characters long!']='La password deve essere lunga almeno 5 caratteri!';
+$tr['Wrong captcha code! please try again.']='Codice captcha errato! Prego riprovare.';
+$tr['Login incorrect!']='Login non valido!';
+$tr['Logout']='Esci';
+$tr['Your e-mail address isn\'t valid!']='L\'indirizzo e-mail non è valido!';
+$tr['Information about your uploaded file: %1']='Informazioni relative al file caricato: %1';
+$tr['Wrong password!']='Password errata!';
+?>
Added: trunk/plugins/banned.inc.php
===================================================================
--- trunk/plugins/banned.inc.php (rev 0)
+++ trunk/plugins/banned.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,91 @@
+<?php
+
+
+class BannedPlugin extends OpenUploadPlugin {
+
+ function BannedPlugin() {
+ }
+
+ function init() {
+ global $_SERVER;
+
+ $this->banned = app()->db->loadTable('banned','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'])) {
+ if ($row['access']!='allow') {
+ $this->banned();
+ } else {
+ return;
+ }
+ }
+ }
+ /* no match has been found */
+ $this->banned();
+ }
+
+ function banned() {
+
+ $this->display('banned');
+ app()->page['content'] = $this->pluginHTML;
+ app()->page['title']= tr('IP Banned');
+ app()->tpl->assign('page',app()->page);
+ app()->display(app()->mainPage);
+ exit;
+ }
+
+ function convertSubnet($val) {
+ $sub = array();
+ if ($val<0) $val = 0;
+ if ($val>32) $val = 32;
+ for ($i=0; $i<4; $i++) {
+ $x = 0; /* could be done with a for... */
+ if ($val>0) $x += 128;
+ if ($val>1) $x += 64;
+ if ($val>2) $x += 32;
+ if ($val>3) $x += 16;
+ if ($val>4) $x += 8;
+ if ($val>5) $x += 4;
+ if ($val>6) $x += 2;
+ if ($val>7) $x += 1;
+ $sub[$i] = $x;
+ $val = $val - 8;
+ }
+ return $sub;
+ }
+
+ function matchIP($sip,$exp) {
+ if (strpos($exp,'/')!==FALSE) {
+ $x = explode('/',$exp);
+ $net = $x[0];
+ $sub = $x[1];
+ if (strpos($sub,'.')===FALSE) {
+ /* it's a single number convert to subnet mask*/
+ $sub = $this->convertSubnet($sub);
+ } else {
+ $sub = explode('.',$sub);
+ }
+ } else { /* single ip */
+ $net = $exp;
+ $sub = array(255,255,255,255);
+ }
+ $ip = explode('.',$sip);
+ $net = explode('.',$net);
+
+ /* now do the match */
+ $mip[0] = $ip[0] & $sub[0];
+ $mip[1] = $ip[1] & $sub[1];
+ $mip[2] = $ip[2] & $sub[2];
+ $mip[3] = $ip[3] & $sub[3];
+ $dip[0] = $net[0] & $sub[0];
+ $dip[1] = $net[1] & $sub[1];
+ $dip[2] = $net[2] & $sub[2];
+ $dip[3] = $net[3] & $sub[3];
+ if (($mip[0] == $dip[0]) and ($mip[1] == $dip[1]) and
+ ($mip[2] == $dip[2]) and ($mip[3] == $dip[3]))
+ return true;
+ else
+ return false;
+ }
+}
+?>
\ No newline at end of file
Added: trunk/plugins/captcha.inc.php
===================================================================
--- trunk/plugins/captcha.inc.php (rev 0)
+++ trunk/plugins/captcha.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,63 @@
+<?php
+
+class CaptchaPlugin extends OpenUploadPlugin {
+
+ function CaptchaPlugin() {
+ $this->fields = array('captcha');
+ $this->description = tr('Add captcha protection to file download and user registration');
+ }
+
+ function uploadOptions(&$finfo,$acl) {
+ if ($acl!='enable') return true;
+ $this->display('uploadOptions');
+ return true;
+ }
+
+ function uploadConfirm(&$finfo,$acl) {
+ global $_POST;
+
+ if ($acl!='enable') return true;
+ $finfo['captcha'] = $_POST['captcha'];
+ return true;
+ }
+
+ function downloadRequest($finfo,$acl) {
+ if ($finfo['captcha']==1) {
+ $this->assign('captcha_img',app()->config['WWW_ROOT'].'/plugins/captcha.php');
+ $this->display('downloadRequest');
+ return false;
+ }
+ return true;
+ }
+
+ function downloadConfirm($finfo,$acl) {
+ global $_POST;
+
+ if ($finfo['captcha']==1) {
+ require_once(app()->config['INSTALL_ROOT'].'/plugins/securimage/securimage.php');
+ $securimage = new Securimage();
+ $result = $securimage->check($_POST['captcha_code']);
+ if (!$result) app()->error(tr('Wrong captcha code! please try again.'));
+ return $result;
+ } else
+ return true;
+ }
+
+ function registerForm($uinfo,$acl) {
+ $this->assign('captcha_img',app()->config['WWW_ROOT'].'/plugins/captcha.php');
+ $this->display('registerForm');
+ return true;
+ }
+
+ function registerConfirm(&$uinfo,$acl) {
+ global $_POST;
+
+ require_once(app()->config['INSTALL_ROOT'].'/plugins/securimage/securimage.php');
+ $securimage = new Securimage();
+ $result = $securimage->check($_POST['captcha_code']);
+ if (!$result) app()->error(tr('Wrong captcha code! please try again.'));
+ return $result;
+ }
+}
+
+?>
\ No newline at end of file
Added: trunk/plugins/email.inc.php
===================================================================
--- trunk/plugins/email.inc.php (rev 0)
+++ trunk/plugins/email.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,71 @@
+<?php
+
+class emailPlugin extends OpenUploadPlugin {
+
+ function emailPlugin() {
+ $this->description = 'Add option to send e-mail to the uploader or to another e-mail address';
+ }
+
+ function uploadOptions(&$finfo,$acl) {
+ if ($acl!='enable') return true;
+ $this->display('uploadOptions');
+ return true;
+ }
+
+ function uploadConfirm(&$finfo,$acl) {
+ global $_POST;
+ if ($acl!='enable') return true;
+ /* do e-mail checking and so */
+/* $this->display('upload'); */
+ $finfo['emailme']=$_POST['emailme'];
+ $finfo['emailfrom']=app()->config['site']['email'];
+ $finfo['emailto']=$_POST['emailto'];
+ $finfo['email_removelink']=$_POST['removelink'];
+ $finfo['subject']=$_POST['subject'];
+ $finfo['message']=$_POST['message'];
+ if ($finfo['emailme']=="yes") {
+ if ($_SESSION['user']['email']=='') {
+ /* check valid e-mail */
+ if (!validEmail($_POST['email'])) {
+ app()->error(tr('Your e-mail address isn\'t valid!'));
+ return false;
+ }
+ $finfo['emailfrom']=$_POST['email'];
+ } else {
+ $finfo['emailfrom']=$_SESSION['user']['name'].' <'.$_SESSION['user']['email'].'>';
+ }
+ }
+ if ($finfo['emailto']!='') {
+ if (!validEmail($_POST['emailto'])) {
+ app()->error(tr('Destination e-mail address isn\'t valid!'));
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ function uploadFileInfo(&$finfo,$acl) {
+ global $_SESSION;
+
+ if ($acl!='enable') return true;
+ /* send the e-mails */
+ app()->tpl->assign('finfo',$finfo);
+ if ($finfo['emailme']=="yes") {
+ app()->tpl->assign('remove','yes');
+ $subject = app()->config['site']['title'].': '.tr("Information about your uploaded file: %1",$finfo['name']);
+ sendMail(app()->config['site']['email'],'noreply',$finfo['emailfrom'],$subject,'plugins/email/notify');
+ }
+ if ($finfo['emailto']!='') {
+ $subject = $finfo['subject']!=''?$finfo['subject']:tr("An upload was delivered to you");
+ $subject = app()->config['site']['title'].': '.$subject;
+ app()->tpl->assign('remove',$finfo['email_removelink']);
+ sendMail($finfo['emailfrom'],$finfo['emailfrom'],$finfo['emailto'],$subject,'plugins/email/notify');
+ }
+ /* don't send it twice */
+ $finfo['emailme']=='';
+ $finfo['emailto']=='';
+//exit();
+ return true;
+ }
+}
\ No newline at end of file
Added: trunk/plugins/mimetypes.inc.php
===================================================================
--- trunk/plugins/mimetypes.inc.php (rev 0)
+++ trunk/plugins/mimetypes.inc.php 2008-10-15 13:53:52 UTC (rev 8)
@@ -0,0 +1,31 @@
+<?php
+
+class MimeTypesPlugin extends OpenUploadPlugin {
+
+ function MimeTypes() {
+ $this->description = tr('Limit the mimetypes a user can upload');
+ }
+
+ function uploadForm(&$finfo,$acl) {
+ if ($acl!='enable') return true;
+ ...
[truncated message content] |
|
From: <ts...@us...> - 2008-10-15 18:14:26
|
Revision: 20
http://openupload.svn.sourceforge.net/openupload/?rev=20&view=rev
Author: tsdogs
Date: 2008-10-15 18:14:17 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
add administration of users
Modified Paths:
--------------
trunk/lib/modules/db/mysql.inc.php
trunk/lib/modules/default/admin.inc.php
trunk/www/templates/default/main.css
Added Paths:
-----------
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
trunk/www/templates/default/img/admin/active0.png
trunk/www/templates/default/img/admin/active1.png
trunk/www/templates/default/img/admin/delete_user.png
trunk/www/templates/default/img/admin/edit_user.png
trunk/www/templates/default/img/admin/tadd_user.png
trunk/www/templates/default/img/admin/tdelete_user.png
Modified: trunk/lib/modules/db/mysql.inc.php
===================================================================
--- trunk/lib/modules/db/mysql.inc.php 2008-10-15 16:18:27 UTC (rev 19)
+++ trunk/lib/modules/db/mysql.inc.php 2008-10-15 18:14:17 UTC (rev 20)
@@ -27,8 +27,11 @@
}
}
- function queryUser($login) {
- $res = mysql_query('select * from '.$this->prefix.'users where login="'.mysql_real_escape_string($login).'" and active=1');
+ 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);
@@ -51,13 +54,13 @@
$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']).'"'.
- 'where id="'.$user['id'].'"';
+ 'where login="'.$user['login'].'"';
mysql_query($sql);
}
- function deleteUser($user) {
+ function deleteUser($login) {
$e = 'mysql_real_escape_string';
- $sql = 'delete from '.$this->prefix.'users where id="'.$user['id'].'"';
+ $sql = 'delete from '.$this->prefix.'users where login="'.$login.'"';
mysql_query($sql);
}
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-10-15 16:18:27 UTC (rev 19)
+++ trunk/lib/modules/default/admin.inc.php 2008-10-15 18:14:17 UTC (rev 20)
@@ -16,6 +16,10 @@
),
"adminusers" => array (
1 => "users",
+ 2 => "useradd",
+ 3 => "useredit",
+ 4 => "userdel",
+ 5 => "useractivate",
),
"admingroups" => array (
1 => "groups",
@@ -45,8 +49,115 @@
}
function users() {
+ /* List the users */
+ $users = app()->db->loadTable('users','login');
+ $this->tpl->assign('users',$users);
}
+ function useradd() {
+ global $_POST;
+
+ $groups = app()->db->loadTable('groups','name');
+ $this->tpl->assign('groups',$groups);
+ if (isset($_POST['adduserlogin'])) {
+ /* add the user */
+ $user['login']=$_POST['adduserlogin'];
+ $user['name']=$_POST['addusername'];
+ $user['group_id']=$_POST['addusergroup'];
+ $user['email']=$_POST['adduseremail'];
+ $user['active']=$_POST['adduseractive'];
+ $error = false;
+ if (strlen($_POST['adduserlogin'])<5) {
+ app()->error('login name must be at least 5 char long!');
+ $error = true;
+ }
+ if (strlen($_POST['adduserpassword'])<5) {
+ app()->error('password must be at least 5 char long!');
+ $error = true;
+ } else if ($_POST['adduserpassword']!=$_POST['adduserrepassword']) {
+ app()->error('Passwords do not correspond!');
+ $error = true;
+ }
+ if (!validEmail($_POST['adduseremail'])) {
+ app()->error('e-mail is not a valid address!');
+ $error = true;
+ }
+ if (!$error) {
+ $user['password']=crypt($_POST['adduserpassword']);
+ app()->db->addUser($user);
+ /* redirect */
+ $this->nextStep(1);
+ }
+ }
+ if (!isset($user)) {
+ $user['active']=1;
+ $user['group_id']=app()->config['register']['default_group'];
+ }
+ $this->tpl->assign('adduser',$user);
+ }
+
+ function userdel() {
+ global $_GET;
+
+ if (isset($_GET['id'])) {
+ app()->db->deleteUser($_GET['id']);
+ }
+ $this->nextStep(1);
+ }
+
+ function useractivate() {
+ global $_GET;
+
+ if (isset($_GET['id'])) {
+ $active=$_GET['active']==1?0:1;
+ $user = app()->db->queryUser($_GET['id'],false);
+ if ($user['login']==$_GET['id']) {
+ $user['active']=$active;
+ app()->db->updateUser($user);
+ }
+ }
+ $this->nextStep(1);
+ }
+
+ function useredit() {
+ global $_GET;
+ global $_POST;
+ /* edit the user */
+ $groups = app()->db->loadTable('groups','name');
+ $this->tpl->assign('groups',$groups);
+ if (isset($_POST['login'])) {
+ $user = app()->db->queryUser($_POST['login'],false);
+ $user['name']=$_POST['editusername'];
+ $user['group_id']=$_POST['editusergroup'];
+ $user['email']=$_POST['edituseremail'];
+ $user['active']=$_POST['edituseractive'];
+ $error = false;
+ if ($_POST['edituserpassword']!='') {
+ if (strlen($_POST['edituserpassword'])<5) {
+ app()->error('password must be at least 5 char long!');
+ $error = true;
+ } else if ($_POST['edituserpassword']!=$_POST['edituserrepassword']) {
+ app()->error('Passwords do not correspond!');
+ $error = true;
+ }
+ if (!$error)
+ $user['password']=crypt($_POST['edituserpassword']);
+ }
+ if (!validEmail($_POST['edituseremail'])) {
+ app()->error('e-mail is not a valid address!');
+ $error = true;
+ }
+ if (!$error) {
+ app()->db->updateUser($user);
+ /* redirect */
+ $this->nextStep(1);
+ }
+ } else {
+ $user = app()->db->queryUser($_GET['id'],false);
+ }
+ $this->tpl->assign('edituser',$user);
+ }
+
function groups() {
}
Added: trunk/templates/default/modules/admin/adminmenu.tpl
===================================================================
--- trunk/templates/default/modules/admin/adminmenu.tpl (rev 0)
+++ trunk/templates/default/modules/admin/adminmenu.tpl 2008-10-15 18:14:17 UTC (rev 20)
@@ -0,0 +1,6 @@
+<div id="menu">
+<ul>
+ <li><a href="{$script}?action=adminusers">{tr}Users{/tr}</a></li>
+</ul>
+</div>
+<hr>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/useradd.tpl
===================================================================
--- trunk/templates/default/modules/admin/useradd.tpl (rev 0)
+++ trunk/templates/default/modules/admin/useradd.tpl 2008-10-15 18:14:17 UTC (rev 20)
@@ -0,0 +1,18 @@
+<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}Login name{/tr}:</td><td><input type="text" name="adduserlogin" value="{$adduser.login}"></td></tr>
+<tr><td>{tr}Password{/tr}:</td><td><input type="password" name="adduserpassword"></td></tr>
+<tr><td>{tr}Retype Password{/tr}:</td><td><input type="password" name="adduserrepassword"></td></tr>
+<tr><td>{tr}Full Name{/tr}:</td><td><input type="text" name="addusername" value="{$adduser.name}"></td></tr>
+<tr><td>{tr}e-mail{/tr}:</td><td><input type="text" name="adduseremail" value="{$adduser.email}"></td></tr>
+<tr><td>{tr}Group{/tr}:</td><td><select name="addusergroup">
+ {foreach from=$groups item=g}
+ <option value="{$g.name}" {if $g.name==$adduser.group_id} selected{/if}>{$g.description}</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>
+</form>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/useredit.tpl
===================================================================
--- trunk/templates/default/modules/admin/useredit.tpl (rev 0)
+++ trunk/templates/default/modules/admin/useredit.tpl 2008-10-15 18:14:17 UTC (rev 20)
@@ -0,0 +1,19 @@
+<form action="{$script}" method="post">
+<input type="hidden" name="action" value="{$action}">
+<input type="hidden" name="step" value="{$step}">
+<input type="hidden" name="login" value="{$edituser.login}">
+<table border="0">
+<tr><td>{tr}Login name{/tr}:</td><td>{$edituser.login}</td></tr>
+<tr><td>{tr}Password{/tr}:</td><td><input type="password" name="edituserpassword"></td></tr>
+<tr><td>{tr}Retype Password{/tr}:</td><td><input type="password" name="edituserrepassword"></td></tr>
+<tr><td>{tr}Full Name{/tr}:</td><td><input type="text" name="editusername" value="{$edituser.name}"></td></tr>
+<tr><td>{tr}e-mail{/tr}:</td><td><input type="text" name="edituseremail" value="{$edituser.email}"></td></tr>
+<tr><td>{tr}Group{/tr}:</td><td><select name="editusergroup">
+ {foreach from=$groups item=g}
+ <option value="{$g.name}" {if $g.name==$edituser.group_id} selected{/if}>{$g.description}</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>
+</form>
\ No newline at end of file
Added: trunk/templates/default/modules/admin/users.tpl
===================================================================
--- trunk/templates/default/modules/admin/users.tpl (rev 0)
+++ trunk/templates/default/modules/admin/users.tpl 2008-10-15 18:14:17 UTC (rev 20)
@@ -0,0 +1,34 @@
+{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_user.png"></a>
+<img src="{$page.template}/img/admin/tdelete_user.png">
+</div>
+<br>
+<table border="0" id="dbtable">
+<tr>
+ <th width="10">S</th>
+ <th width="100">Login</th>
+ <th width="200">Name</th>
+ <th width="100">Group</th>
+ <th width="200">E-mail</th>
+ <th width="20">Active</th>
+ <th width="100">Actions</th>
+</tr>
+{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">{$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}">
+ <img src="{$page.template}/img/admin/active{$u.active}.png">
+ </a>
+ </td>
+ <td id="row1">
+ <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>
+</tr>
+{/foreach}
+</table>
\ No newline at end of file
Added: trunk/www/templates/default/img/admin/active0.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/active0.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/active1.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/active1.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/delete_user.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/delete_user.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/edit_user.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/edit_user.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tadd_user.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tadd_user.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tdelete_user.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tdelete_user.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-15 16:18:27 UTC (rev 19)
+++ trunk/www/templates/default/main.css 2008-10-15 18:14:17 UTC (rev 20)
@@ -134,4 +134,24 @@
border-right: 1px solid #2d55b4;
border-bottom: 1px solid #2d55b4;
font-weight: bold;
+}
+img {
+ border: 0px;
+}
+#dbtable {
+ border: 1px solid #000;
+}
+#dbtable th {
+ background-color: #4c8dff;
+ color: #ffffff;
+ font-weight: bold;
+}
+#dbtable #row1 {
+ padding: 2px;
+ background-color: #fafafa;
+ text-align: center;
+}
+#datatable #row2 {
+ background-color: #adadad;
+ text-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: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.
|
|
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 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 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-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['edit...
[truncated message content] |
|
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-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-22 17:44:15
|
Revision: 47
http://openupload.svn.sourceforge.net/openupload/?rev=47&view=rev
Author: tsdogs
Date: 2008-10-22 17:44:07 +0000 (Wed, 22 Oct 2008)
Log Message:
-----------
Add e-mail confirmation on registration
Modified Paths:
--------------
trunk/TODO
trunk/lib/modules/auth/default.inc.php
trunk/lib/modules/default/auth.inc.php
trunk/sql/mysql/1_structure.sql
trunk/sql/mysql/2_base.sql
trunk/templates/default/modules/auth/registerConfirm.tpl
trunk/templates/default/modules/auth/registerEnable.tpl
trunk/www/config.inc.php.example
Added Paths:
-----------
trunk/templates/default/modules/auth/emailconfirm.tpl
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/TODO 2008-10-22 17:44:07 UTC (rev 47)
@@ -5,42 +5,34 @@
Administration
- Admin of banned IPs
-Registration
-- Enable registration moderation
-- Enable registration with e-mail confirmation
-
-Database
-- txtdb needs some work
-
Translation
- Update the translations
Download
-- Change serve file method to not go over the memory php limit and not timeout when serving a file.
+- Let it not reach timeout when serving a file.
General
-- make sub www folders not accessible by default (some index.php needed)
+- make sub www folders not accessible by default (some index.php/html files needed)
-******* MIGHT BE IN RELEASE *******
-Registration
-- Enable registration moderation
+Templates
+- remove absolute paths from templates, to retrieve default template file if template file is not found
+******* WOULD LIKE IT TO BE IN RELEASE *******
Authentication
- LDAP authentication for Openldap and AD support
-Database
-- pgsql module
-
Upload
- Display upload progress
-Administration
-- Rights switch mode (to switch from 1 mode to the other)
-- Rights better admin tool.
+Database
+- pgsql module
Plugins
-- Upload different filesize limiting depending on group
+- Upload different filesize limiting depending on group (needs plugin options based on groups)
+Maintainence
+- Create a script to clean up the files/tmpfiles.
+
******* OTHER THINGS/IDEAS *******
General
@@ -50,13 +42,24 @@
Users
- manage personal files (if allowed)
+Database
+- txtdb needs some work. might need file locks.
+
Administration
- Review the general administration module
- First setup script
- Config administration
- Language table admin.
- Plugin options
+- Rights switch mode (to switch from 1 mode to the other)
+- Rights better admin tool.
+Registration
+- Enable registration moderation
+
+User
+- e-mail change should need a confirmation e-mail too!
+
Download
- Fix double click on no blockings for download
@@ -74,7 +77,6 @@
- Add a database translator? not until base isn't complete.
Maintainence
-- Create a script to clean up the files/tmpfiles.
- Manage file deletion timeout probably better to be handled here.
Template
Modified: trunk/lib/modules/auth/default.inc.php
===================================================================
--- trunk/lib/modules/auth/default.inc.php 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/lib/modules/auth/default.inc.php 2008-10-22 17:44:07 UTC (rev 47)
@@ -5,7 +5,7 @@
var $userfields;
function defaultAuth() {
- $this->userfields = array('id','login','password','name','group_id','email','lang','active');
+ $this->userfields = array('id','login','password','name','group_id','email','lang','reg_date','regid','active');
$this->features = array('info','add', 'update', 'delete');
}
Modified: trunk/lib/modules/default/auth.inc.php
===================================================================
--- trunk/lib/modules/default/auth.inc.php 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/lib/modules/default/auth.inc.php 2008-10-22 17:44:07 UTC (rev 47)
@@ -16,6 +16,7 @@
"register" => array (
1 => "registerForm",
2 => "registerConfirm",
+ 3 => "registerEnable",
),
);
var $page;
@@ -82,8 +83,14 @@
function registerForm() {
global $_SESSION;
+ global $_GET;
global $_POST;
+ if (isset($_GET['regid'])) {
+ /* confirm registration */
+ $_SESSION['user']['regidconfirm']=$_GET['regid'];
+ $this->nextStep(3);
+ }
/* ask the plugins if require more options */
$result = app()->pluginAction('registerForm',$user);
if (!$result) {
@@ -134,15 +141,26 @@
$user['email'] = $_POST['registeremail'];
$user['lang'] = $_POST['registerlang'];
$user['group_id'] = app()->config['register']['default_group'];
- $user['active'] = 1;
+ $user['reg_date']=date('Y-m-d H:i:s');
$result = app()->pluginAction('registerConfirm',$user);
$_SESSION['register']=$user;
unset($_SESSION['register']['password']);
if (!$result) {
- $fauled = true;
+ $failed = true;
}
if ($failed)
$this->prevStep(1); /* back to registration form */
+
+ if (app()->config['registration']['email_confirm']=='yes') {
+ $user['active'] = 0;
+ $user['regid']=app()->db->newRandomId('users','regid');
+ $subject = tr('[%1] User registration confirmation e-mail',app()->config['site']['title']);
+ $this->tpl->assign('reguser',$user);
+ $this->tpl->assign('reglink',app()->config['WWW_SERVER'].app()->config['WWW_ROOT'].'/?action=register®id='.$user['regid']);
+ sendMail(app()->config['site']['email'],'noreply',$user['email'],$subject,'modules/auth/emailconfirm');
+ } else {
+ $user['active'] = 1;
+ }
app()->auth->add($user);
} else {
$this->prevStep(1); /* back to registration form */
@@ -156,12 +174,25 @@
/* simulate the user login and proceed */
unset($_SESSION['user']);
$this->authenticate();
+ } else {
+ /* display a message */
+ $this->tpl->assign('emailconfirm',app()->config['registration']['email_confirm']);
+ $this->tpl->assign('moderation',app()->config['registration']['moderation']);
}
}
function registerEnable() {
+ global $_SESSION;
/* if everything is ok register the user */
-
+ if (isset($_SESSION['user']['regidconfirm'])) {
+ $user = app()->db->read('users',array('regid' => $_SESSION['user']['regidconfirm']));
+ if (count($user)>0) {
+ $user = $user[0];
+ $user['active']=1;
+ $user['regid']=''; /* disable possibility to reactivate it if disabled by the admin */
+ app()->db->update('users',$user,array('id' => $user['id']),array('active','regid'));
+ }
+ }
}
function profile() {
Modified: trunk/sql/mysql/1_structure.sql
===================================================================
--- trunk/sql/mysql/1_structure.sql 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/sql/mysql/1_structure.sql 2008-10-22 17:44:07 UTC (rev 47)
@@ -149,6 +149,8 @@
`group_id` varchar(50) NOT NULL default 'unregistered',
`email` varchar(250) NOT NULL,
`lang` varchar(10) NOT NULL default 'en',
+ `reg_date` datetime NOT NULL default now(),
+ `regid` varchar(50) NOT NULL default 'en',
`active` tinyint(3) unsigned NOT NULL default '1',
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`)
Modified: trunk/sql/mysql/2_base.sql
===================================================================
--- trunk/sql/mysql/2_base.sql 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/sql/mysql/2_base.sql 2008-10-22 17:44:07 UTC (rev 47)
@@ -39,7 +39,7 @@
-- 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);
+INSERT INTO `users` (`id`, `login`, `password`, `name`, `group_id`, `email`, `lang`, `active`) VALUES(1, 'admin', '$1$sLCQ3aFR$rCIb4Owhgi3mIHgYnbA351', 'Administrator', 'admins', 'ope...@yo...', 'en', now(), '', 1);
--
-- Dump dei dati per la tabella `acl`
Added: trunk/templates/default/modules/auth/emailconfirm.tpl
===================================================================
--- trunk/templates/default/modules/auth/emailconfirm.tpl (rev 0)
+++ trunk/templates/default/modules/auth/emailconfirm.tpl 2008-10-22 17:44:07 UTC (rev 47)
@@ -0,0 +1,88 @@
+This is a multi-part message MIME format.
+
+--{$boudary}
+Content-Type: text/plain; charset="iso-8559-1"
+Content-Transfer-Encoding: 7bit
+
+{tr}Dear {/tr} {$reguser.name},
+{tr}This e-mail message is sent to you to confirm your account registration has a valid e-mail address.{/tr}
+
+
+{tr}Open the following link in a browser to confirm your account.{/tr}:
+
+{$reglink}
+
+{tr}Best regards{/tr}.
+
+{if isset($adminemail)}
+-------------------
+{tr}For complains please send an email to{/tr}: {$adminemail}
+{/if}
+
+-------------------------------------------------------------------
+OpenUpload c by Alessandro Briosi http://openupload.sourceforge.net
+
+--{$boudary}
+Content-Type: text/html; charset="iso-8559-1"
+Content-Transfer-Encoding: 7bit
+
+<html>
+<header>
+<title>{$subject}</title>
+<style>
+{literal}
+body {
+ font-family: Arial, Helvetica, Tahoma;
+ font-size: 10pt;
+}
+a {
+ color: #3161cf;
+ font-weight: bold;
+ font-size: 11pt;
+ text-decoration: none;
+}
+a:visited {
+ color: #3161cf;
+ font-weight: bold;
+ font-size: 11pt;
+ text-decoration: none;
+}
+a:hover {
+ color: #4c8dff;
+ font-weight: bold;
+ font-size: 11pt;
+ text-decoration: none;
+}
+#footer {
+ clear: both;
+ position: fixed;
+ bottom: 0px;
+ height: 20px;
+ width: 100%;
+ font-weight: bold;
+ font-size: 9pt;
+ border-top: 1px solid #000000;
+ text-align: center;
+}
+
+</style>
+{/literal}
+</header>
+<body>
+<p>{tr}Dear {/tr} {$reguser.name},<br>
+{tr}This e-mail message is sent to you to confirm your account registration has a valid e-mail address.{/tr}</p>
+
+
+<p>{tr}Open the following link in a browser to confirm your account.{/tr}:<br>
+<a href="{$reglink}">{$reglink}</a></p>
+
+<p>{tr}Best regards{/tr}.</p>
+
+{if isset($adminemail)}
+<hr>
+<p>{tr}For complains please send an email to{/tr}: <a href="mailto:{$adminemail}">{$adminemail}</a></p>
+{/if}
+<div id="footer">OpenUpload © by Alessandro Briosi
+<a href="http://openupload.sourceforge.net>http://openupload.sourceforge.net</a></div>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/templates/default/modules/auth/registerConfirm.tpl
===================================================================
--- trunk/templates/default/modules/auth/registerConfirm.tpl 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/templates/default/modules/auth/registerConfirm.tpl 2008-10-22 17:44:07 UTC (rev 47)
@@ -1 +1,8 @@
-Registration succeded. <a href="{$script}">back to home</a>
\ No newline at end of file
+{tr}Registration succeded{/tr}. <br>
+
+{if $emailconfirm=='yes'}
+<p>{tr}An e-mail has been sent for the accout activation{/tr}.<br>
+{tr}Please follow the e-mail instructions to activate your account.{/tr}</p>
+{/if}
+<br>
+<a href="{$script}">{tr}back to home{/tr}</a>
\ No newline at end of file
Modified: trunk/templates/default/modules/auth/registerEnable.tpl
===================================================================
--- trunk/templates/default/modules/auth/registerEnable.tpl 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/templates/default/modules/auth/registerEnable.tpl 2008-10-22 17:44:07 UTC (rev 47)
@@ -0,0 +1,2 @@
+{tr}Your account registration has been confirmed.{/tr} <br/><br/>
+{tr}You can now proceed with the login{/tr} <a href="{$script}?action=login">{tr}here{/tr}</a>
\ No newline at end of file
Modified: trunk/www/config.inc.php.example
===================================================================
--- trunk/www/config.inc.php.example 2008-10-21 18:13:49 UTC (rev 46)
+++ trunk/www/config.inc.php.example 2008-10-22 17:44:07 UTC (rev 47)
@@ -24,11 +24,9 @@
* txt is a special mode where data is stored inside ascii files
* it can be used when no database is available
*/
-$CONFIG['database']['type']='mysql';
-/* Depending on the option above... */
-
/* MYSQL Database */
+$CONFIG['database']['type']='mysql';
$CONFIG['database']['host']='localhost';
$CONFIG['database']['user']='databaseuser';
$CONFIG['database']['password']='databasepwd';
@@ -38,6 +36,7 @@
//$CONFIG['database']['type']='txt';
//$CONFIG['database']['rootdir']=$CONFIG['INSTALL_ROOT'].'/txtdb';
+/* Table name prefix: should be common */
$CONFIG['database']['prefix']='';
/* PLUGINS: here you enable the plugins
@@ -53,7 +52,10 @@
/* Set maximum default upload size in MB*/
$CONFIG['max_upload_size']=100;
-/* SITE TITLE */
+/* if registration is enabled confirm it by e-amil ? */
+$CONFIG['registration']['email_confirm']='yes';
+
+/* SITE TITLE (also used for e-mails) */
$CONFIG['site']['title'] = 'Open Upload';
/* webmaster e-mail */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-22 17:46:26
|
Revision: 51
http://openupload.svn.sourceforge.net/openupload/?rev=51&view=rev
Author: tsdogs
Date: 2008-10-22 17:46:24 +0000 (Wed, 22 Oct 2008)
Log Message:
-----------
Doc update
Modified Paths:
--------------
trunk/CHANGELOG
trunk/INSTALL
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-10-22 17:46:00 UTC (rev 50)
+++ trunk/CHANGELOG 2008-10-22 17:46:24 UTC (rev 51)
@@ -2,6 +2,8 @@
* Registration
- Check for valid login name
+ - Enable registration with e-mail confirmation
+
* Upload
- Added main maximum upload file size checks
@@ -27,6 +29,9 @@
- array module
- initial Italian translation
+* Download
+ - Changeed serve file method to not go over the memory php limit (output buffer)
+
* Web site
- Created index page
- Addedd Screen shots
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2008-10-22 17:46:00 UTC (rev 50)
+++ trunk/INSTALL 2008-10-22 17:46:24 UTC (rev 51)
@@ -9,17 +9,34 @@
3. Copy all files to somewhere which is not accessible from the web (i.e. /usr/local/share/openupload)
4. Copy the www/ files into the web server folder (i.e. /var/www/html) or create a web server alias to point to the www/ folder
5. copy the www/config.inc.php.example and edit it to suit your installation
-6. Make sure the web server is able to write to the data directory
+6. Make sure the web server is able to write to the "data" directory
7. Create the database
+ see README for more information on mode and rights configuration
mysql:
- create the db and the user
create database <database>;
grant all privileges on <database>.* to '<user>'@'localhost' deintified by '<password>';
- import the database schema and default config options
- mysql <database> -u <user> -p < sql/mysql/openupload.sql
+ mysql <database> -u <user> -p < sql/mysql/1_schema.sql
+ mysql <database> -u <user> -p < sql/mysql/2_base.sql
+ - import the configuration mode (it is not required):
+ mysql <database> -u <user> -p < sql/mysql/3_<mode>.sql
+ txt:
+ - the txt is usable, but I would not suggest it unless it's a really low traffic site.
+ - make sure the "rootdir" for the txtdb folder is writable by your apache user
+ - copy the default files from sql/txt/*.txt to the "rootdir" folder
+ - substitute the wanted mode configuration acl_<mode>.txt over the acl.txt
8. Point your browser to http://localhost/<wherever>
+9. Login with "admin" "admin"
+10. Go to Profile and change your admin e-mail and password
+11. Enjoy! :)
+N.B. If you want to change something in the templates I'd suggest to create a site template and put there the needed changed files,
+ (templates/<yourtemplate> or www/templates/<yourtemplate>).
+ The program will check for the exsistence of a file in the selected template folder, and if not found will go back to the default.
+ This will avoid problems when updating the program to a new version.
+
BIG FAT NOTE:
The program will work even if you copy the whole folder into the web server root or a subdiretory.
But:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-23 10:34:22
|
Revision: 63
http://openupload.svn.sourceforge.net/openupload/?rev=63&view=rev
Author: tsdogs
Date: 2008-10-23 10:30:01 +0000 (Thu, 23 Oct 2008)
Log Message:
-----------
remove banned plugin
Modified Paths:
--------------
trunk/www/config.inc.php.example
Added Paths:
-----------
trunk/www/templates/default/img/admin/banned.png
trunk/www/templates/default/img/admin/tadd.png
Removed Paths:
-------------
trunk/plugins/banned.inc.php
trunk/templates/default/plugins/banned/
Deleted: trunk/plugins/banned.inc.php
===================================================================
--- trunk/plugins/banned.inc.php 2008-10-23 10:29:08 UTC (rev 62)
+++ trunk/plugins/banned.inc.php 2008-10-23 10:30:01 UTC (rev 63)
@@ -1,109 +0,0 @@
-<?php
-
-
-class BannedPlugin extends OpenUploadPlugin {
-
- function BannedPlugin() {
- }
-
- function init() {
- global $_SERVER;
-
- $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'])) {
- if ($row['access']!='allow') {
- $this->banned();
- } else {
- return;
- }
- }
- }
- /* no match has been found */
- $this->banned();
- }
-
- function banned() {
-
- $this->display('banned');
- app()->page['content'] = $this->pluginHTML;
- app()->page['title']= tr('IP Banned');
- app()->tpl->assign('page',app()->page);
- app()->display(app()->mainPage);
- exit;
- }
-
- function convertSubnet($val) {
- $sub = array();
- if ($val<0) $val = 0;
- if ($val>32) $val = 32;
- for ($i=0; $i<4; $i++) {
- $x = 0; /* could be done with a for... */
- if ($val>0) $x += 128;
- if ($val>1) $x += 64;
- if ($val>2) $x += 32;
- if ($val>3) $x += 16;
- if ($val>4) $x += 8;
- if ($val>5) $x += 4;
- if ($val>6) $x += 2;
- if ($val>7) $x += 1;
- $sub[$i] = $x;
- $val = $val - 8;
- }
- return $sub;
- }
-
- function matchIP($sip,$exp) {
- if (strpos($exp,'/')!==FALSE) {
- $x = explode('/',$exp);
- $net = $x[0];
- $sub = $x[1];
- if (strpos($sub,'.')===FALSE) {
- /* it's a single number convert to subnet mask*/
- $sub = $this->convertSubnet($sub);
- } else {
- $sub = explode('.',$sub);
- }
- } else { /* single ip */
- $net = $exp;
- $sub = array(255,255,255,255);
- }
- $ip = explode('.',$sip);
- $net = explode('.',$net);
-
- /* now do the match */
- $mip[0] = $ip[0] & $sub[0];
- $mip[1] = $ip[1] & $sub[1];
- $mip[2] = $ip[2] & $sub[2];
- $mip[3] = $ip[3] & $sub[3];
- $dip[0] = $net[0] & $sub[0];
- $dip[1] = $net[1] & $sub[1];
- $dip[2] = $net[2] & $sub[2];
- $dip[3] = $net[3] & $sub[3];
- if (($mip[0] == $dip[0]) and ($mip[1] == $dip[1]) and
- ($mip[2] == $dip[2]) and ($mip[3] == $dip[3]))
- return true;
- else
- return false;
- }
-
- function fileaction() {
- global $_GET;
- if (isset($_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 */
- $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
Modified: trunk/www/config.inc.php.example
===================================================================
--- trunk/www/config.inc.php.example 2008-10-23 10:29:08 UTC (rev 62)
+++ trunk/www/config.inc.php.example 2008-10-23 10:30:01 UTC (rev 63)
@@ -43,7 +43,6 @@
* they will need to enable the functionality
* on a group basis
*/
-$CONFIG['plugins'][] = 'banned';
$CONFIG['plugins'][] = 'mimetypes';
$CONFIG['plugins'][] = 'email';
$CONFIG['plugins'][] = 'password';
Added: trunk/www/templates/default/img/admin/banned.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/banned.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/tadd.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/tadd.png
___________________________________________________________________
Added: svn:executable
+ *
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.
|
|
From: <ts...@us...> - 2008-10-23 11:05:15
|
Revision: 67
http://openupload.svn.sourceforge.net/openupload/?rev=67&view=rev
Author: tsdogs
Date: 2008-10-23 11:02:34 +0000 (Thu, 23 Oct 2008)
Log Message:
-----------
Add download timeout configuration option
Modified Paths:
--------------
trunk/CHANGELOG
trunk/TODO
trunk/lib/modules/default/files.inc.php
trunk/www/config.inc.php.example
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-10-23 10:42:46 UTC (rev 66)
+++ trunk/CHANGELOG 2008-10-23 11:02:34 UTC (rev 67)
@@ -1,5 +1,8 @@
Changelog before release (0.3?) (updated on 2008.10.18).
+* General
+ - make sub www folders not accessible by default (some index.html files)
+
* Registration
- Check for valid login name
- Enable registration with e-mail confirmation
@@ -32,6 +35,7 @@
* Download
- Changeed serve file method to not go over the memory php limit (output buffer)
+ - Make download timeout configurable.
* Web site
- Created index page
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-23 10:42:46 UTC (rev 66)
+++ trunk/TODO 2008-10-23 11:02:34 UTC (rev 67)
@@ -5,12 +5,6 @@
Translation
- Update the translations
-Download
-- Let it not reach timeout when serving a file.
-
-General
-- make sub www folders not accessible by default (some index.php/html files needed)
-
Templates
- remove absolute paths from templates, to retrieve default template file if template file is not found
Modified: trunk/lib/modules/default/files.inc.php
===================================================================
--- trunk/lib/modules/default/files.inc.php 2008-10-23 10:42:46 UTC (rev 66)
+++ trunk/lib/modules/default/files.inc.php 2008-10-23 11:02:34 UTC (rev 67)
@@ -245,6 +245,12 @@
/* if we got this far the download should begin serving */
$file = app()->config['DATA_PATH'].'/'.$finfo['id'];
$filesize = filesize($file);
+ /* set to not timeout within default setting */
+ if (isset(app()->config['max_download_time'])) {
+ set_time_limit(app()->config['max_download_time']*60);
+ } else {
+ set_time_limit(7200); /* 2 hours should be enough */
+ }
/* disable and clean output buffer so it won't reach memory limit */
ob_end_clean();
header('Content-Type: '.$finfo['mime']);
Modified: trunk/www/config.inc.php.example
===================================================================
--- trunk/www/config.inc.php.example 2008-10-23 10:42:46 UTC (rev 66)
+++ trunk/www/config.inc.php.example 2008-10-23 11:02:34 UTC (rev 67)
@@ -51,6 +51,9 @@
/* Set maximum default upload size in MB*/
$CONFIG['max_upload_size']=100;
+/* Set the maximum time (in minutes) a download should take (putting it to 0 will disable the timeout, but it's not suggested) */
+$CONFIG['max_download_time']=120;
+
/* if registration is enabled confirm it by e-amil ? */
$CONFIG['registration']['email_confirm']='yes';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-23 12:53:48
|
Revision: 65
http://openupload.svn.sourceforge.net/openupload/?rev=65&view=rev
Author: tsdogs
Date: 2008-10-23 10:36:48 +0000 (Thu, 23 Oct 2008)
Log Message:
-----------
Documentation update
Modified Paths:
--------------
trunk/CHANGELOG
trunk/TODO
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-10-23 10:30:45 UTC (rev 64)
+++ trunk/CHANGELOG 2008-10-23 10:36:48 UTC (rev 65)
@@ -14,6 +14,7 @@
- Plugin ACL administration
- Rights Administration
- Display of actual configuration
+ - Administration of banned IPs
* User
- Manage profile (password/Name/E-Mail change)
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-23 10:30:45 UTC (rev 64)
+++ trunk/TODO 2008-10-23 10:36:48 UTC (rev 65)
@@ -2,9 +2,6 @@
RELEASE: not until api and db are stable.
******* MUST BE DONE BEFORE RELEASE *******
-Administration
-- Admin of banned IPs
-
Translation
- Update the translations
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-24 12:29:41
|
Revision: 81
http://openupload.svn.sourceforge.net/openupload/?rev=81&view=rev
Author: tsdogs
Date: 2008-10-24 11:37:17 +0000 (Fri, 24 Oct 2008)
Log Message:
-----------
Update some docs
Modified Paths:
--------------
trunk/CHANGELOG
trunk/README
trunk/TODO
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-10-24 11:16:14 UTC (rev 80)
+++ trunk/CHANGELOG 2008-10-24 11:37:17 UTC (rev 81)
@@ -22,6 +22,9 @@
* User
- Manage profile (password/Name/E-Mail change)
+* Authentication
+ - LDAP authentication for Openldap and AD support
+
* Database
- Review DB module functions
- Updated txtdb with basic api
Modified: trunk/README
===================================================================
--- trunk/README 2008-10-24 11:16:14 UTC (rev 80)
+++ trunk/README 2008-10-24 11:37:17 UTC (rev 81)
@@ -27,6 +27,9 @@
It aims to be customizable/extendible.
It can be used inside enterprises for sharing files fast with customers.
+INSTALLATION:
+
+ See INSTALL file for details.
COPYRIGHT:
Copyright (c) 2008 Alessandro Briosi. All rights reserved.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-24 11:16:14 UTC (rev 80)
+++ trunk/TODO 2008-10-24 11:37:17 UTC (rev 81)
@@ -9,9 +9,6 @@
- remove absolute paths from templates, to retrieve default template file if template file is not found
******* WOULD LIKE IT TO BE IN RELEASE *******
-Authentication
-- LDAP authentication for Openldap and AD support
-
Upload
- Display upload progress
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-27 12:22:01
|
Revision: 85
http://openupload.svn.sourceforge.net/openupload/?rev=85&view=rev
Author: tsdogs
Date: 2008-10-27 11:36:38 +0000 (Mon, 27 Oct 2008)
Log Message:
-----------
Remove template path in templates (for images and css)
Modified Paths:
--------------
trunk/lib/general.inc.php
trunk/lib/main.inc.php
trunk/lib/smarty/plugins/block.tr.php
trunk/templates/default/index.tpl
trunk/templates/default/modules/admin/admin.tpl
trunk/templates/default/modules/admin/banned.tpl
trunk/templates/default/modules/admin/files.tpl
trunk/templates/default/modules/admin/groups.tpl
trunk/templates/default/modules/admin/plugins.tpl
trunk/templates/default/modules/admin/pluginsacl.tpl
trunk/templates/default/modules/admin/rights.tpl
trunk/templates/default/modules/admin/users.tpl
trunk/templates/default/modules/files/downloadConfirm.tpl
trunk/templates/default/modules/files/uploadForm.tpl
Added Paths:
-----------
trunk/lib/smarty/plugins/function.tpl.php
Modified: trunk/lib/general.inc.php
===================================================================
--- trunk/lib/general.inc.php 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/lib/general.inc.php 2008-10-27 11:36:38 UTC (rev 85)
@@ -82,6 +82,17 @@
return $txt;
}
+function template_file($file) {
+ global $CONFIG;
+
+
+ if ($file == '') return '';
+ if (file_exists($CONFIG['WEB_ROOT'].'/templates/'.$CONFIG['site']['template'].'/'.$file))
+ return $CONFIG['WWW_ROOT'].'/templates/'.$CONFIG['site']['template'].'/'.$file;
+ else
+ return $CONFIG['WWW_ROOT'].'/templates/default/'.$file;
+}
+
/**
Validate an email address.
Provide email address (raw input)
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/lib/main.inc.php 2008-10-27 11:36:38 UTC (rev 85)
@@ -26,7 +26,7 @@
$this->tpl->config_dir = SMARTY_DIR.'/config';
$this->tpl->cache_dir = $this->config['INSTALL_ROOT'].'/cache';
$this->tpl->caching = $this->config['site']['caching'];
-
+
$this->page['template']= $this->config['WWW_ROOT'].'/templates/'.$this->config['site']['template'];
/* include the class first */
Modified: trunk/lib/smarty/plugins/block.tr.php
===================================================================
--- trunk/lib/smarty/plugins/block.tr.php 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/lib/smarty/plugins/block.tr.php 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,6 +1,24 @@
<?php
+/**
+ * Smarty plugin
+ * @package OpenUpload
+ * @subpackage plugins
+ */
+/**
+ * Smarty {tr} block plugin
+ *
+ * Type: block<br>
+ * Name: tr<br>
+ * Purpose: Translate contained text with a user defined function "translate"
+ * @author Alessandro Briosi
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses translate()
+ */
+
function smarty_block_tr($params, $content = null, &$smarty, &$repeat) {
if(!$repeat){
Added: trunk/lib/smarty/plugins/function.tpl.php
===================================================================
--- trunk/lib/smarty/plugins/function.tpl.php (rev 0)
+++ trunk/lib/smarty/plugins/function.tpl.php 2008-10-27 11:36:38 UTC (rev 85)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Smarty plugin
+ * @package OpenUpload
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty {tpl} function plugin
+ *
+ * Type: function<br>
+ * Name: tpl<br>
+ * Input:<br>
+ * - file (required) - string containing template sub file
+ * Purpose: Returns a file from the template folder, if it does not exsist
+ * it returns a file from the default template
+ * @author Alessandro Briosi
+ * @param array
+ * @param Smarty
+ * @return string
+ * @uses template_file
+ */
+
+function smarty_function_tpl($params, &$smarty)
+{
+ return template_file($params["file"]);
+
+}
+?>
\ No newline at end of file
Modified: trunk/templates/default/index.tpl
===================================================================
--- trunk/templates/default/index.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/index.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,12 +1,12 @@
<html>
<head>
<title>{$site.title} - {tr}{$page.title}{/tr}</title>
-<link rel="stylesheet" type="text/css" href='{$page.template}/main.css'>
+<link rel="stylesheet" type="text/css" href="{tpl file=/main.css}">
</head>
<body>
<!-- header -->
<div id="header">
-<div id="logo"><img src="{$page.template}/img/openupload.jpg" border="0"></div>
+<div id="logo"><img src="{tpl file=/img/openupload.jpg}" border="0"></div>
<div id="langs">
<ul>
{foreach from=$langs item=l name=c}
Modified: trunk/templates/default/modules/admin/admin.tpl
===================================================================
--- trunk/templates/default/modules/admin/admin.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/admin.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,18 +1,18 @@
{tr}Here you can administer{/tr}:<hr>
<table border="0" width="400" height="300">
<tr>
- <td align="center"><a href="{$script}?action=adminsettings"><img src="{$page.template}/img/admin/settings.png" border="0" ><br>{tr}Settings{/tr}</a></td>
- <td align="center"><a href="{$script}?action=adminplugins"><img src="{$page.template}/img/admin/plugins.png" border="0" align="center"><br>{tr}Plugins{/tr}</a></td>
- <td align="center"><a href="{$script}?action=adminfiles"><img src="{$page.template}/img/admin/files.png" border="0" ><br>{tr}Files{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminsettings"><img src="{tpl file=/img/admin/settings.png}" border="0" ><br>{tr}Settings{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminplugins"><img src="{tpl file=/img/admin/plugins.png}" border="0" align="center"><br>{tr}Plugins{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminfiles"><img src="{tpl file=/img/admin/files.png}" border="0" ><br>{tr}Files{/tr}</a></td>
</tr>
<tr>
- <td align="center"><a href="{$script}?action=adminusers"><img src="{$page.template}/img/admin/users.png" border="0" ><br>{tr}Users{/tr}</a></td>
- <td align="center"><a href="{$script}?action=admingroups"><img src="{$page.template}/img/admin/groups.png" border="0" ><br>{tr}Groups{/tr}</a></td>
- <td align="center"><a href="{$script}?action=adminrights"><img src="{$page.template}/img/admin/rights.png" border="0" ><br>{tr}Rights{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminusers"><img src="{tpl file=/img/admin/users.png}" border="0" ><br>{tr}Users{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=admingroups"><img src="{tpl file=/img/admin/groups.png}" border="0" ><br>{tr}Groups{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminrights"><img src="{tpl file=/img/admin/rights.png}" border="0" ><br>{tr}Rights{/tr}</a></td>
</tr>
<tr>
<td align="center"> </td>
- <td align="center"><a href="{$script}?action=adminbanned"><img src="{$page.template}/img/admin/banned.png" border="0" ><br>{tr}Banned IPs{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminbanned"><img src="{tpl file=/img/admin/banned.png}" border="0" ><br>{tr}Banned IPs{/tr}</a></td>
<td align="center"> </td>
</tr>
{$plugins}
Modified: trunk/templates/default/modules/admin/banned.tpl
===================================================================
--- trunk/templates/default/modules/admin/banned.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/banned.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,7 +1,7 @@
{include file="default/modules/admin/adminmenu.tpl"}
<div id="toolbar">
-<a href="{$script}?action={$action}&step=2"><img src="{$page.template}/img/admin/tadd.png"></a>
-<img src="{$page.template}/img/admin/tdelete.png">
+<a href="{$script}?action={$action}&step=2"><img src="{tpl file=/img/admin/tadd.png}"></a>
+<img src="{tpl file=/img/admin/tdelete.png}">
</div>
<br>
{if $pages>2}
@@ -31,7 +31,7 @@
<td id="{$rid}">{$b.access}</td>
<td id="{$rid}">{$b.priority}</td>
<td id="{$rid}">
- <a title="delete" href="{$script}?action={$action}&step=4&id={$b.id}"><img src="{$page.template}/img/admin/delete.png"></a>
+ <a title="delete" href="{$script}?action={$action}&step=4&id={$b.id}"><img src="{tpl file=/img/admin/delete.png}"></a>
</td>
</tr>
{/foreach}
Modified: trunk/templates/default/modules/admin/files.tpl
===================================================================
--- trunk/templates/default/modules/admin/files.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/files.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -29,10 +29,10 @@
<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=adminbanned&step=2&ip={$f.ip}&newaction={$action}">
- <img align="right" src="{$page.template}/img/admin/ban.png" ></a>{$f.ip} </td>
+ <img align="right" src="{tpl file=/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>
+ <a title="delete" href="{$script}?action={$action}&step=4&id={$f.id}"><img src="{tpl file=/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-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/groups.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,7 +1,7 @@
{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">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{tpl file=/img/admin/tadd_group.png}"></a>
+<img src="{tpl file=/img/admin/tdelete_group.png}">
</div>
<br>
<table border="0" id="dbtable">
@@ -18,9 +18,9 @@
<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=3&id={$g.name}"><img src="{tpl file=/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>
+ <a href="{$script}?action={$action}&step=4&id={$g.name}"><img src="{tpl file=/img/admin/delete_group.png}"></a></td>
</tr>
{/foreach}
</table>
\ No newline at end of file
Modified: trunk/templates/default/modules/admin/plugins.tpl
===================================================================
--- trunk/templates/default/modules/admin/plugins.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/plugins.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -2,8 +2,8 @@
<br>
<table border="0" width="400" height="200">
<tr>
- <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>
+ <td align="center"><a href="{$script}?action=adminpluginsacl"><img src="{tpl file=/img/admin/plugins.png}" border="0" ><br>{tr}Plugins ACL{/tr}</a></td>
+ <td align="center"><a href="{$script}?action=adminpluginsoptions"><img src="{tpl file=/img/admin/plugins.png}" border="0" align="center"><br>{tr}Plugins Options{/tr}</a></td>
</tr>
{$plugins}
</table>
\ No newline at end of file
Modified: trunk/templates/default/modules/admin/pluginsacl.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginsacl.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/pluginsacl.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,7 +1,7 @@
{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">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{tpl file=/img/admin/plugins.png}"></a>
+<img src="{tpl file=/img/admin/tdelete.png}">
</div>
<br>
<table border="0" id="dbtable">
@@ -22,9 +22,9 @@
<td id="{$rid}">{$p.group_name}</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=3&id={$p.id}"><img src="{tpl file=/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>
+ <a href="{$script}?action={$action}&step=4&id={$p.id}"><img src="{tpl file=/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-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/rights.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,7 +1,7 @@
{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">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{tpl file=/img/admin/tadd_right.png}"></a>
+<img src="{tpl file=/img/admin/tdelete.png}">
</div>
<br>
<table border="0" id="dbtable">
@@ -24,9 +24,9 @@
<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=3&id={$r.id}"><img src="{tpl file=/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>
+ <a href="{$script}?action={$action}&step=4&id={$r.id}"><img src="{tpl file=/img/admin/delete.png}"></a></td>
</tr>
{/foreach}
</table>
\ No newline at end of file
Modified: trunk/templates/default/modules/admin/users.tpl
===================================================================
--- trunk/templates/default/modules/admin/users.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/admin/users.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -1,7 +1,7 @@
{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_user.png"></a>
-<img src="{$page.template}/img/admin/tdelete_user.png">
+<a href="{$script}?action={$action}&step=2&id={$u.id}"><img src="{tpl file=/img/admin/tadd_user.png}"></a>
+<img src="{tpl file=/img/admin/tdelete_user.png}">
</div>
<br>
<table border="0" id="dbtable">
@@ -23,13 +23,13 @@
<td id="{$rid}">{$u.group_name}</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">
+ <img src="{tpl file='/img/admin/active%s.png'|sprintf:$u.active}">
</a>
</td>
<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=3&id={$u.login}"><img src="{tpl file=/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>
+ <a href="{$script}?action={$action}&step=4&id={$u.login}"><img src="{tpl file=/img/admin/delete_user.png}"></a></td>
</tr>
{/foreach}
</table>
\ No newline at end of file
Modified: trunk/templates/default/modules/files/downloadConfirm.tpl
===================================================================
--- trunk/templates/default/modules/files/downloadConfirm.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/files/downloadConfirm.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -8,7 +8,7 @@
</table>
<div id="downloadbutton"><br><center>
<a href="{$script}?action=g">
- <img src="{$page.template}/img/download.png" border="0"><br>
+ <img src="{tpl file=/img/download.png}" border="0"><br>
{tr}Download file{/tr}</a></center>
</div>
Modified: trunk/templates/default/modules/files/uploadForm.tpl
===================================================================
--- trunk/templates/default/modules/files/uploadForm.tpl 2008-10-27 10:34:11 UTC (rev 84)
+++ trunk/templates/default/modules/files/uploadForm.tpl 2008-10-27 11:36:38 UTC (rev 85)
@@ -21,7 +21,7 @@
{$plugins}
<div id="uploadbutton" style="visibility:hidden"><br>
<a href="{$script}" onclick="document.uploadform.submit();return false;">
- <img src="{$page.template}/img/upload.png" border="0"><br>
+ <img src="{tpl file=/img/upload.png}" border="0"><br>
{tr}Upload{/tr}</a>
</div>
</form>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-10-28 18:31:31
|
Revision: 92
http://openupload.svn.sourceforge.net/openupload/?rev=92&view=rev
Author: tsdogs
Date: 2008-10-28 18:31:29 +0000 (Tue, 28 Oct 2008)
Log Message:
-----------
Preparing for release
Modified Paths:
--------------
trunk/CHANGELOG
trunk/TODO
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-10-28 18:28:05 UTC (rev 91)
+++ trunk/CHANGELOG 2008-10-28 18:31:29 UTC (rev 92)
@@ -34,10 +34,13 @@
- Modules
- Plugins
+* Templates
+ - removed absolute paths from templates, to retrieve default template file if template file is not found
+
* Translations
- gettext module
- - array module
- - initial Italian translation
+ - phparray module
+ - initial Italian translation (admin templates need a review)
* Download
- Changed serve file method to not go over the memory php limit (disable output buffer)
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-28 18:28:05 UTC (rev 91)
+++ trunk/TODO 2008-10-28 18:31:29 UTC (rev 92)
@@ -1,16 +1,11 @@
TODO list not priority ordered.
-RELEASE: not until api and db are stable.
******* MUST BE DONE BEFORE RELEASE *******
-Translation
-- Update the translations
+All seems to be done.
-Templates
-- remove absolute paths from templates, to retrieve default template file if template file is not found
-
-******* WOULD LIKE IT TO BE IN RELEASE *******
+******* POSTPONED FOR NEXT RELEASE *******
Upload
-- Display upload progress
+- Display upload progress (a bit too triky and workarounds ain't really nice)
Database
- pgsql module
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-11-06 14:12:15
|
Revision: 123
http://openupload.svn.sourceforge.net/openupload/?rev=123&view=rev
Author: tsdogs
Date: 2008-11-06 14:12:08 +0000 (Thu, 06 Nov 2008)
Log Message:
-----------
complete languages administration
Modified Paths:
--------------
trunk/lib/modules/default/admin.inc.php
trunk/templates/default/modules/admin/pluginoptions.tpl
Added Paths:
-----------
trunk/templates/default/modules/admin/langadd.tpl
trunk/www/templates/default/img/admin/edit_lang.png
trunk/www/templates/default/img/admin/langs.png
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-11-06 12:40:40 UTC (rev 122)
+++ trunk/lib/modules/default/admin.inc.php 2008-11-06 14:12:08 UTC (rev 123)
@@ -588,6 +588,43 @@
}
function langadd() {
+ if (isset($_POST['addlangid'])) {
+ $lang['id']=$_POST['addlangid'];
+ $lang['name']=$_POST['addlangname'];
+ $lang['locale']=$_POST['addlanglocale'];
+ $lang['browser']=$_POST['addlangbrowser'];
+ $lang['charset']=$_POST['addlangcharset'];
+ $lang['active']=isset($_POST['addlangactive'])?1:0;
+ //$this->tpl->assign('lang' , $lang[0]);
+ $tmp = app()->db->read('langs',array('id' => $_POST['id']));
+ if ($lang['id']=='') {
+ $error = true;
+ app()->error(tr('Language "%1" cannot be empty',tr('ID')));
+ } else if ($tmp[0]['id']==$lang['id']) {
+ $error = true;
+ app()->error(tr('Language "%1" already exists!',$lang['id']));
+ }
+ if ($lang['name']=='') {
+ $error = true;
+ app()->error(tr('Language "%1" cannot be empty!',tr('Name')));
+ }
+ if ($lang['locale']=='') {
+ $error = true;
+ app()->error(tr('Language "%1" cannot be empty!',tr('Locale')));
+ }
+ if ($lang['charset']=='') {
+ $error = true;
+ app()->error(tr('Language "%1" cannot be empty!',tr('Charset')));
+ }
+ if (!$error) {
+ app()->db->insert('langs',$lang);
+ $this->nextStep(1);
+ }
+ } else {
+ $lang['name']='New language';
+ $lang['active']=1;
+ }
+
}
function langedit() {
@@ -613,6 +650,12 @@
}
function langdel() {
+ global $_GET;
+
+ if (isset($_GET['id'])) {
+ app()->db->delete('langs',array( 'id' => $_GET['id']));
+ }
+ $this->nextStep(1);
}
function langtoggle() {
Added: trunk/templates/default/modules/admin/langadd.tpl
===================================================================
--- trunk/templates/default/modules/admin/langadd.tpl (rev 0)
+++ trunk/templates/default/modules/admin/langadd.tpl 2008-11-06 14:12:08 UTC (rev 123)
@@ -0,0 +1,15 @@
+{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}ID{/tr}:</td><td><input type="text" name="addlangid" value="{$lang.id}"></td></tr>
+<tr><td>{tr}Name{/tr}:</td><td><input type="text" name="addlangname" value="{$lang.name}"></td></tr>
+<tr><td>{tr}Locale{/tr}:</td><td><input type="text" name="addlanglocale" value="{$lang.locale}"></td></tr>
+<tr><td>{tr}Browser recon{/tr}:</td><td><input type="text" name="addlangbrowser" value="{$lang.browser}"></td></tr>
+<tr><td>{tr}Charset{/tr}:</td><td><input type="text" name="addlangcharset" value="{$lang.charset}"></td></tr>
+<tr><td>{tr}Active{/tr}:</td><td><input type="checkbox" name="addlangactive" value="1" {if $lang.active==1}checked{/if}></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
Modified: trunk/templates/default/modules/admin/pluginoptions.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginoptions.tpl 2008-11-06 12:40:40 UTC (rev 122)
+++ trunk/templates/default/modules/admin/pluginoptions.tpl 2008-11-06 14:12:08 UTC (rev 123)
@@ -1,3 +1,15 @@
{include file="default/modules/admin/adminmenu.tpl"}
-<br>
-<h1>To be implemented!!!</h1>
\ No newline at end of file
+<table border="0" id="dbtable">
+<tr>
+ <th width="100">Plugin</th>
+ <th width="400">Description</th>
+</tr>
+{foreach from=$pluginlist item=p}
+{cycle values="row1,row2" advance=true assign=rid}
+<tr>
+ <td id="{$rid}" style="text-align:left; vertical-align: top;">
+ <a href="{$script}?action={$action}&step=2&id={$p.name}">{$p.name}</a></td>
+ <td id="{$rid}" style="text-align:justify">{$p.description}</td>
+</tr>
+{/foreach}
+</table>
\ No newline at end of file
Added: trunk/www/templates/default/img/admin/edit_lang.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/edit_lang.png
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/www/templates/default/img/admin/langs.png
===================================================================
(Binary files differ)
Property changes on: trunk/www/templates/default/img/admin/langs.png
___________________________________________________________________
Added: svn:executable
+ *
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.
|
|
From: <ts...@us...> - 2008-11-06 19:57:35
|
Revision: 124
http://openupload.svn.sourceforge.net/openupload/?rev=124&view=rev
Author: tsdogs
Date: 2008-11-06 19:57:33 +0000 (Thu, 06 Nov 2008)
Log Message:
-----------
Plugin options now are in the db.
Modified Paths:
--------------
trunk/lib/classes.inc.php
trunk/lib/modules/default/admin.inc.php
trunk/plugins/mimetypes.inc.php
trunk/templates/default/modules/admin/groups.tpl
trunk/templates/default/modules/admin/pluginoptions.tpl
trunk/templates/default/modules/admin/rights.tpl
trunk/templates/default/plugins/mimetypes/uploadForm.tpl
Added Paths:
-----------
trunk/templates/default/modules/admin/pluginoptionadd.tpl
trunk/templates/default/modules/admin/pluginoptiondetail.tpl
trunk/templates/default/modules/admin/pluginoptionedit.tpl
Modified: trunk/lib/classes.inc.php
===================================================================
--- trunk/lib/classes.inc.php 2008-11-06 14:12:08 UTC (rev 123)
+++ trunk/lib/classes.inc.php 2008-11-06 19:57:33 UTC (rev 124)
@@ -90,10 +90,13 @@
function OpenUploadMoule() {
}
- function nextStep($step = 0, $action = '') {
+ function nextStep($step = 0, $action = '',$params='') {
$step = $step==0?app()->step+1:$step;
$action = $action==''?app()->action:$action;
- redirect('?action='.$action.'&step='.$step);
+ if ($params!='')
+ redirect('?action='.$action.'&step='.$step.'&'.$params);
+ else
+ redirect('?action='.$action.'&step='.$step);
}
function prevStep() {
@@ -115,6 +118,8 @@
var $messageHTML;
var $name;
var $fields = array();
+ var $options = array();
+ var $config = array();
function MySharePlugin() {
}
@@ -127,7 +132,34 @@
$this->pluginHTML .= app()->fetch('plugins/'.$this->name.'/'.$tpl);
}
+ function loadConfig() {
+ if (count($this->options)>0) {
+ $opt = app()->db->read('plugin_options',array('plugin' => $this->name),array(),'',array('name','group_name'));
+ if (count($opt)==0) return;
+ foreach ($this->options as $o) {
+ $this->config[$o['name']] = array();
+ if (isset($opt[$o['name']])) {
+ foreach ($opt[$o['name']] as $g => $v) {
+ switch ($o['type']) {
+ case 'list':
+ $this->config[$o['name']][$g] = explode("\n",chop($v['value']));
+ break;
+ case 'text':
+ $this->config[$o['name']][$g] = $v['value'];
+ break;
+ default:
+ $this->config[$o['name']][$g] = $v['value'];
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
function init() {
+ $this->loadConfig();
+
}
/* functions that can be called
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-11-06 14:12:08 UTC (rev 123)
+++ trunk/lib/modules/default/admin.inc.php 2008-11-06 19:57:33 UTC (rev 124)
@@ -19,9 +19,10 @@
),
"adminpluginsoptions" => array (
1 => "pluginoptions",
- 2 => "pluginoptionadd",
- 3 => "pluginoptionedit",
- 4 => "pluginoptiondelete",
+ 2 => "pluginoptiondetail",
+ 3 => "pluginoptionadd",
+ 4 => "pluginoptionedit",
+ 5 => "pluginoptiondelete",
),
"adminfiles" => array (
1 => "files",
@@ -319,7 +320,7 @@
}
}
}
- redirect('?action=adminrights&step=2&id='.$id);
+ $this->nextStep(2,'','id='.$id);
} else {
$id = $_GET['id'];
}
@@ -473,16 +474,105 @@
}
function pluginoptiondetail() {
+ global $_GET;
+
+ if (isset($_GET['id'])) {
+ $groups = app()->auth->groupinfo();
+ $options = app()->db->read('plugin_options',array('plugin' => $_GET['id']),array('group_name'),
+ '',array('group_name','name'));
+ $this->tpl->assign('groups',$groups);
+ $this->tpl->assign('plugin_options',$options);
+ $this->tpl->assign('options',app()->plugins[$_GET['id']]->options);
+ $this->tpl->assign('pluginname',$_GET['id']);
+ } else {
+ $this->nextStep(1);
+ }
}
function pluginoptionadd() {
+ global $_GET;
+ global $_POST;
+
+ if (isset($_GET['id']) or isset($_POST['id'])) {
+ $plugin = isset($_POST['id'])?$_POST['id']:$_GET['id'];
+ $poptions = app()->plugins[$plugin]->options;
+ $groups = app()->auth->groupinfo();
+ $this->tpl->assign('groups',$groups);
+ $this->tpl->assign('options',$poptions);
+ $this->tpl->assign('pluginname',$plugin);
+ if (isset($_POST['id'])) {
+ $group = $_POST['gid'];
+ /* should check if values for this group already exsist */
+ $tmp = app()->db->read('plugin_options',array('group_name' => $group, 'plugin' => $plugin));
+ if (count($tmp)>0) {
+ app()->error(tr('Options for this group already exsist, please use the edit function!'));
+ } else {
+ foreach ($poptions as $o) {
+ $val = array();
+ $val['plugin']=$plugin;
+ $val['group_name']=$group;
+ $val['name']=$o['name'];
+ $val['value'] = $_POST[$o['name']];
+ app()->db->insert('plugin_options',$val);
+ }
+ $this->nextStep(2,'','id='.$plugin);
+ }
+ } else {
+ $options = array();
+ }
+ $this->tpl->assign('plugin_options',$options);
+ } else {
+ $this->nextStep(1);
+ }
}
function pluginoptionedit() {
+ global $_GET;
+ global $_POST;
+
+ if (isset($_GET['id']) or isset($_POST['id'])) {
+ $plugin = isset($_POST['id'])?$_POST['id']:$_GET['id'];
+ $group = isset($_POST['gid'])?$_POST['gid']:$_GET['gid'];
+ $options = app()->db->read('plugin_options',array('plugin' => $plugin, 'group_name' => $group),array(),'',
+ array('name'));
+ $poptions = app()->plugins[$plugin]->options;
+ if (isset($_POST['id'])) {
+ foreach ($poptions as $o) {
+ $val = array();
+ if (isset($options[$o['name']])) {
+ $val = $options[$o['name']];
+ $val['value'] = $_POST[$o['name']];
+ app()->db->update('plugin_options',$val,array('id' => $val['id']));
+ } else {
+ $val['plugin']=$plugin;
+ $val['group_name']=$group;
+ $val['name']=$o['name'];
+ $val['value'] = $_POST[$o['name']];
+ app()->db->insert('plugin_options',$val);
+ }
+ }
+ $this->nextStep(2,'','id='.$plugin);
+ } else if ($group!='') {
+ $this->tpl->assign('plugin_options',$options);
+ $this->tpl->assign('options',$poptions);
+ } else {
+ $this->nextStep(2,'','id='.$plugin);
+ }
+ $this->tpl->assign('gid',$group);
+ $this->tpl->assign('pluginname',$plugin);
+ } else {
+ $this->nextStep(1);
+ }
}
function pluginoptiondelete() {
+ global $_GET;
+
+ if (isset($_GET['id'])) {
+ app()->db->delete('plugin_options',array('group_name' => $_GET['gid'], 'plugin' => $_GET['id']));
+ $this->nextStep(2,'','id='.$_GET['id']);
+ }
}
function settings() {
@@ -519,11 +609,11 @@
app()->db->insert('banned',$ban);
app()->message(tr('IP %1 has been banned!',$ip));
if (isset($_GET['nextaction']))
- redirect('?action='.$_GET['nextaction']);
+ $this->nextStep(1,$_GET['nextaction']);
} else {
app()->error(tr('IP %1 was already in state: %2!',$ip,$ban['access']));
if (isset($_GET['newaction']))
- redirect('?action='.$_GET['newaction']);
+ $this->nextStep(1,$_GET['newaction']);
}
} else if (isset($_POST['addbannedip'])) {
$ip = $_POST['addbannedip'];
Modified: trunk/plugins/mimetypes.inc.php
===================================================================
--- trunk/plugins/mimetypes.inc.php 2008-11-06 14:12:08 UTC (rev 123)
+++ trunk/plugins/mimetypes.inc.php 2008-11-06 19:57:33 UTC (rev 124)
@@ -4,14 +4,38 @@
function MimeTypesPlugin() {
$this->description = tr('Limit the mimetypes a user can upload');
+ $this->options = array(
+ array('name' => 'allowed', 'description' => tr('Allowed mime types'), 'type' => 'list'),
+ array('name' => 'message', 'description' => tr('Types in message'), 'type' => 'text'),
+ );
+ /* load the plugin configuration */
}
+ function getGroup() {
+ $group = app()->user->group();
+ if (is_array($group)) {
+ /* check for which group there is a configuration */
+ foreach ($group as $g) {
+ if (isset($this->config['allowed'][$g])) {
+ if (count($this->config['allowed'])) {
+ return $g;
+ }
+ }
+ }
+ return $group[0];
+ } else {
+ return $group;
+ }
+ }
+
function uploadForm(&$finfo,$acl) {
if ($acl!='enable') return true;
- if (count(app()->config['mimetypes'])==0) {
+ $group = $this->getGroup();
+ if (count($this->config['allowed'][$group])==0) {
app()->error(tr('WARNING: no mime types defined. Plugin has been disabled!'));
} else {
- $this->assign('mimetypes',app()->config['mimetypes']);
+ $this->assign('message',$this->config['message'][$group]);
+ $this->assign('mimetypes',$this->config['allowed'][$group]);
$this->display('uploadForm');
}
return true;
@@ -19,9 +43,10 @@
function uploadOptions(&$finfo,$acl) {
if ($acl!='enable') return true;
- if (count(app()->config['mimetypes'])==0) {
+ $group = $this->getGroup();
+ if (count($this->config['allowed'][$group])==0) {
app()->error(tr('WARNING: no mime types defined. Plugin has been disabled!'));
- } else if (array_search($finfo['mime'],app()->config['mimetypes'])===FALSE) {
+ } else if (array_search($finfo['mime'],$this->config['allowed'][$group])===FALSE) {
app()->error(tr('This file type (%1) is not allowed on this site!',$finfo['mime']));
return false;
}
Modified: trunk/templates/default/modules/admin/groups.tpl
===================================================================
--- trunk/templates/default/modules/admin/groups.tpl 2008-11-06 14:12:08 UTC (rev 123)
+++ trunk/templates/default/modules/admin/groups.tpl 2008-11-06 19:57:33 UTC (rev 124)
@@ -7,9 +7,9 @@
<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>
+ <th width="100">{tr}Group Name{/tr}</th>
+ <th>width="200">{tr}Description{/tr}</th>
+ <th width="100">{tr}Actions{/tr}</th>
</tr>
{foreach from=$groups item=g}
{cycle values="row1,row2" advance=true assign=rid}
Added: trunk/templates/default/modules/admin/pluginoptionadd.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginoptionadd.tpl (rev 0)
+++ trunk/templates/default/modules/admin/pluginoptionadd.tpl 2008-11-06 19:57:33 UTC (rev 124)
@@ -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}">
+<input type="hidden" name="id" value="{$pluginname}">
+<table border="0">
+<tr><td>{tr}Group{/tr}:</td><td>
+ <select name="gid">
+ {foreach from=$groups item=g}
+ <option value="{$g.name}">{$g.description}</option>
+ {/foreach}
+ </select></td>
+</tr>
+{foreach from=$options item=o}
+<tr><td valign="top">{$o.description}:</td><td>
+{if $o.type=='list'}
+<textarea cols="40" rows="6" name="{$o.name}">
+{$plugin_options[$o.name].value}
+</textarea>
+{elseif $o.type=='text'}
+<input type="text" name="{$o.name}" value="{$plugin_options[$o.name].value}"></td></tr>
+{/if}
+{/foreach}
+<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/pluginoptiondetail.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginoptiondetail.tpl (rev 0)
+++ trunk/templates/default/modules/admin/pluginoptiondetail.tpl 2008-11-06 19:57:33 UTC (rev 124)
@@ -0,0 +1,38 @@
+{include file="default/modules/admin/adminmenu.tpl"}
+<h3>{$pluginname}</h3>
+
+{if count($options)==0}
+<div id="message">{tr}Plugin does not have any option to be configured{/tr}</div>
+{else}
+<div id="toolbar">
+<a href="{$script}?action={$action}&step=3&id={$pluginname}"><img src="{tpl file=/img/admin/tadd.png}"></a>
+<img src="{tpl file=/img/admin/tdelete.png}">
+</div>
+<br>
+<table border="0" id="dbtable">
+ <tr>
+ <th width="150">{tr}Group{/tr}</th>
+{foreach from=$options item=o}
+ <th width="200">{$o.description}</th>
+{/foreach}
+ <th width="80">{tr}Actions{/tr}</th>
+ </tr>
+{foreach from=$groups item=g}
+ {cycle values="row1,row2" advance=true assign=rid}
+ {if isset($plugin_options[$g.name])}
+ <tr>
+ <td id="{$rid}" style="text-align:left; vertical-align: top;">
+ <a href="{$script}?action={$action}&step=4&id={$pluginname}&gid={$g.name}">{$g.name}</a></td>
+ {foreach from=$options item=o}
+ <td id="{$rid}" style="text-align:left; vertical-align: top;"><pre>{$plugin_options[$g.name][$o.name].value}</pre></td>
+ {/foreach}
+ <td id="{$rid}" style="text-align:justify">
+ <a href="{$script}?action={$action}&step=4&id={$pluginname}&gid={$g.name}"><img src="{tpl file=/img/admin/edit_plugin.png}"></a>
+
+ <a href="{$script}?action={$action}&step=5&id={$pluginname}&gid={$g.name}"><img src="{tpl file=/img/admin/delete.png}"></a></td>
+ </td>
+ </tr>
+ {/if}
+{/foreach}
+</table>
+{/if}
\ No newline at end of file
Added: trunk/templates/default/modules/admin/pluginoptionedit.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginoptionedit.tpl (rev 0)
+++ trunk/templates/default/modules/admin/pluginoptionedit.tpl 2008-11-06 19:57:33 UTC (rev 124)
@@ -0,0 +1,19 @@
+{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="id" value="{$pluginname}">
+<input type="hidden" name="gid" value="{$gid}">
+<table border="0">
+<tr><td>{tr}Group{/tr}:</td><td>{$gid}</td></tr>
+{foreach from=$options item=o}
+<tr><td valign="top">{$o.description}:</td><td>{if $o.type=='list'}
+<textarea cols="40" rows="6" name="{$o.name}">{$plugin_options[$o.name].value}</textarea>
+{elseif $o.type=='text'}
+<input type="text" name="{$o.name}" value="{$plugin_options[$o.name].value}"></td></tr>
+{/if}
+{/foreach}
+<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
Modified: trunk/templates/default/modules/admin/pluginoptions.tpl
===================================================================
--- trunk/templates/default/modules/admin/pluginoptions.tpl 2008-11-06 14:12:08 UTC (rev 123)
+++ trunk/templates/default/modules/admin/pluginoptions.tpl 2008-11-06 19:57:33 UTC (rev 124)
@@ -1,4 +1,5 @@
{include file="default/modules/admin/adminmenu.tpl"}
+<br>
<table border="0" id="dbtable">
<tr>
<th width="100">Plugin</th>
Modified: trunk/templates/default/modules/admin/rights.tpl
===================================================================
--- trunk/templates/default/modules/admin/rights.tpl 2008-11-06 14:12:08 UTC (rev 123)
+++ trunk/templates/default/modules/admin/rights.tpl 2008-11-06 19:57:33 UTC (rev 124)
@@ -2,9 +2,9 @@
<br>
<table border="0" id="dbtable">
<tr>
- <th width="100">Name</th>
- <th width="200">Description</th>
- <th width="100">Rights set?</th>
+ <th width="100">{tr}Gruppo{/tr}</th>
+ <th width="200">{tr}Description{/tr}</th>
+ <th width="100">{tr}Rights set?{/tr}</th>
</tr>
{foreach from=$groups item=g}
{cycle values="row1,row2" advance=true assign=rid}
Modified: trunk/templates/default/plugins/mimetypes/uploadForm.tpl
===================================================================
--- trunk/templates/default/plugins/mimetypes/uploadForm.tpl 2008-11-06 14:12:08 UTC (rev 123)
+++ trunk/templates/default/plugins/mimetypes/uploadForm.tpl 2008-11-06 19:57:33 UTC (rev 124)
@@ -1 +1,4 @@
-<div id="mime">{tr}Only the following mime types are allowed{/tr} ({foreach from=$mimetypes item=m}{$m}, {/foreach})</div>
\ No newline at end of file
+<div id="mime">{tr}Only the following mime types are allowed{/tr} (
+{if $message!=''}{$message}
+{else}{foreach from=$mimetypes item=m}{$m}, {/foreach}{/if}
+)</div>
\ 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-11-12 12:43:08
|
Revision: 136
http://openupload.svn.sourceforge.net/openupload/?rev=136&view=rev
Author: tsdogs
Date: 2008-11-12 12:43:04 +0000 (Wed, 12 Nov 2008)
Log Message:
-----------
Update status
Modified Paths:
--------------
trunk/CHANGELOG
trunk/TODO
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-11-12 12:41:56 UTC (rev 135)
+++ trunk/CHANGELOG 2008-11-12 12:43:04 UTC (rev 136)
@@ -8,6 +8,15 @@
- Added PostgreSQL db structures
- PostgreSQL seems to be stable now
+* Administration
+ - Languages can now be administrated
+ - New rights editing interface.
+ - Plugin options
+
+* Plugins
+ - Options are now group based and in the database
+
+
Changelog from 0.3a to 0.3b (updated 2008.11.07)
* Fixed Bugs
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-11-12 12:41:56 UTC (rev 135)
+++ trunk/TODO 2008-11-12 12:43:04 UTC (rev 136)
@@ -11,12 +11,10 @@
- Display upload progress (a bit too triky and workarounds ain't really nice)
Database
-- pgsql module deep testing
- txtdb deep testing
Plugins
- Upload different filesize limiting depending on group (needs plugin options based on groups)
-- Plugin configuration options
Maintainence
- Create a script to clean up the files/tmpfiles.
@@ -26,10 +24,7 @@
- Config administration
Administration
-- Language table admin.
-- Plugin options
- Enable multiple table operations (deletion mainly)
-- Rights with better administration...
******* OTHER THINGS/IDEAS *******
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-11-12 12:44:10
|
Revision: 137
http://openupload.svn.sourceforge.net/openupload/?rev=137&view=rev
Author: tsdogs
Date: 2008-11-12 12:44:00 +0000 (Wed, 12 Nov 2008)
Log Message:
-----------
Add first version of setup script (only mysql is supported)
Modified Paths:
--------------
trunk/index.php
trunk/www/index.php
Added Paths:
-----------
trunk/www/setup.inc.php
Modified: trunk/index.php
===================================================================
--- trunk/index.php 2008-11-12 12:43:04 UTC (rev 136)
+++ trunk/index.php 2008-11-12 12:44:00 UTC (rev 137)
@@ -29,6 +29,6 @@
* @package OpenUpload
* @version 0.3
*/
-
+ define('__NOT_MAIN_SCRIPT',true);
require_once('www/index.php');
?>
Modified: trunk/www/index.php
===================================================================
--- trunk/www/index.php 2008-11-12 12:43:04 UTC (rev 136)
+++ trunk/www/index.php 2008-11-12 12:44:00 UTC (rev 137)
@@ -30,13 +30,8 @@
* @version 0.3
*/
-define ('__VALID_CALLING_SCRIPT', true);
+define ('__VALID_CALLING_SCRIPT',true);
-require_once('config.inc.php');
-require_once($CONFIG['INSTALL_ROOT'].'/lib/general.inc.php');
-
-global $application;
-
/* check authentication */
if (isset($_GET['action'])) {
$action = $_GET['action'];
@@ -52,8 +47,19 @@
} else {
$step = '';
}
-
-new Application($CONFIG);
-app()->run($action,$step);
+$configfile = 'config.inc.php';
+if (defined('__NOT_MAIN_SCRIPT'))
+ $configfile = 'www/'.$configfile;
+if (file_exists($configfile)) {
+ require_once($configfile);
+ require_once($CONFIG['INSTALL_ROOT'].'/lib/general.inc.php');
+ global $application;
+ new Application($CONFIG);
+ app()->run($action,$step);
+} else {
+ require_once('setup.inc.php');
+}
+
+
?>
Added: trunk/www/setup.inc.php
===================================================================
--- trunk/www/setup.inc.php (rev 0)
+++ trunk/www/setup.inc.php 2008-11-12 12:44:00 UTC (rev 137)
@@ -0,0 +1,1250 @@
+<?php
+
+if (!defined('__VALID_CALLING_SCRIPT')) die('DIRECT ACCESS IS DENIED');
+
+ob_start();
+session_start();
+
+$steps = array (
+ 1 => array (
+ 'title' => "Welcome",
+ 'function' => 'welcome',
+ ),
+ 2 => array (
+ 'title' => "PHP Setup check",
+ 'function' => 'setupcheck',
+ ),
+ 3 => array (
+ 'title' => "Paths",
+ 'function' => 'paths',
+ ),
+ 4 => array (
+ 'title' => "Database Type",
+ 'function' => 'databasetype',
+ ),
+ 5 => array (
+ 'title' => "Database Options",
+ 'function' => 'databaseoptions',
+ ),
+ 6 => array (
+ 'title' => "Application options",
+ 'function' => 'options',
+ ),
+ 7 => array (
+ 'title' => "Users",
+ 'function' => "users",
+ ),
+ 8 => array (
+ 'title' => "Plugins",
+ 'function' => "plugins",
+ ),
+ 9 => array (
+ 'title' => "Database inizialization",
+ 'function' => "createdb",
+ ),
+ 10 => array (
+ 'title' => "Save configuration",
+ 'function' => 'save',
+ ),
+);
+
+/* DATABASE INITIALIZATION QUERY */
+$MYSQL_QUERY = array (
+ 'dropdb' => 'DROP DATABASE IF EXISTS `%1`',
+ 'createdb' => 'CREATE DATABASE `%1`',
+ 'dropuser' => '',
+ 'createuser' => '',
+ 'grant' => 'GRANT ALL PRIVILEGES ON %2.* TO "%1"@"localhost" IDENTIFIED BY "%3"',
+ 'droptable' => 'DROP TABLE IF EXISTS `%1%2`',
+ 'structure' => array (
+ 'acl' => 'CREATE TABLE `%1acl` (
+ `id` int(11) NOT NULL auto_increment,
+ `module` varchar(100) NOT NULL,
+ `action` varchar(100) NOT NULL,
+ `group_name` varchar(50) NOT NULL,
+ `access` varchar(10) NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0',
+ 'banned' => 'CREATE TABLE `%1banned` (
+ `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',
+ 'files' => 'CREATE TABLE `%1files` (
+ `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_login` varchar(100) NOT NULL,
+ `ip` varchar(40) NOT NULL,
+ `upload_date` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1',
+ 'file_options' => 'CREATE TABLE `%1file_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',
+ 'groups' => 'CREATE TABLE `%1groups` (
+ `name` varchar(50) NOT NULL,
+ `description` varchar(250) default NULL,
+ PRIMARY KEY (`name`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1',
+ 'langs' => 'CREATE TABLE `%1langs` (
+ `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',
+ 'plugin_acl' => 'CREATE TABLE `%1plugin_acl` (
+ `id` int(11) NOT NULL auto_increment,
+ `group_name` varchar(50) NOT NULL,
+ `plugin` varchar(100) NOT NULL,
+ `access` varchar(10) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `group_name` (`group_name`,`plugin`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0',
+ 'plugin_options' => 'CREATE TABLE `%1plugin_options` (
+ `id` int(11) NOT NULL auto_increment,
+ `plugin` varchar(100) NOT NULL,
+ `group_name` varchar(100) NOT NULL,
+ `name` varchar(100) NOT NULL,
+ `value` text,
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0',
+ 'users' => 'CREATE TABLE `%1users` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `login` varchar(100) NOT NULL,
+ `password` varchar(100) NOT NULL,
+ `name` varchar(200) NOT NULL,
+ `group_name` varchar(50) NOT NULL default \'registered\',
+ `email` varchar(250) NOT NULL,
+ `lang` varchar(10) NOT NULL default \'en\',
+ `reg_date` datetime NOT NULL,
+ `regid` varchar(50) NOT NULL default \'\',
+ `active` tinyint(3) unsigned NOT NULL default \'1\',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `login` (`login`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0',
+ ),
+ 'base' => array (
+ "INSERT INTO `%0banned` (`id`, `ip`, `access`, `priority`) VALUES(1, '127.0.0.1', 'allow', 1)",
+ "INSERT INTO `%0banned` (`id`, `ip`, `access`, `priority`) VALUES(2, '0.0.0.0/0', 'allow', 9999999)",
+ "INSERT INTO `%0groups` (`name`, `description`) VALUES('%3', 'Administrators group')",
+ "INSERT INTO `%0groups` (`name`, `description`) VALUES('%4', 'Registered Users')",
+ "INSERT INTO `%0groups` (`name`, `description`) VALUES('%5', 'Unregistered users')",
+ "INSERT INTO `%0langs` (`id`, `name`, `locale`, `browser`, `charset`, `active`) VALUES('en', 'English', 'en_EN', '[en];[en-EN]', 'iso-8559-1', 1)",
+ "INSERT INTO `%0langs` (`id`, `name`, `locale`, `browser`, `charset`, `active`) VALUES('it', 'Italiano', 'it_IT.utf8', '[it];[it-IT]', 'utf8', 1)",
+ "INSERT INTO `%0users` (`id`, `login`, `password`, `name`, `group_name`, `email`, `lang`, `reg_date`, `regid`, `active`) VALUES(1, '%1', '%2', 'Administrator', '%3', '%6', 'en', now(), '', 1)",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(1, '*', '*', '%3', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(2, 'admin', '*', '%3', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(3, 'admin', '*', '*', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(4, 'auth', 'login', '%5', 'allow')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(1, '%3', 'password', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(2, '%3', 'captcha', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(3, '%3', 'email', 'enable')",
+ "INSERT INTO `%0plugin_options` (`id`, `plugin`, `group_name`, `name`, `value`) VALUES (1, 'mimetypes', '%5', 'message', 'Pdf, JPEG')",
+ "INSERT INTO `%0plugin_options` (`id`, `plugin`, `group_name`, `name`, `value`) VALUES (2, 'mimetypes', '%5', 'allowed', 'application/pdf
+image/jpeg')",
+ ),
+ 'mode_1' => array (
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(5, 'auth', 'register', '*', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(6, 'auth', '*', '%5', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(7, 'auth', '*', '*', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(8, 'files', '*', '%5', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(9, 'files', '*', '*', 'allow')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(4, '%4', 'password', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(5, '%4', 'captcha', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(6, '%4', 'email', 'enable')",
+ ),
+ 'mode_2' => array (
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(5, 'auth', 'register', '*', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(6, 'auth', '*', '%5', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(7, 'auth', '*', '*', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(8, 'files', 'd', '%5', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(9, 'files', 'g', '%5', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(10, 'files', '*', '%5', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(11, 'files', '*', '*', 'allow')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(4, '%4', 'password', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(5, '%4', 'captcha', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(6, '%4', 'email', 'enable')",
+ ),
+ 'mode_3' => array (
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(5, 'auth', 'register', '%5', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(6, 'auth', '*', '%5', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(7, 'auth', 'register', '*', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(8, 'auth', '*', '*', 'allow')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(9, 'files', '*', '*', 'allow')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(4, '%4', 'password', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(5, '%4', 'captcha', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(6, '%4', 'email', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(7, '%5', 'mimetypes', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(8, '%5', 'captcha', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(9, '%5', 'password', 'enable')",
+),
+ 'mode_4' => array (
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(5, 'auth', '*', '*', 'deny')",
+ "INSERT INTO `%0acl` (`id`, `module`, `action`, `group_name`, `access`) VALUES(6, 'files', '*', '*', 'allow')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(4, '%5', 'password', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(5, '%5', 'captcha', 'enable')",
+ "INSERT INTO `%0plugin_acl` (`id`, `group_name`, `plugin`, `access`) VALUES(6, '%5', 'email', 'enable')",
+ ),
+);
+$PGSQL_QUERY = array (
+ 'dropdb' => 'DROP DATABASE "%1"',
+ 'createdb' => 'CREATE DATABASE "%1"',
+ 'dropuser' => '',
+ 'createuser' => 'GRANT ALL PRIVILEGES TO "%1"@"localhost" ON %2.* IDENTIFIED BY "%3"',
+ 'grant' => '',
+ 'droptable' => 'DROP TABLE IF EXISTS `%2`',
+);
+
+
+/* try to guess the appropriate settings from the $_SERVER */
+$step = (isset($_GET['step']))?$_GET['step']:1;
+$step = (isset($_POST['step']))?$_POST['step']:$step;
+
+if ($step =='') $step = 1;
+
+$path = 'templates/default';
+if (defined('__NOT_MAIN_SCRIPT')) {
+ $path = 'www/'.$path;
+}
+
+$CONFIG = $_SESSION['config'];
+
+/********************* SUPPORT FUNCTIONS *****************************/
+
+function msg($str,$type = '') {
+ global $path;
+ echo '<div id="message">';
+ if ($type != '') {
+ echo '<img src="'.$path.'/img/setup/'.$type.'.png"> ';
+ }
+ echo $str.'</div>';
+}
+
+function listModules($path,$ext = 'inc.php') {
+ /* now list the available database types */
+ $dir = opendir($path);
+ $result = array();
+ while ($d = readdir($dir)) {
+ if ($ext != '') {
+ $n = explode('.',$d,2);
+ if ($n[1]==$ext)
+ $result[] = $n[0];
+ } else {
+ $result[] = $d;
+ }
+ }
+ closedir($dir);
+ return $result;
+}
+
+/************************ SETUP FUNCTIONS ********************/
+
+function welcome($step) {
+ global $_POST;
+ if (isset($_POST['step'])) {
+ return $step+1;
+ }
+?>
+<div id="message">
+Now to get started using OpenUpload you need to enter a few setup information...
+</div>
+<div id="message">
+Click on the Next button to proceed installing OpenUpload.
+</div>
+<form method="POST" action="index.php">
+<input type="hidden" name="step" value="<?php echo $step; ?>">
+<div><input type="submit" value="Next >>"></div>
+</form>
+<?php
+ return $step;
+}
+
+function setupcheck($step) {
+ global $_POST;
+
+ $message = 'Let\'s check your php installation';
+ if (isset($_POST['check'])) {
+ /* we do some php installation checks */
+ echo '<div id="message"><b>PHP INI Settings</b></div>';
+ if (ini_get('file_uploads') == 1) {
+ msg('File Uploads are enabled','ok');
+ } else {
+ msg('File Uploads are disable','fail');
+ msg('Please check your php.ini setting: file_uploads');
+ }
+ $msg = 'upload_max_filesize value is set to ';
+ msg($msg.': '.ini_get('upload_max_filesize'));
+ $msg = 'post_max_size value is set to ';
+ msg($msg.': '.ini_get('post_max_size'));
+ if (ini_get('register_globals') == 0) {
+ msg('Register globals disabled','ok');
+ } else {
+ msg('Register globals enabled','fail');
+ msg('Though the application should work with this set please consider disabling it');
+ }
+ echo '<div id="message"><b>Optional Values</b></div>';
+ if (function_exists('mysql_connect')) {
+ msg('MYSQL Support: exsists','ok');
+ } else {
+ msg('MYSQL Support: not found','fail');
+ msg('MYSQL is needed if you plan to use mysql');
+ }
+ if (function_exists('pg_connect')) {
+ msg('POSTGRESQL Support: exsists','ok');
+ } else {
+ msg('POSTGRESQL Support: not found','fail');
+ msg('POSTGRESQL is needed if you plan to use postgresql');
+ }
+ if (function_exists('ldap_connect')) {
+ msg('LDAP Support: exsists','ok');
+ } else {
+ msg('LDAP Support: not found','fail');
+ msg('LDAP is needed for LDAP and AD support');
+ }
+ if (function_exists('imagecreate')) {
+ msg('GD Support: exsists','ok');
+ } else {
+ msg('GD Support: not found','fail');
+ msg('GD is needed for captcha plugin');
+ }
+ echo '<hr>';
+ $checked = true;
+ $message ='If everything looks good proceed!';
+ }
+
+ if (isset($_POST['proceed'])) {
+ return $step+1;
+ }
+?>
+<div id="message">
+<?php echo $message; ?>
+</div>
+<form method="POST" action="index.php">
+<input type="hidden" name="step" value="<?php echo $step; ?>">
+<?php if ($checked) { ?>
+<input type="submit" name="check" value="Check Again">
+<input type="submit" name="proceed" value="Next >>">
+<?php } else { ?>
+<input type="submit" name="check" value="Check">
+<?php } ?>
+</form>
+<?php
+}
+
+/* INSTALLATION AND WWW PATHS */
+function guessPaths($CONFIG) {
+ global $_SERVER;
+
+echo 'guessing';
+ $srvname = $_SERVER['SERVER_NAME']; /* localhost */
+ $srvport = $_SERVER['SERVER_PORT']; /* 80 or 443 */
+
+ $http = 'http://';
+ if ($srvport == '443') {
+ $http = 'https://';
+ $srvport = '';
+ }
+ if ($srvport == '80')
+ $srvport = '';
+
+ $script = $_SERVER['SCRIPT_FILENAME']; /* full path to script */
+ /* remove index.php from script */
+ if (strpos($script,'index.php')!==FALSE)
+ $script = substr($script,0,strpos($script,'index.php')-1);
+
+ if (!defined('__NOT_MAIN_SCRIPT')) {
+ if (strpos($script,'/www')==strlen($script)-4) {
+ $script = substr($script,0,strlen($script)-4);
+ }
+ }
+
+ $uri = $_SERVER['REQUEST_URI'];
+
+ if (strpos($uri,'index.php')!==FALSE)
+ $uri = substr($uri,0,strpos($uri,'index.php')-1);
+
+ if (defined('__NOT_MAIN_SCRIPT'))
+ $uri .= '/www';
+
+ $CONFIG['WWW_SERVER']=$http.$srvname.($srvport!=''?$srvport:'');
+ $CONFIG['WWW_ROOT']=$uri;
+ $CONFIG['INSTALL_ROOT']=$script;
+ $CONFIG['DATA_PATH']=$script.'/data';
+ return $CONFIG;
+}
+
+function paths($step) {
+ global $_POST;
+ global $CONFIG;
+ global $_SESSION;
+
+ if (!isset($_POST['install_root'])) {
+ if (!isset($CONFIG['INSTALL_ROOT'])) {
+ $CONFIG = guessPaths($CONFIG);
+ }
+ } else {
+ $CONFIG['WWW_SERVER']=$_POST['www_server'];
+ $CONFIG['WWW_ROOT']=$_POST['www_root'];
+ $CONFIG['INSTALL_ROOT']=$_POST['install_root'];
+ $CONFIG['DATA_PATH']=$_POST['data_path'];
+
+ /* now check for correctness of the settings */
+ /* if ok go to next step */
+ return $step+1;
+ }
+
+ /* now I need to display and ask confirmation of the values */
+?>
+<div id="message">
+Here you must specify the paths of your installation.<br>
+Guessed values might be wrong on some circumstances so please make sure they are ok.
+</div>
+<form method="POST" action="index.php">
+<input type="hidden" name="step" value="<?php echo $step; ?>">
+<table border="0">
+<TR><TD>Install PATH:<br>(Where lib,templates,etc are)</TD>
+ <TD><input type="text" name="install_root" size="50" value="<?php echo $CONFIG['INSTALL_ROOT']; ?>"></TD></TR>
+<TR><TD>WWW Server URL:</TD>
+ <TD><input type="text" name="www_server" size="50" value="<?php echo $CONFIG['WWW_SERVER']; ?>"></TD></TR>
+<TR><TD>WWW Root Path <br>(where setup.php is):</TD>
+ <TD><input type="text" name="www_root" size="50" value="<?php echo $CONFIG['WWW_ROOT']; ?>"></TD></TR>
+<TR><TD>DATA PATH:</TD>
+ <TD><input type="text" name="data_path" size="50" value="<?php echo $CONFIG['DATA_PATH']; ?>"></TD></TR>
+<TR><TD colspan="2"><input type="submit" value="Next >>"</TD></TR>
+</table>
+</form>
+<?php
+ return $step;
+}
+
+/* DATABASE SETUP */
+
+function databasetype($step) {
+ global $CONFIG;
+ global $_POST;
+
+ if (isset($_POST['dbtype'])) {
+ $CONFIG['database']['type']=$_POST['dbtype'];
+ if ($CONFIG['database']['type']=='txt') {
+ $CONFIG['database']['rootdir']=$CONFIG['INSTALL_ROOT'].'/txtdb';
+ unset($CONFIG['database']['host']);
+ unset($CONFIG['database']['user']);
+ unset($CONFIG['database']['password']);
+ unset($CONFIG['database']['name']);
+ } else {
+ unset($CONFIG['database']['rootdir']);
+ $CONFIG['database']['host'] = 'localhost';
+ $CONFIG['database']['user'] = '';
+ $CONFIG['database']['password'] = '';
+ $CONFIG['database']['name'] = 'openupload';
+ }
+ return $step+1;
+ }
+ $db = listModules($CONFIG['INSTALL_ROOT'].'/lib/modules/db');
+?>
+<form method="POST" action="index.php">
+<input type="hidden" name="step" value="<?php echo $step; ?>">
+<table border="0">
+<TR><TD>Database Type:</TD>
+<td><select name='dbtype'><option value="">-- Select one --</option>
+<?php foreach ($db as $d) {
+ $selected = $CONFIG['database']['type']==$d?'selected':'';
+ echo '<option value="'.$d.'" '.$selected.'>'.$d.'</option>';
+} ?>
+</select></td>
+</TR>
+<TR><TD colspan="2"><input type="submit" value="Next >>"></TD></TR>
+</table>
+</form>
+<?php
+}
+
+
+function databaseoptions($step) {
+ global $CONFIG;
+ global $_POST;
+ global $_SESSION;
+
+ if (isset($_POST['dbhost'])) {
+ $CONFIG['database']['host']=$_POST['dbhost'];
+ $CONFIG['database']['user']=$_POST['dbusername'];
+ if ($_POST['dbpassword']!='')
+ $CONFIG['database']['password']=$_POST['dbpassword'];
+ $CONFIG['database']['name']=$_POST['dbname'];
+ $CONFIG['database']['prefix']=$_POST['dbprefix'];
+ $_SESSION['options']['rootuser']=$_POST['rootuser'];
+ if ($_POST['rootpassword']!='')
+ $_SESSION['options']['rootpassword']=$_POST['rootpassword'];
+ $_SESSION['options']['newdb']=$_POST['newdb'];
+ $_SESSION['options']['newuser']=$_POST['newuser'];
+ $_SESSION['options']['populate']=$_POST['populate'];
+ if (isset($_POST['test'])) {
+ if ($_SESSION['options']['newdb']==1) {
+ $user = $_SESSION['options']['rootuser'];
+ $pwd = $_SESSION['options']['rootpassword'];
+ if ($CONFIG['database']['type']=='mysql')
+ $dbn = 'mysql';
+ else
+ $dbn = 'postgres';
+ } else {
+ $user = $CONFIG['database']['user'];
+ $pwd = $CONFIG['database']['password'];
+ $dbn = $CONFIG['database']['name'];
+ }
+ if (dbconnect($CONFIG['database']['host'],$user,$pwd,$dbn,true)) {
+ msg('Database connection SUCCESSFULL.','ok');
+ } else {
+ msg('Database connection failed ','fail');
+ }
+ } else {
+ /* check the values */
+ return $step+1;
+ }
+ }
+ //TODO: ask the db class for parameters
+?>
+<form method="POST" action="index.php">
+<input type="hidden" name="step" value="<?php echo $step; ?>">
+<table border="0">
+<TR><TD>Database Type:</TD>
+ <td><?php echo $CONFIG['database']['type']; ?></td></tr>
+<?php if ($CONFIG['database']['type']=='txt') { ?>
+<TR><TD>DB File Path:</TD><TD><input type="text" size="50" name="dbrootdir" value="<?php echo $CONFIG['database']['rootdir']; ?>"></TD></TR>
+<TR><TD colspan="2"><input type="submit" value="Next >>"></TD></TR>
+<?php } else { ?>
+<TR><TD>Host:</TD><TD><input type="text" size="30" name="dbhost" value="<?php echo $CONFIG['database']['host']; ?>"></TD></TR>
+<TR><TD>Username:</TD><TD><input type="text" size="30" name="dbusername" value="<?php echo $CONFIG['database']['user']; ?>"></TD></TR>
+<TR><TD>Password:</TD><TD><input type="password" size="30" name="dbpassword" value=""></TD></TR>
+<TR><TD>DB Name:</TD><TD><input type="text" size="30" name="dbname" value="<?php echo $CONFIG['database']['name']; ?>"></TD></TR>
+<TR><TD>Table prefix:</TD><TD><input type="text" size="30" name="dbprefix" value="<?php echo $CONFIG['database']['prefix']; ?>"></TD></TR>
+<TR><TD>Create the database?</TD><TD><input type="checkbox" name="newdb" value="1" <?php if ($_SESSION['options']['newdb']==1) echo 'checked'; ?>></TD></TR>
+<TR><TD>Also create user?</TD><TD><input type="checkbox" name="newuser" value="1" <?php if ($_SESSION['options']['newuser']==1) echo 'checked'; ?>></TD></TR>
+<TR><TD>DB Admin user:</TD><TD><input type="text" name="rootuser" value="<?php echo $_SESSION['options']['rootuser']; ?>"></TD></TR>
+<TR><TD>DB Admin password:</TD><TD><input type="password" name="rootpassword" value=""></TD></TR>
+<TR><TD>Populate database</TD><TD>
+<select name="populate">
+<?php $opt = array("No","Structure only","Base System data","Private mode","Restricted mode","Service mode","Public mode");
+ foreach ($opt as $k => $v) {
+ echo '<option value="'.$k.'" '.($k==$_SESSION['options']['populate']?'selected':'').'>'.$v.'</option>';
+ }
+?>
+</select>
+</TD></TR>
+<TR><TD colspan="2"><input type="submit" name="test" value="Test connection"> <input type="submit" value="Next >>"></TD></TR>
+<?php } ?>
+</table>
+</form>
+<?php
+}
+
+function options($step) {
+ global $_POST;
+ global $CONFIG;
+
+ $tr = listModules($CONFIG['INSTALL_ROOT'].'/lib/modules/tr');
+ $auth = listModules($CONFIG['INSTALL_ROOT'].'/lib/modules/auth');
+ $templates = listModules($CONFIG['INSTALL_ROOT'].'/templates','');
+
+ if (isset($_POST['translator'])) {
+ $error = false;
+ $CONFIG['translator']=$_POST['translator'];
+ $CONFIG['auth']=$_POST['auth'];
+ $CONFIG['defaultlang']=$_POST['defaultlang'];
+ $CONFIG['site']['title']=$_POST['sitetitle'];
+ $CONFIG['site']['webmaster']= $_POST['webmaster'];
+ $CONFIG['site']['email']= $_POST['email'];
+ $CONFIG['site']['footer']=str_replace('\"','"',$_POST['sitefooter']);
+ $CONFIG['registration']['email_confirm']=isset($_POST['confirmregistration'])?$_POST['confirmregistration']:'no';
+ $CONFIG['max_upload_size']=$_POST['max_upload_size'];
+ $CONFIG['max_download_time']=$_POST['max_download_time'];
+
+ if ($CONFIG['translator']=='') {
+ $error = true;
+ msg('Please select a translator','fail');
+ }
+ if ($CONFIG['auth']=='') {
+ $error = true;
+ msg('Please select an authentication module','fail');
+ }
+ if ($CONFIG['site']['webmaster']=='') {
+ $error = true;
+ msg('Please insert a webmaster e-mail address','fail');
+ }
+ if ($CONFIG['site']['email']=='') {
+ $error = true;
+ msg('Please insert a site e-mail address','fail');
+ }
+ if ($CONFIG['max_upload_size']=='') {
+ $error = true;
+ msg('Please insert a maximum default upload size','fail');
+ }
+ if ($CONFIG['max_download_time']=='') {
+ $error = true;
+ msg('Please insert a maximum download time','fail');
+ }
+ if (!$error) {
+ return $step+1;
+ }
+ } else if (!isset($CONFIG['site']['title'])) {
+ /* init default values */
+ $CONFIG['translator']='phparray';
+ $CONFIG['auth']='default';
+ $CONFIG['defaultlang']='en';
+ $CONFIG['site']['title']='Open Upload';
+ $CONFIG['site']['webmaster']= '';
+ $CONFIG['site']['email']= '';
+ $CONFIG['site']['footer']='<a href="http://openupload.sf.net">Open Upload</a> - Created by Alessandro Briosi © 2008';
+ $CONFIG['registration']['email_confirm']='yes';
+ $CONFIG['max_upload_size']=100;
+ $CONFIG['max_download_time']=120;
+ }
+?>
+<form method="POST" action="index.php">
+<input type="hidden" name="step" value="<?php echo $step; ?>">
+<table border="0">
+<tr><td>Translation module:</td><td>
+<select name="translator">
+<option value="">-- Select one --</option>
+<?php foreach ($tr as $t) {
+ $selected = $CONFIG['translator']==$t?'selected':'';
+ echo '<option value="'.$t.'" '.$selected.'>'.$t.'</option>';
+} ?>
+</select>
+</td></tr>
+<tr><td>Default language:</td><td><input type="text" name="defaultlang" value="<?php echo $CONFIG['defaultlang']; ?>"></td></tr>
+<tr><td>Authentication module:<br>(LDAP Configuration needs to be done<br> by hand for now)</td><td>
+<select name="auth">
+<option value="">-- Select one --</option>
+<?php foreach ($auth as $t) {
+ $selected = $CONFIG['auth']==$t?'selected':'';
+ echo '<option value="'.$t.'" '.$selected.'>'.$t.'</option>';
+} ?>
+</select>
+</td></tr>
+<tr><td>Site title:</td><td><input type="text" name="sitetitle" value="<?php echo $CONFIG['site']['title']; ?>"></td></tr>
+<tr><td>WebMaster E-mail:</td><td><input type="text" name="webmaster" value="<?php echo $CONFIG['site']['webmaster']; ?>"></td></tr>
+<tr><td>Site E-mail:</td><td><input type="text" name="email" value="<?php echo $CONFIG['site']['email']; ?>"></td></tr>
+<tr><td>Confirm registration with e-mail:</td><td><input type="checkbox" name="confirmregistration" value="yes" <?php if ($CONFIG['registration']['email_confirm']=='yes') echo 'checked'; ?> ></td></tr>
+<tr><td>Template:</td><td>
+<select name="template">
+<option value="">-- Select one --</option>
+<?php foreach ($templates as $t) {
+ if ($t != '..' and $t != '.' and strpos($t,'.')!==0) {
+ $selected = $CONFIG['auth']==$t?'selected':'';
+ echo '<option value="'.$t.'" '.$selected.'>'.$t.'</option>';
+ }
+} ?>
+</select>
+</td></tr>
+<tr><td>Template Footer:</td><td><textarea name="sitefooter" cols="50" rows=...
[truncated message content] |
|
From: <ts...@us...> - 2008-11-12 18:56:35
|
Revision: 141
http://openupload.svn.sourceforge.net/openupload/?rev=141&view=rev
Author: tsdogs
Date: 2008-11-12 18:56:31 +0000 (Wed, 12 Nov 2008)
Log Message:
-----------
Add multiple file uploads at once
Modified Paths:
--------------
trunk/lib/main.inc.php
trunk/lib/modules/default/files.inc.php
trunk/plugins/mimetypes.inc.php
trunk/templates/default/modules/files/downloadConfirm.tpl
trunk/templates/default/modules/files/uploadForm.tpl
trunk/templates/default/modules/files/uploadOptions.tpl
trunk/www/setup.inc.php
Modified: trunk/lib/main.inc.php
===================================================================
--- trunk/lib/main.inc.php 2008-11-12 18:54:35 UTC (rev 140)
+++ trunk/lib/main.inc.php 2008-11-12 18:56:31 UTC (rev 141)
@@ -367,6 +367,13 @@
$this->tpl->assign('script',$_SERVER['PHP_SELF']);
$this->tpl->assign('page',$this->page);
+ if (isset($this->config['multiupload'])) {
+ if ($this->config['multiupload']<=0)
+ $this->config['multiupload']=1;
+ $this->tpl->assign('multiupload',$this->config['multiupload']);
+ } else {
+ $this->config['multiupload']=1;
+ }
/* check for banned IP */
if ($this->banned() != 'allow') {
$this->page['content'] = $this->fetch('banned');
Modified: trunk/lib/modules/default/files.inc.php
===================================================================
--- trunk/lib/modules/default/files.inc.php 2008-11-12 18:54:35 UTC (rev 140)
+++ trunk/lib/modules/default/files.inc.php 2008-11-12 18:56:31 UTC (rev 141)
@@ -62,7 +62,7 @@
global $_SESSION;
global $_FILES;
global $_SERVER;
-
+
if (isset($_FILES['upload'])) {
if ($_FILES['upload']['error']>0) {
switch ($_FILES['upload']['error']) { /* taken from here: http://it.php.net/manual/en/features.file-upload.errors.php */
@@ -78,28 +78,47 @@
}
$this->nextStep(1);
} else if ($_FILES['upload']['size']>app()->user->info('max_upload_size')) {
- app()->error(tr('Maximum file size exceeded!')); break;
+ app()->error(tr('Maximum file size exceeded!'));
+ break;
} 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_login']=app()->user->info('login');
+ for ($i = 0; $i<app()->config['multiupload']; $i++) {
+ $u = 'upload';
+ $tmpnamex = $tmpname;
+ if ($i>0) {
+ $u = 'upload_'.$i;
+ $tmpnamex = $tmpname.'_'.$i;
+ }
+ if (isset($_FILES[$u]) and $_FILES[$u]['tmp_name']!='') {
+ move_uploaded_file($_FILES[$u]['tmp_name'],$tmpnamex);
+ $_SESSION['user']['u'][$i]['tmp']=$tmpnamex;
+ $_SESSION['user']['u'][$i]['mime']=$_FILES[$u]['type'];
+ $_SESSION['user']['u'][$i]['name']=$_FILES[$u]['name'];
+ $_SESSION['user']['u'][$i]['size']=$_FILES[$u]['size'];
+ $_SESSION['user']['u'][$i]['ip']=$_SERVER['REMOTE_ADDR'];
+ $_SESSION['user']['u'][$i]['user_login']=app()->user->info('login');
+ $result = app()->pluginAction('uploadComplete',$_SESSION['user']['u'][$i]);
+ if (!$result) { /* some plugin blocked the upload */
+ /* remove the file */
+ unset($_SESSION['user']['u']);
+ redirect();
+ }
+ }
+ }
$this->nextStep(app()->step);
}
- } else if (!isset($_SESSION['user']['u'])) {
+ } else if (!isset($_SESSION['user']['u'][0])) {
redirect();
}
- $result = app()->pluginAction('uploadOptions',$_SESSION['user']['u']);
+ $result = app()->pluginAction('uploadOptions',$_SESSION['user']['u'][0]);
if (!$result) { /* some plugin blocked the upload */
- /* remove the file */
+ /* remove the files */
+ unset($_SESSION['user']['u']);
redirect();
}
- $this->tpl->assign('finfo',$_SESSION['user']['u']);
+ $this->tpl->assign('finfo',$_SESSION['user']['u'][0]);
+ $this->tpl->assign('files',$_SESSION['user']['u']);
/* ask for information on the file */
}
@@ -112,37 +131,52 @@
/* display the information on the upload */
if (isset($_POST['description'])) {
/* move the file to the actual location */
- $finfo = $_SESSION['user']['u'];
- $finfo['description'] = $_POST['description'];
- /* now check plugins and if ok add file otherwise redirect */
- $result = app()->pluginAction('uploadConfirm',$finfo);
- if (!$result)
- $this->prevStep();
- /* everything ok then add the file */
- $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_login','ip','upload_date'));
- foreach (app()->plugins as $plugin) {
- if (count($plugin->fields)>0) {
- foreach ($plugin->fields as $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'));
+ for ($i = 0; $i<count($_SESSION['user']['u']); $i++) {
+ $finfo = $_SESSION['user']['u'][$i];
+ $finfo['description'] = $_POST['description'];
+ /* now check plugins and if ok add file otherwise redirect */
+ if ($i==0) {
+ $result = app()->pluginAction('uploadConfirm',$finfo);
+ if (!$result)
+ $this->prevStep();
+ $finfo['id']= app()->db->newRandomId('files','id');
+ $mainid = $finfo['id'];
+ } else {
+ $finfo['id']=$mainid.'_'.$i;
+ }
+ /* everything ok then add the file */
+ $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_login','ip','upload_date'));
+ if ($i==0) {
+ foreach (app()->plugins as $plugin) {
+ if (count($plugin->fields)>0) {
+ foreach ($plugin->fields as $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'));
+ }
+ }
}
+ } else {
+ $pinfo['file_id'] = $finfo['id'];
+ $pinfo['module'] = 'files';
+ $pinfo['name']='group';
+ $pinfo['value']=$mainid;
+ app()->db->insert('file_options',$pinfo,array('file_id','module','name','value'));
}
+ rename($_SESSION['user']['u'][$i]['tmp'],app()->config['DATA_PATH'].'/'.$finfo['id']);
+ $_SESSION['user']['u'][$i]=$finfo;
}
- rename($_SESSION['user']['u']['tmp'],app()->config['DATA_PATH'].'/'.$finfo['id']);
- $_SESSION['user']['u']=$finfo;
$this->nextStep();
}
}
function uploadFileInfo() {
- if (isset($_SESSION['user']['u']['id'])) {
- $finfo = $_SESSION['user']['u'];
+ if (isset($_SESSION['user']['u'][0]['id'])) {
+ $finfo = $_SESSION['user']['u'][0];
/* get the file info */
$finfo['downloadlink']= app()->config['WWW_SERVER'].app()->config['WWW_ROOT'].'/?action=d&id='.$finfo['id'];
$finfo['removelink']= app()->config['WWW_SERVER'].app()->config['WWW_ROOT'].'/?action=r&id='.$finfo['id'].'&removeid='.$finfo['remove'];
@@ -153,14 +187,21 @@
redirect();
}
}
-
+/**/
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'];
+ $finfo[0][$v['name']]=$v['value'];
}
+ $afiles = app()->db->read('file_options',array('module' => 'files', 'name' => 'group', 'value' => $id));
+ if (count($afiles)>0) {
+ foreach ($afiles as $k => $a) {
+ $afile = app()->db->read('files',array('id'=>$a['file_id']));
+ $finfo[$k+1]=$afile[0];
+ }
+ }
+//print_r($finfo); exit();
return $finfo;
}
@@ -170,7 +211,7 @@
unset($_SESSION['user']['d']);
if (isset($_GET['id'])) {
- $_SESSION['user']['d']['id'] = $_GET['id'];
+ $_SESSION['user']['d'][0]['id'] = $_GET['id'];
$this->nextStep();
}
$finfo = array();
@@ -179,24 +220,26 @@
function downloadRequest() {
global $_GET;
+ global $_POST;
global $_SESSION;
-
+
$id = '';
if (isset($_POST['id'])) {
$id = $_POST['id'];
- } else if (isset($_SESSION['user']['d']['id'])) {
- $id = $_SESSION['user']['d']['id'];
+ } else if (isset($_SESSION['user']['d'][0]['id'])) {
+ $id = $_SESSION['user']['d'][0]['id'];
}
/* check if download exsists, and what are the properties */
if ($id != '') {
$finfo = $this->loadFile($id);
- if ($finfo['id']!=$id) {
+ if ($finfo[0]['id']!=$id) {
app()->error(tr('Requested file does not exsist!'));
$this->prevStep();
} else {
$_SESSION['user']['d']=$finfo;
- $this->tpl->assign('finfo',$finfo);
- $result = app()->pluginAction('downloadRequest',$finfo,false);
+ $this->tpl->assign('finfo',$finfo[0]);
+ $this->tpl->assign('files',$finfo);
+ $result = app()->pluginAction('downloadRequest',$finfo[0],false);
if ($result) {
$this->nextStep();
}
@@ -209,18 +252,20 @@
/* here we do the actual download of the file */
if (!isset($_SESSION['user']['d'])) {
redirect();
- } else if ($_SESSION['user']['d']['candownload']=='ok') {
+ } else if ($_SESSION['user']['d'][0]['candownload']=='ok') {
$finfo = $_SESSION['user']['d'];
- $this->tpl->assign('finfo',$finfo);
+ $this->tpl->assign('finfo',$finfo[0]);
+ $this->tpl->assign('files',$finfo);
/* download is allowed */
} else {
$finfo = $_SESSION['user']['d'];
/* check wether the plugins are ok */
- $result = app()->pluginAction('downloadConfirm',$finfo);
+ $result = app()->pluginAction('downloadConfirm',$finfo[0]);
if (!$result)
$this->prevStep();
+ for ($i = 0; $i<count($finfo); $i++)
+ $finfo[$i]['candownload']='ok';
$_SESSION['user']['d']=$finfo;
- $_SESSION['user']['d']['candownload']='ok';
/* now the user can download it */
$this->nextStep(app()->step);
}
@@ -229,21 +274,26 @@
function serveFile() {
global $_SESSION;
global $_POST;
+ global $_GET;
+ $num = 0;
+ if (isset($_GET['fid'])) {
+ $num = $_GET['fid'];
+ }
/* here we do the actual download of the file */
if (!isset($_SESSION['user']['d'])) {
redirect();
- } else if ($_SESSION['user']['d']['candownload']!='ok') {
+ } else if ($_SESSION['user']['d'][$num]['candownload']!='ok') {
$this->nextStep(2,'d');
} else {
$finfo = $_SESSION['user']['d'];
/* check wether the plugins are ok */
- $result = app()->pluginAction('serveFile',$finfo);
+ $result = app()->pluginAction('serveFile',$finfo[$num]);
if (!$result)
$this->nextStep(3,'d');
- $_SESSION['user']['d']['candownload']='ok';
+ $_SESSION['user']['d'][$num]['candownload']='ok';
/* if we got this far the download should begin serving */
- $file = app()->config['DATA_PATH'].'/'.$finfo['id'];
+ $file = app()->config['DATA_PATH'].'/'.$finfo[$num]['id'];
$filesize = filesize($file);
/* set to not timeout within default setting */
if (isset(app()->config['max_download_time'])) {
@@ -253,12 +303,12 @@
}
/* disable and clean output buffer so it won't reach memory limit */
ob_end_clean();
- header('Content-Type: '.$finfo['mime']);
+ header('Content-Type: '.$finfo[$num]['mime']);
header('Content-Length: '.$filesize);
- header('Content-Disposition: attachment; filename="'.$finfo['name'].'"');
+ header('Content-Disposition: attachment; filename="'.$finfo[$num]['name'].'"');
readfile($file);
/* file should have been sent now let's reset the download info */
- $_SESSION['user']['d']['candownload']='ko';
+ $_SESSION['user']['d'][$num]['candownload']='ko';
exit(0);
}
}
Modified: trunk/plugins/mimetypes.inc.php
===================================================================
--- trunk/plugins/mimetypes.inc.php 2008-11-12 18:54:35 UTC (rev 140)
+++ trunk/plugins/mimetypes.inc.php 2008-11-12 18:56:31 UTC (rev 141)
@@ -41,7 +41,7 @@
return true;
}
- function uploadOptions(&$finfo,$acl) {
+ function uploadComplete(&$finfo,$acl) {
if ($acl!='enable') return true;
$group = $this->getGroup();
if (count($this->config['allowed'][$group])==0) {
Modified: trunk/templates/default/modules/files/downloadConfirm.tpl
===================================================================
--- trunk/templates/default/modules/files/downloadConfirm.tpl 2008-11-12 18:54:35 UTC (rev 140)
+++ trunk/templates/default/modules/files/downloadConfirm.tpl 2008-11-12 18:56:31 UTC (rev 141)
@@ -1,14 +1,14 @@
{tr}You can now proceed downloading the file{/tr}:
<table border="0">
<tr><td>{tr}File description{/tr}:</td><td><b>{$finfo.description}</b></td></tr>
-<tr><td>{tr}File name{/tr}:</td><td><b>{$finfo.name}</b></td></tr>
-<tr><td>{tr}File size{/tr}:</td><td><b>{$finfo.size|fsize_format}</b></td></tr>
<tr><td>{tr}Uploaded on{/tr}:</td><td><b>{$finfo.upload_date}</b></td></tr>
{$plugins}
+{foreach from=$files item=f key=k}
+<tr><td>{tr}File name{/tr}:</td><td><b>{$f.name}</b></td></tr>
+<tr><td>{tr}File size{/tr}:</td><td><b>{$f.size|fsize_format}</b></td></tr>
+<td colspan="2" align="center"><a href="{$script}?action=g&fid={$k}">
+ <img src="{tpl file=/img/download.png}" border="0"><br>
+ {tr}Download file{/tr}</a></td></tr>
+{/foreach}
</table>
-<div id="downloadbutton"><br><center>
- <a href="{$script}?action=g">
- <img src="{tpl file=/img/download.png}" border="0"><br>
- {tr}Download file{/tr}</a></center>
-</div>
Modified: trunk/templates/default/modules/files/uploadForm.tpl
===================================================================
--- trunk/templates/default/modules/files/uploadForm.tpl 2008-11-12 18:54:35 UTC (rev 140)
+++ trunk/templates/default/modules/files/uploadForm.tpl 2008-11-12 18:56:31 UTC (rev 141)
@@ -1,8 +1,12 @@
{literal}
<script>
-function unhide() {
- $obj = document.getElementById('uploadbutton');
- $obj.style.visibility = 'visible';
+function unhide(i) {
+ obj = document.getElementById('uploadbutton');
+ obj.style.visibility = 'visible';
+
+ obj = document.getElementById('upload_'+i);
+ if (obj)
+ obj.style.visibility = 'visible';
}
</script>
{/literal}
@@ -14,8 +18,18 @@
<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="60" name="upload" onchange="if (this.value!='') unhide();"><br>
+ <input type="file" class="file" size="60" name="upload" onchange="if (this.value!='') unhide(1);"><br>
+{if isset($multiupload)}
+{section name=i start=1 loop=$multiupload}
{if isset($user.max_upload_size)}
+<div id="upload_{$smarty.section.i.index}" style="visibility: hidden">
+<input type="hidden" name="MAX_FILE_SIZE" value="{$user.max_upload_size}">
+{/if}
+<input type="file" class="file" size="60" name="upload_{$smarty.section.i.index}" onchange="if (this.value!='') unhide({$smarty.section.i.index+1});"><br>
+</div>
+{/section}
+{/if}
+{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}
Modified: trunk/templates/default/modules/files/uploadOptions.tpl
===================================================================
--- trunk/templates/default/modules/files/uploadOptions.tpl 2008-11-12 18:54:35 UTC (rev 140)
+++ trunk/templates/default/modules/files/uploadOptions.tpl 2008-11-12 18:56:31 UTC (rev 141)
@@ -3,8 +3,10 @@
<input type="hidden" name="action" value="{$action}">
<input type="hidden" name="step" value="{$nextstep}">
<table border="0">
-<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>
+{foreach from=$files item=f}
+<tr><td>{tr}File name{/tr}:</td><td>{$f.name}</td></tr>
+<tr><td>{tr}File size{/tr}:</td><td>{$f.size|fsize_format}</td></tr>
+{/foreach}
<tr><td>{tr}Description{/tr}:</td><td><input id="description" type="text" size="30" name="description" value="{$finfo.description}"></td></tr>
{$plugins}
<tr><td colspan="2" align="right"><input class="submit" type="submit" value="{tr}Complete upload{/tr}"></td></tr>
Modified: trunk/www/setup.inc.php
===================================================================
--- trunk/www/setup.inc.php 2008-11-12 18:54:35 UTC (rev 140)
+++ trunk/www/setup.inc.php 2008-11-12 18:56:31 UTC (rev 141)
@@ -205,7 +205,7 @@
'dropdb' => 'DROP DATABASE "%1"',
'createdb' => 'CREATE DATABASE "%1"',
'dropuser' => '',
- 'createuser' => 'GRANT ALL PRIVILEGES TO "%1"@"localhost" ON %2.* IDENTIFIED BY "%3"',
+ 'createuser' => '',
'grant' => '',
'droptable' => 'DROP TABLE IF EXISTS `%2`',
);
@@ -448,10 +448,12 @@
unset($CONFIG['database']['name']);
} else {
unset($CONFIG['database']['rootdir']);
- $CONFIG['database']['host'] = 'localhost';
- $CONFIG['database']['user'] = '';
- $CONFIG['database']['password'] = '';
- $CONFIG['database']['name'] = 'openupload';
+ if (!isset($CONFIG['database']['host'])) {
+ $CONFIG['database']['host'] = 'localhost';
+ $CONFIG['database']['user'] = '';
+ $CONFIG['database']['password'] = '';
+ $CONFIG['database']['name'] = 'openupload';
+ }
}
return $step+1;
}
@@ -572,6 +574,7 @@
$CONFIG['registration']['email_confirm']=isset($_POST['confirmregistration'])?$_POST['confirmregistration']:'no';
$CONFIG['max_upload_size']=$_POST['max_upload_size'];
$CONFIG['max_download_time']=$_POST['max_download_time'];
+ $CONFIG['multiupload']=$_POST['max_download_time'];
if ($CONFIG['translator']=='') {
$error = true;
@@ -597,6 +600,10 @@
$error = true;
msg('Please insert a maximum download time','fail');
}
+ if ($CONFIG['multiupload']<1) {
+ $error = true;
+ msg('Please insert a max number of uploaded files per upload','fail');
+ }
if (!$error) {
return $step+1;
}
@@ -612,6 +619,7 @@
$CONFIG['registration']['email_confirm']='yes';
$CONFIG['max_upload_size']=100;
$CONFIG['max_download_time']=120;
+ $CONFIG['multiupload']=1;
}
?>
<form method="POST" action="index.php">
@@ -654,6 +662,7 @@
<tr><td>Template Footer:</td><td><textarea name="sitefooter" cols="50" rows="5"><?php echo $CONFIG['site']['footer']; ?></textarea></td></tr>
<tr><td>Maximum upload size (in MB):</td><td><input type="text" name="max_upload_size" value="<?php echo $CONFIG['max_upload_size']; ?>"></td></tr>
<tr><td>Maximum download time (in Min)<br>0 disables it:</td><td><input type="text" name="max_download_time" value="<?php echo $CONFIG['max_download_time']; ?>"></td></tr>
+<tr><td>Max num. of file uploaded per upload:</td><td><input type="text" name="multiupload" value="<?php echo $CONFIG['multiupload']; ?>"></td></tr>
<TR><TD colspan="2"><input type="submit" value="Next >>"></TD></TR>
</table>
</form>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-11-14 19:16:43
|
Revision: 148
http://openupload.svn.sourceforge.net/openupload/?rev=148&view=rev
Author: tsdogs
Date: 2008-11-14 19:16:41 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
update with French translation
Modified Paths:
--------------
trunk/CHANGELOG
trunk/README
Modified: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG 2008-11-14 19:13:14 UTC (rev 147)
+++ trunk/CHANGELOG 2008-11-14 19:16:41 UTC (rev 148)
@@ -1,4 +1,4 @@
-Changelog from release 0.3 to 0.4
+Changelog from release 0.3b to 0.4
* Fixed BUGS
- Registration wasn't working 'cause of a api rename bug
@@ -16,6 +16,8 @@
* Plugins
- Options are now group based and in the database
+* Translations
+ - Add French thanks to BatMat (themat)
Changelog from 0.3a to 0.3b (updated 2008.11.07)
Modified: trunk/README
===================================================================
--- trunk/README 2008-11-14 19:13:14 UTC (rev 147)
+++ trunk/README 2008-11-14 19:16:41 UTC (rev 148)
@@ -2,7 +2,7 @@
OpenUpload - Share your big files over the internet service
-VERSION: 0.3
+VERSION: 0.4
AUTHORS:
@@ -19,6 +19,8 @@
Crystal Project Icons (http://www.everaldo.com) (Used in default template)
Copyright: Copyright (c) 2006-2007 Everaldo Coelho
+BatMat (themat)
+ French translation
DESCRIPTION:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ts...@us...> - 2008-11-17 18:09:08
|
Revision: 151
http://openupload.svn.sourceforge.net/openupload/?rev=151&view=rev
Author: tsdogs
Date: 2008-11-17 18:09:06 +0000 (Mon, 17 Nov 2008)
Log Message:
-----------
Fix typos
Modified Paths:
--------------
trunk/locale/fr/LC_MESSAGES/openupload.po
trunk/locale/fr.inc.php
trunk/locale/it/LC_MESSAGES/openupload.po
trunk/locale/it.inc.php
trunk/templates/default/locale/fr/LC_MESSAGES/template.mo
trunk/templates/default/locale/fr/LC_MESSAGES/template.po
trunk/templates/default/locale/fr.inc.php
trunk/templates/default/locale/it/LC_MESSAGES/template.mo
trunk/templates/default/locale/it/LC_MESSAGES/template.po
trunk/templates/default/locale/it.inc.php
Modified: trunk/locale/fr/LC_MESSAGES/openupload.po
===================================================================
--- trunk/locale/fr/LC_MESSAGES/openupload.po 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/locale/fr/LC_MESSAGES/openupload.po 2008-11-17 18:09:06 UTC (rev 151)
@@ -185,11 +185,11 @@
msgstr "Cette extension de fichier n'est pas supportée!"
#: ../../../lib/modules/default/files.inc.php:77
-msgid "Upload failed for Unknonw error code: %1"
+msgid "Upload failed for Unknown error code: %1"
msgstr "L'envoi de fichier a échoué pour une raison inconnue. ERREUR: %1"
#: ../../../lib/modules/default/files.inc.php:194
-msgid "Requested file does not exsist!"
+msgid "Requested file does not exist!"
msgstr "Le fichier demandé n'existe pas!"
#: ../../../lib/modules/default/files.inc.php:280
Modified: trunk/locale/fr.inc.php
===================================================================
--- trunk/locale/fr.inc.php 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/locale/fr.inc.php 2008-11-17 18:09:06 UTC (rev 151)
@@ -40,8 +40,8 @@
$tr["Missing temporary directory"] = "Le répertoire temporaire est introuvable";
$tr["Can't write to temporary diretory!"] = "Impossible d'écrire dans le répertoire temporaire!";
$tr["Upload blocked by extension!"] = "Cette extension de fichier n'est pas supportée!";
-$tr["Upload failed for Unknonw error code: %1"] = "L'envoi de fichier a échoué pour une raison inconnue. ERREUR: %1";
-$tr["Requested file does not exsist!"] = "Le fichier demandé n'existe pas!";
+$tr["Upload failed for Unknown error code: %1"] = "L'envoi de fichier a échoué pour une raison inconnue. ERREUR: %1";
+$tr["Requested file does not exist!"] = "Le fichier demandé n'existe pas!";
$tr["Wrong file id!"] = "L'identifiant du fichier est erronné!";
$tr["Administration"] = "Administration";
$tr["User administration not supported by Auth Module"] = "L'administration des utilisateurs n'est pas permise par le module d'authentification (Auth)";
Modified: trunk/locale/it/LC_MESSAGES/openupload.po
===================================================================
--- trunk/locale/it/LC_MESSAGES/openupload.po 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/locale/it/LC_MESSAGES/openupload.po 2008-11-17 18:09:06 UTC (rev 151)
@@ -185,11 +185,11 @@
msgstr "Upload bloccato da un'estensione!"
#: ../../../lib/modules/default/files.inc.php:77
-msgid "Upload failed for Unknonw error code: %1"
+msgid "Upload failed for Unknown error code: %1"
msgstr "Upload fallito per una ragione sconosciuta. codice errore: %1"
#: ../../../lib/modules/default/files.inc.php:194
-msgid "Requested file does not exsist!"
+msgid "Requested file does not exist!"
msgstr "Il file richiesto non esiste!"
#: ../../../lib/modules/default/files.inc.php:280
Modified: trunk/locale/it.inc.php
===================================================================
--- trunk/locale/it.inc.php 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/locale/it.inc.php 2008-11-17 18:09:06 UTC (rev 151)
@@ -40,8 +40,8 @@
$tr["Missing temporary directory"] = "Manca la cartella per l'upload temporaneo";
$tr["Can't write to temporary diretory!"] = "Impossibile scrivere nella cartella temporanea!";
$tr["Upload blocked by extension!"] = "Upload bloccato da un'estensione!";
-$tr["Upload failed for Unknonw error code: %1"] = "Upload fallito per una ragione sconosciuta. codice errore: %1";
-$tr["Requested file does not exsist!"] = "Il file richiesto non esiste!";
+$tr["Upload failed for Unknown error code: %1"] = "Upload fallito per una ragione sconosciuta. codice errore: %1";
+$tr["Requested file does not exist!"] = "Il file richiesto non esiste!";
$tr["Wrong file id!"] = "ID del file errata!";
$tr["Administration"] = "Amministrazione";
$tr["User administration not supported by Auth Module"] = "Amministrazione utenti non supportata dal modulo di Autenticazione";
Modified: trunk/templates/default/locale/fr/LC_MESSAGES/template.mo
===================================================================
(Binary files differ)
Modified: trunk/templates/default/locale/fr/LC_MESSAGES/template.po
===================================================================
--- trunk/templates/default/locale/fr/LC_MESSAGES/template.po 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/templates/default/locale/fr/LC_MESSAGES/template.po 2008-11-17 18:09:06 UTC (rev 151)
@@ -3,8 +3,8 @@
"Project-Id-Version: OpenUpload default template\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-11-14 17:29+0100\n"
-"PO-Revision-Date: 2008-11-14 18:29+0100\n"
-"Last-Translator: Mathieu Robin-Vinet <mat...@ho...>\n"
+"PO-Revision-Date: 2008-11-17 19:05+0100\n"
+"Last-Translator: Alessandro Briosi <ts...@br...>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -374,7 +374,7 @@
msgstr "Envoyer"
#: ../../../default.c:398
-msgid "FILE HAS BEEN SUCCESSGULLY REMOVED"
+msgid "FILE HAS BEEN SUCCESSFULLY REMOVED"
msgstr "LE FICHIER A ETE SUPPRIME AVEC SUCCES"
#: ../../../default.c:431
@@ -434,11 +434,11 @@
msgstr "Changer"
#: ../../../default.c:500
-msgid "Registration succeded"
+msgid "Registration succeeded"
msgstr "Inscription effectuée avec succès"
#: ../../../default.c:503
-msgid "An e-mail has been sent for the accout activation"
+msgid "An e-mail has been sent for the account activation"
msgstr "Un courriel de confirmation a été envoyé"
#: ../../../default.c:506
Modified: trunk/templates/default/locale/fr.inc.php
===================================================================
--- trunk/templates/default/locale/fr.inc.php 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/templates/default/locale/fr.inc.php 2008-11-17 18:09:06 UTC (rev 151)
@@ -68,7 +68,7 @@
$tr["You can now proceed downloading the file"] = "Vous pouvez maintenant télécharger le fichier";
$tr["Download file"] = "Télécharger";
$tr["Complete upload"] = "Envoyer";
-$tr["FILE HAS BEEN SUCCESSGULLY REMOVED"] = "LE FICHIER A ETE SUPPRIME AVEC SUCCES";
+$tr["FILE HAS BEEN SUCCESSFULLY REMOVED"] = "LE FICHIER A ETE SUPPRIME AVEC SUCCES";
$tr["Dear "] = "Cher";
$tr["This e-mail message is sent to you to confirm your account registration has a valid e-mail address."] = "Ce message vous est envoyé pour confirmer que votre compte utilise une adresse de courriel valide";
$tr["Open the following link in a browser to confirm your account."] = "Cliquez sur le lient suivant pour confirmer votre inscription.";
@@ -82,8 +82,8 @@
$tr["Login here"] = "vous Authentifier ici";
$tr["Language"] = "Langue";
$tr["Change"] = "Changer";
-$tr["Registration succeded"] = "Inscription effectuée avec succès";
-$tr["An e-mail has been sent for the accout activation"] = "Un courriel de confirmation a été envoyé";
+$tr["Registration succeeded"] = "Inscription effectuée avec succès";
+$tr["An e-mail has been sent for the account activation"] = "Un courriel de confirmation a été envoyé";
$tr["Please follow the e-mail instructions to activate your account."] = "Merci de suivre les instructions contenues dans le courriel pour activer votre compte.";
$tr["back to home"] = "Retour à l'accueil";
$tr["Old password"] = "Ancien mot de passe";
Modified: trunk/templates/default/locale/it/LC_MESSAGES/template.mo
===================================================================
(Binary files differ)
Modified: trunk/templates/default/locale/it/LC_MESSAGES/template.po
===================================================================
--- trunk/templates/default/locale/it/LC_MESSAGES/template.po 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/templates/default/locale/it/LC_MESSAGES/template.po 2008-11-17 18:09:06 UTC (rev 151)
@@ -2,8 +2,8 @@
msgstr ""
"Project-Id-Version: OpenUpload default template\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-10-28 18:29+0100\n"
-"PO-Revision-Date: 2008-10-28 18:29+0100\n"
+"POT-Creation-Date: 2008-11-17 19:06+0100\n"
+"PO-Revision-Date: 2008-11-17 19:06+0100\n"
"Last-Translator: Alessandro Briosi <ts...@br...>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -374,7 +374,7 @@
msgstr "Completa caricamento"
#: ../../../default.c:398
-msgid "FILE HAS BEEN SUCCESSGULLY REMOVED"
+msgid "FILE HAS BEEN SUCCESSFULLY REMOVED"
msgstr "IL FILE E' STATO RIMOSSO CON SUCCESSO"
#: ../../../default.c:431
@@ -434,11 +434,11 @@
msgstr "Modifica"
#: ../../../default.c:500
-msgid "Registration succeded"
+msgid "Registration succeeded"
msgstr "Registrazione avvenuta con successo"
#: ../../../default.c:503
-msgid "An e-mail has been sent for the accout activation"
+msgid "An e-mail has been sent for the account activation"
msgstr "Un'email ti è stata inviata per confermare l'attivazione del tuo account"
#: ../../../default.c:506
Modified: trunk/templates/default/locale/it.inc.php
===================================================================
--- trunk/templates/default/locale/it.inc.php 2008-11-17 18:07:46 UTC (rev 150)
+++ trunk/templates/default/locale/it.inc.php 2008-11-17 18:09:06 UTC (rev 151)
@@ -68,7 +68,7 @@
$tr["You can now proceed downloading the file"] = "Puoi ora procedere allo scaricamento del file";
$tr["Download file"] = "Scarica file";
$tr["Complete upload"] = "Completa caricamento";
-$tr["FILE HAS BEEN SUCCESSGULLY REMOVED"] = "IL FILE E' STATO RIMOSSO CON SUCCESSO";
+$tr["FILE HAS BEEN SUCCESSFULLY REMOVED"] = "IL FILE E' STATO RIMOSSO CON SUCCESSO";
$tr["Dear "] = "Egregio";
$tr["This e-mail message is sent to you to confirm your account registration has a valid e-mail address."] = "Questo messaggio ti è stato inviato per confermare che il tuo account abbia un indirizzo e-mail valido";
$tr["Open the following link in a browser to confirm your account."] = "Apri il seguente indirizzo in un browser per confermare il tuo account.";
@@ -82,8 +82,8 @@
$tr["Login here"] = "Accedere qui";
$tr["Language"] = "Lingua";
$tr["Change"] = "Modifica";
-$tr["Registration succeded"] = "Registrazione avvenuta con successo";
-$tr["An e-mail has been sent for the accout activation"] = "Un'email ti è stata inviata per confermare l'attivazione del tuo account";
+$tr["Registration succeeded"] = "Registrazione avvenuta con successo";
+$tr["An e-mail has been sent for the account activation"] = "Un'email ti è stata inviata per confermare l'attivazione del tuo account";
$tr["Please follow the e-mail instructions to activate your account."] = "Segui le istruzioni dell'e-mail per attivare il tuo account.";
$tr["back to home"] = "torna alla pagina principale";
$tr["Old password"] = "Vecchia Password";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|