1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

Page template corrections in bootstrap.

This commit is contained in:
Cameron
2013-06-01 14:03:18 -07:00
parent 4776f49964
commit 7c80fc6aad
3 changed files with 80 additions and 9 deletions

View File

@@ -24,7 +24,15 @@ class page_shortcodes extends e_shortcode
if(($action == 'listPages' || $action == 'listChapters') && vartrue($this->request['id'])) if(($action == 'listPages' || $action == 'listChapters') && vartrue($this->request['id']))
{ {
$this->var = e107::getDb()->retrieve('page_chapters','chapter_name, chapter_meta_description','chapter_id = '.intval($this->request['id']).' LIMIT 1'); $this->var = e107::getDb()->retrieve('page_chapters','chapter_name, chapter_meta_description','chapter_id = '.intval($this->request['id']).' LIMIT 1');
} }
if($action == 'showPage' && vartrue($this->request['id'])) // get chapter and description from current.
{
$query = "SELECT p.page_id,c.chapter_name,c.chapter_meta_description FROM #page AS p LEFT JOIN #page_chapters AS c ON p.page_chapter = c.chapter_id WHERE p.page_id = ".intval($this->request['id'])." LIMIT 1 ";
$rows = e107::getDb()->retrieve($query,true);
$this->var = $rows[0];
}
} }
@@ -101,7 +109,7 @@ class page_shortcodes extends e_shortcode
function sc_page_chapter_name($parm='') function sc_page_chapter_name($parm='')
{ {
return e107::getParser()->toHtml($this->var['chapter_name']); return e107::getParser()->toHtml($this->var['chapter_name']);
} }

View File

@@ -6,7 +6,60 @@
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
*/ */
$PAGE_TEMPLATE['docs']['page'] = '
{PAGE}
{PAGECOMMENTS}
';
$PAGE_TEMPLATE['docs']['start'] = '<div class="cpage_body">';
$PAGE_TEMPLATE['docs']['body'] = '
{CPAGEMESSAGE|default}
<section id="{CPAGEANCHOR}">
{CPAGEBODY}
<br />
<div class="muted text-right">
<small>
{CPAGERATING|default}
{CPAGEDATE|default}
{CPAGEAUTHOR|default}
</small>
</div>
</section>
';
$PAGE_TEMPLATE['docs']['authorize'] = '
<div class="cpage-restrict">
{message}
{form_open}
<h2>{caption}</h2>
<div clas="center">{label} {password} {submit}</div>
{form_close}
</div>
';
$PAGE_TEMPLATE['docs']['restricted'] = '
{text}
';
$PAGE_TEMPLATE['docs']['notfound'] = '
{text}
';
$PAGE_TEMPLATE['docs']['end'] = '</div>';
$PAGE_TEMPLATE['docs']['tableRender'] = 'cpage';

View File

@@ -344,12 +344,12 @@ class pageClass
} }
$sql = e107::getDb(); $sql = e107::getDb();
$query = "SELECT p.*, u.user_id, u.user_name, user_login FROM #page AS p $query = "SELECT p.*, u.user_id, u.user_name, user_login FROM #page AS p
LEFT JOIN #user AS u ON p.page_author = u.user_id LEFT JOIN #user AS u ON p.page_author = u.user_id
WHERE p.page_id=".intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later WHERE p.page_id=".intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later
if(!$sql->db_Select_gen($query)) if(!$sql->gen($query))
{ {
$ret['title'] = LAN_PAGE_12; // ***** CHANGED $ret['title'] = LAN_PAGE_12; // ***** CHANGED
$ret['sub_title'] = ''; $ret['sub_title'] = '';
@@ -364,13 +364,19 @@ class pageClass
$this->batch = e107::getScBatch('page',null,'cpage')->setVars(new e_vars($ret))->setScVar('page', array()); $this->batch = e107::getScBatch('page',null,'cpage')->setVars(new e_vars($ret))->setScVar('page', array());
define("e_PAGETITLE", $ret['title']); define("e_PAGETITLE", $ret['title']);
return; return;
} }
$this->page = $sql->db_Fetch(); $this->page = $sql->fetch();
$this->template = e107::getCoreTemplate('page', vartrue($this->page['page_template'], 'default')); $this->template = e107::getCoreTemplate('page', vartrue($this->page['page_template'], 'default'), true, true);
if(empty($this->template)) $this->template = e107::getCoreTemplate('page', 'default'); // $this->template = e107::getCoreTemplate('page', 'default',true,true);
// print_a($this->template);
if(empty($this->template))
{
$this->template = e107::getCoreTemplate('page', 'default');
}
$this->batch = e107::getScBatch('page',null,'cpage'); $this->batch = e107::getScBatch('page',null,'cpage');
@@ -454,17 +460,21 @@ class pageClass
public function showPage() public function showPage()
{ {
if(null !== $this->cacheData) if(null !== $this->cacheData)
{ {
return $this->renderCache(); return $this->renderCache();
} }
if(true === $this->authorized) if(true === $this->authorized)
{ {
$vars = $this->batch->getParserVars(); $vars = $this->batch->getParserVars();
$template = str_replace('{PAGECOMMENTS}', '[[PAGECOMMENTS]]', $this->template['start'].$this->template['body'].$this->template['end']); $template = str_replace('{PAGECOMMENTS}', '[[PAGECOMMENTS]]', $this->template['start'].$this->template['body'].$this->template['end']);
$ret = $this->renderPage($template); $ret = $this->renderPage($template);
if(!empty($this->template['page'])) if(!empty($this->template['page']))
{ {
$ret = str_replace(array('{PAGE}', '{PAGECOMMENTS}'), array($ret, '[[PAGECOMMENTS]]'), $this->template['page']); $ret = str_replace(array('{PAGE}', '{PAGECOMMENTS}'), array($ret, '[[PAGECOMMENTS]]'), $this->template['page']);