[Openupload-svn-update] SF.net SVN: openupload:[176] trunk
Status: Beta
Brought to you by:
tsdogs
|
From: <ts...@us...> - 2008-12-09 18:11:49
|
Revision: 176
http://openupload.svn.sourceforge.net/openupload/?rev=176&view=rev
Author: tsdogs
Date: 2008-12-09 18:11:44 +0000 (Tue, 09 Dec 2008)
Log Message:
-----------
add options configuration to the admin
Modified Paths:
--------------
trunk/TODO
trunk/lib/modules/default/admin.inc.php
trunk/templates/default/modules/admin/options.tpl
trunk/www/setup.inc.php
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-12-09 17:16:31 UTC (rev 175)
+++ trunk/TODO 2008-12-09 18:11:44 UTC (rev 176)
@@ -2,7 +2,6 @@
******* MUST BE DONE BEFORE RELEASE 0.4 *******
-
Bugs
- Fix all bugs I find in 0.3 (I hope somebody else will report some if they exsist)
Modified: trunk/lib/modules/default/admin.inc.php
===================================================================
--- trunk/lib/modules/default/admin.inc.php 2008-12-09 17:16:31 UTC (rev 175)
+++ trunk/lib/modules/default/admin.inc.php 2008-12-09 18:11:44 UTC (rev 176)
@@ -648,23 +648,40 @@
function database() {
}
-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;
+ 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;
}
- closedir($dir);
- return $result;
-}
-
+
+ function generateConfig($CONFIG) {
+
+ $result = '<?php'."\n";
+ foreach ($CONFIG as $k => $v) {
+ if (is_array($v)) {
+ foreach ($v as $sk => $sv) {
+ $result .= '$CONFIG[\''.$k.'\'][\''.$sk.'\'] = \''.str_replace('\'','\\\'',$sv).'\';'."\n";
+ }
+ $result .= "\n\n";
+ } else {
+ $result .= '$CONFIG[\''.$k.'\'] = \''.str_replace('\'','\\\'',$v).'\';'."\n\n";
+ }
+ }
+ $result .='?>';
+ return $result;
+ }
+
function options() {
$loglevels = array ( 'Disabled', 'Errors', 'Security', 'Warnings', 'Statistics', 'Info');
$tr = $this->listModules(app()->config['INSTALL_ROOT'].'/lib/modules/tr');
@@ -686,11 +703,55 @@
}
}
}
+ $config = array();
+ if (count($_POST)>0) {
+ $config['translator']=$_POST['translator'];
+ $config['defaultlang']=$_POST['defaultlang'];
+ $config['auth']=$_POST['auth'];
+ $config['site']['title']=$_POST['sitetitle'];
+ $config['site']['footer']=str_replace('\"','"',$_POST['sitefooter']);
+ $config['site']['webmaster']=$_POST['webmaster'];
+ $config['site']['email']=$_POST['email'];
+ $config['registration']['email_confirm']=isset($_POST['confirmregistration'])?'yes':'no';
+ $config['template']=$_POST['template'];
+ $config['multiupload']=$_POST['multiupload'];
+ $config['max_upload_size']=$_POST['max_upload_size'];
+ $config['progress']=$_POST['progress'];
+ $config['logging']['enabled']=isset($_POST['logging'])?'yes':'no';
+ $config['logging']['db_level']=$_POST['log_db_level'];
+ $config['logging']['syslog_level']=$_POST['log_syslog_level'];
+ }
if (isset($_POST['save'])) {
+ /* save the configuration file */
+ $config = array_merge(app()->config,$config);
+ //unset($config['plugins']);
+ unset($config['modules']);
+ $cfgfile = $this->generateConfig($config);
+ $file = 'config.inc.php';
+ if (defined('__NOT_MAIN_SCRIPT')) {
+ $file = 'www/'.$file;
+ }
+ if (@file_put_contents($file,$cfgfile)) {
+ app()->message('Configuration sucessfully saved!');
+ } else {
+ app()->error(tr('Configuration file could not be saved, please proceed with the download!'));
+ }
} else if (isset($_POST['download'])) {
+ /* send the configuration file */
+ $config = array_merge(app()->config,$config);
+ //unset($config['plugins']);
+ unset($config['modules']);
+ $cfgfile = $this->generateConfig($config);
+ ob_clean();
+ header('Content-Type: text/plain');
+ header('Content-Length: '.strlen($result));
+ header('Content-Disposition: attachment; filename="config.inc.php"');
+ echo $cfgfile;
+ exit;
} else {
- $this->tpl->assign('config',app()->config);
+ $config = array_merge(app()->config,$config);
}
+ $this->tpl->assign('config',$config);
$this->tpl->assign('auth',$auth);
$this->tpl->assign('tr',$tr);
Modified: trunk/templates/default/modules/admin/options.tpl
===================================================================
--- trunk/templates/default/modules/admin/options.tpl 2008-12-09 17:16:31 UTC (rev 175)
+++ trunk/templates/default/modules/admin/options.tpl 2008-12-09 18:11:44 UTC (rev 176)
@@ -55,6 +55,6 @@
<option value="{$t}" {if $t==$config.logging.syslog_level}selected{/if}>{$x}</option>
{/foreach}
</select></td></tr>
-<TR><TD colspan="2"><input type="submit" name="save" value="Save Changes"> <input type="submit" name="downad" value="Download config file"></TD></TR>
+<TR><TD colspan="2"><input type="submit" name="save" value="Save Changes"> <input type="submit" name="download" value="Download config file"></TD></TR>
</table>
</form>
Modified: trunk/www/setup.inc.php
===================================================================
--- trunk/www/setup.inc.php 2008-12-09 17:16:31 UTC (rev 175)
+++ trunk/www/setup.inc.php 2008-12-09 18:11:44 UTC (rev 176)
@@ -743,7 +743,7 @@
$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['site']['footer']='<a href="http://openupload.sf.net">Open Upload</a> - Created by Alessandro Briosi © 2008';
$CONFIG['site']['template'] = 'default';
$CONFIG['registration']['email_confirm']='yes';
$CONFIG['max_upload_size']=100;
@@ -1570,6 +1570,6 @@
</div>
<br> <br>
<!-- footer -->
-<div id="footer"><a href="http://openupload.sf.net">Open Upload</a> - Created by Alessandro Briosi © 2008</div>
+<div id="footer"><a href="http://openupload.sf.net">Open Upload</a> - Created by Alessandro Briosi © 2008</div>
</body>
</html>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|