public function testSetOptionsRequiresCriticalConfiguration()
 {
     try {
         putenv("CLEVER_CLIENT_ID");
         putenv("CLEVER_CLIENT_SECRET");
         $options = set_options();
         $this->fail("Expected exception not thrown");
     } catch (Exception $e) {
         $this->assertRegExp("@Cannot communicate with Clever without configuration@", $e->getMessage());
     }
 }
/**
 * Install the SIL dictionary infrastructure if needed.
 */
function install_sil_dictionary_infrastructure()
{
    create_search_tables();
    create_reversal_tables();
    set_options();
    set_field_sortorder();
    //upload_stylesheet();
    register_semantic_domains_taxonomy();
    register_part_of_speech_taxonomy();
    register_language_taxonomy();
    register_webstrings_taxonomy();
}
        $sql .= " ORDER BY site_id DESC ";
        $r->set_value($key, get_db_value($sql));
    }
    // check data for categories columns
    $cc_eg->set_value("category_id", 0);
    $cc_eg->change_property("column_id", USE_IN_SELECT, true);
    $cc_eg->change_property("column_id", USE_IN_WHERE, false);
    $cc_eg->change_property("category_id", USE_IN_WHERE, true);
    $cc_eg->change_property("category_id", USE_IN_SELECT, true);
    $columns_number = $cc_eg->get_db_values();
}
if ($columns_number == 0) {
    $columns_number = 5;
}
// set parameters
$r->set_parameters();
$t->set_var("rp", htmlspecialchars($return_page));
// set categories columns
$t->set_var("cc_number", $columns_number);
$cc_eg->set_parameters_all($columns_number);
// set styles for tabs
$tabs = array("general" => array("title" => ADMIN_GENERAL_MSG), "tax" => array("title" => TAX_SETTINGS_MSG), "appearance" => array("title" => PROD_APPEARANCE_MSG), "merchants_affiliates" => array("title" => MERCHANTS_AFFILIATES_MSG), "points" => array("title" => POINTS_AND_CREDITS_MSG), "images" => array("title" => IMAGES_MSG), "google_base" => array("title" => GOOGLE_BASE_SETTINGS_MSG), "import_export" => array("title" => IMPORT_EXPORT_MSG), "fast_checkout" => array("title" => FAST_CHECKOUT_MSG), "table_view" => array("title" => TABLE_VIEW_MSG), "keywords" => array("title" => KEYWORDS_SEARCH_MSG));
parse_admin_tabs($tabs, $tab, 6);
// multisites
if ($sitelist) {
    $sites = get_db_values("SELECT site_id,site_name FROM " . $table_prefix . "sites ORDER BY site_id ", "");
    set_options($sites, $param_site_id, "param_site_id");
    $t->parse("sitelist", false);
}
include_once "./admin_footer.php";
$t->pparse("main");
$current_date = va_time();
$cc_start_years = get_db_values("SELECT start_year AS year_value, start_year AS year_description FROM " . $table_prefix . "cc_start_years", array(array("", YEAR_MSG)));
if (sizeof($cc_start_years) < 2) {
    $cc_start_years = array(array("", YEAR_MSG));
    for ($y = 7; $y >= 0; $y--) {
        $cc_start_years[] = array($current_date[YEAR] - $y, $current_date[YEAR] - $y);
    }
}
$cc_expiry_years = get_db_values("SELECT expiry_year AS year_value, expiry_year AS year_description FROM " . $table_prefix . "cc_expiry_years", array(array("", YEAR_MSG)));
if (sizeof($cc_expiry_years) < 2) {
    $cc_expiry_years = array(array("", YEAR_MSG));
    for ($y = 0; $y <= 7; $y++) {
        $cc_expiry_years[] = array($current_date[YEAR] + $y, $current_date[YEAR] + $y);
    }
}
set_options($cc_start_years, $cc_start_year, "cc_start_year");
set_options($cc_expiry_years, $cc_expiry_year, "cc_expiry_year");
$cc_months = array_merge(array(array("", MONTH_MSG)), $months);
set_options($cc_months, $cc_start_month, "cc_start_month");
set_options($cc_months, $cc_expiry_month, "cc_expiry_month");
$r->set_parameters();
$intro_text = trim($cc_info["intro_text"]);
$intro_text = get_translation($intro_text);
$intro_text = get_currency_message($intro_text, $currency);
if ($intro_text) {
    $t->set_var("intro_text", $intro_text);
    $t->parse("intro_block", false);
}
$t->set_var("billing_address", "test");
$block_parsed = true;
$t->parse("block_body", false);
Example #5
0
}
if (strpos($default_columns, "related_delimiter")) {
    $start_delimiter = strpos($default_columns, "related_delimiter");
    $end_delimiter = strpos($default_columns, "related_delimiter", $start_delimiter + 17);
    $related_delimiter = substr($default_columns, $start_delimiter + 17, $end_delimiter - $start_delimiter - 17);
}
set_options($delimiters, $csv_delimiter, "delimiter");
set_options($delimiters, $csv_delimiter, "delimiter_bottom");
set_options($related_delimiters, $related_delimiter, "related_delimiter");
set_options($related_delimiters, $related_delimiter, "related_delimiter_bottom");
$t->set_var("table_name", $table_name);
$template_id = get_param("template_id");
$sql = " SELECT template_id, template_name FROM " . $table_prefix . "export_templates ";
$sql .= " WHERE table_name=" . $db->tosql($table, TEXT);
$export_templates = get_db_values($sql, array(array("", BASIC_EXPORT_MSG)));
set_options($export_templates, $template_id, "template_id");
$total_columns = 0;
$export_columns = array();
if ($template_id) {
    $sql = " SELECT field_title, field_source FROM " . $table_prefix . "export_fields ";
    $sql .= " WHERE template_id=" . $db->tosql($template_id, INTEGER);
    $sql .= " ORDER BY field_order ";
    $db->query($sql);
    while ($db->next_record()) {
        $column_title = $db->f("field_title");
        $column_source = $db->f("field_source");
        $export_columns[] = array("source" => $column_source, "title" => $column_title, "checked" => "checked");
    }
} else {
    foreach ($db_columns as $column_name => $column_info) {
        if ($column_info[2] == RELATED_DB_FIELD) {
Example #6
0
 public function createTables()
 {
     if (isset($_POST['site_name'])) {
         $this->form_validation->set_rules('site_name', __('Site name'), 'trim|required|min_length[4]');
         if ($this->form_validation->run()) {
             // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
             $this->instance->db_connect();
             // En utilisant les données de la session
             $this->instance = get_instance();
             // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
             $this->load->library('tendoo');
             // Refreshing Tendoo Clss
             $this->load->library('tendoo_admin');
             // loading Admin Class
             $this->load->library('options');
             $this->load->library('installation');
             // Refreshing installation class
             // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
             if (!$this->installation->createTables()) {
                 echo 'false';
                 // Table creation failed, redirect so
                 return false;
             }
             if (set_options(array('SITE_NAME' => $this->input->post('site_name'), 'CONNECT_TO_STORE' => 1), "from_install_interface")) {
                 $_SESSION['secur_access'] = 4;
                 echo 'true';
             } else {
                 echo 'false';
             }
         } else {
             echo 'invalidesitename';
         }
         // Execute control
     } else {
         echo 'nositename';
     }
 }
Example #7
0
function set_config($text)
{
    global $cfg;
    $fh = fopen($cfg, 'a') or die("Can't open file '{$cfg}' for writing.  Try 'chmod 777 pwaphp.cfg'");
    fwrite($fh, $text);
    fclose($fh);
}
$cfg = "config.php";
$loc = $_GET['loc'];
if ($loc == "return") {
    set_gdata_token();
} else {
    if ($loc == "options") {
        get_options();
    } else {
        if ($loc == "finish") {
            set_options();
        } else {
            if (file_exists($cfg)) {
                $file = file_get_contents($cfg);
                if (strpos($file, "GDATA_TOKEN") >= 0) {
                    echo "PWP+PHP is already configured.  Delete {$cfg} and reload this page to reconfigure.";
                } else {
                    get_gdata_token();
                }
            } else {
                get_gdata_token();
            }
        }
    }
}
Example #8
0
        $where .= $s_ex == 1 ? " o.is_exported=1 " : " (o.is_exported<>1 OR o.is_exported IS NULL) ";
    }
    if (!$r->is_empty("s_sti")) {
        if (strlen($where)) {
            $where .= " AND ";
        }
        $s_sti = $r->get_value("s_sti");
        $where .= " o.site_id=" . $db->tosql($r->get_value("s_sti"), INTEGER);
    }
}
$r->set_form_parameters();
$where_sql = "";
if (strlen($where)) {
    $where_sql = " WHERE " . $where;
}
set_options($order_statuses, "status_id", "status_id");
// set up variables for navigator
if ($product_search) {
    $total_records = 0;
    $total = 0;
    //Customization by Vital
    $sql = " SELECT o.order_total FROM ((((" . $table_prefix . "orders o ";
    //Customization by Vital
    $sql .= " INNER JOIN " . $table_prefix . "orders_items oi ON o.order_id=oi.order_id)";
    $sql .= " LEFT JOIN " . $table_prefix . "orders_items_serials ois ON o.order_id=ois.order_id)";
    $sql .= " LEFT JOIN " . $table_prefix . "orders_serials_activations osa ON o.order_id=osa.order_id)";
    $sql .= " LEFT JOIN " . $table_prefix . "order_statuses os ON o.order_status=os.status_id) ";
    $sql .= $where_sql;
    $sql .= " GROUP BY o.order_id ";
    $db->query($sql);
    while ($db->next_record()) {
Example #9
0
 $fast_checkout_postcode_required = get_setting_value($vars, "fast_checkout_postcode_required", 0);
 $user_id = get_session("session_user_id");
 if ($fast_checkout_country_show) {
     $countries = get_db_values("SELECT country_id,country_name FROM " . $table_prefix . "countries WHERE show_for_user=1 ORDER BY country_order, country_name ", array(array("", SELECT_COUNTRY_MSG)));
     set_options($countries, $user_details["country_id"], "fast_checkout_country_id");
     if ($fast_checkout_country_required == 1) {
         $t->set_var("country_required", "*");
     }
     $t->parse("fast_checkout_country_select", false);
 } else {
     $t->set_var("fast_checkout_country_id_value", htmlspecialchars($user_details["country_id"]));
     $t->parse("fast_checkout_country_hidden", false);
 }
 if ($fast_checkout_state_show) {
     $states = get_db_values("SELECT state_id,state_name FROM " . $table_prefix . "states WHERE show_for_user=1 ORDER BY state_name ", array(array("", SELECT_STATE_MSG)));
     set_options($states, $user_details["state_id"], "fast_checkout_state_id");
     if ($fast_checkout_state_required == 1) {
         $t->set_var("state_required", "*");
     }
     $t->parse("fast_checkout_state_select", false);
 } else {
     $t->set_var("fast_checkout_state_id_value", htmlspecialchars($user_details["state_id"]));
     $t->parse("fast_checkout_state_hidden", false);
 }
 if ($fast_checkout_postcode_show) {
     $t->set_var("fast_checkout_postcode", $user_details["postal_code"]);
     if ($fast_checkout_postcode_required == 1) {
         $t->set_var("postcode_required", "*");
     }
     $t->parse("fast_checkout_postcode_textbox", false);
 } else {
Example #10
0
            $t->set_var("payment_radio_id_checked", $checked);
            $t->set_var("payment_radio_id_value", $row_payment_id);
            $t->set_var("payment_radio_id_description", $row_payment_name);
            if ($row_image) {
                $t->set_var("src_image", $row_image);
                $t->set_var("alt_image", $row_image_alt);
                $t->sparse("image_option", false);
            } else {
                $t->set_var("image_option", "");
            }
            $t->parse("payment_radio_id", true);
        }
        $t->parse("payment_gateways_radio", false);
    } else {
        $events = array(BEFORE_SHOW_VALUE => "disabled_values_function", BEFORE_SHOW_VALUE . "_params" => array("disabled_array" => $disabled_values));
        set_options($payment_systems, $payment_id, "payment_select_id", $events);
        $t->parse("payment_gateways_select", false);
    }
} else {
    $payment_id = "";
    $r->errors = "Sorry, but there is no active payment system.";
}
// check credit amount for order before applying fee
$order_credit_amount = 0;
$credit_amount_left = $credit_amount;
if ($credit_amount_left > 0 && $order_total > 0) {
    if ($credit_amount_left > $order_total) {
        $order_credit_amount = $order_total;
    } else {
        $order_credit_amount = $credit_amount_left;
    }
<?php

/**
 * This script demonstrates Clever Instant Login, using OAuth 2.0 for token acquistion & request authentication.
 */
// By default, stop on all errors. In a production application, you may want to use only E_WARNING or otherwise silence with ~E_ALL
error_reporting(E_ALL);
// Handle incoming requests if we're running in a web server context
if ($_SERVER && array_key_exists('REQUEST_URI', $_SERVER)) {
    process_incoming_requests($_SERVER['REQUEST_URI'], set_options());
}
/**
 * Prepares options common to interacting with Clever's authentication & API
 *
 * @param   array $override_options  Options to oveverride from defaults
 * @throws  Exception if configuration options are not adequately met
 * @return  array $results           Options for use in Clever API requests
 */
function set_options(array $override_options = NULL)
{
    $options = array('client_id' => getenv('CLEVER_CLIENT_ID'), 'client_secret' => getenv('CLEVER_CLIENT_SECRET'), 'clever_redirect_base' => getenv('CLEVER_REDIRECT_BASE'), 'clever_oauth_base' => 'https://clever.com/oauth', 'clever_api_base' => 'https://api.clever.com');
    if (isset($override_options)) {
        array_merge($options, $override_options);
    }
    $options['clever_oauth_tokens_url'] = $options['clever_oauth_base'] . "/tokens";
    $options['clever_oauth_authorize_url'] = $options['clever_oauth_base'] . "/authorize";
    $options['clever_api_me_url'] = $options['clever_api_base'] . '/me';
    // Clever redirect URIs must be preregistered on your developer dashboard.
    // If using the default PORT set above, make sure to register "http://localhost:2587/oauth"
    $options['client_redirect_url'] = $options['clever_redirect_base'] . "/oauth";
    if (!empty($options['client_id']) && !empty($options['client_secret']) && !empty($options['clever_redirect_base'])) {