예제 #1
0
    vB::getDbAssertor()->assertQuery('updateUserInfractions', array('joinusergroupid' => $joinusergroupid, 'pointlevel' => empty($groupids[$joinusergroupid]) ? array() : $groupids[$joinusergroupid], 'ids' => $ids));
    $log = array($titles["{$joinusergroupid}"], '*', $primarynames["{$joinusergroupid}"]);
    // the "1" indicates to use the second line of the phrase specified for this task
    log_cron_action(serialize($log), $nextitem, 1);
}
unset($groupids);
$vbulletin =& vB::get_registry();
foreach ($userupdates as $userid => $info) {
    $userdm = new vB_Datamanager_User($vbulletin, vB_DataManager_Constants::ERRTYPE_SILENT);
    $user = array('userid' => $userid);
    $userdm->set_existing($user);
    if ($info['title']) {
        $userdm->set('usertitle', $info['title']);
    }
    if ($info['rank']) {
        $userdm->setr('rank', $info['rank']);
    }
    $userdm->save();
    unset($userdm);
}
foreach ($secondaryupdates as $joinusergroupid => $ids) {
    if ($ids) {
        vB::getDbAssertor()->assertQuery('vBForum:updateUserMemberGroupsByUserId', array('usergroupid' => $joinusergroupid, 'auth' => $ids));
    }
    $log = array($titles["{$joinusergroupid}"], '%', $secondarynames["{$joinusergroupid}"]);
    log_cron_action(serialize($log), $nextitem, 1);
}
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 83432 $
예제 #2
0
 function post_save_each($doquery = true)
 {
     // Check if revision was passed as an info object or as existing
     if (isset($this->info["{$this->revision}"])) {
         $revision = $this->info["{$this->revision}"];
     } else {
         if ($this->fetch_field($this->revision) !== null) {
             $revision = $this->fetch_field($this->revision);
         }
     }
     // We were given an image and a revision number so write out a new image.
     if (!empty($this->info['filedata']) and isset($revision)) {
         $ext = empty($this->existing['aextension']) ? 'gif' : $this->existing['aextension'];
         $oldfilename = $this->fetch_path($this->fetch_field('userid'), $revision, false, $ext);
         $oldthumbfilename = $this->fetch_path($this->fetch_field('userid'), $revision, true, $ext);
         $newfilename = $this->fetch_path($this->fetch_field('userid'), $revision + 1, false, $ext);
         $thumbfilename = $this->fetch_path($this->fetch_field('userid'), $revision + 1, true, $ext);
         if ($filenum = fopen($newfilename, 'wb')) {
             $table = $this->fetchTableBase($this->table);
             if ($revision) {
                 $this->deleteFile($oldfilename);
                 if ($table == 'customavatar') {
                     $this->deleteFile($oldthumbfilename);
                 }
             }
             @fwrite($filenum, $this->info['filedata']);
             @fclose($filenum);
             // init user data manager
             $userdata = new vB_Datamanager_User($this->registry, vB_DataManager_Constants::ERRTYPE_SILENT);
             $userdata->setr('userid', $this->fetch_field('userid'));
             $userdata->condition = array('userid' => $this->fetch_field('userid'));
             $userdata->set($this->revision, $revision + 1);
             $userdata->save();
             unset($userdata);
             if ($table == 'customavatar') {
                 if ($this->info['filedata_thumb']) {
                     $thumbnail['filedata'] =& $this->info['filedata_thumb'];
                 } else {
                     $thumbnail = $this->fetch_thumbnail($newfilename, true);
                 }
                 require_once DIR . '/includes/functions_file.php';
                 $newfiledetails = pathinfo($newfilename);
                 $fields = " filename = '{$newfiledetails['basename']}'";
                 if ($thumbnail['filedata'] and vbmkdir(dirname($thumbfilename)) and $filenum = @fopen($thumbfilename, 'wb')) {
                     @fwrite($filenum, $thumbnail['filedata']);
                     @fclose($filenum);
                     if ($thumbnail['height'] and $thumbnail['width']) {
                         $fields .= ", width_thumb = {$thumbnail['width']}, height_thumb = {$thumbnail['height']}";
                     }
                     unset($thumbnail);
                 }
                 $this->registry->db->query_write("\n\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "customavatar\n\t\t\t\t\t\tSET {$fields}\n\t\t\t\t\t\tWHERE userid = " . $this->fetch_field('userid'));
             }
             return true;
         } else {
             $this->error('upload_invalid_imagepath');
             return false;
         }
     } else {
         return true;
     }
 }