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

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 $config = Zend_Registry::get('config')->settings->domain->base;
0023 $metaDomain = $config->host;
0024 
0025 $this->headTitle($_SERVER['HTTP_HOST'], 'SET');
0026 $this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA);
0027 $this->headMeta()->appendProperty('og:url', $metaDomain);
0028 $this->headMeta()->appendProperty('og:type', 'website');
0029 $this->headMeta()->appendProperty('og:title', $metaDomain);
0030 $this->headMeta()->appendProperty('og:site_name',$metaDomain);
0031 $this->headMeta()->appendProperty('og:description','Libre Cloud Services for users and developers. Keep your personal data save, start new projects, share apps, files and products, communicate freely with friends and colleagues.');
0032 $this->headMeta()->appendProperty('og:image','https://www.opendesktop.org/images/system/opendesktop-logo.png');
0033 
0034 
0035 $modelInfo = new Default_Model_Info();
0036 $helpPrintDate = new Default_View_Helper_PrintDate();
0037 $helperImage = new Default_View_Helper_Image();
0038 
0039 $config = Zend_Registry::get('config')->settings->client->default;
0040 $baseurl = $config->baseurl;
0041 $baseurlStore = $config->baseurl_store;
0042 $url_forum = $config->url_forum;
0043 $url_blog = $config->url_blog;
0044 $url_gitlab = $config->url_gitlab;
0045 $url_riot = $config->url_riot;
0046 $url_myopendesktop = $config->url_myopendesktop;
0047 $url_cloudopendesktop = $config->url_cloudopendesktop;
0048 $url_musicopendesktop = $config->url_musicopendesktop;
0049 $url_mastodon = $config->url_mastodon;
0050 $url_docsopendesktop = $config->url_docsopendesktop;
0051 
0052 $helperUserRole = new Backend_View_Helper_UserRole();
0053 $userRoleName = $helperUserRole->userRole();
0054 $isAdmin = false;
0055 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) {
0056     $isAdmin = true;
0057 }
0058 if (Zend_Auth::getInstance()->hasIdentity()){
0059     $identity = Zend_Auth::getInstance()->getStorage()->read();
0060     $avatar = $helperImage->image($identity->profile_image_url,array('width' => 100, 'height' => 100, 'crop' => 2));
0061     $user = array(
0062         "username" => $identity->username,
0063         "member_id" => $identity->member_id,
0064         "mail" => $identity->mail,
0065         "avatar" => $avatar,
0066         "roleName" =>$identity->roleName,
0067         "isAdmin" => $isAdmin
0068     );
0069 
0070     $tableProduct = new Default_Model_Project();
0071     $productsRowset = $tableProduct->fetchAllProjectsForMember($identity->member_id,5);
0072     $products = array();
0073     foreach ($productsRowset as $row) {
0074         $products[] = $row;
0075     }
0076     
0077     $parray=array();
0078     foreach ($products as $p) {      
0079       // $tmp= array('project_id'=> $p->project_id
0080       // , 'image_small'=>$this->Image($p->image_small, array('width' => 200, 'height' => 200))
0081       // , 'title' => $p->title
0082       // ,'laplace_score' =>$p->laplace_score
0083       // ,'cat_title' =>$p->cat_title
0084       // ,'updated_at' => $helpPrintDate->printDate(($p->changed_at==null?$p->created_at:$p->changed_at))
0085       // ) ; 
0086 
0087       $tmp= array('project_id'=> $p->project_id    
0088       , 'image_small'=>$this->Image($p->image_small, array('width' => 200, 'height' => 200))  
0089       , 'title' => $p->title
0090       ,'laplace_score' =>$p->laplace_score*10
0091       ,'cat_title' =>$p->catTitle
0092       ,'updated_at' => $helpPrintDate->printDate(($p->changed_at==null?$p->created_at:$p->changed_at))
0093       ) ; 
0094       $parray[] = $tmp;
0095     }
0096   
0097 
0098     $comments = $modelInfo->getLastCommentsForUsersProjects($identity->member_id);
0099     $commentsmoderation = $modelInfo->getLastCommentsForUsersProjects($identity->member_id,10,Default_Model_DbTable_Comments::COMMENT_TYPE_MODERATOR);
0100     $votes = $modelInfo->getLastVotesForUsersProjects($identity->member_id);
0101     $spams = $modelInfo->getLastSpamProjects($identity->member_id);    
0102     foreach ($comments as &$p) {
0103       $p['profile_image_url'] = $this->Image($p['profile_image_url'], array('width' => 200, 'height' => 200));
0104       $p['comment_created_at'] = $helpPrintDate->printDate($p['comment_created_at']);
0105     }
0106     foreach ($commentsmoderation as &$p) {
0107       $p['profile_image_url'] = $this->Image($p['profile_image_url'], array('width' => 200, 'height' => 200));
0108       $p['comment_created_at'] = $helpPrintDate->printDate($p['comment_created_at']);
0109     }
0110     foreach ($votes as &$p) {
0111       $p['profile_image_url'] = $this->Image($p['profile_image_url'], array('width' => 200, 'height' => 200));
0112       $p['created_at'] = $helpPrintDate->printDate($p['created_at']);
0113     }
0114 
0115     foreach ($spams as &$p) {
0116       $p['image_small'] = $this->Image($p['image_small'], array('width' => 200, 'height' => 200));
0117       $p['updated_at'] = $helpPrintDate->printDate(($p['changed_at']==null?$p['created_at']:$p['changed_at']));
0118     }
0119     $tableMembers = new Default_Model_Member();
0120     $supporterinfo = $tableMembers->fetchSupporterDonationInfo($identity->member_id);
0121 
0122     $response = array(
0123       'user' => $user,
0124       'products' => $parray,
0125       'supporterinfo' => $supporterinfo,
0126       'comments' =>$comments,
0127       'commentsmoderation' =>$commentsmoderation,
0128       'votes' => $votes,
0129       'spams' => $spams,
0130       "baseUrl" => $baseurl,
0131       "baseUrlStore" => $baseurlStore,
0132       "blogUrl" => $url_blog,
0133       "forumUrl" => $url_forum,
0134       "mastodonUrl" => $url_mastodon,
0135       "gitlabUrl" => $url_gitlab,
0136       "riotUrl" => $url_riot,
0137       "url_myopendesktop" => $url_myopendesktop,
0138       "url_cloudopendesktop" => $url_cloudopendesktop,
0139       "url_musicopendesktop" => $url_musicopendesktop,
0140       "url_docsopendesktop" => $url_docsopendesktop,
0141       "url_mastodon" => $url_mastodon,
0142     );
0143 }else
0144 {
0145 
0146 
0147     $productsAppAddons = $modelInfo->getLastProductsForHostStores(5,'152,233');
0148     $productsThemes = $modelInfo->getLastProductsForHostStores(5,'148');
0149     $productsMultimedia = $modelInfo->getLastProductsForHostStores(5,'586');
0150     $comments = $modelInfo->getLatestComments(5);
0151     foreach ($productsAppAddons as &$p) {
0152       $p['image_small'] = $this->Image($p['image_small'], array('width' => 200, 'height' => 200));
0153       $p['updated_at'] = $helpPrintDate->printDate(($p['changed_at']==null?$p['created_at']:$p['changed_at']));
0154     }
0155     foreach ($productsThemes as &$p) {
0156       $p['image_small'] = $this->Image($p['image_small'], array('width' => 200, 'height' => 200));
0157       $p['updated_at'] = $helpPrintDate->printDate(($p['changed_at']==null?$p['created_at']:$p['changed_at']));
0158     }
0159     foreach ($productsMultimedia as &$p) {
0160       $p['image_small'] = $this->Image($p['image_small'], array('width' => 200, 'height' => 200));
0161       $p['updated_at'] = $helpPrintDate->printDate(($p['changed_at']==null?$p['created_at']:$p['changed_at']));
0162     }
0163     foreach ($comments as &$p) {
0164       $p['profile_image_url'] = $this->Image($p['profile_image_url'], array('width' => 200, 'height' => 200));
0165       $p['comment_created_at'] = $helpPrintDate->printDate($p['comment_created_at']);
0166     }
0167 
0168 
0169 
0170     $response = array(
0171       'comments' => $comments,
0172       'products' => $productsAppAddons,
0173       'productsThemes' => $productsThemes,
0174       'productsMultimedia' => $productsMultimedia,
0175       "baseUrl" => $baseurl,
0176       "baseUrlStore" => $baseurlStore,
0177       "blogUrl" => $url_blog,
0178       "forumUrl" => $url_forum,
0179       "mastodonUrl" => $url_mastodon,
0180       "gitlabUrl" => $url_gitlab,
0181       "riotUrl" => $url_riot,
0182       "url_myopendesktop" => $url_myopendesktop,
0183       "url_cloudopendesktop" => $url_cloudopendesktop,
0184       "url_musicopendesktop" => $url_musicopendesktop,
0185       "url_mastodon" => $url_mastodon,
0186       
0187     );
0188 
0189 
0190 }
0191 
0192 ?>
0193 
0194 <div class="tooltip_templates" style="display:none">
0195       <span id="tooltip_content">
0196           <i class="fa fa-spinner"></i>
0197       </span>
0198 </div>
0199 <main class="startpage-store-new">      
0200       <div id="main-content"></div>
0201       <script type="text/javascript">
0202         var page = "opendesktop";
0203         var hpVersion = 2;
0204         var data = <?php echo Zend_Json::encode($response)?>;
0205       </script>
0206       <script src="/theme/react/bundle/home-main-container-bundle.js" type="text/javascript"></script>      
0207       
0208 </main>