public static function deleteSection($sectionName) { // delete all media $dirsDeleted = true; $blog = BertaEditor::loadBlog($sectionName); if(!empty($blog['entry'])) foreach($blog['entry'] as $e) { if(!empty($e['mediafolder']['value'])) { $mediaFolder = self::$options['MEDIA_ROOT'] . $e['mediafolder']['value']; if(file_exists($mediaFolder)) { $dir = opendir($mediaFolder); while($fItem = readdir($dir)) { if($fItem != '.' && $fItem != '..') { @unlink($mediaFolder . '/' . $fItem); } } $dirsDeleted &= @rmdir($mediaFolder); } } } // delete content if($dirsDeleted) { $xmlPath = realpath(self::$options['XML_ROOT'] . str_replace('%', $sectionName, self::$options['blog.%.xml'])); if(!$xmlPath || @unlink($xmlPath)) { $oldSectionsList = BertaEditor::getSections(); if(isset($oldSectionsList[$sectionName])) unset($oldSectionsList[$sectionName]); BertaEditor::saveSections($oldSectionsList); return true; } else return false; } else return false; }
if($decoded['section'] && $decoded['entry']) { $blog = BertaContent::loadBlog($decoded['section']); $entry = BertaContent::getEntry($decoded['entry'], $blog); echo BertaGallery::getHTMLForEntry($entry, true); } break; case 'galleryEditor': if($decoded['section'] && $decoded['entry']) { $blog = BertaEditor::loadBlog($decoded['section']); $entry = BertaEditor::getEntry($decoded['entry'], $blog); if($entry) { $galType = !empty($entry['mediaCacheData']['@attributes']['type']) ? $entry['mediaCacheData']['@attributes']['type'] : 'slideshow'; $imageSize = !empty($entry['mediaCacheData']['@attributes']['size']) ? $entry['mediaCacheData']['@attributes']['size'] : 'large'; $FullScreen=!empty($entry['mediaCacheData']['@attributes']['fullscreen']) ? $entry['mediaCacheData']['@attributes']['fullscreen'] : $berta->settings->get('entryLayout', 'galleryFullScreenDefault'); echo '<div class="xEntryGalleryEditor-wrap"><div class="xEntryGalleryEditor xPanel">'; //echo '; echo '<div class="xEntryGalleryToolbar xGreyBack">'; echo '<div class="xEntryAddImagesFallback">' . '<iframe name="xEntryUploadFrame' . $entry['id']['value'] . '" id="xEntryUploadFrame' . $entry['id']['value'] . '" class="xEntryUploadFrame"></iframe>' . '<form target="xEntryUploadFrame' . $entry['id']['value'] . '" action="' . $ENGINE_ABS_ROOT . 'upload.php?section=' . $decoded['section'] . '&entry=' . $entry['id']['value'] . '&mediafolder=' . $entry['mediafolder']['value'] . '&session_id=' . session_id() . '" class="xEntryGalleryForm" method="post" enctype="multipart/form-data">' . '<input type="hidden" name="upload_key" value="" />' .
<?php 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) {
@chmod($fNewName, 0666); // update title... $sectionsListNew = array(); foreach ($sectionsList as $sN => $s) { if ((string) $sN === $sName) { $s['title']['value'] = $sNewTitle; $s['name']['value'] = $sNewName; $sectionsListNew[$sNewName] = $s; } else { $sectionsListNew[$sN] = $s; } } // save sections BertaEditor::saveSections($sectionsListNew); // update subsections and tags caches... $newBlog = BertaEditor::loadBlog($sNewName); //rename mediafolders and attributes if ($newBlog) { $newBlog['@attributes']['section'] = $sNewName; if (isset($newBlog['entry'])) { foreach ($newBlog['entry'] as $k => $entry) { if (isset($entry['mediafolder']['value'])) { if (@rename($options['MEDIA_ROOT'] . '/' . $entry['mediafolder']['value'], $options['MEDIA_ROOT'] . '/' . $sNewName . $entry['id']['value'])) { $newBlog['entry'][$k]['mediafolder'] = $sNewName . $entry['id']['value']; } } } } } BertaEditor::saveBlog($sNewName, $newBlog); $ssArr = BertaEditor::getTags();
$settings->update($settingsProperty[0], $settingsProperty[1] . '_width', $imInfo[0]); $settings->update($settingsProperty[0], $settingsProperty[1] . '_height', $imInfo[1]); $settings->save(); } elseif ($sectionBackground) { $sectionsToEdit = BertaEditor::getSections(); if (empty($sectionsToEdit[$sectionName]['mediafolder'])) { $sectionsToEdit[$sectionName]['mediafolder'] = array(); } if (empty($sectionsToEdit[$sectionName]['mediafolder']['value'])) { $sectionsToEdit[$sectionName]['mediafolder']['value'] = $mediaFolder; } BertaEditor::updateImageCacheForSection($sectionsToEdit[$sectionName]); BertaEditor::saveSections($sectionsToEdit); } else { // update image cache $blog = BertaEditor::loadBlog($sectionName); BertaEditor::updateImageCacheFor($blog, $entryId); BertaEditor::saveBlog($sectionName, $blog); } // write response $result['status'] = 1; $result['hash'] = md5_file($fileFolder . $fName); $result['type'] = $fileType; // image $result['smallthumb_path'] = $smallThumbPath; $result['smallthumb_width'] = $smallThumbInfo[0]; $result['smallthumb_height'] = $smallThumbInfo[1]; $result['path'] = $fileFolder . $fName; $result['path_orig'] = $fileFolder . $fName; //$origVersionPath; $result['filename'] = $fName;