本文整理汇总了PHP中admin_tools::AdminScripts方法的典型用法代码示例。如果您正苦于以下问题:PHP admin_tools::AdminScripts方法的具体用法?PHP admin_tools::AdminScripts怎么用?PHP admin_tools::AdminScripts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admin_tools
的用法示例。
在下文中一共展示了admin_tools::AdminScripts方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
global $page, $langmessage;
$page->head_js[] = '/include/js/admin_users.js';
//set possible_permissions
$scripts = admin_tools::AdminScripts();
foreach ($scripts as $script => $info) {
$this->possible_permissions[$script] = $info['label'];
}
$this->GetUsers();
$cmd = common::GetCommand();
switch ($cmd) {
case 'save_file_permissions':
if ($this->SaveFilePermissions()) {
return;
}
case 'file_permissions':
$this->FilePermissions();
return;
case 'newuser':
if ($this->CreateNewUser()) {
break;
}
case 'newuserform':
$this->NewUserForm();
return;
case 'rm':
$this->RmUserConfirmed();
break;
case 'resetpass':
if ($this->ResetPass()) {
break;
}
case 'changepass':
$this->ChangePass();
return;
case 'SaveChanges':
if ($this->SaveChanges()) {
break;
}
case 'details':
$this->ChangeDetails();
return;
}
$this->ShowForm();
}
示例2: GetAdminGroup
static function GetAdminGroup($grouping)
{
global $langmessage, $page;
$scripts = admin_tools::AdminScripts();
ob_start();
foreach ($scripts as $script => $info) {
if (isset($info['list']) && $info['list'] === false) {
continue;
}
if (!isset($info['group']) || strpos($info['group'], $grouping) === false) {
continue;
}
if (!admin_tools::HasPermission($script)) {
continue;
}
echo '<li>';
if (isset($info['popup']) && $info['popup'] == true) {
echo common::Link($script, $info['label'], '', array('data-cmd' => 'gpabox'));
} else {
echo common::Link($script, $info['label']);
}
echo '</li>';
switch ($script) {
case 'Admin_Menu':
echo '<li>';
echo common::Link('Admin_Menu', '+ ' . $langmessage['create_new_file'], 'cmd=add_hidden&redir=redir', array('title' => $langmessage['create_new_file'], 'data-cmd' => 'gpabox'));
echo '</li>';
break;
}
}
$result = ob_get_clean();
if (!empty($result)) {
return $result;
}
return false;
}
示例3: RunAdminScript
/**
* Find the requested admin script and execute it if the user has permissions to view it
*
*/
function RunAdminScript()
{
global $dataDir, $langmessage;
//resolve request for /Admin_Theme_Content if the request is for /Admin_Theme_Conent/1234
$parts = explode('/', $this->requested);
do {
$request_string = implode('/', $parts);
$scriptinfo = false;
$scripts = admin_tools::AdminScripts();
if (isset($scripts[$request_string])) {
$scriptinfo = $scripts[$request_string];
if (admin_tools::HasPermission($request_string)) {
if (isset($scriptinfo['addon'])) {
gpPlugin::SetDataFolder($scriptinfo['addon']);
}
admin_display::OrganizeFrequentScripts($request_string);
if (isset($scriptinfo['script'])) {
require $dataDir . $scriptinfo['script'];
}
if (isset($scriptinfo['class'])) {
new $scriptinfo['class']();
}
gpPlugin::ClearDataFolder();
return;
} else {
message($langmessage['not_permitted']);
$parts = array();
}
} elseif (count($scripts) > 0) {
//check case
$case_check = array_keys($scripts);
$case_check = array_combine($case_check, $case_check);
$case_check = array_change_key_case($case_check, CASE_LOWER);
$lower = strtolower($request_string);
if (isset($case_check[$lower])) {
$location = common::GetUrl($case_check[$lower], '', false);
common::Redirect($location);
}
}
//these are here because they should be available to everyone
switch ($request_string) {
case 'Admin_Browser':
includeFile('admin/admin_browser.php');
new admin_browser();
return;
case 'Admin_Preferences':
includeFile('admin/admin_preferences.php');
new admin_preferences();
return;
case 'Admin_About':
includeFile('admin/admin_about.php');
new admin_about();
return;
case 'Admin_Finder':
includeFile('thirdparty/elfinder/connector.php');
return;
}
} while (array_pop($parts));
$this->AdminPanel();
}
示例4: ShowRedirection
function ShowRedirection()
{
global $langmessage, $page, $gp_index, $config;
$page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
$page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
echo '<p>' . $langmessage['About_Redirection'] . '</p>';
echo common::Link('Admin_Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
if (empty($this->error_data['redirects'])) {
return;
}
echo '<table class="bordered tablesorter full_width">';
echo '<thead>';
echo '<tr><th>';
echo $langmessage['Source URL'];
echo '</th><th>';
echo $langmessage['Target URL'];
echo '</th><th>';
echo $langmessage['Similarity'];
echo '</th><th>';
echo $langmessage['Method'];
echo '</th><th>';
echo $langmessage['options'];
echo '</th></tr>';
echo '</thead>';
echo '<tbody>';
$has_invalid_target = false;
$admin_urls = admin_tools::AdminScripts();
foreach ($this->error_data['redirects'] as $source => $data) {
echo '<tr><td>';
$raw_source = $source;
if (!empty($data['raw_source'])) {
$raw_source = $data['raw_source'];
}
echo htmlspecialchars($raw_source);
echo '</td><td>';
$target_show = $data['target'];
if (strlen($target_show) > 40) {
$target_show = substr($target_show, 0, 15) . ' ... ' . substr($target_show, -15);
}
$full_target = $this->GetTarget($data['target'], false);
echo '<a href="' . htmlspecialchars($full_target) . '">' . str_replace(' ', ' ', htmlspecialchars($target_show)) . '</a>';
$is_gplink = $this->isGPLink($data['target']);
if (!empty($data['target']) && $is_gplink) {
if (!isset($gp_index[$data['target']]) && !isset($admin_urls[$data['target']])) {
$has_invalid_target = true;
echo ' <img src="' . common::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
}
}
echo '</td><td>';
if ($is_gplink) {
$lower_source = strtolower($raw_source);
$lower_target = strtolower($target_show);
similar_text($lower_source, $lower_target, $percent);
if ($config['auto_redir'] > 0 && $percent >= $config['auto_redir']) {
//echo '<span style="color:orange">'.number_format($percent,1).'%</span>';
echo number_format($percent, 1) . '%';
} else {
echo number_format($percent, 1) . '%';
}
} else {
echo ' ';
}
echo '</td><td>';
echo $this->GetCodeLanguage($data['code']);
echo '</td><td>';
echo common::Link('Admin_Missing', $langmessage['edit'], 'cmd=editredir&source=' . urlencode($source), array('data-cmd' => 'gpabox'));
echo ' ';
echo common::Link($source, $langmessage['Test']);
echo ' ';
$title = sprintf($langmessage['generic_delete_confirm'], $source);
echo common::Link('Admin_Missing', $langmessage['delete'], 'cmd=rmredir&link=' . urlencode($source), array('data-cmd' => 'postlink', 'title' => $title, 'class' => 'gpconfirm'));
echo '</td></tr>';
}
echo '</tbody>';
echo '</table>';
echo '<p>';
echo common::Link('Admin_Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
echo '</p>';
if ($has_invalid_target) {
echo '<p>';
echo ' <img src="' . common::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
echo $langmessage['Target URL Invalid'];
echo '</p>';
}
}
示例5: RunAdminScript
/**
* Find the requested admin script and execute it if the user has permissions to view it
*
*/
function RunAdminScript()
{
global $dataDir, $langmessage;
//resolve request for /Admin_Theme_Content if the request is for /Admin_Theme_Conent/1234
$parts = explode('/', $this->requested);
do {
$request_string = implode('/', $parts);
$scriptinfo = false;
$scripts = admin_tools::AdminScripts();
if (isset($scripts[$request_string])) {
$scriptinfo = $scripts[$request_string];
if (admin_tools::HasPermission($request_string)) {
admin_display::OrganizeFrequentScripts($request_string);
gpOutput::ExecInfo($scriptinfo);
return;
} else {
message($langmessage['not_permitted']);
$parts = array();
}
} elseif (count($scripts) > 0) {
//check case
$case_check = array_keys($scripts);
$case_check = array_combine($case_check, $case_check);
$case_check = array_change_key_case($case_check, CASE_LOWER);
$lower = strtolower($request_string);
if (isset($case_check[$lower])) {
$location = common::GetUrl($case_check[$lower], http_build_query($_GET), false);
common::Redirect($location);
}
}
//these are here because they should be available to everyone
switch ($request_string) {
case 'Admin_Browser':
includeFile('admin/admin_browser.php');
new admin_browser();
return;
case 'Admin_Preferences':
$this->label = $langmessage['Preferences'];
includeFile('admin/admin_preferences.php');
new admin_preferences();
return;
case 'Admin_About':
$this->label = 'About gpEasy';
includeFile('admin/admin_about.php');
new admin_about();
return;
case 'Admin_Finder':
if (admin_tools::HasPermission('Admin_Uploaded')) {
includeFile('thirdparty/finder/connector.php');
return;
}
break;
}
array_pop($parts);
} while (count($parts));
$this->AdminPanel();
}
示例6: GetAdminGroup
function GetAdminGroup($grouping)
{
global $langmessage, $page;
$scripts = admin_tools::AdminScripts();
ob_start();
foreach ($scripts as $script => $info) {
if (isset($info['list']) && $info['list'] === false) {
continue;
}
if (!isset($info['group']) || strpos($info['group'], $grouping) === false) {
continue;
}
if (!admin_tools::HasPermission($script)) {
continue;
}
echo '<li>';
if (isset($info['popup']) && $info['popup'] == true) {
echo common::Link($script, $info['label'], '', 'name="gpabox"');
} else {
echo common::Link($script, $info['label']);
}
echo '</li>';
switch ($script) {
case 'Admin_Menu':
echo '<li>';
echo common::Link('Admin_Menu', '+ ' . $langmessage['create_new_file'], 'cmd=add_hidden&redir=redir', ' title="' . $langmessage['create_new_file'] . '" name="gpajax"');
echo '</li>';
break;
}
}
//add more links
switch ($grouping) {
case 'appearance':
if (!empty($page->gpLayout) && admin_tools::HasPermission('Admin_Theme_Content')) {
echo '<li>';
echo common::Link('Admin_Theme_Content/' . urlencode($page->gpLayout), $langmessage['edit_this_layout']);
echo '</li>';
}
echo '<li>';
echo common::Link('Admin_Theme_Content', $langmessage['Download Themes'], 'cmd=remote');
echo '</li>';
break;
}
$result = ob_get_clean();
if (!empty($result)) {
return $result;
}
return false;
}
示例7: AutoCompleteValues
/**
* Return javascript code to be used with autocomplete (jquery ui)
*
*/
static function AutoCompleteValues($GetUrl = true, $options = array())
{
global $gp_index;
$options += array('admin_vals' => true, 'var_name' => 'gptitles');
//internal link array
$array = array();
foreach ($gp_index as $slug => $id) {
$label = common::GetLabel($slug);
$label = str_replace(array('<', '>', '"', ''', '&'), array('<', '>', '"', "'", '&'), $label);
if ($GetUrl) {
$slug = common::GetUrl($slug, '', false);
$slug = rawurldecode($slug);
}
$array[] = array($label, $slug);
}
if ($options['admin_vals'] && class_exists('admin_tools')) {
$scripts = admin_tools::AdminScripts();
foreach ($scripts as $url => $info) {
if ($GetUrl) {
$url = common::GetUrl($url, '', false);
$url = rawurldecode($url);
}
$array[] = array($info['label'], $url);
}
}
$code = json_encode($array);
if ($options['var_name']) {
$code = 'var ' . $options['var_name'] . ' = ' . $code . ';';
}
return $code;
}
示例8: GetTarget
/**
* Translate the $target url to a url that can be used with Header() or in a link
*
* @param string $target The user supplied value for redirection
* @param boolean $get_final If true, GetTarget() will check for additional redirection and $target existence before returning the url. Maximum of 10 redirects.
* @return string|false
*/
function GetTarget($target, $get_final = true)
{
global $gp_index;
static $redirects = 0;
if (empty($target)) {
return common::GetUrl('');
}
if (!$this->isGPLink($target)) {
return $target;
}
if (!$get_final) {
return common::GetUrl($target);
}
//check for more redirects
if (isset($this->error_data['redirects'][$target])) {
$redirects++;
if ($redirects > 10) {
return false;
}
$target = $this->error_data['redirects'][$target]['target'];
return $this->GetTarget($target);
}
//check for target existence
if (isset($gp_index[$target])) {
return common::GetUrl($target);
}
includeFile('admin/admin_tools.php');
$scripts = admin_tools::AdminScripts();
if (isset($scripts[$target])) {
return common::GetUrl($target);
}
return false;
}