diff --git a/cwslack-activities.php b/cwslack-activities.php index ec12ef6..c1de0b5 100644 --- a/cwslack-activities.php +++ b/cwslack-activities.php @@ -26,9 +26,9 @@ // Authorization array. Auto encodes API key for auhtorization above. $header_data = postHeader($companyname, $apipublickey, $apiprivatekey); -if(empty($_GET['token']) || ($_GET['token'] != $slackactivitiestoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode("|",$_GET['text']); //Explode the string attached to the slash command for use in variables. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slackactivitiestoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. +$exploded = explode("|",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. //Check to see if the first command in the text array is actually help, if so redirect to help webpage detailing slash command use. if ($exploded[0]=="help") { @@ -48,7 +48,7 @@ flush(); session_write_close(); if($sendtimeoutwait==true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); } } //End timeout fix block @@ -95,14 +95,14 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => $return)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => $return)); } else { die($return); //Post to slack } die(); } if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } diff --git a/cwslack-configs.php b/cwslack-configs.php index b17b11b..f1981fc 100644 --- a/cwslack-configs.php +++ b/cwslack-configs.php @@ -23,10 +23,10 @@ require_once 'config.php'; //Require config require_once 'functions.php'; //Require functions -if(empty($_GET['token']) || ($_GET['token'] != $slackconfigstoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slackconfigstoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode("|",$_GET['text']); //Explode the string attached to the slash command for use in variables. +$exploded = explode("|",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. //Check to see if the first command in the text array is actually help, if so redirect to help webpage detailing slash command use. if ($exploded[0]=="help") { @@ -46,7 +46,7 @@ flush(); session_write_close(); if($sendtimeoutwait==true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); } } //End timeout fix block @@ -86,7 +86,7 @@ if($dataTData==NULL) //If no contact is returned or your API URL is incorrect. { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No configuration found.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No configuration found.")); } else { die("No configuration found."); //Return properly encoded arrays in JSON for Slack parsing. } @@ -162,7 +162,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } diff --git a/cwslack-contacts.php b/cwslack-contacts.php index 4e5ca23..8fb4af3 100644 --- a/cwslack-contacts.php +++ b/cwslack-contacts.php @@ -23,10 +23,10 @@ require_once 'config.php'; require_once 'functions.php'; -if(empty($_GET['token']) || ($_GET['token'] != $slackcontactstoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slackcontactstoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode(" ",$_GET['text']); //Explode the string attached to the slash command for use in variables. +$exploded = explode(" ",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. //Check to see if the first command in the text array is actually help, if so redirect to help webpage detailing slash command use. if ($exploded[0]=="help") { @@ -46,7 +46,7 @@ flush(); session_write_close(); if($sendtimeoutwait==true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); } } //End timeout fix block @@ -84,7 +84,7 @@ if($dataTData==NULL) //If no contact is returned or your API URL is incorrect. { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No contact found or your API URL is incorrect.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No contact found or your API URL is incorrect.")); } else { die("No contact found or your API URL is incorrect."); //Post to slack } @@ -185,7 +185,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } diff --git a/cwslack-dbmanage.php b/cwslack-dbmanage.php index 12bbc3b..e2080f1 100644 --- a/cwslack-dbmanage.php +++ b/cwslack-dbmanage.php @@ -22,12 +22,12 @@ require_once 'config.php'; require_once 'functions.php'; -if(empty($_GET['token']) || ($_GET['token'] != $slackdbmantoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode(" ",$_GET['text']); //Explode the string attached to the slash command for use in variables. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slackdbmantoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. +$exploded = explode(" ",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. $explodeadmins = explode("|", $adminlist); //Explode list of acceptable admins. -if(!in_array($_GET["user_name"],$explodeadmins)) +if(!in_array($_REQUEST["user_name"],$explodeadmins)) { die("You are not authorized to access this command. Only the following users can: " . implode(", ",$explodeadmins)); } diff --git a/cwslack-follow.php b/cwslack-follow.php index 399f37c..4637297 100644 --- a/cwslack-follow.php +++ b/cwslack-follow.php @@ -24,11 +24,11 @@ $link=0; -if(empty($_GET['method']) || ($_GET['method'] != $followtoken && $_GET['method'] != $unfollowtoken)){ - if(empty($_GET['token']) || $_GET['token'] != $slackfollowtoken) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. - if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. +if(empty($_REQUEST['method']) || ($_REQUEST['method'] != $followtoken && $_REQUEST['method'] != $unfollowtoken)){ + if(empty($_REQUEST['token']) || $_REQUEST['token'] != $slackfollowtoken) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. + if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. - $exploded = explode(" ",$_GET['text']); //Explode the string attached to the slash command for use in variables. + $exploded = explode(" ",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. } else { $link=1; } @@ -53,7 +53,7 @@ if($link==0){ $ticketnumber = $exploded[0]; //Read ticket number to variable for convenience. - $username = $_GET['user_name']; //Read Slack username to variable for convenience. + $username = $_REQUEST['user_name']; //Read Slack username to variable for convenience. if (array_key_exists(1,$exploded)) //If a second string exists in the slash command array, make it the command. { @@ -62,14 +62,14 @@ } else { - $ticketnumber = $_GET['srnumber']; + $ticketnumber = $_REQUEST['srnumber']; $mysql = mysqli_connect($dbhost, $dbusername, $dbpassword, $dbdatabase); if (!$mysql) //Check for errors { die("Connection Error: " . mysqli_connect_error()); } - $val1 = mysqli_real_escape_string($mysql,$_GET['memberid']); + $val1 = mysqli_real_escape_string($mysql,$_REQUEST['memberid']); $sql = "SELECT slackuser FROM usermap where cwname = '".$val1."'"; $result = mysqli_query($mysql, $sql); //Run result @@ -81,15 +81,15 @@ } else { - $username = $_GET['memberid']; + $username = $_REQUEST['memberid']; } mysqli_close($mysql); - if($_GET['method']==$followtoken) + if($_REQUEST['method']==$followtoken) { //For future use. } - else if ($_GET['method']==$unfollowtoken) + else if ($_REQUEST['method']==$unfollowtoken) { $command="unfollow"; //Set command to unfollow if it matches the CW unfollowtoken } diff --git a/cwslack-incoming.php b/cwslack-incoming.php index 8288382..8c803da 100644 --- a/cwslack-incoming.php +++ b/cwslack-incoming.php @@ -31,11 +31,11 @@ $info = json_decode(stripslashes($data->Entity)); //Decode the entity field which contains the JSON data we want. //Connection kill blocks. Stops things from running if certain conditions are met. -if(empty($_GET['id']) || empty($_GET['action']) || empty($info)) die; //If anything we need doesn't exist, kill connection. +if(empty($_REQUEST['id']) || empty($_REQUEST['action']) || empty($info)) die; //If anything we need doesn't exist, kill connection. -if($_GET['action'] == "updated" && $_GET['srDetailRecId']==0 && $_GET['timeRecId']==0) die; //Kill connection if the update is not a note, and is something like a status change. This will prevent duplicate entries. +if($_REQUEST['action'] == "updated" && $_REQUEST['srDetailRecId']==0 && $_REQUEST['timeRecId']==0) die; //Kill connection if the update is not a note, and is something like a status change. This will prevent duplicate entries. -if($_GET['isProblemDescription']=="False" && $_GET['isInternalAnalysis']=="False" && $_GET['isResolution']=="False") die; //Die if no actual update. +if($_REQUEST['isProblemDescription']=="False" && $_REQUEST['isInternalAnalysis']=="False" && $_REQUEST['isResolution']=="False") die; //Die if no actual update. $badboards = explode("|",$badboard); //Explode with pipe seperator. $badstatuses = explode("|",$badstatus); //Explode with pipe seperator. @@ -56,32 +56,32 @@ } } } -else if (!empty($_GET['board'])) +else if (!empty($_REQUEST['board'])) { - if(strpos($_GET['board'], "-") !== false) + if(strpos($_REQUEST['board'], "-") !== false) { - $tempboards = explode("-", $_GET['board']); + $tempboards = explode("-", $_REQUEST['board']); if(!in_array($info->BoardName, $tempboards)) { die("Incorrect board"); } } - else if($_GET['board'] != $info->BoardName) + else if($_REQUEST['board'] != $info->BoardName) { die("Incorrect board"); } - if(!empty($_GET['channel'])) //If using channels in URL is set, and channel is not empty.. + if(!empty($_REQUEST['channel'])) //If using channels in URL is set, and channel is not empty.. { - $channel = $_GET['channel']; //Set $channel to the channel. + $channel = $_REQUEST['channel']; //Set $channel to the channel. } } //URL creation $ticketurl = $connectwise . "/$connectwisebranch/services/system_io/Service/fv_sr100_request.rails?service_recid="; //Set the URL required for ticket links. -$noteurl = $connectwise . "/$connectwisebranch/apis/3.0/service/tickets/" . $_GET['id'] . "/notes?orderBy=id%20desc"; //Set the URL required for cURL requests to ticket note API. -$timeurl = $connectwise . "/$connectwisebranch/apis/3.0/time/entries?conditions=chargeToId=" . $_GET['id'] . "&chargeToType=%27ServiceTicket%27&orderBy=dateEntered%20desc"; //Set the URL required for cURL requests to the time entry API. +$noteurl = $connectwise . "/$connectwisebranch/apis/3.0/service/tickets/" . $_REQUEST['id'] . "/notes?orderBy=id%20desc"; //Set the URL required for cURL requests to ticket note API. +$timeurl = $connectwise . "/$connectwisebranch/apis/3.0/time/entries?conditions=chargeToId=" . $_REQUEST['id'] . "&chargeToType=%27ServiceTicket%27&orderBy=dateEntered%20desc"; //Set the URL required for cURL requests to the time entry API. $dataTData = array(); //Blank array. $dataTimeData = array(); //Blank array. @@ -95,7 +95,7 @@ $skip = 0; //Create variable to skip posting to Slack channel while also allowing follow posts. $date=strtotime($info->EnteredDateUTC); //Convert date entered JSON result to time. $dateformat=date('m-d-Y g:i:sa',$date); //Convert previously converted time to a better time string. -$ticket=$_GET['id']; +$ticket=$_REQUEST['id']; $usetime = 0; //For posttext internal vs external flag. $dataarray = NULL; //For internal vs external flag. $dateformat = "None"; //Just in case! @@ -154,16 +154,16 @@ } } -if($_GET['action'] == "added" && $postadded == 1) +if($_REQUEST['action'] == "added" && $postadded == 1) { if($posttext==0) { $postfieldspre = array( "channel" => ($channel!=NULL ? "#" . $channel : NULL), "attachments"=>array(array( - "fallback" => (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, + "fallback" => (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, "title" => "<" . $ticketurl . $ticket . "&companyName=" . $companyname . "|#" . $ticket . ">: ". $info->Summary, - "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", + "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", "text" => $info->CompanyName . " | " . $info->ContactName . //Return "Company / Contact" string "\n" . "Priority: " . $info->Priority . " | " . $info->StatusName . //Return "Prority / Status" string "\n" . $info->Resources, //Return assigned resources @@ -180,9 +180,9 @@ $postfieldspre = array( "channel" => ($channel!=NULL ? "#" . $channel : NULL), "attachments"=>array(array( - "fallback" => (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, + "fallback" => (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, "title" => "<" . $ticketurl . $ticket . "&companyName=" . $companyname . "|#" . $ticket . ">: ". $info->Summary, - "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", + "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", "text" => $info->CompanyName . " | " . $info->ContactName . //Return "Company / Contact" string "\n" . "Priority: " . $info->Priority . " | " . $info->StatusName . //Return "Prority / Status" string "\n" . $info->Resources, //Return assigned resources @@ -204,7 +204,7 @@ ); } } -else if($_GET['action'] == "updated" && $postupdated == 1) +else if($_REQUEST['action'] == "updated" && $postupdated == 1) { if($posttext==0) { @@ -295,16 +295,16 @@ if(!empty($alerts)) { foreach ($alerts as $username) //For each user in alerts array, set $postfieldspre to the follow message. { - if ($_GET['action'] == "added") + if ($_REQUEST['action'] == "added") { if ($posttext == 0) { $postfieldspre = array( "channel" => "@" . $username, "attachments" => array(array( - "fallback" => (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, + "fallback" => (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, "title" => "<" . $ticketurl . $ticket . "&companyName=" . $companyname . "|#" . $ticket . ">: " . $info->Summary, - "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", + "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", "text" => $info->CompanyName . " | " . $info->ContactName . //Return "Company / Contact" string "\n" . "Priority: " . $info->Priority . " | " . $info->StatusName . //Return "Prority / Status" string "\n" . $info->Resources, //Return assigned resources @@ -319,9 +319,9 @@ $postfieldspre = array( "channel" => "@" . $username, "attachments" => array(array( - "fallback" => (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, + "fallback" => (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, "title" => "<" . $ticketurl . $ticket . "&companyName=" . $companyname . "|#" . $ticket . ">: " . $info->Summary, - "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", + "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", "text" => $info->CompanyName . " | " . $info->ContactName . //Return "Company / Contact" string "\n" . "Priority: " . $info->Priority . " | " . $info->StatusName . //Return "Prority / Status" string "\n" . $info->Resources, //Return assigned resources @@ -342,7 +342,7 @@ )) ); } - } else if ($_GET['action'] == "updated") { + } else if ($_REQUEST['action'] == "updated") { if ($posttext == 0) { $postfieldspre = array( "channel" => "@" . $username, @@ -396,17 +396,17 @@ //Block for if ticket time reaches past X value if($timeenabled==1 && $info->ActualHours>$timepast) { - if($_GET['action'] == "added") + if($_REQUEST['action'] == "added") { if($posttext==0) { $postfieldspre = array( "channel"=>$timechan, "attachments"=>array(array( - "fallback" => (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, + "fallback" => (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, "title" => "<" . $ticketurl . $ticket . "&companyName=" . $companyname . "|#" . $ticket . ">: ". $info->Summary, "color" => "#F0E68C", - "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", + "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", "text" => $info->CompanyName . " | " . $info->ContactName . //Return "Company / Contact" string "\n" . "Priority: " . $info->Priority . " | " . $info->StatusName . //Return "Prority / Status" string "\n" . $info->Resources . " | Total Hours: *" . $info->ActualHours . "*", //Return assigned resources @@ -423,10 +423,10 @@ $postfieldspre = array( "channel"=>$timechan, "attachments"=>array(array( - "fallback" => (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, + "fallback" => (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) ." created #" . $ticket . " - " . ($postcompany ? "(" . $info->CompanyName . ") " : "") . $info->Summary, "title" => "<" . $ticketurl . $ticket . "&companyName=" . $companyname . "|#" . $ticket . ">: ". $info->Summary, "color" => "#F0E68C", - "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_GET['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", + "pretext" => "Ticket #" . $ticket . " has been created by " . (strtolower($_REQUEST['memberId'])=="zadmin" ? $info->ContactName : $info->UpdatedBy) . ".", "text" => $info->CompanyName . " | " . $info->ContactName . //Return "Company / Contact" string "\n" . "Priority: " . $info->Priority . " | " . $info->StatusName . //Return "Prority / Status" string "\n" . $info->Resources . " | Total Hours: *" . $info->ActualHours . "*", //Return assigned resources @@ -448,7 +448,7 @@ ); } } - else if($_GET['action'] == "updated") + else if($_REQUEST['action'] == "updated") { if ($posttext == 0) { $postfieldspre = array( diff --git a/cwslack-notes.php b/cwslack-notes.php index acc321c..f9cdcd9 100644 --- a/cwslack-notes.php +++ b/cwslack-notes.php @@ -23,10 +23,10 @@ require_once 'config.php'; require_once 'functions.php'; -if(empty($_GET['token']) || ($_GET['token'] != $slacknotestoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slacknotestoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode(" ",$_GET['text']); //Explode the string attached to the slash command for use in variables. +$exploded = explode(" ",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. //This section checks if the ticket number is not equal to 6 digits (our tickets are in the hundreds of thousands but not near a million yet) and kills the connection if it's not. if(!is_numeric($exploded[0])) { @@ -54,7 +54,7 @@ flush(); session_write_close(); if($sendtimeoutwait==true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); } } //End timeout fix block @@ -102,7 +102,7 @@ else //If second part of text is neither external or internal { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Second part of text must be either internal or external.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Second part of text must be either internal or external.")); } else { die("Second part of text must be either internal or external."); //Return error text. } @@ -118,14 +118,14 @@ if (!$mysql) //Check for errors { if ($timeoutfix == true) { //This should NEVER happen. - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); } else { die("Connection Error: " . mysqli_connect_error()); //Post to slack } die(); } - $val1 = mysqli_real_escape_string($mysql,$_GET["user_name"]); + $val1 = mysqli_real_escape_string($mysql,$_REQUEST["user_name"]); $sql = "SELECT * FROM `usermap` WHERE `slackuser`=\"" . $val1 . "\""; //SQL Query to select all ticket number entries $result = mysqli_query($mysql, $sql); //Run result @@ -133,7 +133,7 @@ if($rowcount > 1) //If there were too many rows matching query { if ($timeoutfix == true) { //This should NEVER happen. - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); } else { die("Error: too many users somehow?"); //Post to slack } @@ -149,7 +149,7 @@ { if($usecwname==1) //If variable enabled { - $postfieldspre["member"] = array("identifier"=>$_GET['user_name']); //Return the slack username as the user for the ticket note. If the user does not exist in CW, it will use the API username. + $postfieldspre["member"] = array("identifier"=>$_REQUEST['user_name']); //Return the slack username as the user for the ticket note. If the user does not exist in CW, it will use the API username. } } } @@ -157,7 +157,7 @@ { if($usecwname==1) { - $postfieldspre["member"] = array("identifier"=>$_GET['user_name']); + $postfieldspre["member"] = array("identifier"=>$_REQUEST['user_name']); } } @@ -168,7 +168,7 @@ $errors = $dataTNotes->errors; //Make array easier to access. if ($timeoutfix == true) { //Return CW error - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "ConnectWise Error: " . $errors[0]->message)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "ConnectWise Error: " . $errors[0]->message)); } else { die("ConnectWise Error: " . $errors[0]->message); //Post to slack } @@ -177,7 +177,7 @@ else //No error { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "New " . $command . " note created on #" . $ticketnumber . ": " . $sentence)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "New " . $command . " note created on #" . $ticketnumber . ": " . $sentence)); } else { echo "New " . $command . " note created on #" . $ticketnumber . ": " . $sentence; //Post to slack } diff --git a/cwslack-tasks.php b/cwslack-tasks.php index ea0075c..94a15c9 100644 --- a/cwslack-tasks.php +++ b/cwslack-tasks.php @@ -23,10 +23,10 @@ require_once 'config.php'; require_once 'functions.php'; -if(empty($_GET['token']) || ($_GET['token'] != $slacktaskstoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slacktaskstoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode(" ",$_GET['text']); //Explode the string attached to the slash command for use in variables. +$exploded = explode(" ",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. //This section checks if the ticket number is not equal to 6 digits (our tickets are in the hundreds of thousands but not near a million yet) and kills the connection if it's not. if(!is_numeric($exploded[0])) { @@ -53,7 +53,7 @@ flush(); session_write_close(); if($sendtimeoutwait==true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); } } //End timeout fix block @@ -102,7 +102,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Please use [ticket number] [list/update/complete/open/new] [task number]")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Please use [ticket number] [list/update/complete/open/new] [task number]")); } else { die("Please use [ticket number] [list/update/complete/open/new] [task number]"); //Post to slack } @@ -116,7 +116,7 @@ if(empty($taskdata)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); } else { die("No tasks found on ticket #".$ticketnumber); //Post to slack } @@ -143,7 +143,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } @@ -156,7 +156,7 @@ if(empty($taskdata)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); } else { die("No tasks found on ticket #".$ticketnumber); //Post to slack } @@ -170,7 +170,7 @@ if($t->closedFlag==false) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" .$task . " is already open.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" .$task . " is already open.")); } else { die("Task #" .$task . " is already open."); //Post to slack } @@ -181,7 +181,7 @@ if($taskid==NULL) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " not found on Ticket #" . $ticketnumber . ".")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " not found on Ticket #" . $ticketnumber . ".")); } else { die("Task #" . $task . " not found on Ticket #" . $ticketnumber . "."); //Post to slack } @@ -198,7 +198,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been marked open.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been marked open.")); } else { die("Task #" . $task . " has been marked open."); //Post to slack } @@ -212,7 +212,7 @@ if(empty($taskdata)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); } else { die("No tasks found on ticket #".$ticketnumber); //Post to slack } @@ -226,7 +226,7 @@ if($t->closedFlag==true) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" .$task . " is already marked done.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" .$task . " is already marked done.")); } else { die("Task #" .$task . " is already marked done."); //Post to slack } @@ -237,7 +237,7 @@ if($taskid==NULL) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " not found on Ticket #" . $ticketnumber . ".")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " not found on Ticket #" . $ticketnumber . ".")); } else { die("Task #" . $task . " not found on Ticket #" . $ticketnumber . "."); //Post to slack } @@ -261,7 +261,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been marked completed with resolution note: " . $sentence)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been marked completed with resolution note: " . $sentence)); } else { die("Task #" . $task . " has been marked completed with resolution note: " . $sentence); //Post to slack } @@ -270,7 +270,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been marked completed.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been marked completed.")); } else { die("Task #" . $task . " has been marked completed."); //Post to slack } @@ -285,7 +285,7 @@ if(empty($taskdata)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No tasks found on ticket #".$ticketnumber)); } else { die("No tasks found on ticket #".$ticketnumber); //Post to slack } @@ -299,7 +299,7 @@ if($t->closedFlag==true) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" .$task . " is already marked done.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" .$task . " is already marked done.")); } else { die("Task #" .$task . " is already marked done."); //Post to slack } @@ -310,7 +310,7 @@ if($taskid==NULL) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " not found on Ticket #" . $ticketnumber . ".")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " not found on Ticket #" . $ticketnumber . ".")); } else { die("Task #" . $task . " not found on Ticket #" . $ticketnumber . "."); //Post to slack } @@ -328,7 +328,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been updated with note: " . $sentence)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Task #" . $task . " has been updated with note: " . $sentence)); } else { die("Task #" . $task . " has been updated with note: " . $sentence); //Post to slack } @@ -337,7 +337,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No note provided for update.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No note provided for update.")); } else { die("No note provided for update."); //Post to slack } @@ -365,7 +365,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "A new task has been created with note: " . $sentence)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "A new task has been created with note: " . $sentence)); } else { die("A new task has been created with note: " . $sentence); //Post to slack } @@ -374,7 +374,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No note provided for new task.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No note provided for new task.")); } else { die("No note provided for new task."); //Post to slack } @@ -384,7 +384,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Unknown command. Please use [ticket number] [list/update/complete/open/new] [task number]")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Unknown command. Please use [ticket number] [list/update/complete/open/new] [task number]")); } else { die("Unknown command. Please use [ticket number] [list/update/complete/open/new] [task number]"); //Post to slack } diff --git a/cwslack-time.php b/cwslack-time.php index b2656a6..145c1d4 100644 --- a/cwslack-time.php +++ b/cwslack-time.php @@ -23,10 +23,10 @@ require_once 'config.php'; require_once 'functions.php'; -if(empty($_GET['token']) || ($_GET['token'] != $slacktimetoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slacktimetoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode(" ",$_GET['text']); //Explode the string attached to the slash command for use in variables. +$exploded = explode(" ",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. //Timeout Fix Block, has to be before massive numeric check block. if($timeoutfix == true) @@ -41,7 +41,7 @@ flush(); session_write_close(); if($sendtimeoutwait==true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); } } //End timeout fix block @@ -51,7 +51,7 @@ //Check to see if the first command in the text array is actually help, if so redirect to help webpage detailing slash command use. if ($exploded[0]=="help") { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Please visit " . $helpurl . " for more help information")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Please visit " . $helpurl . " for more help information")); } else { die("Please visit " . $helpurl . " for more help information"); //Post to slack } @@ -69,7 +69,7 @@ if (!$mysql) //Check for errors { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); } else { die("Connection Error: " . mysqli_connect_error()); //Post to slack } @@ -84,7 +84,7 @@ if($rowcount > 1) //This should NEVER happen. { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); } else { die("Error: too many users somehow?"); //Post to slack } @@ -121,14 +121,14 @@ if (!$mysql) //Check for errors { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); } else { die("Connection Error: " . mysqli_connect_error()); //Post to slack } die(); } - $val1 = mysqli_real_escape_string($mysql,$_GET["user_name"]); + $val1 = mysqli_real_escape_string($mysql,$_REQUEST["user_name"]); $sql = "SELECT * FROM `usermap` WHERE `slackuser`=\"" . $val1 . "\""; //SQL Query to select all ticket number entries $result = mysqli_query($mysql, $sql); //Run result @@ -136,7 +136,7 @@ if($rowcount > 1) //This should NEVER happen. { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); } else { die("Error: too many users somehow?"); //Post to slack } @@ -152,7 +152,7 @@ { if($usecwname==1) //If variable enabled { - $cwuser = $_GET['user_name']; + $cwuser = $_REQUEST['user_name']; } } } @@ -160,7 +160,7 @@ { if($usecwname==1) { - $cwuser = $_GET['user_name']; + $cwuser = $_REQUEST['user_name']; } } } @@ -177,7 +177,7 @@ if($data == NULL) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "User has not yet recorded time or the username $cwuser does not exist.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "User has not yet recorded time or the username $cwuser does not exist.")); } else { die("User has not yet recorded time or the username $cwuser does not exist."); //Post to slack } @@ -207,7 +207,7 @@ if($totaltime == 0) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "User has not yet recorded time today.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "User has not yet recorded time today.")); } else { die("User has not yet recorded time today."); //Post to slack } @@ -256,7 +256,7 @@ )) ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } @@ -277,7 +277,7 @@ if ($data == NULL) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No users have recorded time information for today.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No users have recorded time information for today.")); } else { die("No users have recorded time information for today."); //Post to slack } @@ -329,7 +329,7 @@ )) ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } @@ -338,7 +338,7 @@ else //Else close the connection. { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Unknown entry for ticket number.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Unknown entry for ticket number.")); } else { die("Unknown entry for ticket number."); //Post to slack } @@ -375,7 +375,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Time entry does not work. Please only use a number then h or m to indicate hours or minutes. E.x. 5m or 1.5h are valid, 1hour5minutes is not")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Time entry does not work. Please only use a number then h or m to indicate hours or minutes. E.x. 5m or 1.5h are valid, 1hour5minutes is not")); } else { die("Time entry does not work. Please only use a number then h or m to indicate hours or minutes. E.x. 5m or 1.5h are valid, 1hour5minutes is not"); //Post to slack } @@ -385,7 +385,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No time given.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No time given.")); } else { die("No time given."); //Post to slack } @@ -401,7 +401,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No sentence given for note.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No sentence given for note.")); } else { die("No sentence given for note."); //Post to slack } @@ -411,7 +411,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No command given.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No command given.")); } else { die("No command given."); //Post to slack } @@ -441,7 +441,7 @@ else //If second part of text is neither external or internal { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Second part of text must be either internal, detail, or resolution (d/i/r also accepted).")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Second part of text must be either internal, detail, or resolution (d/i/r also accepted).")); } else { die("Second part of text must be either internal, detail, or resolution (d/i/r also accepted)."); //Post to slack } @@ -456,14 +456,14 @@ if (!$mysql) //Check for errors { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); } else { die("Connection Error: " . mysqli_connect_error()); //Post to slack } die(); } - $val1 = mysqli_real_escape_string($mysql,$_GET["user_name"]); + $val1 = mysqli_real_escape_string($mysql,$_REQUEST["user_name"]); $sql = "SELECT * FROM `usermap` WHERE `slackuser`=\"" . $val1 . "\""; //SQL Query to select all ticket number entries $result = mysqli_query($mysql, $sql); //Run result @@ -471,7 +471,7 @@ if($rowcount > 1) //This should NEVER happen. { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: too many users somehow?")); } else { die("Error: too many users somehow?"); //Post to slack } @@ -488,8 +488,8 @@ { if($usecwname==1) //If variable enabled { - $postfieldspre["member"] = array("identifier"=>$_GET['user_name']); //Return the slack username as the user for the ticket note. If the user does not exist in CW, it will use the API username. - $postfieldspre["enteredBy"] = $_GET['user_name']; + $postfieldspre["member"] = array("identifier"=>$_REQUEST['user_name']); //Return the slack username as the user for the ticket note. If the user does not exist in CW, it will use the API username. + $postfieldspre["enteredBy"] = $_REQUEST['user_name']; } } } @@ -497,8 +497,8 @@ { if($usecwname==1) { - $postfieldspre["member"] = array("identifier"=>$_GET['user_name']); - $postfieldspre["enteredBy"] = $_GET['user_name']; + $postfieldspre["member"] = array("identifier"=>$_REQUEST['user_name']); + $postfieldspre["enteredBy"] = $_REQUEST['user_name']; } } @@ -509,7 +509,7 @@ $errors = $dataTNotes->errors; //Make array easier to access. if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "ConnectWise Error: " . $errors[0]->message)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "ConnectWise Error: " . $errors[0]->message)); } else { die("ConnectWise Error: " . $errors[0]->message); //Post to slack } @@ -518,7 +518,7 @@ else //No error { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "New " . $command . " time entry created on #" . $ticketnumber . ": " . $sentence)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "New " . $command . " time entry created on #" . $ticketnumber . ": " . $sentence)); } else { die("New " . $command . " time entry created on #" . $ticketnumber . ": " . $sentence); //Return new ticket posted message. } diff --git a/cwslack.php b/cwslack.php index f7a9150..46330ce 100644 --- a/cwslack.php +++ b/cwslack.php @@ -29,9 +29,9 @@ // Authorization array, with extra json content-type used in patch commands to change tickets. $header_data2 = postHeader($companyname, $apipublickey, $apiprivatekey); -if(empty($_GET['token']) || ($_GET['token'] != $slacktoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. -if(empty($_GET['text'])) die("No text provided."); //If there is no text added, kill the connection. -$exploded = explode(" ",$_GET['text']); //Explode the string attached to the slash command for use in variables. +if(empty($_REQUEST['token']) || ($_REQUEST['token'] != $slacktoken)) die("Slack token invalid."); //If Slack token is not correct, kill the connection. This allows only Slack to access the page for security purposes. +if(empty($_REQUEST['text'])) die("No text provided."); //If there is no text added, kill the connection. +$exploded = explode(" ",$_REQUEST['text']); //Explode the string attached to the slash command for use in variables. //This section checks if the ticket number is not equal to 6 digits (our tickets are in the hundreds of thousands but not near a million yet) and kills the connection if it's not. if(!is_numeric($exploded[0])) { @@ -62,7 +62,7 @@ flush(); session_write_close(); if($sendtimeoutwait==true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral", "text" => "Please wait...")); } } //End timeout fix block @@ -106,7 +106,7 @@ { if(!array_key_exists(2, $ticketstuff)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Not enough values specified. Please use /t new board|company|summary")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Not enough values specified. Please use /t new board|company|summary")); } else { die("Not enough values specified. Please use /t new board|company|summary"); //Return properly encoded arrays in JSON for Slack parsing. } @@ -118,7 +118,7 @@ if(is_null($companydata)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No company found with the name " . $ticketstuff[0])); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No company found with the name " . $ticketstuff[0])); } else { die("No company found with the name " . $ticketstuff[0]); //Return properly encoded arrays in JSON for Slack parsing. } @@ -141,7 +141,7 @@ { if(!array_key_exists(1, $ticketstuff)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Not enough values specified. Please use /t new company|summary")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Not enough values specified. Please use /t new company|summary")); } else { die("Not enough values specified. Please use /t new company|summary"); //Return properly encoded arrays in JSON for Slack parsing. } @@ -155,7 +155,7 @@ if(is_null($companydata)) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No company found with the name " . $ticketstuff[0])); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No company found with the name " . $ticketstuff[0])); } else { die("No company found with the name " . $ticketstuff[0]); //Return properly encoded arrays in JSON for Slack parsing. } @@ -176,14 +176,14 @@ if (!$mysql) //Check for errors { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); } else { die("Connection Error: " . mysqli_connect_error()); //Return properly encoded arrays in JSON for Slack parsing. } die(); } - $val1 = mysqli_real_escape_string($mysql,$_GET["user_name"]); + $val1 = mysqli_real_escape_string($mysql,$_REQUEST["user_name"]); $sql = "SELECT * FROM `usermap` WHERE `slackuser`=\"" . $val1 . "\""; //SQL Query to select all ticket number entries $result = mysqli_query($mysql, $sql); //Run result @@ -203,8 +203,8 @@ { if($usecwname==1) //If variable enabled { - $postarray["enteredBy"] = $_GET['user_name']; - $postarray["owner"] = array("identifier"=>$_GET['user_name']); //Return the slack username as the user for the ticket note. If the user does not exist in CW, it will use the API username. + $postarray["enteredBy"] = $_REQUEST['user_name']; + $postarray["owner"] = array("identifier"=>$_REQUEST['user_name']); //Return the slack username as the user for the ticket note. If the user does not exist in CW, it will use the API username. } } } @@ -212,8 +212,8 @@ { if($usecwname==1) { - $postarray["enteredBy"] = $_GET['user_name']; - $postarray["owner"] = array("identifier"=>$_GET['user_name']); + $postarray["enteredBy"] = $_REQUEST['user_name']; + $postarray["owner"] = array("identifier"=>$_REQUEST['user_name']); } } @@ -226,7 +226,7 @@ if($timeoutfix == true) { - cURLPost($_GET["response_url"],array("Content-Type: application/json"),"POST",array("parse" => "full", "response_type" => "ephemeral","text" => "New ticket #<" . $connectwise . "/$connectwisebranch/services/system_io/Service/fv_sr100_request.rails?service_recid=" . $dataTCmd->id . "|" . $dataTCmd->id . "> has been created.","mrkdwn"=>true)); + cURLPost($_REQUEST["response_url"],array("Content-Type: application/json"),"POST",array("parse" => "full", "response_type" => "ephemeral","text" => "New ticket #<" . $connectwise . "/$connectwisebranch/services/system_io/Service/fv_sr100_request.rails?service_recid=" . $dataTCmd->id . "|" . $dataTCmd->id . "> has been created.","mrkdwn"=>true)); } else { @@ -243,7 +243,7 @@ if($dataTData==NULL) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Array not returned in line 195. Please check your connectwise URL variable in config.php and ensure it is accessible via the web at " . $urlticketdata)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Array not returned in line 195. Please check your connectwise URL variable in config.php and ensure it is accessible via the web at " . $urlticketdata)); } else { die("Array not returned in line 195. Please check your connectwise URL variable in config.php and ensure it is accessible via the web at " . $urlticketdata); //Return properly encoded arrays in JSON for Slack parsing. } @@ -268,7 +268,7 @@ if ($priority==0) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Failed to get priority code: " . $option3)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Failed to get priority code: " . $option3)); } else { die("Failed to get priority code: " . $option3); //Return properly encoded arrays in JSON for Slack parsing. } @@ -298,7 +298,7 @@ ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } @@ -321,7 +321,7 @@ if ($status == 0) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Failed to get status code: " . $status)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Failed to get status code: " . $status)); } else { die("Failed to get status code: " . $status); //Return properly encoded arrays in JSON for Slack parsing. } @@ -350,7 +350,7 @@ )) ); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. } @@ -369,14 +369,14 @@ if (!$mysql) //Check for errors { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); } else { die("Connection Error: " . mysqli_connect_error()); //Return properly encoded arrays in JSON for Slack parsing. } die(); } - $val1 = mysqli_real_escape_string($mysql,$_GET["user_name"]); + $val1 = mysqli_real_escape_string($mysql,$_REQUEST["user_name"]); $sql = "SELECT * FROM `usermap` WHERE `slackuser`=\"" . $val1 . "\""; //SQL Query to select all ticket number entries $result = mysqli_query($mysql, $sql); //Run result @@ -395,7 +395,7 @@ { if($usecwname==1) //If variable enabled { - $cwuser = $_GET['user_name']; + $cwuser = $_REQUEST['user_name']; } } } @@ -403,14 +403,14 @@ { if($usecwname==1) { - $cwuser = $_GET['user_name']; + $cwuser = $_REQUEST['user_name']; } else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: Name " . $_GET['user_name'] . " not found")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: Name " . $_REQUEST['user_name'] . " not found")); } else { - die("Error: Name " . $_GET['user_name'] . " not found"); //Return properly encoded arrays in JSON for Slack parsing. + die("Error: Name " . $_REQUEST['user_name'] . " not found"); //Return properly encoded arrays in JSON for Slack parsing. } die(); } @@ -452,7 +452,7 @@ { $timingdate = explode("T", $datestart); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "You have been properly scheduled for ticket #" . $dataTCmd->objectId . " for $timingdate[0]","mrkdwn"=>true)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "You have been properly scheduled for ticket #" . $dataTCmd->objectId . " for $timingdate[0]","mrkdwn"=>true)); } else { die("You have been properly scheduled for ticket #" . $dataTCmd->objectId . " for $timingdate[0]"); //Return properly encoded arrays in JSON for Slack parsing. } @@ -461,7 +461,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "You have been properly scheduled for ticket #" . $dataTCmd->objectId . " at " . $removal,"mrkdwn"=>true)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "You have been properly scheduled for ticket #" . $dataTCmd->objectId . " at " . $removal,"mrkdwn"=>true)); } else { die("You have been properly scheduled for ticket #" . $dataTCmd->objectId . " at " . $removal); //Return properly encoded arrays in JSON for Slack parsing. } @@ -476,7 +476,7 @@ if($option3 == NULL) { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No user specified.")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "No user specified.")); } else { die("No user specified."); //Return properly encoded arrays in JSON for Slack parsing. } @@ -491,7 +491,7 @@ if (!$mysql) //Check for errors { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Connection Error: " . mysqli_connect_error())); } else { die("Connection Error: " . mysqli_connect_error()); //Return properly encoded arrays in JSON for Slack parsing. } @@ -530,7 +530,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: Name " . $username . " not found")); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "Error: Name " . $username . " not found")); } else { die("Error: Name " . $username . " not found"); //Return properly encoded arrays in JSON for Slack parsing. } @@ -575,7 +575,7 @@ { $timingdate = explode("T", $datestart); if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "$username has been properly scheduled for ticket #" . $dataTCmd->objectId . " for $timingdate[0]","mrkdwn"=>true)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "$username has been properly scheduled for ticket #" . $dataTCmd->objectId . " for $timingdate[0]","mrkdwn"=>true)); } else { die("$username has been properly scheduled for ticket #" . $dataTCmd->objectId . " for $timingdate[0]"); //Return properly encoded arrays in JSON for Slack parsing. } @@ -584,7 +584,7 @@ else { if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "$username has been properly scheduled for ticket #" . $dataTCmd->objectId . " at " . $removal,"mrkdwn"=>true)); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", array("parse" => "full", "response_type" => "ephemeral","text" => "$username has been properly scheduled for ticket #" . $dataTCmd->objectId . " at " . $removal,"mrkdwn"=>true)); } else { die("$username has been properly scheduled for ticket #" . $dataTCmd->objectId . " at " . $removal); //Return properly encoded arrays in JSON for Slack parsing. } @@ -938,7 +938,7 @@ } if ($timeoutfix == true) { - cURLPost($_GET["response_url"], array("Content-Type: application/json"), "POST", $return); + cURLPost($_REQUEST["response_url"], array("Content-Type: application/json"), "POST", $return); } else { die(json_encode($return, JSON_PRETTY_PRINT)); //Return properly encoded arrays in JSON for Slack parsing. }