function post_save_each($doquery = true) { ($hook = vBulletinHook::fetch_hook('userpicdata_postsave')) ? eval($hook) : false; return parent::post_save_each($doquery); }
/** * Code to run after saving * * @param boolean Do the query? * * @return boolean Whether this code executed correctly * */ function post_save_each($doquery = true) { $pictureid = intval($this->fetch_field('pictureid')); if (!$this->condition and !empty($this->info['albums'])) { $dateline = !$this->info['dateline'] ? TIMENOW : $this->info['dateline']; $albuminsert = array(); $albumids = array(); foreach ($this->info['albums'] as $album) { $albumids[] = intval($album['albumid']); $albuminsert[] = "(" . intval($album['albumid']) . ", {$pictureid}, {$dateline})"; } $this->registry->db->query_write("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "albumpicture\n\t\t\t\t\t(albumid, pictureid, dateline)\n\t\t\t\tVALUES " . implode(', ', $albuminsert)); if ($this->info['auto_count_update']) { $this->registry->db->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "album SET\n\t\t\t\t\t\t" . ($this->fetch_field('state') == 'visible' ? "visible = visible + 1, lastpicturedate = IF({$dateline} > lastpicturedate, {$dateline}, lastpicturedate)" : "moderation = moderation + 1") . "\n\t\t\t\t\tWHERE albumid IN (" . implode(',', $albumids) . ")\n\t\t\t\t"); } } ($hook = vBulletinHook::fetch_hook('picturedata_postsave')) ? eval($hook) : false; return parent::post_save_each($doquery); }
/** * Additional data to update after a save call (such as denormalized values in other tables). * In batch updates, is executed for each record updated. * * @param boolean Do the query? */ function post_save_each($doquery = true) { if ($contenttypeid = intval($this->fetch_field('contenttypeid'))) { require_once DIR . '/packages/vbattach/attach.php'; if (!($attach =& vB_Attachment_Dm_Library::fetch_library($this->registry, $contenttypeid))) { return false; } $attach->post_save_each($this); } return parent::post_save_each($doquery); }
/** * Additional data to update after a save call (such as denormalized values in other tables). * In batch updates, is executed for each record updated. * * @param boolean Do the query? */ function post_save_each($doquery = true) { if (!empty($this->info['update_existing'])) { // we're updating an existing attachment that has already been counted // in the thread/post.attach fields. We need to decrement those fields // because they will be incremented on save. $this->registry->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "post SET\n\t\t\t\t\tattach = IF(attach > 0, attach - 1, 0)\n\t\t\t\tWHERE postid = " . intval($this->info['update_existing'])); $this->registry->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "post AS post, " . TABLE_PREFIX . "thread AS thread SET\n\t\t\t\t\tthread.attach = IF(thread.attach > 0, thread.attach - 1, 0)\n\t\t\t\tWHERE thread.threadid = post.threadid\n\t\t\t\t\tAND post.postid = " . intval($this->info['update_existing'])); } ($hook = vBulletinHook::fetch_hook('attachdata_postsave')) ? eval($hook) : false; return parent::post_save_each($doquery); }
/** * Additional data to update after a save call (such as denormalized values in other tables). * In batch updates, is executed for each record updated. * * @param boolean Do the query? */ function post_save_each($doquery = true) { // attachment counts if ($this->fetch_field('visible') and empty($this->existing['visible'])) { // new attachment or making one invisible $this->registry->db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "pt_issue SET\r\n\t\t\t\t\tattachcount = attachcount + 1\r\n\t\t\t\tWHERE issueid = " . intval($this->fetch_field('issueid'))); } else { if (!$this->fetch_field('visible') and !empty($this->existing['visible'])) { // hiding visible attachment $this->registry->db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "pt_issue SET\r\n\t\t\t\t\tattachcount = IF(attachcount > 0, attachcount - 1, 0)\r\n\t\t\t\tWHERE issueid = " . intval($this->fetch_field('issueid'))); } } if (!$this->condition and $this->fetch_field('visible')) { // insert issue change $change =& datamanager_init('Pt_IssueChange', $this->registry, ERRTYPE_STANDARD); $change->set_info('roll_post_time_limit', 0); // disable folding for attachment uploads $change->set('issueid', $this->fetch_field('issueid')); $change->set('userid', $this->registry->userinfo['userid']); $change->set('field', 'attachment_uploaded'); $change->set('newvalue', $this->fetch_field('filename')); $change->set('oldvalue', ''); $change->save(); } ($hook = vBulletinHook::fetch_hook('ptattachdata_postsave')) ? eval($hook) : false; return parent::post_save_each($doquery); }
function post_save_each($doquery = true) { return parent::post_save_each($doquery); }