unset($cloneSection['positionXY']); $sectionsList[$sName] = $cloneSection; $cloneContent = BertaContent::loadBlog($decoded['cloneSection']); if ($cloneContent) { $cloneSectionName = isset($cloneContent['@attributes']['section']) ? $cloneContent['@attributes']['section'] : $sName; $cloneContent['@attributes']['section'] = $sName; if (isset($cloneContent['entry'])) { foreach ($cloneContent['entry'] as $k => $entry) { $cloneContent['entry'][$k]['uniqid'] = uniqid(); $cloneContent['entry'][$k]['date'] = date('d.m.Y H:i:s'); $cloneContent['entry'][$k]['updated'] = date('d.m.Y H:i:s'); if (isset($entry['mediafolder'])) { $cloneMediafolder = $entry['mediafolder']['value']; $cloneContent['entry'][$k]['mediafolder'] = str_replace($cloneSectionName, $sName, $cloneMediafolder); //clone media folder BertaUtils::copyFolder(realpath($options['MEDIA_ROOT']) . '/' . $cloneMediafolder, realpath($options['MEDIA_ROOT']) . '/' . $cloneContent['entry'][$k]['mediafolder']); } } } BertaEditor::saveBlog($sName, $cloneContent); } } $possibleTypes = 'default|Default'; $typeParams = array(); if (!empty($berta->template->sectionTypes)) { $possibleTypes = array(); foreach ($berta->template->sectionTypes as $sT => $sTParams) { $possibleTypes[] = "{$sT}|{$sTParams['title']}"; if (!empty($sTParams['params'])) { $typeParams[$sT] = $sTParams['params']; }
} $sTitle = 'untitled' . uniqid(); $sName = strtolower(BertaUtils::canonizeString($sTitle, '-', '-')); $dir = $options['XML_SITES_ROOT'] . $sName; @mkdir($dir, 0777); @chmod($dir, 0777); //clone contents $cloneFromSite = $decoded['site']; if ($cloneFromSite >= 0) { if ($cloneFromSite === 0) { //root site $src = $options['XML_MAIN_ROOT']; } else { $src = $options['XML_SITES_ROOT'] . $cloneFromSite; } BertaUtils::copyFolder($src, $dir); } //end clone contents $returnUpdate = ''; $returnUpdate .= '<div class="csHandle"><span class="handle"></span></div>'; $returnUpdate .= '<div class="csTitle"><span class="' . $xEditSelectorSimple . ' xProperty-title xNoHTMLEntities xSite-' . $sName . '">' . BertaEditor::getXEmpty('title') . '</span></div>'; $returnUpdate .= '<div class="csName">' . $options['SITE_HOST_ADDRESS'] . $options['SITE_ABS_ROOT'] . '<span class="' . $xEditSelectorSimple . ' xProperty-name xNoHTMLEntities xSite-' . $sName . '">' . $sName . '</span></div>'; $returnUpdate .= '<div class="csPub"><span class="' . $xEditSelectorYesNo . ' xProperty-published xSite-' . $sName . '">0</span></div>'; $returnUpdate .= '<div class="csClone"><a href="#" class="xSiteClone">clone</a></div>'; $returnUpdate .= '<div class="csDelete"><a href="#" class="xSiteDelete">delete</a></div>'; $returnReal = $sName; $sitesList = BertaEditor::getSites(); $sitesList[$sName] = array('@attributes' => array('published' => 0), 'name' => $sName, 'title' => array('value' => '')); BertaEditor::saveSites($sitesList); } else { if ($decoded['action'] == 'DELETE_SITE') {