Example #1
0
 /**
  * Sets the session ID variable & the cookie
  *
  * @author Art <*****@*****.**>
  * @return AbstractSession
  */
 protected function setID()
 {
     $c = get($_COOKIE[ALO_SESSION_COOKIE]);
     if ($c && strlen($c) == 128) {
         session_id($c);
     } else {
         session_id(Security::getUniqid('sha512', 'session'));
     }
     \Log::debug('Session ID set to ' . session_id());
     return $this;
 }
Example #2
0
 /**
  * Attempts to attach not a file from the disk, but generated contents
  *
  * @author Art <*****@*****.**>
  *
  * @param string $name    The attachment filename
  * @param string $content The contents
  *
  * @return bool
  * @throws \Exception
  * @throws \phpmailerException
  */
 function attachContent($name, $content)
 {
     $destFilename = Security::getUniqid('md5', 'email_attachment');
     $dest = DIR_TMP . $destFilename;
     if (file_exists($dest)) {
         //try again
         return $this->attachContent($name, $content);
     } elseif (file_put_contents($dest, $content) !== false) {
         $this->attachedContent[] = $dest;
         return $this->addAttachment($dest, $name);
     } else {
         return false;
     }
 }