2014-06-28 00:57:33 -04:00
< ? php
define ( 'IN_SCRIPT' , 1 );
define ( 'HESK_PATH' , '../' );
require ( HESK_PATH . 'install/install_functions.inc.php' );
require ( HESK_PATH . 'hesk_settings.inc.php' );
2014-06-28 15:57:14 -04:00
$showFinished = 'none' ;
$showInstructions = 'block' ;
2014-06-28 00:57:33 -04:00
if ( $_GET [ 'update' ] == 1 )
{
hesk_dbConnect ();
$somethingRS = hesk_dbQuery ( " SHOW TABLES LIKE ' " . $hesk_settings [ 'db_pfix' ] . " statuses' " );
$shouldBuildTable = ( $somethingRS -> num_rows == 0 );
2014-06-28 15:57:14 -04:00
$showInstructions = 'none' ;
$showFinished = 'block' ;
2014-06-28 00:57:33 -04:00
if ( $shouldBuildTable )
{
$showInstructions = 'none' ;
$showFinished = 'block' ;
2014-06-28 15:57:14 -04:00
//-- Need to do this since we are no longer restricted on IDs and we want an INT for proper INNER JOINs
hesk_dbQuery ( " ALTER TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " tickets` CHANGE COLUMN `status` `status` INT NOT NULL DEFAULT '0' " );
2014-06-28 00:57:33 -04:00
hesk_dbQuery ( " CREATE TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " statuses` (
2014-06-28 15:57:14 -04:00
`ID` INT NOT NULL ,
`ShortNameContentKey` TEXT NOT NULL ,
`TicketViewContentKey` TEXT NOT NULL ,
`TextColor` TEXT NOT NULL ,
`IsNewTicketStatus` BIT NOT NULL DEFAULT 0 ,
`IsClosed` BIT NOT NULL DEFAULT 0 ,
`IsClosedByClient` BIT NOT NULL DEFAULT 0 ,
`IsCustomerReplyStatus` BIT NOT NULL DEFAULT 0 ,
`IsStaffClosedOption` BIT NOT NULL DEFAULT 0 ,
`IsStaffReopenedStatus` BIT NOT NULL DEFAULT 0 ,
`IsDefaultStaffReplyStatus` BIT NOT NULL DEFAULT 0 ,
`LockedTicketStatus` BIT NOT NULL DEFAULT 0 ,
2014-06-28 00:57:33 -04:00
PRIMARY KEY ( `ID` )) " );
2014-06-28 15:57:14 -04:00
hesk_dbQuery ( " INSERT INTO ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus,
IsStaffClosedOption , IsStaffReopenedStatus , IsDefaultStaffReplyStatus , LockedTicketStatus )
VALUES ( 0 , 'open' , 'open' , '#FF0000' , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ); " );
2014-06-28 00:57:33 -04:00
2014-06-28 15:57:14 -04:00
hesk_dbQuery ( " INSERT INTO ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus,
IsStaffClosedOption , IsStaffReopenedStatus , IsDefaultStaffReplyStatus , LockedTicketStatus )
VALUES ( 1 , 'wait_reply' , 'wait_staff_reply' , '#FF9933' , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 ); " );
hesk_dbQuery ( " INSERT INTO ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus,
IsStaffClosedOption , IsStaffReopenedStatus , IsDefaultStaffReplyStatus , LockedTicketStatus )
VALUES ( 2 , 'replied' , 'wait_cust_reply' , '#0000FF' , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 ); " );
hesk_dbQuery ( " INSERT INTO ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus,
IsStaffClosedOption , IsStaffReopenedStatus , IsDefaultStaffReplyStatus , LockedTicketStatus )
2014-06-29 10:56:27 -04:00
VALUES ( 3 , 'resolved' , 'resolved' , '#008000' , 0 , 1 , 1 , 0 , 1 , 0 , 0 , 1 ); " );
2014-06-28 15:57:14 -04:00
hesk_dbQuery ( " INSERT INTO ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus,
IsStaffClosedOption , IsStaffReopenedStatus , IsDefaultStaffReplyStatus , LockedTicketStatus )
VALUES ( 4 , 'in_progress' , 'in_progress' , '#000000' , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ); " );
hesk_dbQuery ( " INSERT INTO ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " statuses` (ID, ShortNameContentKey, TicketViewContentKey, TextColor, IsNewTicketStatus, IsClosed, IsClosedByClient, IsCustomerReplyStatus,
IsStaffClosedOption , IsStaffReopenedStatus , IsDefaultStaffReplyStatus , LockedTicketStatus )
VALUES ( 5 , 'on_hold' , 'on_hold' , '#000000' , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ); " );
2014-09-21 21:07:59 -04:00
hesk_dbQuery ( " ALTER TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " users` ADD COLUMN `autorefresh` BIGINT NOT NULL DEFAULT 0 AFTER `replies`; " );
2014-09-28 10:15:46 -04:00
hesk_dbQuery ( " CREATE TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " denied_ips` (
`ID` INT NOT NULL PRIMARY KEY AUTO_INCREMENT ,
`RangeStart` VARCHAR ( 100 ) NOT NULL ,
`RangeEnd` VARCHAR ( 100 ) NOT NULL ) " );
hesk_dbQuery ( " CREATE TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " denied_emails` (ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Email VARCHAR(100) NOT NULL); " );
hesk_dbQuery ( " ALTER TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " tickets` ADD COLUMN `parent` MEDIUMINT(8) NULL AFTER `custom20`; " );
2014-10-13 22:04:50 -04:00
hesk_dbQuery ( " ALTER TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " users` ADD COLUMN `active` BIT NOT NULL DEFAULT 1 AFTER `autorefresh` " );
2014-10-15 22:09:52 -04:00
hesk_dbQuery ( " ALTER TABLE ` " . hesk_dbEscape ( $hesk_settings [ 'db_pfix' ]) . " users` ADD COLUMN `can_manage_settings` INT NOT NULL DEFAULT 1 " );
2014-06-28 00:57:33 -04:00
}
}
?>
< html >
< head >
2014-10-13 22:04:50 -04:00
< title > NuMods 1.5 . 0 Install / Upgrade </ title >
2014-06-28 00:57:33 -04:00
</ head >
< body >
< div style = " display: <?php echo $showInstructions ; ?> " >
2014-10-13 22:04:50 -04:00
< h1 > Update NuMods from v1 . 4.1 to v1 . 5.0 </ h1 >
< p >< a href = " # " > Update here </ a >. < b > Do not use the installation below !</ b > </ p >
< h1 > Update NuMods from v1 . 2.4 - v1 . 3.0 to v1 . 5.0 </ h1 >
2014-09-28 10:24:36 -04:00
< p > If you attempted the v1 . 4.0 installation and it failed , use < a href = " updateTo1-4-1.php?ar=true " > this update link </ a >. Do not use the link below !</ p >
2014-09-28 10:15:46 -04:00
< p >< a href = " updateTo1-4-1.php " > Update here </ a >. < b > Do not use the installation below !</ b ></ p >
2014-10-13 22:04:50 -04:00
< h1 > Install NuMods v1 . 5.0 < b > for the first time </ b ></ h1 >
2014-06-28 00:57:33 -04:00
< h4 >< i > If you have not yet installed / updated HESK , please do so first before continuing ; otherwise installation will < b > fail </ b >!</ i ></ h4 >
< br />
2014-09-28 00:51:06 -04:00
< p > Please verify the database information below . Additionally , ensure that the database user has CREATE and ALTER permissions .</ p >
2014-06-28 00:57:33 -04:00
< p >< b > Database Host : </ b > < ? php echo $hesk_settings [ 'db_host' ]; ?> </p>
< p >< b > Database Name : </ b >< ? php echo $hesk_settings [ 'db_name' ]; ?> </p>
< p >< b > Database User : </ b >< ? php echo $hesk_settings [ 'db_user' ]; ?> </p>
< p >< b > Database Password : </ b >< ? php echo $hesk_settings [ 'db_pass' ]; ?> </p>
< p >< b > Database Prefix : </ b >< ? php echo $hesk_settings [ 'db_pfix' ]; ?> </p>
2014-09-21 21:07:59 -04:00
< a href = " ?update=1 " > Proceed with installation </ a >
2014-09-28 00:51:06 -04:00
< p > By proceeding , you agree to the terms of the < a href = " https://creativecommons.org/licenses/by-sa/4.0/ " target = " _blank " > Creative Commons Attribution - ShareAlike 4.0 International License .</ a ></ p >
2014-06-28 00:57:33 -04:00
</ div >
< div style = " display: <?php echo $showFinished ; ?> " >
2014-09-21 21:07:59 -04:00
< h1 > Installation Finished </ h1 >
< p > The installation of NuMods has finished . You can now delete the < b > install </ b > directory and access the < a href = " <?php echo HESK_PATH . 'admin'; ?> " > admin area </ a ></ p >
2014-06-28 00:57:33 -04:00
</ div >
</ body >
2014-08-05 20:48:20 -04:00
</ html >