Example #1
0
 protected function extract_user_messages(&$response)
 {
     // format client messages
     if (isset($response[IClient::return_messages])) {
         Base_EssClientCommon::add_client_messages($response[IClient::return_messages]);
     }
 }
Example #2
0
 public function no_ssl_settings()
 {
     $f = $this->init_module("Libs/QuickForm");
     $f->addElement('checkbox', 'allow', 'Allow unsecure connection');
     Base_ActionBarCommon::add('back', __('Back'), Base_BoxCommon::pop_main_href());
     Base_ActionBarCommon::add('save', __('Save'), $f->get_submit_form_href());
     if ($f->validate()) {
         $x = $f->exportValues();
         $allow = false;
         if (isset($x['allow']) && $x['allow']) {
             $allow = true;
         }
         Base_EssClientCommon::set_no_ssl_allow($allow);
         Base_BoxCommon::pop_main();
         return;
     }
     $f->setDefaults(array('allow' => Base_EssClientCommon::is_no_ssl_allowed()));
     print '<div class="important_notice">';
     print __('Allowing unsecure connection will cause all the data to be transferred without encryption. This creates opportunity for third parties to capture the data being transmitted, including your License Key. Please note that License Key should be kept confidential and that using the same License Key on several EPESI installations is a direct violation of Terms of Service and will result in termination of the License Key.');
     print '<center>';
     $f->display();
     print '</center>';
     print '</div>';
 }
Example #3
0
 private static function _display_payments_for_order($order_id)
 {
     $orders = Base_EssClientCommon::server()->orders_list();
     if (isset($orders[$order_id])) {
         $o = $orders[$order_id];
         $keys = array_keys($o['price']);
         $currency = reset($keys);
         $value = $o['price'][$currency]['to_pay'];
         $main_module = Base_BoxCommon::main_module_instance();
         $store = $main_module->init_module(Base_EpesiStore::module_name());
         $main_module->display_module($store, array($o['id'], $value, $currency), 'form_payment_frame');
         return true;
     }
     return "No such order to perform payment.";
 }
Example #4
0
 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;
     }
 }
Example #5
0
 protected function GB_row_data_transform_order(array $data)
 {
     static $module_licenses = null;
     if ($module_licenses === null) {
         $module_licenses = Base_EssClientCommon::server()->module_licenses_list();
     }
     // change module ids to names
     foreach ($data['modules'] as &$m) {
         // $m is module_license
         $mod_id = isset($module_licenses[$m]) ? $module_licenses[$m]['module'] : null;
         $m = __('[license not found]');
         if ($mod_id !== null) {
             $mi = Base_EpesiStoreCommon::get_module_info($mod_id);
             $m = $mi['name'];
         }
     }
     $data['modules'] = implode(', ', $data['modules']);
     // handle prices
     $total = array();
     $to_pay = array();
     foreach ($data['price'] as $curr_code => $amount) {
         $total[] = $amount['display_total'];
         if ($amount['to_pay']) {
             $href = $this->href_navigate('form_payment_frame', $data['id'], $amount['to_pay'], $curr_code, $data['modules']);
             $pay_button = "<button {$href}>Pay {$amount['display_to_pay']}</button>";
             $to_pay[] = $pay_button;
         } else {
             $to_pay[] = __('Paid');
         }
     }
     unset($data['price']);
     $data['total_price'] = implode('<br/>', $total);
     $data['to_pay'] = implode('<br/>', $to_pay);
     return $data;
 }
Example #6
0
 /**
  * Get server connection object to perform requests
  * @param boolean $recreate_object force to recreate object
  * @return ClientRequester server requester
  */
 public static function server($recreate_object = false)
 {
     if (self::$client_requester == null || $recreate_object == true) {
         // include php file
         $dir = self::Instance()->get_module_dir();
         require_once $dir . 'ClientRequester.php';
         // create object
         self::$client_requester = new ClientRequester(self::get_server_url());
         self::$client_requester->set_client_license_key(self::get_license_key());
     }
     return self::$client_requester;
 }
Example #7
0
 * @author Arkadiusz Bisaga <*****@*****.**>
 * @copyright Copyright &copy; 2008, Telaxus LLC
 * @license MIT
 * @version 1.0
 * @package epesi-utils
 * @subpackage tooltip
 */
if (!isset($_POST['cid'])) {
    die('Invalid request' . print_r($_POST, true));
}
define('JS_OUTPUT', 1);
define('CID', $_POST['cid']);
define('READ_ONLY_SESSION', 1);
require_once '../../../include.php';
ModuleManager::load_modules();
$registered = Base_EssClientCommon::is_registered();
$ver = __('version %s', array(EPESI_VERSION));
if (!$registered) {
    print $ver;
    return;
}
$updates = Base_EpesiStoreCommon::is_update_available();
if (!$updates) {
    print $ver;
    return;
}
if (Base_AclCommon::i_am_sa()) {
    $tooltip = __('There are updates available for download, click to go to EPESI store.');
} else {
    $tooltip = __('There are updates available for download. Please contact your administrator.');
}