Exemplo n.º 1
0
     $msgHtml = "";
 }
 // Display current filter
 if (!empty($currentFilter)) {
     $filterParams = array("filter" => $currentFilter);
     $filterHtml = tkMakeHtml($tmpl["currentFilter"], $filterParams);
 } else {
     $filterHtml = "";
 }
 // No threads here
 if ($thread->num($thread->listRes) <= 0) {
     $errorParams = array("error" => $ln_no_threads);
     $listHtml = tkMakeHtml($tmpl["listError"], $errorParams);
 }
 // 'New thread' link
 if (tkCheckTags("create")) {
     $linkParams = array("newlink" => tkMakeURL("c=new", $confStripQueryVars));
     $linkHtml = tkMakeHtml($tmpl["newlinkcon"], $linkParams);
 } else {
     $linkHtml = "";
 }
 // Mail hint
 if (!validateMail($tkUser["email"])) {
     $mailParams = array();
     $mailHtml = tkMakeHtml($tmpl["mailhint"], $mailParams);
 } else {
     $mailHtml = "";
 }
 // Page Management
 $numPages = ceil($thread->numTotalElements / $tkThreadsPerPage);
 $paginationLinksHtml = "";
Exemplo n.º 2
0
      Templating
      
      ----------------------------
*/
// inner
// ...
// outer
$tkTmplEl = array("newlinkcon", "forwardlink", "mailhint", "newerlink", "pagelink", "pagination", "newCount", "message", "currentFilter", "managePost", "post", "subscribe", "newpost", "manage", "managebutton", "deleteThread", "statusform", "statuschange", "thread", "deleteLink", "threadRow", "listError", "list", "newthread", "navlink", "filterchoice", "header", "email:newComment", "email:statusChange", "email:newThread", "body");
Header("Content-Type: text/html; charset=UTF-8");
$tkTmpl = file_get_contents("includes/tkTmpl.tpl");
$tmpl = tkGetTemplate($tkTmpl);
$confProtectVars = array();
$tmplFilterChoice = '<div id="filter">';
foreach ($confFilters as $name => $filter) {
    $split = split("::", $filter);
    if (count($split) > 1 && !tkCheckTags($split[1])) {
        continue;
    } else {
        $filter = $split[0];
    }
    if (!empty($filter)) {
        $link = tkMakeURL("f=" . $filter, uStrip . ",f");
    } else {
        $link = tkMakeURL("", uStrip . ",f");
    }
    if ($_GET["f"] == $filter) {
        $current = " current";
    } else {
        $current = "";
    }
    if ($filter == "") {
Exemplo n.º 3
0
 function sendNotify($cause, $type)
 {
     global $tmpl, $tkConfBotMail, $tkConfSysName, $ln_eNotify_titles, $tkUser;
     // Get all users who need to be identified
     $users = array();
     // First option - all users who subscribed to the current thread
     /*if( $type == "_subscribers" )#$this->checkFrontidExistance( $type ) )
       {
         // Get the ids of the users who described to this thread
         $sql = "
         SELECT
           id, userid, email_last_notify
         FROM
          ".PRFX."threads_marks
         WHERE
           threadid='".$this->dataRaw["id"]."' AND
           email_notification LIKE '%".$cause."%'
         ;";
         
         
         
         $res = $this->query( $sql );
       
         while( $row = $this->assoc( $res ) )
         {
           // don't spam the users
           if( time() > $row["email_last_notify"] + 60 * 60 * 24 * 7 ) // maximum is: once a week
             $users[] = $row["userid"];
         }
         
       }
       
       // Second Option - all users, who want to be notified when there is a new thread
       else if( $type == "_new" )
       {
         global $confEmailNotifyUsers;
         
         $users = $confEmailNotifyUsers;
       }*/
     // add the Global Subscription Users
     #$users = Array();
     // We are just notifying users who want it.
     $users = globGetUsers();
     #foreach ( $globUser as $userid )
     #{
     # if( !in_array( $userid, $users ) )
     #   $users[] = $userid;
     #}
     // Give the users for debug reasons
     #var_dump( $users );
     /*foreach( $users as $userid )
       {
         echo "-------------<br />";
         $user = tkCbGetUserById( $userid );
         echo $user["name"];
         echo " -".$user["email"]."-<br />";
       
       }
       exit;*/
     // Now it's time to notify the users
     foreach ($users as $userid) {
         // get the details for each user
         $user = tkCbGetUserById($userid);
         // check the users mail
         if (!validateMail($user["email"])) {
             tkLog("bad mail for user \"" . $user["name"] . "\": " . $user["email"]);
             continue;
         }
         // Is the user even allowed to view this thread?
         if (tkCheckTags("viewAll", $userid) || tkCheckTags("viewOwn", $userid) && $this->dataRaw["author"] == $userid) {
             $access = true;
         } else {
             continue;
         }
         // only send the mail, if the user checked the rhead since last mail
         //   (meaning, if the email_last_notify column in threads_marks != 0, then no mail)
         $marks = $this->getMarks($user["id"]);
         if ($marks["email_last_notify"] > 0) {
             continue;
         }
         #marker3
         // send a notification mail
         switch ($cause) {
             case "onComment":
                 $eTmpl = $tmpl["email:newComment"];
                 #$content = $this->posts["create"]->handleField( "text", $this->posts["create"]->dataRaw["text"] );
                 $content = $this->posts["create"]->dataRaw["text"];
                 $author = $this->posts["create"]->handleField("author", $this->posts["create"]->dataRaw["author"]);
                 break;
             case "onStatusChange":
                 $eTmpl = $tmpl["email:statusChange"];
                 break;
             case "onNew":
                 $eTmpl = $tmpl["email:newThread"];
                 $content = $this->posts["create"]->dataRaw["text"];
                 $author = $this->handleField("author", $this->dataRaw["author"]);
                 break;
             default:
                 tkSendError("System Error: unkown notify status");
                 break;
         }
         $htmlContent = $this->posts["create"]->handleField("text", $content);
         $lastCheckOnThread = $this->getLastCheck($tkUser["id"], $dataRaw["id"]);
         $unreadPosts = 0;
         $allPosts = 0;
         // First unread post
         foreach ($this->posts as $post) {
             if ($post->dataRaw["build"] > $lastCheckOnThread) {
                 if (!isset($firstUnreadPost)) {
                     $firstUnreadPost = $post->dataRaw["id"];
                 }
                 $unreadPosts++;
             }
             $allPosts++;
         }
         $subjval = $this->handleField("subject", $this->dataRaw["subject"]);
         $subject = $ln_eNotify_titles[$cause] . ': \'' . $subjval . '\'';
         global $tkConfPath;
         // No Br in Mails
         #$text = $content;
         #$text = str_replace( "\n", "<br />", $text );
         #$text = stripslashes( $text );
         #$content = $text;
         $params = array("username" => $user["name"], "author" => $author, "subject" => $subjval, "status" => $this->dataRaw["status"], "content" => $htmlContent, "link" => $tkConfPath . "index.php?id=" . $this->dataRaw["frontid"] . "&p=" . $firstUnreadPost . "#comment" . $firstUnreadPost, "frontid" => $this->dataRaw["frontid"]);
         #$message = $tkConfNotMailTmpl;
         $message = tkMakeHtml($eTmpl, $params);
         /*$headers = 'From: KG-Ticket-Notify <'.$tkConfBotMail . ">\r\n" .
               'Reply-To: KG-Ticket-Notify <'.$tkConfBotMail . ">\r\n" . 
               "MIME-Version: 1.0" . "\r\n";
               "Content-type: text/html; charset=ISO-8859-1" ;
               "\n\n" ;
           
           $trans_table = array (
             'ä' => 'ae',
             'ö' => 'oe',
             'ü' => 'ue',
             'Ä' => 'Ae',
             'Ö' => 'Oe',
             'Ü' => 'Ue'
           );
           $subject = str_replace( array_keys( $trans_table), $trans_table, $subject );*/
         // don't notify the user himself
         if ($user["id"] != $tkUser["id"]) {
             // Send the notification mail
             #die( $htmlContent );
             mailLog($user["email"], $user["name"], $subject, $message, $headers);
             #echo $user["name"];
             #$x = mail( $to, $subject, $message, $headers );
             #sendMail( $subject, $message, $user["email"], $user["name"], "Dies ist eine HTML-Email...man kann sie nur mit einem HTML-Email-View ansehen..." );
             #die( "stop" );
             #echo "sendmail";
             /*echo "<pre>"."Send Mail
             To: $to; 
             Subject: $subject; 
             Message: $message"."</pre>";*/
             #exit;
         }
         // prevent spam ( also at creation of ticket )
         $sql = "\n      UPDATE \n        " . PRFX . "threads_marks\n      SET\n        email_last_notify='" . time() . "'\n      WHERE\n        threadid='" . $this->dataRaw["id"] . "' AND\n        userid='" . $user["id"] . "'\n    ;";
         $this->query($sql);
     }
     // Send all Mails in the background
     #> /dev/null &
     system("php includes/sendmails.php > includes/maillog &", $ret);
     // attention, works only with Linux!
     #echo $ret;
     #die("stop");
     return 0;
     #exit;
 }