function readFolder($folderReadID, $auth, $cascade)
{
    $id = array('id' => $folderReadID, 'type' => 'folder');
    $readParams = array('authentication' => $auth, 'identifier' => $id);
    $folderRead = $cascade->read($readParams);
    if ($folderRead->readReturn->success != 'true') {
        echo "looks like it didn't work" . $folderReadID . "\r\n";
    } else {
        echo "folder-" . $folderReadID . "\r\n";
        $folderChildren = $folderRead->readReturn->asset->folder->children->child;
        if (count($folderChildren) == 1) {
            if ($folderChildren->type == 'folder') {
                readFolder($folderChildren->id, $auth, $cascade);
            } elseif ($folderChildren->type == 'page') {
                readPage($folderChildren->id, $auth, $cascade);
            }
        } elseif (count($folderChildren) > 1) {
            foreach ($folderChildren as $value) {
                if ($value->type == 'folder') {
                    readFolder($value->id, $auth, $cascade);
                } elseif ($value->type == 'page') {
                    readPage($value->id, $auth, $cascade);
                }
            }
        }
    }
}
Пример #2
0
function readFolder($folder)
{
    global $vfs, $basepath, $dbh, $update, $host;
    static $level;
    $level++;
    if (substr($folder, -5) == '/.svn') {
        return;
    }
    checkDocLog('readFolder ' . $folder);
    $result = $vfs->listFolder($folder);
    if ($folder == '.') {
        $folder = '';
    }
    foreach ($result as $file) {
        if (is_dir($basepath . $folder . '/' . $file['name'])) {
            if ($folder == '') {
                $newfolder = $file['name'];
            } else {
                $newfolder = $folder . '/' . $file['name'];
            }
            readFolder($newfolder);
            $level--;
        } else {
            if ($level == 2 && preg_match("/\\.xml\$/", $file['name'])) {
                $path = $basepath . $folder . '/' . $file['name'];
                try {
                    list($title, $package) = checkDocumentation($path);
                    $url = '/manual/en/' . $package . '.php';
                    checkDocLog('trying  ' . $host . $url);
                    $request = new HTTP_Request2($host . $url);
                    $response = $request->send();
                    if ($response->getStatus() >= 400) {
                        $new_url = preg_replace("=\\.([^\\.]+)\\.php\$=", ".php", $url);
                        $request->setURL($host . $new_url);
                        checkDocLog('trying2 ' . $host . $new_url);
                        $response = $request->send();
                        $url = $response->getStatus() > 400 ? '' : $new_url;
                    }
                    if ($url) {
                        checkDocLog('Found doc url: ' . $url . ', title: ' . $title);
                        $res = $dbh->execute($update, array($url, $title));
                    } else {
                        checkDocLog('No url for ' . $title);
                    }
                } catch (Exception $e) {
                    print $e->getMessage() . "\n";
                }
            }
        }
    }
}
/**
 * Returns the subfolders of the given folder
 * 
 * @param $dir Path to the folder
 * @param $ignore_dots True if the system-folders "." and ".." should be ignored
 * @return Array Subfolders of the folder
 * @author Markus Staab <*****@*****.**>
 */
function readSubFolders($dir, $ignore_dots = true)
{
    $folder = readFolder($dir);
    $folders = array();
    foreach ($folder as $file) {
        if ($ignore_dots && ($file == '.' || $file == '..')) {
            continue;
        }
        if (is_dir($dir . '/' . $file)) {
            $folders[] = $file;
        }
    }
    return $folders;
}
 function show()
 {
     global $REX;
     $this->address = dirname(dirname($_SERVER['PHP_SELF']));
     $splitURL = split('/redaxo/', $this->address);
     $this->address = $splitURL[0];
     if ($this->address != '/' && $this->address != '\\') {
         $this->address .= '/';
     }
     if ($GLOBALS['TINY2']['script'] != 1) {
         $script = '../files/tmp_/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js';
         $useGzip = file_exists($script);
         if (!$useGzip) {
             $script = '../files/tmp_/tinymce/jscripts/tiny_mce/tiny_mce.js';
         }
         $init = "\n" . '<script language="javascript" type="text/javascript" src="' . $script . '"></script>';
         if ($useGzip) {
             include_once $REX['INCLUDE_PATH'] . '/addons/tinymce/functions/function_rex_folder.inc.php';
             $plugins = readFolder('../files/tmp_/tinymce/jscripts/tiny_mce/plugins');
             unset($plugins[0]);
             // Lösche .
             unset($plugins[1]);
             // Lösche ..
             $init .= "\n" . "<script type=\"text/javascript\">\r\n        \t\t\t\ttinyMCE_GZ.init({\r\n        \t\t\t\t\tplugins : '" . implode(',', $plugins) . "',\r\n        \t\t\t\t\tthemes : 'advanced',\r\n        \t\t\t\t\tlanguages : 'de',\r\n        \t\t\t\t\tdisk_cache : true,\r\n        \t\t\t\t\tdebug : false\r\n        \t\t\t\t});\r\n        \t\t\t\t</script>";
         }
         echo $init;
         $GLOBALS['TINY2']['script'] = "1";
     }
     if ($GLOBALS['TINY2']['boxes'] != 1) {
         $GLOBALS['TINY2']['boxes'] = "1";
     }
     echo "\n" . '<script language="javascript" type="text/javascript">' . "\n";
     echo 'var sDocumentBase = "' . $this->address . '"' . ';' . "\n";
     echo 'tinyMCE.init({' . "\n";
     echo 'document_base_url: sDocumentBase,' . "\n";
     echo 'relative_urls: true,' . "\n";
     echo 'advimage_styles : "' . $this->advimageCSS . '",' . "\n";
     echo 'content_css : "' . $this->editorCSS . '",' . "\n";
     echo 'mode : "exact",' . "\n";
     echo 'elements : "tiny2e' . $this->id . '",' . "\n";
     echo 'theme : "advanced",' . "\n";
     echo 'advimage_image_browser_callback : "fileBrowserCallBack",' . "\n";
     echo 'advlink_file_browser_callback:"linkBrowserCallBack",' . "\n";
     echo 'plugins : "' . $this->plugins . '",' . "\n";
     echo 'theme_advanced_disable : "' . $this->disable . '",' . "\n";
     echo 'theme_advanced_buttons1 : "' . $this->buttons1 . '",' . "\n";
     echo 'theme_advanced_buttons2 : "' . $this->buttons2 . '",' . "\n";
     echo 'theme_advanced_buttons3 : "' . $this->buttons3 . '",' . "\n";
     echo 'theme_advanced_buttons4 : "' . $this->buttons4 . '",' . "\n";
     echo 'theme_advanced_buttons1_add : "' . $this->buttons1_add . '",' . "\n";
     echo 'theme_advanced_buttons2_add : "' . $this->buttons2_add . '",' . "\n";
     echo 'theme_advanced_toolbar_location : "top",' . "\n";
     echo 'theme_advanced_toolbar_align : "left",' . "\n";
     echo 'plugin_insertdate_dateFormat : "%Y-%m-%d",' . "\n";
     echo 'plugin_insertdate_timeFormat : "%H:%M:%S",' . "\n";
     echo 'inline_styles: true,' . "\n";
     echo 'valid_elements : ' . $this->validhtml . ",\n";
     echo 'extended_valid_elements : "' . $this->add_validhtml . '",' . "\n";
     echo 'paste_auto_cleanup_on_paste : true,' . "\n";
     echo 'paste_convert_headers_to_strong : true,' . "\n";
     echo 'convert_fonts_to_spans : true,' . "\n";
     echo 'cleanup_on_startup : true,' . "\n";
     echo 'remove_linebreaks : true,' . "\n";
     echo 'language: "' . $this->lang . '",' . "\n";
     echo 'apply_source_formatting : false,' . "\n";
     echo 'accessibility_warnings : false' . "\n";
     echo '});' . "\n";
     echo 'function fileBrowserCallBack(field_name, url, type, win) {' . "\n";
     echo 'newPoolWindow( sDocumentBase+"redaxo/index.php?page=medienpool&opener_input_field=TINYIMG");' . "\n";
     echo '}' . "\n";
     echo 'function linkBrowserCallBack(href, target){' . "\n";
     echo 'newLinkMapWindow(sDocumentBase+"redaxo/index.php?page=linkmap&opener_input_field=TINY");' . "\n";
     echo '}' . "\n";
     echo '//redaxo default callback functions' . "\n";
     echo 'function insertLink(link,name){' . "\n";
     echo ' var win=tinyMCE.getWindowArg("window");' . "\n";
     echo ' win.document.forms[0].href.value=link;' . "\n";
     echo ' win.document.forms[0].title.value=name;' . "\n";
     echo '}' . "\n";
     echo 'function insertImage(imageUrl,title){' . "\n";
     echo ' var win=tinyMCE.getWindowArg("window");' . "\n";
     echo ' win.document.forms[0].src.value=imageUrl;' . "\n";
     echo ' win.document.forms[0].title.value=title;' . "\n";
     // Hier Fehler behandeln
     // siehe http://trac.symfony-project.com/ticket/2625
     echo ' try {' . "\n";
     echo '   win.resetImageData();' . "\n";
     echo '   win.showPreviewImage(imageUrl, false);' . "\n";
     echo ' } catch (ex) {}' . "\n";
     echo '}' . "\n";
     echo 'function insertFileLink(fileUrl,title){' . "\n";
     echo '  tinyMCE.themes["advanced"]._insertLink(fileUrl,"_self");' . "\n";
     echo '}' . "\n";
     echo 'function insertHtml(htmlCode){' . "\n";
     echo ' tinyMCE.execCommand("mceInsertContent", false, htmlCode);' . "\n";
     echo '}' . "\n";
     echo '</script>';
     echo '<textarea name="VALUE[' . $this->id . ']" class="tiny2" id="tiny2e' . $this->id . '" style="width:100%;" cols="50" rows="15">' . $this->content . '</textarea>';
 }
Пример #5
0
error_reporting(0);
require_once '../phplib/HttpStatusCode.php';
require_once '../config/config.inc.php';
header('Content-Type: application/json; charset=utf-8');
$searchPhrase = filter_input(INPUT_POST, "searchPhrase");
$folder = ".." . DS . MANGAS_FOLDER . DS;
$rows = array();
foreach (new DirectoryIterator($folder) as $dirInfo) {
    if ($dirInfo->isDot()) {
        continue;
    }
    if (!$dirInfo->isDir()) {
        continue;
    }
    $info = json_decode(utf8_encode(file_get_contents($folder . $dirInfo->getFilename() . DS . 'info' . DS . 'info.json')), true);
    $row = array("info" => $info, "folder" => $dirInfo->getFilename(), "creation" => date("j/n/Y", $dirInfo->getMTime()), "folders" => readFolder($dirInfo->getFilename()));
    array_push($rows, $row);
}
usort($rows, "compareByFolderAsc");
$response = array("rows" => $rows, "total" => count($rows));
echo json_encode($response);
function compareByFolderAsc($a, $b)
{
    return strnatcmp($a["folder"], $b["folder"]);
}
function compareByFolderDesc($a, $b)
{
    return -compareByFolderAsc($a, $b);
}
function compareByTitleAsc($a, $b)
{