示例#1
0
 public function ic2_isError($url)
 {
     // ブラックリストをチェック
     $blacklist = new ImageCache2_DataObject_BlackList();
     if ($blacklist->get($url)) {
         switch ($blacklist->type) {
             case 0:
                 return 'x05';
                 // No More
             // No More
             case 1:
                 return 'x01';
                 // Aborn
             // Aborn
             case 2:
                 return 'x04';
                 // Virus
             // Virus
             default:
                 return 'x06';
                 // Unknown
         }
     }
     // エラーログをチェック
     if ($this->_ini['Getter']['checkerror']) {
         $errlog = new ImageCache2_DataObject_Errors();
         if ($errlog->get($url)) {
             return $errlog->errcode;
         }
     }
     return false;
 }
示例#2
0
文件: ic2.php 项目: xingskycn/p2-php
            // あぼーん
            break;
        case 2:
            $errcode = 'x04';
            // ウィルス感染
            break;
        default:
            $errcode = 'x06';
            // ???
    }
    ic2_error($errcode, '', false);
}
// 画像がエラーログにあるか確認
if (!$force && $ini['Getter']['checkerror']) {
    $errlog = new ImageCache2_DataObject_Errors();
    if ($errlog->get($uri)) {
        ic2_error($errlog->errcode, '', false);
    }
}
// }}}
// {{{ init http-client
// 設定を確認
$conn_timeout = isset($ini['Getter']['conn_timeout']) && $ini['Getter']['conn_timeout'] > 0 ? (double) $ini['Getter']['conn_timeout'] : 60.0;
$read_timeout = isset($ini['Getter']['read_timeout']) && $ini['Getter']['read_timeout'] > 0 ? (int) $ini['Getter']['read_timeout'] : 60;
$ic2_ua = !empty($_conf['expack.user_agent']) ? $_conf['expack.user_agent'] : $_SERVER['HTTP_USER_AGENT'];
// キャッシュされていなければ、取得を試みる
$client = new HTTP_Client();
$client->setRequestParameter('timeout', $conn_timeout);
$client->setRequestParameter('readTimeout', array($read_timeout, 0));
$client->setMaxRedirects(3);
$client->setDefaultHeader('User-Agent', $ic2_ua);