|
Cookbook /
WebAdminSummary: PHP file manager, works without ftp client
Version: 1.1, 9 November 2006
Prerequisites:
Status:
Maintainer:
Category: Administration CMS
Question(s)
AnswerYou can use webadmin.phpΔ. webadmin is a complete file manager written in PHP with which you can manage your files on the server without needing a FTP client. You can edit/rename/move/delete/upload files and directories according to the permissions settings of the server - which with a standard PmWiki installation, will mean that you can view all files, and perform operations on the files in the wiki.d and uploads directories. Since it is a PHP script it will be able to manage files created by other PHP scripts (including PmWiki) which may not be accessible with FTP (and viceversa). Notes
Installation:On a wiki that is not using cleanURLs:Download the script from above and place it in your cookbook directory. Then add include_once("$FarmD/cookbook/webadmin.php"); in your local configuration (local/config.php).
On a wiki using cleanURLsDownload the script from above and place it in your cookbook directory.
You will need to disable cleanURLs on one page of the wiki -- usually one requiring an admin-level password to read -- and place a link on that page that will trigger an ?action=webadmin, so use something like [[{$Name}?action=webadmin | Web Admin]].
Option 1: To disable cleanURLs for the chosen page, and install the WebAdmin recipe, place the following in your local configuration (local/config.php):
// WebAdmin - http://www.pmwiki.org/wiki/Cookbook/WebAdmin
// On the second line of code below, replace "Groupname" and "Pagename" with
// the group and page you've chosen to use for your Web Admin form
$pagename = ResolvePageName($pagename);
if ($pagename == 'Groupname.Pagename') {
$EnablePathInfo = 0;
$WebAdminHomeDir="$FarmD/cookbook/";
include_once("$FarmD/cookbook/webadmin.php");
}
Option 2: To disable cleanURLs for the chosen page, create a local php file corresponding to that page, using the file to disable cleanURLs for the page. So if the page you've chosen for the ?action=webadmin link, described above, is -- say -- Site.WebAdmin, then create a text-file local/Site.WebAdmin.php, containing only:
<?php
$EnablePathInfo = 0;
(Option 2, continued) In your local configuration (local/config.php), place
include_once("$FarmD/cookbook/webadmin.php");
Configuration:You may give a value to the following variables before including the script to configure some aspects of the webadmin:
$WebAdminAction can be used to change the action used by the script (default is 'webadmin').ex. $WebAdminAction = 'webadmin';
$WebAdminAuthLevel can be used to change the authorization level necessary to use the script (default is 'admin'). Please note that who uses the script can be able to add/edit/delete files and directories on the server (according to file permissions).ex. $WebAdminAuthLevel = 'edit';
$WebAdminHomeDir can be used to configure the home directory to which the script is positioned at the beginning (default is './', which is the same directory where is pmwiki.php).ex. $WebAdminHomeDir = './pub/';
$WebAdminLanguage can be used to configure the language in which the script displays its interface.Available languages: 'en' (English), 'de' (German), 'fr' (French), 'it' (Italian), 'nl' (Dutch), 'se' (Swedish), 'sp' (Spanish), 'dk' (Danish), 'tr' (Turkish), 'cs' (Czech), 'ru' (Russian).Default is 'auto': language is selected automatically by checking the accepted languages of the browser.ex. $WebAdminLanguage = 'it';
Use:Just add ?action=webadmin to the URL to use the file manager.
i18n:The script retains its original internationalization system which is different from PmWiki's one. See the configuration section for more information.
Screenshot:![]()
Releases
Comments - in date order2012-08-15 - It would be nice if the starting path could be passed in. That way I could provide links to start in /uploads/GroupName/. May 21, 2007 - Using Nov 9, 2006 - ~Lenard Works fine now thank you Mateusz June 19, 2006 - Comment from Michi June 1, 2006 - Comment from Lenard I've had the same problem, but I found the reason and changed the script a tiny bit to fix it. The new version is webadmin-1.1.phpΔ ~Mateusz April 25, 2006 - Comment from DirkBlaas April 7, 2006 - Comment from IanMacGregor Warning: array_key_exists() [function.array-key-exists]: The second argument should Warning: array_key_exists() [function.array-key-exists]: The second argument should Warning: Cannot modify header information - headers already sent by (output started at\\ /var/www/pmwiki/cookbook/webadmin.php:1306) in /var/www/pmwiki/pmwiki.php on line 857 And when I use $WebAdminHomeDir = './'; in config.php, I get a blank page. Anyone know how to fix this? June 20, 2008 Comment from JeffMuday I would like to modify the script to "jail" some of the users into the 'uploads' or 'pub' subdirectory rather than allowing them to climb into other parts of the PMwiki site. April 9, 2006 - Comment from IanMacGregor
UPDATE: From IanMacGregor on August 21, 2006 I am now using pmwiki-2.1.14 with PHP5 and this cookbook recipe now works great.
Some functions of webadmin 1.0 (03.01.2006) didn't work for me (i had problem with delete and copy action). I fixed the request_dump() function like this: function request_dump () {
$str = "";
foreach ($_REQUEST as $key => $value) {
$str .= "\t<input type=\"hidden\" name=\"" . html($key) . '" value="' . html($value) . "\" />\n";
}
return $str;
}
I use CleanUrls and I was still able to get WebAdmin to work fine so far. I just disabled the clean Urls in the Page from which I call WebAdmin using a local configuration file. Let's say I have a special Admin menu page called Site.Admin with Admin level password protection. I create a local configuration file in the local directory named Site.Admin.php and inside that file I put the following directive: UPDATE - June 14, 2008: I use Apache rewrite directives and I can say that this recipe does not work with pmwiki-2.2.0-beta65. --Ian MacGregor Feb 1, 2007 - Am I just missing something in my configuration? I can get the listing to display, but every link comes back with "The requested URL /php.cgi was not found on this server." I have noticed that all my URLs come back (..\pmwiki.php?n=Main.HomePage?) as opposed to what the script seems to be generating as a link (..\php.cgi?n=Main.HomePage?). How can I fix this? erisraven ![]() 2009-05-27 IIS & PmWiki 2.2.1
has anyone got this running on 2.2.1? I see the following problems (not using clean URLs, no configuration changes made)
Can anyone help July 20, 2010 - webadmin-1.1.php uses several deprecated functions, specifically
From: $src = ereg_replace('<font color="([^"]*)">', '<span style="color: \1">', ob_get_contents());
To: $src = preg_replace('/<font color="([^"]*)">/', '<span style="color: \1">', ob_get_contents());
From: return ereg('\.php$|\.php3$|\.php4$|\.php5$', $filename);
To: return preg_match('/\.php$|\.php3$|\.php4$|\.php5$/', $filename);
From: if (eregi($regex, $filename)) return $mime;
To: if (preg_match("/$regex/i", $filename)) return $mime;
From: while (ereg($regex, $path)) {
$path = ereg_replace($regex, $delim, $path);
}
To: while (preg_match ("/$regex/", $path)) {
$path = preg_replace("/$regex/", $delim, $path);
}
Should the maintainer update the code? See Also
Contributors
User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |