public static function getHTML($imgs, $mediaFolderName, $galleryType, $isAdminMode = false, $bReturnFullInfo = false, $sizeRatio = 1, $galleryFullScreen = false, $imageSize = 'large')
 {
     global $berta;
     $strOut = '';
     $mFolder = self::$options['MEDIA_ROOT'] . $mediaFolderName . '/';
     $mFolderABS = self::$options['MEDIA_ABS_ROOT'] . $mediaFolderName . '/';
     $imageTargetWidth = $berta->template->settings->get('media', 'images' . ucfirst($imageSize) . 'Width', false, true);
     $imageTargetHeight = $berta->template->settings->get('media', 'images' . ucfirst($imageSize) . 'Width', false, true);
     // print output ...
     if ($imgs && count($imgs) > 0) {
         list($firstImageHTML, $firstImageWidth, $firstImageHeight) = BertaGallery::getImageHTML($imgs[0], $mediaFolderName, $isAdminMode, $sizeRatio, $imageTargetWidth, $imageTargetHeight);
         $strOut = '<div class="xGalleryContainer xGalleryHasImages xGalleryType-' . $galleryType . '">';
         $strOut .= "<div class=\"xGallery\" style=\"width: {$firstImageWidth}px; height: {$firstImageHeight}px;\">";
         $strOut .= $firstImageHTML;
         if ($isAdminMode) {
             $strOut .= '<a href="#" class="xGalleryEditButton xEditorLink xSysCaption xMAlign-container"><span class="xMAlign-outer"><span class="xMAlign-inner">edit gallery</span></span></a>';
         }
         $strOut .= '</div>';
         $strOut .= BertaGallery::getNavHTML($imgs, $galleryType, $mFolder, $mFolderABS, $isAdminMode, $sizeRatio, $imageTargetWidth, $imageTargetHeight, $galleryFullScreen);
         $strOut .= '</div>';
     } elseif ($isAdminMode) {
         $strOut = '<div class="xGalleryContainer">';
         //.
         //'<img src="' . $options['MEDIA_ROOT'] . $p['mediafolder']['value'] . '/' . $imgs[0] . '" alt="' . (!empty($p['title']['value']) ? htmlspecialchars($p['title']['value']) : '') . '" />' .
         //'</div>';
         $strOut .= '<div class="imageEmpty">';
         if ($isAdminMode) {
             $strOut .= '<a href="#" class="xGalleryEditButton">' . BertaContent::getXEmpty('gallery') . '</a>';
         }
         $strOut .= '</div>';
         $strOut .= '</div>';
     }
     return $bReturnFullInfo ? array($strOut, $firstImageWidth, $firstImageHeight) : $strOut;
 }
function smarty_function_selectMarkedEntries($params, &$smarty) {
	global $berta;
	$settings = $berta->template->settings;
	
	$count = !empty($params['count']) ? $params['count'] : 1000;
	$order = !empty($params['order']) ? $params['order'] : 'random';
	
	$return = array();

	foreach($berta->sections as $sName => $s) {
		if($sName != $berta->sectionName) {
			$entries = BertaContent::loadBlog($sName);
			if(!empty($entries['entry'])) {
				foreach($entries['entry'] as $idx => $e) {
					if($idx === '@attributes') continue;
				
					if(!empty($e['marked']['value'])) {
						$e['__section'] = $berta->sections[$sName];
						array_push($return, $e);
					}
				}
			}
		}
	}
	
	if($order == 'random') {
		shuffle($return);
	}
	
	if(count($return) > $count) {
		$return = array_slice($return, 0, $count);
	}
	
	$returnFinal = array();
	reset($return);
	while(list($i, $p) = each($return)) {
		if(!empty($p['id']) && !empty($p['id']['value']) 
				&& !empty($p['uniqid']) && !empty($p['uniqid']['value']) 
				&& !empty($p['mediafolder']) && !empty($p['mediafolder']['value'])) {
		
			$returnFinal[$p['uniqid']['value']] = BertaTemplate::entryForTemplate($p, array('section' => $p['__section']));
		}
	}
	
	
	if(!empty($params['assign'])) {
		$berta->template->addVariable($params['assign'], $returnFinal);
	} else {
		return $returnFinal;
	}
}
Beispiel #3
0
 public function initContent($full_url, $sectionName, $tagName)
 {
     $this->requestURI = $this->apacheRewriteUsed ? $full_url : false;
     // seciton ...
     $this->sections = BertaContent::getSections();
     if (!$sectionName || empty($this->sections[$sectionName])) {
         if ($this->environment == 'engine') {
             list($sectionName, ) = each($this->sections);
         } else {
             foreach ($this->sections as $sName => $s) {
                 if (!empty($s['@attributes']['published'])) {
                     $sectionName = $sName;
                     break;
                 }
             }
         }
     }
     $this->sectionName = $sectionName;
     // content ...
     $this->content = BertaContent::loadBlog($sectionName);
     $this->allContent = array($this->sectionName => $this->content);
     //var_dump($this->sectionName, $this->sections[$this->sectionName]['get_all_entries_by_section']);
     if (!empty($this->sections[$this->sectionName]['get_all_entries_by_section']) && $this->sections[$this->sectionName]['get_all_entries_by_section']['value'] == 'yes') {
         foreach ($this->sections as $sName => $s) {
             if ($this->sectionName != $sName) {
                 $this->allContent[$sName] = BertaContent::loadBlog($sName);
             }
         }
     }
     //BertaEditor::populateSubSections($this->sectionName, $this->content);
     // subsections ...
     $this->tags = BertaContent::getTags();
     $this->tagName = $tagName;
     if (!isset($this->tags[$this->sectionName][$this->tagName])) {
         $this->tagName = false;
     }
     // in the engine mode one can view all entries for a section, even if the section has subsections
     // but in the front-ends mode, if there are subsections, the first of them is automatically selected.
     if ($this->environment != 'engine' && !empty($this->tags[$this->sectionName]) && empty($this->tagName) && empty($this->sections[$this->sectionName]['@attributes']['has_direct_content']) && $this->settings->get('navigation', 'alwaysSelectTag') == 'yes') {
         $this->tagName = reset(array_keys($this->tags[$this->sectionName]));
     }
     // tags ....
     /*$this->tags = BertaContent::getTags($sectionName);
     		//asort($this->tags);
     		$this->tagName = $tagName;
     		if(!isset($this->tags[$this->tagName])) $this->tagName = false;*/
     // template ...
     $this->template->addContent($this->requestURI, $this->sectionName, $this->sections, $this->tagName, $this->tags, $this->content, $this->allContent);
 }
Beispiel #4
0
$jsonRequest = !empty($_REQUEST['json']) ? stripslashes($_REQUEST['json']) : false;

if($jsonRequest) {
    //var_dump($_REQUEST);
	//echo str_replace(array("\n", "\r"), array('\n', ''), $jsonRequest) . "\n\n";
	$decoded = $result = Zend_Json::decode(str_replace(array("\n", "\r"), array('\n', ''), $jsonRequest));
	//	var_dump($decoded);
	
	switch($decoded['property']) {
		
		case 'gallery':
		
			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);
				
Beispiel #5
0
<?php

define('AUTH_AUTHREQUIRED', true);
define('BERTA_ENVIRONMENT', 'engine');
include 'inc.page.php';
$loggedIn = $berta->security->userLoggedIn;
include_once $ENGINE_ROOT . '_classes/class.bertaeditor.php';
$allSections = BertaContent::getSections();
$topPanelHTML = BertaEditor::getTopPanelHTML('sections');
$int_version = BertaEditor::$options['int_version'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php 
echo $berta->settings->get('texts', 'pageTitle');
?>
 / <?php 
echo I18n::_('Sections');
?>
</title>
<link rel="SHORTCUT ICON" href="favicon.ico"/>
<link rel="stylesheet" href="<?php 
echo $ENGINE_ABS_ROOT;
?>
css/backend.min.css?<?php 
echo $int_version;
?>
" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="<?php 
 } while (file_exists($fName));
 $emptyXML = '<?xml version="1.0" encoding="utf-8"?><blog></blog>';
 if (!@file_put_contents($fName, $emptyXML)) {
     $returnError = 'section cannot be created! the storage file cannot be created. check permissions and be sure the name of the section is not TOO fancy.';
 } else {
     @chmod($fName, 0666);
     $published = 1;
     $sectionsList = BertaEditor::getSections();
     if ($isClone) {
         $cloneSection = $sectionsList[$decoded['cloneSection']];
         $published = $cloneSection['@attributes']['published'];
         $cloneSection['name'] = $sName;
         $cloneSection['title'] = $sTitle;
         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']);
                     }
                 }
 public static function getXEmpty($property)
 {
     return parent::getXEmpty($property);
 }
Beispiel #8
0
$options['tags']['all_value'] = 'a181a603769c1f98ad927e7367c7aa51';
/**
 * System folders
 */
$options['ENGINE_ROOT'] = $ENGINE_ROOT;
$options['SITE_ROOT'] = $SITE_ROOT;
$options['TEMPLATES_ROOT'] = $SITE_ROOT . '_templates/';
$options['TEMPLATES_ABS_ROOT'] = $options['SITE_ABS_ROOT'] . '_templates/';
$options['TEMPLATES_FULL_SERVER_PATH'] = realpath($SITE_ROOT . '_templates') . '/';
/**
 * Writable folders
 */
$options['XML_MAIN_ROOT'] = $SITE_ROOT . 'storage/';
$options['XML_SITES_ROOT'] = $SITE_ROOT . 'storage/-sites/';
$options['MULTISITES'] = BertaContent::getSites(!$INDEX_INCLUDED);
$options['MULTISITE'] = BertaContent::getSite($options);
$options['MEDIA_FOLDER_NAME'] = 'media';
if (!empty($options['MULTISITE'])) {
    $options['XML_ROOT'] = $options['XML_SITES_ROOT'] . $options['MULTISITE'] . '/';
    $options['MEDIA_ROOT'] = $options['XML_ROOT'] . $options['MEDIA_FOLDER_NAME'] . '/';
    $options['MEDIA_TEMP_ROOT'] = $options['MEDIA_ROOT'];
    $options['CACHE_ROOT'] = $options['XML_ROOT'] . 'cache/';
    $options['MEDIA_ABS_ROOT'] = $options['SITE_ABS_ROOT'] . 'storage/-sites/' . $options['MULTISITE'] . '/media/';
    $options['CACHE_ABS_ROOT'] = $options['SITE_ABS_ROOT'] . 'storage/-sites/' . $options['MULTISITE'] . '/cache/';
} else {
    $options['XML_ROOT'] = $SITE_ROOT . 'storage/';
    $options['MEDIA_ROOT'] = $SITE_ROOT . 'storage/' . $options['MEDIA_FOLDER_NAME'] . '/';
    $options['MEDIA_TEMP_ROOT'] = $options['MEDIA_ROOT'];
    $options['CACHE_ROOT'] = $SITE_ROOT . 'storage/cache/';
    $options['MEDIA_ABS_ROOT'] = $options['SITE_ABS_ROOT'] . 'storage/media/';
    $options['CACHE_ABS_ROOT'] = $options['SITE_ABS_ROOT'] . 'storage/cache/';
Beispiel #9
0
 public function getEmpty($property = false)
 {
     return BertaContent::getXEmpty($property);
 }
 public static function getHTML($imgs, $mediaFolderName, $galleryType, $isAdminMode = false, $bReturnFullInfo = false, $sizeRatio = 1, $galleryFullScreen = false, $imageSize = 'large', $galleryAutoPlay = '0', $gallerySlideNumbersVisible = 'yes', $galleryLinkAddress = '', $galleryLinkTarget = '', $rowGalleryPadding = false)
 {
     global $berta;
     $strOut = '';
     $mFolder = self::$options['MEDIA_ROOT'] . $mediaFolderName . '/';
     $mFolderABS = self::$options['MEDIA_ABS_ROOT'] . $mediaFolderName . '/';
     $imageTargetWidth = $berta->template->settings->get('media', 'images' . ucfirst($imageSize) . 'Width', false, true);
     $imageTargetHeight = $berta->template->settings->get('media', 'images' . ucfirst($imageSize) . 'Height', false, true);
     // print output ...
     if ($imgs && count($imgs) > 0) {
         list($firstImageHTML, $firstImageWidth, $firstImageHeight) = BertaGallery::getImageHTML($imgs[0], $mediaFolderName, $isAdminMode, $sizeRatio, $imageTargetWidth, $imageTargetHeight);
         $specificClasses = '';
         switch ($galleryType) {
             case 'link':
                 $specificClasses = ' xGalleryLinkAddress-' . $galleryLinkAddress;
                 $specificClasses .= ' xGalleryLinkTarget-' . $galleryLinkTarget;
                 break;
             case 'slideshow':
                 $specificClasses = ' xGalleryAutoPlay-' . $galleryAutoPlay . ' xSlideNumbersVisible-' . $gallerySlideNumbersVisible;
                 break;
         }
         $strOut = '<div class="xGalleryContainer xGalleryHasImages xGalleryType-' . $galleryType . $specificClasses . '">';
         $strOut .= "<div class=\"xGallery\" style=\"width: {$firstImageWidth}px; height: {$firstImageHeight}px;\"" . ($rowGalleryPadding ? ' xRowGalleryPadding="' . $rowGalleryPadding . '"' : '') . ">";
         $strOut .= $firstImageHTML;
         if ($isAdminMode) {
             $strOut .= '<a href="#" class="xGalleryEditButton xEditorLink xSysCaption xMAlign-container"><span class="xMAlign-outer-gallery"><span class="xMAlign-inner-gallery">edit gallery</span></span></a>';
         }
         $strOut .= '</div>';
         $strOut .= BertaGallery::getNavHTML($imgs, $galleryType, $mFolder, $mFolderABS, $isAdminMode, $sizeRatio, $imageTargetWidth, $imageTargetHeight, $galleryFullScreen);
         if ($galleryType == 'slideshow') {
             $strOut .= '<div class="loader xHidden"></div>';
         }
         $strOut .= '</div>';
     } elseif ($isAdminMode) {
         $strOut = '<div class="xGalleryContainer">';
         //.
         //'<img src="' . $options['MEDIA_ROOT'] . $p['mediafolder']['value'] . '/' . $imgs[0] . '" alt="' . (!empty($p['title']['value']) ? htmlspecialchars($p['title']['value']) : '') . '" />' .
         //'</div>';
         $strOut .= '<div class="imageEmpty">';
         if ($isAdminMode) {
             $strOut .= '<a href="#" class="xGalleryEditButton">' . BertaContent::getXEmpty('gallery') . '</a>';
         }
         $strOut .= '</div>';
         $strOut .= '</div>';
     }
     return $bReturnFullInfo ? array($strOut, $firstImageWidth, $firstImageHeight) : $strOut;
 }
Beispiel #11
0
<?php

define('AUTH_AUTHREQUIRED', true);
define('BERTA_ENVIRONMENT', 'engine');
include 'inc.page.php';
$loggedIn = $berta->security->userLoggedIn;
include_once $ENGINE_ROOT . '_classes/class.bertaeditor.php';
if ($options['MULTISITE_DISABLED']) {
    header("Location: ./");
    exit;
}
$allSites = BertaContent::getSites();
$topPanelHTML = BertaEditor::getTopPanelHTML('multisite');
$int_version = BertaEditor::$options['int_version'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php 
echo $berta->settings->get('texts', 'pageTitle');
?>
 / <?php 
echo I18n::_('Multisite');
?>
</title>
<link rel="SHORTCUT ICON" href="favicon.ico"/>
<link rel="stylesheet" href="<?php 
echo $ENGINE_ABS_ROOT;
?>
css/backend.min.css?<?php