Exemplo n.º 1
0
include_once '_classes/class.bertaeditor.php';
$sections = BertaEditor::getSections();
if (is_array($sections)) {
    foreach ($sections as $sName => $sTitle) {
        $blog = BertaEditor::loadBlog($sName);
        if ($blog) {
            // ------- ...
            // updates ...
            if (empty($blog['@attributes']['version']) && $blog['@attributes']['version'] != $options['version']) {
                $ver = array(0, 5, 0);
                if (!empty($blog['@attributes']['version'])) {
                    $ver = explode('.', $blog['@attributes']['version']);
                }
                // "updated" field for all entries
                if ($ver[1] < 6) {
                    BertaEditor::setUpdateTimesForAll($blog);
                }
                if ($ver[1] = 6 && $ver[2] < 6) {
                    // replace files with their _orig_ versions.
                    BertaEditor::updateImageCacheFor($blog);
                    foreach ($blog['entry'] as $eId => $e) {
                        if ((string) $eId == '@attributes') {
                            continue;
                        }
                        $mFolder = Berta::$options['MEDIA_ROOT'] . $e['mediafolder']['value'] . '/';
                        $entryCache =& $blog['entry'][$eId]['mediaCacheData'];
                        if (count($entryCache)) {
                            Array_XML::makeListIfNotList($entryCache['file']);
                            foreach ($entryCache['file'] as $cacheIndex => $cacheIm) {
                                $origSrc = '_orig_' . $cacheIm['@attributes']['src'];
                                if (file_exists($mFolder . $origSrc)) {