| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 //Custom MOStlyCE code 3 require('../../../../../../configuration.php'); 4 require ($mosConfig_absolute_path.'mambots/editors/mostlyce/jscripts/tiny_mce/auth_check.php'); 5 $result = externalCallCheck($mosConfig_absolute_path, $mosConfig_secret); 6 if (!$result) { 7 die('Direct Access to this location is not allowed.'); 8 } 9 require ($mosConfig_absolute_path.'/mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php'); 10 //If the Image Manager is not enabled stop them here 11 if ($editor_plugin_img_mgr!=='true') { 12 die('Direct Access to this location is not allowed.'); 13 } 14 //End custom MOStlyCE code 15 ?> 16 <?php 17 /** 18 * Show a list of images in a long horizontal table. 19 * @author $Author$ 20 * @version $Id$ 21 * @package ImageManager 22 */ 23 24 require_once ('config.inc.php'); 25 require_once ('Classes/ImageManager.php'); 26 27 //default path is / 28 $relative = '/'; 29 $manager = new ImageManager($IMConfig); 30 31 //process any file uploads 32 $manager->processUploads(); 33 34 $manager->deleteFiles(); 35 36 $refreshDir = false; 37 //process any directory functions 38 if($manager->deleteDirs() || $manager->processNewDir()) 39 $refreshDir = true; 40 41 //check for any sub-directory request 42 //check that the requested sub-directory exists 43 //and valid 44 if(isset($_REQUEST['dir'])) 45 { 46 $path = rawurldecode($_REQUEST['dir']); 47 if($manager->validRelativePath($path)) 48 $relative = $path; 49 } 50 51 52 $manager = new ImageManager($IMConfig); 53 54 55 //get the list of files and directories 56 $list = $manager->getFiles($relative); 57 58 59 /* ================= OUTPUT/DRAW FUNCTIONS ======================= */ 60 61 /** 62 * Draw the files in an table. 63 */ 64 function drawFiles($list, &$manager) 65 { 66 global $relative; 67 68 foreach($list as $entry => $file) 69 { ?> 70 <td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block"> 71 <a href="javascript:;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php echo $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a> 72 </td></tr><tr><td class="edit"> 73 <a href="images.php?dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a> 74 <?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?> 75 </td></tr></table></td> 76 <?php 77 }//foreach 78 }//function drawFiles 79 80 81 /** 82 * Draw the directory. 83 */ 84 function drawDirs($list, &$manager) 85 { 86 global $relative; 87 88 foreach($list as $path => $dir) 89 { ?> 90 <td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block"> 91 <a href="images.php?dir=<?php echo rawurlencode($path); ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"><img src="img/folder.gif" height="80" width="80" alt="<?php echo $dir['entry']; ?>" /></a> 92 </td></tr><tr> 93 <td class="edit"> 94 <a href="images.php?dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a> 95 <?php echo $dir['entry']; ?> 96 </td> 97 </tr></table></td> 98 <?php 99 } //foreach 100 }//function drawDirs 101 102 103 /** 104 * No directories and no files. 105 */ 106 function drawNoResults() 107 { 108 ?> 109 <table width="100%"> 110 <tr> 111 <td class="noResult">No Images Found</td> 112 </tr> 113 </table> 114 <?php 115 } 116 117 /** 118 * No directories and no files. 119 */ 120 function drawErrorBase(&$manager) 121 { 122 ?> 123 <table width="100%"> 124 <tr> 125 <td class="error">Invalid base directory: <?php echo $manager->config['base_dir']; ?></td> 126 </tr> 127 </table> 128 <?php 129 } 130 131 ?> 132 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 133 134 <html> 135 <head> 136 <title>Image List</title> 137 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 138 <link href="assets/imagelist.css" rel="stylesheet" type="text/css" /> 139 <script type="text/javascript" src="assets/dialog.js"></script> 140 <script type="text/javascript"> 141 /*<![CDATA[*/ 142 143 if(window.top) 144 I18N = window.top.I18N; 145 146 function hideMessage() 147 { 148 var topDoc = window.top.document; 149 var messages = topDoc.getElementById('messages'); 150 if(messages) 151 messages.style.display = "none"; 152 } 153 154 init = function() 155 { 156 hideMessage(); 157 var topDoc = window.top.document; 158 159 <?php 160 //we need to refesh the drop directory list 161 //save the current dir, delete all select options 162 //add the new list, re-select the saved dir. 163 if($refreshDir) 164 { 165 $dirs = $manager->getDirs(); 166 ?> 167 var selection = topDoc.getElementById('dirPath'); 168 var currentDir = selection.options[selection.selectedIndex].text; 169 170 while(selection.length > 0) 171 { selection.remove(0); } 172 173 selection.options[selection.length] = new Option("/","<?php echo rawurlencode('/'); ?>"); 174 <?php foreach($dirs as $relative=>$fullpath) { ?> 175 selection.options[selection.length] = new Option("<?php echo $relative; ?>","<?php echo rawurlencode($relative); ?>"); 176 <?php } ?> 177 178 for(var i = 0; i < selection.length; i++) 179 { 180 var thisDir = selection.options[i].text; 181 if(thisDir == currentDir) 182 { 183 selection.selectedIndex = i; 184 break; 185 } 186 } 187 <?php } ?> 188 } 189 190 function editImage(image) 191 { 192 var url = "editor.php?img="+image; 193 Dialog(url, function(param) 194 { 195 if (!param) // user must have pressed Cancel 196 return false; 197 else 198 { 199 return true; 200 } 201 }, null); 202 } 203 204 /*]]>*/ 205 </script> 206 <script type="text/javascript" src="assets/images.js"></script> 207 </head> 208 209 <body> 210 <?php if ($manager->isValidBase() == false) { drawErrorBase($manager); } 211 elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?> 212 <table> 213 <tr valign="top"> 214 <?php drawDirs($list[0], $manager); ?> 215 <?php drawFiles($list[1], $manager); ?> 216 </tr> 217 </table> 218 <?php } else { drawNoResults(); } ?> 219 </body> 220 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed May 23 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |