当前位置: 首页>>代码示例>>PHP>>正文


PHP vB_Bitfield_Builder::init方法代码示例

本文整理汇总了PHP中vB_Bitfield_Builder::init方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_Bitfield_Builder::init方法的具体用法?PHP vB_Bitfield_Builder::init怎么用?PHP vB_Bitfield_Builder::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vB_Bitfield_Builder的用法示例。


在下文中一共展示了vB_Bitfield_Builder::init方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse

 /**
  * Parse XML
  *
  * @param	string	location of XML
  */
 public function parse($xml)
 {
     print_dots_start('<b>' . $this->vbphrase['importing_product'] . "</b>, {$this->vbphrase[please_wait]}", ':', 'dspan');
     $this->xmlobj = new vB_XML_Parser($xml);
     if ($this->xmlobj->error_no == 1) {
         print_dots_stop();
         throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
     }
     if (!($this->productobj = $this->xmlobj->parse())) {
         print_dots_stop();
         throw new vB_Exception_AdminStopMessage(array('xml_error_x_at_line_y', $this->xmlobj->error_string(), $this->xmlobj->error_line()));
     }
     // ############## general product information
     $this->productinfo['productid'] = substr(preg_replace('#[^a-z0-9_]#', '', strtolower($this->productobj['productid'])), 0, 25);
     $this->productinfo['title'] = $this->productobj['title'];
     $this->productinfo['description'] = $this->productobj['description'];
     $this->productinfo['version'] = $this->productobj['version'];
     $this->productinfo['active'] = $this->productobj['active'];
     $this->productinfo['url'] = $this->productobj['url'];
     $this->productinfo['versioncheckurl'] = $this->productobj['versioncheckurl'];
     if (!$this->productinfo['productid']) {
         print_dots_stop();
         if (!empty($this->productobj['plugin'])) {
             throw new vB_Exception_AdminStopMessage('this_file_appears_to_be_a_plugin');
         } else {
             throw new vB_Exception_AdminStopMessage('invalid_file_specified');
         }
     }
     if (strtolower($this->productinfo['productid']) == 'vbulletin') {
         print_dots_stop();
         throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
     }
     // check for bitfield conflicts on install
     $bitfields = vB_Bitfield_Builder::return_data();
     if (!$bitfields) {
         $bfobj =& vB_Bitfield_Builder::init();
         if ($bfobj->errors) {
             print_dots_stop();
             throw new vB_Exception_AdminStopMessage(array('bitfield_conflicts_x', '<li>' . implode('</li><li>', $bfobj->errors) . '</li>'));
         }
     }
     return true;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:48,代码来源:class_upgrade_product.php

示例2: return_data

 /**
  * Returns a multi-dimensional array of all defined bitfields, including <nocache> and disabled products
  *
  * $vbulletin->bf_ugp_forumpermissions['canview'] would be returned as $array['ugp']['forumpermissions']['canview']
  *
  * @return	array
  */
 function return_data()
 {
     if (vB_Bitfield_Builder::build(true, true) === false) {
         return false;
     }
     $obj =& vB_Bitfield_Builder::init();
     return $obj->data;
 }
开发者ID:holandacz,项目名称:nb4,代码行数:15,代码来源:class_bitfield_builder.php

示例3: array

}
$vbulletin->input->clean_array_gpc('r', array('forumid' => TYPE_INT, 'moderatorid' => TYPE_UINT, 'userid' => TYPE_UINT, 'modusername' => TYPE_STR, 'redir' => TYPE_NOHTML));
// ############################# LOG ACTION ###############################
log_admin_action($vbulletin->GPC['moderatorid'] != 0 ? " moderator id = " . $vbulletin->GPC['moderatorid'] : ($vbulletin->GPC['forumid'] != 0 ? "forum id = " . $vbulletin->GPC['forumid'] : ($vbulletin->GPC['userid'] != 0 ? "user id = " . $vbulletin->GPC['userid'] : (!empty($vbulletin->GPC['modusername']) ? "mod username = " . $vbulletin->GPC['modusername'] : ''))));
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
print_cp_header($vbphrase['moderator_manager']);
if (empty($_REQUEST['do'])) {
    $_REQUEST['do'] = 'modify';
}
// ###################### Start add / edit moderator #######################
if ($_REQUEST['do'] == 'add' or $_REQUEST['do'] == 'edit' or $_REQUEST['do'] == 'editglobal') {
    require_once DIR . '/includes/class_bitfield_builder.php';
    if (vB_Bitfield_Builder::build(false) !== false) {
        $myobj =& vB_Bitfield_Builder::init();
        if (sizeof($myobj->data['misc']['moderatorpermissions']) != sizeof($vbulletin->bf_misc_moderatorpermissions) or sizeof($myobj->data['misc']['moderatorpermissions2']) != sizeof($vbulletin->bf_misc_moderatorpermissions2)) {
            $myobj->save($db);
            define('CP_REDIRECT', $vbulletin->scriptpath);
            print_stop_message('rebuilt_bitfields_successfully');
        }
    } else {
        echo "<strong>error</strong>\n";
        print_r(vB_Bitfield_Builder::fetch_errors());
    }
    if ($_REQUEST['do'] == 'editglobal') {
        $moderator = $db->query_first("\n\t\t\tSELECT user.username, user.userid,\n\t\t\tmoderator.forumid, moderator.permissions, moderator.permissions2, moderator.moderatorid\n\t\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "moderator AS moderator ON (moderator.userid = user.userid AND moderator.forumid = -1)\n\t\t\tWHERE user.userid = " . $vbulletin->GPC['userid']);
        print_form_header('moderator', 'update');
        construct_hidden_code('forumid', '-1');
        construct_hidden_code('modusername', $moderator['username'], false);
        $username = $moderator['username'];
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:moderator.php

示例4: fetchDefaultData

 /**
  * Fetch default usergroup data for adding or editing new usergroup
  *
  * @param int $usergroupid If present, the data will be copied from this usergroup
  * @return array Default usergroup data. It contains four sub-arrays:
  *               'usergroup' - Basic usergroup information
  *               'ugarr' - usergroups to be used for 'Create Forum Permissions Based off of Usergroup'
  *               'ug_bitfield' - Usergroup bitfield
  *               'groupinfo' - Usergroup permission information
  */
 public function fetchDefaultData($usergroupid = 0)
 {
     $this->checkHasAdminPermission('canadminpermissions');
     $bf_ugp = vB::getDatastore()->get_value('bf_ugp');
     require_once DIR . '/includes/class_bitfield_builder.php';
     $myobj =& vB_Bitfield_Builder::init();
     if ($usergroupid) {
         $usergroup = vB::getDbAssertor()->getRow('usergroup', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_TABLE, vB_dB_Query::CONDITIONS_KEY => array('usergroupid' => $usergroupid)));
         $ug_bitfield = array();
         foreach ($bf_ugp as $permissiongroup => $fields) {
             $ug_bitfield["{$permissiongroup}"] = convert_bits_to_array($usergroup["{$permissiongroup}"], $fields);
         }
     } else {
         $ug_bitfield = array('genericoptions' => array('showgroup' => 1, 'showeditedby' => 1, 'isnotbannedgroup' => 1), 'forumpermissions' => array('canview' => 1, 'canviewothers' => 1, 'cangetattachment' => 1, 'cansearch' => 1, 'canthreadrate' => 1, 'canpostattachment' => 1, 'canpostpoll' => 1, 'canvote' => 1, 'canviewthreads' => 1), 'forumpermissions2' => array('cangetimgattachment' => 1), 'wolpermissions' => array('canwhosonline' => 1), 'genericpermissions' => array('canviewmembers' => 1, 'canmodifyprofile' => 1, 'canseeprofilepic' => 1, 'canusesignature' => 1, 'cannegativerep' => 1, 'canuserep' => 1, 'cansearchft_nl' => 1));
         // set default numeric permissions
         $usergroup = array('pmquota' => 0, 'pmsendmax' => 5, 'attachlimit' => 1000000, 'avatarmaxwidth' => 200, 'avatarmaxheight' => 200, 'avatarmaxsize' => 20000, 'profilepicmaxwidth' => 100, 'profilepicmaxheight' => 100, 'profilepicmaxsize' => 25000, 'sigmaxsizebbcode' => 7);
     }
     $permgroups = vB::getDbAssertor()->assertQuery('usergroup_fetchperms', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED));
     $ugarr = array();
     foreach ($permgroups as $group) {
         $ugarr["{$group['usergroupid']}"] = $group['title'];
     }
     foreach ((array) $myobj->data['ugp'] as $grouptitle => $perms) {
         if ($grouptitle == 'createpermissions') {
             continue;
         }
         foreach ($perms as $permtitle => $permvalue) {
             if (empty($permvalue['group'])) {
                 continue;
             }
             $groupinfo["{$permvalue['group']}"]["{$permtitle}"] = array('phrase' => $permvalue['phrase'], 'value' => $permvalue['value'], 'parentgroup' => $grouptitle);
             if ($permvalue['intperm']) {
                 $groupinfo["{$permvalue['group']}"]["{$permtitle}"]['intperm'] = true;
             }
             if (!empty($myobj->data['layout']["{$permvalue['group']}"]['ignoregroups'])) {
                 $groupinfo["{$permvalue['group']}"]['ignoregroups'] = $myobj->data['layout']["{$permvalue['group']}"]['ignoregroups'];
             }
             if (!empty($permvalue['ignoregroups'])) {
                 $groupinfo["{$permvalue['group']}"]["{$permtitle}"]['ignoregroups'] = $permvalue['ignoregroups'];
             }
             if (!empty($permvalue['options'])) {
                 $groupinfo["{$permvalue['group']}"]["{$permtitle}"]['options'] = $permvalue['options'];
             }
         }
     }
     return array('usergroup' => $usergroup, 'ug_bitfield' => $ug_bitfield, 'ugarr' => $ugarr, 'groupinfo' => $groupinfo);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:57,代码来源:usergroup.php

示例5: array

     // fetch the custom perms, row per type this time
     $customperms = array();
     $customperms_data = $db->query_read("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "pt_projectpermission\n\t\t\tWHERE usergroupid = {$usergroup_info['usergroupid']}\n\t\t\t\tAND projectid = {$project['projectid']}\n\t\t");
     while ($customperm = $db->fetch_array($customperms_data)) {
         $perms = $customperm;
         unset($perms['usergroupid'], $perms['projectid'], $perms['issuetypeid']);
         $customperms["{$customperm['issuetypeid']}"] = $perms;
     }
 } else {
     // editing global permissions
     print_table_header(construct_phrase($vbphrase['edit_permissions_for_x'], $usergroup_info['title']), sizeof($issuetype_options) + 1);
     $customperms = array();
 }
 require_once DIR . '/includes/class_bitfield_builder.php';
 vB_Bitfield_Builder::build(false);
 $builder =& vB_Bitfield_Builder::init();
 $perms = array();
 $has_custom = array();
 if (!$project) {
     // these are the global-only (settable in one place) permissions for the project tools
     print_description_row($vbphrase['global_project_tools_permissions'], false, 4, 'thead');
     foreach ($builder->data['ugp']['ptpermissions'] as $bitname => $permvalue) {
         $bit = $permvalue['value'];
         print_yes_no_row($vbphrase["{$permvalue['phrase']}"], "ugpermissions[{$bit}]", intval($usergroup_info['ptpermissions']) & intval($bit) ? 1 : 0);
     }
     print_description_row('<span class="smallfont"><a href="#" onclick="js_open_help(\'projectpermission\', \'edit\', \'about_reports\'); return false;">' . $vbphrase['what_are_reports'] . '</a></span>', false, 2, '', 'right');
     print_table_break();
     print_table_header(construct_phrase($vbphrase['project_tools_permissions_for_x'], $usergroup_info['title']), sizeof($issuetype_options) + 1);
 } else {
     // project specific -- let's check the general permissions for this group
     if (!(intval($usergroup_info['ptpermissions']) & $vbulletin->bf_ugp_ptpermissions['canviewprojecttools'])) {
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:projectpermission.php

示例6: install_product

/**
* Installs a product from the xml text
*
* This function depends on the vb class loader, which requires that the
* framework init is called.
*
* @return bool True if the product requires a template merge, false otherwise
*/
function install_product($xml, $allow_overwrite)
{
	global $vbphrase;
	global $vbulletin;
	global $db;

	require_once(DIR . '/includes/class_bitfield_builder.php');
	require_once(DIR . '/includes/class_xml.php');
	require_once(DIR . '/includes/class_block.php');

	//share some code with the main xml style import
	require_once(DIR . '/includes/adminfunctions_template.php');

	print_dots_start('<b>' . $vbphrase['importing_product'] . "</b>, $vbphrase[please_wait]", ':', 'dspan');

	$xmlobj = new vB_XML_Parser($xml);
	if ($xmlobj->error_no == 1)
	{
		print_dots_stop();
		throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
	}

	if(!$arr = $xmlobj->parse())
	{
		print_dots_stop();
		throw new vB_Exception_AdminStopMessage(
			array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
	}

	// ############## general product information
	$info = array(
		'productid'       => substr(preg_replace('#[^a-z0-9_]#', '', strtolower($arr['productid'])), 0, 25),
		'title'           => $arr['title'],
		'description'     => $arr['description'],
		'version'         => $arr['version'],
		'active'          => $arr['active'],
		'url'             => $arr['url'],
		'versioncheckurl' => $arr['versioncheckurl']
	);

	if (!$info['productid'])
	{
		print_dots_stop();
		if (!empty($arr['plugin']))
		{
			throw new vB_Exception_AdminStopMessage('this_file_appears_to_be_a_plugin');
		}
		else
		{
			throw new vB_Exception_AdminStopMessage('invalid_file_specified');
		}
	}

	if (strtolower($info['productid']) == 'vbulletin')
	{
		print_dots_stop();
		throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
	}

	// check for bitfield conflicts on install
	$bitfields = vB_Bitfield_Builder::return_data();
	if (!$bitfields)
	{
		$bfobj =& vB_Bitfield_Builder::init();
		if ($bfobj->errors)
		{
			print_dots_stop();
			throw new vB_Exception_AdminStopMessage(array(
				'bitfield_conflicts_x',
				'<li>' . implode('</li><li>', $bfobj->errors) . '</li>'
			));
		}
	}

	// get system version info
	$system_versions = array(
		'php' => PHP_VERSION,
		'vbulletin' => $vbulletin->options['templateversion'],
		'products' => fetch_product_list(true)
	);
	$mysql_version = $db->query_first("SELECT VERSION() AS version");
	$system_versions['mysql'] = $mysql_version['version'];

	// ############## import dependencies
	if (is_array($arr['dependencies']['dependency']))
	{
		$dependencies =& $arr['dependencies']['dependency'];
		if (!isset($dependencies[0]))
		{
			$dependencies = array($dependencies);
		}

//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:adminfunctions_plugin.php

示例7: install_product

/**
* Installs a product from the xml text
*
* This function depends on the vb class loader, which requires that the
* framework init is called.
*
* @return bool True if the product requires a template merge, false otherwise
*/
function install_product($xml, $allow_overwrite = false, $verbose = true)
{
    global $vbphrase;
    global $vbulletin;
    $assertor = vB::getDbAssertor();
    require_once DIR . '/includes/class_bitfield_builder.php';
    require_once DIR . '/includes/class_xml.php';
    //share some code with the main xml style import
    require_once DIR . '/includes/adminfunctions_template.php';
    if ($verbose) {
        print_dots_start('<b>' . $vbphrase['importing_product'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
    }
    $xmlobj = new vB_XML_Parser($xml);
    if ($xmlobj->error_no() == 1) {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
    }
    if (!($arr = $xmlobj->parse())) {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage(array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
    }
    // ############## general product information
    $info = array('productid' => substr(preg_replace('#[^a-z0-9_]#', '', strtolower($arr['productid'])), 0, 25), 'title' => $arr['title'], 'description' => $arr['description'], 'version' => $arr['version'], 'active' => $arr['active'], 'url' => $arr['url'], 'versioncheckurl' => $arr['versioncheckurl']);
    if (!$info['productid']) {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage('invalid_file_specified');
    }
    if (strtolower($info['productid']) == 'vbulletin') {
        if ($verbose) {
            print_dots_stop();
        }
        throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
    }
    // check for bitfield conflicts on install
    $bitfields = vB_Bitfield_Builder::return_data();
    if (!$bitfields) {
        $bfobj =& vB_Bitfield_Builder::init();
        if ($bfobj->errors) {
            if ($verbose) {
                print_dots_stop();
            }
            throw new vB_Exception_AdminStopMessage(array('bitfield_conflicts_x', '<li>' . implode('</li><li>', $bfobj->errors) . '</li>'));
        }
    }
    // get system version info
    $system_versions = array('php' => PHP_VERSION, 'vbulletin' => $vbulletin->options['templateversion'], 'products' => fetch_product_list(true));
    $mysql_version = $assertor->getRow('mysqlVersion');
    $system_versions['mysql'] = $mysql_version['version'];
    // ############## import dependencies
    if (isset($arr['dependencies']['dependency']) and is_array($arr['dependencies']['dependency'])) {
        $dependencies =& $arr['dependencies']['dependency'];
        if (!isset($dependencies[0])) {
            $dependencies = array($dependencies);
        }
        $dependency_errors = array();
        $ignore_dependency_errors = array();
        // let's check the dependencies
        foreach ($dependencies as $dependency) {
            // if we get an error, we haven't met this dependency
            // if we go through without a problem, we have automatically met
            // all dependencies for this "class" (mysql, php, vb, a specific product, etc)
            $this_dependency_met = true;
            // build a phrase for the version compats -- will look like (minver / maxver)
            if ($dependency['minversion']) {
                $compatible_phrase = construct_phrase($vbphrase['compatible_starting_with_x'], htmlspecialchars_uni($dependency['minversion']));
            } else {
                $compatible_phrase = '';
            }
            if ($dependency['maxversion']) {
                $incompatible_phrase = construct_phrase($vbphrase['incompatible_with_x_and_greater'], htmlspecialchars_uni($dependency['maxversion']));
            } else {
                $incompatible_phrase = '';
            }
            if ($compatible_phrase or $incompatible_phrase) {
                $required_version_info = "({$compatible_phrase}";
                if ($compatible_phrase and $incompatible_phrase) {
                    $required_version_info .= ' / ';
                }
                $required_version_info .= "{$incompatible_phrase})";
            }
            // grab the appropriate installed version string
            if ($dependency['dependencytype'] == 'product') {
                // group dependencies into types -- individual products get their own group
                $dependency_type_key = "product-{$dependency['parentproductid']}";
                // undocumented feature -- you can put a producttitle attribute in a dependency so the id isn't displayed
                $parent_product_title = !empty($dependency['producttitle']) ? $dependency['producttitle'] : $dependency['parentproductid'];
//.........这里部分代码省略.........
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:adminfunctions_product.php

示例8: build_project_bitfields

/**
* Builds the cache of project bitfields (for perms) into $vbulletin->pt_bitfields.
* Accessed as [groupid][bitname] => value
*
* @return	array	Bitfield cache
*/
function build_project_bitfields()
{
    global $vbulletin;
    require_once DIR . '/includes/class_bitfield_builder.php';
    vB_Bitfield_Builder::build(false);
    $builder =& vB_Bitfield_Builder::init();
    $bits = array();
    if ($builder->data['pt_permissions']) {
        foreach ($builder->data['pt_permissions'] as $groupid => $permission_group) {
            foreach ($permission_group as $bitname => $permvalue) {
                $bits["{$groupid}"]["{$bitname}"] = intval(is_array($permvalue) ? $permvalue['value'] : $permvalue);
            }
        }
    }
    build_datastore('pt_bitfields', serialize($bits), 1);
    $vbulletin->pt_bitfields = $bits;
    return $bits;
}
开发者ID:holandacz,项目名称:nb4,代码行数:24,代码来源:adminfunctions_projecttools.php


注:本文中的vB_Bitfield_Builder::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。