File: 0.01.1a/email.php (View as Code)

1: 2: /* ------------------------------------------------------------- 3: This file is part of FreeDESK 4: 5: FreeDESK is (C) Copyright 2012 David Cutting 6: 7: FreeDESK is free software: you can redistribute it and/or modify 8: it under the terms of the GNU General Public License as published by 9: the Free Software Foundation, either version 3 of the License, or 10: (at your option) any later version. 11: 12: FreeDESK is distributed in the hope that it will be useful, 13: but WITHOUT ANY WARRANTY; without even the implied warranty of 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15: GNU General Public License for more details. 16: 17: You should have received a copy of the GNU General Public License 18: along with FreeDESK. If not, see www.gnu.org/licenses 19: 20: For more information see www.purplepixie.org/freedesk/ 21: -------------------------------------------------------------- */ 22: 23: /** 24: * Send an email update to customer 25: **/ 26: 27: 28: // Output buffer on and start FreeDESK then discard startup whitespace-spam 29: ob_start(); 30: include("core/FreeDESK.php"); 31: $DESK = new FreeDESK("./"); 32: $DESK->Start(); 33: ob_end_clean(); 34: 35: 36: if (!isset($_REQUEST['sid']) || !$DESK->ContextManager->Open(ContextType::User, $_REQUEST['sid'])) 37: { 38: $data=array("title"=>$DESK->Lang->Get("welcome")); 39: $DESK->Skin->IncludeFile("min_header.php",$data); 40: 41: echo "\n\n"; 44: 45: echo "

".$DESK->Lang->Get("login_invalid").":

\n";
46: 47: 48: $DESK->Skin->IncludeFile("min_footer.php"); 49: exit(); 50: } 51: 52: 53: // So we're authenticated let's view the main page 54: $data=array("title"=>"FreeDESK Email"); 55: $DESK->Skin->IncludeFile("min_header.php",$data); 56: 57: $request = $DESK->RequestManager->Fetch($_REQUEST['request']); 58: //echo "
";
 59: //print_r($request);
 60: 
 61: $customerid = $request->Get("customerid");
 62: 
 63: $q="SELECT * FROM ".$DESK->Database->Table("customer")." WHERE ".$DESK->Database->Field("customerid")."=".$DESK->Database->Safe($customerid)." LIMIT 0,1";
 64: $r=$DESK->Database->Query($q);
 65: 
 66: $customer = $DESK->Database->FetchAssoc($r)
 67:  or die("wah");
 68: 
 69: $DESK->Database->Free($r);
 70: 
 71: echo "
\n"; 72: echo "\n"; 73: echo ""; 74: 75: echo "\n"; 76: 77: $accounts = $DESK->Email->GetAccounts(); 78: 79: echo "\n"; 87: 88: $customername = $customer['firstname']." ".$customer['lastname']; 89: $requestid = $_REQUEST['request']; 90: $update = $_REQUEST['update']; 91: 92: echo "\n"; 93: echo "\n"; 94: 95: $data = array( 96: "customer" => $customername, 97: "requestid" => $requestid, 98: "update" => $update ); 99: 100: $message = $DESK->Email->GetSubTemplate($_REQUEST['template'], $data); 101: 102: echo "\n"; 103: echo "\n"; 104: 105: echo "\n"; 107: 108: echo "\n"; 110: 111: echo "
".$DESK->Lang->Get("from")."\n"; 80: echo "\n"; 86: echo "
".$DESK->Lang->Get("to")."
".$DESK->Lang->Get("subject")."
\n"; 106: echo "
 Lang->Get("send")."\" onclick=\"DESK.formAPI('email',true);\" />\n"; 109: echo "
\n";
112: 113: $DESK->Skin->IncludeFile("min_footer.php"); 114: 115: 116: ?> 117: