File indexing completed on 2024-12-29 05:24:44

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 $helperFetchCategory = new Default_View_Helper_CatTitle();
0024 $helperFetchCatParent = new Default_View_Helper_CatParent();
0025 $getAuthUser = new Default_View_Helper_GetAuthUser();
0026 $helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl();
0027 $helperBuildBaseUrl = new Default_View_Helper_BuildBaseUrl();
0028 $helperImage = new Default_View_Helper_Image();
0029 $auth = Zend_Auth::getInstance();
0030 $member = $getAuthUser->getAuthUser();
0031 $phash = null;
0032 $ltat = null;
0033 if ($auth->hasIdentity()) {
0034     $sess = new Zend_Session_Namespace('ocs_meta');
0035     $phash = $sess->phash;
0036     $ltat = $sess->openid;
0037 }
0038 
0039 $jsonmember = null;
0040 if($member && !empty($member->username)){
0041     $jsonmember=array(
0042         'member_id' => $member->member_id,
0043         'username' => $member->username,
0044         'avatar' => $member->avatar,
0045         'profile_image_url' => $member->profile_image_url
0046     );
0047 }
0048 
0049 
0050 $serverUrl = $this->serverUrl();
0051 
0052 $baseurl = Zend_Registry::get('config')->settings->client->default->baseurl;
0053 
0054 $searchbaseurl = $this->buildSearchBaseUrl();
0055 $sname = Zend_Registry::get('store_host');
0056 $store_config = Zend_Registry::get('store_config');
0057 $store_order = $store_config->order;
0058 $store_name = $store_config->name;
0059 $is_show_title = $store_config->is_show_title;
0060 $last_char_store_order = substr($store_order, -1);
0061 
0062 //Is stayInContext and in Teamplate is set a Footer Header == show the text from tmeplate in page header
0063 $stay_in_context = $store_config->stay_in_context;
0064 $header_links = $this->template['trademark']['text'];
0065 $show_header_links = false;
0066 if($stay_in_context == 1 && $header_links != '') {
0067     $show_header_links = true;
0068 } else {
0069     $header_links = "";
0070 }
0071 
0072 $url_forum = Zend_Registry::get('config')->settings->client->default->url_forum;
0073 $url_gitlab = Zend_Registry::get('config')->settings->client->default->url_gitlab;
0074 $url_blog = Zend_Registry::get('config')->settings->client->default->url_blog;
0075 $config_domain = $config = Zend_Registry::get('config')->settings->domain;
0076 $url_openid = $config_domain->openid->host;
0077 
0078 /** @var Zend_Controller_Request_Http $request */
0079 $request = Zend_Controller_Front::getInstance()->getRequest();
0080 $http_scheme = $request->getScheme();
0081 
0082 $json_menu = $this->fetchMetaheaderMenuJson();
0083 $json_tree = $this->fetchStoresForCatTreeJson();
0084 
0085 
0086 $filter = new Local_Filter_Url_Encrypt();
0087 //$thisurl = $helperBuildBaseUrl->buildBaserUrl();
0088 $thisurl = "/";
0089 if(isset($_GET['url'])) {
0090     $thisurl = $_GET['url'];
0091 }
0092 $url_logout = "/logout?redirect=".$filter->filter($thisurl);
0093 $url_login = "/logint?redirect=".$filter->filter($thisurl);
0094 
0095 
0096 
0097 $cat_title = $helperFetchCategory->catTitle($this->cat_id);
0098 $category_id = $this->cat_id;
0099 $category_id_parent = $helperFetchCatParent->getCatParentId(array('project_category_id' =>  $category_id));
0100 $cat_title_length = strlen($cat_title);
0101 //check logo-width:
0102 $logoWidth = (int)$this->template['header-logo']['width'];
0103 $cat_title_left = (int)$logoWidth + (int)strlen($store_name)+120;
0104 $tabs_left = (int)$this->template['header-nav-tabs']['absolute-left'];
0105 $tabs_left += $cat_title_length*10;
0106 echo $this->render('partials/header/metaheader.phtml');
0107 
0108 ?>
0109 
0110 
0111 
0112 <script type="text/javascript">
0113     var json_hasIdentity = <?php  if( $auth->hasIdentity() ) { echo '1' ;} else { echo '0';} ?>;
0114     var json_redirectString = <?php  if( $auth->hasIdentity() ) { echo Zend_Json::encode(null);} else {
0115     $helperEncryptUrl = new Default_View_Helper_EncryptUrl();
0116     $redirectString = '/redirect/' . $helperEncryptUrl->EncryptUrl(Zend_Controller_Front::getInstance()->getRequest()->getScheme() . '://' . Zend_Controller_Front::getInstance()->getRequest()->getHttpHost().$_SERVER["REQUEST_URI"]);
0117     echo Zend_Json::encode($redirectString);} ?>;
0118     var json_serverUri = <?php echo Zend_Json::encode($_SERVER["REQUEST_URI"]);?>;
0119     var json_member = <?php echo Zend_Json::encode($jsonmember); ?>;     
0120     var json_member_avatar = <?php if( $auth->hasIdentity() ) {                
0121         echo Zend_Json::encode($this->Image($member->profile_image_url,array('width' => 30, 'height' => 30)));
0122     } else { echo Zend_Json::encode(null);}?>;
0123     var json_template = <?php echo Zend_Json::encode($this->template); ?>;
0124     var json_serverUrl = <?php echo Zend_Json::encode($serverUrl); ?>;
0125     var json_baseurl = <?php echo  Zend_Json::encode($baseurl);?>;
0126     var json_searchbaseurl = <?php echo  Zend_Json::encode($searchbaseurl);?>;    
0127     var json_sname =  <?php echo  Zend_Json::encode($sname);?>;
0128     var json_store_order =  <?php echo  Zend_Json::encode($store_order);?>;
0129     var json_store_name =  <?php echo  Zend_Json::encode($store_name);?>;
0130     var json_is_show_title =  <?php echo  Zend_Json::encode($is_show_title);?>;
0131     var json_last_char_store_order = <?php echo  Zend_Json::encode($last_char_store_order);?>;
0132     var json_cat_title =  <?php echo  Zend_Json::encode($cat_title);?>;
0133     var json_cat_id =  <?php echo  Zend_Json::encode($category_id);?>;
0134     var json_logoWidth = <?php echo  Zend_Json::encode($logoWidth);?>;
0135     var json_cat_title_left = <?php echo  Zend_Json::encode($cat_title_left);?>;
0136     var json_tabs_left = <?php echo  Zend_Json::encode($tabs_left);?>;
0137     
0138     var json_header_links = <?php echo Zend_Json::encode($header_links); ?>;
0139     
0140     <?php
0141     $contentTheme = '';
0142     if (Zend_Auth::getInstance()->hasIdentity()){
0143         $identity = Zend_Auth::getInstance()->getStorage()->read();
0144         $settingmodel = new Default_Model_MemberSettingValue();
0145         $result = $settingmodel->fetchMemberSettingItem($identity->member_id,2);
0146         if($result && $result['value']==1)
0147         {
0148             $contentTheme = 'content-theme-dark';
0149         }
0150     }
0151     ?>
0152     var json_content_theme = <?php echo  Zend_Json::encode($contentTheme);?>; 
0153     
0154     var json_loginurl = <?php echo Zend_Json::encode($url_login); ?>;  
0155     var json_logouturl = <?php echo Zend_Json::encode($url_logout); ?>;  
0156     
0157     var json_store_for_tree = <?php echo $json_tree; ?>;
0158 
0159     var json_server_images = <?php echo Zend_Json::encode(IMAGES_MEDIA_SERVER); ?>;
0160     var json_server_videos = <?php echo Zend_Json::encode(VIDEOS_MEDIA_SERVER); ?>;
0161     var json_server_comics = <?php echo Zend_Json::encode(COMICS_MEDIA_SERVER); ?>;
0162 </script>
0163 <script type="text/javascript" src="/theme/react/lib/react/react.production.min.js"></script>
0164 <script type="text/javascript" src="/theme/react/lib/react-dom/react-dom.production.min.js"></script>
0165 
0166 
0167 <?php $this->inlineScript()->appendScript(
0168     '$(document).ready(function(){
0169         MenuHover.setup();
0170         Popuppanel.setup();
0171         LoginContainer.update();
0172         PlingsRedirect.setup();
0173     });'
0174 );