2013-10-08 12:24:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by JetBrains PhpStorm.
|
|
|
|
* User: Fawaz
|
|
|
|
* Date: 8/28/13
|
|
|
|
* Time: 12:20 PM
|
|
|
|
* To change this template use File | Settings | File Templates.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//Redirect Using JAVASCRIPT
|
|
|
|
|
|
|
|
function redirect_to($url){
|
|
|
|
echo '<script type="text/javascript">
|
|
|
|
window.location = "'.$url.'"
|
|
|
|
</script>';
|
|
|
|
exit("Javascript is turned off, <a href='$url'>click here to go to requested page</a>");
|
|
|
|
}
|
|
|
|
|
|
|
|
//Test function to return template file
|
|
|
|
function Fetch($name,$inside=FALSE)
|
|
|
|
{
|
2014-01-31 13:17:52 +00:00
|
|
|
global $cbtpl;
|
|
|
|
if($inside){
|
|
|
|
$file = $cbtpl->fetch($name);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
//var_dump($name);die();
|
|
|
|
$file = $cbtpl->fetch(LAYOUT.'/'.$name);
|
|
|
|
}
|
2013-10-08 12:24:07 +00:00
|
|
|
|
|
|
|
return $file;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Simple Template Displaying Function
|
|
|
|
|
|
|
|
function Template($template,$layout=true){
|
2013-11-09 14:20:22 +00:00
|
|
|
global $admin_area,$cbtpl;
|
2013-10-08 12:24:07 +00:00
|
|
|
if($layout)
|
2013-11-09 14:20:22 +00:00
|
|
|
$cbtpl->display(LAYOUT.'/'.$template);
|
2013-10-08 12:24:07 +00:00
|
|
|
else
|
2013-11-09 14:20:22 +00:00
|
|
|
$cbtpl->display($template);
|
2013-10-08 12:24:07 +00:00
|
|
|
|
|
|
|
if($template == 'footer.html' && $admin_area !=TRUE){
|
2013-11-09 14:20:22 +00:00
|
|
|
$cbtpl->display(BASEDIR.'/includes/templatelib/'.$template);
|
2013-10-08 12:24:07 +00:00
|
|
|
}
|
|
|
|
if($template == 'header.html'){
|
2013-11-09 14:20:22 +00:00
|
|
|
$cbtpl->display(BASEDIR.'/includes/templatelib/'.$template);
|
2013-10-08 12:24:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Assign($name,$value)
|
|
|
|
{
|
2013-11-09 14:20:22 +00:00
|
|
|
global $cbtpl;
|
|
|
|
$cbtpl->assign($name,$value);
|
2013-11-10 16:19:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return Head menu of CLipBucket front-end
|
|
|
|
*
|
|
|
|
* @param Array $params
|
|
|
|
* @return Array
|
|
|
|
*/
|
2013-11-18 14:59:33 +00:00
|
|
|
function cb_menu($params=NULL){ global $Cbucket; return $Cbucket->cbMenu($params); }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function used to call display
|
|
|
|
*/
|
|
|
|
function display_it()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2016-05-27 16:12:24 +05:00
|
|
|
global $ClipBucket, $db,$__devmsgs;
|
2013-11-18 14:59:33 +00:00
|
|
|
$dir = LAYOUT;
|
2016-05-27 16:12:24 +05:00
|
|
|
if (is_array($__devmsgs)) {
|
|
|
|
#pr($__devmsgs,true);
|
|
|
|
assign("thebase", BASEDIR);
|
|
|
|
assign("__devmsgs",$__devmsgs);
|
|
|
|
}
|
2013-11-18 14:59:33 +00:00
|
|
|
foreach($ClipBucket->template_files as $file)
|
|
|
|
{
|
2014-02-18 14:02:48 +00:00
|
|
|
if(file_exists(LAYOUT.'/'.$file['file']) || is_array($file))
|
2013-11-18 14:59:33 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(!$ClipBucket->show_page && $file['follow_show_page'])
|
|
|
|
{
|
|
|
|
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
if(!is_array($file))
|
|
|
|
$new_list[] = $file;
|
|
|
|
else
|
|
|
|
{
|
2014-02-18 14:02:48 +00:00
|
|
|
if(isset($file['folder']) && file_exists($file['folder'].'/'.$file['file']))
|
2013-11-18 14:59:33 +00:00
|
|
|
$new_list[] = $file['folder'].'/'.$file['file'];
|
|
|
|
else
|
|
|
|
$new_list[] = $file['file'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assign('template_files',$new_list);
|
|
|
|
|
|
|
|
Template('body.html');
|
|
|
|
|
|
|
|
footer();
|
|
|
|
}catch(SmartyException $e)
|
|
|
|
{
|
|
|
|
show_cb_error($e);
|
|
|
|
}
|
|
|
|
}
|