diff --git a/application/modules/default/controllers/HomeController.php b/application/modules/default/controllers/HomeController.php
index f342e254c..75ebff0fc 100644
--- a/application/modules/default/controllers/HomeController.php
+++ b/application/modules/default/controllers/HomeController.php
@@ -1,520 +1,523 @@
.
**/
class HomeController extends Local_Controller_Action_DomainSwitch
{
public function indexAction()
{
/** @var Default_Model_ConfigStore $storeConfig */
$storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null;
if ($storeConfig) {
$this->view->package_type = $storeConfig->package_type;
if($storeConfig->isShowHomepage())
{
$test = (int)$this->getParam('test', 0);
if($test==1)
{
$this->_helper->viewRenderer('index-' . $storeConfig->config_id_name.'-test');
}else{
$this->_helper->viewRenderer('index-' . $storeConfig->config_id_name);
}
return;
}
}
$params = array('ord' => 'latest');
if ($this->hasParam('domain_store_id')) {
$params['domain_store_id'] = $this->getParam('domain_store_id');
}
$this->forward('index', 'explore', 'default', $params);
}
public function indexAction_()
{
$storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null;
$storePackageTypeIds = null;
if ($storeConfig) {
$this->view->package_type = $filter['package_type'] = $storeConfig['package_type'];
}
Zend_Registry::get('logger')->debug('*** SHOW_HOME_PAGE: ' . getenv('SHOW_HOME_PAGE'));
/**
* The SHOW_HOME_PAGE environment var will be set in apache .htaccess for some specific host names
* e.g.
* SetEnvIfNoCase Host opendesktop\.org$ SHOW_HOME_PAGE
*/
if (false == $this->hasParam('domain_store_id') AND getenv('SHOW_HOME_PAGE')) {
$this->_helper->viewRenderer('index-' . $this->getNameForStoreClient());
return;
}
// forward is the faster way, but you have no influence to the url. On redirect the url changes.
$params = array('ord' => 'latest');
if ($this->hasParam('domain_store_id')) {
$params['domain_store_id'] = $this->getParam('domain_store_id');
}
$this->forward('index', 'explore', 'default', $params);
}
public function showfeatureajaxAction()
{
$this->_helper->layout->disableLayout();
$modelInfo = new Default_Model_Info();
$page = (int)$this->getParam('page');
if($page==0){
$featureProducts = $modelInfo->getRandProduct();
$featureProducts->setItemCountPerPage(1);
$featureProducts->setCurrentPageNumber(1);
}else{
$featureProducts = $modelInfo->getFeaturedProductsForHostStores(100);
if($featureProducts->getTotalItemCount() > 0){
$offset = (int)$this->getParam('page');
$irandom = rand(1,$featureProducts->getTotalItemCount());
$featureProducts->setItemCountPerPage(1);
$featureProducts->setCurrentPageNumber($irandom);
}
}
if ($featureProducts->getTotalItemCount() > 0) {
$this->view->featureProducts = $featureProducts;
$this->_helper->viewRenderer('/partials/featuredProducts');
// $this->_helper->json($featureProducts);
}
}
public function showfeaturejsonAction()
{
$this->_helper->layout->disableLayout();
$modelInfo = new Default_Model_Info();
$page = (int)$this->getParam('page');
if($page==0){
$featureProducts = $modelInfo->getRandProduct();
$featureProducts->setItemCountPerPage(1);
$featureProducts->setCurrentPageNumber(1);
}else{
$featureProducts = $modelInfo->getFeaturedProductsForHostStores(100);
if($featureProducts->getTotalItemCount() > 0){
$offset = (int)$this->getParam('page');
$irandom = rand(1,$featureProducts->getTotalItemCount());
$featureProducts->setItemCountPerPage(1);
$featureProducts->setCurrentPageNumber($irandom);
}
}
$item;
foreach ($featureProducts as $i) {
$item = $i;
break;
}
+ $helpCategories = new Default_View_Helper_FetchCategoriesForProductAsString();
$response = array(
'project_id' => $item['project_id'],
'member_id' => $item['member_id'],
'username' => $item['username'],
'profile_image_url' => $item['profile_image_url'],
'featured' => $item['featured'],
'description' => $item['description'],
+ 'title' => $item['title'],
+ 'category' => $helpCategories->fetchCategoriesForProductAsString($item['project_id']),
'image_small' => $item['image_small'],
'laplace_score' => $item['laplace_score'],
'count_likes' => $item['count_likes'],
'count_dislikes' => $item['count_dislikes'],
'changed_at' => $item['changed_at'],
'created_at' => $item['created_at'],
'count_comments' => $item['count_comments']
);
$this->_helper->json($response);
}
public function metamenujsAction()
{
$this->_helper->layout()->disableLayout();
header('Access-Control-Allow-Origin: *');
$this->getResponse()
->setHeader('Access-Control-Allow-Origin', '*')
->setHeader('Access-Control-Allow-Credentials', 'true')
->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
;
}
public function metamenubundlejsAction()
{
$this->_helper->layout()->disableLayout();
// header('Access-Control-Allow-Origin: *');
// $this->getResponse()
// ->setHeader('Access-Control-Allow-Origin', '*')
// ->setHeader('Access-Control-Allow-Credentials', 'true')
// ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
// ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
// ;
}
public function baseurlajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header('Access-Control-Allow-Origin: *');
$this->getResponse()
->setHeader('Access-Control-Allow-Origin', '*')
->setHeader('Access-Control-Allow-Credentials', 'true')
->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
;
$resultArray = array();
$baseurl = Zend_Registry::get('config')->settings->client->default->baseurl;
$resultArray['base_url'] = $baseurl;
$resultAll = array();
$resultAll['status'] = "success";
$resultAll['data'] = $resultArray;
$this->_helper->json($resultAll);
}
public function forumurlajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header('Access-Control-Allow-Origin: *');
$this->getResponse()
->setHeader('Access-Control-Allow-Origin', '*')
->setHeader('Access-Control-Allow-Credentials', 'true')
->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
;
$resultArray = array();
$url_forum = Zend_Registry::get('config')->settings->client->default->url_forum;
$resultArray['url_forum'] = $url_forum;
$resultAll = array();
$resultAll['status'] = "success";
$resultAll['data'] = $resultArray;
$this->_helper->json($resultAll);
}
public function blogurlajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header('Access-Control-Allow-Origin: *');
$this->getResponse()
->setHeader('Access-Control-Allow-Origin', '*')
->setHeader('Access-Control-Allow-Credentials', 'true')
->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
;
$resultArray = array();
$url_blog = Zend_Registry::get('config')->settings->client->default->url_blog;
$resultArray['url_blog'] = $url_blog;
$resultAll = array();
$resultAll['status'] = "success";
$resultAll['data'] = $resultArray;
$this->_helper->json($resultAll);
}
public function storenameajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header('Access-Control-Allow-Origin: *');
$this->getResponse()
->setHeader('Access-Control-Allow-Origin', '*')
->setHeader('Access-Control-Allow-Credentials', 'true')
->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
;
$resultArray = array();
$sname = Zend_Registry::get('store_host');
$resultArray['store_name'] = $sname;
$resultAll = array();
$resultAll['status'] = "success";
$resultAll['data'] = $resultArray;
$this->_helper->json($resultAll);
}
public function loginurlajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header('Access-Control-Allow-Origin: *');
$this->getResponse()
->setHeader('Access-Control-Allow-Origin', '*')
->setHeader('Access-Control-Allow-Credentials', 'true')
->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
;
$resultArray = array();
$url = $this->getParam('url');
$filterRedirect = new Local_Filter_Url_Encrypt();
$loginUrl = '/login?redirect=' . $filterRedirect->filter($url);
$resultArray['login_url'] = $loginUrl;
$resultAll = array();
$resultAll['status'] = "success";
$resultAll['data'] = $resultArray;
$this->_helper->json($resultAll);
}
public function domainsajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header('Access-Control-Allow-Origin: *');
$this->getResponse()
->setHeader('Access-Control-Allow-Origin', '*')
->setHeader('Access-Control-Allow-Credentials', 'true')
->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept')
;
$resultArray = array();
$domainobjects = $this->fetchMetaheaderMenuJson();
$resultArray['domains'] = $domainobjects;
$resultAll = array();
$resultAll['status'] = "success";
$resultAll['data'] = $resultArray;
$this->_helper->json($resultAll);
}
protected function setLayout()
{
$storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null;
if($storeConfig && $storeConfig->layout_home)
{
$this->_helper->layout()->setLayout($storeConfig->layout_home);
}else{
$this->_helper->layout()->setLayout('home_template');
}
}
private function fetchMetaheaderMenuJson()
{
$sname = Zend_Registry::get('store_host');
/** @var Zend_Cache_Core $cache */
$cache = Zend_Registry::get('cache');
$cacheName = __FUNCTION__ . md5($sname);
if (false == ($domainobjects = $cache->load($cacheName))) {
$tbl = new Default_Model_DbTable_ConfigStore();
$result = $tbl->fetchDomainObjects();
// sort Desktop manuelly to the front
$arrayDesktop = array();
$arrayRest = array();
foreach ($result as $obj) {
$o = $obj['order'];
$curOrder = floor($obj['order']/1000);
if($curOrder<10 or $curOrder>50) continue;
$obj['calcOrder'] = $curOrder;
$tmp = array();
$tmp['order'] = $obj['order'];
$tmp['calcOrder'] = $obj['calcOrder'];
$tmp['host'] = $obj['host'];
$tmp['name'] = $obj['name'];
if($curOrder==30) {
// Desktop set calcOrder = 9 manuelly put desktop in front
$tmp['calcOrder'] = 9;
$arrayDesktop[] = $tmp;
}else{
$arrayRest[] = $tmp;
}
}
$domainobjects = array_merge($arrayDesktop, $arrayRest);
$baseurl = Zend_Registry::get('config')->settings->client->default->baseurl;
// set group name manully
foreach ($domainobjects as &$obj) {
if($sname == $obj['host']){
$obj['menuactive'] = 1;
}else{
$obj['menuactive'] = 0;
}
$order = $obj['order'];
// z.b 150001 ende ==1 go real link otherwise /s/$name
$last_char_check = substr($order, -1);
if($last_char_check=='1')
{
$obj['menuhref'] = $obj['host'];
}else{
$obj['menuhref'] = $baseurl.'/s/'.$obj['name'];
}
switch ($obj['calcOrder']) {
case 9:
$obj['menugroup']='Desktops';
break;
case 10:
$obj['menugroup']='Applications';
break;
case 20:
$obj['menugroup']='Addons';
break;
case 40:
$obj['menugroup']='Artwork';
break;
case 50:
$obj['menugroup']='Other';
break;
}
}
$cache->save($domainobjects, $cacheName, array(), 28800);
}
return Zend_Json::encode($domainobjects);
}
/**
* @throws Exception
* @throws Zend_Exception
* @throws Zend_Form_Exception
*/
public function redirectmeAction()
{
$this->_helper->layout()->disableLayout();
//$this->_helper->viewRenderer->setNoRender(true);
$redir = "/";
if(isset($_GET['redirect'])) {
$redir = $_GET['redirect'];
$filter = new Local_Filter_Url_Decrypt();
$redir = $filter->filter($redir);
}
$this->view->redirect = $redir;
}
public function fetchforgitAction()
{
$this->_helper->layout()->disableLayout();
$tableProject = new Default_Model_Project();
$params = $this->getAllParams();
$action = 'fetch-products-for-git-project-id';
if($this->hasParam('target')) {
$action = $params['target'];
}
if($action == 'fetch-products-for-git-project-id') {
$gitProjectId = $params['project_id'];
$this->view->products = null;
if(isset($gitProjectId)) {
$products = $tableProject->fetchAll('status = 100 AND type_id = 1 AND is_gitlab_project = 1 AND gitlab_project_id = ' . $gitProjectId);
$helperImage = new Default_View_Helper_Image();
$viewArray = array();
$viewProjectArray = array();
foreach ($products as $product) {
$viewProjectArray = array();
$viewProjectArray['project_id'] = $product['project_id'];
$viewProjectArray['title'] = $product['title'];
$viewProjectArray['version'] = $product['version'];
$viewProjectArray['member_id'] = $product['member_id'];
$viewProjectArray['avatar'] = $helperImage->Image($product['image_small'], array('width' => 100, 'height' => 100));
$viewArray[] = $viewProjectArray;
}
$this->view->viewdata = $viewArray;
}
} else {
$this->view->viewdata = array();
}
}
}
diff --git a/application/modules/default/views/scripts/home/index-opendesktop-test.phtml b/application/modules/default/views/scripts/home/index-opendesktop-test.phtml
index 1f3457806..45c974301 100755
--- a/application/modules/default/views/scripts/home/index-opendesktop-test.phtml
+++ b/application/modules/default/views/scripts/home/index-opendesktop-test.phtml
@@ -1,139 +1,143 @@
.
**/
$this->headTitle($_SERVER['HTTP_HOST'], 'SET');
$this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA);
$this->headMeta()->appendProperty('og:url', 'www.opendesktop.org');
$this->headMeta()->appendProperty('og:type', 'website');
$this->headMeta()->appendProperty('og:title', 'opendesktop.org');
$this->headMeta()->appendProperty('og:site_name','www.opendesktop.org');
$this->headMeta()->appendProperty('og:description','A community where developers and artists share applications, themes and other content');
$this->headMeta()->appendProperty('og:image','https://www.opendesktop.org/images/system/opendesktop-logo.png');
$modelInfo = new Default_Model_Info();
$this->comments = $modelInfo->getLatestComments(10);
//$this->users = $modelInfo->getNewActiveMembers(18);
//$this->supporters = $modelInfo->getNewActiveSupporters(9);
//$this->plingproducts = $modelInfo->getNewActivePlingProduct(9);
$this->productsThemesGTK = $modelInfo->getLastProductsForHostStores(5,"366,363,273,267,138,125,131,153,154,414,133");
$this->productsThemesPlasma = $modelInfo->getLastProductsForHostStores(5,"365,119,123,266,114,118,349,417,101,100,111,422,423,446,417");
$this->productsWindowmanager = $modelInfo->getLastProductsForHostStores(5,"117,267,139,143,142,140,141,144");
$this->productsIconsCursors= $modelInfo->getLastProductsForHostStores(5,"386,107");
$this->productsScreenshots= $modelInfo->getLastProductsForHostStores(5,"225,445");
$this->productsApps = $modelInfo->getLastProductsForHostStores(5,233);
$this->productsAddons = $modelInfo->getLastProductsForHostStores(5,"152");
$this->productsWallpapersOriginal = $modelInfo->getLastProductsForHostStores(5,"295,158",null,true);
$this->productsWallpapers = $modelInfo->getLastProductsForHostStores(5,"295,158",null,false);
$this->countSupporters = $modelInfo->getCountActiveSupporters();
$featuredProducts = $modelInfo->getFeaturedProductsForHostStores(100);
if ($featuredProducts->getTotalItemCount()) {
$request = Zend_Controller_Front::getInstance()->getRequest();
$offset = (int)$request->getParam('page');
$irandom = rand(1,$featuredProducts->getTotalItemCount());
$featuredProducts->setItemCountPerPage(1);
$featuredProducts->setCurrentPageNumber($irandom);
$this->featureProducts = $featuredProducts;
}
$helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl();
$helperImage = new Default_View_Helper_Image();
$helpPrintDate = new Default_View_Helper_PrintDate();
$item;
foreach ($this->featureProducts as $i) {
$item = $i;
break;
}
+$helpCategories = new Default_View_Helper_FetchCategoriesForProductAsString();
+
$feature = array(
'project_id' => $item['project_id'],
'member_id' => $item['member_id'],
'username' => $item['username'],
'profile_image_url' => $item['profile_image_url'],
'featured' => $item['featured'],
'description' => $item['description'],
+ 'title' => $item['title'],
+ 'category' => $helpCategories->fetchCategoriesForProductAsString($item['project_id']),
'image_small' => $item['image_small'],
'laplace_score' => $item['laplace_score'],
'count_likes' => $item['count_likes'],
'count_dislikes' => $item['count_dislikes'],
'changed_at' => $item['changed_at'],
'created_at' => $item['created_at'],
'count_comments' => $item['count_comments']
);
$response = array(
"productsThemesGTK" => Zend_Json::encode($this->productsThemesGTK),
"productsThemesPlasma" => Zend_Json::encode($this->productsThemesPlasma),
"productsWindowmanager" => Zend_Json::encode($this->productsWindowmanager),
"productsIconsCursors" => Zend_Json::encode($this->productsIconsCursors),
"productsScreenshots" => Zend_Json::encode($this->productsScreenshots),
"productsApps" => Zend_Json::encode($this->productsApps),
"productsAddons" => Zend_Json::encode($this->productsAddons),
"productsWallpapersOriginal" => Zend_Json::encode($this->productsWallpapersOriginal),
"productsWallpapers" => Zend_Json::encode($this->productsWallpapers),
"featureProducts" => Zend_Json::encode($feature)
);
?>