Example #1
1
 /**
  * 
  * @return string
  */
 public static function fileTree()
 {
     $root = JchPlatformPaths::rootPath();
     $dir = urldecode(JchPlatformUtility::get('dir', '', 'string', 'post'));
     $dir = JchPlatformUtility::decrypt($dir);
     $response = '';
     if (file_exists($root . $dir)) {
         $files = scandir($root . $dir);
         natcasesort($files);
         if (count($files) > 2) {
             /* The 2 accounts for . and .. */
             $response .= '<ul class="jqueryFileTree" style="display: none; ">';
             // All dirs
             foreach ($files as $file) {
                 if (file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file)) {
                     $response .= '<li class="directory collapsed"><a href="#" rel="' . JchPlatformUtility::encrypt($dir . $file . '/') . '">' . htmlentities($file) . '</a></li>';
                 }
             }
             // All files
             foreach ($files as $file) {
                 if (file_exists($root . $dir . $file) && $file != '.' && $file != '..' && !is_dir($root . $dir . $file)) {
                     $ext = preg_replace('/^.*\\./', '', $file);
                     $response .= '<li class="file ext_' . $ext . '"><a href="#" rel="' . JchPlatformUtility::encrypt($dir . $file) . '">' . htmlentities($file) . '</a></li>';
                 }
             }
             $response .= '</ul>';
         }
     }
     return $response;
 }
 /**
  * 
  * @param type $image
  * @return type
  */
 public static function prepareImageUrl($image)
 {
     return array('path' => JchPlatformUtility::encrypt($image));
 }
Example #3
0
 private static function item($file, $dir, $view, $path)
 {
     $encrypt_dir = JchPlatformUtility::encrypt($dir . $file);
     $encrypt_file = JchPlatformUtility::encrypt(rtrim(JchPlatformPaths::rootPath(), '/\\') . $dir . $file);
     $anchor = '<a href="#" rel="' . $encrypt_dir . '">' . htmlentities($file) . '</a>';
     $html = '';
     if ($view == 'tree') {
         $html .= $anchor;
     } else {
         if ($path == 'dir') {
             $html .= '<span><input type="checkbox" value="' . $encrypt_dir . '"></span>';
             $html .= $anchor;
         } else {
             $html .= '<span><input type="checkbox" value="' . $encrypt_file . '"></span>';
             $html .= '<span>' . htmlentities($file) . '</span>' . '<span><input type="text" pattern="[0-9]*" size="10" maxlength="5" name="width" ></span>' . '<span><input type="text" pattern="[0-9]*" size="10" maxlength="5" name="height" ></span>';
         }
     }
     return $html;
 }