public static function menu() { if (!self::admin_access()) { return; } if (!Base_EssClientCommon::has_license_key()) { return; } return array(_M('Support') => array('__submenu__' => 1, _M('EPESI Store') => array('__function__' => 'manage'))); }
public function admin($store = false) { if (!Base_AclCommon::i_am_sa()) { return; } if ($this->is_back()) { $this->parent->reset(); return; } if (!$store) { Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href()); } if (Base_EssClientCommon::is_no_ssl_allowed()) { Base_ActionBarCommon::add('settings', __('SSL settings'), $this->create_callback_href(array('Base_BoxCommon', 'push_module'), array('Base_EssClient', 'no_ssl_settings'))); } if (Base_EssClientCommon::has_license_key() == false) { $this->terms_and_conditions(); Base_EssClientCommon::server(true); } try { if (Base_EssClientCommon::has_license_key()) { $data = Base_EssClientCommon::server()->installation_registered_data(); if ($data) { $data['license_key'] = Base_EssClientCommon::get_license_key(); $data['status'] = Base_EssClientCommon::get_installation_status(); ///////// Status //////// print '<div class="important_notice">'; print '<div style="margin: 5px">' . __('Thank you for registering your EPESI installation.') . '</div>'; $status_description = ''; $verbose_description = ''; if (stripos($data['status'], 'confirmed') !== false || stripos($data['status'], 'validated') !== false) { $status_description = __('registration done'); $verbose_description = __('The registration process is complete.'); } else { $status_description = __('waiting for e-mail confirmation'); $verbose_description = __('You need to verify your e-mail address. An e-mail was sent to the Administrator\'s e-mail address with a link to confirm the e-mail address.'); } print '<div class="important_notice_frame"><span style="font-weight:bold;">' . __('License Key') . ': ' . '</span>' . $data['license_key'] . '<br/>'; print '<span style="font-weight:bold;">' . __('Status') . ': ' . '</span>' . $status_description . '</div>'; print '<div style="margin: 5px">' . $verbose_description . '</div>'; print '</div>'; Base_ActionBarCommon::add('edit', __('Edit company details'), $this->create_callback_href(array($this, 'register_form'), array($data))); } else { $email = Base_EssClientCommon::get_support_email(); print '<div class="important_notice">' . __('Your EPESI ID is not recognized by EPESI Store Server. Please contact EPESI team at %s.', array($email)) . '</div>'; Base_ActionBarCommon::add('delete', __('Revoke license key'), $this->create_confirm_callback_href(__('Are you sure you want to revoke your EPESI License Key?'), array('Base_EssClientCommon', 'clear_license_key'))); } $url = get_epesi_url() . '/modules/Base/EssClient/tos/tos.php'; Base_ActionBarCommon::add('search', __('Terms & Conditions'), 'target="_blank" href="' . $url . '"'); Base_ActionBarCommon::add('settings', __('Edit license key'), $this->create_callback_href(array($this, 'license_key_form'))); } } catch (Exception $e) { print '<div class="important_notice">' . __('There was an error while trying to connect to Epesi Store Server. Please try again later.') . '<br>'; print __('If the problem persists, please contact us at %s', array('<a href="http://forum.epesibim.com/" target="_blank">http://forum.epesibim.com/</a>')) . '<br>'; print '<br>'; print __('Error message: ') . '<br>'; print '<div class="important_notice_frame">' . $e->getMessage(); print '</div></div>'; Base_ActionBarCommon::add('retry', __('Retry'), $this->create_href(array())); return; } print Base_EssClientCommon::client_messages_frame(); }
public function add_store_products(&$sorted, &$filters) { $registered = Base_EssClientCommon::has_license_key(); $filters_attrs = ''; if (!$registered) { if (TRIAL_MODE) { $msg = __('EPESI Store is not accessible during the trial.'); $filters_attrs = 'href="javascript:void(0);" onclick="alert(\'' . $msg . '\');"'; } else { $msg = __('To access EPESI Store it is necessary that you register your EPESI installation. Would you like to do this now?'); $filters_attrs = $this->create_confirm_callback_href($msg, array($this, 'jump_to_epesi_registration')); } } $filters[__('Updates')] = array('arg' => 'updates', 'attrs' => $filters_attrs); $filters[__('My Purchases')] = array('arg' => 'purchases', 'attrs' => $filters_attrs); $filters[__('Store')] = array('arg' => 'store', 'attrs' => $filters_attrs); if (!$registered) { return; } $store = Base_EpesiStoreCommon::get_modules_all_available(); print Base_EssClientCommon::client_messages_frame(); if (!$store) { return; } foreach ($store as $s) { $name = htmlspecialchars_decode($s['name']); // Module name is translated on the server $label = $s['action']; $downloaded = $label != Base_EpesiStoreCommon::ACTION_BUY && $label != Base_EpesiStoreCommon::ACTION_DOWNLOAD; if (!isset($s['total_price'])) { $s['total_price'] = $s['price']; } if ($label == Base_EpesiStoreCommon::ACTION_BUY && $s['total_price'] === 0) { $s['total_price'] = __('Free'); $label = 'obtain license'; } $b_label = _V(ucfirst($label)); // ****** EpesiStoreCommon - translations added in comments $button = array('label' => $b_label, 'style' => 'install', 'href' => Base_EpesiStoreCommon::action_href($s, $s['action'], array('Base_Setup', 'response_callback'))); if (isset($sorted[$name]) && $downloaded) { $sorted[$name]['filter'][] = 'purchases'; if ($label == Base_EpesiStoreCommon::ACTION_UPDATE) { $sorted[$name]['buttons'][] = $button; $sorted[$name]['filter'][] = 'updates'; $sorted[$name]['style'] = 'problem'; } if ($label == Base_EpesiStoreCommon::ACTION_RESTORE) { $button['style'] = 'problem'; $sorted[$name]['buttons'][] = $button; $sorted[$name]['style'] = 'disabled'; $sorted[$name]['status'] = __('Files modified'); } $sorted[$name]['url'] = $s['description_url']; $sorted[$name]['icon'] = $s['icon_url']; continue; } $sorted[$name] = array(); $sorted[$name]['core'] = 0; $sorted[$name]['url'] = $s['description_url']; $sorted[$name]['icon'] = $s['icon_url']; $sorted[$name]['name'] = $name; // ****** FIXME - modules names from the store $sorted[$name]['modules'] = array(); $sorted[$name]['options'] = array(); if (isset($s['paid']) && $s['paid']) { $status = __('Purchased'); $style = 'problem'; switch ($label) { case Base_EpesiStoreCommon::ACTION_RESTORE: $status = __('Files modified'); $button['style'] = 'uninstall'; $style = 'disabled'; break; case Base_EpesiStoreCommon::ACTION_INSTALL: $status = __('Ready to use'); $style = 'disabled'; break; case Base_EpesiStoreCommon::ACTION_UPDATE: $status = __('To update'); break; } $sorted[$name]['status'] = $status; $sorted[$name]['style'] = $style; $sorted[$name]['filter'] = array('purchases'); } else { $sorted[$name]['status'] = __('Price: %s', array($s['total_price'])); $sorted[$name]['style'] = 'store'; $sorted[$name]['filter'] = array('store'); $sorted[$name]['buttons_tooltip'] = $this->included_modules_text($s); } if ($label != Base_EpesiStoreCommon::ACTION_INSTALL) { $sorted[$name]['buttons'] = array($button); } $sorted[$name]['version'] = $s['version']; if ($label == Base_EpesiStoreCommon::ACTION_UPDATE) { $sorted[$name]['filter'][] = 'updates'; } $sorted[$name]['installed'] = null; $sorted[$name]['instalable'] = 0; $sorted[$name]['uninstalable'] = 0; } }
public function form_main_store() { if (Base_EssClientCommon::has_license_key()) { $this->navigation_buttons(); $this->display_modules(); } else { if (TRIAL_MODE) { print '<span class="important_notice">EPESI store is unavailable during the trial.</span>'; } else { $this->display_registration_form(); } } $this->client_messages(); }