[evolvis-commits] r11473: added configman↵

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Feb 24 18:11:43 CET 2011


Author: mirabilos
Date: 2011-02-24 18:11:42 +0100 (Thu, 24 Feb 2011)
New Revision: 11473

Added:
   trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/configman.php
Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog
   trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/index.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab
Log:
added configman


Modified: trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog	2011-02-24 17:11:41 UTC (rev 11472)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog	2011-02-24 17:11:42 UTC (rev 11473)
@@ -1,3 +1,6 @@
+2005-12-13 Daniel Perez <daniel at gforgegroup.com>
+	Added configman.php, configuration files manager for admin interface
+
 2005-12-05 Daniel Perez <daniel at gforgegroup.com>
 	Patchs applied :
 	* Fixed bug -> usergroup.php has multiple problems 'deleting' CVS repositories

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/configman.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/configman.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/configman.php	2011-02-24 17:11:42 UTC (rev 11473)
@@ -0,0 +1,136 @@
+<?php
+/**
+ * GForge Config File edit page
+ *
+ * @version 
+ * @author 
+ * @copyright 
+ * Copyright 2005 GForge, LLC
+ * http://gforge.org/
+ *
+ * Daniel A. Pérez danielperez.arg at gmail.com
+ *
+ * This file is part of GForge.
+ *
+ * GForge 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.
+ *
+ * GForge 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 GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+require_once('pre.php');
+require_once('www/admin/admin_utils.php');
+
+site_admin_header(array('title'=>$Language->getText('admin_index','title')));
+
+function printSelection($checked) {
+	global $Language,$feedback;
+	
+	$config_files = array(); // array that´ll have the config files
+	$i = 0;
+					
+	// check if we can get local.inc
+	$handle = fopen('/etc/gforge/local.inc','r+');
+	if ($handle) {
+		$config_files['local.inc'] = '/etc/gforge/local.inc';
+		fclose($handle);
+		$i++;
+	} else {
+		// say we couldn't open local.inc
+		$feedback .= $Language->getText('configman','notopenlocalinc');
+	}
+
+	//get the directories from the plugins dir
+	if (chdir('/etc/gforge/plugins/')) {
+		$handle = opendir('.');
+		$j = 0;
+		while ($filename = readdir($handle)) {
+			//Don't add special directories '..' or '.' to the list
+			if (($filename!='..') && ($filename!='.') && ($filename!="CVS") ) {
+				$handle2 = @opendir($filename); // open the etc dir of the plugin 
+				if ($handle2){
+					while ($filename2 = readdir($handle2)) {
+						if (strstr($filename2,'.conf') || strstr($filename2,'.inc') || ($filename2=='config.php')) {
+							$config_files['(' . $filename . ') - ' . $filename2] = '/etc/gforge/plugins/' . $filename . '/' . $filename2;
+							$i++;						
+						}
+					}
+					fclose($handle2);
+				}
+			}
+		}
+		fclose($handle);
+	} else {
+		// say we couldn't get into etc plugins dir
+		$feedback .= $Language->getText('configman','notopenplugindir');
+	}
+	
+	echo '<br><div align="center">';
+	echo html_build_select_box_from_assoc($config_files,'files',$checked,true);
+	echo '<input type="submit" name="choose" value="' . $Language->getText('configman','choose') .'"/>';
+	echo '</div>';	
+}
+
+
+?>
+
+
+<form name="theform" action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="POST">
+<?php
+
+printSelection(getStringFromRequest('files'));
+
+if (getStringFromRequest('choose')) {
+	
+	$filepath = getStringFromRequest('files');
+	$handle = fopen($filepath,'r+');
+	if ($handle){
+		fclose($handle); // we had to open it in r+ because we need to check we'll be able to save it later
+		$filedata = file_get_contents($filepath);
+		echo '<br><center>' . html_build_rich_textarea('filedata',30,150,$filedata,false) . '</center>';
+		echo '<input type="hidden" name="filepath" value="' . $filepath . '">';
+		echo '<div align="center"><input type="submit" name="doedit" value="' . $Language->getText('configman','doedit') .'"/></div>';
+	} else {
+		// say we couldn't open the file
+		$feedback .= $Language->getText('configman','notopenfile');
+	}
+} elseif (getStringFromRequest('doedit')) {
+	$filedata = getStringFromRequest('filedata');
+	$filedata = str_replace('\"','"',$filedata);
+	$filedata = str_replace("\'","'",$filedata);
+	$filepath = getStringFromRequest('filepath');
+	if ($handle = fopen($filepath,'w')) {
+		if (fwrite($handle,$filedata)) {
+			// say wrote ok
+			$feedback .= $Language->getText('configman','updateok');
+		} else {
+			// say some problem
+			$feedback .= $Language->getText('configman','nowrite');
+		}
+	} else {
+		// say couldn´t open
+		$feedback .= $Language->getText('configman','notopenfile');
+	}
+}
+
+
+?>
+
+</form>
+
+<?php
+
+
+site_admin_footer(array());
+
+?>
\ No newline at end of file

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/index.php	2011-02-24 17:11:41 UTC (rev 11472)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/admin/index.php	2011-02-24 17:11:42 UTC (rev 11473)
@@ -160,6 +160,7 @@
 	<li><a href="/stats/lastlogins.php"><?php echo $Language->getText('admin_index','recent_logins'); ?></a></li>
 	<li><a href="cronman.php"><?php echo $Language->getText('admin_index','cronman'); ?></a></li>
 	<li><a href="pluginman.php"><?php echo $Language->getText('admin_index','pluginman'); ?></a></li>
+	<li><a href="configman.php"><?php echo $Language->getText('admin_index','configman'); ?></a></li>
 	<?php plugin_hook("site_admin_option_hook", false); ?>
 </ul>
 

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab	2011-02-24 17:11:41 UTC (rev 11472)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/include/languages/Base.tab	2011-02-24 17:11:42 UTC (rev 11473)
@@ -311,6 +311,13 @@
 pluginman	successiniterror <br>Couldn't run SQL init script. Perhaps malformed SQL file? please correct and run manually.
 pluginman	userdeleted	$1 Users detached from plugin..<br>
 pluginman	groupdeleted	$1 Groups detached from plugin..<br>
+configman	choose	Choose
+configman	doedit	Save
+configman	notopenlocalinc	Could not open local.inc file for read/write. Check the permissions for apache<br>
+configman	notopenplugindir	Could not open plugins etc dir for reading. Check the permissions for apache<br>
+configman	notopenfile	Could not open the file for read/write. Check the permissions for apache<br>
+configman	updateok	File wrote successfully.<br>
+configman	nowrite	File wasn't written or is empty.<br>
 admin_index	active_projects_count	Active projects: <strong>$1</strong>
 admin_index	active_users_count	Active site users: <strong>$1</strong>
 admin_index	add_delete_edit_file_types	Add, Delete, or Edit File Types
@@ -321,6 +328,7 @@
 admin_index	add_to_trove_map	Add to the Trove Map
 admin_index	approve_reject	Approve/Reject
 admin_index	cronman	Cron Manager
+admin_index	configman	Config Manager
 admin_index	pluginman	Plugin Manager
 admin_index	deleted_status	(deleted) Status
 admin_index	display_full_group	Display Full Group List/Edit Groups



More information about the evolvis-commits mailing list