Initial commit
This commit is contained in:
79
production/includes/content/viewDoc.inc.php
Normal file
79
production/includes/content/viewDoc.inc.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| viewDoc.inc.php
|
||||
| ========================================
|
||||
| Displays a site document
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
// query database
|
||||
|
||||
if (!defined('CC_INI_SET')) die('Access Denied');
|
||||
|
||||
// include lang file
|
||||
$lang = getLang('includes'.CC_DS.'content'.CC_DS.'viewDoc.inc.php');
|
||||
|
||||
$_GET['docId'] = sanitizeVar($_GET['docId']);
|
||||
|
||||
if (LANG_FOLDER !== $config['defaultLang']) {
|
||||
$result = $db->select("SELECT doc_name, doc_content FROM ".$glob['dbprefix']."CubeCart_docs_lang WHERE doc_master_id = ".$db->mySQLSafe($_GET['docId'])." AND doc_lang=".$db->mySQLSafe(LANG_FOLDER));
|
||||
if ($config['seftags']) {
|
||||
// get metas for the docs
|
||||
$sefresult = $db->select("SELECT doc_metatitle, doc_metadesc, doc_metakeywords FROM ".$glob['dbprefix']."CubeCart_docs WHERE doc_id = ".$db->mySQLSafe($_GET['docId']));
|
||||
$result['sefSiteTitle'] = $sefresult['sefSiteTitle'];
|
||||
$result['sefSiteDesc'] = $sefresult['sefSiteDesc'];
|
||||
$result['sefSiteKeywords'] = $sefresult['sefSiteKeywords'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($result) || !$result) {
|
||||
if($config['seftags']) {
|
||||
$result = $db->select("SELECT doc_metatitle, doc_metadesc, doc_metakeywords, doc_name, doc_content FROM ".$glob['dbprefix']."CubeCart_docs WHERE doc_id = ".$db->mySQLSafe($_GET['docId']));
|
||||
} else {
|
||||
$result = $db->select("SELECT doc_name, doc_content FROM ".$glob['dbprefix']."CubeCart_docs WHERE doc_id = ".$db->mySQLSafe($_GET['docId']));
|
||||
}
|
||||
}
|
||||
|
||||
$view_doc = new XTemplate('content'.CC_DS.'viewDoc.tpl');
|
||||
|
||||
if (isset($result) && $result) {
|
||||
$view_doc->assign('DOC_NAME', validHTML($result[0]['doc_name']));
|
||||
$view_doc->assign('DOC_CONTENT', (!get_magic_quotes_gpc ()) ? stripslashes($result[0]['doc_content']) : $result[0]['doc_content']);
|
||||
|
||||
if ($config['seftags']) {
|
||||
$meta['siteTitle'] = $result[0]['doc_name'];
|
||||
$meta['metaDescription'] = substr(strip_tags($result[0]['doc_content']), 0, 35);
|
||||
$meta['sefSiteTitle'] = $result[0]['doc_metatitle'];
|
||||
$meta['sefSiteDesc'] = $result[0]['doc_metadesc'];
|
||||
$meta['sefSiteKeywords'] = $result[0]['doc_metakeywords'];
|
||||
} else {
|
||||
$meta['siteTitle'] = $config['siteTitle'].' - '.$result[0]['doc_name'];
|
||||
$meta['metaDescription'] = substr(strip_tags($result[0]['doc_content']), 0, 35);
|
||||
}
|
||||
} else {
|
||||
$view_doc->assign('DOC_NAME', $lang['viewDoc']['error']);
|
||||
$view_doc->assign('DOC_CONTENT', $lang['viewDoc']['does_not_exist']);
|
||||
}
|
||||
|
||||
$view_doc->parse('view_doc');
|
||||
$page_content = $view_doc->text('view_doc');
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user