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


PHP POP3::apop方法代碼示例

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


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

示例1: workPopfetcher

 function workPopfetcher(&$eventData)
 {
     global $serendipity;
     static $debug = null;
     if ($debug === null) {
         $debug = $this->debug = serendipity_db_bool($this->get_config('debug'));
     }
     // updertEntry() will not function unless this is set:
     $serendipity['POST']['properties']['fake'] = 'fake';
     $_SESSION['serendipityRightPublish'] = true;
     $this->out('<h3>' . PLUGIN_MF_NAME . ' v' . POPFETCHER_VERSION . ' @ ' . date("D M j G:i:s T Y") . '</h3>');
     $debug_file = null;
     // DEVELOPERS: If set to a filename, you can bypass fetching POP and use a file instead.
     $debug_mail = $this->get_config('debug_mail');
     if (strlen($debug_mail) != '' && file_exists($debug_mail)) {
         $debug_file = $debug_mail;
     }
     if ($debug_file != null) {
         $this->debug = true;
     }
     $authorid = $this->get_config('author');
     if (empty($authorid) || $authorid == 'empty') {
         $authorid = isset($serendipity['authorid']) ? $serendipity['authorid'] : 1;
     }
     $mailserver = trim($this->get_config('mailserver'));
     $mailport = $this->get_config('mailport');
     $mailuser = trim($this->get_config('mailuser'));
     $mailpass = trim($this->get_config('mailpass'));
     $timeout = $this->get_config('timeout');
     $deleteflag = serendipity_db_bool($this->get_config('deleteflag'));
     $apopflag = serendipity_db_bool($this->get_config('apopflag'));
     $blogflag = serendipity_db_bool($this->get_config('blogflag'));
     $striptagsflag = serendipity_db_bool($this->get_config('striptagsflag'));
     $publishflag = serendipity_db_bool($this->get_config('publishflag'));
     $onlyfrom = $this->get_config('onlyfrom', '');
     $maildir = trim($this->get_config('maildir'));
     $category = trim($this->get_config('category'));
     $adflag = serendipity_db_bool($this->get_config('adflag'));
     $plaintext_is_body_flag = serendipity_db_bool($this->get_config('plaintext_is_body'));
     $plaintext_use_extended_flag = serendipity_db_bool($this->get_config('plaintext_use_extended'));
     $list_virus = array('.pif', '.vbs', '.scr', '.bat', '.com', '.exe');
     $list_imagetype = array('jpg', 'jpeg', 'gif', 'png', 'x-png', 'pjpeg');
     $list_imageext = array('.gif', '.jpg', '.png', '.jpeg');
     $list_ignore = array('.smil');
     $output = '';
     $dirpath = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $maildir;
     $dupcount = 0;
     // Upload directory must end with a slash character
     if (strrchr($dirpath, '/') != '/') {
         $output = MF_ERROR7;
         $this->out('<br />' . $output . '<br />');
         return true;
     }
     // Upload directory must be writable
     if (!is_writable($dirpath)) {
         $output = MF_ERROR6;
         $this->out('<br />' . $output . '<br />');
         return true;
     }
     if (serendipity_db_bool($this->get_config('subfolder'))) {
         $dirpath = $dirpath . '/' . date('Y');
         if (!is_dir($dirpath)) {
             mkdir($dirpath);
         }
         $dirpath = $dirpath . '/' . date('m') . '/';
         if (!is_dir($dirpath)) {
             mkdir($dirpath);
         }
         $maildir .= date('Y') . '/' . date('m') . '/';
     }
     $maildir = str_replace('//', '/', $maildir);
     // Category (if specified) must exist
     if (!empty($category)) {
         $cid = serendipity_fetchCategoryInfo(null, $category);
         if ($cid == false) {
             $output = MF_ERROR8;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
     }
     if ($debug_file === null) {
         // Create new instance of POP3 connection
         $pop3 = new POP3($mailserver, $timeout);
         // Attempt to connect to mail server
         if (!$pop3->connect($mailserver, $mailport)) {
             $output = MF_ERROR1 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
         // Try APOP login if requested, otherwise, regular login
         if ($apopflag) {
             $Count = $pop3->apop($mailuser, $mailpass);
         } else {
             $Count = $pop3->login($mailuser, $mailpass);
         }
         // Check for error retrieving number of msgs in mailbox
         if ($Count === false or $Count == -1) {
             $output = MF_ERROR2 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             return true;
//.........這裏部分代碼省略.........
開發者ID:sqall01,項目名稱:additional_plugins,代碼行數:101,代碼來源:serendipity_event_popfetcher.php


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