HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/NVonken/mijneigenlied.com/wwwroot/Core/Components/pager.com.php
<?php
	
	General::Load("Page");
	General::Load("Column");
	General::Load("Photo");
	
	class pager
	{
	
		var $_tpl;
		
		public static function Settings()
		{
			return array(	"Pageable" 			=> false,
							"DisplayName" 		=> "Page",
							"Version" 			=> 1.0,
							"HasAdmin"			=> false,
							"Filename"			=> "page.com.php");
		}

        public function __construct()
        {
            General::Load("Page");
            General::Load("Column");
            General::Load("Photo");
            General::Load("HatchPage");

            $this->_tpl = new tpl();
        }

		public function Run()
		{
            $page = null;
            if(!defined("GET_1"))
            {
                $hatchPage = General::MapArray(HatchPage::SelectByHatch(ACTIVE_HATCH_ID), "Language");
                if(isset($hatchPage[strtoupper(ACTIVE_LANGUAGE)]))
                    $page = Page::Select($hatchPage[strtoupper(ACTIVE_LANGUAGE)]->PageId);
            }
			else
			{
                $page = Page::SelectBySlug(GET_1, ACTIVE_LANGUAGE);
			}

			$scriptTags = "";
			$description = "";
			$template = DEFAULT_TEMPLATE;
			
			if($page != null)
			{
				$template = $page->Template;
                $description = $page->PageDescription;
                $title = $page->PageTitle;

				if($page->ContentType == "component")
				{
					$componentInfo = explode(";", $page->Component);
					require_once("Core/Components/".$componentInfo[0]);
					$componentName = substr($componentInfo[0], 0, strpos($componentInfo[0], "."));
					$com = new $componentName();
					$content = $com->Run($componentInfo[1]);
					$dependancies = $com->Dependancies();
					if(isset($dependancies["js"]) && count($dependancies["js"]) > 0)
					{
						foreach($dependancies["js"] as $js)
						{
							$this->_tpl->assign("file", $js);
							$scriptTags .= $this->_tpl->parse("General/script-tag");
						}
					}
					if(isset($dependancies["css"]) && count($dependancies["css"]) > 0)
					{
						foreach($dependancies["css"] as $css)
						{
							$this->_tpl->assign("file", $css);
							$scriptTags .= $this->_tpl->parse("General/css-tag");
						}
					}
				}
				elseif($page->ContentType == "columns")
				{
					$columns = Column::SelectByPage($page->Id);
					$columnWidth = floor(100 / count($columns));
                    $content = "";
					foreach($columns as $column)
					{
						switch($column->Type)
						{
							case "text":
								$this->_tpl->assign("content", $column->Text);
								$this->_tpl->assign("width", $columnWidth);
							break;
							case "element":
								require_once("Core/Page Elements/".$column->Element);
								$elementName = "Element_".substr($column->Element, 0, strpos($column->Element, "."));
								$element = new $elementName();
								$this->_tpl->assign("content", $element->Run());
								$this->_tpl->assign("width", $columnWidth);
							break;
							case "photo":
								$photoIds = explode(",", $column->Photos);
								$photos = Photo::SelectRange($photoIds);
                                $photoContent = "";
                                $scriptTags = '<link rel="stylesheet" href="'.SETTING_ROOT.'/images/fancybox/jquery.fancybox-1.3.4.css"><script type="text/javascript" src="'.SETTING_ROOT.'/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script><script type="text/javascript">$(document).ready(function(){$(".fancyboxImage").fancybox();});</script>';
								foreach($photos as $photo)
								{
                                    $this->_tpl->assign("file", SETTING_ROOT."/uploads/".$photo->Filename.".jpg");
                                    $this->_tpl->assign("fileThumb", SETTING_ROOT."/uploads/thumbs/".$photo->Filename.".jpg");
									$this->_tpl->assign("width", "100%");
                                    $this->_tpl->assign("columnId", $column->Id);
									$photoContent .= $this->_tpl->parse("Page/image");
								}
								$this->_tpl->assign("content", $photoContent);
								$this->_tpl->assign("width", $columnWidth);
                            break;
						}
                        if($page->HorizontalColumns != 0)
                            $content .= $this->_tpl->parse("Page/column");
                        else
                            $content .= $this->_tpl->parse("Page/column-horizontal");
					}
				}
			}
			else
			{
				if(!defined("GET_1") || strpos(GET_1,'.') !== false || !file_exists("Core/Components/".GET_1.".com.php"))
				{
					$content = $this->_tpl->parse("General/404");
				}
				else 
				{
                    $comName = GET_1;
					include("Core/Components/".$comName.".com.php");
					$com = new $comName();
					return $com->Run();
				}
							
			}
			$this->_tpl->assign("Content", $content);
			$this->_tpl->assign("scriptTags", $scriptTags);
            $this->_tpl->assign("pageDescription", $description);
            $this->_tpl->assign("pageTitle", $title);
            $this->_tpl->assign("pageSlug", General::UrlSafe($title));

			return $this->_tpl->parse("Layout/".$template);
		}

		public function Admin()
		{
		
		}
	}

?>