예제 #1
0
 /**
  * accountAction
  * Manage the User account settings.
  * @return void
  */
 public function accountAction()
 {
     $form = $this->getForm('/admin/profile/process');
     $this->view->form = $form;
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->title = $this->translator->translate("User Account");
     $this->view->description = $this->translator->translate("Here you can edit your user account information");
     $adminbuttons = array();
     // Create the buttons in the edit form
     if (AdminRoles::isAdministrator($this->logged_user['user_id'])) {
         $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/profile/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')));
     } else {
         $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')));
     }
     $user = AdminUser::getAllInfo($this->logged_user['user_id']);
     $user['permissions'] = AdminRoles::getResourcesbyUserID($this->logged_user['user_id']);
     // the password is a MD5 string so we need to empty it, because the software could save the MD5 value again.
     $user['password'] = "";
     $form->populate($user);
     $this->render('applicantform');
 }
예제 #2
0
파일: Tickets.php 프로젝트: kokkez/shineisp
 /**
  * Send ticket by email
  * 
  * @param integer $id
  * @param boolean $isTicket
  * @param string $attachment
  */
 public static function send($id, $isTicket = true, $attachment = null)
 {
     $isp = Isp::getActiveISP();
     $placeholders = array();
     $customer_url = "";
     $admin_url = "";
     if ($isTicket) {
         $ticket = self::getAllInfo($id, null, true);
         $customer = $ticket[0]['Customers'];
         $operator = AdminUser::getAllInfo($ticket[0]['user_id']);
     } else {
         $ticket = TicketsNotes::getAllInfo($id);
         $customer = $ticket[0]['Tickets']['Customers'];
         $operator = AdminUser::getAllInfo($ticket[0]['Tickets']['user_id']);
     }
     if (!empty($ticket[0])) {
         if ($isp) {
             $ispmail = explode("@", $isp['email']);
             $retval = Shineisp_Commons_Utilities::getEmailTemplate('ticket_message');
             if ($retval) {
                 $s = $retval['subject'];
                 $ticketid = $ticket[0]['ticket_id'];
                 $in_reply_to = md5($ticketid);
                 $ispmail = "noreply@" . $ispmail[1];
                 $rec = Fastlinks::findlinks($ticketid, $customer['customer_id'], 'tickets');
                 if (!empty($rec[0]['code'])) {
                     $customer_url = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/" . $rec[0]['code'];
                     $admin_url = "http://" . $_SERVER['HTTP_HOST'] . "/admin/login/link/id/" . $rec[0]['code'];
                 }
                 // Check the attachments
                 if (!empty($attachment) && file_exists(PUBLIC_PATH . $attachment)) {
                     $attachment = PUBLIC_PATH . $attachment;
                 }
                 if ($isTicket) {
                     $placeholders['subject'] = $ticket[0]['subject'];
                     $placeholders['description'] = $ticket[0]['description'];
                     $placeholders['date_open'] = Shineisp_Commons_Utilities::formatDateOut($ticket[0]['date_open']);
                     $placeholders['status'] = $ticket[0]['Statuses']['status'];
                 } else {
                     $placeholders['subject'] = $ticket[0]['Tickets']['subject'];
                     $placeholders['description'] = $ticket[0]['note'];
                     $placeholders['date_open'] = Shineisp_Commons_Utilities::formatDateOut($ticket[0]['Tickets']['date_open']);
                     $placeholders['status'] = $ticket[0]['Tickets']['Statuses']['status'];
                 }
                 $placeholders['customer'] = $customer['firstname'] . " " . $customer['lastname'] . " " . $customer['company'];
                 $placeholders['link'] = $customer_url;
                 $placeholders['company'] = $isp['company'];
                 $placeholders['issue_number'] = $ticketid;
                 $placeholders['operator'] = $operator['lastname'] . " " . $operator['firstname'];
                 // Send a message to the customer
                 Shineisp_Commons_Utilities::sendEmailTemplate(Contacts::getEmails($customer['customer_id']), 'ticket_message', $placeholders, $in_reply_to, $attachment, null, $isp, $customer['language_id']);
                 // Update the link for the administrator email
                 $placeholders['link'] = $admin_url . "/keypass/" . Shineisp_Commons_Hasher::hash_string($operator['email']);
                 Shineisp_Commons_Utilities::sendEmailTemplate($isp['email'], 'ticket_message', $placeholders, $in_reply_to, $attachment, null, $isp);
                 return true;
             }
         }
     }
     return false;
 }