Beispiel #1
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     // load all modules
     $method_dir = DIR_FS_ADMIN . 'modules/' . $module . '/methods/';
     $methods = array();
     if ($dir = @dir($method_dir)) {
         while ($choice = $dir->read()) {
             if (file_exists($method_dir . $choice . '/' . $choice . '.php') && $choice != '.' && $choice != '..') {
                 $methods[] = $choice;
             }
         }
         $dir->close();
         //update keys
         foreach ($methods as $method) {
             require_once DIR_FS_ADMIN . 'modules/' . $module . '/methods/' . $method . '/' . $method . '.php';
             $properties = new $method();
             foreach ($properties->keys() as $key) {
                 if (!defined($key['key'])) {
                     write_configure($key['key'], $key['default']);
                 }
             }
         }
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #2
0
 function update()
 {
     foreach ($this->keys() as $key) {
         $field = strtolower($key['key']);
         if (isset($_POST[$field])) {
             write_configure($key['key'], $_POST[$field]);
         }
     }
 }
Beispiel #3
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #4
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (db_field_exists(TABLE_CURRENT_STATUS, 'next_capa_desc')) {
         $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_capa_desc");
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #5
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (MODULE_PHREEFORM_STATUS == '3.0') {
         write_configure('PDF_APP', 'TCPDF');
     }
     if (MODULE_PHREEFORM_STATUS < '3.5') {
         //		$id = admin_add_report_heading(TEXT_MISC, 'cust');
         //		if (admin_add_report_folder($id, TEXT_LETTERS, 'cust:ltr', 'fl')) $error = true;
         //		$id = admin_add_report_heading(TEXT_MISC, 'vend');
         //		if (admin_add_report_folder($id, TEXT_LETTERS, 'vend:ltr', 'fl')) $error = true;
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #6
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (MODULE_PHREEHELP_STATUS < 3.0) {
         foreach ($this->tables as $table => $create_table_sql) {
             if (!db_table_exists($table)) {
                 if (!$db->Execute($create_table_sql)) {
                     $error = true;
                 }
             }
         }
     }
     write_configure(PHREEHELP_FORCE_RELOAD, '1');
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #7
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (MODULE_ASSETS_STATUS < 3.1) {
         $tab_map = array('0' => '0');
         if (db_table_exists(DB_PREFIX . 'assets_tabs')) {
             $result = $db->Execute("select * from " . DB_PREFIX . 'assets_tabs');
             while (!$result->EOF) {
                 $updateDB = $db->Execute("insert into " . TABLE_EXTRA_TABS . " set \n\t\t\t  module_id = 'assets',\n\t\t\t  tab_name = '" . $result->fields['category_name'] . "',\n\t\t\t  description = '" . $result->fields['category_description'] . "',\n\t\t\t  sort_order = '" . $result->fields['sort_order'] . "'");
                 $tab_map[$result->fields['category_id']] = db_insert_id();
                 $result->MoveNext();
             }
             $db->Execute("DROP TABLE " . DB_PREFIX . "assets_tabs");
         }
         if (db_table_exists(DB_PREFIX . 'assets_fields')) {
             $result = $db->Execute("select * from " . DB_PREFIX . 'assets_fields');
             while (!$result->EOF) {
                 $updateDB = $db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set \n\t\t\t  module_id = 'assets',\n\t\t\t  tab_id = '" . $tab_map[$result->fields['category_id']] . "',\n\t\t\t  entry_type = '" . $result->fields['entry_type'] . "',\n\t\t\t  field_name = '" . $result->fields['field_name'] . "',\n\t\t\t  description = '" . $result->fields['description'] . "',\n\t\t\t  params = '" . $result->fields['params'] . "'");
                 $result->MoveNext();
             }
             $db->Execute("DROP TABLE " . DB_PREFIX . "assets_fields");
         }
         xtra_field_sync_list('assets', TABLE_ASSETS);
     }
     if (MODULE_ASSETS_STATUS < 3.3) {
         if (!db_field_exists(TABLE_ASSETS, 'attachments')) {
             $db->Execute("ALTER TABLE " . TABLE_ASSETS . " ADD attachments TEXT NOT NULL AFTER terminal_date");
         }
         require_once DIR_FS_MODULES . 'phreedom/functions/phreedom.php';
         xtra_field_sync_list('assets', TABLE_ASSETS);
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #8
0
 function btn_save($id = '')
 {
     global $db, $messageStack;
     if ($this->security_id < 3) {
         $messageStack->add(ERROR_NO_PERMISSION, 'error');
         return false;
     }
     $title = db_prepare_input($_POST['title']);
     $code = strtoupper(db_prepare_input($_POST['code']));
     if ($_POST['decimal_precise'] == '') {
         $_POST['decimal_precise'] = $_POST['decimal_places'];
     }
     $sql_data_array = array('title' => $title, 'code' => $code, 'symbol_left' => db_prepare_input($_POST['symbol_left']), 'symbol_right' => db_prepare_input($_POST['symbol_right']), 'decimal_point' => db_prepare_input($_POST['decimal_point']), 'thousands_point' => db_prepare_input($_POST['thousands_point']), 'decimal_places' => db_prepare_input($_POST['decimal_places']), 'decimal_precise' => db_prepare_input($_POST['decimal_precise']), 'value' => db_prepare_input($_POST['value']));
     if ($id) {
         db_perform($this->db_table, $sql_data_array, 'update', "currencies_id = " . (int) $id);
         gen_add_audit_log(SETUP_LOG_CURRENCY . TEXT_UPDATE, $title);
     } else {
         db_perform($this->db_table, $sql_data_array);
         gen_add_audit_log(SETUP_LOG_CURRENCY . TEXT_ADD, $title);
     }
     if (isset($_POST['default']) && $_POST['default'] == 'on') {
         // first check to see if there are any general ledger entries
         $result = $db->Execute("SELECT id FROM " . TABLE_JOURNAL_MAIN . " LIMIT 1");
         if ($result->RecordCount() > 0) {
             $messageStack->add(SETUP_ERROR_CANNOT_CHANGE_DEFAULT, 'error');
         } else {
             write_configure('DEFAULT_CURRENCY', db_input($code));
             db_perform($this->db_table, array('value' => 1), 'update', "code='{$code}'");
             // change default exc rate to 1
             $db->Execute("alter table " . TABLE_JOURNAL_MAIN . " \n\t\t\tchange currencies_code currencies_code CHAR(3) NOT NULL DEFAULT '" . db_input($code) . "'");
             $this->def_currency = db_input($code);
             $this->btn_update();
         }
     }
     return true;
 }
Beispiel #9
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (MODULE_CONTACTS_STATUS < 3.3) {
         $db->Execute("ALTER TABLE " . TABLE_CONTACTS . " CHANGE short_name short_name VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''");
         if (!db_table_exists(TABLE_CONTACTS_LOG)) {
             foreach ($this->tables as $table => $sql) {
                 if ($table == TABLE_CONTACTS_LOG) {
                     admin_install_tables(array($table => $sql));
                 }
             }
         }
         if (db_table_exists(DB_PREFIX . 'contacts_extra_fields')) {
             // first create a new tab
             if (!defined('SETUP_TITLE_EXTRA_FIELDS')) {
                 define('SETUP_TITLE_EXTRA_FIELDS', 'New Tab');
             }
             $updateDB = $db->Execute("insert into " . TABLE_EXTRA_TABS . " set\n\t\t  module_id = 'contacts',\n\t\t  tab_name = '" . SETUP_TITLE_EXTRA_FIELDS . "',\n\t\t  description = '" . SETUP_TITLE_EXTRA_FIELDS . "',\n\t\t  sort_order = '20'");
             $tab_id = db_insert_id();
             $result = $db->Execute("select * from " . DB_PREFIX . 'contacts_extra_fields');
             while (!$result->EOF) {
                 $params = unserialize($result->fields['params']);
                 // need to insert contact_type
                 $params['contact_type'] = $result->fields['contact_type'];
                 $updateDB = $db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set\n\t\t    module_id = 'contacts',\n\t\t    tab_id = '" . $tab_id . "',\n\t\t    entry_type = '" . $result->fields['entry_type'] . "',\n\t\t    field_name = '" . $result->fields['field_name'] . "',\n\t\t    description = '" . $result->fields['description'] . "',\n\t\t    params = '" . serialize($params) . "'");
                 $result->MoveNext();
             }
             $db->Execute("DROP TABLE " . DB_PREFIX . "contacts_extra_fields");
         }
         xtra_field_sync_list('contacts', TABLE_CONTACTS);
     }
     if (MODULE_CONTACTS_STATUS < 3.5) {
         if (db_field_exists(TABLE_CURRENT_STATUS, 'next_cust_id_desc')) {
             $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_cust_id_desc");
         }
         if (db_field_exists(TABLE_CURRENT_STATUS, 'next_vend_id_desc')) {
             $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_vend_id_desc");
         }
         if (!db_field_exists(TABLE_CONTACTS, 'attachments')) {
             $db->Execute("ALTER TABLE " . TABLE_CONTACTS . " ADD attachments TEXT NOT NULL AFTER tax_id");
         }
     }
     if (MODULE_CONTACTS_STATUS < 3.7) {
         if (!db_field_exists(TABLE_CONTACTS_LOG, 'entered_by')) {
             $db->Execute("ALTER TABLE " . TABLE_CONTACTS_LOG . " ADD entered_by INT(11) NOT NULL DEFAULT '0' AFTER contact_id");
         }
     }
     if (MODULE_CONTACTS_STATUS < 3.72) {
         $db->Execute("ALTER TABLE " . TABLE_CONTACTS . " CHANGE tax_id tax_id INT(11) NOT NULL DEFAULT '-1';");
     }
     if (MODULE_CONTACTS_STATUS < 3.73) {
         if (!db_field_exists(TABLE_CONTACTS, 'contacts_level')) {
             $db->Execute("ALTER TABLE " . TABLE_CONTACTS . " ADD contacts_level CHAR(1) NOT NULL DEFAULT 'r' AFTER type;");
         }
         xtra_field_sync_list('contacts', TABLE_CONTACTS);
     }
     if (!db_field_exists(TABLE_CURRENT_STATUS, 'next_crm_id_num')) {
         $result = $db->Execute("Select MAX(short_name + 1) AS new  FROM " . TABLE_CONTACTS . " WHERE TYPE = 'i'");
         $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " ADD next_crm_id_num VARCHAR( 16 ) NOT NULL DEFAULT '" . $result->fields['new'] . "';");
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #10
0
 function changePassPhrase()
 {
     global $messageStack;
     $old_pp = db_prepare_input($_POST['pass_phrase_current']);
     $new_pp = db_prepare_input($_POST['pass_phrase_new']);
     $dup_pp = db_prepare_input($_POST['pass_phrase_confirm']);
     // error check
     if ($old_pp != MODULE_SHIPPING_ENDICIA_PASS_PHRASE) {
         $messageStack->add(SHIPPING_ENDICIA_PASSPHRASE_OLD_NOT_MATCH, 'error');
         return false;
     }
     if ($new_pp != $dup_pp) {
         $messageStack->add(SHIPPING_ENDICIA_PASSPHRASE_NEW_NOT_MATCH, 'error');
         return false;
     }
     $data = array('ChangePassPhraseRequest' => array('RequesterID' => MODULE_SHIPPING_ENDICIA_PARTNER_ID, 'RequestID' => time(), 'CertifiedIntermediary' => array('AccountID' => MODULE_SHIPPING_ENDICIA_ACCOUNT_NUMBER, 'PassPhrase' => MODULE_SHIPPING_ENDICIA_PASS_PHRASE), 'NewPassPhrase' => $new_pp));
     $url = MODULE_SHIPPING_ENDICIA_TEST_MODE == 'Prod' ? MODULE_SHIPPING_ENDICIA_WSDL_URL : MODULE_SHIPPING_ENDICIA_TEST_WSDL_URL;
     $client = new SoapClient($url, array('trace' => 1));
     try {
         $response = $client->ChangePassPhrase($data);
         if ($response->ChangePassPhraseRequestResponse->Status == 0) {
             write_configure('MODULE_SHIPPING_ENDICIA_PASS_PHRASE', $new_pp);
             $messageStack->add(SHIPPING_ENDICIA_PASSPHRASE_SUCCESS_MSG, 'success');
         } else {
             $messageStack->add(TEXT_ERROR . ' (' . $response->ChangePassPhraseRequestResponse->Status . ') ' . $response->ChangePassPhraseRequestResponse->ErrorMessage, 'error');
         }
     } catch (SoapFault $exception) {
         $messageStack->add("SOAP error ({$exception->faultcode}) {$exception->faultstring}", 'error');
     }
 }
 function update($module)
 {
     global $db, $messageStack;
     foreach ($this->keys as $key => $value) {
         if (!defined($key)) {
             write_configure($key, $value);
         }
     }
     $sql = "select id from " . TABLE_EXTRA_FIELDS . " where module_id = 'contacts' and (field_name like '%bank_account%' or field_name like '%iban%')";
     $result = $db->Execute($sql);
     if ($result->RecordCount() == 0) {
         $result = $db->Execute("select id from " . TABLE_EXTRA_TABS . " where module_id='contacts' and tab_name = 'import_banking'");
         if ($result->RecordCount() == 0) {
             $db->Execute("INSERT INTO " . TABLE_EXTRA_TABS . " (module_id, tab_name, sort_order) VALUES( 'contacts','import_banking','100')");
             $tab_id = $db->insert_ID();
         } else {
             $tab_id = $result->fields['id'];
         }
         $db->Execute("INSERT INTO " . TABLE_EXTRA_FIELDS . " (module_id, tab_id, entry_type, field_name, description, params) VALUES ('contacts', {$tab_id}, 'text', 'iban', 'IBAN', 'a:4:{s:4:\"type\";s:4:\"text\";s:12:\"contact_type\";s:4:\"c:v:\";s:6:\"length\";i:32;s:7:\"default\";s:0:\"\";}')");
     }
     foreach ($this->tables as $table => $sql) {
         if ($table == TABLE_IMPORT_BANK) {
             admin_install_tables(array($table => $sql));
         }
     }
     $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
 }
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (MODULE_RMA_STATUS < 3.1) {
         if (db_field_exists(TABLE_CURRENT_STATUS, 'next_rma_desc')) {
             $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_rma_desc");
         }
     }
     if (MODULE_RMA_STATUS < 3.3) {
         if (!db_field_exists(TABLE_RMA, 'attachments')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD attachments TEXT DEFAULT NULL AFTER closed_date");
         }
         if (!db_field_exists(TABLE_RMA, 'contact_id')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD contact_id VARCHAR(32) DEFAULT NULL AFTER caller_email");
         }
         if (!db_field_exists(TABLE_RMA, 'contact_name')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD contact_name VARCHAR(48) DEFAULT NULL AFTER contact_id");
         }
         if (!db_field_exists(TABLE_RMA, 'purch_order_id')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD purch_order_id VARCHAR(24) DEFAULT NULL AFTER purchase_invoice_id");
         }
         if (!db_field_exists(TABLE_RMA, 'receive_details')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD receive_details TEXT DEFAULT NULL AFTER receive_notes");
         }
         if (!db_field_exists(TABLE_RMA, 'close_notes')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD close_notes VARCHAR(255) DEFAULT NULL AFTER receive_details");
         }
         if (!db_field_exists(TABLE_RMA, 'close_details')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD close_details TEXT DEFAULT NULL AFTER close_notes");
         }
         if (!db_field_exists(TABLE_RMA, 'invoice_date')) {
             $db->Execute("ALTER TABLE " . TABLE_RMA . " ADD invoice_date DATE NOT NULL DEFAULT '0000-00-00' AFTER creation_date");
         }
         $result = $db->Execute("select * from " . DB_PREFIX . 'rma_module_item');
         $output = array();
         while (!$result->EOF) {
             $output[$result->fields['ref_id']][] = array('sku' => $result->fields['sku'], 'qty' => $result->fields['qty'], 'notes' => $result->fields['item_notes'], 'action' => $result->fields['item_action']);
             $result->MoveNext();
         }
         if (sizeof($output > 0)) {
             foreach ($output as $key => $value) {
                 db_perform(TABLE_RMA, array('close_details' => serialize($value)), 'update', 'id = ' . $key);
             }
         }
         if (db_table_exists(DB_PREFIX . 'rma_module_item')) {
             $db->Execute("drop table " . DB_PREFIX . 'rma_module_item');
         }
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #13
0
 }
 // force complete copy of phreedom module
 switch ($task) {
     case 'core':
     case 'demo':
         if (admin_install_dirs($install_mod->dirlist, DIR_FS_MY_FILES . $db_name . '/')) {
             $error = true;
         } elseif (admin_install_tables($install_mod->tables)) {
             // Create the tables
             $error = true;
         } else {
             // Load the installed module version into db
             write_configure('MODULE_' . strtoupper($entry) . '_STATUS', constant('MODULE_' . strtoupper($entry) . '_VERSION'));
             // Load the remaining configuration constants
             foreach ($install_mod->keys as $key => $value) {
                 write_configure($key, $value);
             }
             if ($task == 'demo') {
                 if ($install_mod->load_demo()) {
                     $error = true;
                 }
             }
             // load demo data
             if ($entry != 'phreedom') {
                 $install_mod->load_reports($entry);
             }
             if ($entry == 'phreeform') {
                 $temp_mod = new phreedom_admin();
                 $temp_mod->load_reports('phreedom');
             }
         }
Beispiel #14
0
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/phreehelp/pages/main/pre_process.php
//
$security_level = validate_user(0, true);
/**************  include page specific files    *********************/
require_once DIR_FS_WORKING . 'defaults.php';
require_once DIR_FS_WORKING . 'functions/phreehelp.php';
/**************   page specific initialization  *************************/
if (PHREEHELP_FORCE_RELOAD == '1') {
    // load/reload db tables if forced to
    synchronize();
    write_configure('PHREEHELP_FORCE_RELOAD', '0');
}
$frame_id = isset($_GET['fID']) ? $_GET['fID'] : 'main';
$context_ref = isset($_GET['idx']) ? $_GET['idx'] : '';
$result = false;
$start_page = DOC_ROOT_URL;
if ($context_ref) {
    $result = $db->Execute("select doc_url from " . TABLE_PHREEHELP . " where doc_pos = '" . $context_ref . "'");
    if ($result->RecordCount() > 0) {
        $start_page = $result->fields['doc_url'];
    }
}
$frame_url = 'index.php?module=phreehelp&amp;page=main';
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/main/extra_actions.php';
if (file_exists($custom_path)) {
require_once DIR_FS_WORKING . 'defaults.php';
require_once DIR_FS_WORKING . 'functions/phreeform.php';
require_once DIR_FS_MODULES . 'phreedom/functions/phreedom.php';
require_once DIR_FS_WORKING . 'classes/install.php';
/**************   page specific initialization  *************************/
$error = false;
$install = new phreeform_admin();
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        validate_security($security_level, 3);
        // save general tab
        foreach ($install->keys as $key => $default) {
            $field = strtolower($key);
            if (isset($_POST[$field])) {
                write_configure($key, $_POST[$field]);
            }
        }
        $messageStack->add(GENERAL_CONFIG_SAVED, 'success');
        gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
        break;
    case 'fix':
        // drop the database
        $db->Execute("truncate " . TABLE_PHREEFORM);
        // load all the install classes to re-build directory structure
        $install_mod = new phreeform_admin();
        $install_mod->load_reports('phreeform');
        $contents = scandir(DIR_FS_MODULES);
        foreach ($contents as $entry) {
            // install each module
            if (!defined('MODULE_' . strtoupper($entry) . '_STATUS')) {
Beispiel #16
0
            $install_mod->load_reports($entry);
        }
    }
}
// reload pages array since it doesn't exist at the start of the update
global $loaded_modules;
$loaded_modules = array();
$dirs = scandir(DIR_FS_MODULES);
foreach ($dirs as $dir) {
    // first pull all module language files, loaded or not
    if ($dir == '.' || $dir == '..') {
        continue;
    }
    if (is_dir(DIR_FS_MODULES . $dir)) {
        gen_pull_language($dir, 'menu');
    }
}
foreach ($dirs as $dir) {
    if ($dir == '.' || $dir == '..') {
        continue;
    }
    if (defined('MODULE_' . strtoupper($dir) . '_STATUS')) {
        // module is loaded
        $loaded_modules[] = $dir;
        require_once DIR_FS_MODULES . $dir . '/config.php';
    }
}
write_configure('DATE_FORMAT', defined('DATE_FORMAT') ? DATE_FORMAT : 'm/d/Y');
write_configure('DATE_DELIMITER', defined('DATE_DELIMITER') ? DATE_DELIMITER : '/');
write_configure('DATE_TIME_FORMAT', defined('DATE_TIME_FORMAT') ? DATE_TIME_FORMAT : 'm/d/Y h:i:s a');
Beispiel #17
0
 function release_update($module, $version, $path = '')
 {
     global $db, $messageStack;
     $error = false;
     if (file_exists($path)) {
         include_once $path;
     }
     write_configure('MODULE_' . strtoupper($module) . '_STATUS', $version);
     return $error ? false : $version;
 }
Beispiel #18
0
function gen_auto_update_period($show_message = true)
{
    global $db, $messageStack;
    $period = gen_calculate_period(date('Y-m-d'), true);
    if ($period == CURRENT_ACCOUNTING_PERIOD && defined('CURRENT_ACCOUNTING_PERIOD')) {
        return;
    }
    // we're in the current period
    if (!$period) {
        // we're outside of the defined fiscal years
        if ($show_message) {
            $messageStack->add(ERROR_MSG_POST_DATE_NOT_IN_FISCAL_YEAR, 'error');
        }
    } else {
        // update CURRENT_ACCOUNTING_PERIOD constant with this new period
        $result = $db->Execute("select start_date, end_date from " . TABLE_ACCOUNTING_PERIODS . " where period = " . $period);
        write_configure('CURRENT_ACCOUNTING_PERIOD', $period);
        write_configure('CURRENT_ACCOUNTING_PERIOD_START', $result->fields['start_date']);
        write_configure('CURRENT_ACCOUNTING_PERIOD_END', $result->fields['end_date']);
        gen_add_audit_log(GEN_LOG_PERIOD_CHANGE);
        if ($show_message) {
            $messageStack->add(sprintf(ERROR_MSG_ACCT_PERIOD_CHANGE, $period), 'success');
        }
    }
}
Beispiel #19
0
 function update($module)
 {
     global $db, $messageStack, $currencies;
     $error = false;
     if (MODULE_INVENTORY_STATUS < 3.1) {
         $tab_map = array('0' => '0');
         if (db_table_exists(DB_PREFIX . 'inventory_categories')) {
             $result = $db->Execute("select * from " . DB_PREFIX . 'inventory_categories');
             while (!$result->EOF) {
                 $updateDB = $db->Execute("insert into " . TABLE_EXTRA_TABS . " set\n\t\t\t  module_id = 'inventory',\n\t\t\t  tab_name = '" . $result->fields['category_name'] . "',\n\t\t\t  description = '" . $result->fields['category_description'] . "',\n\t\t\t  sort_order = '" . $result->fields['sort_order'] . "'");
                 $tab_map[$result->fields['category_id']] = db_insert_id();
                 $result->MoveNext();
             }
             $db->Execute("DROP TABLE " . DB_PREFIX . "inventory_categories");
         }
         if (db_table_exists(DB_PREFIX . 'inventory_categories')) {
             $result = $db->Execute("select * from " . DB_PREFIX . 'inventory_fields');
             while (!$result->EOF) {
                 $updateDB = $db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set\n\t\t\t  module_id = 'inventory',\n\t\t\t  tab_id = '" . $tab_map[$result->fields['category_id']] . "',\n\t\t\t  entry_type = '" . $result->fields['entry_type'] . "',\n\t\t\t  field_name = '" . $result->fields['field_name'] . "',\n\t\t\t  description = '" . $result->fields['description'] . "',\n\t\t\t  params = '" . $result->fields['params'] . "'");
                 $result->MoveNext();
             }
             $db->Execute("DROP TABLE " . DB_PREFIX . "inventory_fields");
         }
         xtra_field_sync_list('inventory', TABLE_INVENTORY);
     }
     if (MODULE_INVENTORY_STATUS < 3.2) {
         if (!db_field_exists(TABLE_PRICE_SHEETS, 'type')) {
             $db->Execute("ALTER TABLE " . TABLE_PRICE_SHEETS . " ADD type char(1) NOT NULL default 'c' AFTER sheet_name");
         }
         if (!db_field_exists(TABLE_INVENTORY, 'price_sheet_v')) {
             $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD price_sheet_v varchar(32) default NULL AFTER price_sheet");
         }
         xtra_field_sync_list('inventory', TABLE_INVENTORY);
     }
     if (MODULE_INVENTORY_STATUS < 3.6) {
         $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD INDEX ( sku )");
         if (!db_field_exists(TABLE_INVENTORY, 'attachments')) {
             $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD attachments text AFTER last_journal_date");
         }
         if (!db_field_exists(TABLE_INVENTORY, 'full_price_with_tax')) {
             $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD full_price_with_tax FLOAT NOT NULL DEFAULT '0' AFTER full_price");
         }
         if (!db_field_exists(TABLE_INVENTORY, 'product_margin')) {
             $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD product_margin FLOAT NOT NULL DEFAULT '0' AFTER full_price_with_tax");
         }
         if (!db_field_exists(TABLE_EXTRA_FIELDS, 'use_in_inventory_filter')) {
             $db->Execute("ALTER TABLE " . TABLE_EXTRA_FIELDS . " ADD use_in_inventory_filter ENUM( '0', '1' ) NOT NULL DEFAULT '0'");
         }
         $db->Execute("alter table " . TABLE_INVENTORY . " CHANGE inactive inactive ENUM( '0', '1' ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '0'");
         xtra_field_sync_list('inventory', TABLE_INVENTORY);
         $db->Execute("update " . TABLE_INVENTORY . " set inventory_type = 'ma' where inventory_type = 'as'");
         $result = $db->Execute("select * from " . TABLE_EXTRA_FIELDS . " where module_id = 'inventory'");
         while (!$result->EOF) {
             $temp = unserialize($result->fields['params']);
             switch ($result->fields['field_name']) {
                 case 'serialize':
                     $temp['inventory_type'] = 'sa:sr';
                     break;
                 case 'item_taxable':
                 case 'purch_taxable':
                 case 'item_cost':
                 case 'price_sheet':
                 case 'price_sheet_v':
                 case 'full_price':
                 case 'full_price_with_tax':
                 case 'product_margin':
                     $temp['inventory_type'] = 'ci:ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
                     break;
                 case 'image_with_path':
                     $temp['inventory_type'] = 'ia:ma:mb:mi:ms:ns:sa:si:sr';
                     break;
                 case 'account_cost_of_sales':
                     $temp['inventory_type'] = 'ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
                     break;
                 case 'cost_method':
                     $temp['inventory_type'] = 'ia:ma:mb:mi:ms:ns:si';
                     break;
                 case 'item_weight':
                     $temp['inventory_type'] = 'ia:ma:mb:mi:ms:ns:sa:si:sr';
                     break;
                 case 'quantity_on_hand':
                 case 'minimum_stock_level':
                 case 'reorder_quantity':
                     $temp['inventory_type'] = 'ia:ma:mi:ns:sa:si:sr';
                     break;
                 case 'quantity_on_order':
                 case 'quantity_on_allocation':
                     $temp['inventory_type'] = 'ia:mi:sa:si:sr';
                     break;
                 case 'quantity_on_sales_order':
                     $temp['inventory_type'] = 'ia:ma:mi:sa:si:sr';
                     break;
                 case 'lead_time':
                     $temp['inventory_type'] = 'ai:ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
                     break;
                 case 'upc_code':
                     $temp['inventory_type'] = 'ia:ma:mi:ns:sa:si:sr';
                     break;
                 default:
                     $temp['inventory_type'] = 'ai:ci:ds:ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
             }
             $updateDB = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set params = '" . serialize($temp) . "' where id = '" . $result->fields['id'] . "'");
             $result->MoveNext();
         }
         $haystack = array('attachments', 'account_sales_income', 'item_taxable', 'purch_taxable', 'image_with_path', 'account_inventory_wage', 'account_cost_of_sales', 'cost_method', 'lead_time');
         $result = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set entry_type = 'check_box' where field_name = 'inactive'");
         $result = $db->Execute("select * from " . TABLE_EXTRA_FIELDS . " where module_id = 'inventory'");
         while (!$result->EOF) {
             $use_in_inventory_filter = '1';
             if (in_array($result->fields['field_name'], $haystack)) {
                 $use_in_inventory_filter = '0';
             }
             $updateDB = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set use_in_inventory_filter = '" . $use_in_inventory_filter . "' where id = '" . $result->fields['id'] . "'");
             $result->MoveNext();
         }
         if (!db_table_exists(TABLE_INVENTORY_PURCHASE)) {
             foreach ($this->tables as $table => $sql) {
                 if ($table == TABLE_INVENTORY_PURCHASE) {
                     admin_install_tables(array($table => $sql));
                 }
             }
             if (db_field_exists(TABLE_INVENTORY, 'purch_package_quantity')) {
                 $result = $db->Execute("insert into " . TABLE_INVENTORY_PURCHASE . " ( sku, vendor_id, description_purchase, purch_package_quantity, purch_taxable, item_cost, price_sheet_v ) select sku, vendor_id, description_purchase, purch_package_quantity, purch_taxable, item_cost, price_sheet_v  from " . TABLE_INVENTORY);
                 $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " DROP purch_package_quantity");
             } else {
                 $result = $db->Execute("insert into " . TABLE_INVENTORY_PURCHASE . " ( sku, vendor_id, description_purchase, purch_package_quantity, purch_taxable, item_cost, price_sheet_v ) select sku, vendor_id, description_purchase, 1, purch_taxable, item_cost, price_sheet_v  from " . TABLE_INVENTORY);
             }
         }
         require_once DIR_FS_MODULES . 'phreebooks/functions/phreebooks.php';
         $tax_rates = ord_calculate_tax_drop_down('c');
         $result = $db->Execute("SELECT id, item_taxable, full_price, item_cost FROM " . TABLE_INVENTORY);
         while (!$result->EOF) {
             $sql_data_array = array();
             $sql_data_array['full_price_with_tax'] = round((1 + $tax_rates[$result->fields['item_taxable']]['rate'] / 100) * $result->fields['full_price'], $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
             if ($result->fields['item_cost'] != '' && $result->fields['item_cost'] > 0) {
                 $sql_data_array['product_margin'] = round($sql_data_array['full_price_with_tax'] / $result->fields['item_cost'], $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
             }
             db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "id = " . $result->fields['id']);
             $result->MoveNext();
         }
         mkdir(DIR_FS_MY_FILES . $_SESSION['company'] . '/inventory/attachments/', 0755, true);
     }
     if (MODULE_INVENTORY_STATUS < 3.7) {
         if (!db_field_exists(TABLE_INVENTORY_HISTORY, 'avg_cost')) {
             $db->Execute("ALTER TABLE " . TABLE_INVENTORY_HISTORY . " ADD avg_cost FLOAT NOT NULL DEFAULT '0' AFTER unit_cost");
             $db->Execute("UPDATE " . TABLE_INVENTORY_HISTORY . " SET avg_cost = unit_cost");
         }
         $result = $db->Execute("select id, params from " . TABLE_EXTRA_FIELDS . " where module_id = 'inventory' AND field_name = 'account_cost_of_sales'");
         $temp = unserialize($result->fields['params']);
         $temp['inventory_type'] = 'ai:ci:ds:ia:lb:ma:mb:mi:ms:ns:sa:sf:si:sr:sv';
         $updateDB = $db->Execute("update " . TABLE_EXTRA_FIELDS . " set params='" . serialize($temp) . "' where id='" . $result->fields['id'] . "'");
         $db->Execute("ALTER TABLE " . TABLE_INVENTORY . "\n\t\t\tCHANGE item_cost item_cost DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE full_price full_price DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE full_price_with_tax full_price_with_tax DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE product_margin product_margin DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE item_weight item_weight DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_hand quantity_on_hand DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_order quantity_on_order DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_sales_order quantity_on_sales_order DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE quantity_on_allocation quantity_on_allocation DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE minimum_stock_level minimum_stock_level DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE reorder_quantity reorder_quantity DOUBLE NOT NULL DEFAULT '0'");
         $db->Execute("ALTER TABLE " . TABLE_INVENTORY_ASSY_LIST . " CHANGE qty qty double NOT NULL default '0'");
         $db->Execute("ALTER TABLE " . TABLE_INVENTORY_COGS_OWED . " CHANGE qty qty double NOT NULL default '0'");
         $db->Execute("ALTER TABLE " . TABLE_INVENTORY_COGS_USAGE . " CHANGE qty qty double NOT NULL default '0'");
         $db->Execute("ALTER TABLE " . TABLE_INVENTORY_HISTORY . "\n\t\t\tCHANGE qty qty DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE remaining remaining DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE unit_cost unit_cost DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE avg_cost avg_cost DOUBLE NOT NULL DEFAULT '0'");
         $db->Execute("ALTER TABLE " . TABLE_INVENTORY_PURCHASE . "\n\t\t\tCHANGE purch_package_quantity purch_package_quantity DOUBLE NOT NULL DEFAULT '0',\n\t\t\tCHANGE item_cost item_cost DOUBLE NOT NULL DEFAULT '0'");
     }
     if (version_compare(MODULE_INVENTORY_STATUS, '3.7.4', '<')) {
         if (!db_field_exists(TABLE_INVENTORY, 'product_markup')) {
             $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " CHANGE product_margin product_markup DOUBLE NOT NULL DEFAULT '0'");
             $db->Execute("ALTER TABLE " . TABLE_INVENTORY . " ADD product_margin DOUBLE NOT NULL DEFAULT '0' AFTER product_markup");
             $db->Execute("insert into " . TABLE_EXTRA_FIELDS . " set module_id = 'inventory', tab_id = '0', entry_type = 'decimal', field_name = 'product_markup',\n\t\t\t\tdescription = 'product_markup', params = 'a:2:{s:4:\"type\";N;s:14:\"inventory_type\";s:39:\"lb:ma:ia:mb:ms:ci:ns:sa:sr:sv:mi:sf:si:\";}'");
         }
         $result = $db->Execute("SELECT i.id, i.full_price, i.item_cost, max(p.item_cost) as purchase_cost FROM " . TABLE_INVENTORY . " i left join " . TABLE_INVENTORY_PURCHASE . " p on (p.sku = i.sku) ");
         while (!$result->EOF) {
             $sql_data_array = array();
             if ($result->fields['purchase_cost'] > $result->fields['item_cost']) {
                 $sql_data_array['product_margin'] = round(($result->fields['full_price'] - $result->fields['purchase_cost']) / $result->fields['full_price'] * 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
                 db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "id = " . $result->fields['id']);
             } else {
                 $sql_data_array['product_margin'] = round(($result->fields['full_price'] - $result->fields['item_cost']) / $result->fields['full_price'] * 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
                 db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "id = " . $result->fields['id']);
             }
             $result->MoveNext();
         }
     }
     if (!$error) {
         xtra_field_sync_list('inventory', TABLE_INVENTORY);
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
 function update($module)
 {
     global $db;
     write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
 }
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'upload':
        $upXML = new zencart();
        $id = db_prepare_input($_POST['rowSeq']);
        if ($upXML->submitXML($id, 'product_ul')) {
            gen_add_audit_log(ZENCART_UPLOAD_PRODUCT, $upXML->sku);
        }
        break;
    case 'bulkupload':
        $upXML = new bulk_upload();
        $inc_image = isset($_POST['include_images']) ? true : false;
        if ($upXML->bulkUpload($inc_image)) {
            gen_add_audit_log(ZENCART_BULK_UPLOAD);
            write_configure('MODULE_ZENCART_LAST_UPDATE', date('Y-m-d H:i:s'));
        }
        break;
    case 'sync':
        $upXML = new zencart();
        if ($upXML->submitXML(0, 'product_sync')) {
            gen_add_audit_log(ZENCART_PRODUCT_SYNC);
        }
        break;
    case 'confirm':
        $upXML = new zencart();
        $upXML->post_date = $ship_date;
        if ($upXML->submitXML(0, 'confirm')) {
            gen_add_audit_log(ZENCART_SHIP_CONFIRM, $ship_date);
        }
        break;
Beispiel #22
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (MODULE_PHREEPOS_STATUS < 3.2) {
         if (!defined('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE')) {
             write_configure('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE', '');
         }
         if (!defined('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE')) {
             write_configure('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE', '');
         }
     }
     if (MODULE_PHREEPOS_STATUS < 3.3) {
         if (!defined('PHREEPOS_RECEIPT_PRINTER_OPEN_DRAWER')) {
             write_configure('PHREEPOS_RECEIPT_PRINTER_OPEN_DRAWER', '');
         }
         if (!defined('PHREEPOS_DISPLAY_WITH_TAX')) {
             write_configure('PHREEPOS_DISPLAY_WITH_TAX', '1');
         }
         if (!defined('PHREEPOS_DISCOUNT_OF')) {
             write_configure('PHREEPOS_DISCOUNT_OF', '0');
         }
         if (!defined('PHREEPOS_ROUNDING')) {
             write_configure('PHREEPOS_ROUNDING', '0');
         }
     }
     if (!db_table_exists(TABLE_PHREEPOS_TILLS)) {
         foreach ($this->tables as $table => $sql) {
             if ($table == TABLE_PHREEPOS_TILLS) {
                 admin_install_tables(array($table => $sql));
             }
             foreach (gen_get_store_ids() as $store) {
                 $sql_data_array = array('store_id' => $store['id'], 'gl_acct_id' => AR_SALES_RECEIPTS_ACCOUNT, 'description' => $store['text'], 'rounding_gl_acct_id' => AR_SALES_RECEIPTS_ACCOUNT, 'dif_gl_acct_id' => AR_SALES_RECEIPTS_ACCOUNT, 'printer_name' => PHREEPOS_RECEIPT_PRINTER_NAME, 'printer_starting_line' => PHREEPOS_RECEIPT_PRINTER_STARTING_LINE, 'printer_closing_line' => PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE, 'printer_open_drawer' => '');
                 db_perform(TABLE_PHREEPOS_TILLS, $sql_data_array);
             }
             if (defined('PHREEPOS_RECEIPT_PRINTER_NAME')) {
                 remove_configure('PHREEPOS_RECEIPT_PRINTER_NAME');
             }
             if (defined('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE')) {
                 remove_configure('PHREEPOS_RECEIPT_PRINTER_STARTING_LINE');
             }
             if (defined('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE')) {
                 remove_configure('PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE');
             }
         }
     }
     foreach ($this->tables as $table => $sql) {
         if ($table == TABLE_PHREEPOS_OTHER_TRANSACTIONS) {
             admin_install_tables(array($table => $sql));
         }
     }
     if (!defined('PHREEPOS_ENABLE_DIRECT_PRINTING')) {
         write_configure('PHREEPOS_ENABLE_DIRECT_PRINTING', 0);
     }
     if (!db_field_exists(TABLE_PHREEPOS_TILLS, 'tax_id')) {
         $db->Execute("ALTER TABLE " . TABLE_PHREEPOS_TILLS . " ADD tax_id INT(11) default '-1' AFTER max_discount");
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #23
0
        if (!$error) {
            $_SESSION['admin_encrypt'] = $enc_key;
            $messageStack->add(GEN_ENCRYPTION_KEY_SET, 'success');
        }
        break;
    case 'encrypt_key':
        validate_security($security_level, 4);
        $old_key = db_prepare_input($_POST['old_encrypt_key']);
        $new_key = db_prepare_input($_POST['new_encrypt_key']);
        $new_key_confirm = db_prepare_input($_POST['new_encrypt_confirm']);
        if (defined('ENCRYPTION_VALUE') && !pw_validate_password($old_key, ENCRYPTION_VALUE)) {
            $error = $messageStack->add(ERROR_OLD_ENCRYPT_NOT_CORRECT, 'error');
        }
        if (strlen($new_key) < ENTRY_PASSWORD_MIN_LENGTH) {
            $error = $messageStack->add(sprintf(ENTRY_PASSWORD_NEW_ERROR, ENTRY_PASSWORD_MIN_LENGTH), 'error');
        }
        if ($new_key != $new_key_confirm) {
            $error = $messageStack->add(ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING, 'error');
        }
        if (!$error) {
            write_configure('ENCRYPTION_VALUE', pw_encrypt_password($new_key));
            $messageStack->add(GEN_ENCRYPTION_KEY_CHANGED, 'success');
        }
        break;
    default:
}
/*****************   prepare to display templates  *************************/
$include_header = true;
$include_footer = true;
$include_template = 'template_main.php';
define('PAGE_TITLE', BOX_HEADING_ENCRYPTION);
Beispiel #24
0
 function update()
 {
     foreach ($this->keys() as $key) {
         $field = strtolower($key['key']);
         switch ($key['key']) {
             case 'MODULE_SHIPPING_UPS_TYPES':
                 // read the checkboxes
                 write_configure($key['key'], implode(',', $_POST[$field]));
                 break;
             default:
                 // just write the value
                 if (isset($_POST[$field])) {
                     write_configure($key['key'], $_POST[$field]);
                 }
         }
     }
 }
Beispiel #25
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (!defined('MODULE_' . strtoupper($module) . '_VERSION')) {
         return $error;
     }
     // shippig module not installed,
     if (MODULE_SHIPPING_STATUS < 3.2) {
         if (!db_field_exists(TABLE_CURRENT_STATUS, 'next_shipment_num')) {
             $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " ADD next_shipment_num VARCHAR(16) NOT NULL DEFAULT '1'");
         }
         if (db_field_exists(TABLE_CURRENT_STATUS, 'next_shipment_desc')) {
             $db->Execute("ALTER TABLE " . TABLE_CURRENT_STATUS . " DROP next_shipment_desc");
         }
     }
     if (MODULE_SHIPPING_STATUS < 3.7) {
         $db->Execute("ALTER TABLE " . TABLE_SHIPPING_LOG . " CHANGE cost cost DOUBLE NOT NULL DEFAULT '0'");
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }
Beispiel #26
0
 function update($module)
 {
     global $db, $messageStack;
     $error = false;
     if (MODULE_ZENCART_STATUS < 3.4) {
         write_configure('MODULE_ZENCART_LAST_UPDATE', date('0000-00-00 00:00:00'));
     }
     $result = $db->Execute("select tab_id from " . TABLE_EXTRA_FIELDS . " where field_name = 'category_id'");
     if ($result->RecordCount() == 0) {
         $error = $messageStack->add('can not find tab_name ZenCart', 'error');
     } else {
         $tab_id = $result->fields['tab_id'];
     }
     if ($error == false && !db_field_exists(TABLE_INVENTORY, 'ProductURL')) {
         $sql_data_array = array('module_id' => 'inventory', 'tab_id' => $tab_id, 'entry_type' => 'text', 'field_name' => 'ProductURL', 'description' => ZENCART_CATALOG_URL, 'params' => serialize(array('type' => 'text', 'length' => '64', 'default' => '', 'inventory_type' => 'ai:ci:ds:sf:ma:ia:lb:mb:ms:mi:ns:sa:sr:sv:si:')));
         db_perform(TABLE_EXTRA_FIELDS, $sql_data_array);
         $db->Execute("alter table " . TABLE_INVENTORY . " add column ProductURL varchar(64) default ''");
     }
     if ($error == false && !db_field_exists(TABLE_INVENTORY, 'ProductModel')) {
         $sql_data_array = array('module_id' => 'inventory', 'tab_id' => $tab_id, 'entry_type' => 'text', 'field_name' => 'ProductModel', 'description' => ZENCART_CATALOG_MODEL, 'params' => serialize(array('type' => 'text', 'length' => '64', 'default' => '', 'inventory_type' => 'ai:ci:ds:sf:ma:ia:lb:mb:ms:mi:ns:sa:sr:sv:si:')));
         db_perform(TABLE_EXTRA_FIELDS, $sql_data_array);
         $db->Execute("alter table " . TABLE_INVENTORY . " add column ProductModel varchar(64) default ''");
     }
     if (!$error) {
         write_configure('MODULE_' . strtoupper($module) . '_STATUS', constant('MODULE_' . strtoupper($module) . '_VERSION'));
         $messageStack->add(sprintf(GEN_MODULE_UPDATE_SUCCESS, $module, constant('MODULE_' . strtoupper($module) . '_VERSION')), 'success');
     }
     return $error;
 }