/**
  * This is a pre_save method that only applies to the subclasses that have post
  * fields as their members (ie, not _Thread). Likely only called in those class's
  * pre_save methods.
  *
  * @return	bool	True on success, false on failure
  */
 function pre_save_post($doquery = true)
 {
     if ($this->info['forum']['podcast'] and $this->info['podcasturl'] and empty($this->info['podcastsize'])) {
         require_once DIR . '/includes/class_upload.php';
         $upload = new vB_Upload_Abstract($this->registry);
         if (!($this->info['podcastsize'] = intval($upload->fetch_remote_filesize($this->info['podcasturl'])))) {
             $this->error('invalid_podcasturl');
             return false;
         }
     }
     if (!$this->condition) {
         if ($this->fetch_field('userid', 'post') == 0 and $this->fetch_field('username', 'post') == '') {
             $this->error('nousername');
             return false;
         }
         if ($this->fetch_field('dateline', 'post') === null) {
             $this->set('dateline', TIMENOW);
         }
         if ($this->fetch_field('ipaddress', 'post') === null) {
             $this->set('ipaddress', $this->registry->options['logip'] ? IPADDRESS : '');
         }
         // flood check
         if ($this->registry->options['floodchecktime'] > 0 and empty($this->info['preview']) and empty($this->info['is_automated']) and $this->fetch_field('userid', 'post')) {
             if (!$this->info['user']) {
                 $this->info['user'] = fetch_userinfo($this->fetch_field('userid', 'post'));
             }
             $user =& $this->info['user'];
             if ($user['lastpost'] <= TIMENOW and !can_moderate($this->info['forum']['forumid'], '', $user['userid'], $user['usergroupid'] . (trim($user['membergroupids']) ? ",{$user['membergroupids']}" : ''))) {
                 if (!class_exists('vB_FloodCheck')) {
                     require_once DIR . '/includes/class_floodcheck.php';
                 }
                 $this->floodcheck =& new vB_FloodCheck($this->registry, 'user', 'lastpost');
                 $this->floodcheck->commit_key($this->registry->userinfo['userid'], TIMENOW, TIMENOW - $this->registry->options['floodchecktime']);
                 if ($this->floodcheck->is_flooding()) {
                     $this->error('postfloodcheck', $this->registry->options['floodchecktime'], $this->floodcheck->flood_wait());
                     return false;
                 }
                 if ($this->errors) {
                     // if we already have errors, the save won't happen, so rollback now...
                     $this->floodcheck->rollback();
                 } else {
                     // ...or, in case we have a new error
                     $this->set_failure_callback(array(&$this->floodcheck, 'rollback'));
                 }
             }
         }
     }
     if (!$this->verify_image_count('pagetext', 'allowsmilie', $this->info['forum']['forumid'], 'post')) {
         return false;
     }
     if ($this->info['posthash']) {
         $this->info['newattach'] = $this->fetch_attachment_count($this->info['posthash'], $this->fetch_field('userid', 'post'));
         $this->set('attach', intval($this->fetch_field('attach')) + $this->info['newattach']);
     }
     // New posts that aren't automated and are visible should be scanned
     if (!$this->condition and !empty($this->registry->options['vb_antispam_key']) and empty($this->info['is_automated']) and $this->fetch_field('visible') == 1 and (!$this->registry->options['vb_antispam_posts'] or $this->registry->userinfo['posts'] < $this->registry->options['vb_antispam_posts']) and !can_moderate()) {
         require_once DIR . '/includes/class_akismet.php';
         $akismet = new vB_Akismet($this->registry);
         $akismet->akismet_board = $this->registry->options['bburl'];
         $akismet->akismet_key = $this->registry->options['vb_antispam_key'];
         if ($akismet->verify_text(array('user_ip' => IPADDRESS, 'user_agent' => USER_AGENT, 'comment_type' => 'post', 'comment_author' => $this->registry->userinfo['userid'] ? $this->registry->userinfo['username'] : $this->fetch_field('username', 'post'), 'comment_author_email' => $this->registry->userinfo['email'], 'comment_author_url' => $this->registry->userinfo['homepage'], 'comment_content' => $this->fetch_field('pagetext', 'post'))) === 'spam') {
             $this->set('visible', 0);
             $this->spamlog_insert = true;
         }
     }
     return true;
 }
Exemple #2
0
 function vB_Upload_AlbumPicture(&$registry)
 {
     $this->allowanimation = true;
     parent::vB_Upload_Abstract($registry);
 }
Exemple #3
0
 $photoplog_urlflag = 0;
 $photoplog_file_error = 1;
 $photoplog_urllink = str_replace(array(' ', '..'), array('+', ''), $photoplog_userlink);
 if (eregi('^(http|ftp)s?://[^./]+\\.[^.]+.*/.+(\\.(gif|jpeg|jpg|png))$', $photoplog_urllink)) {
     $photoplog_parse_url = @parse_url($photoplog_urllink);
     $photoplog_file_check = @getimagesize($photoplog_urllink);
     $photoplog_file_name = photoplog_strip_text(trim(basename($photoplog_parse_url['path'])));
     if (!empty($photoplog_file_check) && is_array($photoplog_file_check) && !empty($photoplog_file_name) && eregi(".+\\.(gif|jpeg|jpg|png)\$", $photoplog_file_name)) {
         if (!in_array($photoplog_file_check[2], array(1, 2, 3))) {
             photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_file']);
         }
         $photoplog_file_type = htmlspecialchars_uni($photoplog_file_check['mime']);
         $photoplog_file_tmp_name = '';
         $photoplog_file_error = 1;
         require_once DIR . '/includes/class_upload.php';
         $photoplog_class_upload = new vB_Upload_Abstract($vbulletin);
         $photoplog_file_size = intval($photoplog_class_upload->fetch_remote_filesize($photoplog_urllink));
         if (!$photoplog_file_size || $permissions['photoplogmaxfilesize'] && $photoplog_file_size > intval($permissions['photoplogmaxfilesize'])) {
             photoplog_output_page('photoplog_error_page', $vbphrase['photoplog_error'], $vbphrase['photoplog_bad_file']);
         }
         $photoplog['dimensions'] = '975313579 x 135797531';
         if ($photoplog_file_check[0] && $photoplog_file_check[1]) {
             $photoplog['dimensions'] = $photoplog_file_check[0] . ' x ' . $photoplog_file_check[1];
         }
         $photoplog_directory_name = PHOTOPLOG_BWD . "/" . $vbulletin->options['photoplog_upload_dir'] . "/" . $photoplog_file_userid . "/url";
         if (!is_dir($photoplog_directory_name)) {
             @mkdir($photoplog_directory_name, 0777);
             @chmod($photoplog_directory_name, 0777);
             if ($photoplog_handle = @fopen($photoplog_directory_name . "/index.html", "w")) {
                 $photoplog_blank = '';
                 @fwrite($photoplog_handle, $photoplog_blank);
 function vB_Upload_SocialGroupIcon(&$registry)
 {
     parent::vB_Upload_Abstract($registry);
 }