function nick_changer_change_username($userinfo, $username)
{
    global $vbulletin;
    if (!nick_changer_can_change_username($userinfo)) {
        return false;
    }
    if ($userinfo['username'] != $username) {
        $old_username = $userinfo['username'];
        $dataman =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
        $dataman->set_existing($userinfo);
        // If this is the first post, we close the thread as "Moderated"
        $dataman->set('nick_changer_last_change', TIMENOW);
        $dataman->set('username', $username);
        $dataman->set('nick_changer_last_username', $old_username);
        $dataman->pre_save();
        if (!empty($dataman->errors)) {
            return $dataman->errors;
        } else {
            $dataman->save();
            $vbulletin->db->query_write("INSERT INTO `" . TABLE_PREFIX . "nick_changer_usernames` (userid, username, dateline) \n  \t  VALUES (\n  \t  " . $userinfo['userid'] . ",\n  \t  '" . $vbulletin->db->escape_string($old_username) . "',\n  \t  " . TIMENOW . "\n  \t  );\n  \t  ");
            nick_changer_create_usernote($old_username);
        }
    } else {
        return false;
    }
    return true;
}
示例#2
0
function newPost($newpost, $posterid = '')
{
    global $vbulletin;
    if ($posterid == '') {
        $posterid = $vbulletin->userinfo['userid'];
    }
    $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
    //$foruminfo = fetch_foruminfo($newpost['forumid']);
    $threadinfo = array();
    $postman->set_info('thread', $threadinfo);
    $postman->setr('threadid', $newpost['threadid']);
    $postman->setr('parentid', $newpost['parentid']);
    $postman->setr('userid', $posterid);
    $postman->setr('pagetext', $newpost['pagetext']);
    $postman->setr('title', $newpost['title']);
    $postman->setr('showsignature', $signature);
    $postman->set('allowsmilie', $newpost['allowsmilie']);
    $postman->set('visible', $newpost['visible']);
    $postman->set_info('parseurl', $newpost['parseurl']);
    $postid = $postman->save();
    build_thread_counters($newpost['threadid']);
    //$result = $vbulletin->db->query_read("SELECT `firstpostid` FROM `".TABLE_PREFIX."thread` WHERE `threadid`='{$idpack['threadid']}'");
    //$row = $vbulletin->db->fetch_row($result);
    //$idpack['postid'] = $row[0];
    return $postid;
}
示例#3
0
文件: results.php 项目: Kheros/MMOver
 /**
  * Create the results based on a list of ids return from the search implmentation
  *
  * @param vB_Current_User $user
  * @param vB_Search_Criteria criteria for the search
  * @return vB_Search_Results
  */
 public static function create_from_criteria($user, $criteria, $searchcontroller = null)
 {
     global $vbulletin;
     $results = new vB_Search_Results();
     $results->user = $user;
     $results->criteria = $criteria;
     $start = microtime();
     if (is_null($searchcontroller)) {
         $searchcontroller = vB_Search_Core::get_instance()->get_search_controller();
         $searchcontroller->clear();
     }
     $results->results = $searchcontroller->get_results($user, $criteria);
     //move log_search call after get_results to allow for any changes to the $criteria
     //object that might be made by the searchcontroller
     $results->searchid = $results->log_search();
     $results->dateline = TIMENOW;
     $results->cache_results();
     $searchtime = vb_number_format(fetch_microtime_difference($start), 2);
     $results->searchtime = $searchtime;
     $results->complete_search($searchtime);
     //log tag search
     $filter = $criteria->get_filters('tag');
     if (isset($filter[vB_Search_Core::OP_EQ])) {
         $dm = datamanager_init('tag', $vbulletin, ERRTYPE_ARRAY);
         $dm->log_tag_search($filter[vB_Search_Core::OP_EQ]);
     }
     return $results;
 }
 function vBulletin_Bridge()
 {
     global $vbulletin;
     $this->vbulletin = $vbulletin;
     $this->db = $this->vbulletin->db;
     $this->userdm =& datamanager_init('User', $this->vbulletin, ERRTYPE_ARRAY);
 }
/**
 * Freeze user
 *
 */
function fu_freeze_user($user_info)
{
    global $vbulletin;
    if (fu_user_can_be_frozen($user_info)) {
        fu_disable_notifications($user_info['userid']);
        $user_dm =& datamanager_init('User', $vbulletin, ERRTYPE_CP);
        $user_dm->set_existing($user_info);
        $user_dm->set('usergroupid', (int) $vbulletin->options['fu_frozen_group']);
        $user_dm->save();
        return true;
    }
    return false;
}
示例#6
0
文件: private.php 项目: holandacz/nb4
function build_pm_counters()
{
    global $vbulletin;
    $pmcount = $vbulletin->db->query_first("\n\t\tSELECT\n\t\t\tCOUNT(pmid) AS pmtotal,\n\t\t\tSUM(IF(messageread = 0 AND folderid >= 0, 1, 0)) AS pmunread\n\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\tWHERE pm.userid = " . $vbulletin->userinfo['userid'] . "\n\t");
    $pmcount['pmtotal'] = intval($pmcount['pmtotal']);
    $pmcount['pmunread'] = intval($pmcount['pmunread']);
    if ($vbulletin->userinfo['pmtotal'] != $pmcount['pmtotal'] or $vbulletin->userinfo['pmunread'] != $pmcount['pmunread']) {
        // init user data manager
        $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
        $userdata->set_existing($vbulletin->userinfo);
        $userdata->set('pmtotal', $pmcount['pmtotal']);
        $userdata->set('pmunread', $pmcount['pmunread']);
        $userdata->save();
    }
}
示例#7
0
 function add_member_to_group($member, $order_details, $renewal)
 {
     if ($renewal || is_wp_error($member) || !$member) {
         return;
     }
     if (!empty($order_details['_acp_order_product_id'])) {
         $member_group = get_post_meta($order_details['_acp_order_product_id'], '_acp_product_vbulletin_group', true);
     }
     if (empty($member_group)) {
         $member_group = accesspress_get_option('vbulletin_group');
     }
     if (!$member_group) {
         return;
     }
     $vb_user_id = get_user_meta($member, 'vbulletin_user_id', true);
     if (empty($vb_user_id)) {
         return;
     }
     // get the vBulletin user
     $vb_user_data = datamanager_init('User', $GLOBALS['vbulletin'], ERRTYPE_ARRAY);
     $user_info = fetch_userinfo($vb_user_id);
     $vb_user_data->set_existing($user_info);
     // check for existing user
     $vb_primary_group = $vb_user_data->fetch_field('usergroupid');
     if (empty($vb_primary_group) || !is_numeric($vb_primary_group)) {
         $vb_user_data->set('usergroupid', $member_group);
         // user already has this primary group
     } elseif ($vb_primary_group == $member_group) {
         return;
         // add to secondary group
     } else {
         $secondary_groups = array($member_group);
         $groups = $vb_user_data->fetch_field('membergroupids');
         if (!empty($groups)) {
             $secondary_groups = explode(',', $groups);
             if (in_array($member_group, $secondary_groups)) {
                 return;
             }
             $secondary_groups[] = $member_group;
             sort($secondary_groups);
         }
         $vb_user_data->set('membergroupids', implode(',', $secondary_groups));
     }
     $vb_user_data->pre_save();
     if (empty($vb_user_data->errors)) {
         $vb_user_id = $vb_user_data->save();
     }
 }
示例#8
0
/**
* Rebuild the pending blog group req count
*
* @param	int			Userid
*
*/
function build_blog_pending_count($userid)
{
	global $vbulletin;

	$pending = $vbulletin->db->query_first("
		SELECT COUNT(*) AS count
		FROM " . TABLE_PREFIX . "blog_groupmembership
		WHERE userid = $userid
			AND state = 'pending'
	");

	$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
	$userinfo = array('userid' => $userid);
	$userdata->set_existing($userinfo);
	$userdata->set('bloggroupreqcount', $pending['count']);
	$userdata->save();
}
示例#9
0
function send_pm($fromuser, $fromid, $touser, $title, $message)
{
    global $vbulletin, $permissions;
    $permissions['pmsendmax'] = 10;
    $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
    $pmdm->set('fromuserid', $fromid);
    $pmdm->set('fromusername', $fromuser);
    $pmdm->set('title', $title);
    $pmdm->set('message', $message);
    $pmdm->set_recipients($touser, $permissions);
    $pmdm->set('dateline', TIMENOW);
    $pmdm->set('showsignature', 1);
    $pmdm->set_info('savecopy', 0);
    $pmdm->pre_save();
    if (empty($pmdm->errors)) {
        $pmdm->save();
    }
}
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     // Bind the user datamanager
     $this->app->bind('vbuserdm', function () {
         $forum_path = $this->app->basePath() . $this->app('config')->get('vbulletin.path');
         define('THIS_SCRIPT', 'laravel_user_datamanager');
         define('CWD', $forum_path);
         require_once "{$forum_path}/global.php";
         // Load up our essential files
         require_once "{$forum_path}/includes/functions.php";
         require_once "{$forum_path}/includes/class_core.php";
         require_once "{$forum_path}/includes/init.php";
         // $vbulletin is defined in here
         $vbulletin = $GLOBALS['vbulletin'];
         $dataman =& datamanager_init('User', $vbulletin);
         // Grab the datamanager for User model
         return new Services\VBulletinUserDataManager($vbulletin, $dataman);
     });
     // Publish the configuration file
     $this->publishes([__DIR__ . '/config/vbulletin.php' => config_path('vbulletin.php')]);
 }
示例#11
0
function capture_user_sync($profile = false, $setId = false, $redirect = false)
{
    global $vbulletin;
    if ($profile === false) {
        $profile = load_user_entity();
    }
    if ($profile) {
        $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
        $userdata->set_existing($vbulletin->userinfo);
        $userdata->set('username', $profile['result']['displayName']);
        if ($profile['result']['birthday']) {
            $userdata->set('birthday', $profile['result']['birthday']);
        }
        if ($setId) {
            $userfield = array($vbulletin->options['janrain_capture_uuid'] => $profile['result']['uuid']);
            $customfields = $userdata->set_userfields($userfield, true, 'admin');
        }
        $userdata->save();
        if ($redirect) {
            exec_header_redirect(capture_current_page());
        }
    }
}
示例#12
0
 /**
  * Additional data to update after a save call (such as denormalized values in other tables).
  *
  * @param	boolean	Do the query?
  */
 function post_save_each($doquery = true)
 {
     // When creating a group, the creator needs to be come a user automatically
     if (empty($this->condition)) {
         $socialgroupmemberdm = datamanager_init('SocialGroupMember', $this->registry, ERRTYPE_STANDARD);
         $socialgroupmemberdm->set('userid', $this->fetch_field('creatoruserid'));
         $socialgroupmemberdm->set('groupid', $this->fetch_field('groupid'));
         $socialgroupmemberdm->set('dateline', $this->fetch_field('dateline'));
         $socialgroupmemberdm->set('type', 'member');
         $socialgroupmemberdm->save();
     }
     ($hook = vBulletinHook::fetch_hook('socgroupdata_postsave')) ? eval($hook) : false;
 }
示例#13
0
             standard_error(fetch_error('you_do_not_have_permission_to_manage_deleted_messages'));
         } else {
             if ($physicaldel and !$canremovemessages or !$physicaldel and !$candeletemessages) {
                 standard_error(fetch_error('you_do_not_have_permission_to_delete_messages'));
             }
         }
     }
     $message['group_name'] = $group['name'];
     $messagearray["{$message['gmid']}"] = $message;
     $grouplist["{$message['groupid']}"] = true;
 }
 if (empty($messagearray)) {
     standard_error(fetch_error('you_did_not_select_any_valid_messages'));
 }
 foreach ($messagearray as $gmid => $message) {
     $dataman =& datamanager_init('GroupMessage', $vbulletin, ERRTYPE_SILENT);
     $dataman->set_existing($message);
     $dataman->set_info('hard_delete', $physicaldel);
     $dataman->set_info('reason', $vbulletin->GPC['deletereason']);
     $dataman->set_info('skip_build_counters', true);
     $dataman->delete();
     unset($dataman);
 }
 foreach ($grouplist as $groupid => $foo) {
     build_group_counters($groupid);
 }
 foreach ($messagearray as $message) {
     if (!$message['is_group_owner']) {
         log_moderator_action($message, $physicaldel ? 'gm_by_x_for_y_removed' : 'gm_by_x_for_y_soft_deleted', array($message['postusername'], $message['group_name']));
     }
 }
示例#14
0
/**
 * Adds a thread rating to the database
 *
 * @param	integer	The Rating
 * @param	array	Forum Information
 * @param	array	Thread Information
 *
 */
function build_thread_rating($rating, $foruminfo, $threadinfo)
{
    // add thread rating into DB
    global $vbulletin;
    if ($rating >= 1 and $rating <= 5 and $foruminfo['allowratings']) {
        if ($vbulletin->userinfo['forumpermissions'][$foruminfo['forumid']] & $vbulletin->bf_ugp_forumpermissions['canthreadrate']) {
            // see if voting allowed
            $vote = intval($rating);
            if ($ratingsel = $vbulletin->db->query_first("\n\t\t\t\tSELECT vote, threadrateid, threadid\n\t\t\t\tFROM " . TABLE_PREFIX . "threadrate\n\t\t\t\tWHERE userid = " . $vbulletin->userinfo['userid'] . " AND\n\t\t\t\tthreadid = {$threadinfo['threadid']}\n\t\t\t")) {
                // user has already voted
                if ($vbulletin->options['votechange']) {
                    // if allowed to change votes
                    if ($vote != $ratingsel['vote']) {
                        // if vote is different to original
                        $voteupdate = $vote - $ratingsel['vote'];
                        $threadrate =& datamanager_init('ThreadRate', $vbulletin, ERRTYPE_SILENT);
                        $threadrate->set_info('thread', $threadinfo);
                        $threadrate->set_existing($ratingsel);
                        $threadrate->set('vote', $vote);
                        $threadrate->save();
                    }
                }
            } else {
                // insert new vote, post_save_each ++ the vote count of the thread
                $threadrate =& datamanager_init('ThreadRate', $vbulletin, ERRTYPE_SILENT);
                $threadrate->set_info('thread', $threadinfo);
                $threadrate->set('threadid', $threadinfo['threadid']);
                $threadrate->set('userid', $vbulletin->userinfo['userid']);
                $threadrate->set('vote', $vote);
                $threadrate->save();
            }
        }
    }
}
示例#15
0
		");
	}
	else
	{
		// insert a record into the userban table
		/*insert query*/
		$db->query_write("
			INSERT INTO " . TABLE_PREFIX . "userban
			(userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate, reason)
			VALUES
			($user[userid], $user[usergroupid], $user[displaygroupid], $user[customtitle], '" . $db->escape_string($user['usertitle']) . "', " . $vbulletin->userinfo['userid'] . ", " . TIMENOW . ", $liftdate, '" . $db->escape_string($vbulletin->GPC['reason']) . "')
		");
	}

	// update the user record
	$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
	$userdm->set_existing($user);
	$userdm->set('usergroupid', $vbulletin->GPC['usergroupid']);
	$userdm->set('displaygroupid', 0);

	// update the user's title if they've specified a special user title for the banned group
	if ($vbulletin->usergroupcache["{$vbulletin->GPC['usergroupid']}"]['usertitle'] != '')
	{
		$userdm->set('usertitle', $vbulletin->usergroupcache["{$vbulletin->GPC['usergroupid']}"]['usertitle']);
		$userdm->set('customtitle', 0);
	}

	$userdm->save();
	unset($userdm);

	define('CP_REDIRECT', 'banning.php');
示例#16
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)) {
         $oldfilename = $this->fetch_path($this->fetch_field('userid'), $revision);
         $oldthumbfilename = $this->fetch_path($this->fetch_field('userid'), $revision, true);
         $newfilename = $this->fetch_path($this->fetch_field('userid'), $revision + 1);
         $thumbfilename = $this->fetch_path($this->fetch_field('userid'), $revision + 1, true);
         if ($filenum = fopen($newfilename, 'wb')) {
             @unlink($oldfilename);
             if ($this->table == 'customavatar') {
                 @unlink($oldthumbfilename);
             }
             @fwrite($filenum, $this->info['filedata']);
             @fclose($filenum);
             // init user data manager
             $userdata =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
             $userdata->setr('userid', $this->fetch_field('userid'));
             $userdata->condition = "userid = " . $this->fetch_field('userid');
             $userdata->set($this->revision, $revision + 1);
             $userdata->save();
             unset($userdata);
             if ($this->table == 'customavatar') {
                 if ($this->info['filedata_thumb']) {
                     $thumbnail['filedata'] =& $this->info['filedata_thumb'];
                 } else {
                     $thumbnail = $this->fetch_thumbnail($newfilename, true);
                 }
                 if ($thumbnail['filedata'] and $filenum = @fopen($thumbfilename, 'wb')) {
                     @fwrite($filenum, $thumbnail['filedata']);
                     @fclose($filenum);
                     if ($thumbnail['height'] and $thumbnail['width']) {
                         $this->registry->db->query_write("\n\t\t\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "customavatar\n\t\t\t\t\t\t\t\tSET width_thumb = {$thumbnail['width']},\n\t\t\t\t\t\t\t\t\theight_thumb = {$thumbnail['height']}\n\t\t\t\t\t\t\t\tWHERE userid = " . $this->fetch_field('userid'));
                     }
                     unset($thumbnail);
                 }
             }
             ($hook = vBulletinHook::fetch_hook('userpicdata_postsave')) ? eval($hook) : false;
             return true;
         } else {
             ($hook = vBulletinHook::fetch_hook('userpicdata_postsave')) ? eval($hook) : false;
             $this->error('upload_invalid_imagepath');
             return false;
         }
     } else {
         ($hook = vBulletinHook::fetch_hook('userpicdata_postsave')) ? eval($hook) : false;
         return true;
     }
 }
示例#17
0
 /**
  * For registration without existing account, create a new vb user
  * If a user is successfully created, her userid is written to $userid
  */
 private function createUser($data, &$userid)
 {
     global $vbulletin;
     $moderated = $vbulletin->options['moderatenewmembers'];
     $languageid = $vbulletin->userinfo['languageid'];
     $require_activation = $vbulletin->options['verifyemail'] && $data['default_email'] != $data['coded_email'];
     // Create a vB user with default permissions -- code from register.php
     if (!$vbulletin->options['allowregistration']) {
         eval(standard_error(fetch_error('noregister')));
     }
     // Init user datamanager class
     $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
     $userdata->set_info('coppauser', false);
     $userdata->set_info('coppapassword', '');
     $userdata->set_bitfield('options', 'coppauser', '');
     $userdata->set('username', $data['username']);
     $userdata->set('password', md5($this->genPasswd()));
     $userdata->set('email', $data['email']);
     $userdata->set('languageid', $languageid);
     $userdata->set('ipaddress', IPADDRESS);
     // UserGroupId: Registered Users (2) or Users Awaiting Email Confirmation (3)
     $userdata->set('usergroupid', $require_activation ? 3 : 2);
     $userdata->set_usertitle('', false, $vbulletin->usergroupcache["{$newusergroupid}"], false, false);
     $userdata->presave_called = true;
     // If any error happened, we abort and return the error message(s)
     if ($userdata->has_errors(false)) {
         // $die := false
         return join('</li><li>', $userdata->errors);
     }
     // Save the data
     $userid = $userdata->save();
     // Did we get a valid vb userid?
     if (!$userid) {
         return 'vbnexus_registration_failed';
     }
     // If the user changed the email given by the external service, we follow
     // the regular steps for email activation
     if ($require_activation) {
         // Email phrase 'activateaccount' expects vars called $userid, $username
         // and $activateid to be defined and meaningfull
         $username = $data['username'];
         $activateid = build_user_activation_id($userid, $moderated ? 4 : 2, 0);
         eval(fetch_email_phrases('activateaccount', $languageid));
         // After eval'ing activateaccount we have vars $subject and $message set
         vbmail($data['email'], $subject, $message, true);
     }
     // Force a new session to prevent potential issues with guests from the same IP, see bug #2459
     $vbulletin->session->created = false;
     return true;
 }
示例#18
0
文件: profile.php 项目: holandacz/nb4
                    $forumperms = fetch_permissions($attachment['forumid']);
                    if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['caneditpost']) or $vbulletin->userinfo['userid'] != $attachment['userid']) {
                        continue;
                    } else {
                        if (!$vbulletin->options['allowattachdel'] and $vbulletin->options['edittimelimit'] and $attachment['p_dateline'] < TIMENOW - $vbulletin->options['edittimelimit'] * 60) {
                            continue;
                        }
                    }
                }
            }
        }
        $idlist .= ',' . $attachment['attachmentid'];
    }
    require_once DIR . '/includes/functions_file.php';
    if (!empty($idlist)) {
        $attachdata =& datamanager_init('Attachment', $vbulletin, ERRTYPE_STANDARD);
        $attachdata->condition = "attachmentid IN (-1{$idlist})";
        $attachdata->delete();
    }
    ($hook = vBulletinHook::fetch_hook('profile_deleteattachments_complete')) ? eval($hook) : false;
    $vbulletin->url = 'profile.php?' . $vbulletin->session->vars['sessionurl'] . 'do=editattachments&amp;pp=' . $vbulletin->GPC['perpage'] . '&amp;page=' . $vbulletin->GPC['pagenumber'] . '&amp;showthumbs=' . $vbulletin->GPC['showthumbs'] . '&amp;u=' . $vbulletin->GPC['userid'];
    eval(print_standard_redirect('redirect_attachdel'));
}
// ############################### List of attachments for current user ################
if ($_REQUEST['do'] == 'editattachments') {
    // Variables reused in templates
    $perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);
    $pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
    $showthumbs = $vbulletin->input->clean_gpc('r', 'showthumbs', TYPE_BOOL);
    $vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT));
    $templatename = 'modifyattachments';
示例#19
0
 /**
  * protected void associateAccount(array $user, int $vbnexus_userid)
  *	    Forces GFC users to choose a password (and a valid email too for
  *      users of vbnexus3). The change is then flagged in the database with
  *      field vbnexus_user.associated set to 2.
  *
  * @param array $user
  * @param int $vbnexus_userid
  * @return void
  */
 protected function associateAccount($user, $vbnexus_userid)
 {
     global $vbulletin, $vboptions, $vbphrase, $stylevar, $vbnexus_loc;
     if (!intval($user['userid'])) {
         return false;
     }
     // If the user is submitting email and/or password, process it
     if (isset($_POST['vbnexus_gfc_fix'])) {
         // Validate input
         if (empty($_POST['email'])) {
             $vbnexus_error = "A valid email is required";
         } elseif (empty($_POST['password'])) {
             $vbnexus_error = "A valid password is required";
         } elseif (empty($_POST['password2']) || $_POST['password'] != $_POST['password2']) {
             $vbnexus_error = "Passwords do not match";
         } else {
             $require_activation = $vbulletin->options['verifyemail'] && $user['email'] != $_POST['email'];
             $userdata =& datamanager_init('user', $vbulletin, ERRTYPE_SILENT);
             $userdata->set_existing(fetch_userinfo($user['userid']));
             $userdata->set('password', $_POST['password']);
             // We can ignore validation of the email if it wasn't changed
             $user['email'] == $_POST['email'] || $userdata->set('email', $_POST['email']);
             if ($require_activation) {
                 $userdata->set('usergroupid', 3);
             }
             if ($userdata->has_errors(false)) {
                 $vbnexus_error = join('</li><li>', $userdata->errors);
             } elseif ($userdata->save()) {
                 if ($require_activation) {
                     // Email phrase 'activateaccount' expects vars called $userid, $username
                     // and $activateid to be defined and meaningfull
                     $userid = $user['userid'];
                     $username = $user['username'];
                     $activateid = build_user_activation_id($userid, $user['usergroupid'], 0);
                     eval(fetch_email_phrases('activateaccount', $languageid));
                     // After eval'ing activateaccount we have vars $subject and $message set
                     vbmail($_POST['email'], $subject, $message, true);
                 }
                 // The user was updated, there's now a valid password and email, so let's flag it
                 $sql = "UPDATE `" . TABLE_PREFIX . "vbnexus_user`\r\n                            SET `associated` = 2\r\n                            WHERE `nonvbid` = '{$vbnexus_userid}'\r\n                            AND `service` = 'gfc'";
                 $vbulletin->db->query_write($sql);
                 if ($vbulletin->db->query_write($sql)) {
                     // Returning since we're done here and execution should go on normally
                     return;
                 } else {
                     // This should never happen, it's mostly for debugging if something goes wrong
                     $errmsg = "An error occurred trying to update your GFC information. Please try again." . " If the problem persists please report it to an admin.";
                     return eval(standard_error($errmsg));
                     // Prints and exits
                 }
             } else {
                 // This should never happen, it's mostly for debugging if something goes wrong
                 $errmsg = "An error occurred trying to update the account information. Please try again." . " If the problem persists please report it to an admin.";
                 return eval(standard_error($errmsg));
                 // Prints and exits
             }
         }
         $user['email'] = $_POST['email'];
     }
     $vBNexusUser = $user;
     // No need to show mock emails from old vbnexus (< 3)
     if (empty($_POST['email']) && preg_match("/apps\\+|{$vbnexus_userid}[@\\.]/", $user['email'])) {
         $vBNexusUser['email'] = '';
     }
     $vbnexus_loc = $_GET['loc'];
     // This will print a Message box (not really an error, but the actual form) and exit
     eval('$html = "' . fetch_template('vbnexus_3_gfc_invalid_email') . '";');
     eval(standard_error($html));
 }
示例#20
0
文件: cleanup.php 项目: 0hyeah/yurivn
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "session\n\tWHERE lastactivity < " . intval(TIMENOW - $vbulletin->options['cookietimeout']) . "\n");
$vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "cpsession\n\tWHERE dateline < " . ($vbulletin->options['timeoutcontrolpanel'] ? intval(TIMENOW - $vbulletin->options['cookietimeout']) : TIMENOW - 3600) . "\n");
require_once DIR . '/vb/search/results.php';
vB_Search_Results::clean();
// expired lost passwords and email confirmations after 4 days
$vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "useractivation\n\tWHERE dateline < " . (TIMENOW - 345600) . " AND\n\t(type = 1 OR (type = 0 and usergroupid = 2))\n");
// old forum/thread read marking data
$vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "threadread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400));
$vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "forumread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400));
$vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "groupread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400));
$vbulletin->db->query_write("\n\tDELETE FROM " . TABLE_PREFIX . "discussionread\n\tWHERE readtime < " . (TIMENOW - $vbulletin->options['markinglimit'] * 86400));
// delete expired thread redirects
$threads = $vbulletin->db->query_read("\n\tSELECT threadid\n\tFROM " . TABLE_PREFIX . "threadredirect\n\tWHERE expires < " . TIMENOW . "\n");
while ($thread = $vbulletin->db->fetch_array($threads)) {
    $thread['open'] = 10;
    $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost');
    $threadman->set_existing($thread);
    $threadman->delete(false, true, NULL, false);
    unset($threadman);
}
vB_Cache::instance()->clean();
($hook = vBulletinHook::fetch_hook('cron_script_cleanup_hourly')) ? eval($hook) : false;
log_cron_action('', $nextitem, 1);
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 03:13, Sat Sep 7th 2013
|| # CVS: $RCSfile$ - $Revision: 62098 $
|| ####################################################################
\*======================================================================*/
示例#21
0
	{
		print_no_permission();
	}

	if ($vbulletin->GPC['deletemessage'] != '')
	{
		if ($vbulletin->GPC['deletemessage'] == 'remove' AND can_moderate(0, 'canremovevisitormessages'))
		{
			$hard_delete = true;
		}
		else
		{
			$hard_delete = false;
		}

		$dataman =& datamanager_init('VisitorMessage', $vbulletin, ERRTYPE_STANDARD);
		$dataman->set_existing($messageinfo);
		$dataman->set_info('hard_delete', $hard_delete);
		$dataman->set_info('reason', $vbulletin->GPC['reason']);

		$dataman->delete();
		unset($dataman);

		if ($messageinfo['postuserid'] != $vbulletin->userinfo['userid'] AND can_moderate(0, 'candeletevisitormessages'))
		{
			require_once(DIR . '/includes/functions_log_error.php');
			log_moderator_action($messageinfo,
				($hard_delete ? 'vm_by_x_for_y_removed' : 'vm_by_x_for_y_soft_deleted'),
				array($messageinfo['postusername'], $userinfo['username'])
			);
		}
示例#22
0
    } else {
        if (!$user['isadministrator']) {
            // should this user have an administrator record??
            $userinfo = fetch_userinfo($user['userid']);
            cache_permissions($userinfo);
            if ($userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) {
                $admindm =& datamanager_init('Admin', $vbulletin, ERRTYPE_SILENT);
                $admindm->set('userid', $userinfo['userid']);
                $admindm->save();
                unset($admindm);
            } else {
                print_stop_message('invalid_user_specified');
            }
        }
    }
    $admindm =& datamanager_init('Admin', $vbulletin, ERRTYPE_CP);
    $admindm->set_existing($user);
} else {
    $user = array();
}
require_once DIR . '/includes/class_bitfield_builder.php';
if (vB_Bitfield_Builder::build(false) !== false) {
    $myobj =& vB_Bitfield_Builder::init();
} else {
    echo "<strong>error</strong>\n";
    print_r(vB_Bitfield_Builder::fetch_errors());
}
foreach ($myobj->data['ugp']['adminpermissions'] as $title => $values) {
    // don't show settings that have a group for the usergroup page
    if (empty($values['group'])) {
        $ADMINPERMISSIONS["{$title}"] = $values['value'];
示例#23
0
     }
 } else {
     if (!($vbulletin->userinfo['calendarpermissions']["{$calendarinfo['calendarid']}"] & $vbulletin->bf_ugp_calendarpermissions['canpostevent'])) {
         print_no_permission();
     }
 }
 // unwysiwygify the incoming data
 if ($vbulletin->GPC['wysiwyg']) {
     require_once DIR . '/includes/class_wysiwygparser.php';
     $html_parser = new vB_WysiwygHtmlParser($vbulletin);
     $message = $html_parser->parse_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $calendarinfo['allowhtml']);
 } else {
     $message = $vbulletin->GPC['message'];
 }
 // init event datamanager class
 $eventdata =& datamanager_init('Event', $vbulletin, ERRTYPE_STANDARD);
 ($hook = vBulletinHook::fetch_hook('calendar_update_process')) ? eval($hook) : false;
 $eventdata->set_info('parseurl', $vbulletin->GPC['parseurl'] and $calendarinfo['allowbbcode']);
 $eventdata->setr_info('fromtime', $fromtime);
 $eventdata->setr_info('totime', $totime);
 $eventdata->setr_info('fromdate', $fromdate);
 $eventdata->setr_info('todate', $todate);
 $eventdata->setr_info('type', $vbulletin->GPC['type']);
 $eventdata->setr_info('recur', $vbulletin->GPC['recur']);
 $eventdata->set('title', $vbulletin->GPC['title']);
 $eventdata->set('event', $message);
 $eventdata->set('allowsmilies', empty($vbulletin->GPC['disablesmilies']) ? true : false);
 $eventdata->set('utc', $timezoneoffset);
 $eventdata->set('recurring', $type == 'recur' ? $vbulletin->GPC['recur']['pattern'] : 0);
 $eventdata->set('calendarid', $calendarinfo['calendarid']);
 $eventdata->set('dst', $dst);
/**
* Deletes all private messages belonging to the specified user
*
* @param	integer	User ID
* @param	boolean	If true, update the user record in the database to reflect their new number of private messages
*
* @return	mixed	If messages are deleted, will return a string to be printed out detailing work done by this function
*/
function delete_user_pms($userid, $updateuser = true)
{
    global $vbulletin, $vbphrase;
    $userid = intval($userid);
    // array to store pm ids message ids
    $pms = array();
    // array to store the number of pmtext records used by this user
    $pmTextCount = array();
    // array to store the ids of any pmtext records that are used soley by this user
    $deleteTextIDs = array();
    // array to store results
    $out = array();
    // first zap all receipts belonging to this user
    $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "pmreceipt WHERE userid = {$userid}");
    $out['receipts'] = $vbulletin->db->affected_rows();
    // now find all this user's private messages
    $messages = $vbulletin->db->query_read("\n\t\tSELECT pmid, pmtextid\n\t\tFROM " . TABLE_PREFIX . "pm\n\t\tWHERE userid = {$userid}\n\t");
    while ($message = $vbulletin->db->fetch_array($messages)) {
        // stick this record into our $pms array
        $pms["{$message['pmid']}"] = $message['pmtextid'];
        // increment the number of PMs that use the current PMtext record
        $pmTextCount["{$message['pmtextid']}"]++;
    }
    $vbulletin->db->free_result($messages);
    if (!empty($pms)) {
        // zap all pm records belonging to this user
        $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "pm WHERE userid = {$userid}");
        $out['pms'] = $vbulletin->db->affected_rows();
        $out['pmtexts'] = 0;
        // update the user record if necessary
        if ($updateuser and $user = fetch_userinfo($userid)) {
            $updateduser = true;
            $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
            $userdm->set_existing($user);
            $userdm->set('pmtotal', 0);
            $userdm->set('pmunread', 0);
            $userdm->set('pmpopup', 'IF(pmpopup=2, 1, pmpopup)', false);
            $userdm->save();
            unset($userdm);
        }
    } else {
        $out['pms'] = 0;
        $out['pmtexts'] = 0;
    }
    // in case the totals have been corrupted somehow
    if (!isset($updateduser) and $updateuser and $user = fetch_userinfo($userid)) {
        $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
        $userdm->set_existing($user);
        $userdm->set('pmtotal', 0);
        $userdm->set('pmunread', 0);
        $userdm->set('pmpopup', 'IF(pmpopup=2, 1, pmpopup)', false);
        $userdm->save();
        unset($userdm);
    }
    foreach ($out as $k => $v) {
        $out["{$k}"] = vb_number_format($v);
    }
    return $out;
}
 function post_save_each($doquery = true)
 {
     $this->insert_moderator_log();
     if (!$this->condition and $this->fetch_field('visible') == 1 and $this->info['forum']) {
         $forumdata =& datamanager_init('Forum', $this->registry, ERRTYPE_SILENT);
         $forumdata->set_existing($this->info['forum']);
         $forumdata->set_info('disable_cache_rebuild', true);
         if (!empty($this->info['coventry']) and $this->info['coventry']['in_coventry'] == 1) {
             $forumdata->set_info('coventry', $this->info['coventry']);
         }
         $forumdata->set('threadcount', 'threadcount + 1', false);
         $forumdata->save();
     }
     if ($this->condition and $fpid = $this->fetch_field('firstpostid')) {
         if ($this->existing['visible'] == 0 and $this->fetch_field('visible') == 1) {
             $this->akismet_mark_as_ham($fpid);
         }
         if (!$this->info['skip_first_post_update']) {
             // if we're updating the title/iconid of an existing thread, update the first post
             if ((isset($this->thread['title']) or isset($this->thread['iconid'])) and $fp = fetch_postinfo($fpid)) {
                 $postdata =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost');
                 $postdata->set_existing($fp);
                 if (isset($this->thread['title'])) {
                     $postdata->set('title', $this->thread['title'], true, false);
                     // don't clean it -- already been cleaned
                 }
                 if (isset($this->thread['iconid'])) {
                     $postdata->set('iconid', $this->thread['iconid'], true, false);
                 }
                 $postdata->save();
             }
         }
     }
     if ($this->condition and $this->thread['title'] and $this->existing['title']) {
         // we're updating the title of a thread, so update redirect titles as well if the redirect title is the same
         $this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "thread SET\n\t\t\t\t\ttitle = '" . $this->dbobject->escape_string($this->thread['title']) . "'\n\t\t\t\tWHERE\n\t\t\t\t\topen = 10 AND\n\t\t\t\t\tpollid = " . intval($this->fetch_field('threadid')) . " AND\n\t\t\t\t\ttitle = '" . $this->dbobject->escape_string($this->existing['title']) . "'\n\t\t\t");
     }
     if (!empty($this->info['coventry']) and $this->info['coventry']['in_coventry'] == 1 and $this->setfields['replycount']) {
         $this->dbobject->query_read("SELECT * FROM " . TABLE_PREFIX . "tachythreadcounter WHERE userid = " . $this->info['coventry']['userid'] . " AND threadid = " . $this->fetch_field('threadid'));
         if ($this->dbobject->affected_rows() > 0) {
             $tachyupdate = 'replycount = ' . $this->tachythreadcounter['replycount'];
             $this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "tachythreadcounter SET " . $tachyupdate . " WHERE userid = " . $this->info['coventry']['userid'] . " AND threadid = " . $this->fetch_field('threadid'));
         } else {
             $this->tachythreadcounter['replycount'] = 1;
             $this->tachythreadcounter['userid'] = $this->info['coventry']['userid'];
             $this->tachythreadcounter['threadid'] = $this->fetch_field('threadid');
             $this->dbobject->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "tachythreadcounter\n\t\t\t\t\t\t(userid, threadid, replycount)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(" . intval($this->tachythreadcounter['userid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadcounter['threadid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadcounter['replycount']) . ")\n\t\t\t\t");
         }
     }
     if (empty($this->info['rebuild']) and $this->setfields['lastpost']) {
         if (!empty($this->info['coventry']) and $this->info['coventry']['in_coventry'] == 1) {
             $this->tachythreadpost['userid'] = $this->info['coventry']['userid'];
             $this->tachythreadpost['threadid'] = $this->fetch_field('threadid');
             $this->dbobject->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "tachythreadpost\n\t\t\t\t\t\t(userid, threadid, lastpost, lastposter, lastpostid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(" . intval($this->tachythreadpost['userid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadpost['threadid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadpost['lastpost']) . ",\n\t\t\t\t\t\t'" . $this->dbobject->escape_string($this->tachythreadpost['lastposter']) . "',\n\t\t\t\t\t\t" . intval($this->tachythreadpost['lastpostid']) . ")\n\t\t\t\t");
         } else {
             $this->dbobject->query_write("\n\t\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "tachythreadpost\n\t\t\t\t\t\tWHERE threadid = " . intval($this->fetch_field('threadid')));
         }
     }
     ($hook = vBulletinHook::fetch_hook('threaddata_postsave')) ? eval($hook) : false;
 }
示例#26
0
文件: prefix.php 项目: Kheros/MMOver
        print_stop_message('invalid_action_specified');
    }
    $prefixsetdm->set_existing($prefixset);
    $prefixsetdm->delete();
    define('CP_REDIRECT', 'prefix.php?do=list');
    print_stop_message('prefix_set_deleted');
}
// ########################################################################
if ($_REQUEST['do'] == 'deleteset') {
    $vbulletin->input->clean_array_gpc('r', array('prefixsetid' => TYPE_NOHTML));
    print_delete_confirmation('prefixset', $vbulletin->GPC['prefixsetid'], 'prefix', 'killset');
}
// ########################################################################
if ($_POST['do'] == 'insertset') {
    $vbulletin->input->clean_array_gpc('p', array('prefixsetid' => TYPE_NOHTML, 'origprefixsetid' => TYPE_NOHTML, 'title' => TYPE_STR, 'displayorder' => TYPE_UINT, 'forumids' => TYPE_ARRAY_INT));
    $prefixsetdm =& datamanager_init('PrefixSet', $vbulletin, ERRTYPE_CP);
    if ($vbulletin->GPC['origprefixsetid']) {
        $prefixset = $db->query_first("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . TABLE_PREFIX . "prefixset\r\n\t\t\tWHERE prefixsetid = '" . $db->escape_string($vbulletin->GPC['origprefixsetid']) . "'\r\n\t\t");
        if (!$prefixset) {
            print_stop_message('invalid_action_specified');
        }
        $prefixsetdm->set_existing($prefixset);
    } else {
        $prefixsetdm->set('prefixsetid', $vbulletin->GPC['prefixsetid']);
    }
    $prefixsetdm->set('displayorder', $vbulletin->GPC['displayorder']);
    $prefixsetdm->set_info('title', $vbulletin->GPC['title']);
    $prefixsetdm->save();
    $vbulletin->GPC['prefixsetid'] = $prefixsetdm->fetch_field('prefixsetid');
    // setup this prefix set for selected forums
    $old_forums = array();
示例#27
0
/**
 * Builds infraction groups for users
 *
 * @param	array	User IDs to build
 *
 */
function build_infractiongroupids($userids)
{
    global $vbulletin;
    static $infractiongroups = array(), $beenhere;
    if (!$beenhere) {
        $beenhere = true;
        $groups = $vbulletin->db->query_read_slave("\n\t\t\tSELECT usergroupid, orusergroupid, pointlevel, override\n\t\t\tFROM " . TABLE_PREFIX . "infractiongroup\n\t\t\tORDER BY pointlevel\n\t\t");
        while ($group = $vbulletin->db->fetch_array($groups)) {
            $infractiongroups["{$group['usergroupid']}"]["{$group['pointlevel']}"][] = array('orusergroupid' => $group['orusergroupid'], 'override' => $group['override']);
        }
    }
    $users = $vbulletin->db->query_read("\n\t\tSELECT user.*\n\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\tWHERE userid IN (" . implode(', ', $userids) . ")\n\t");
    while ($user = $vbulletin->db->fetch_array($users)) {
        $infractioninfo = fetch_infraction_groups($infractiongroups, $user['userid'], $user['ipoints'], $user['usergroupid']);
        if (($groupids = implode(',', $infractioninfo['infractiongroupids'])) != $user['infractiongroupids'] or $infractioninfo['infractiongroupid'] != $user['infractiongroupid']) {
            $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
            $userdata->set_existing($user);
            $userdata->set('infractiongroupids', $groupids);
            $userdata->set('infractiongroupid', $infractioninfo['infractiongroupid']);
            $userdata->save();
        }
    }
}
示例#28
0
 /**
  * Code to run after deleting
  *
  * @param	boolean	Do the query?
  *
  * @return	boolean	Was this code executed correctly?
  *
  */
 function post_delete($doquery = true)
 {
     $albums = array();
     $albums_sql = $this->registry->db->query_read("\n\t\t\tSELECT album.*\n\t\t\tFROM " . TABLE_PREFIX . "albumpicture AS albumpicture\n\t\t\tINNER JOIN " . TABLE_PREFIX . "album AS album ON (album.albumid = albumpicture.albumid)\n\t\t\tWHERE albumpicture.pictureid = " . $this->fetch_field('pictureid'));
     while ($album = $this->registry->db->fetch_array($albums_sql)) {
         $albums[] = $album;
     }
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "albumpicture\n\t\t\tWHERE pictureid = " . $this->fetch_field('pictureid'));
     if ($this->info['auto_count_update'] and $albums) {
         foreach ($albums as $album) {
             $albumdata =& datamanager_init('Album', $this->registry, ERRTYPE_SILENT);
             $albumdata->set_existing($album);
             $albumdata->rebuild_counts();
             // for a picture to have been set to the cover, it must have been visible
             if ($albumdata->fetch_field('coverpictureid') == $this->fetch_field('pictureid')) {
                 if ($album['visible'] - 1 > 0) {
                     $new_cover = $this->registry->db->query_first("\n\t\t\t\t\t\t\tSELECT albumpicture.pictureid\n\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "albumpicture AS albumpicture\n\t\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "picture AS picture ON (albumpicture.pictureid = picture.pictureid)\n\t\t\t\t\t\t\tWHERE albumpicture.albumid = {$album['albumid']} AND picture.state = 'visible'\n\t\t\t\t\t\t\tORDER BY albumpicture.dateline ASC\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t");
                 }
                 $albumdata->set('coverpictureid', $new_cover['pictureid'] ? $new_cover['pictureid'] : 0);
             }
             $albumdata->save();
         }
     }
     $del_usercss = array();
     foreach ($albums as $album) {
         $del_usercss[] = "'{$album['albumid']}," . $this->fetch_field('pictureid') . "'";
     }
     if ($del_usercss) {
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "usercss\n\t\t\t\tWHERE property = 'background_image'\n\t\t\t\t\tAND value IN (" . implode(',', $del_usercss) . ")\n\t\t\t\t\tAND userid = " . intval($this->fetch_field('userid')) . "\n\t\t\t");
         $this->info['have_updated_usercss'] = $this->registry->db->affected_rows() > 0;
     }
     $groups = array();
     $groups_sql = $this->registry->db->query_read("\n\t\t\tSELECT DISTINCT socialgroup.*\n\t\t\tFROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture\n\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgrouppicture.groupid)\n\t\t\tWHERE socialgrouppicture.pictureid = " . $this->fetch_field('pictureid'));
     while ($group = $this->registry->db->fetch_array($groups_sql)) {
         $groups[] = $group;
     }
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "socialgrouppicture\n\t\t\tWHERE pictureid = " . $this->fetch_field('pictureid'));
     foreach ($groups as $group) {
         $groupdata =& datamanager_init('SocialGroup', $this->registry, ERRTYPE_SILENT);
         $groupdata->set_existing($group);
         $groupdata->rebuild_picturecount();
         $groupdata->save();
     }
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment\n\t\t\tWHERE pictureid = " . $this->fetch_field('pictureid'));
     require_once DIR . '/includes/functions_picturecomment.php';
     build_picture_comment_counters($this->fetch_field('userid'));
     ($hook = vBulletinHook::fetch_hook('picturedata_delete')) ? eval($hook) : false;
     return parent::post_delete($doquery);
 }
示例#29
0
 /**
  * Additional data to update after a delete call (such as denormalized values in other tables).
  *
  * @param	boolean	Do the query?
  */
 function post_delete($doquery = true)
 {
     $pictures = array();
     $picture_sql = $this->registry->db->query_read("\n\t\t\tSELECT albumpicture.pictureid, picture.idhash, picture.extension\n\t\t\tFROM " . TABLE_PREFIX . "albumpicture AS albumpicture\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "picture AS picture ON (albumpicture.pictureid = picture.pictureid)\n\t\t\tWHERE albumpicture.albumid = " . $this->fetch_field('albumid'));
     while ($picture = $this->registry->db->fetch_array($picture_sql)) {
         $pictures["{$picture['pictureid']}"] = $picture;
     }
     if ($pictures) {
         if ($this->registry->options['album_dataloc'] != 'db') {
             // remove from fs
             foreach ($pictures as $picture) {
                 @unlink(fetch_picture_fs_path($picture));
                 @unlink(fetch_picture_fs_path($picture, true));
             }
         }
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         // delete based on picture id as this means that when a picture is deleted,
         // it's removed from all albums automatically
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "albumpicture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         require_once DIR . '/includes/functions_picturecomment.php';
         build_picture_comment_counters($this->fetch_field('userid'));
         $groups = array();
         $groups_sql = $this->registry->db->query_read("\n\t\t\t\tSELECT DISTINCT socialgroup.*\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgrouppicture.groupid)\n\t\t\t\tWHERE socialgrouppicture.pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         while ($group = $this->registry->db->fetch_array($groups_sql)) {
             $groups[] = $group;
         }
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "socialgrouppicture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         foreach ($groups as $group) {
             $groupdata =& datamanager_init('SocialGroup', $this->registry, ERRTYPE_SILENT);
             $groupdata->set_existing($group);
             $groupdata->rebuild_picturecount();
             $groupdata->save();
         }
     }
     $this->remove_usercss_background_image();
     ($hook = vBulletinHook::fetch_hook('albumdata_delete')) ? eval($hook) : false;
     return true;
 }
    define('CP_REDIRECT', 'admininfraction.php?do=dolist' . $args);
    print_stop_message('deleted_infraction_successfully');
}
// ###################### Start Delete #######################
if ($_REQUEST['do'] == 'deleteinfraction') {
    $vbulletin->input->clean_array_gpc('r', array('infractionid' => TYPE_UINT, 'pagenumber' => TYPE_UINT, 'orderby' => TYPE_NOHTML, 'perpage' => TYPE_UINT, 'status' => TYPE_NOHTML, 'userid' => TYPE_UINT, 'whoadded' => TYPE_UINT, 'startstamp' => TYPE_UINT, 'endstamp' => TYPE_UINT));
    print_delete_confirmation('infraction', $vbulletin->GPC['infractionid'], 'admininfraction', 'killinfraction', '', array('page' => $vbulletin->GPC['pagenumber'], 'orderby' => $vbulletin->GPC['orderby'], 'pp' => $vbulletin->GPC['perpage'], 'status' => $vbulletin->GPC['status'], 'u' => $vbulletin->GPC['userid'], 'whoadded' => $vbulletin->GPC['whoadded'], 'startstamp' => $vbulletin->GPC['startstamp'], 'endstamp' => $vbulletin->GPC['endstamp'], 'infractionlevelid' => $vbulletin->GPC['infractionlevelid']));
}
// ###################### Start Reversal #######################
if ($_POST['do'] == 'doreverse') {
    $vbulletin->input->clean_array_gpc('r', array('infractionid' => TYPE_UINT, 'reason' => TYPE_STR, 'pagenumber' => TYPE_UINT, 'orderby' => TYPE_NOHTML, 'perpage' => TYPE_UINT, 'status' => TYPE_NOHTML, 'userid' => TYPE_UINT, 'whoadded' => TYPE_UINT, 'startstamp' => TYPE_UINT, 'endstamp' => TYPE_UINT));
    if ($infractioninfo = $db->query_first("\n\t\tSELECT infraction.*\n\t\tFROM " . TABLE_PREFIX . "infraction AS infraction\n\t\tWHERE infractionid = " . $vbulletin->GPC['infractionid'])) {
        if ($infractioninfo['action'] == 2) {
            print_stop_message('infraction_already_reversed');
        }
        $infdata =& datamanager_init('Infraction', $vbulletin, ERRTYPE_STANDARD);
        $infdata->set_existing($infractioninfo);
        $infdata->setr_info('postinfo', $postinfo);
        $infdata->setr_info('userinfo', $userinfo);
        $infdata->set('action', 2);
        $infdata->set('actionuserid', $vbulletin->userinfo['userid']);
        $infdata->set('actiondateline', TIMENOW);
        $infdata->set('actionreason', $vbulletin->GPC['reason']);
        $infdata->save();
        $args = '&status=' . $vbulletin->GPC['status'] . '&u=' . $vbulletin->GPC['userid'] . '&whoadded=' . $vbulletin->GPC['whoadded'] . '&startstamp=' . $vbulletin->GPC['startstamp'] . '&endstamp=' . $vbulletin->GPC['endstamp'] . '&pp=' . $vbulletin->GPC['perpage'] . '&page=' . $vbulletin->GPC['pagenumber'] . '&orderby=' . $vbulletin->GPC['orderby'] . '&infractionlevelid=' . $vbulletin->GPC['infractionlevelid'];
        define('CP_REDIRECT', 'admininfraction.php?do=dolist' . $args);
        print_stop_message('reversed_infraction_successfully');
    } else {
        print_stop_message('no_matches_found');
    }
}