コード例 #1
0
     if (empty($test_user_id)) {
         $delete_ids[] = $mailbox->getUniqueId($k);
         mail($mail->from, 'Error processing your email: ' . $subject, '. We didn\'t find your' . ' email address in our users database, please update your email ' . 'address in your user profile of casebox and resend your mail. ' . 'Wrong messages are deleted automatically.' . $mail_requirements, 'From: ' . $core['mail_user'] . "\n\r");
         echo "\rcannot find corresponding user in our database '.\n                'for email {$email} from message: {$subject} ... skipping";
         continue;
     } else {
         $user_id = $test_user_id;
     }
 }
 /* end of try to find user from database that corresponds to this mail */
 if (preg_match('/(\\([\\s]*(.+)[\\s]*\\))\\s*$/i', $subject, $matches)) {
     $subject = str_replace($matches[0], '', $subject);
     $path = $matches[2];
 } else {
     /*STORE IN /<USER_ID>/Emails folder*/
     $pid = User::getEmailFolderId($user_id);
 }
 /* end of try to get target folder from subject*/
 /* locate the corresponding folder in our database */
 if (empty($pid)) {
     echo 'processing path ' . $path;
     $path = explode('/', $path);
     $rootFolderId = Browser::getRootFolderId();
     $rootFolderName = null;
     $sql = 'SELECT name FROM tree WHERE id = $1';
     $res = DB\dbQuery($sql, $rootFolderId) or die(DB\dbQueryError());
     if ($r = $res->fetch_assoc()) {
         $rootFolderName = $r['name'];
     }
     $res->close();
     while (!empty($path) && empty($path[0])) {