require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(RMA_DIR_ATTACHMENTS, $filename, true); } die; case 'dn_attach': // download from list, assume the first document only $cID = db_prepare_input($_POST['rowSeq']); $result = $db->Execute("select attachments from " . TABLE_RMA . " where id = " . $cID); $attachments = unserialize($result->fields['attachments']); foreach ($attachments as $key => $value) { $filename = 'rma_' . $cID . '_' . $key . '.zip'; if (file_exists(RMA_DIR_ATTACHMENTS . $filename)) { require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(RMA_DIR_ATTACHMENTS, $filename, true); die; } } break; case 'go_first': $_REQUEST['list'] = 1; break; case 'go_previous': $_REQUEST['list'] = max($_REQUEST['list'] - 1, 1); break; case 'go_next': $_REQUEST['list']++; break; case 'go_last': $_REQUEST['list'] = 99999;
require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(CONTACTS_DIR_ATTACHMENTS, $filename, true); } die; case 'dn_attach': // download from list, assume the first document only $cID = db_prepare_input($_POST['rowSeq']); $result = $db->Execute("select attachments from " . TABLE_CONTACTS . " where id = {$cID}"); $attachments = unserialize($result->fields['attachments']); foreach ($attachments as $key => $value) { $filename = 'contacts_' . $cID . '_' . $key . '.zip'; if (file_exists(CONTACTS_DIR_ATTACHMENTS . $filename)) { require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(CONTACTS_DIR_ATTACHMENTS, $filename, true); die; } } case 'reset': $_SESSION['f0'] = $default_f0; break; case 'go_first': $_REQUEST['list'] = 1; break; case 'go_previous': $_REQUEST['list'] = max($_REQUEST['list'] - 1, 1); break; case 'go_next': $_REQUEST['list']++; break;
if ($working->make_dir_tree(DIR_FS_MODULES . $mod . '/', '')) { $error = true; } // read the db if ($working->make_db_info($mod_info->tables)) { $error = true; } // build the output string //echo 'result object = '; print_r($working->output); echo '<br><br>'; $xmlString = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"; $xmlString .= $working->build_xml_string($working->output); //echo 'writing: ' . htmlspecialchars($xmlString) . '<br>'; // store it in a file $handle = fopen(DIR_FS_MY_FILES . $mod . '.xml', "w"); $contents = fwrite($handle, $xmlString, strlen($xmlString)); fclose($handle); // zip it and download $mod_xml->source_dir = DIR_FS_MY_FILES; $mod_xml->source_file = $mod . '.xml'; $mod_xml->dest_dir = DIR_FS_MY_FILES; $mod_xml->dest_file = $mod . '_xml_info.zip'; $mod_xml->make_zip('file', $mod . '.xml'); $mod_xml->download(DIR_FS_MY_FILES, $mod . '_xml_info.zip'); break; default: } /***************** prepare to display templates *************************/ $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', XML_BUILDER_PAGE_TITLE);
} $cInfo = new objectInfo($_POST); // if we are here, there was an error, reload page $cInfo->post_date = gen_db_date($_POST['post_date']); break; case 'edit': $oID = (int) $_GET['oID']; validate_security($security_level, 2); $cInfo = new objectInfo(array()); break; case 'dn_attach': $oID = db_prepare_input($_POST['id']); if (file_exists(PHREEBOOKS_DIR_MY_ORDERS . 'order_' . $oID . '.zip')) { require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(PHREEBOOKS_DIR_MY_ORDERS, 'order_' . $oID . '.zip', true); } die; default: } /***************** prepare to display templates *************************/ // retrieve the list of gl accounts and fill js arrays $gl_array_list = gen_coa_pull_down(); $i = 0; $js_gl_array = 'var js_gl_array = new Array();' . chr(10); foreach ($gl_array_list as $account) { $is_asset = $coa_types_list[$account['type']]['asset'] ? '1' : '0'; $js_gl_array .= 'js_gl_array[' . $i . '] = new glProperties("' . $account['id'] . '", "' . $account['text'] . '", "' . $is_asset . '");' . chr(10); $i++; } $cal_gl = array('name' => 'datePost', 'form' => 'journal', 'fieldname' => 'post_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($post_date));
require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(ASSETS_DIR_ATTACHMENTS, $filename, true); } die; case 'dn_attach': // download from list, assume the first document only $cID = db_prepare_input($_POST['rowSeq']); $result = $db->Execute("select attachments from " . TABLE_ASSETS . " where id = " . $cID); $attachments = unserialize($result->fields['attachments']); foreach ($attachments as $key => $value) { $filename = 'assets_' . $cID . '_' . $key . '.zip'; if (file_exists(ASSETS_DIR_ATTACHMENTS . $filename)) { require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(ASSETS_DIR_ATTACHMENTS, $filename, true); die; } } break; case 'go_first': $_REQUEST['list'] = 1; break; case 'go_previous': $_REQUEST['list'] = max($_REQUEST['list'] - 1, 1); break; case 'go_next': $_REQUEST['list']++; break; case 'go_last': $_REQUEST['list'] = 99999;
$backup->dest_file = 'ship_' . $carrier . '_' . $fy_year . $fy_month . '.tar.bz2'; if ($backup->make_bz2('dir')) { $error = true; } break; default: case 'zip': $backup->dest_file = 'ship_' . $carrier . '_' . $fy_year . $fy_month . '.zip'; if ($backup->make_zip('dir')) { $error = true; } break; } if (!$error) { gen_add_audit_log(GEN_DB_DATA_BACKUP, TABLE_AUDIT_LOG); $backup->download($backup->dest_dir, $backup->dest_file); // will not return if successful } $default_tab_id = 'tools'; break; case 'clean': $carrier = db_prepare_input($_POST['carrier']); $fy_month = db_prepare_input($_POST['fy_month']); $fy_year = db_prepare_input($_POST['fy_year']); $conv_type = db_prepare_input($_POST['conv_type']); $backup = new backup(); $backup->source_dir = DIR_FS_MY_FILES . $_SESSION['company'] . '/shipping/labels/' . $carrier . '/' . $fy_year . '/' . $fy_month . '/'; if ($backup->delete_dir($backup->source_dir, $recursive = true)) { $error = true; } if (!$error) {
require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(INVENTORY_DIR_ATTACHMENTS, $filename, true); } die; case 'dn_attach': // download from list, assume the first document only $cID = db_prepare_input($_POST['rowSeq']); $result = $db->Execute("select attachments from " . TABLE_INVENTORY . " where id = {$cID}"); $attachments = unserialize($result->fields['attachments']); foreach ($attachments as $key => $value) { $filename = 'inventory_' . $cID . '_' . $key . '.zip'; if (file_exists(INVENTORY_DIR_ATTACHMENTS . $filename)) { require_once DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backup = new backup(); $backup->download(INVENTORY_DIR_ATTACHMENTS, $filename, true); die; } } case 'reset': $_SESSION['filter_field'] = null; $_REQUEST['filter_field'] = null; $_SESSION['filter_criteria'] = null; $_REQUEST['filter_criteria'] = null; $_SESSION['filter_value'] = null; $_REQUEST['filter_value'] = null; break; case 'go_first': $_REQUEST['list'] = 1; break; case 'go_previous':