//Drops. db_query('ALTER TABLE ' . PREFIX . 'department DROP `noreply_autoresp`'); db_query('ALTER TABLE ' . PREFIX . 'config DROP `noreply_email` ,DROP `alert_email` ,DROP `api_whitelist`'); db_query('TRUNCATE TABLE ' . PREFIX . 'email_pop3'); db_query('DROP TABLE ' . PREFIX . 'email_pop3'); } if ($errors) { break; } //break on any errors. //break on any errors. case 2: //upgrading v1.6 ST (latest release). $schema = './inc/v1.6st-upgrade.sql'; $vars = $errors = array(); if (!load_sql_schema($schema, $errors) && !$errors['err']) { $errors['err'] = 'Error parsing SQL schema! Get help from developers'; } if (!$errors) { //update the version to the latest $sendnotices = $cfg->autoRespONNewTicket() ? 1 : 0; db_query('UPDATE ' . CONFIG_TABLE . ' SET ostversion=' . db_input(VERSION) . ',ticket_notice_active=' . db_input($sendnotice)); //Fix attachment issues. require_once INCLUDE_DIR . 'class.ticket.php'; $sql = 'SELECT ticket.ticket_id, count(attach_id) as attachments FROM ' . TICKET_TABLE . ' ticket ' . 'LEFT JOIN ' . TICKET_ATTACHMENT_TABLE . ' attach ON ticket.ticket_id=attach.ticket_id ' . 'GROUP BY ticket.ticket_id'; //echo $sql; $resp = db_query($sql); if ($resp && db_num_rows($resp)) { while (list($id, $files) = db_fetch_row($resp)) { if (!$files) { continue;
if(!$errors && !file_exists(SCHEMAFILE)) { $errors['err']='Internal error. Please make sure your download is the latest'; $errors['mysql']='Missing SQL schema file'; } //Open the file for writing.. if(!$errors && !($fp = @fopen(CONFIGFILE,'r+'))){ $errors['err']='Unable to open config file for writing. Permission denied!'; } //IF no errors..Do the install. Let the fun start... if(!$errors && $fp) { define('ADMIN_EMAIL',$_POST['email']); //Needed to report SQL errors during install. define('PREFIX',$_POST['prefix']); //Table prefix $debug=false; //Change it to true to show failed query if(!load_sql_schema(SCHEMAFILE,$errors,$debug) && !$errors['err']) $errors['err']='Error parsing SQL schema! Get help from developers'; if(!$errors) { $info=$support; //Rewrite the config file. $configfile= str_replace("define('OSTINSTALLED',FALSE);","define('OSTINSTALLED',TRUE);",$configfile); $configfile= str_replace('%ADMIN-EMAIL',$_POST['email'],$configfile); $configfile= str_replace('%CONFIG-DBHOST',$_POST['dbhost'],$configfile); $configfile= str_replace('%CONFIG-DBNAME',$_POST['dbname'],$configfile); $configfile= str_replace('%CONFIG-DBUSER',$_POST['dbuser'],$configfile); $configfile= str_replace('%CONFIG-DBPASS',$_POST['dbpass'],$configfile); $configfile= str_replace('%CONFIG-PREFIX',$_POST['prefix'],$configfile); $configfile= str_replace('%CONFIG-SIRI',Misc::randcode(32),$configfile);