當前位置: 首頁>>代碼示例>>PHP>>正文


PHP comment::find_email方法代碼示例

本文整理匯總了PHP中comment::find_email方法的典型用法代碼示例。如果您正苦於以下問題:PHP comment::find_email方法的具體用法?PHP comment::find_email怎麽用?PHP comment::find_email使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在comment的用法示例。


在下文中一共展示了comment::find_email方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: comment

 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
// For use like get_attachment.php?entity=project&id=5&file=foo.bar
require_once "../alloc.php";
if (isset($_GET["id"]) && $_GET["part"]) {
    $comment = new comment();
    $comment->set_id($_GET["id"]);
    $comment->select() or die("Bad _GET[id]");
    list($mail, $text, $mimebits) = $comment->find_email(false, true);
    if (!$mail) {
        list($mail, $text, $mimebits) = $comment->find_email(false, true, true);
    }
    if ($comment->has_attachment_permission($current_user)) {
        foreach ((array) $mimebits as $bit) {
            if ($bit["part"] == $_GET["part"]) {
                $thing = $bit["blob"];
                $filename = $bit["name"];
                break;
            }
        }
        header('Content-Type: ' . $mimetype);
        header("Content-Length: " . strlen($thing));
        header('Content-Disposition: inline; filename="' . basename($filename) . '"');
        echo $thing;
開發者ID:cjbayliss,項目名稱:alloc,代碼行數:31,代碼來源:get_mime_part.php

示例2: opendir

ini_set('memory_limit', "256M");
$db = new db_alloc();
// Loop through attachments directory
$dir = ATTACHMENTS_DIR . "comment" . DIRECTORY_SEPARATOR;
if (is_dir($dir)) {
    $handle = opendir($dir);
    while (false !== ($file = readdir($handle))) {
        clearstatcache();
        if ($file == "." || $file == ".." || !is_numeric($file) || dir_is_empty($dir . $file) || !is_numeric($file)) {
            continue;
        }
        // Figure out which email created the comment
        $comment = new comment();
        $comment->set_id($file);
        $comment->select();
        echo "<br><br><hr>Examining comment " . $file;
        // Figure out what the mime parts are for the attachments and update comment.commentMimeParts
        list($email, $text, $mimebits) = $comment->find_email(true);
        if (!$email) {
            echo "<br>Couldn't find email for commentID: " . $file . "<br>";
            rename($dir . $file, $dir . "fail_" . $file);
        }
        if ($mimebits) {
            echo "<br>Setting commentMimeParts for comment: " . $comment->get_id();
            $comment->set_value("commentMimeParts", serialize($mimebits));
            $comment->skip_modified_fields = true;
            $comment->save();
            rename($dir . $file, $dir . "done_" . $file);
        }
    }
}
開發者ID:cjbayliss,項目名稱:alloc,代碼行數:31,代碼來源:patch-00274-alla.php


注:本文中的comment::find_email方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。