if (count($entryCache)) { Array_XML::makeListIfNotList($entryCache['file']); foreach ($entryCache['file'] as $cacheIndex => $cacheIm) { $origSrc = '_orig_' . $cacheIm['@attributes']['src']; if (file_exists($mFolder . $origSrc)) { if (@unlink($mFolder . $cacheIm['@attributes']['src'])) { @rename($mFolder . $origSrc, $mFolder . $cacheIm['@attributes']['src']); } } } } } } // set version $blog['@attributes']['version'] = $options['version']; } // update some old settings ... $g = $berta->settings->get('settings', 'google-analytics-id'); if ($g) { $berta->settings->delete('settings', 'google-analytics-id'); $berta->settings->update('settings', 'googleAnalyticsId', $g); $berta->settings->save(); } // ------------------------------- ... // clean-up and files organisation ... BertaEditor::populateTags($sName, $blog); BertaEditor::updateImageCacheFor($blog); BertaEditor::saveBlog($sName, $blog); } } }
} if($hasEntries && !$entryPut) $newEntriesList[] = $e; $blog['entry'] = $newEntriesList; // var_dump($blog['entry']); } } else { // all other properties go straight forward into the xml if(empty($e['content'])) $e['content'] = array(); $e['content'][$decoded['property']] = trim($returnReal) ? array('value' => $returnReal) : NULL; $allowFormatModifier = true; } $e['updated'] = array('value' => date('d.m.Y H:i:s')); BertaEditor::saveBlog($decoded['section'], $blog); if($decoded['property'] == 'tags') BertaEditor::populateTags($decoded['section'], $blog); } else if($decoded['action'] == 'CREATE_NEW_ENTRY') { // create new entry on the spot $returnUpdate['entrynum'] = count($blog['entry']) + (isset($blog['@attributes']) ? -1 : 0); } else if($decoded['action'] == 'ORDER_ENTRIES') { // apply the new order //print_r($blog['entry']); $blog = BertaEditor::loadBlog($decoded['section']); $newEntriesList = array(); foreach($decoded['value'] as $oIdx => $oId) { $newEntriesList[$oIdx] = BertaEditor::getEntry($oId, $blog); } //print_r($blog['entry']); if(!empty($blog['entry']['@attributes'])) $newEntriesList['@attributes'] = $blog['entry']['@attributes'];
$value = $p['default']; } $returnUpdate .= BertaEditor::getSettingsItemEditHTML($pName, $p, $value, array('xSection' => $sName, 'xSectionField')); } } $returnUpdate .= '</div>'; $returnUpdate .= '<div class="csPub"><span class="' . $xEditSelectorYesNo . ' xProperty-published xSection-' . $sName . '">' . $published . '</span></div>'; $returnUpdate .= '<div class="csClone"><a href="#" class="xSectionClone">clone</a></div>'; $returnUpdate .= '<div class="csDelete"><a href="#" class="xSectionDelete">delete</a></div>'; $returnReal = $sName; if (!$isClone) { $sectionsList[$sName] = array('@attributes' => array('tags_behavior' => 'invisible', 'published' => 1), 'name' => $sName, 'title' => array('value' => '')); } BertaEditor::saveSections($sectionsList); if ($isClone) { BertaEditor::populateTags($sName, $cloneContent); } } } else { if ($decoded['action'] == 'DELETE_SECTION') { // delete a section if (!BertaEditor::deleteSection($decoded['value'])) { $returnError = 'Section cannot be deleted! Check permissions.'; } } else { $returnUpdate = $returnReal = trim($decoded['value']); $sName = trim($decoded['section']); if (strtolower($sName) != 'title' && strtolower($sName) != 'name') { $sectionsList = BertaEditor::getSections(); foreach ($sectionsList as $sN => $s) { if ((string) $sN === $sName) {
$sectionsListNew[$sNewName] = $s; } else { $sectionsListNew[$sN] = $s; } } // save... BertaEditor::saveSections($sectionsListNew); // update subsections and tags caches... $newBlog = BertaEditor::loadBlog($sNewName); $ssArr = BertaEditor::getTags(); if (isset($ssArr[$sName])) { $ssArr[$sNewName] = $ssArr[$sName]; unset($ssArr[$sName]); } BertaEditor::saveTags($ssArr); BertaEditor::populateTags($sNewName, $newBlog); } } } else { if ($property == 'type') { // section external link $sectionsList = BertaEditor::getSections(); $returnUpdate = $returnReal = trim($decoded['value']); $sName = $decoded['section']; foreach ($sectionsList as $sN => $s) { if ($sN == $sName) { $sectionsList[$sN]['@attributes']['type'] = $returnUpdate; if (!empty($berta->template->sectionTypes)) { foreach ($berta->template->sectionTypes as $sT => $sTParams) { if ($returnUpdate == $sT) { if (!empty($sTParams['params'])) {