本文整理汇总了PHP中XenForo_Link::buildAdminLink方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Link::buildAdminLink方法的具体用法?PHP XenForo_Link::buildAdminLink怎么用?PHP XenForo_Link::buildAdminLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Link
的用法示例。
在下文中一共展示了XenForo_Link::buildAdminLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionTestFacebook
public function actionTestFacebook()
{
if (!XenForo_Application::get('options')->facebookAppId) {
$group = $this->getModelFromCache('XenForo_Model_Option')->getOptionGroupById('facebook');
$url = XenForo_Link::buildAdminLink('options/list', $group);
return $this->responseError(new XenForo_Phrase('to_test_facebook_integration_must_enter_application_info', array('url' => $url)));
}
$fbRedirectUri = XenForo_Link::buildAdminLink('canonical:tools/test-facebook', false, array('x' => '?/&=', 'y' => 2));
if ($this->_input->filterSingle('test', XenForo_Input::UINT)) {
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, XenForo_Helper_Facebook::getFacebookRequestUrl($fbRedirectUri));
}
$info = false;
$userToken = false;
$code = $this->_input->filterSingle('code', XenForo_Input::STRING);
if ($code) {
$token = XenForo_Helper_Facebook::getAccessTokenFromCode($code, $fbRedirectUri);
$fbError = XenForo_Helper_Facebook::getFacebookRequestErrorInfo($token, 'access_token');
if ($fbError) {
return $this->responseError($fbError);
}
$userToken = $token['access_token'];
$info = XenForo_Helper_Facebook::getUserInfo($userToken);
$fbError = XenForo_Helper_Facebook::getFacebookRequestErrorInfo($info, 'id');
if ($fbError) {
return $this->responseError($fbError);
}
}
$viewParams = array('fbInfo' => $info, 'userToken' => $userToken);
return $this->responseView('XenForo_ViewAdmin_Tools_TestFacebook', 'tools_test_facebook', $viewParams);
}
示例2: actionDelete
/**
* This method should be sufficiently generic to handle deletion of any extended node type
*
* @return XenForo_ControllerResponse_Reroute
*/
public function actionDelete()
{
$nodeId = $this->_input->filterSingle('node_id', XenForo_Input::INT);
if ($this->isConfirmedPost()) {
$writer = $this->_getNodeDataWriter();
$writer->setExistingData($nodeId);
if ($this->_input->filterSingle('move_child_nodes', XenForo_Input::BINARY)) {
$parentNodeId = $this->_input->filterSingle('parent_node_id', XenForo_Input::UINT);
if ($parentNodeId) {
$parentNode = $this->_getNodeModel()->getNodeById($parentNodeId);
if (!$parentNode) {
return $this->responseError(new XenForo_Phrase('specified_destination_node_does_not_exist'));
}
} else {
// no destination node id, so set it to 0 (root node)
$parentNodeId = 0;
}
$writer->setOption(XenForo_DataWriter_Node::OPTION_CHILD_NODE_DESTINATION_PARENT_ID, $parentNodeId);
}
$writer->delete();
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('nodes'));
} else {
if ($nodeId && ($nodeType = $this->_getNodeModel()->getNodeTypeByNodeId($nodeId))) {
return $this->responseReroute($nodeType['controller_admin_class'], 'deleteConfirm');
} else {
return $this->responseError(new XenForo_Phrase('requested_node_not_found'), 404);
}
}
}
示例3: actionSave
public function actionSave()
{
$this->_assertPostOnly();
if ($this->_input->filterSingle('delete', XenForo_Input::STRING)) {
return $this->responseReroute(__CLASS__, 'deleteConfirm');
}
$data = $this->_input->filter(array('title' => XenForo_Input::STRING, 'description' => XenForo_Input::STRING, 'node_name' => XenForo_Input::STRING, 'node_type_id' => XenForo_Input::BINARY, 'parent_node_id' => XenForo_Input::UINT, 'display_order' => XenForo_Input::UINT, 'display_in_list' => XenForo_Input::UINT, 'style_id' => XenForo_Input::UINT, 'options' => XenForo_Input::ARRAY_SIMPLE));
if (!$this->_input->filterSingle('style_override', XenForo_Input::UINT)) {
$data['style_id'] = 0;
}
$nodeId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
// save page
$dw = $this->_getNodeDataWriter();
if ($nodeId) {
$dw->setExistingData($nodeId);
}
$dw->bulkSet($data);
$dw->save();
if ($this->_input->filterSingle('is_index', XenForo_Input::UINT)) {
WidgetFramework_Option::setIndexNodeId($dw->get('node_id'));
} elseif (WidgetFramework_Option::get('indexNodeId') == $dw->get('node_id')) {
WidgetFramework_Option::setIndexNodeId(0);
}
$response = $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('nodes') . $this->getLastHash($dw->get('node_id')));
if (XenForo_Application::isRegistered('nodesAsTabsAPI')) {
call_user_func(array('NodesAsTabs_API', 'actionSave'), $response, $this);
}
return $response;
}
示例4: actionCleanPrefixListingCache
/**
* Clean the addon cache.
*/
public function actionCleanPrefixListingCache()
{
$this->_assertPostOnly();
$this->assertAdminPermission('rebuildCache');
$this->_getPrefixListingModel()->cleanPrefixCache();
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('tools/rebuild', false, array('success' => 1)));
}
示例5: actionDelete
public function actionDelete()
{
$filterParams = $this->_getFilterParams();
$attachmentIds = $this->_input->filterSingle('attachment_ids', array(XenForo_Input::UINT, 'array' => true));
if ($attachmentId = $this->_input->filterSingle('attachment_id', XenForo_Input::UINT)) {
$attachmentIds[] = $attachmentId;
}
if ($this->isConfirmedPost()) {
// delete specified attachments
foreach ($attachmentIds as $attachmentId) {
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Attachment');
$dw->setExistingData($attachmentId);
$dw->delete();
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('attachments', null, $filterParams));
} else {
// show confirmation dialogue
$viewParams = array('attachmentIds' => $attachmentIds, 'filterParams' => $filterParams);
if (count($attachmentIds) == 1) {
list($attachmentId) = $attachmentIds;
$viewParams['attachment'] = $this->_getAttachmentModel()->getAttachmentById($attachmentId);
}
return $this->responseView('XenForo_ViewAdmin_Attachment_Delete', 'attachment_delete', $viewParams);
}
}
示例6: fire
public static function fire($event, array $args = array(), $hint = null)
{
if ($event === 'front_controller_pre_route') {
$addOns = XenForo_Application::get('addOns');
if (!isset($addOns['devHelper'])) {
// looks like our add-on hasn't been installed (or disabled)
/** @var XenForo_Model_AddOn $addOnModel */
$addOnModel = XenForo_Model::create('XenForo_Model_AddOn');
$addOn = $addOnModel->getAddOnById('devHelper');
if (!empty($addOn)) {
/** @var XenForo_DataWriter_AddOn $addOnDw */
$addOnDw = XenForo_DataWriter::create('XenForo_DataWriter_AddOn');
$addOnDw->setExistingData($addOn);
$addOnDw->set('active', 1);
$addOnDw->save();
$message = 'Re-enabled DevHelper add-on.';
} else {
$xmlPath = 'library/DevHelper/addon-devHelper.xml';
if (!file_exists($xmlPath)) {
die(sprintf('XML path (%s) does not exist', $xmlPath));
}
$addOnModel->installAddOnXmlFromFile($xmlPath);
$message = 'Installed DevHelper add-on.';
}
/** @var XenForo_FrontController $fc */
$fc = $args[0];
$redirect = $fc->getRequest()->getRequestUri();
die(sprintf('<' . 'script>alert(%s);window.location = %s;</script>', json_encode($message), json_encode(XenForo_Link::buildAdminLink('full:tools/run-deferred', null, array('redirect' => $redirect)))));
}
}
return parent::fire($event, $args, $hint);
}
示例7: actionManual
/**
*
* @see XenForo_ControllerAdmin_UserGroupPromotion::actionManual()
*/
public function actionManual()
{
$this->_assertPostOnly();
$input = $this->_input->filter(array('username' => XenForo_Input::STRING, 'promotion_id' => XenForo_Input::UINT, 'action' => XenForo_Input::STRING, 'end_date' => XenForo_Input::STRING));
if (!$input['end_date']) {
return parent::actionManual();
}
if ($input['action'] == 'demote') {
return $this->responseError(new XenForo_Phrase('th_end_dates_can_only_be_used_to_promote_users_promotionenddate'));
}
$endDate = strtotime(date($input['end_date']) . ' 00:00:00');
$timestampDifference = XenForo_Application::$time - $endDate;
if ($timestampDifference >= 0 && $timestampDifference <= 60 * 60 * 24) {
return $this->responseError(new XenForo_Phrase('th_promotion_length_must_be_at_least_one_day_promotionenddate'));
}
if ($endDate < XenForo_Application::$time) {
return $this->responseError(new XenForo_Phrase('th_end_date_cannot_be_in_the_past_promotionenddate'));
}
$user = $this->_getUserModel()->getUserByName($input['username']);
if (!$user) {
return $this->responseError(new XenForo_Phrase('requested_user_not_found'));
}
$promotion = $this->_getPromotionOrError($input['promotion_id']);
if ($input['action'] == 'promote') {
$this->_getPromotionModel()->promoteUserWithEndDate($promotion, $user['user_id'], 'manual', $endDate);
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('user-group-promotions/manage'));
}
示例8: actionTogglePrivate
public function actionTogglePrivate()
{
$this->_assertPostOnly();
$idExists = $this->_input->filterSingle('exists', array(XenForo_Input::UINT, 'array' => true));
$ids = $this->_input->filterSingle('id', array(XenForo_Input::UINT, 'array' => true));
$nodeModel = $this->_getNodeModel();
$nodes = $nodeModel->getAllNodes();
$permissionEntries = $this->_getPermissionModel()->getAllContentPermissionEntriesByTypeGrouped('node');
$privateNodes = array();
foreach ($permissionEntries['system'] as $nodeId => $nodePermissions) {
if (!empty($nodePermissions['general']['viewNode']) && $nodePermissions['general']['viewNode'] == 'reset') {
$privateNodes[$nodeId] = true;
}
}
foreach ($nodes as $nodeId => $node) {
if (isset($idExists[$nodeId])) {
$itemActive = !empty($ids[$nodeId]) ? 1 : 0;
if (!empty($privateNodes[$nodeId]) != $itemActive) {
// TODO: better approach that doesn't rely on every
// permission having "revoke" value
$this->_setPermissionRevokeStatus($node['node_id'], 0, 0, $itemActive);
}
}
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('nodes/private', $node));
}
示例9: actionSave
/**
* Updates system-wide permissions.
*
* @return XenForo_ControllerResponse_Abstract
*/
public function actionSave()
{
$this->_assertPostOnly();
$permissions = $this->_input->filterSingle('permissions', XenForo_Input::ARRAY_SIMPLE);
$this->_getPermissionModel()->updateGlobalPermissionsForUserCollection($permissions, 0, 0);
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('system-permissions'));
}
示例10: actionImport
/**
*
* @return XenForo_ControllerResponse_Abstract
*/
public function actionImport()
{
$fieldModel = $this->_getFieldModel();
if ($this->isConfirmedPost()) {
$input = $this->_input->filter(array('target' => XenForo_Input::STRING, 'display_group' => XenForo_Input::STRING, 'overwrite_field_id' => XenForo_Input::STRING));
$upload = XenForo_Upload::getUploadedFile('upload');
if (!$upload) {
return $this->responseError(new XenForo_Phrase('please_upload_valid_field_xml_file'));
}
if ($input['target'] == 'overwrite') {
$field = $this->_getFieldOrError($input['overwrite_field_id']);
$input['display_group'] = $field['display_group'];
}
$document = $this->getHelper('Xml')->getXmlFromFile($upload);
$caches = $fieldModel->importFieldXml($document, $input['display_group'], $input['overwrite_field_id']);
if (XenForo_Application::$versionId < 1020000) {
return XenForo_CacheRebuilder_Abstract::getRebuilderResponse($this, $caches, XenForo_Link::buildAdminLink('user-fields'));
} else {
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('user-fields'));
}
} else {
$fieldModel = $this->_getFieldModel();
$viewParams = array('displayGroups' => $fieldModel->getUserFieldGroups(), 'fields' => $fieldModel->prepareUserFields($fieldModel->getUserFields()));
return $this->responseView('Waindigo_CustomFields_ViewAdmin_UserField_Import', 'user_field_import', $viewParams);
}
}
示例11: actionSave
public function actionSave()
{
$this->_assertPostOnly();
if ($this->_input->filterSingle('delete', XenForo_Input::STRING)) {
return $this->responseReroute('autocraft_ControllerAdmin_Game', 'deleteConfirm');
}
$title = $this->_input->filterSingle('title', XenForo_Input::STRING);
$desc = $this->_input->filterSingle('description', XenForo_Input::STRING);
$gameId = $this->_input->filterSingle('game_id', XenForo_Input::UINT);
//Lets get the ID of the user who is given the note
$visitor = XenForo_Visitor::getInstance()->toArray();
//The date of the note given
$current_time = XenForo_Application::$time;
$writer = $this->_getDataWriter();
if ($gameId) {
$writer->setExistingData($gameId);
} else {
$writer->set('created_user_id', $visitor['user_id']);
$writer->set('created_date', $current_time);
}
$writer->set('title', $title);
$writer->set('description', $desc);
$writer->save();
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('games') . 'game.' . $writer->get('game_id'));
}
示例12: actionUpload
/**
* Displays a form to allow choice of content type and upload box.
*
* @return XenForo_ControllerResponse_Abstract
*/
public function actionUpload()
{
$adminImageModel = $this->_getAdminImageModel();
$adminImages = XenForo_Upload::getUploadedFiles('admin_image');
$input = $this->_input->filter(array('type' => XenForo_Input::STRING, 'type_id' => array(XenForo_Input::UINT, 'array' => true)));
if (empty($adminImages) || !$input['type'] || !$input['type_id']) {
$typeHandlers = $this->_getAdminImageModel()->getAdminImageHandlers();
$contentTypes = array_keys($typeHandlers);
if (!$input['type']) {
$input['type'] = reset($contentTypes);
}
$viewParams = array('type' => $input['type'], 'typeId' => $input['type_id'], 'typeHandlers' => $typeHandlers);
return $this->responseView('ThemeHouse_AdminImages_ViewAdmin_AdminImage_Upload', 'th_admin_image_upload_adminimages', $viewParams);
}
$this->_assertPostOnly();
$handler = $adminImageModel->getAdminImageHandlers($input['type']);
$contentId = isset($input['type_id'][$input['type']]) ? $input['type_id'][$input['type']] : 0;
if (!$handler->getContentTitle($contentId)) {
return $this->responseError(new XenForo_Phrase('th_please_select_a_valid_attach_to_item_adminimages'), 404);
}
$adminImage = reset($adminImages);
$attachmentModel = $this->_getAttachmentModel();
if ($adminImage->isImage()) {
$dataId = $attachmentModel->insertUploadedAttachmentData($adminImage, XenForo_Visitor::getUserId());
$attachmentId = $attachmentModel->insertTemporaryAttachment($dataId, 'adminimage-' . $input['type'] . '-' . $input['type_id'][$input['type']]);
$this->_getAdminImageModel()->associateAttachment($input['type'], $input['type_id'][$input['type']]);
} else {
throw $this->responseException($this->responseError(new XenForo_Phrase('th_uploaded_file_is_not_an_image_adminimages')));
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('images'));
}
示例13: actionTypesSave
public function actionTypesSave()
{
$this->_assertPostOnly();
$id = $this->_input->filterSingle('type_id', XenForo_Input::UINT);
$dwInput = $this->_input->filter(['type_title' => XenForo_Input::STRING, 'type_url' => XenForo_Input::STRING, 'type_is_default' => XenForo_Input::UINT, 'type_perpage' => XenForo_Input::UINT, 'type_singular' => XenForo_Input::STRING, 'type_plural' => XenForo_Input::STRING, 'type_cat_id' => [XenForo_Input::UINT, 'default' => 0], 'type_cat_id_option' => [XenForo_Input::UINT, 'default' => 0], 'type_subcat_id' => [XenForo_Input::UINT, 'default' => 0], 'type_subcat_id_option' => [XenForo_Input::UINT, 'default' => 0]]);
$perms = ['view' => [], 'post' => [], 'postAs' => [], 'editOwn' => [], 'editAll' => [], 'deleteOwn' => [], 'deleteAll' => []];
foreach (array_keys($perms) as $k) {
$p = $this->_input->filterSingle($k . '_user_group_ids', XenForo_Input::UINT, ['array' => true, 'default' => []]);
$a = $this->_input->filterSingle('user_group_type_' . $k, XenForo_Input::STRING);
if ($a == 'all') {
$perms[$k] = [-1];
} else {
$perms[$k] = $p;
}
}
$dwInput['type_perms'] = $perms;
$dw = XenForo_DataWriter::create('GeekListings_DataWriter_Type');
if ($id) {
$dw->setExistingData($id);
}
$dw->bulkSet($dwInput);
$dw->save();
$id = $dw->get('type_id');
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('geeklistings/types') . $this->getLastHash($id));
}
示例14: actionEdit
public function actionEdit()
{
$id = $this->_input->filterSingle('tag_id', XenForo_Input::UINT);
$tag = $this->_getTagOrError($id);
if ($this->isConfirmedPost()) {
$dwInput = $this->_input->filter(array('tag_text' => XenForo_Input::STRING, 'tag_title' => XenForo_Input::STRING, 'tag_description' => XenForo_Input::STRING, 'is_staff' => XenForo_Input::UINT));
$dw = $this->_getTagDataWriter();
$dw->setExistingData($id);
$dw->bulkSet($dwInput);
// process link target_type
// since 1.8
$link = $this->_input->filterSingle('link', XenForo_Input::STRING);
if (!empty($link)) {
$existingLink = $this->_getTagModel()->getTagLink($tag);
if ($link != $existingLink) {
$dw->bulkSet(array('target_type' => 'link', 'target_id' => 0, 'target_data' => array('link' => $link)));
}
} else {
$dw->bulkSet(array('target_type' => '', 'target_id' => 0, 'target_data' => array()));
}
$dw->save();
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('xentag-tags') . '#' . XenForo_Template_Helper_Core::callHelper('listitemid', array($tag['tag_id'])));
} else {
$viewParams = array('tag' => $tag, 'tagLink' => $this->_getTagModel()->getTagLink($tag));
return $this->responseView('Tinhte_XenTag_ViewAdmin_Tag_Edit', 'tinhte_xentag_tag_edit', $viewParams);
}
}
示例15: actionIndex
/**
*
* @see XenForo_ControllerAdmin_Option::actionIndex()
*/
public function actionIndex()
{
$response = parent::actionIndex();
if ($response instanceof XenForo_ControllerResponse_View) {
$addOns = $this->_getAddOnModel()->getAllAddOns();
$addOnId = $this->_input->filterSingle('addon_id', XenForo_Input::STRING);
if (!empty($GLOBALS['XenForo_Route_PrefixAdmin_Options']) && !$addOnId) {
$addOnId = XenForo_Helper_Cookie::getCookie('edit_addon_id');
}
if ($addOnId) {
XenForo_Helper_Cookie::setCookie('edit_addon_id', $addOnId);
} else {
XenForo_Helper_Cookie::deleteCookie('edit_addon_id');
}
$groupCount = count($response->params['groups']);
if ($addOnId && !empty($addOns[$addOnId])) {
XenForo_Helper_Cookie::setCookie('edit_addon_id', $addOnId);
$addOn = $addOns[$addOnId];
$response->params['addOnSelected'] = $addOnId;
if ($addOnId) {
foreach ($response->params['groups'] as $groupKey => $group) {
if ($addOnId != $group['addon_id']) {
unset($response->params['groups'][$groupKey]);
}
}
}
$this->canonicalizeRequestUrl(XenForo_Link::buildAdminLink('add-ons/options', $addOn));
} else {
$this->canonicalizeRequestUrl(XenForo_Link::buildAdminLink('add-ons/options', array('addon_id' => '')));
}
$response->params['addOns'] = $addOns;
$response->params['groupCount'] = $groupCount;
}
return $response;
}