public function view() { $this->set('latest_version', Config::get('APP_VERSION_LATEST')); $tp = new TaskPermission(); $updates = 0; $local = array(); $remote = array(); if ($tp->canInstallPackages()) { $local = Package::getLocalUpgradeablePackages(); $remote = Package::getRemotelyUpgradeablePackages(); } // now we strip out any dupes for the total $updates = 0; $localHandles = array(); foreach ($local as $_pkg) { $updates++; $localHandles[] = $_pkg->getPackageHandle(); } foreach ($remote as $_pkg) { if (!in_array($_pkg->getPackageHandle(), $localHandles)) { $updates++; } } $this->set('updates', $updates); }
public function prepare_remote_upgrade($remoteMPID = 0){ $tp = new TaskPermission(); if ($tp->canInstallPackages()) { Loader::model('marketplace_remote_item'); $mri = MarketplaceRemoteItem::getByID($remoteMPID); if (!is_object($mri)) { $this->set('error', array(t('Invalid marketplace item ID.'))); return; } $local = Package::getbyHandle($mri->getHandle()); if (!is_object($local) || $local->isPackageInstalled() == false) { $this->set('error', array(Package::E_PACKAGE_NOT_FOUND)); return; } $r = $mri->downloadUpdate(); if ($r != false) { if (!is_array($r)) { $this->set('error', array($r)); } else { $errors = Package::mapError($r); $this->set('error', $errors); } } else { $this->redirect('/dashboard/extend/update', 'do_update', $mri->getHandle()); } } }
public function view() { $this->set('latest_version', \Concrete\Core\Updater\Update::getLatestAvailableVersionNumber()); $tp = new \TaskPermission(); $updates = 0; $local = array(); $remote = array(); if ($tp->canInstallPackages()) { $local = Package::getLocalUpgradeablePackages(); $remote = Package::getRemotelyUpgradeablePackages(); } // now we strip out any dupes for the total $updates = 0; $localHandles = array(); foreach ($local as $_pkg) { $updates++; $localHandles[] = $_pkg->getPackageHandle(); } foreach ($remote as $_pkg) { if (!in_array($_pkg->getPackageHandle(), $localHandles)) { $updates++; } } $this->set('updates', $updates); }
public function connect_complete() { $tp = new TaskPermission(); if ($tp->canInstallPackages()) { if (!$_POST['csToken']) { $this->set('error', array(t('An unexpected error occurred when connecting your site to the marketplace.'))); } else { Config::save('MARKETPLACE_SITE_TOKEN', $_POST['csToken']); Config::save('MARKETPLACE_SITE_URL_TOKEN', $_POST['csURLToken']); print '<script type="text/javascript">parent.window.location.href=\'' . View::url('/dashboard/install', 'view', 'community_connect_success') . '\';</script>'; exit; } } else { $this->set('error', array(t('You do not have permission to connect this site to the marketplace.'))); } }
public function install($btHandle = null) { $tp = new TaskPermission(); if ($tp->canInstallPackages()) { try { $resp = BlockType::installBlockType($btHandle); if ($resp != '') { $this->error->add($resp); } else { $this->set('message', t('Block Type Installed.')); } } catch(Exception $e) { $this->error->add($e); $this->set('error', $this->error); } } else { $this->error->add(t('You do not have permission to install custom block types or add-ons.')); $this->set('error', $this->error); } $this->view(); }
public function view() { $tp = new TaskPermission(); $mi = Marketplace::getInstance(); if ($mi->isConnected() && $tp->canInstallPackages()) { Loader::model('marketplace_remote_item'); $mri = new MarketplaceRemoteItemList(); $mri->setItemsPerPage(9); $sets = MarketplaceRemoteItemList::getItemSets('themes'); $setsel = array('' => t('All Items'), 'FEATURED' => t('Featured Items')); if (is_array($sets)) { foreach ($sets as $s) { $setsel[$s->getMarketplaceRemoteSetID()] = $s->getMarketplaceRemoteSetName(); } } $sortBy = array('' => t('Recommended'), 'popular' => t('Popular'), 'recent' => t('Recently Added'), 'rating' => t('Highest Rated'), 'price_low' => t('Price: Low to High'), 'price_high' => t('Price: High to Low')); $mri->setIncludeInstalledItems(false); if (isset($_REQUEST['marketplaceRemoteItemSetID'])) { $set = $_REQUEST['marketplaceRemoteItemSetID']; } if (isset($_REQUEST['mpID'])) { $mri->filterByMarketplaceItemID($_REQUEST['mpID']); } if (isset($_REQUEST['marketplaceRemoteItemSortBy'])) { $this->set('selectedSort', Loader::helper('text')->entities($_REQUEST['marketplaceRemoteItemSortBy'])); $mri->sortBy($_REQUEST['marketplaceRemoteItemSortBy']); } else { $mri->sortBy('recommended'); } if (isset($_REQUEST['marketplaceIncludeOnlyCompatibleAddons']) && $_REQUEST['marketplaceIncludeOnlyCompatibleAddons'] == 1) { $mri->filterByCompatibility(1); } if (isset($_REQUEST['marketplaceRemoteItemKeywords']) && $_REQUEST['marketplaceRemoteItemKeywords']) { $keywords = $_REQUEST['marketplaceRemoteItemKeywords']; $sortBy = array('relevance' => t('Relevance')) + $sortBy; } if ($keywords != '') { $mri->filterByKeywords($keywords); } if ($set == 'FEATURED') { $mri->filterByIsFeaturedRemotely(1); } else { if ($set > 0) { $mri->filterBySet($set); } } $mri->setType('themes'); $mri->execute(); $items = $mri->getPage(); $this->set('sortBy', $sortBy); $this->set('selectedSet', $set); $this->set('list', $mri); $this->set('items', $items); $this->set('form', Loader::helper('form')); $this->set('sets', $setsel); $this->set('pagination', $mri->getPagination()); $this->set('type', $what); } else { $this->redirect('/dashboard/extend/connect'); } }
<table cellspacing="0" cellpadding="0"> <tr> <td class="ccm-installed-items-icon"><img src="<?=$ci->getBlockTypeIconURL($bt)?>" /></td> <td class="ccm-addon-list-description"><h3><?=$bt->getBlockTypeName()?></a></h3><?=$bt->getBlockTypeDescription()?></td> <td><?=$ch->button(t("Edit"), View::url('/dashboard/install', 'inspect_block_type', $bt->getBlockTypeID()), "right")?></td> </tr> </table> </div> <? } ?> <? } ?> </div> </div> <? if ($tp->canInstallPackages()) { ?> <div class="ccm-module" style="width: 350px; margin-bottom: 20px"> <? if ($updates > 0) { ?> <h1><span><?=t('Updates')?></span></h1> <div class="ccm-dashboard-inner"> <? if ($updates == 1) { ?> <?=t('There is currently <strong>1</strong> update available.')?> <? } else { ?> <?=t('There are currently <strong>%s</strong> updates available.', $updates)?> <? } ?> <? print $ch->button(t('Update Addons'), $this->url('/dashboard/install', 'update'))?> <div class="ccm-spacer"> </div> </div>
<p><?php echo $pkg->getPackageDescription(); ?> </p> </div> </div> <?php } } else { ?> <p><?php echo t('No packages have been installed.'); ?> </p><?php } if ($tp->canInstallPackages()) { ?> <hr/> <h3><?php echo t('Awaiting Installation'); ?> </h3> <?php if (count($availableArray) == 0 && count($purchasedBlocks) == 0) { if (!$mi->isConnected()) { ?> <p><?php echo t('Nothing currently available to install.'); ?> </p><?php }
<div><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($settingsPage, false, true); ?> "><strong><?php echo t('System & Settings'); ?> </strong></a> - <?php echo t('Secure and setup your site.'); ?> </div> <?php } $tpa = new TaskPermission(); $extendPage = Page::getByPath('/dashboard/extend'); $extendPageP = new Permissions($extendPage); if ($tpa->canInstallPackages() && $extendPageP->canRead()) { ?> <div><a href="<?php echo View::url('/dashboard/extend'); ?> "><strong><?php echo t("Extend concrete5"); ?> </strong></a> – <?php if (ENABLE_MARKETPLACE_SUPPORT) { ?> <?php echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons')); ?> <?php
<td class="ccm-marketplace-list-install-button"><?php echo $ch->button(t("Edit"), View::url('/dashboard/extend/install', 'inspect_package', $pkg->getPackageID()), ""); ?> </td> </tr> <? } ?> </table> <? } else { ?> <p><?php echo t('No packages have been installed.'); ?> </p> <? } ?> <? if ($tp->canInstallPackages()) { ?> <h3><?php echo t('Awaiting Installation'); ?> </h3> <? if (count($availableArray) == 0 && count($purchasedBlocks) == 0) { ?> <? if (!$mi->isConnected()) { ?> <?php echo t('Nothing currently available to install.'); ?> <? } ?> <? } else { ?> <table class="table table-bordered table-striped">
if ($newsPageP->canRead()) { ?> <div><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($settingsPage, false, true); ?> "><strong><?php echo t('System & Settings'); ?> </strong></a> - <?php echo t('Secure and setup your site.'); ?> </div> <?php } $tpa = new TaskPermission(); if ($tpa->canInstallPackages()) { ?> <div><a href="<?php echo View::url('/dashboard/extend'); ?> "><strong><?php echo t("Extend concrete5"); ?> </strong></a> – <?php if (ENABLE_MARKETPLACE_SUPPORT) { ?> <?php echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons')); ?> <?php
public function getDashboardAndSearchMenus() { if (isset($_SESSION['dashboardMenus'][Localization::activeLocale()])) { return $_SESSION['dashboardMenus'][Localization::activeLocale()]; } $d = ConcreteDashboardMenu::getMine(); $items = $d->getItems(); ob_start(); ?> <div id="ccm-intelligent-search-results"> <?php $page = Page::getByPath('/dashboard'); $children = $page->getCollectionChildrenArray(true); $packagepages = array(); $corepages = array(); foreach ($children as $ch) { $page = Page::getByID($ch); $pageP = new Permissions($page); if ($pageP->canRead()) { if (!$page->getAttribute("exclude_nav")) { if ($page->getPackageID() > 0) { $packagepages[] = $page; } else { $corepages[] = $page; } } } else { continue; } if ($page->getAttribute('exclude_search_index')) { continue; } if ($page->getCollectionPath() == '/dashboard/system') { $ch2 = $page->getCollectionChildrenArray(); } else { $ch2 = $page->getCollectionChildrenArray(true); } ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite"> <h1><?php echo t($page->getCollectionName()); ?> </h1> <ul class="ccm-intelligent-search-results-list"> <?php if (count($ch2) == 0) { ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($page, false, true); ?> "><?php echo t($page->getCollectionName()); ?> </a><span><?php echo t($page->getCollectionName()); ?> <?php echo t($page->getAttribute('meta_keywords')); ?> </span></li> <?php } ?> <?php if ($page->getCollectionPath() == '/dashboard/system') { ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($page, false, true); ?> "><?php echo t('View All'); ?> </a><span><?php echo t($page->getCollectionName()); ?> <?php echo t($page->getAttribute('meta_keywords')); ?> </span></li> <?php } foreach ($ch2 as $chi) { $subpage = Page::getByID($chi); $subpageP = new Permissions($subpage); if (!$subpageP->canRead()) { continue; } if ($subpage->getAttribute('exclude_search_index')) { continue; } ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($subpage, false, true); ?> "><?php echo t($subpage->getCollectionName()); ?> </a><span><?php if ($page->getCollectionPath() != '/dashboard/system') { echo t($page->getCollectionName()); ?> <?php echo t($page->getAttribute('meta_keywords')); ?> <?php } echo t($subpage->getCollectionName()); ?> <?php echo t($subpage->getAttribute('meta_keywords')); ?> </span></li> <?php } ?> </ul> </div> <?php } $custHome = Page::getByPath('/dashboard/home'); $custHomeP = new Permissions($custHome); if ($custHomeP->canRead()) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite"> <h1><?php echo t('Dashboard Home'); ?> </h1> <ul class="ccm-intelligent-search-results-list"> <li><a href="<?php echo View::url('/dashboard/home'); ?> "><?php echo t('Customize'); ?> <span><?php echo t('Customize Dashboard Home'); ?> </span></a></li> </ul> </div> <?php } ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Your Site'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-your-site"> </ul> </div> <?php if (ENABLE_INTELLIGENT_SEARCH_HELP) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Help'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-help"> </ul> </div> <?php } ?> <?php if (ENABLE_INTELLIGENT_SEARCH_MARKETPLACE) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Add-Ons'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-marketplace"> </ul> </div> <?php } ?> </div> <div id="ccm-dashboard-overlay"> <div id="ccm-dashboard-overlay-core"> <div class="ccm-dashboard-overlay-inner" id="ccm-dashboard-overlay-main"> <!--recent--> <?php $currentHeader = false; $x = 0; $itemsChanged = false; foreach ($items as $path) { $p = Page::getByPath($path, 'ACTIVE'); // If page is not found etc, remove it from items if ($p->isError()) { $d->remove($p); $itemsChanged = true; continue; } $pc = new Permissions($p); if ($pc->canViewPage()) { $name = t($p->getCollectionName()); $parent = Page::getByID($p->getCollectionParentID(), 'ACTIVE'); if ($parent->getCollectionPath() == '/dashboard') { $parent = $p; $name = t('Home'); } if ($currentHeader != $parent->getCollectionID()) { ?> <?php if ($currentHeader != false) { ?> </ul> </div> <?php $x++; ?> <?php if ($x % 4 == 0) { ?> <div class="clearfix" style="padding-bottom: 0px"></div> <?php } ?> <?php } ?> <div class="ccm-dashboard-overlay-module"> <h1><?php echo t($parent->getCollectionName()); ?> </h1> <ul> <?php $currentHeader = $parent->getCollectionID(); ?> <?php } ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($p, false, true); ?> "><?php echo $name; ?> </a></li> <?php } ?> <?php } ?> <?php if ($itemsChanged) { $u = new User(); $u->saveConfig('QUICK_NAV_BOOKMARKS', serialize($d)); } ?> <?php if ($currentHeader != false) { ?> </ul> </div> <?php } ?> </div> </div> <div id="ccm-dashboard-overlay-misc" class="ccm-dashboard-overlay-misc-rounded"> <div class="ccm-dashboard-overlay-inner"> <?php // Before we throw in a UL, we check permissions, etc. to see if any of the LI items need to be shown. $systemNews = Page::getByPath('/dashboard/news'); $systemNewsP = new Permissions($systemNews); $canAccessNews = $systemNewsP->canRead(); $systemSettings = Page::getByPath('/dashboard/system'); $systemSettingsP = new Permissions($systemSettings); $canAccessSystem = $systemSettingsP->canRead(); $tpa = new TaskPermission(); $canAccessExtend = $tpa->canInstallPackages(); $systemExtend = Page::getByPath('/dashboard/extend'); $systemExtendP = new Permissions($systemExtend); $canViewExtend = $systemExtendP->canRead(); // If any need to be shown then we proceed... if ($canAccessNews || $canAccessSystem || $canAccessExtend && $canViewExtend) { ?> <ul> <?php if ($canAccessNews) { ?> <li><a href="<?php echo View::url('/dashboard/news'); ?> "><strong><?php echo t('News'); ?> </strong></a> – <?php echo t('Learn about your site and concrete5.'); ?> </li> <?php } ?> <?php if ($canAccessSystem) { ?> <li><a href="<?php echo View::url('/dashboard/system'); ?> "><strong><?php echo t('System & Settings'); ?> </strong></a> – <?php echo t('Secure and setup your site.'); ?> </li> <?php } ?> <?php if ($canAccessExtend && $canViewExtend) { ?> <li><a href="<?php echo View::url('/dashboard/extend'); ?> "><strong><?php echo t("Extend concrete5"); ?> </strong></a> – <?php if (ENABLE_MARKETPLACE_SUPPORT) { ?> <?php echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons')); ?> <?php } else { ?> <?php echo sprintf(t('<a href="%s">Install</a> or <a href="%s">update</a> packages.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update')); ?> <?php } ?> </li> <?php } ?> </ul> <?php } ?> </div> </div> <div id="ccm-dashboard-overlay-footer"> <div class="ccm-dashboard-overlay-inner"> <a href="<?php echo View::url('/dashboard'); ?> "><?php echo t('View Full Dashboard'); ?> <i class="icon-arrow-right"></i></a> </div> </div> </div> <?php $html = ob_get_contents(); ob_end_clean(); return str_replace(array("\n", "\r", "\t"), "", $html); }
public function download($remoteMPID = null) { $tp = new TaskPermission(); if ($tp->canInstallPackages()) { Loader::model('marketplace_remote_item'); $mri = MarketplaceRemoteItem::getByID($remoteMPID); if (!is_object($mri)) { $this->set('error', array(t('Invalid marketplace item ID.'))); return; } $r = $mri->download(); if ($r != false) { if (!is_array($r)) { $this->set('error', array($r)); } else { $errors = Package::mapError($r); $this->set('error', $errors); } } else { $this->set('message', t('Marketplace item %s downloaded successfully.', $mri->getName())); } } else { $this->error->add(t('You do not have permission to download add-ons.')); $this->set('error', $this->error); } }
<?php defined('C5_EXECUTE') or die("Access Denied."); Loader::model('collection_types'); Loader::library('marketplace'); $mi = Marketplace::getInstance(); $tp = new TaskPermission(); if ($mi->isConnected() && $tp->canInstallPackages()) { $previewCID = intval($_REQUEST['previewCID']); $themeCID = intval($_REQUEST['themeCID']); $themeHandle = $_REQUEST['themeHandle']; $postStr = '&themeHandle=' . $themeHandle . '&ctID=' . $ctID . '&ctHandle=' . $ctHandle; if (!function_exists('curl_init')) { ?> <div><?php echo t('curl must be enabled to preview external themes.'); ?> </div> <?php } else { $curl_handle = curl_init(); // Check to see if there are proxy settings if (Config::get('HTTP_PROXY_HOST') != null) { @curl_setopt($curl_handle, CURLOPT_PROXY, Config::get('HTTP_PROXY_HOST')); @curl_setopt($curl_handle, CURLOPT_PROXYPORT, Config::get('HTTP_PROXY_PORT')); // Check if there is a username/password to access the proxy if (Config::get('HTTP_PROXY_USER') != null) { @curl_setopt($curl_handle, CURLOPT_PROXYUSERPWD, Config::get('HTTP_PROXY_USER') . ':' . Config::get('HTTP_PROXY_PWD')); } } curl_setopt($curl_handle, CURLOPT_URL, MARKETPLACE_THEME_PREVIEW_URL);
public function getMarketplaceFrame($width = '100%', $height = '530', $completeURL = false) { // if $mpID is passed, we are going to either // a. go to its purchase page // b. pass you through to the page AFTER connecting. $tp = new TaskPermission(); if ($tp->canInstallPackages()) { if (!$this->isConnected()) { $url = MARKETPLACE_URL_CONNECT; if (!$completeURL) { $completeURL = BASE_URL . View::url('/dashboard/settings/marketplace', 'connect_complete'); } $csReferrer = urlencode($completeURL); $csiURL = urlencode(BASE_URL . DIR_REL); if ($this->hasConnectionError()) { $csToken = $this->getSiteToken(); } else { // new connection $csToken = Marketplace::generateSiteToken(); } $url = $url . '?ts=' . time() . '&csiURL=' . $csiURL . '&csToken=' . $csToken . '&csReferrer=' . $csReferrer . '&csName=' . htmlspecialchars(SITE, ENT_QUOTES, APP_CHARSET); } if ($csToken == false) { return '<div class="ccm-error">' . t('Unable to generate a marketplace token. Please ensure that allow_url_fopen is turned on, or that cURL is enabled on your server. If these are both true, It\'s possible your site\'s IP address may be blacklisted for some reason on our server. Please ask your webhost what your site\'s outgoing cURL request IP address is, and email it to us at <a href="mailto:help@concrete5.org">help@concrete5.org</a>.') . '</div>'; } else { return '<iframe id="ccm-marketplace-frame-' . time() . '" frameborder="0" width="' . $width . '" height="' . $height . '" src="' . $url . '"></iframe>'; } } else { return '<div class="ccm-error">' . t('You do not have permission to connect this site to the marketplace.') . '</div>'; } }
public function getMarketplacePurchaseFrame($mp, $width = '100%', $height = '530') { $tp = new TaskPermission(); if ($tp->canInstallPackages()) { if (!is_object($mp)) { return '<div class="alert-message block-message error">' . t('Unable to get information about this product.') . '</div>'; } if ($this->isConnected()) { $url = MARKETPLACE_URL_CHECKOUT; $csiURL = urlencode(BASE_URL . DIR_REL); $csiBaseURL = urlencode(BASE_URL); $csToken = $this->getSiteToken(); $url = $url . '/' . intval($mp->getProductBlockID(), 10) . '?ts=' . time() . '&csiBaseURL=' . $csiBaseURL . '&csiURL=' . $csiURL . '&csToken=' . $csToken; } $time = time(); $ifr = '<script type="text/javascript">$(function() { $.receiveMessage(function(e) { jQuery.fn.dialog.hideLoader(); if (e.data == "loading") { jQuery.fn.dialog.showLoader(); } else { var eh = e.data; eh = parseInt(eh) + 20; $("#ccm-marketplace-frame-' . $time . '").attr("height", eh); } }, \'' . CONCRETE5_ORG_URL_SECURE . '\'); }); </script>'; $ifr .= '<iframe class="ccm-marketplace-frame" id="ccm-marketplace-frame-' . $time . '" class="ccm-marketplace-frame" frameborder="0" width="' . $width . '" height="' . $height . '" src="' . $url . '"></iframe>'; return $ifr; } else { return '<div class="ccm-error">' . t('You do not have permission to connect this site to the marketplace.') . '</div>'; } }
} ?> <script type="text/javascript"> ccm_marketplaceRefreshInstalledThemes = function() { jQuery.fn.dialog.closeTop(); $("a#ccm-nav-design").click(); } </script> <h2><?php echo t('Themes'); ?> </h2> <?php if (!$tp->canInstallPackages()) { ?> <div><?php echo t('You do not have permission to connect to the marketplace.'); ?> </div> <?php } else { if (!count($availableThemes)) { ?> <div><?php echo t('Unable to connect to the marketplace.'); ?> </div> <?php } else {
<?php defined('C5_EXECUTE') or die("Access Denied."); $ch = Loader::helper('concrete/interface'); //marketplace $tp = new TaskPermission(); if (ENABLE_MARKETPLACE_SUPPORT && $tp->canInstallPackages()) { Loader::model('marketplace_remote_item'); $mri = new MarketplaceRemoteItemList(); $mri->filterByIsFeaturedRemotely(1); $mri->setIncludeInstalledItems(true); $mri->setType('addons'); $mri->execute(); $marketplaceBlockTypes = $mri->getPage(); } else { $marketplaceBlockTypes = array(); } ?> <script type="text/javascript"> ccm_marketplaceRefreshInstalledBlockTypes = function() { jQuery.fn.dialog.closeTop(); setTimeout(function() { <?php if ($_REQUEST['arHandle']) { ?> ccm_openAreaAddBlock('<?php echo $_REQUEST['arHandle']; ?> '); <?php
<?php defined('C5_EXECUTE') or die("Access Denied."); $valt = Loader::helper('validation/token'); $ci = Loader::helper('concrete/urls'); $ch = Loader::helper('concrete/ui'); $tp = new TaskPermission(); if ($tp->canInstallPackages()) { $mi = Marketplace::getInstance(); } $pkgRemote = array(); $pkgLocal = array(); if (Config::get('concrete.marketplace.enabled') && is_object($mi)) { if ($mi->isConnected()) { $pkgArray = Package::getInstalledList(); foreach ($pkgArray as $pkg) { if ($pkg->isPackageInstalled() && version_compare($pkg->getPackageVersion(), $pkg->getPackageVersionUpdateAvailable(), '<')) { $pkgRemote[] = $pkg; } } } } $pkgAvailableArray = Package::getLocalUpgradeablePackages(); foreach ($pkgAvailableArray as $pkg) { if (!in_array($pkg, $pkgRemote)) { $pkgLocal[] = $pkg; } } ?> <?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Update Add-Ons'));
public function getDashboardAndSearchMenus() { if (isset($_SESSION['dashboardMenus'])) { return $_SESSION['dashboardMenus']; } ob_start(); ?> <div id="ccm-intelligent-search-results"> <?php $page = Page::getByPath('/dashboard'); $children = $page->getCollectionChildrenArray(true); $packagepages = array(); $corepages = array(); foreach ($children as $ch) { $page = Page::getByID($ch); $pageP = new Permissions($page); if ($pageP->canRead()) { if (!$page->getAttribute("exclude_nav")) { if ($page->getPackageID() > 0) { $packagepages[] = $page; } else { $corepages[] = $page; } } } else { continue; } if ($page->getAttribute('exclude_search_index')) { continue; } if ($page->getCollectionPath() == '/dashboard/system') { $ch2 = $page->getCollectionChildrenArray(); } else { $ch2 = $page->getCollectionChildrenArray(true); } ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite"> <h1><?php echo t($page->getCollectionName()); ?> </h1> <ul class="ccm-intelligent-search-results-list"> <?php if (count($ch2) == 0) { ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($page, false, true); ?> "><?php echo t($page->getCollectionName()); ?> </a><span><?php echo t($page->getCollectionName()); ?> <?php echo $page->getAttribute('meta_keywords'); ?> </span></li> <?php } ?> <?php if ($page->getCollectionPath() == '/dashboard/system') { ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($page, false, true); ?> "><?php echo t('View All'); ?> <span><?php echo t($page->getCollectionName()); ?> <?php echo $page->getAttribute('meta_keywords'); ?> </span></li> <?php } foreach ($ch2 as $chi) { $subpage = Page::getByID($chi); $subpageP = new Permissions($subpage); if (!$subpageP->canRead()) { continue; } if ($subpage->getAttribute('exclude_search_index')) { continue; } ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkTocollection($subpage, false, true); ?> "><?php echo $subpage->getCollectionName(); ?> </a><span>1<?php if ($page->getCollectionPath() != '/dashboard/system') { echo t($page->getCollectionName()); ?> <?php echo $page->getAttribute('meta_keywords'); ?> <?php } echo $subpage->getCollectionName(); ?> <?php echo $subpage->getAttribute('meta_keywords'); ?> </span></li> <?php } ?> </ul> </div> <?php } $custHome = Page::getByPath('/dashboard/home'); $custHomeP = new Permissions($custHome); if ($custHomeP->canRead()) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite"> <h1><?php echo t('Dashboard Home'); ?> </h1> <ul class="ccm-intelligent-search-results-list"> <li><a href="<?php echo View::url('/dashboard/home'); ?> "><?php echo t('Customize'); ?> <span><?php echo 'Customize Dashboard Home'; ?> </span></a></li> </ul> </div> <?php } ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Your Site'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-your-site"> </ul> </div> <?php if (ENABLE_INTELLIGENT_SEARCH_HELP) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Help'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-help"> </ul> </div> <?php } ?> <?php if (ENABLE_INTELLIGENT_SEARCH_MARKETPLACE) { ?> <div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading"> <h1><?php echo t('Add-Ons'); ?> </h1> <ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-marketplace"> </ul> </div> <?php } ?> </div> <div id="ccm-dashboard-overlay"> <div id="ccm-dashboard-overlay-core"> <div class="ccm-dashboard-overlay-inner" id="ccm-dashboard-overlay-main"> <?php foreach ($corepages as $page) { ?> <div class="ccm-dashboard-overlay-module"> <h1><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($page, false, true); ?> "><?php echo t($page->getCollectionName()); ?> </a></h1> <ul> <?php $ch2 = $page->getCollectionChildrenArray(true); foreach ($ch2 as $chi) { $subpage = Page::getByID($chi); $subpageP = new Permissions($subpage); if (!$subpageP->canRead()) { continue; } if ($subpage->getAttribute('exclude_nav')) { continue; } ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($subpage, false, true); ?> "><?php echo t($subpage->getCollectionName()); ?> </a></li> <?php } ?> </ul> </div> <?php } ?> </div> </div> <div id="ccm-dashboard-overlay-misc" <?php if (count($packagepages) == 0) { ?> class="ccm-dashboard-overlay-misc-rounded" <?php } ?> > <div class="ccm-dashboard-overlay-inner"> <ul> <li><a href="<?php echo View::url('/dashboard/news'); ?> "><strong><?php echo t('News'); ?> </strong></a> – <?php echo t('Learn about your site and concrete5.'); ?> </li> <?php $systemSettings = Page::getByPath('/dashboard/system'); $systemSettingsP = new Permissions($systemSettings); if ($systemSettingsP->canRead()) { ?> <li><a href="<?php echo View::url('/dashboard/system'); ?> "><strong><?php echo t('System & Settings'); ?> </strong></a> – <?php echo t('Secure and setup your site.'); ?> </li> <?php } ?> <?php $tpa = new TaskPermission(); if ($tpa->canInstallPackages()) { ?> <li><a href="<?php echo View::url('/dashboard/extend'); ?> "><strong><?php echo t("Extend concrete5"); ?> </strong></a> – <?php if (ENABLE_MARKETPLACE_SUPPORT) { ?> <?php echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons')); ?> <?php } else { ?> <?php echo sprintf(t('<a href="%s">Install</a> or <a href="%s">update</a> packages.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update')); ?> <?php } ?> </li> <?php } ?> </ul> </div> </div> <?php if (count($packagepages) > 0) { ?> <div id="ccm-dashboard-overlay-footer"> <div class="ccm-dashboard-overlay-inner" id="ccm-dashboard-overlay-packages"> <?php foreach ($packagepages as $page) { ?> <div class="ccm-dashboard-overlay-module"> <h1><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($page, false, true); ?> "><?php echo t($page->getCollectionName()); ?> </a></h1> <ul> <?php $ch2 = $page->getCollectionChildrenArray(true); foreach ($ch2 as $chi) { $subpage = Page::getByID($chi); $subpageP = new Permissions($subpage); if (!$subpageP->canRead()) { continue; } if ($subpage->getAttribute('exclude_nav')) { continue; } ?> <li><a href="<?php echo Loader::helper('navigation')->getLinkToCollection($subpage, false, true); ?> "><?php echo t($subpage->getCollectionName()); ?> </a></li> <?php } ?> </ul> </div> <?php } ?> </div> </div> <?php } ?> </div> <?php $contents = ob_get_contents(); ob_end_clean(); return str_replace(array("\n", "\r", "\t"), "", $contents); }