本文整理汇总了PHP中common::IdUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP common::IdUrl方法的具体用法?PHP common::IdUrl怎么用?PHP common::IdUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::IdUrl方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DeleteTheme
/**
* Delete a remote theme
*
*/
function DeleteTheme()
{
global $langmessage, $dataDir, $gpLayouts, $config;
$config_before = $config;
$gpLayoutsBefore = $gpLayouts;
$theme_folder_name =& $_POST['folder'];
$theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name;
if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name)) {
message($langmessage['OOPS'] . ' (Invalid Request)');
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
$rm_addon = false;
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) {
continue;
}
if (array_key_exists('addon_key', $layout_info)) {
$rm_addon = $layout_info['addon_key'];
}
$this->RmLayoutPrep($layout_id);
unset($gpLayouts[$layout_id]);
}
//remove from settings
unset($config['themes'][$theme_folder_name]);
if ($rm_addon) {
includeFile('admin/admin_addon_installer.php');
$installer = new admin_addon_installer();
if (!$installer->Uninstall($rm_addon)) {
$gpLayouts = $gpLayoutsBefore;
}
$installer->OutputMessages();
} else {
if (!admin_tools::SaveAllConfig()) {
$config = $config_before;
$gpLayouts = $gpLayoutsBefore;
message($langmessage['OOPS'] . ' (s1)');
return false;
}
message($langmessage['SAVED']);
if ($order) {
$img_path = common::IdUrl('ci');
common::IdReq($img_path);
}
}
//delete the folder if it hasn't already been deleted by admin_addon_installer
$dir = $dataDir . '/data/_themes/' . $theme_folder_name;
if (file_exists($dir)) {
gpFiles::RmAll($dir);
}
}
示例2: CheckStatus
static function CheckStatus()
{
switch (self::$update_status) {
case 'embedcheck':
$img_path = common::GetUrl('Admin', 'cmd=embededcheck');
common::IdReq($img_path);
break;
case 'checkincompat':
$img_path = common::IdUrl('ci');
//check in
common::IdReq($img_path);
break;
}
}
示例3: Install_Step3
function Install_Step3()
{
global $langmessage, $config;
if (empty($this->install_folder_name)) {
message($langmessage['OOPS']);
return false;
}
if ($this->upgrade_key && !$this->developer_mode) {
if (!file_exists($this->install_folder_path)) {
message($langmessage['OOPS']);
return false;
}
if (empty($this->temp_folder_name) || !file_exists($this->temp_folder_path)) {
message($langmessage['OOPS']);
return false;
}
}
$old_config = $config;
$this->Step3_Links();
if (!isset($this->config[$this->install_folder_name])) {
$this->config[$this->install_folder_name] = array();
}
echo '<p>';
echo 'Saving Settings';
echo '</p>';
//general configuration
$this->UpdateConfigInfo('Addon_Name', 'name');
$this->UpdateConfigInfo('Addon_Version', 'version');
$this->UpdateConfigInfo('Addon_Unique_ID', 'id');
$this->UpdateConfigInfo('Addon_Unique_ID', 'id');
//proof of purchase
$order = false;
if (isset($this->ini_contents['Proof of Purchase']) && isset($this->ini_contents['Proof of Purchase']['order'])) {
$order = $this->ini_contents['Proof of Purchase']['order'];
$this->config[$this->install_folder_name]['order'] = $order;
} else {
// don't delete any purchase id's
// unset($this->config[$this->install_folder_name]['order']);
}
if ($this->can_install_links) {
$this->UpdateConfigInfo('editable_text', 'editable_text');
$this->UpdateConfigInfo('html_head', 'html_head');
}
if (!$this->Step3_Folders()) {
message($langmessage['OOPS']);
$config = $old_config;
return false;
}
if (!admin_tools::SaveAllConfig()) {
message($langmessage['OOPS']);
$config = $old_config;
return false;
}
// History
$history = array();
$history['name'] = $this->config[$this->install_folder_name]['name'];
$history['action'] = 'installed';
if (isset($this->config[$this->install_folder_name]['id'])) {
$history['id'] = $this->config[$this->install_folder_name]['id'];
}
$history['time'] = time();
$this->addonHistory[] = $history;
$this->SaveAddonData();
if ($order) {
$img_path = common::IdUrl('ci');
common::IdReq($img_path);
}
//completed install, clean up /data/_addoncode/ folder
$this->CleanInstallFolder();
return true;
}
示例4: 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)');
}
}
示例5: Confirm_Uninstall
function Confirm_Uninstall()
{
global $config, $langmessage, $dataDir, $gp_titles, $gp_menu, $gp_index;
$addon =& $_POST['addon'];
if (!isset($config['addons'][$addon])) {
message($langmessage['OOPS']);
return;
}
$order = false;
if (isset($config['addons'][$addon]['order'])) {
$order = $config['addons'][$addon]['order'];
}
//tracking
$history = array();
$history['name'] = $config['addons'][$addon]['name'];
$history['action'] = 'uninstalled';
if (isset($config['addons'][$addon]['id'])) {
$history['id'] = $config['addons'][$addon]['id'];
}
unset($config['addons'][$addon]);
//remove links
$installedGadgets = $this->GetInstalledComponents($config['gadgets'], $addon);
$this->RemoveFromHandlers($installedGadgets);
//remove from gp_index, gp_menu
$installedLinks = $this->GetInstalledComponents($gp_titles, $addon);
foreach ($installedLinks as $index) {
if (isset($gp_menu[$index])) {
unset($gp_menu[$index]);
}
$title = common::IndexToTitle($index);
if ($title) {
unset($gp_index[$title]);
}
}
$this->RemoveFromConfig($config['gadgets'], $addon);
$this->RemoveFromConfig($config['admin_links'], $addon);
$this->RemoveFromConfig($gp_titles, $addon);
$this->CleanHooks($addon);
if (!admin_tools::SaveAllConfig()) {
message($langmessage['OOPS']);
$this->Uninstall();
return false;
}
/*
* Delete the data folders
*/
$installFolder = $dataDir . '/data/_addoncode/' . $addon;
if (file_exists($installFolder)) {
gpFiles::RmAll($installFolder);
}
$data_folder_name = gpPlugin::GetDataFolder($addon);
$dataFolder = $dataDir . '/data/_addondata/' . $data_folder_name;
if (file_exists($dataFolder)) {
gpFiles::RmAll($dataFolder);
}
/*
* Record the history
*/
$history['time'] = time();
$this->addonHistory[] = $history;
$this->SaveAddonData();
if ($order) {
$img_path = common::IdUrl('ci');
common::IdReq($img_path);
}
message($langmessage['SAVED']);
}
示例6: ErrorBuffer
static function ErrorBuffer($check_user = true, $jquery = true)
{
global $wbErrorBuffer, $config, $dataDir, $rootDir;
if (count($wbErrorBuffer) == 0) {
return;
}
if (isset($config['Report_Errors']) && !$config['Report_Errors']) {
return;
}
if ($check_user && !common::LoggedIn()) {
return;
}
$dataDir_len = strlen($dataDir);
$rootDir_len = strlen($rootDir);
$img_path = common::IdUrl('er');
$i = 0;
foreach ($wbErrorBuffer as $error) {
//remove $dataDir or $rootDir from the filename
$file_name = common::WinPath($error['ef' . $i]);
if ($dataDir_len > 1 && strpos($file_name, $dataDir) === 0) {
$file_name = substr($file_name, $dataDir_len);
} elseif ($rootDir_len > 1 && strpos($file_name, $rootDir) === 0) {
$file_name = substr($file_name, $rootDir_len);
}
$error['ef' . $i] = substr($file_name, -100);
$new_path = $img_path . '&' . http_build_query($error, '', '&');
//maximum length of 2000 characters
if (strlen($new_path) > 2000) {
break;
}
$img_path = $new_path;
$i++;
}
return common::IdReq($img_path, $jquery);
}
示例7: DoRemoteCheck2
/**
* Update available package information from gpEasy.com
*
*/
function DoRemoteCheck2()
{
global $config, $dataDir;
$path = common::IdUrl();
//add any locally available themes with addon ids
includeFile('tool/parse_ini.php');
$dir = $dataDir . '/themes';
$themes = scandir($dir);
$theme_ids = array();
foreach ($themes as $name) {
if ($name == '.' || $name == '..') {
continue;
}
$full_dir = $dir . '/' . $name;
$templateFile = $full_dir . '/template.php';
$ini_file = $full_dir . '/Addon.ini';
if (!file_exists($templateFile)) {
continue;
}
$ini_info = array();
if (file_exists($ini_file)) {
$ini_info = gp_ini::ParseFile($ini_file);
}
if (isset($ini_info['Addon_Unique_ID'])) {
$theme_ids[] = $ini_info['Addon_Unique_ID'];
}
}
$theme_ids = array_unique($theme_ids);
if (count($theme_ids)) {
$path .= '&th=' . implode('-', $theme_ids);
}
//get data from gpEasy
$result = gpRemoteGet::Get_Successful($path);
if (!$result) {
$this->msg(gpRemoteGet::Debug('Sorry, data not fetched'));
return false;
}
//zipped data possible as of gpEasy 4.1
/*
if( function_exists('gzinflate') ){
$temp = gzinflate($result);
if( $temp ){
$result = $temp;
}
}
*/
$result = trim($result);
$array = json_decode($result, true);
//json as of gpEasy 4.1
if (!is_array($array)) {
$debug = array();
$debug['Type'] = gettype($array);
$debug['json_last_error'] = json_last_error();
$debug['Two'] = substr($result, 0, 20);
$this->msg(gpRemoteGet::Debug('Sorry, data not fetched', $debug));
return false;
}
if (!$array) {
$debug = array();
$debug['Count'] = count($array);
$debug['Two'] = substr($result, 0, 20);
$this->msg(gpRemoteGet::Debug('Sorry, data not fetched', $debug));
return false;
}
$this->update_data['packages'] = array();
$core_version = false;
foreach ($array as $info) {
$id =& $info['id'];
if (!is_numeric($id)) {
continue;
}
if (!isset($info['type'])) {
continue;
}
if ($info['type'] == 'core') {
$id = 'core';
$core_version = $info['version'];
}
$this->update_data['packages'][$id] = $info;
}
if (isset($this->update_data['packages']['core'])) {
$this->core_package = $this->update_data['packages']['core'];
}
return true;
}
示例8: DoRemoteCheck2
function DoRemoteCheck2()
{
global $config, $gpversion;
$path = common::IdUrl();
$result = gpRemoteGet::Get_Successful($path);
if (!$result) {
return false;
}
parse_str($result, $array);
if (!is_array($array) || count($array) < 1) {
return false;
}
$core_version = false;
foreach ($array as $info) {
$id =& $info['id'];
if (!is_numeric($id)) {
continue;
}
if (!isset($info['type'])) {
continue;
}
if ($info['type'] == 'core') {
$id = 'core';
$core_version = $info['version'];
}
$this->update_data['packages'][$id] = $info;
}
//save some info in $config
/*
if( $core_version && version_compare($gpversion,$core_version,'<') ){
$config['updates']['core'] = time();
}
$config['updates']['checked'] = time();
*/
//admin_tools::SaveConfig();
return true;
}
示例9: InstallSteps
/**
* Run through the installation process
*
*/
function InstallSteps()
{
global $dataDir;
$this->GetAddonData();
// addonHistory
$this->Init_PT();
// $this->config
//get from remote
if ($this->remote_install && !$this->GetRemote()) {
return false;
}
//check ini contents
$this->display_name = basename($this->source);
if (!$this->GetINI($this->source, $error)) {
//local themes don't need addon.ini files
if (empty($this->new_layout)) {
$this->message($error);
return false;
}
}
// upgrade/destination
$this->upgrade_key = $this->config_key = admin_addons_tool::UpgradePath($this->ini_contents, $this->config_index);
if ($this->remote_install) {
if ($this->config_key) {
$this->dest = $this->addon_folder . '/' . $this->config_key;
} else {
$this->dest = $this->TempFile();
}
} else {
$this->dest = $this->source;
}
$this->dest_name = basename($this->dest);
if (!$this->config_key) {
$this->config_key = $this->dest_name;
}
//the data folder will not always be the same as the addon folder
if (isset($this->config[$this->config_key]['data_folder'])) {
$this->data_folder = $this->config[$this->config_key]['data_folder'];
} elseif ($this->upgrade_key && file_exists($dataDir . '/data/_addondata/' . $this->upgrade_key)) {
$this->data_folder = $this->upgrade_key;
} else {
$this->data_folder = $this->dest_name;
}
$this->IniContents();
if (!$this->PrepConfig()) {
return false;
}
if (!$this->CheckFile()) {
return false;
}
//hooks
if (!$this->Hooks()) {
return false;
}
//layout
if (!$this->Layout()) {
return false;
}
//move new addon folder into place
if (!$this->FinalizeFolder()) {
return false;
}
if (!$this->FinalizeConfig()) {
return false;
}
// Save
if (!admin_tools::SaveAllConfig()) {
$this->message($langmessage['OOPS'] . ' (Configuration not saved)');
return false;
}
if ($this->order) {
$img_path = common::IdUrl('ci');
common::IdReq($img_path);
}
$this->UpdateHistory();
return true;
}
示例10: DoRemoteCheck2
function DoRemoteCheck2()
{
global $config, $dataDir;
$path = common::IdUrl();
//add any locally available themes with addon ids
includeFile('admin/admin_addons_tool.php');
$dir = $dataDir . '/themes';
$themes = scandir($dir);
$theme_ids = array();
foreach ($themes as $name) {
if ($name == '.' || $name == '..') {
continue;
}
$full_dir = $dir . '/' . $name;
$templateFile = $full_dir . '/template.php';
if (!file_exists($templateFile)) {
continue;
}
$ini_info = admin_addons_tool::GetAvailInstall($full_dir);
if (isset($ini_info['Addon_Unique_ID'])) {
$theme_ids[] = $ini_info['Addon_Unique_ID'];
}
}
$theme_ids = array_unique($theme_ids);
if (count($theme_ids)) {
$path .= '&th=' . implode('-', $theme_ids);
}
//get data from gpEasy
$result = gpRemoteGet::Get_Successful($path);
if (!$result) {
return false;
}
//zipped data possible as of gpEasy 4.1
if (function_exists('gzinflate')) {
$temp = gzinflate($result);
if ($temp) {
$result = $temp;
}
}
$array = json_decode($result, true);
//json as of gpEasy 4.1
if (!is_array($array) || count($array) < 1) {
return false;
}
$this->update_data['packages'] = array();
$core_version = false;
foreach ($array as $info) {
$id =& $info['id'];
if (!is_numeric($id)) {
continue;
}
if (!isset($info['type'])) {
continue;
}
if ($info['type'] == 'core') {
$id = 'core';
$core_version = $info['version'];
}
$this->update_data['packages'][$id] = $info;
}
return true;
}