示例#1
0
 public function indexAction()
 {
     //Zend_Loader::loadClass("Ht_Utils");
     $this->_helper->layout->disableLayout();
     $profile = Ht_Utils::getProfile();
     if ($profile) {
         self::$_dispatcher->notify(new sfEvent($this, 'authentication.log', array('message' => array(sprintf('User name `%s` goto denied page.', $profile->u_name . " " . $profile->u_lastname)), 'priority' => 4)));
     }
     //$this->_redirect('/admin/index/index');
 }
示例#2
0
    public function sendMailAction()
    {
        $this->_helper->layout()->disableLayout();
        $this->_helper->viewRenderer->setNoRender();
        $data = $this->_request->getParams();
        try {
            Zend_Loader::loadClass("Ht_Utils");
            $mailer = Ht_Utils::getMailer();
            $admin = $this->__getAdministratorInfo();
            if ($mailer && $admin) {
                //$mail->setCharset('UTF-8');
                $mailer->addTo($admin->u_email, $admin->u_name . " " . $admin->u_lastname);
                $mailer->setFrom($data["email"], $data["name"]);
                $appName = $this->getSysSetting(self::CONF_KEY_APPLICATION_NAME);
                $subject = "{$appName}: Application Error!";
                $exception = nl2br($data["exception"]);
                $adminName = $admin->u_name . " " . $admin->u_lastname;
                $msg = $data["message"];
                $senderName = $data["name"];
                $message = <<<MESSAGE
<html>
<head><title>{$subject}</title></head>
<body>
<h3>Dear Khun {$adminName}</h3>
<br />
{$msg}
<br />
<hr />
{$exception}
<br />
<br />
Best Regards,
{$senderName}
</body>
</html>
MESSAGE;
                $mailer->sentMail($subject, $message);
            }
            $this->getDispatcher()->notify(new sfEvent($this, 'system.log', array('message' => array(sprintf('`%s` sent error report success', trim($data["name"]))), 'priority' => 6)));
        } catch (Exception $e) {
            $this->getDispatcher()->notify(new sfEvent($this, 'error.log', array('message' => array(sprintf('`%s` sent error report fail.', $data["name"]), sprintf("Error Message: %s", $e->getMessage()), sprintf("Stack trace: %s", $e->getTraceAsString())), 'priority' => 3)));
            echo "error";
            return;
        }
        echo "success";
    }
示例#3
0
文件: Utils.php 项目: kangza/hagtag
 /**
  * Get a hash of your server
  *
  * If you happen to have multiple installations of frapi
  * you would get apc cache collisions if we woulnd't have
  * some sort of hashing and identification of the hostnames.
  *
  * Right now this hash is very rudimentary, it's simply and sha1
  * hash of the HTTP_HOST that you are serving frapi from.
  *
  * @return string self::$_hash The sha1-server hash
  */
 public static function getHash()
 {
     if (self::$_hash) {
         return self::$_hash;
     }
     $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
     self::$_hash = hash('sha1', $host);
     return self::$_hash;
 }