Source for file admin.media.php
Documentation is available at admin.media.php
* @copyright Refer to copyright.php
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @author Mambo Foundation Inc see README.php
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// ensure user has access to this function
if (!($acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' )
|
$acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'com_media' ))) {
mosRedirect( 'index2.php', T_('You are not authorized to view this resource.') );
require_once( $mainframe->getPath( 'admin_html' ) );
//require_once( $mainframe->getPath( 'class' ) );
mosRedirect( "index2.php?option=com_media&listdir=".
$_POST['dirPath'], T_("NO HACKING PLEASE") );
mosRedirect( "index2.php?option=com_media&listdir=".
$_POST['dirPath'], T_("Directory creation not allowed while running in SAFE MODE as this can cause problems.") );
global $mosConfig_absolute_path;
$del_image =
$mosConfig_absolute_path.
"/images/stories".
$listdir.
"/".
$delfile;
global $mosConfig_absolute_path;
if (eregi("[^0-9a-zA-Z_]", $folder_name)) {
mosRedirect( "index2.php?option=com_media&listdir=".
$_POST['dirPath'], T_("Directory name must only contain alphanumeric characters and no spaces please.") );
$folder =
$mosConfig_absolute_path.
"/images/stories".
$dirPath.
"/".
$folder_name;
$fp =
fopen($folder.
"/index.html", "w" );
fwrite( $fp, "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>" );
global $mosConfig_absolute_path;
$del_html =
$mosConfig_absolute_path.
'/images/stories'.
$listdir.
$delFolder.
'/index.html';
$del_folder =
$mosConfig_absolute_path.
'/images/stories'.
$listdir.
$delFolder;
if( $entry !=
"." & $entry !=
".." & strtolower($entry) !=
"index.html" )
echo
'<font color="red">'.
T_('Unable to delete: not empty!').
'</font>';
global $mosConfig_absolute_path;
if(isset
($_FILES['upload']) &&
is_array($_FILES['upload']) && isset
($_POST['dirPath']))
$dirPathPost =
$_POST['dirPath'];
if(substr($dirPathPost,0,1)==
'/')
$IMG_ROOT .=
$dirPathPost;
$IMG_ROOT =
$dirPathPost;
do_upload( $_FILES['upload'], $mosConfig_absolute_path.
'/images/stories/'.
$dirPathPost.
'/');
mosRedirect( "index2.php?option=com_media&listdir=".
$_POST['dirPath'], T_("Upload FAILED. File already exists") );
if ((strcasecmp(substr($file['name'],-
4),".gif")) &&
(strcasecmp(substr($file['name'],-
4),".jpg")) &&
(strcasecmp(substr($file['name'],-
4),".png")) &&
(strcasecmp(substr($file['name'],-
4),".bmp")) &&
(strcasecmp(substr($file['name'],-
4),".doc")) &&
(strcasecmp(substr($file['name'],-
4),".xls")) &&
(strcasecmp(substr($file['name'],-
4),".ppt")) &&
(strcasecmp(substr($file['name'],-
4),".swf")) &&
(strcasecmp(substr($file['name'],-
4),".pdf"))) {
mosRedirect( "index2.php?option=com_media&listdir=".
$_POST['dirPath'], T_("Only files of type gif, png, jpg, bmp, pdf, swf, doc, xls or ppt can be uploaded") );
mosRedirect( "index2.php?option=com_media&listdir=".
$_POST['dirPath'], T_("Upload FAILED") );
mosRedirect( "index2.php?option=com_media&listdir=".
$_POST['dirPath'], T_("Upload complete") );
static $filelist =
array();
static $dirlist =
array();
while (false !==
($dir =
readdir($dh))) {
if (is_dir($base .
"/".
$dir) &&
$dir !==
'.' &&
$dir !==
'..' &&
strtolower($dir) !==
'cvs') {
$subbase =
$base .
"/".
$dir;
$subdirlist =
recursive_listdir($subbase);
* @param string The image directory to display
global $mosConfig_absolute_path, $mosConfig_live_site;
// get list of directories
foreach ($imgFiles as $file) {
// create folder selectlist
$dirPath =
mosHTML::selectList( $folders, 'dirPath', "class=\"inputbox\" size=\"1\" "
.
"onchange=\"goUpDir()\" ",
'value', 'text', $listdir );
* @param string The image directory to display
global $mosConfig_absolute_path, $mosConfig_live_site;
$d =
@dir($mosConfig_absolute_path.
"/images/stories/".
$listdir);
while (false !==
($entry =
$d->read()))
if(is_file($mosConfig_absolute_path.
"/images/stories".
$listdir.
'/'.
$img_file) &&
substr($entry,0,1) !=
'.' &&
strtolower($entry) !==
'index.html')
if (eregi( "bmp|gif|jpg|png", $img_file )) {
$image_info =
@getimagesize($mosConfig_absolute_path.
"/images/stories/".
$listdir.
'/'.
$img_file);
$file_details['file'] =
$mosConfig_absolute_path.
"/images/stories".
$listdir.
"/".
$img_file;
$file_details['img_info'] =
$image_info;
$file_details['size'] =
filesize($mosConfig_absolute_path.
"/images/stories".
$listdir.
"/".
$img_file);
$images[$entry] =
$file_details;
$docs[$entry] =
$img_file;
else if(is_dir($mosConfig_absolute_path.
"/images/stories/".
$listdir.
'/'.
$img_file) &&
substr($entry,0,1) !=
'.' &&
strtolower($entry) !==
'cvs')
$folders[$entry] =
$img_file;
//now sort the folders and images by name.
for($i=
0; $i<
count($folders); $i++
)
$folder_name =
key($folders);
for($i=
0; $i<
count($docs); $i++
)
$iconfile=
$mosConfig_absolute_path.
"/administrator/components/com_media/images/".
substr($doc_name,-
3).
"_16.png";
$icon =
"components/com_media/images/".
(substr($doc_name,-
3)).
"_16.png" ; }
$icon =
"components/com_media/images/con_info.png";
for($i=
0; $i<
count($images); $i++
)
$image_name =
key($images);
HTML_Media::show_image($images[$image_name]['file'], $image_name, $images[$image_name]['img_info'], $images[$image_name]['size'],$listdir);
function rm_all_dir($dir)
//echo "OPEN:".$dir.'<Br>';
while (false !==
($entry =
$d->read()))
//echo "#".$entry.'<br>';
if($entry !=
'.' &&
$entry !=
'..')
Documentation generated on Mon, 05 May 2008 16:15:30 +0400 by phpDocumentor 1.4.0