Example #1
0
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once './php/CRMDefaults.php';
require_once './php/UIHandler.php';
require_once './php/LanguageHandler.php';
require_once './php/DbHandler.php';
require_once './php/CRMUtils.php';
include './php/Session.php';
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$db = new \creamy\DbHandler();
$user = \creamy\CreamyUser::currentUser();
// get parameters
if (isset($_GET["folder"])) {
    $folder = $_GET["folder"];
} else {
    $folder = MESSAGES_GET_INBOX_MESSAGES;
}
if ($folder < 0 || $folder > MESSAGES_MAX_FOLDER) {
    $folder = MESSAGES_GET_INBOX_MESSAGES;
}
if (isset($_GET["message_id"])) {
    $messageid = $_GET["message_id"];
} else {
    $messageid = NULL;
}
// get the message
Example #2
0
 public function dashboardHook($wantsFullRow = true)
 {
     // check if today we must show a custom quote.
     $customDate = $this->valueForModuleSetting("custom_quote_day");
     $customQuote = $this->valueForModuleSetting("custom_quote");
     if (!empty($customDate) && !empty($customQuote)) {
         if ($this->dateIsToday(strtotime($customDate))) {
             return $this->sectionWithCustomQuote($customQuote, \creamy\CreamyUser::currentUser()->getUserName());
         }
     }
     // else just one quote for the dashboard hook.
     return $this->sectionWithRandomQuotes(1);
 }
Example #3
0
 /** 
  * Sends a mail to the given recipients.
  * @param String $recipients	A valid RFC 2822 recipients address set. See http://www.faqs.org/rfcs/rfc2822
  * @param String $subject 		A valid RFC 2047 subject. See http://www.faqs.org/rfcs/rfc2047
  * @param String $message		Message in HTML or plain text.
  * @param Array  $attachments	Array of files as received by $_FILES.
  * @return true if successful, false if email couldn't be sent.
  */
 public function sendMailWithAttachments($recipients, $subject, $message, $attachments, $attachmentTag = "attachment")
 {
     // safety checks.
     require_once 'Session.php';
     if (empty($recipients)) {
         return false;
     }
     // boundary for this email.
     $boundaryId = md5(uniqid(time()));
     // get from user data.
     $user = \creamy\CreamyUser::currentUser();
     if (!isset($user)) {
         return false;
     }
     $userData = $this->db->getDataForUser($user->getUserId());
     if (!isset($userData)) {
         return false;
     }
     $userEmail = isset($userData["email"]) ? $userData["email"] : null;
     if (!isset($userEmail)) {
         return false;
     }
     // build header
     $header = $this->generateMultipartHeaderAndMessageContent($userEmail, $message, $boundaryId);
     $header .= $this->generateAttachmentMultipartFromFiles($attachments, $boundaryId, $attachmentTag);
     // generate a valid header including the attachments.
     return mail($recipients, $subject, null, $header);
 }
Example #4
0
    /**
     * Generates the HTML with the list of message folders as <li> items.
     * @param $activefolder String current active folder the user is in.
     * @return String the HTML with the list of message folders as <li> items.
     */
    public function getMessageFoldersAsList($activefolder)
    {
        require_once 'Session.php';
        $user = \creamy\CreamyUser::currentUser();
        // info for active folder and unread messages
        $unreadMessages = $this->db->getUnreadMessagesNumber($user->getUserId());
        $aInbox = $activefolder == MESSAGES_GET_INBOX_MESSAGES ? 'class="active"' : '';
        $aSent = $activefolder == MESSAGES_GET_SENT_MESSAGES ? 'class="active"' : '';
        $aFav = $activefolder == MESSAGES_GET_FAVORITE_MESSAGES ? 'class="active"' : '';
        $aDel = $activefolder == MESSAGES_GET_DELETED_MESSAGES ? 'class="active"' : '';
        return '<ul class="nav nav-pills nav-stacked">
			<li ' . $aInbox . '><a href="messages.php?folder=0">
				<i class="fa fa-inbox"></i> ' . $this->lh->translationFor("inbox") . ' 
				<span class="label label-primary pull-right">' . $unreadMessages . '</span></a>
			</li>
			<li ' . $aSent . '><a href="messages.php?folder=3"><i class="fa fa-envelope-o"></i> ' . $this->lh->translationFor("sent") . '</a></li>
			<li ' . $aFav . '><a href="messages.php?folder=4"><i class="fa fa-star"></i> ' . $this->lh->translationFor("favorites") . '</a></li>
			<li ' . $aDel . '><a href="messages.php?folder=2"><i class="fa fa-trash-o"></i> ' . $this->lh->translationFor("trash") . '</a></li>
		</ul>';
    }