本文整理汇总了PHP中write_configure函数的典型用法代码示例。如果您正苦于以下问题:PHP write_configure函数的具体用法?PHP write_configure怎么用?PHP write_configure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_configure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
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;
}
示例2: update
function update()
{
foreach ($this->keys() as $key) {
$field = strtolower($key['key']);
if (isset($_POST[$field])) {
write_configure($key['key'], $_POST[$field]);
}
}
}
示例3: update
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;
}
示例4: update
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;
}
示例5: update
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;
}
示例6: update
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;
}
示例7: update
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;
}
示例8: btn_save
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;
}
示例9: update
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;
}
示例10: changePassPhrase
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');
}
}
示例11: update
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'));
}
示例12: update
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;
}
示例13: switch
}
// 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');
}
}
示例14: validate_user
// | 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&page=main';
/*************** hook for custom actions ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/main/extra_actions.php';
if (file_exists($custom_path)) {
示例15: phreeform_admin
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')) {