Example #1
0
 function site_text($language_id = false, $use_store_id = false)
 {
     global $languages_id, $store_id;
     if ($language_id === false) {
         $language_id = $languages_id;
     }
     if ($use_store_id === false) {
         $use_store_id = $store_id;
     }
     $this->languageID = $language_id;
     $this->storeID = $use_store_id;
     $this->langArray = smn_get_languages();
 }
Example #2
0
function store_category($action)
{
    if (isset($_POST['store_categories_id'])) {
        $store_categories_id = smn_db_prepare_input($_POST['store_categories_id']);
    }
    $sort_order = smn_db_prepare_input($_POST['sort_order']);
    $sql_data_array = array('sort_order' => $sort_order);
    if ($action == 'insert_store_category') {
        $insert_sql_data = array('store_parent_id' => (int) $current_store_category_id, 'date_added' => 'now()');
        $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
        smn_db_perform(TABLE_STORE_CATEGORIES, $sql_data_array);
        $store_categories_id = smn_db_insert_id();
    } elseif ($action == 'update_store_category') {
        $update_sql_data = array('last_modified' => 'now()');
        $sql_data_array = array_merge($sql_data_array, $update_sql_data);
        smn_db_perform(TABLE_STORE_CATEGORIES, $sql_data_array, 'update', "store_categories_id = '" . (int) $store_categories_id . "'");
    }
    $languages = smn_get_languages();
    $sizeof_languages = sizeof($languages);
    $store_categories_name_array = $_POST['store_categories_name'];
    $store_categories_description_array = $_POST['store_categories_description'];
    for ($i = 0, $n = $sizeof_languages; $i < $n; $i++) {
        $language_id = $languages[$i]['id'];
        $sql_data_array = array('store_categories_description' => smn_db_prepare_input($store_categories_description_array[$language_id]), 'store_categories_name' => smn_db_prepare_input($store_categories_name_array[$language_id]));
        if ($action == 'insert_store_category') {
            $insert_sql_data = array('store_categories_id' => (int) $store_categories_id, 'language_id' => $languages[$i]['id']);
            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
            smn_db_perform(TABLE_STORE_CATEGORIES_DESCRIPTION, $sql_data_array);
        } elseif ($action == 'update_store_category') {
            smn_db_perform(TABLE_STORE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "store_categories_id = '" . (int) $store_categories_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
        }
    }
    if (isset($_FILES['store_categories_image']) && is_array($_FILES['store_categories_image']) && $_FILES['store_categories_image']['size'] > 0) {
        if ($store_categories_image = new upload('store_categories_image', DIR_FS_CATALOG_IMAGES)) {
            smn_db_query("update " . TABLE_STORE_CATEGORIES . " set store_categories_image = '" . smn_db_input($store_categories_image->filename) . "' where store_categories_id = '" . (int) $store_categories_id . "'");
        }
    }
    if (USE_CACHE == 'true') {
        smn_reset_cache_block('store_categories');
        smn_reset_cache_block('also_purchased');
    }
    smn_redirect(smn_href_link(FILENAME_MANAGEMENT, 'sPath=' . $sPath . '&cID=' . $store_categories_id));
}
    } else {
        $page_text_query_raw = "select * from " . $db_table . " where text_key = '" . $_GET['text_key'] . "' and page_name='" . $_GET['page_name'] . "' and language_id ='" . $languages_id . "' and store_id = '" . $store_id . "'";
        $text_query = smn_db_query($page_text_query_raw);
        $text_list_query = smn_db_fetch_array($text_query);
        ?>
      <input type="hidden" name="page_name" value="<?php 
        echo $_GET['page_name'];
        ?>
">
      <input type="hidden" name="text_key" value="<?php 
        echo $_GET['text_key'];
        ?>
">
<?php 
    }
    $languages = smn_get_languages();
    for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
        if ($page_id) {
            $text_query_raw = smn_db_query("select * from " . TABLE_ARTICLES . " where  page_id= '" . $_GET['page_id'] . "' and language_id = '" . $languages[$i]['id'] . "' and store_id = '" . $store_id . "'");
        } else {
            $text_query_raw = smn_db_query("select * from " . $db_table . " where  text_key = '" . $_GET['text_key'] . "' and page_name='" . $_GET['page_name'] . "' and language_id = '" . $languages[$i]['id'] . "' and store_id = '" . $store_id . "'");
        }
        $language_list_query = smn_db_fetch_array($text_query_raw);
        if ($page_id) {
            ?>
          <tr>
            <td class="main"><?php 
            echo TEXT_CURRENT_TEXT;
            ?>
</td>
          </tr>
Example #4
0
function smn_reset_cache_block($cache_block)
{
    global $cache_blocks;
    for ($i = 0, $n = sizeof($cache_blocks); $i < $n; $i++) {
        if ($cache_blocks[$i]['code'] == $cache_block) {
            if ($cache_blocks[$i]['multiple']) {
                if ($dir = @opendir(DIR_FS_CACHE)) {
                    while ($cache_file = readdir($dir)) {
                        $cached_file = $cache_blocks[$i]['file'];
                        $languages = smn_get_languages();
                        for ($j = 0, $k = sizeof($languages); $j < $k; $j++) {
                            $cached_file_unlink = ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file);
                            if (ereg('^' . $cached_file_unlink, $cache_file)) {
                                @unlink(DIR_FS_CACHE . $cache_file);
                            }
                        }
                    }
                    closedir($dir);
                }
            } else {
                $cached_file = $cache_blocks[$i]['file'];
                $languages = smn_get_languages();
                for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
                    $cached_file = ereg_replace('-language', '-' . $languages[$i]['directory'], $cached_file);
                    @unlink(DIR_FS_CACHE . $cached_file);
                }
            }
            break;
        }
    }
}
Example #5
0
 function install()
 {
     global $store_id;
     $check_query = smn_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Preparing [PayPal IPN]' limit 1");
     if (smn_db_num_rows($check_query) < 1) {
         $status_query = smn_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
         $status = smn_db_fetch_array($status_query);
         $status_id = $status['status_id'] + 1;
         $languages = smn_get_languages();
         foreach ($languages as $lang) {
             smn_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal IPN]')");
         }
     } else {
         $check = smn_db_fetch_array($check_query);
         $status_id = $check['orders_status_id'];
     }
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','Enable PayPal IPN Module', 'MODULE_PAYMENT_PAYPAL_IPN_STATUS', 'False', 'Do you want to accept PayPal IPN payments?', '6', '1', 'smn_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','Gateway Server', 'MODULE_PAYMENT_PAYPAL_IPN_GATEWAY_SERVER', 'Testing', 'Use the testing (sandbox) or live gateway server for transactions?', '6', '2', 'smn_cfg_select_option(array(\\'Testing\\',\\'Live\\'), ', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','Sort order of display.', 'MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '3', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','Force shipping address?', 'MODULE_PAYMENT_PAYPAL_IPN_SHIPPING', 'False', 'If TRUE the address details for the PayPal Seller Protection Policy are sent but customers without a PayPal account must re-enter their details. If set to FALSE order is not eligible for Seller Protection but customers without acount will have their address fiels pre-populated.', '6', '4', 'smn_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','E-Mail Address', 'MODULE_PAYMENT_PAYPAL_IPN_ID', '', 'The e-mail address to use for the PayPal IPN service', '6', '5', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','Transaction Currency', 'MODULE_PAYMENT_PAYPAL_IPN_CURRENCY', 'Selected Currency', 'The currency to use for transactions', '6', '10', 'smn_cfg_select_option(array(\\'Selected Currency\\',\\'Only AUD\\',\\'Only CAD\\',\\'Only CHF\\',\\'Only CZK\\',\\'Only DKK\\',\\'Only EUR\\',\\'Only GBP\\',\\'Only HKD\\',\\'Only HUF\\',\\'Only JPY\\',\\'Only NOK\\',\\'Only NZD\\',\\'Only PLN\\',\\'Only SEK\\',\\'Only SGD\\',\\'Only USD\\'), ', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('" . $store_id . "','Payment Zone', 'MODULE_PAYMENT_PAYPAL_IPN_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '11', 'smn_get_zone_class_title', 'smn_cfg_pull_down_zone_classes(', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $store_id . "','Set Preparing Order Status', 'MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID', '" . $status_id . "', 'Set the status of prepared orders made with this payment module to this value', '6', '12', 'smn_cfg_pull_down_order_statuses(', 'smn_get_order_status_name', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $store_id . "','Set PayPal Acknowledged Order Status', 'MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '13', 'smn_cfg_pull_down_order_statuses(', 'smn_get_order_status_name', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('" . $store_id . "','Set PayPal Completed Order Status', 'MODULE_PAYMENT_PAYPAL_IPN_COMP_ORDER_STATUS_ID', '0', 'Set the status of orders which are confirmed as paid (completed) to this value', '6', '13', 'smn_cfg_pull_down_order_statuses(', 'smn_get_order_status_name', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','Transaction Type', 'MODULE_PAYMENT_PAYPAL_IPN_TRANSACTION_TYPE', 'Aggregate', 'Send individual items to PayPal or aggregate all as one total item?', '6', '14', 'smn_cfg_select_option(array(\\'Per Item\\',\\'Aggregate\\'), ', now())");
     // bof PandA.nl move tax to total amount
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','Move tax to total amount', 'MOVE_TAX_TO_TOTAL_AMOUNT', 'True', 'Do you want to move the tax to the total amount? If true PayPal will allways show the total amount including tax. (needs Aggregate instead of Per Item to function)', '6', '15', 'smn_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
     // eof PandA.nl move tax to total amount
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','Page Style', 'MODULE_PAYMENT_PAYPAL_IPN_PAGE_STYLE', '', 'The page style to use for the transaction procedure (defined at your PayPal Profile page)', '6', '20', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','Debug E-Mail Address', 'MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL', '', 'All parameters of an Invalid IPN notification will be sent to this email address if one is entered.', '6', '21', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','Enable Encrypted Web Payments', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS', 'False', 'Do you want to enable Encrypted Web Payments?', '6', '30', 'smn_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','Your Private Key', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY', '', 'The location of your Private Key to use for signing the data. (*.pem)', '6', '31', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','Your Public Certificate', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY', '', 'The location of your Public Certificate to use for signing the data. (*.pem)', '6', '32', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','PayPals Public Certificate', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY', '', 'The location of the PayPal Public Certificate for encrypting the data.', '6', '33', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','Your PayPal Public Certificate ID', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID', '', 'The Certificate ID to use from your PayPal Encrypted Payment Settings Profile.', '6', '34', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','Working Directory', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_WORKING_DIRECTORY', '', 'The working directory to use for temporary files. (trailing slash needed)', '6', '35', now())");
     smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $store_id . "','OpenSSL Location', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL', '/usr/bin/openssl', 'The location of the openssl binary file.', '6', '36', now())");
     if ($store_id == 1) {
         smn_db_query("insert into " . TABLE_CONFIGURATION . " (store_id,configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('" . $store_id . "','For Single Checkout?', 'MODULE_PAYMENT_PAYPAL_IPN_SINGLE_CHECKOUT', 'False', 'Use this payment for single checkout?', '6', '2', 'smn_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
     }
 }