本文整理汇总了PHP中admin_tools类的典型用法代码示例。如果您正苦于以下问题:PHP admin_tools类的具体用法?PHP admin_tools怎么用?PHP admin_tools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了admin_tools类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: SaveConfig
function SaveConfig()
{
global $config, $langmessage;
$possible = $this->variables;
foreach ($possible as $key => $curr_possible) {
if ($curr_possible == 'boolean') {
if (isset($_POST[$key]) && $_POST[$key] == 'true') {
$config[$key] = true;
} else {
$config[$key] = false;
}
} elseif ($curr_possible == 'integer') {
if (isset($_POST[$key]) && is_numeric($_POST[$key])) {
$config[$key] = $_POST[$key];
}
} elseif (isset($_POST[$key])) {
$config[$key] = $_POST[$key];
}
}
$config['history_limit'] = min($config['history_limit'], gp_backup_limit);
if (!admin_tools::SaveConfig()) {
message($langmessage['OOPS']);
return false;
}
if (isset($_GET['gpreq']) && $_GET['gpreq'] == 'json') {
message($langmessage['SAVED'] . ' ' . $langmessage['REFRESH']);
} else {
message($langmessage['SAVED']);
}
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:30,代码来源:admin_configuration.php
示例2: GenerateOutput
function GenerateOutput()
{
global $langmessage, $page;
common::ShowingGallery();
echo '<h2>';
echo gpOutput::ReturnText('galleries');
echo '</h2>';
includeFile('admin/admin_tools.php');
$wrap = admin_tools::CanEdit($page->gp_index);
if ($wrap) {
echo gpOutput::EditAreaLink($edit_index, 'Admin_Galleries', $langmessage['edit']);
echo '<div class="editable_area cf" id="ExtraEditArea' . $edit_index . '">';
// class="edit_area" added by javascript
}
$image_text = gpOutput::ReturnText('image');
$images_text = gpOutput::ReturnText('images');
$list = '';
$shown = 0;
foreach ($this->galleries as $title => $info) {
//page is hidden
if (!$this->GalleryVisible($title, $info)) {
continue;
}
$count = '';
if (is_array($info)) {
$icon = $info['icon'];
if ($info['count'] == 1) {
$count = $info['count'] . ' ' . gpOutput::ReturnText('image');
} elseif ($info['count'] > 1) {
$count = $info['count'] . ' ' . gpOutput::ReturnText('images');
}
} else {
$icon = $info;
}
if (empty($icon)) {
continue;
}
$icon = rawurldecode($icon);
//prevent double encoding
if (strpos($icon, '/thumbnails/') === false) {
$thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
} else {
$thumbPath = common::GetDir('/data/_uploaded' . $icon);
}
$label = common::GetLabel($title);
$title_attr = ' title="' . common::GetBrowserTitle($title) . '"';
$label_img = ' <img src="' . $thumbPath . '" alt=""/>';
$list .= '<li>' . common::Link($title, $label_img, '', $title_attr) . '<div>' . common::Link($title, $label, '', $title_attr) . '<p>' . $count . '</p>' . '</div>' . '</li>';
}
if (!empty($list)) {
echo '<ul class="gp_gallery gp_galleries">';
echo $list;
echo '</ul>';
}
if ($wrap) {
echo '</div>';
}
$this->PostSave();
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:59,代码来源:special_galleries.php
示例3: ShowFiles
/**
* Show files in the cache
*
*/
function ShowFiles()
{
global $page, $langmessage;
$page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
$page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
if (!$this->all_files) {
return;
}
echo '<p>';
echo common::Link('Admin_Cache', 'Empty Cache', 'cmd=EmptyResourceCache', array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => 'Empty the resource cache?'));
echo '</p>';
echo '<table class="bordered tablesorter full_width">';
echo '<thead>';
echo '<tr><th>';
echo $langmessage['file_name'];
echo '</th><th>';
echo $langmessage['File Size'];
echo '</th><th>';
echo 'Touched';
echo '</th><th>';
echo $langmessage['options'];
echo '</th></tr>';
echo '</thead>';
$total_size = 0;
echo '<tbody>';
foreach ($this->all_files as $file) {
$full = $this->cache_dir . '/' . $file;
echo '<tr><td>';
echo '<a href="?cmd=ViewFile&file=' . rawurlencode($file) . '">';
echo $file;
echo '</a>';
echo '</td><td>';
$size = filesize($full);
echo '<span style="display:none">' . $size . '</span>';
echo admin_tools::FormatBytes($size);
$total_size += $size;
echo '</td><td>';
$elapsed = admin_tools::Elapsed(time() - filemtime($full));
echo sprintf($langmessage['_ago'], $elapsed);
echo '</td><td>';
echo common::Link('Admin_Cache', $langmessage['delete'], 'cmd=DeleteFile&file=' . rawurlencode($file), array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm']));
echo '</tr>';
}
echo '</tbody>';
//totals
echo '<tfoot>';
echo '<tr><td>';
echo number_format(count($this->all_files)) . ' Files';
echo '</td><td>';
echo admin_tools::FormatBytes($total_size);
echo '</td><td>';
echo '</tr>';
echo '</table>';
}
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:58,代码来源:admin_cache.php
示例4: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->requested);
if ($scriptinfo === false) {
switch ($this->requested) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->requested];
$this->label = common::GetLabel($this->requested);
$this->TitleInfo = $scriptinfo;
$menu_permissions = false;
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
$page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', ' name="gpajax" ');
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), ' title="' . $langmessage['current_layout'] . '" name="gpabox"');
}
if (admin_tools::HasPermission('Admin_User')) {
$page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), ' title="' . $langmessage['permissions'] . '" name="gpabox" ');
}
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
}
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:51,代码来源:special.php
示例5: Toggle
/**
* Toggle the visibility of a page
*
*/
static function Toggle($index, $visibility = '')
{
global $gp_titles, $langmessage;
if (!isset($gp_titles[$index])) {
msg($langmessage['OOPS'] . ' (Invalid Request)');
return false;
}
if ($visibility == 'private') {
$gp_titles[$index]['vis'] = 'private';
} else {
unset($gp_titles[$index]['vis']);
}
if (!\admin_tools::SavePagesPHP()) {
msg($langmessage['OOPS'] . ' (VT1)');
return false;
}
return true;
}
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:22,代码来源:Visibility.php
示例6: Upgrade_234
/**
* Update the gp_index, gp_titles and menus so that special pages can be renamed
*
*/
function Upgrade_234()
{
global $gp_index, $gp_titles, $gp_menu, $config, $dataDir;
includeFile('tool/gpOutput.php');
$special_indexes = array();
$new_index = array();
$new_titles = array();
foreach ($gp_index as $title => $index) {
$info = $gp_titles[$index];
$type = common::SpecialOrAdmin($title);
if ($type === 'special') {
$special_indexes[$index] = strtolower($title);
$index = strtolower($title);
$info['type'] = 'special';
//some older versions didn't maintain this value well
}
$new_index[$title] = $index;
$new_titles[$index] = $info;
}
$gp_titles = $new_titles;
$gp_index = $new_index;
//update gp_menu
$gp_menu = $this->FixMenu($gp_menu, $special_indexes);
//save pages
if (!admin_tools::SavePagesPHP()) {
return;
}
$config['gpversion'] = '2.3.4';
admin_tools::SaveConfig();
//update alt menus
if (isset($config['menus']) && is_array($config['menus'])) {
foreach ($config['menus'] as $key => $value) {
$menu_file = $dataDir . '/data/_menus/' . $key . '.php';
if (gpFiles::Exists($menu_file)) {
$menu = gpOutput::GetMenuArray($key);
$menu = $this->FixMenu($menu, $special_indexes);
gpFiles::SaveData($menu_file, 'menu', $menu);
}
}
}
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:45,代码来源:upgrade.php
示例7: ProtectCommand
function ProtectCommand($cmd)
{
global $protect_object, $gp_titles, $langmessage;
if (!admin_tools::HasPermission('Admin_Protect')) {
return;
}
switch ($cmd) {
case 'passprotect':
case 'rm_protection':
case 'protect_page':
break;
default:
return $cmd;
}
if (!isset($_POST['index']) || !isset($gp_titles[$_POST['index']])) {
message($langmessage['OOPS']);
return $cmd;
}
$index = $_POST['index'];
$protect_object->IsProtected($index);
return $protect_object->Admin($cmd, $index);
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:22,代码来源:MenuPageOptions.php
示例8: Admin
function Admin($cmd, $index)
{
global $gp_titles, $langmessage, $page;
if (!admin_tools::HasPermission('Admin_Protect')) {
return;
}
switch ($cmd) {
case 'passprotect':
$this->OptionsForm($index);
return 'return';
case 'rm_protection':
$page->ajaxReplace = array();
unset($this->config['pages'][$index]);
if ($this->SaveConfig()) {
$this->is_protected = false;
message($langmessage['SAVED']);
} else {
message($langmessage['OOPS']);
}
return $cmd;
case 'protect_page':
$page->ajaxReplace = array();
$this->config['pages'][$index] = true;
if ($this->SaveConfig()) {
$this->is_protected = true;
message($langmessage['SAVED']);
} else {
message($langmessage['OOPS']);
}
return $cmd;
}
if ($this->is_protected) {
message('Notice: This page is currently protected and can only be viewed by logged in users.');
}
return $cmd;
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:36,代码来源:PageProtect.php
示例9: GetAddonSubLinks
/**
* Return a formatted list of links associated with $addon
* @return string
*/
static function GetAddonSubLinks($addon = false)
{
global $config;
$special_links = admin_tools::GetAddonTitles($addon);
$admin_links = admin_tools::GetAddonComponents($config['admin_links'], $addon);
$result = '';
foreach ($special_links as $linkName => $linkInfo) {
$result .= '<li>';
$result .= common::Link($linkName, $linkInfo['label']);
$result .= '</li>';
}
foreach ($admin_links as $linkName => $linkInfo) {
if (admin_tools::HasPermission($linkName)) {
$result .= '<li>';
$result .= common::Link($linkName, $linkInfo['label']);
$result .= '</li>';
}
}
return $result;
}
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:24,代码来源:admin_tools.php
示例10: ShowAddon
function ShowAddon($addon = false)
{
global $config, $langmessage;
if ($addon === false) {
$addon =& $_REQUEST['addon'];
}
if (!isset($config['addons'][$addon])) {
message($langmessage['OOPS'] . '(s1)');
$this->Select();
return;
}
$cmd = common::GetCommand();
switch ($cmd) {
case 'enable':
case 'disable':
$this->GadgetVisibility($addon, $cmd);
break;
/*
case 'changeinstall':
$this->ChangeInstallType($addon);
break;
case 'changeinstall_confirmed':
$this->ChangeInstallConfirmed($addon);
break;
*/
}
$this->FindForm();
echo '<h2 class="hmargin">';
echo common::Link('Admin_Addons', $langmessage['Manage Plugins']);
echo ' » ';
echo $config['addons'][$addon]['name'];
echo '</h2>';
echo '<table class="bordered" style="width:90%">';
//show Special Links
$sublinks = admin_tools::GetAddonTitles($addon);
if (!empty($sublinks)) {
echo '<tr><th>';
echo 'Special Links';
echo '</th>';
echo '<th>';
echo $langmessage['options'];
echo '</th></tr>';
foreach ($sublinks as $linkName => $linkInfo) {
echo '<tr><td>';
echo common::Link($linkName, $linkInfo['label']);
echo '</td>';
echo '<td>';
echo '-';
echo '</td></tr>';
}
}
//show Admin Links
$sublinks = admin_tools::GetAddonComponents($config['admin_links'], $addon);
if (!empty($sublinks)) {
echo '<tr><th>';
echo 'Admin Links';
echo '</th>';
echo '<th>';
echo $langmessage['options'];
echo '</th></tr>';
foreach ($sublinks as $linkName => $linkInfo) {
echo '<tr><td>';
echo common::Link($linkName, $linkInfo['label']);
echo '</td>';
echo '<td>';
echo '-';
echo '</td></tr>';
}
}
//show Gadgets
$gadgets = admin_tools::GetAddonComponents($config['gadgets'], $addon);
if (is_array($gadgets) && count($gadgets) > 0) {
echo '<tr><th>';
echo $langmessage['gadgets'];
echo '</th>';
echo '<th>';
echo $langmessage['options'];
echo '</th></tr>';
foreach ($gadgets as $name => $value) {
echo '<tr><td>';
echo str_replace('_', ' ', $name);
echo '</td><td>';
if (isset($value['disabled'])) {
echo common::Link('Admin_Addons', $langmessage['enable'], 'cmd=enable&addon=' . $addon . '&gadget=' . rawurlencode($name), ' name="creq" ');
echo ' - ';
echo '<b>' . $langmessage['disabled'] . '</b>';
} else {
echo ' <b>' . $langmessage['enabled'] . '</b>';
echo ' - ';
echo common::Link('Admin_Addons', $langmessage['disable'], 'cmd=disable&addon=' . $addon . '&gadget=' . rawurlencode($name), ' name="creq" ');
}
echo '</td></tr>';
}
}
//editable text
if (isset($config['addons'][$addon]['editable_text']) && admin_tools::HasPermission('Admin_Theme_Content')) {
echo '<tr><th>';
echo $langmessage['editable_text'];
echo '</th>';
//.........这里部分代码省略.........
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_addons.php
示例11: SetLayout
/**
* Assign a layout to the $title. Child pages without a layout assigned will inherit this setting
* @param string $title
*/
function SetLayout()
{
global $gp_index, $gp_titles, $langmessage, $gpLayouts;
$index = $_POST['index'];
$title = common::IndexToTitle($index);
if (!$title) {
message($langmessage['OOPS']);
return;
}
$this->title = $title;
$layout = $_POST['layout'];
if (!isset($gpLayouts[$layout])) {
message($langmessage['OOPS']);
return;
}
if (!common::verify_nonce('use_' . $layout)) {
message($langmessage['OOPS']);
return;
}
//unset, then reset if needed
unset($gp_titles[$index]['gpLayout']);
$currentLayout = display::OrConfig($index, 'gpLayout');
if ($currentLayout != $layout) {
$gp_titles[$index]['gpLayout'] = $layout;
}
if (!admin_tools::SavePagesPHP()) {
message($langmessage['OOPS'] . '(3)');
return false;
}
message($langmessage['SAVED']);
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:35,代码来源:Page_Layout.php
示例12: RemoteBrowse
/**
* Get addon data from gpEasy.com and display to user
*
*/
function RemoteBrowse()
{
global $langmessage, $config, $dataDir;
//search options
if (isset($_GET['search_option'])) {
$save = true;
switch ($_GET['search_option']) {
case 'version':
unset($config['search_version']);
break;
case 'noversion':
$config['search_version'] = false;
break;
default:
$save = false;
break;
}
if ($save) {
admin_tools::SaveConfig();
}
}
//make a list of installed addon id's
$this->installed_ids = array();
if (isset($config['addons']) && is_array($config['addons'])) {
foreach ($config['addons'] as $addon_info) {
if (isset($addon_info['id'])) {
$this->installed_ids[] = $addon_info['id'];
}
}
}
includeFile('tool/RemoteGet.php');
//search settings
$this->searchUrl = $this->path_remote;
$this->searchOrderOptions['rating_score'] = $langmessage['Highest Rated'];
$this->searchOrderOptions['downloads'] = $langmessage['Most Downloaded'];
$this->searchOrderOptions['modified'] = $langmessage['Recently Updated'];
$this->searchOrderOptions['created'] = $langmessage['Newest'];
$_GET += array('q' => '');
if (isset($_REQUEST['page']) && ctype_digit($_REQUEST['page'])) {
$this->searchPage = $_REQUEST['page'];
}
//version specific search
$search_version = false;
if (!isset($config['search_version']) || $config['search_version']) {
$this->searchQuery .= '&ug=' . rawurlencode(gpversion);
$search_version = true;
}
if (!empty($_GET['q'])) {
$this->searchQuery .= '&q=' . rawurlencode($_GET['q']);
}
$this->SearchOrder();
$slug = 'Plugins';
if ($this->config_index == 'themes') {
$slug = 'Themes';
}
$src = addon_browse_path . '/' . $slug . '?cmd=remote&format=json&' . $this->searchQuery . '&page=' . $this->searchPage;
// format=json added 4.6b3
//check cache
$cache_file = $dataDir . '/data/_remote/' . sha1($src) . '.txt';
$use_cache = false;
if (file_exists($cache_file) && filemtime($cache_file) + 26100 > time()) {
$result = file_get_contents($cache_file);
$use_cache = true;
} else {
$result = gpRemoteGet::Get_Successful($src);
}
//no response
if (!$result) {
if ($use_cache) {
unlink($cache_file);
}
echo '<p>' . gpRemoteGet::Debug('Sorry, data not fetched') . '</p>';
return;
}
//serialized or json (serialized data may be cached)
if (strpos($result, 'a:') === 0) {
$data = unserialize($result);
} elseif (strpos($result, '{') === 0) {
$data = json_decode($result, true);
} else {
if ($use_cache) {
unlink($cache_file);
}
$debug = array();
$debug['Two'] = substr($result, 0, 2);
$debug['Twotr'] = substr(trim($result), 0, 2);
echo '<p>' . gpRemoteGet::Debug('Sorry, data not fetched', $debug) . '</p>';
return;
}
//not unserialized?
if (!is_array($data) || count($data) == 0) {
if ($use_cache) {
unlink($cache_file);
}
echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (F3)</p>';
return;
//.........这里部分代码省略.........
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_addon_install.php
示例13: NewFileNumber
public static function NewFileNumber()
{
global $config;
includeFile('admin/admin_tools.php');
if (!isset($config['file_count'])) {
$config['file_count'] = 0;
}
$config['file_count']++;
admin_tools::SaveConfig();
return $config['file_count'];
}
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:11,代码来源:Files.php
示例14: RenameFileWorker
static function RenameFileWorker($title)
{
global $langmessage, $dataDir, $gp_index;
//use new_label or new_title
if (isset($_POST['new_title'])) {
$new_title = admin_tools::PostedSlug($_POST['new_title']);
} else {
$new_title = admin_tools::LabelToSlug($_POST['new_label']);
}
//title unchanged
if ($new_title == $title) {
return $title;
}
$special_file = false;
if (common::SpecialOrAdmin($title)) {
$special_file = true;
}
if (!admin_tools::CheckTitle($new_title, $message)) {
msg($message);
return false;
}
$old_gp_index = $gp_index;
//re-index: make the new title point to the same data index
$old_file = gpFiles::PageFile($title);
$file_index = $gp_index[$title];
unset($gp_index[$title]);
$gp_index[$new_title] = $file_index;
//rename the php file
if (!$special_file) {
$new_file = gpFiles::PageFile($new_title);
//we don't have to rename files if we're using the index naming convention. See gpFiles::PageFile() for more info
if ($new_file == $old_file) {
//if the file being renamed doesn't use the index naming convention, then we'll still need to rename it
} elseif (!rename($old_file, $new_file)) {
msg($langmessage['OOPS'] . ' (N3)');
$gp_index = $old_gp_index;
return false;
}
//gallery rename
includeFile('special/special_galleries.php');
special_galleries::RenamedGallery($title, $new_title);
}
//create a 301 redirect
if (isset($_POST['add_redirect']) && $_POST['add_redirect'] == 'add') {
includeFile('admin/admin_missing.php');
admin_missing::AddRedirect($title, $new_title);
}
gpPlugin::Action('RenameFileDone', array($file_index, $title, $new_title));
return $new_title;
}
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:50,代码来源:Page_Rename.php
示例15: AdminPanel
/**
* Show the default admin page
*
*/
function AdminPanel()
{
global $langmessage;
$cmd = common::GetCommand();
switch ($cmd) {
case 'embededcheck':
includeFile('tool/update.php');
new update_class('embededcheck');
return;
case 'autocomplete-titles':
$opts = array('var_name' => false);
echo gp_edit::AutoCompleteValues(false, $opts);
die;
}
$this->head_js[] = '/include/js/auto_width.js';
echo '<h2>' . $langmessage['administration'] . '</h2>';
echo '<div id="adminlinks2">';
admin_tools::AdminPanelLinks(false);
echo '</div>';
}
开发者ID:jdearaujo,项目名称:gpEasy-CMS,代码行数:24,代码来源:admin_display.php
示例16: HomepageSave
/**
* Save the posted page as the homepage
*
*/
function HomepageSave()
{
global $langmessage, $config, $gp_index, $gp_titles, $page;
$homepage = $_POST['homepage'];
$homepage_key = false;
if (isset($gp_index[$homepage])) {
$homepage_key = $gp_index[$homepage];
} else {
foreach ($gp_titles as $index => $title) {
if ($title['label'] === $homepage) {
$homepage_key = $index;
break;
}
}
if (!$homepage_key) {
message($langmessage['OOPS']);
return;
}
}
$config['homepath_key'] = $homepage_key;
$config['homepath'] = common::IndexToTitle($config['homepath_key']);
if (!admin_tools::SaveConfig()) {
message($langmessage['OOPS']);
return;
}
//update the display
ob_start();
$this->HomepageDisplay();
$content = ob_get_clean();
$page->ajaxReplace[] = array('inner', '.homepage_setting', $content);
}
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:35,代码来源:admin_menu_new.php
示例17: DeleteThemeConfirmed
/**
* Finalize theme removal
*
*/
function DeleteThemeConfirmed()
{
global $langmessage, $dataDir, $gpLayouts, $config;
$gpLayoutsBefore = $gpLayouts;
$can_delete = true;
$theme_folder_name =& $_POST['folder'];
$theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name;
if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name) || !isset($config['themes'][$theme_folder_name])) {
message($langmessage['OOPS']);
return false;
}
$order = false;
if (isset($config['themes'][$theme_folder_name]['order'])) {
$order = $config['themes'][$theme_folder_name]['order'];
}
if (!$this->CanDeleteTheme($theme_folder_name, $message)) {
message($message);
return false;
}
//remove layouts
foreach ($gpLayouts as $layout_id => $layout_info) {
if (!isset($layout_info['is_addon']) || !$layout_info['is_addon']) {
continue;
}
$layout_folder = dirname($layout_info['theme']);
if ($layout_folder == $theme_folder_name) {
$this->RmLayout($layout_id);
}
}
//delete the folder
$dir = $dataDir . '/data/_themes/' . $theme_folder_name;
gpFiles::RmAll($dir);
//remove from settings
unset($config['themes'][$theme_folder_name]);
if (admin_tools::SaveAllConfig()) {
message($langmessage['SAVED']);
if ($order) {
$img_path = common::IdUrl('ci');
common::IdReq($img_path);
}
} else {
$gpLayouts = $gpLayoutsBefore;
message($langmessage['OOPS'] . ' (s1)');
}
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:49,代码来源:admin_theme_content.php
示例18: GenerateFile
/**
* Generate a file with all of the combined content
*
*/
static function GenerateFile($files, $type)
{
global $dataDir;
//get etag
$modified = $content_length = 0;
$full_paths = array();
foreach ($files as $file) {
$full_path = gp_combine::CheckFile($file);
if ($full_path === false) {
continue;
}
gp_combine::FileStat_Static($full_path, $modified, $content_length);
$full_paths[$file] = $full_path;
}
//check css imports
if ($type == 'css') {
$had_imported = false;
$import_data = array();
$imported_file = $dataDir . '/data/_cache/import_info.php';
if (file_exists($imported_file)) {
include_once $imported_file;
}
foreach ($full_paths as $file => $full_path) {
if (!isset($import_data[$full_path])) {
continue;
}
$had_imported = true;
foreach ($import_data[$full_path] as $imported_full) {
gp_combine::FileStat_Static($imported_full, $modified, $content_length);
}
unset($import_data[$full_path]);
}
}
//check to see if file exists
$etag = common::GenEtag(json_encode($files), $modified, $content_length);
$cache_relative = '/data/_cache/combined_' . $etag . '.' . $type;
$cache_file = $dataDir . $cache_relative;
if (file_exists($cache_file)) {
// change modified time to extend cache
if (time() - filemtime($cache_file) > 604800) {
touch($cache_file);
}
return $cache_relative;
}
//create file
if ($type == 'js') {
ob_start();
common::jsStart();
foreach ($full_paths as $full_path) {
readfile($full_path);
echo ";\n";
}
$combined_content = ob_get_clean();
} else {
$imports = $combined_content = '';
$new_imported = array();
foreach ($full_paths as $file => $full_path) {
$temp = new gp_combine_css($file);
$combined_content .= "\n/* " . $file . " */\n";
$combined_content .= $temp->content;
$imports .= $temp->imports;
if (count($temp->imported)) {
$new_imported[$full_path] = $temp->imported;
}
}
$combined_content = $imports . $combined_content;
//save imported data
if (count($new_imported) || $had_imported) {
if (count($new_imported)) {
$import_data = $new_imported + $import_data;
}
gpFiles::SaveData($imported_file, 'import_data', $import_data);
}
}
if (!gpFiles::Save($cache_file, $combined_content)) {
return false;
}
includeFile('admin/admin_tools.php');
admin_tools::CleanCache();
return $cache_relative;
}
开发者ID:AndFer22,项目名称:Typesetter,代码行数:85,代码来源:combine.php
示例19: Exported
function Exported()
{
global $langmessage;
if (count($this->exported) == 0) {
return;
}
echo '<table class="bordered">';
echo '<tr><th>';
echo $langmessage['Previous Exports'];
echo '</th><th> </th><th>';
echo $langmessage['File Size'];
echo '</th><th>';
echo $langmessage['options'];
echo '</th></tr>';
$total_size = 0;
$total_count = 0;
foreach ($this->exported as $file) {
$info = $this->FileInfo($file);
if (!$info) {
continue;
}
$full_path = $this->export_dir . '/' . $file;
if ($total_count % 2 == 0) {
echo '<tr class="even">';
} else {
echo '<tr>';
}
echo '<td>';
echo str_replace(' ', ' ', $info['time']);
echo '</td><td>';
echo implode(', ', $info['exported']);
echo '</td><td>';
$size = filesize($full_path);
echo admin_tools::FormatBytes($size);
echo ' ';
echo $info['ext'];
echo '</td><td>';
echo '<a href="' . common::GetDir('/data/_exports/' . $file) . '">' . $langmessage['Download'] . '</a>';
echo ' ';
if ($this->CanRevert($info['bits'])) {
echo common::Link('Admin_Port', $langmessage['Revert'], 'cmd=revert&archive=' . rawurlencode($file), '', $file);
} else {
echo $langmessage['Revert'];
}
echo ' ';
echo common::Link('Admin_Port', $langmessage['delete'], 'cmd=delete&file=' . rawurlencode($file), array('data-cmd' => 'postlink', 'title' => $langmessage['delete_confirm'], 'class' => 'gpconfirm'), $file);
echo '</td></tr>';
$total_count++;
$total_size += $size;
}
//totals
echo '<tr><th>';
echo $langmessage['Total'];
echo ': ';
echo $total_count;
echo '</th><th> </th><th>';
echo admin_tools::FormatBytes($total_size);
echo '</th><th> </th></tr>';
echo '</table>';
}
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:60,代码来源:admin_port.php
示例20: GetUsers
function GetUsers()
{
global $dataDir;
require $dataDir . '/data/_site/users.php';
$this->users = $users;
//fix the editing value
foreach ($this->users as $username => $userinfo) {
$userinfo += array('granted' => '');
admin_tools::EditingValue($userinfo);
$this->users[$username] = $userinfo;
}
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:12,代码来源:admin_users.php
注:本文中的admin_tools类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论