コード例 #1
0
ファイル: PageTestCase.php プロジェクト: masteramuk/concrete5
 protected static function createPage($name, $parent = false, $type = false, $template = false)
 {
     if ($parent === false) {
         $parent = Page::getByID(HOME_CID);
     } else {
         if (is_string($parent)) {
             $parent = Page::getByPath($parent);
         }
     }
     if ($type === false) {
         $type = 1;
     }
     if (is_string($type)) {
         $pt = PageType::getByHandle($type);
     } else {
         $pt = PageType::getByID($type);
     }
     if ($template === false) {
         $template = 1;
     }
     if (is_string($template)) {
         $template = PageTemplate::getByHandle($template);
     } else {
         $template = PageTemplate::getByID($template);
     }
     $page = $parent->add($pt, array('cName' => $name, 'pTemplateID' => $template->getPageTemplateID()));
     return $page;
 }
コード例 #2
0
ファイル: controller.php プロジェクト: robertdamoc/concrete5
	public function action_post() {
		// happens through ajax
		$pagetype = PageType::getByID($this->ptID);
		if (is_object($pagetype) && $this->enableNewTopics) {
			$ccp = new Permissions($pagetype);
			if ($ccp->canAddPageType()) {
				$pagetypes = $pagetype->getPageTypeComposerPageTypeObjects();
				$ctTopic = $pagetypes[0];
				$c = Page::getCurrentPage();
				$e = $pagetype->validatePublishRequest($ctTopic, $c);
				$r = new PageTypePublishResponse($e);
				if (!$e->has()) {
					$d = $pagetype->createDraft($ctTopic);
					$d->setPageDraftTargetParentPageID($c->getCollectionID());
					$d->saveForm();
					$d->publish();
					$nc = Page::getByID($d->getCollectionID(), 'RECENT');
					$link = Loader::helper('navigation')->getLinkToCollection($nc, true);
					$r->setRedirectURL($link);
				}
				$r->outputJSON();
			}
		}
		exit;
	}
コード例 #3
0
 protected function addPage2()
 {
     $home = Page::getByID(HOME_CID);
     PageType::add(array('handle' => 'alternate', 'name' => 'Alternate'));
     $pt = PageType::getByID(2);
     $template = PageTemplate::getByID(1);
     $page = $home->add($pt, array('uID' => 1, 'cName' => 'Test page', 'pTemplateID' => $template->getPageTemplateID()));
     return $page;
 }
コード例 #4
0
 public function renderSearchField()
 {
     $form = \Core::make('helper/form');
     $html = $form->select('ptID', array_reduce(\PageType::getList(), function ($types, $type) {
         $types[$type->getPageTypeID()] = $type->getPageTypeDisplayName();
         return $types;
     }), $this->data['ptID']);
     return $html;
 }
コード例 #5
0
 public function view()
 {
     $this->ptID = intval($this->request->query->get('ptID'));
     $this->cParentID = intval($this->request->query->get('cParentID'));
     $this->lastestversion = isset($_GET['lastestversion']) ? true : false;
     $list = new PageList();
     $list->sortByDisplayOrder();
     if ($this->ptID > 0) {
         $list->filterByPageTypeID(intval($this->ptID));
     }
     if ($this->cParentID != 0) {
         $list->filterByPath(Page::getByID($this->cParentID)->getCollectionPath());
     }
     $page_result = $list->getResults();
     $cv_list = array();
     $nh = Core::make('helper/navigation');
     foreach ($page_result as $res) {
         $cp = new Permissions($res);
         if ($cp->canViewPageVersions()) {
             $cv = new VersionList($res);
             if (is_object($cv)) {
                 if ($this->lastestversion == true) {
                     $cvcheck = $cv->getPage(-1);
                     if ($cvcheck[0]->cvIsApproved != 1) {
                         $cv_list[$res->getCollectionID()]['vObj'] = $cv->getPage(-1);
                         $cv_list[$res->getCollectionID()]['cName'] = $res->getCollectionName();
                         $cv_list[$res->getCollectionID()]['cID'] = $res->getCollectionID();
                         $cv_list[$res->getCollectionID()]['link'] = $nh->getLinkToCollection($res);
                     }
                 } else {
                     $cv_list[$res->getCollectionID()]['vObj'] = $cv->getPage(-1);
                     $cv_list[$res->getCollectionID()]['cName'] = $res->getCollectionName();
                     $cv_list[$res->getCollectionID()]['cID'] = $res->getCollectionID();
                     $cv_list[$res->getCollectionID()]['link'] = $nh->getLinkToCollection($res);
                 }
             }
         }
     }
     $cvl = new ItemList();
     $cvl->setItems($cv_list);
     $cvl->setItemsPerPage(10);
     $showPagination = false;
     if ($cvl->getSummary()->pages > 1) {
         $showPagination = true;
         $paginator = $cvl->getPagination();
     }
     $this->set('cParentID', $this->cParentID);
     $this->set('paginator', $paginator);
     $this->set('showPagination', $showPagination);
     $this->set('lastestversion', $this->lastestversion);
     $this->set('cvlresult', $cvl->getPage());
     $this->set('ptID', $this->ptID);
     $pagetypes = \PageType::getList();
     $this->set('pts', $pagetypes);
 }
コード例 #6
0
 public function create_new()
 {
     $pr = new PageEditResponse();
     $ms = Section::getByID($this->request->request->get('section'));
     // we get the related parent id
     if ($this->page->isPageDraft()) {
         $cParentID = $this->page->getPageDraftTargetParentPageID();
     } else {
         $cParentID = $this->page->getCollectionParentID();
     }
     $cParent = \Page::getByID($cParentID);
     $cParentRelatedID = $ms->getTranslatedPageID($cParent);
     if ($cParentRelatedID > 0) {
         // we copy the page underneath it and store it
         $ct = \PageType::getByID($this->page->getPageTypeID());
         if ($this->page->isPageDraft()) {
             $ptp = new \Permissions($ct);
             if (!$ptp->canAddPageType()) {
                 throw new \Exception(t('You do not have permission to add a page of this type.'));
             }
         }
         $newParent = \Page::getByID($cParentRelatedID);
         $cp = new \Permissions($newParent);
         if ($cp->canAddSubCollection($ct)) {
             if ($this->page->isPageDraft()) {
                 $targetParent = \Page::getByPath(\Config::get('concrete.paths.drafts'));
             } else {
                 $targetParent = $newParent;
             }
             $newPage = $this->page->duplicate($targetParent);
             if (is_object($newPage)) {
                 if ($this->page->isPageDraft()) {
                     $newPage->setPageDraftTargetParentPageID($newParent->getCollectionID());
                     Section::relatePage($this->page, $newPage, $ms->getLocale());
                     $pr->setMessage(t('New draft created.'));
                 } else {
                     // grab the approved version and unapprove it
                     $v = Version::get($newPage, 'ACTIVE');
                     if (is_object($v)) {
                         $v->deny();
                     }
                     $pr->setMessage(t('Unapproved page created. You must publish this page before it is live.'));
                 }
                 $ih = Core::make('multilingual/interface/flag');
                 $icon = (string) $ih->getSectionFlagIcon($ms);
                 $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName());
                 $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink());
                 $pr->setAdditionalDataAttribute('icon', $icon);
             }
         } else {
             throw new \Exception(t('You do not have permission to add this page to this section of the tree.'));
         }
     }
     $pr->outputJSON();
 }
コード例 #7
0
ファイル: PageType.php プロジェクト: neymanna/fusionforge
 /** Constructor.
  *
  * @param WikiDB_Page $page
  * @param string $text  The packed page revision content.
  * @param hash $meta    The version meta-data.
  * @param string $type_override  For markup of page using a different
  *        pagetype than that specified in its version meta-data.
  */
 function TransformedText($page, $text, $meta, $type_override = false)
 {
     $pagetype = false;
     if ($type_override) {
         $pagetype = $type_override;
     } elseif (isset($meta['pagetype'])) {
         $pagetype = $meta['pagetype'];
     }
     $this->_type = PageType::GetPageType($pagetype);
     $this->CacheableMarkup($this->_type->transform($page, $text, $meta), $page->getName());
 }
コード例 #8
0
ファイル: multilingual.php プロジェクト: ceko/concrete5-1
 public function create_new()
 {
     $pr = new PageEditResponse();
     $ms = Section::getByID($this->request->request->get('section'));
     // we get the related parent id
     $cParentID = $this->page->getCollectionParentID();
     $cParent = \Page::getByID($cParentID);
     $cParentRelatedID = $ms->getTranslatedPageID($cParent);
     if ($cParentRelatedID > 0) {
         // we copy the page underneath it and store it
         $newParent = \Page::getByID($cParentRelatedID);
         $ct = \PageType::getByID($this->page->getPageTypeID());
         $cp = new \Permissions($newParent);
         if ($cp->canAddSubCollection($ct) && $this->page->canMoveCopyTo($newParent)) {
             $newPage = $this->page->duplicate($newParent);
             if (is_object($newPage)) {
                 // grab the approved version and unapprove it
                 $v = Version::get($newPage, 'ACTIVE');
                 if (is_object($v)) {
                     $v->deny();
                     $pkr = new ApprovePageRequest();
                     $pkr->setRequestedPage($newPage);
                     $u = new \User();
                     $pkr->setRequestedVersionID($v->getVersionID());
                     $pkr->setRequesterUserID($u->getUserID());
                     $response = $pkr->trigger();
                     if (!$response instanceof Response) {
                         // we are deferred
                         $pr->setMessage(t('<strong>Request Saved.</strong> You must complete the workflow before this change is active.'));
                     } else {
                         $ih = Core::make('multilingual/interface/flag');
                         $icon = $ih->getSectionFlagIcon($ms);
                         $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName());
                         $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink());
                         $pr->setAdditionalDataAttribute('icon', $icon);
                         $pr->setMessage(t('Page created.'));
                     }
                 }
             }
         } else {
             throw new \Exception(t('You do not have permission to add this page to this section of the tree.'));
         }
     }
     $pr->outputJSON();
 }
コード例 #9
0
ファイル: PageListTest.php プロジェクト: masteramuk/concrete5
 public function setUp()
 {
     $this->tables = array_merge($this->tables, array('PermissionAccessList', 'PageTypeComposerFormLayoutSets', 'AttributeSetKeys', 'AttributeSets', 'AttributeKeyCategories', 'PermissionAccessEntityTypes', 'Packages', 'AttributeKeys', 'AttributeTypes', 'PageFeeds'));
     parent::setUp();
     \Concrete\Core\Permission\Access\Entity\Type::add('page_owner', 'Page Owner');
     \Concrete\Core\Permission\Category::add('page');
     \Concrete\Core\Permission\Key\Key::add('page', 'view_page', 'View Page', '', 0, 0);
     PageTemplate::add('left_sidebar', 'Left Sidebar');
     PageTemplate::add('right_sidebar', 'Right Sidebar');
     PageType::add(array('handle' => 'alternate', 'name' => 'Alternate'));
     PageType::add(array('handle' => 'another', 'name' => 'Another'));
     foreach ($this->pageData as $data) {
         $c = call_user_func_array(array($this, 'createPage'), $data);
         $c->reindex();
     }
     $this->list = new \Concrete\Core\Page\PageList();
     $this->list->ignorePermissions();
 }
コード例 #10
0
ファイル: category.php プロジェクト: eavesmonkey/respond
 /**
  * @method POST
  */
 function get()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $pageTypeId = -1;
         parse_str($this->request->data, $request);
         // parse request
         if (isset($request['pageTypeId'])) {
             $pageTypeId = $request['pageTypeId'];
         }
         if (isset($request['friendlyId'])) {
             $friendlyId = $request['friendlyId'];
             $pageType = PageType::GetByFriendlyId($friendlyId, $authUser->SiteId);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         if (isset($request['pageTypeUniqId'])) {
             $pageType = PageType::GetByPageTypeUniqId($request['pageTypeUniqId']);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         // check that pageTypeId was set
         if ($pageTypeId != -1) {
             $list = Category::GetCategories($pageTypeId);
             // return a json response
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = json_encode($list);
             return $response;
         } else {
             // return an empty response (e.g. root has not categories)
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = '[]';
             return $response;
         }
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
コード例 #11
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $page_type_list = array();
     $type = PageType::model()->findAll('status=1');
     foreach ($type as $page_type) {
         $page_type_list[$page_type->page_type_id] = $page_type->name_th;
     }
     $page_id_list = array();
     $page = Page::model()->findAll('status=1');
     foreach ($page as $page_list) {
         $page_id_list[$page_list->page_id] = $page_list->name_th;
     }
     if (isset($_POST['LeftMenu'])) {
         $_POST['LeftMenu']['user_id'] = Yii::app()->user->id;
         $model->attributes = $_POST['LeftMenu'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model, 'page_type_list' => $page_type_list, 'page_id_list' => $page_id_list));
 }
コード例 #12
0
$canMoveCopyPages = true;
if (isset($_REQUEST['origCID']) && strpos($_REQUEST['origCID'], ',') > -1) {
    $ocs = explode(',', $_REQUEST['origCID']);
    foreach ($ocs as $ocID) {
        $originalPages[] = Page::getByID($ocID);
    }
}
foreach ($originalPages as $oc) {
    $ocp = new Permissions($oc);
    if (!$ocp->canRead()) {
        $canReadSource = false;
    }
    if (!$ocp->canMoveOrCopyPage()) {
        $canMoveCopyPages = false;
    }
    $ct = PageType::getByID($oc->getPageTypeID());
    if (!$dcp->canAddSubpage($ct)) {
        $canAddSubContent = false;
    }
    if (!$oc->canMoveCopyTo($dc)) {
        $canMoveCopyTo = false;
    }
    if (!$u->isSuperUser() || $oc->getCollectionPointerID() > 0) {
        $canCopyChildren = false;
    }
}
if (is_object($dc) && !$dc->isError() && $dc->isAlias()) {
    $canMoveCopyTo = false;
}
$valt = Loader::helper('validation/token');
$json = array();
コード例 #13
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$pagetypes = PageType::getList();
$types = array();
foreach ($pagetypes as $pt) {
    $types[$pt->getPageTypeID()] = $pt->getPageTypeName();
}
?>

<input type="hidden" name="tab[]" value="posting" />

<div class="form-horizontal">
	<div class="control-group">
		<label class="control-label"><?php 
echo t('Enable New Topics');
?>
</label>
		<div class="controls">
			<div class="radio">
                <label>
				<?php 
echo $form->radio('enablePostingFromGathering', 0, $enablePostingFromGathering);
?>
				<span><?php 
echo t('No, posting is disabled.');
?>
</span>
                </label>
			</div>
			<div class="radio">
コード例 #14
0
ファイル: pages.php プロジェクト: robertdamoc/concrete5
 protected function getField($field)
 {
     $r = new stdClass();
     $r->field = $field;
     $searchRequest = $this->searchRequest->getSearchRequest();
     $form = Loader::helper('form');
     $wdt = Loader::helper('form/date_time');
     /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */
     $html = '';
     switch ($field) {
         case 'keywords':
             $html .= $form->text('keywords', $searchRequest['keywords']);
             break;
         case 'date_public':
             $html .= $wdt->datetime('date_public_from', $wdt->translate('date_public_from', $searchRequest)) . t('to') . $wdt->datetime('date_public_to', $wdt->translate('date_public_to', $searchRequest));
             break;
         case 'date_added':
             $html .= $wdt->datetime('date_added_from', $wdt->translate('date_added_from', $searchRequest)) . t('to') . $wdt->datetime('date_added_to', $wdt->translate('date_added_to', $searchRequest));
             break;
         case 'last_modified':
             $html .= $wdt->datetime('last_modified_from', $wdt->translate('last_modified_from', $searchRequest)) . t('to') . $wdt->datetime('last_modified_to', $wdt->translate('last_modified_to', $searchRequest));
             break;
         case 'owner':
             $html .= $form->text('owner');
             break;
         case 'permissions_inheritance':
             $html .= '<select name="cInheritPermissionsFrom" class="form-control">';
             $html .= '<option value="PARENT"' . ($searchRequest['cInheritPermissionsFrom'] == 'PARENT' ? ' selected' : '') . '>' . t('Parent Page') . '</option>';
             $html .= '<option value="TEMPLATE"' . ($searchRequest['cInheritPermissionsFrom'] == 'TEMPLATE' ? ' selected' : '') . '>' . t('Page Type') . '</option>';
             $html .= '<option value="OVERRIDE"' . ($searchRequest['cInheritPermissionsFrom'] == 'OVERRIDE' ? ' selected' : '') . '>' . t('Itself (Override)') . '</option>';
             $html .= '</select>';
             break;
         case 'type':
             $html .= $form->select('ptID', array_reduce(\PageType::getList(), function ($types, $type) {
                 $types[$type->getPageTypeID()] = $type->getPageTypeDisplayName();
                 return $types;
             }), $searchRequest['ptID']);
             break;
         case 'version_status':
             $versionToRetrieve = \Concrete\Core\Page\PageList::PAGE_VERSION_RECENT;
             if ($searchRequest['versionToRetrieve']) {
                 $versionToRetrieve = $searchRequest['versionToRetrieve'];
             }
             $html .= '<div class="radio"><label>' . $form->radio('versionToRetrieve', \Concrete\Core\Page\PageList::PAGE_VERSION_RECENT, $versionToRetrieve) . t('All') . '</label></div>';
             $html .= '<div class="radio"><label>' . $form->radio('versionToRetrieve', \Concrete\Core\Page\PageList::PAGE_VERSION_ACTIVE, $versionToRetrieve) . t('Approved') . '</label></div>';
             break;
         case 'parent':
             $ps = Loader::helper("form/page_selector");
             $html .= $ps->selectPage('cParentIDSearchField');
             $html .= '<div class="form-group">';
             $html .= '<label class="control-label">' . t('Search All Children?') . '</label>';
             $html .= '<div class="radio"><label>' . $form->radio('cParentAll', 0, false) . ' ' . t('No') . '</label></div>';
             $html .= '<div class="radio"><label>' . $form->radio('cParentAll', 1, false) . ' ' . t('Yes') . '</label></div>';
             $html .= '</div>';
             break;
         case 'num_children':
             $html .= '<div class="form-inline"><select name="cChildrenSelect" class="form-control">';
             $html .= '<option value="gt"' . ($searchRequest['cChildrenSelect'] == 'gt' ? ' selected' : '') . '>' . t('More Than') . '</option>';
             $html .= '<option value="eq"' . ($searchRequest['cChildrenSelect'] == 'eq' ? ' selected' : '') . '>' . t('Equal To') . '</option>';
             $html .= '<option value="lt"' . ($searchRequest['cChildrenSelect'] == 'lt' ? ' selected' : '') . '>' . t('Fewer Than') . '</option>';
             $html .= '</select>';
             $html .= ' <input type="text" name="cChildren" class="form-control" value="' . $searchRequest['cChildren'] . '" /></div>';
             break;
         case 'theme':
             $html .= '<select name="pThemeID" class="form-control">';
             $themes = PageTheme::getList();
             foreach ($themes as $pt) {
                 $html .= '<option value="' . $pt->getThemeID() . '" ' . ($pt->getThemeID() == $searchRequest['pThemeID'] ? ' selected' : '') . '>' . $pt->getThemeName() . '</option>';
             }
             $html .= '</select>';
             break;
         default:
             if (Loader::helper('validation/numbers')->integer($field)) {
                 $ak = CollectionAttributeKey::getByID($field);
                 $html .= $ak->render('search', null, true);
             }
             break;
     }
     $r->html = $html;
     $ag = ResponseAssetGroup::get();
     $r->assets = array();
     foreach ($ag->getAssetsToOutput() as $position => $assets) {
         foreach ($assets as $asset) {
             if (is_object($asset)) {
                 // have to do a check here because we might be included a dumb javascript call like i18n_js
                 $r->assets[$asset->getAssetType()][] = $asset->getAssetURL();
             }
         }
     }
     return $r;
 }
コード例 #15
0
ファイル: page.php プロジェクト: eavesmonkey/respond
 /**
  * @method POST
  */
 function get()
 {
     parse_str($this->request->data, $request);
     // parse request
     $siteUniqId = SITE_UNIQ_ID;
     $pageTypeUniqId = $request['pageTypeUniqId'];
     $site = Site::GetBySiteUniqId($siteUniqId);
     $pageType = PageType::GetByPageTypeUniqId($pageTypeUniqId);
     // Get all pages
     $total = Page::GetPagesCount($site['SiteId'], $pageType['PageTypeId'], true);
     $json = '{"total":"' . $total . '"}';
     header('Content-type: application/json');
     // return a json response
     $response = new Tonic\Response(Tonic\Response::OK);
     $response->contentType = 'applicaton/json';
     $response->body = $json;
     return $response;
 }
コード例 #16
0
ファイル: Publish.php プロジェクト: eavesmonkey/respond
 public static function PublishPage($pageUniqId, $preview = false, $remove_draft = false, $root = '../')
 {
     $page = Page::GetByPageUniqId($pageUniqId);
     if ($page != null) {
         $site = Site::GetBySiteId($page['SiteId']);
         // test for now
         $dest = $root . 'sites/' . $site['FriendlyId'] . '/';
         $imageurl = $dest . 'files/';
         $siteurl = 'http://' . $site['Domain'] . '/';
         $friendlyId = $page['FriendlyId'];
         $url = '';
         $file = '';
         if ($preview == true) {
             $previewId = uniqid();
             $file = $page['FriendlyId'] . '-' . $previewId . '-preview.php';
         } else {
             $file = $page['FriendlyId'] . '.php';
         }
         // create a nice path to store the file
         if ($page['PageTypeId'] == -1) {
             $url = $page['FriendlyId'] . '.php';
             $path = '';
         } else {
             $pageType = PageType::GetByPageTypeId($page['PageTypeId']);
             $path = 'uncategorized/';
             if ($pageType != null) {
                 $path = strtolower($pageType['FriendlyId']) . '/';
             }
         }
         // generate default
         $html = Utilities::GeneratePage($site, $page, $siteurl, $imageurl, $preview, $root);
         // remove any drafts associated with the page
         if ($remove_draft == true) {
             $draft = $root . 'sites/' . $site['FriendlyId'] . '/fragments/draft/' . $page['PageUniqId'] . '.html';
             if (file_exists($draft)) {
                 unlink($draft);
             }
         }
         if ($preview == true) {
             $s_dest = $dest . 'preview/';
         } else {
             $s_dest = $dest . $path;
         }
         // save the content to the published file
         Utilities::SaveContent($s_dest, $file, $html);
         // publish a rendered fragment
         Publish::PublishRender($site, $page, $root);
         // build the search index for the page
         Publish::BuildSearchIndex($site, $page, $root);
         return $s_dest . $file;
     }
 }
コード例 #17
0
ファイル: Utilities.php プロジェクト: SylvainMoingeon/respond
 public static function GenerateSiteMap($site)
 {
     $list = Page::GetPagesForSite($site['SiteId']);
     // get offset for time zone
     $timeZone = new DateTimeZone($site['TimeZone']);
     $now = new DateTime("now", $timeZone);
     $offset = $timeZone->getOffset($now);
     $xml = '<?xml version="1.0" encoding="UTF-8"?>' . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     date_default_timezone_set('America/Los_Angeles');
     foreach ($list as $row) {
         $u = strtotime($row['LastModifiedDate']) + $offset;
         $pageType = PageType::GetByPageTypeId($row['PageTypeId']);
         if ($pageType['IsSecure'] == 1) {
             continue;
         }
         if ($row['IncludeOnly'] == 1) {
             continue;
         }
         // set URL divider based on URL mode
         $divider = '/';
         // build url
         if ($row['PageTypeId'] == -1) {
             $xml = $xml . '<url>' . '<loc>' . $site['Domain'] . $divider . strtolower($row['FriendlyId']) . '</loc>' . '<lastmod>' . date('Y-m-d', $u) . '</lastmod>' . '<priority>1.0</priority>' . '</url>';
         } else {
             $xml = $xml . '<url>' . '<loc>' . $site['Domain'] . $divider . strtolower($pageType['FriendlyId']) . '/' . strtolower($row['FriendlyId']) . '</loc>' . '<lastmod>' . date('Y-m-d', $u) . '</lastmod>' . '<priority>0.5</priority>' . '</url>';
         }
     }
     $xml = $xml . '</urlset>';
     return $xml;
 }
コード例 #18
0
ファイル: controller.php プロジェクト: ceko/concrete5-1
 public function view()
 {
     if ($this->gaID) {
         $gathering = Gathering::getByID($this->gaID);
         if (is_object($gathering)) {
             Core::make('helper/overlay')->init(false);
             if ($this->enablePostingFromGathering && $this->ptID) {
                 $pt = PageType::getByID($this->ptID);
                 Core::make('helper/concrete/composer')->addAssetsToRequest($pt, $this);
                 $p = new Permissions($pt);
                 if ($p->canEditPageTypeInComposer()) {
                     $this->set('pagetype', $pt);
                 }
             }
             $list = new GatheringItemList($gathering);
             $list->sortByDateDescending();
             $list->setItemsPerPage($this->itemsPerPage);
             $this->set('gathering', $gathering);
             $this->set('itemList', $list);
         }
     }
 }
コード例 #19
0
 public function testDelete()
 {
     $db = Database::get();
     $page1 = self::createPage('Awesome Page');
     $page2 = self::createPage('Awesome Page 2');
     $this->assertEquals(3, $page2->getCollectionID());
     $page2->delete();
     $np = Page::getByID(3);
     $this->assertEquals($np->getCollectionID(), null);
     $pt = PageType::getByID(1);
     $template = PageTemplate::getByID(1);
     $newpage = $page1->add($pt, array('uID' => 1, 'cName' => 'Test Sub-page', 'pTemplateID' => $template->getPageTemplateID()));
     $page1->delete();
     $this->assertEquals(1, $db->GetOne('select count(cID) from Pages'));
     $np1 = Page::getByID(2);
     $np2 = Page::getByID(4);
     $this->assertEquals($np1->getCollectionID(), null);
     $this->assertEquals($np2->getCollectionID(), null);
 }
コード例 #20
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
if (!ini_get('safe_mode')) {
    @set_time_limit(0);
}
/* @var $text Concrete5_Helper_Text */
$text = \Loader::helper('text');
$bID = isset($_POST['bID']) ? $_POST['bID'] : '';
$block = \Block::getByID($bID);
$controller = $block->getInstance();
$parentPage = $block->getBlockCollectionObject();
$pageType = \PageType::getByHandle('worldskills_skill');
$template = \PageTemplate::getByHandle('full');
$skills = $controller->getSkills();
foreach ($skills['skills'] as $skill) {
    $skillId = $skill['id'];
    $name = $skill['name']['text'];
    $slug = $text->urlify($name);
    $page = null;
    // try to load existing page
    $pageList = new PageList();
    $pageList->filterByParentID($parentPage->getCollectionId());
    $pageList->filterByAttribute('worldskills_skill_id', $skillId);
    $pages = $pageList->get(1);
    if (is_array($pages) && isset($pages[0])) {
        $page = $pages[0];
    }
    if (!$page) {
        // create page
        $data = array('cName' => $name, 'cDescription' => '', 'cHandle' => $slug);
コード例 #21
0
ファイル: site.php プロジェクト: eavesmonkey/respond
 /**
  * @method POST
  */
 function post()
 {
     parse_str($this->request->data, $request);
     // parse request
     $friendlyId = $request['friendlyId'];
     $name = $request['name'];
     $s_passcode = $request['passcode'];
     $timeZone = $request['timeZone'];
     $email = '';
     $password = '';
     $language = 'en-us';
     // language for the app
     $userId = -1;
     $theme = DEFAULT_THEME;
     // set theme
     if (isset($request['theme'])) {
         $theme = $request['theme'];
     }
     // set language if set
     if (isset($request['language'])) {
         $language = $request['language'];
     }
     // check for email and password
     if (isset($request['email'])) {
         $userLanguage = 'en-us';
         if (isset($request['userLanguage'])) {
             $userLanguage = $request['userLanguage'];
         }
         $email = $request['email'];
         $password = $request['password'];
     } else {
         // get an authuser
         $authUser = new AuthUser();
         if ($authUser->UserUniqId && $authUser->IsSuperAdmin == true) {
             // check if authorized
             $userId = $authUser->UserId;
         } else {
             return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
         }
     }
     // defaults
     $firstName = 'New';
     $lastName = 'User';
     $domain = APP_URL . '/sites/' . $friendlyId;
     $domain = str_replace('http://', '', $domain);
     $logoUrl = 'sample-logo.png';
     if ($s_passcode == PASSCODE) {
         // check for uniqueness of email
         if ($email != '') {
             $isUserUnique = User::IsLoginUnique($email);
             if ($isUserUnique == false) {
                 return new Tonic\Response(Tonic\Response::CONFLICT);
             }
         }
         $isFriendlyIdUnique = Site::IsFriendlyIdUnique($friendlyId);
         if ($isFriendlyIdUnique == false) {
             return new Tonic\Response(Tonic\Response::CONFLICT);
         }
         // add the site
         $site = Site::Add($domain, $name, $friendlyId, $logoUrl, $theme, $email, $timeZone, $language);
         // add the site
         // add the admin
         if ($email != '') {
             $isActive = 1;
             // admins by default are active
             $user = User::Add($email, $password, $firstName, $lastName, 'Admin', $userLanguage, $isActive, $site['SiteId']);
             $userId = $user['UserId'];
         }
         // set the stripe plan, customer id, status
         if (DEFAULT_STRIPE_PLAN != '') {
             Stripe::setApiKey(STRIPE_API_KEY);
             $customer = Stripe_Customer::create(array("plan" => DEFAULT_STRIPE_PLAN, "email" => $email));
             $customerId = $customer->id;
             Site::EditCustomer($site['SiteUniqId'], $customerId);
         }
         // read the defaults file
         $default_json_file = '../themes/' . $theme . '/default.json';
         // set $siteId
         $siteId = $site['SiteId'];
         // check to make sure the defaults.json exists
         if (file_exists($default_json_file)) {
             // get json from the file
             $json_text = file_get_contents($default_json_file);
             // decode json
             $json = json_decode($json_text, true);
             // pagetypes
             $pagetypes = array();
             // menu counts
             $primaryMenuCount = 0;
             $footerMenuCount = 0;
             // walk through defaults array
             foreach ($json as &$value) {
                 // get values from array
                 $url = $value['url'];
                 $source = $value['source'];
                 $name = $value['name'];
                 $description = $value['description'];
                 $layout = $value['layout'];
                 $stylesheet = $value['stylesheet'];
                 $primaryMenu = $value['primaryMenu'];
                 $footerMenu = $value['footerMenu'];
                 if (strpos($url, '/') !== false) {
                     // the url has a pagetype
                     $arr = explode('/', $url);
                     // get friendly ids from $url
                     $pageTypeFriendlyId = $arr[0];
                     $pageFriendlyId = $arr[1];
                     $pageTypeId = -1;
                     $pageType = PageType::GetByFriendlyId($pageTypeFriendlyId, $siteId);
                     // create a new pagetype
                     if ($pageType == NULL) {
                         $pageType = PageType::Add($pageTypeFriendlyId, 'Page', 'Pages', $layout, $stylesheet, 0, $siteId, $userId, $userId);
                     }
                     // get newly minted page type
                     $pageTypeId = $pageType['PageTypeId'];
                 } else {
                     // root, no pagetype
                     $pageFriendlyId = $url;
                     $pageTypeId = -1;
                 }
                 // create a page
                 $page = Page::Add($pageFriendlyId, $name, $description, $layout, $stylesheet, $pageTypeId, $site['SiteId'], $userId);
                 // set the page to active
                 Page::SetIsActive($page['PageUniqId'], 1);
                 // build the content file
                 $filename = '../themes/' . $theme . '/' . $source;
                 $content = '';
                 // get the content for the page
                 if (file_exists($filename)) {
                     $content = file_get_contents($filename);
                     // fix images
                     $content = str_replace('{{site-dir}}', 'sites/' . $site['FriendlyId'], $content);
                 }
                 // publish the fragment
                 Publish::PublishFragment($site['FriendlyId'], $page['PageUniqId'], 'publish', $content);
                 // build the primary menu
                 if ($primaryMenu == true) {
                     MenuItem::Add($name, '', 'primary', $url, $page['PageId'], $primaryMenuCount, $site['SiteId'], $userId, $userId);
                     $primaryMenuCount++;
                 }
                 // build the footer menu
                 if ($footerMenu == true) {
                     MenuItem::Add($name, '', 'footer', $url, $page['PageId'], $footerMenuCount, $site['SiteId'], $userId, $userId);
                     $footerMenuCount++;
                 }
             }
         } else {
             return new Tonic\Response(Tonic\Response::BADREQUEST);
         }
         // publishes a theme for a site
         Publish::PublishTheme($site, $theme);
         // publish the site
         Publish::PublishSite($site['SiteUniqId']);
         // send welcome email
         if (SEND_WELCOME_EMAIL == true && $email != '') {
             $to = $email;
             $from = REPLY_TO;
             $fromName = REPLY_TO_NAME;
             $subject = BRAND . ': Welcome to ' . BRAND;
             $file = 'emails/new-user.html';
             // create strings to replace
             $loginUrl = APP_URL;
             $newSiteUrl = APP_URL . '/sites/' . $site['FriendlyId'];
             $replace = array('{{brand}}' => BRAND, '{{reply-to}}' => REPLY_TO, '{{new-site-url}}' => $newSiteUrl, '{{login-url}}' => $loginUrl);
             // send email from file
             Utilities::SendEmailFromFile($to, $from, $fromName, $subject, $replace, $file);
         }
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
コード例 #22
0
ファイル: Publish.php プロジェクト: sanderdrummer/Homepages
 public static function PublishStaticPage($page, $site, $preview = false, $remove_draft = false)
 {
     $dest = SITES_LOCATION . '/' . $site['FriendlyId'] . '/';
     $imageurl = $dest . 'files/';
     $siteurl = $site['Domain'] . '/';
     $friendlyId = $page['FriendlyId'];
     $url = '';
     $file = '';
     // created ctrl
     $ctrl = ucfirst($page['FriendlyId']);
     $ctrl = str_replace('-', '', $ctrl);
     // set base
     $base = '';
     // create a static location for the page
     if ($page['PageTypeId'] == -1) {
         $url = $page['FriendlyId'] . '.html';
         $dest = SITES_LOCATION . '/' . $site['FriendlyId'] . '/';
     } else {
         $pageType = PageType::GetByPageTypeId($page['PageTypeId']);
         $dest = SITES_LOCATION . '/' . $site['FriendlyId'] . '/uncategorized/';
         if ($pageType != null) {
             $dest = SITES_LOCATION . '/' . $site['FriendlyId'] . '/' . $pageType['FriendlyId'] . '/';
             // created ctrl
             $ctrl = ucfirst($pageType['FriendlyId']) . $ctrl;
             $ctrl = str_replace('-', '', $ctrl);
         }
         // set $base to the root of the director
         $base = '../';
     }
     // create directory if it does not exist
     if (!file_exists($dest)) {
         mkdir($dest, 0755, true);
     }
     // generate default
     $html = '';
     $content = '';
     // get index and layout (file_get_contents)
     $index = SITES_LOCATION . '/' . $site['FriendlyId'] . '/themes/' . $site['Theme'] . '/layouts/index.html';
     $layout = SITES_LOCATION . '/' . $site['FriendlyId'] . '/themes/' . $site['Theme'] . '/layouts/' . $page['Layout'] . '.html';
     // get index html
     if (file_exists($index)) {
         $html = file_get_contents($index);
     }
     // get layout html
     if (file_exists($layout)) {
         $layout_html = file_get_contents($layout);
         $html = str_replace('<body ui-view></body>', '<body ng-controller="PageCtrl" page="' . $page['PageId'] . '" class="' . $page['Stylesheet'] . '">' . $layout_html . '</body>', $html);
     }
     // get draft/content
     if ($preview == true) {
         $file = $page['FriendlyId'] . '.preview.html';
         $content = $page['Draft'];
     } else {
         $file = $page['FriendlyId'] . '.html';
         $content = $page['Content'];
     }
     // replace respond-content for layout with content
     $html = str_replace('<respond-content id="main-content" url="{{page.Url}}"></respond-content>', $content, $html);
     // remove any drafts associated with the page
     if ($remove_draft == true) {
         // remove a draft from the page
         Page::RemoveDraft($page['PageId']);
     }
     // replace common Angular calls for SEO, e.g. {{page.Name}} {{page.Description}} {{site.Name}}
     $html = str_replace('{{page.Name}}', $page['Name'], $html);
     $html = str_replace('{{page.Description}}', $page['Description'], $html);
     $html = str_replace('{{page.Keywords}}', $page['Keywords'], $html);
     $html = str_replace('{{page.Callout}}', $page['Callout'], $html);
     $html = str_replace('{{site.Name}}', $site['Name'], $html);
     $html = str_replace('{{site.Language}}', $site['Language'], $html);
     $html = str_replace('{{site.Direction}}', $site['Direction'], $html);
     $html = str_replace('{{page.FullStylesheetUrl}}', 'css/' . $page['Stylesheet'] . '.css', $html);
     // update base
     $html = str_replace('<base href="/">', '<base href="' . $base . '">', $html);
     // add menu links for SEO (<respond-menu type="primary"></respond-menu>)
     $delimiter = '#';
     $startTag = '<respond-menu type="';
     $endTag = '"></respond-menu>';
     $regex = $delimiter . preg_quote($startTag, $delimiter) . '(.*?)' . preg_quote($endTag, $delimiter) . $delimiter . 's';
     // match against html
     preg_match_all($regex, $html, $matches);
     // crawl matches
     foreach ($matches[1] as &$value) {
         // init menu
         $menu = '';
         // get items for type
         $menuItems = MenuItem::GetMenuItemsForType($site['SiteId'], $value);
         $i = 0;
         $parent_flag = false;
         $new_parent = true;
         // walk through items
         foreach ($menuItems as $menuItem) {
             $url = $menuItem['Url'];
             $name = $menuItem['Name'];
             $css = '';
             $cssClass = '';
             $active = '';
             if ($page['PageId'] == $menuItem['PageId']) {
                 $css = 'active';
             }
             $css .= ' ' . $menuItem['CssClass'];
             if (trim($css) != '') {
                 $cssClass = ' class="' . $css . '"';
             }
             // check for new parent
             if (isset($menuItems[$i + 1])) {
                 if ($menuItems[$i + 1]['IsNested'] == 1 && $new_parent == true) {
                     $parent_flag = true;
                 }
             }
             $menu_root = '/';
             // check for external links
             if (strpos($url, 'http') !== false) {
                 $menu_root = '';
             }
             if ($new_parent == true && $parent_flag == true) {
                 $menu .= '<li>';
                 $menu .= '<a href="' . $menu_root . $url . '">' . $menuItem['Name'] . '</a>';
                 $menu .= '<ul class="dropdown-menu">';
                 $new_parent = false;
             } else {
                 $menu .= '<li' . $cssClass . '>';
                 $menu .= '<a href="' . $menu_root . $url . '">' . $menuItem['Name'] . '</a>';
                 $menu .= '</li>';
             }
             // end parent
             if (isset($menuItems[$i + 1])) {
                 if ($menuItems[$i + 1]['IsNested'] == 0 && $parent_flag == true) {
                     $menu .= '</ul></li>';
                     // end parent if next item is not nested
                     $parent_flag = false;
                     $new_parent = true;
                 }
             } else {
                 if ($parent_flag == true) {
                     $menu .= '</ul></li>';
                     // end parent if next menu item is null
                     $parent_flag = false;
                     $new_parent = true;
                 }
             }
         }
         $i = $i + 1;
         // fill menu with string
         $html = str_replace('<respond-menu type="' . $value . '"></respond-menu>', '<respond-menu type="' . $value . '">' . $menu . '</respond-menu>', $html);
     }
     // save the content to the published file
     Utilities::SaveContent($dest, $file, $html);
     return $dest . $file;
 }
コード例 #23
0
ファイル: page_type.php プロジェクト: ceko/concrete5-1
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$ch = Page::getByPath('/dashboard/pages/types', 'RECENT');
$chp = new Permissions($ch);
if ($_REQUEST['ptID'] > 0) {
    $pt = PageType::getByID($_REQUEST['ptID']);
    $fsp = new Permissions($fs);
    if ($chp->canViewPage()) {
        Loader::element('permission/details/page_type', array("pagetype" => $pt));
    }
}
コード例 #24
0
ファイル: PagePathTest.php プロジェクト: ceko/concrete5-1
 public function testPagePathUpdate()
 {
     $home = Page::getByID(HOME_CID);
     $pt = PageType::getByID(1);
     $template = PageTemplate::getByID(1);
     $page = $home->add($pt, array('uID' => 1, 'cName' => 'Here\'s a twist', 'pTemplateID' => $template->getPageTemplateID()));
     $nc = $page->getVersionToModify();
     $nc->addAdditionalPagePath('/something/cool', false);
     $nc->addAdditionalPagePath('/something/rad', true);
     $nc->update(array('cName' => 'My new name', 'cHandle' => false));
     $nv = $nc->getVersionObject();
     $nv->approve();
     $nc2 = Page::getByID(2);
     $this->assertEquals('/my-new-name', $nc2->getCollectionPath());
     $this->assertEquals('my-new-name', $nc2->getCollectionHandle());
     $this->assertEquals(2, $nc2->getVersionID());
     $path = $nc2->getCollectionPathObject();
     $this->assertInstanceOf('\\Concrete\\Core\\Page\\PagePath', $path);
     $this->assertEquals('/my-new-name', $path->getPagePath());
     $this->assertEquals(true, $path->isPagePathAutoGenerated());
     $this->assertEquals(true, $path->isPagePathCanonical());
     $additionalPaths = $nc2->getAdditionalPagePaths();
     $this->assertEquals(2, count($additionalPaths));
     $this->assertEquals('/something/rad', $additionalPaths[1]->getPagePath());
     $this->assertEquals(false, $additionalPaths[1]->isPagePathAutoGenerated());
     $this->assertEquals(false, $additionalPaths[1]->isPagePathCanonical());
 }
コード例 #25
0
echo t('Number of Pages to Display');
?>
</label>
            <input type="text" name="num" value="<?php 
echo $num;
?>
" class="form-control">
        </div>

        <div class="form-group">
            <label class="control-label"><?php 
echo t('Page Type');
?>
</label>
            <?php 
$ctArray = PageType::getList();
if (is_array($ctArray)) {
    ?>
                <select class="form-control" name="ptID" id="selectPTID">
                    <option value="0">** <?php 
    echo t('All');
    ?>
 **</option>
                    <?php 
    foreach ($ctArray as $ct) {
        ?>
                        <option
                            value="<?php 
        echo $ct->getPageTypeID();
        ?>
" <?php 
コード例 #26
0
ファイル: Page.php プロジェクト: eavesmonkey/respond
 public static function GetByUrl($url, $siteId)
 {
     if (strpos($url, '/') !== false) {
         // get by
         $arr = explode('/', $url);
         $pageTypeFriendlyId = $arr[0];
         $pageFriendlyId = $arr[1];
         $pageType = PageType::GetByFriendlyId($pageTypeFriendlyId, $siteId);
         $page = Page::GetByFriendlyId($pageFriendlyId, $pageType['PageTypeId'], $siteId);
         return $page;
     } else {
         $pageFriendlyId = $url;
         $page = Page::GetByFriendlyId($pageFriendlyId, -1, $siteId);
         return $page;
     }
 }
コード例 #27
0
ファイル: check_in.php プロジェクト: digideskio/concrete5
        <div class="small">
        <?php 
        foreach ($publishErrors->getList() as $error) {
            ?>
            <div class="text-warning"><strong><i class="fa fa-warning"></i> <?php 
            echo $error;
            ?>
</strong></div>
            <br/>
        <?php 
        }
        ?>
        </div>

        <?php 
        $pagetype = PageType::getByID($c->getPageTypeID());
        if (is_object($pagetype)) {
            ?>
            <div class="small">
           <div class="text-info"><strong><i class="fa fa-question-circle"></i>
            <?php 
            echo t('You can specify page name, page location and attributes from the <a href="#" data-launch-panel-detail="page-composer" data-panel-detail-url="%s" data-panel-transition="fade">Page Compose interface</a>.', URL::to('/ccm/system/panels/details/page/composer'));
            ?>
            </strong></div>
            <br/>
            </div>
        <?php 
        }
        ?>
    <?php 
    }
コード例 #28
0
ファイル: WikiDB.php プロジェクト: nterray/tuleap
 /**
  * Get the transformed content of a page.
  *
  * @param string $pagetype  Override the page-type of the revision.
  *
  * @return object An XmlContent-like object containing the page transformed
  * contents.
  */
 function getTransformedContent($pagetype_override = false)
 {
     $backend =& $this->_wikidb->_backend;
     if ($pagetype_override) {
         // Figure out the normal page-type for this page.
         $type = PageType::GetPageType($this->get('pagetype'));
         if ($type->getName() == $pagetype_override) {
             $pagetype_override = false;
         }
         // Not really an override...
     }
     if ($pagetype_override) {
         // Overriden page type, don't cache (or check cache).
         return new TransformedText($this->getPage(), $this->getPackedContent(), $this->getMetaData(), $pagetype_override);
     }
     $possibly_cache_results = true;
     if (!USECACHE or WIKIDB_NOCACHE_MARKUP) {
         if (WIKIDB_NOCACHE_MARKUP == 'purge') {
             // flush cache for this page.
             $page = $this->getPage();
             $page->set('_cached_html', '');
             // ignored with !USECACHE
         }
         $possibly_cache_results = false;
     } elseif (USECACHE and !$this->_transformedContent) {
         //$backend->lock();
         if ($this->isCurrent()) {
             $page = $this->getPage();
             $this->_transformedContent = TransformedText::unpack($page->get('_cached_html'));
         } else {
             $possibly_cache_results = false;
         }
         //$backend->unlock();
     }
     if (!$this->_transformedContent) {
         $this->_transformedContent = new TransformedText($this->getPage(), $this->getPackedContent(), $this->getMetaData());
         if ($possibly_cache_results and !WIKIDB_NOCACHE_MARKUP) {
             // If we're still the current version, cache the transfomed page.
             //$backend->lock();
             if ($this->isCurrent()) {
                 $page->set('_cached_html', $this->_transformedContent->pack());
             }
             //$backend->unlock();
         }
     }
     return $this->_transformedContent;
 }
コード例 #29
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Page\Type\Composer\OutputControl as PageTypeComposerOutputControl;
use Concrete\Core\Page\Type\Composer\FormLayoutSetControl as PageTypeComposerFormLayoutSetControl;
$c = Page::getCurrentPage();
// retrieve all block controls attached to this page template.
$pt = PageTemplate::getByID($c->getPageTemplateID());
$ptt = PageType::getByDefaultsPage($c);
$controls = PageTypeComposerOutputControl::getList($ptt, $pt);
$values = array();
foreach ($controls as $control) {
    $fls = PageTypeComposerFormLayoutSetControl::getByID($control->getPageTypeComposerFormLayoutSetControlID());
    $cc = $fls->getPageTypeComposerControlObject();
    $values[$control->getPageTypeComposerOutputControlID()] = $cc->getPageTypeComposerControlName();
}
$form = Loader::helper('form');
?>
<div class="form-group">
	<label for="ptComposerOutputControlID" class="control-label"><?php 
echo t('Control');
?>
</label>
	<?php 
echo $form->select('ptComposerOutputControlID', $values, $ptComposerOutputControlID);
?>
</div>
コード例 #30
0
ファイル: Publish.php プロジェクト: bladep911/respond
 public static function ApplyMustacheSyntax($html, $site, $page)
 {
     // meta data
     $photo = '';
     $firstName = '';
     $lastName = '';
     $lastModifiedDate = $page['LastModifiedDate'];
     // replace last modified
     if ($page['LastModifiedBy'] != NULL) {
         // get user
         $user = User::GetByUserId($page['LastModifiedBy']);
         // set user infomration
         if ($user != NULL) {
             $photo = $user['PhotoUrl'];
             $firstName = $user['FirstName'];
             $lastName = $user['LastName'];
         }
     }
     // set page information
     $html = str_replace('{{page.PhotoUrl}}', $photo, $html);
     $html = str_replace('{{page.FirstName}}', $firstName, $html);
     $html = str_replace('{{page.LastName}}', $lastName, $html);
     $html = str_replace('{{page.LastModifiedDate}}', $lastModifiedDate, $html);
     // replace timestamp
     $html = str_replace('{{timestamp}}', time(), $html);
     // replace year
     $html = str_replace('{{year}}', date('Y'), $html);
     // set images URL
     $imagesURL = $site['Domain'] . '/';
     // set iconURL
     $iconURL = '';
     if ($site['IconUrl'] != '') {
         $iconURL = $imagesURL . 'files/' . $site['IconUrl'];
     }
     // replace
     $html = str_replace('ng-src', 'src', $html);
     $html = str_replace('{{site.ImagesUrl}}', $imagesURL, $html);
     $html = str_replace('{{site.ImagesURL}}', $imagesURL, $html);
     $html = str_replace('{{site.IconUrl}}', $iconURL, $html);
     // set fullLogo
     $html = str_replace('{{fullLogoUrl}}', $imagesURL . 'files/' . $site['LogoUrl'], $html);
     // set altLogo (defaults to full logo if not available)
     if ($site['AltLogoUrl'] != '' && $site['AltLogoUrl'] != NULL) {
         $html = str_replace('{{fullAltLogoUrl}}', $imagesURL . 'files/' . $site['AltLogoUrl'], $html);
     } else {
         $html = str_replace('{{fullAltLogoUrl}}', $imagesURL . 'files/' . $site['LogoUrl'], $html);
     }
     // set urls
     $relativeURL = $page['FriendlyId'];
     if ($page['PageTypeId'] != -1) {
         $pageType = PageType::GetByPageTypeId($page['PageTypeId']);
         $relativeURL = strtolower($pageType['FriendlyId']) . '/' . $page['FriendlyId'];
     }
     $fullURL = $site['Domain'] . '/' . $relativeURL;
     // replace mustaches syntax {{page.Description}} {{site.Name}}
     $html = str_replace('{{page.Name}}', $page['Name'], $html);
     $html = str_replace('{{page.Description}}', $page['Description'], $html);
     $html = str_replace('{{page.Keywords}}', $page['Keywords'], $html);
     $html = str_replace('{{page.Callout}}', $page['Callout'], $html);
     $html = str_replace('{{site.Name}}', $site['Name'], $html);
     $html = str_replace('{{site.Language}}', $site['Language'], $html);
     $html = str_replace('{{site.Direction}}', $site['Direction'], $html);
     $html = str_replace('{{site.IconBg}}', $site['IconBg'], $html);
     $html = str_replace('{{site.EmbeddedCodeHead}}', $site['EmbeddedCodeHead'], $html);
     $html = str_replace('{{site.EmbeddedCodeBottom}}', $site['EmbeddedCodeBottom'], $html);
     $html = str_replace('{{page.FullStylesheetUrl}}', 'css/' . $page['Stylesheet'] . '.css', $html);
     // urls
     $html = str_replace('{{page.Url}}', $relativeURL, $html);
     $html = str_replace('{{page.FullUrl}}', $fullURL, $html);
     return $html;
 }