本文整理汇总了PHP中main::latest_version方法的典型用法代码示例。如果您正苦于以下问题:PHP main::latest_version方法的具体用法?PHP main::latest_version怎么用?PHP main::latest_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::latest_version方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
$version_info = main::latest_version();
$current_version = $version_info['THT'];
$new_version_download = $version_info['THT_DL'];
$running_version = $dbh->config('version');
$install_check = $this->checkDir(INC . "../install/");
$conf_check = $this->checkPerms(INC . "/conf.inc.php");
if ($current_version == $running_version) {
$updatemsg = "<span style='color:green'>Up-To-Date</span>";
$upgrademsg = "";
} else {
$updatemsg = "<span style='color:red'>Upgrade Avaliable</span>";
$upgrademsg = "<div class='warn'><img src='../themes/icons/error.png' alt='' /> There is a new version ({$current_version}) avaliable! <a href = '" . $new_version_download . "' target = '_blank'>Please download it here</a> and upgrade!</div>";
}
unset($current_version);
unset($running_version);
$stats['VERSION'] = $dbh->config('version');
$stats['THEME'] = $dbh->config('theme');
$stats['CENABLED'] = main::cleaninteger($dbh->config('cenabled'));
$stats['SVID'] = main::cleaninteger($dbh->config('show_version_id'));
$stats['SENABLED'] = main::cleaninteger($dbh->config('senabled'));
$stats['DEFAULT'] = $dbh->config('default_page');
$stats['EMETHOD'] = $dbh->config('emailmethod');
$stats['SIGNENABLE'] = main::cleaninteger($dbh->config('general'));
$stats['MULTI'] = main::cleaninteger($dbh->config('multiple'));
$stats['UPDATE'] = $updatemsg;
$stats['UPG_BOX'] = $upgrademsg;
$stats_box = style::replaceVar('tpl/admin/home/stats.tpl', $stats);
$content = '<strong>Welcome to your Admin Dashboard!</strong><br />Welcome to the dashboard of your Admin Control Panel. In this area you can do the tasks that you need to complete such as manage servers, create packages, manage users.<br />
Here, you can also change the look and feel of your THT Installation. If you require any help, be sure to ask at the <a href="http://thehostingtool.com/forum" title="THT Community is the official stop for THT Support, THT Modules, Developer Center and more! Visit our growing community now!" class="tooltip">THT Community</a><br /><br />' . $stats_box . '<br />' . $install_check . $conf_check . '</div></div>';
echo $content;
if ($_POST) {
$dbh->update("admin_notes", array("notes" => $postvar['admin_notes']), array("id", "=", "1"));
main::errors("Settings Updated!");
main::done();
}
$notes_data = $dbh->select("admin_notes", array("id", "=", "1"));
$notepad_array['NOTEPAD'] = $notes_data['notes'];
$content_notepad = style::replaceVar('tpl/admin/home/notepad.tpl', $notepad_array);
echo '<br />';
echo main::table('Admin Notepad', $content_notepad, 'auto', 'auto');
$news = main::sub("<strong>Add the THT RSS Feed!</strong>", '<a href="http://thehostingtool.com/forum/syndication.php?fid=2" target="_blank" class="tooltip" title="Add the THT RSS Feed!"><img src="<URL>themes/icons/feed.png" /></a>');
$rss_feed = @file_get_contents("http://thehostingtool.com/forum/syndication.php?fid=2&limit=3");
if ($rss_feed !== false) {
$xml = new SimpleXMLElement($rss_feed);
foreach ($xml->channel->item as $item) {
$newsitem_array['title'] = $item->title;
$newsitem_array['author'] = "THT";
$newsitem_array['link'] = $item->link;
$newsitem_array['TIME'] = main::convertdate("n/d/Y", strtotime($item->pubDate));
$newsitem_array['SUMMARY'] = $item->description;
$news .= style::replaceVar('tpl/admin/home/news-item.tpl', $newsitem_array);
}
}
echo "<br />";
echo main::table('THT News & Updates', $news);
}
示例2: install_mod
public function install_mod($mod_dir)
{
global $dbh, $postvar, $getvar, $instance;
if (self::is_mod_installed($mod_dir)) {
echo "This module is already installed. Please uninstall the module first before reinstalling it.";
return;
}
$mod_dir_full = INC . "/automod/" . $mod_dir;
$mod_xml_file = $mod_dir_full . "/install.xml";
if (is_file($mod_xml_file)) {
//Let's set some variables - First the basics.
$module_data = self::get_mod_xml($mod_xml_file);
$header_data = $module_data['header'];
$actions_data = $module_data['action-group'];
$author_data = $module_data['header']['author-group']['author'];
//Values that every module should have.
$mod_name = htmlentities($header_data['projname']);
$mod_desc = htmlentities($header_data['description']);
$mod_license = htmlentities($header_data['license']);
$mod_version = htmlentities($header_data['mod-version']);
$mod_author = htmlentities($author_data['realname']);
$mod_homepage = str_replace("&", "&", htmlspecialchars($author_data['homepage']));
$mod_projectpage = str_replace("&", "&", htmlspecialchars($author_data['projectpage']));
$mod_support = htmlentities($author_data['support']);
$mod_thtversion = htmlentities($author_data['thtversion']);
//Values that many modules have
$mod_sql = $actions_data['sql'];
$mod_uninstallsql = $actions_data['uninstallsql'];
//We should check this to see if the user can remove the database entries made by the module and notify them if the uninstall SQL info isn't available.
$mod_after_install = $actions_data['diy-instructions'];
$mod_edits = $actions_data['open'];
//Versions
$latest_versions = main::latest_version();
$THT_version = $dbh->config("version");
$mod_thtversion = str_replace("reworked", "Reworked", strtolower($mod_thtversion));
//Let the games begin! =)
$warnings = array();
//See if they are using a dynamic admin directory and if so, rename the admin directory before installing.
if (ADMINDIR && ADMINDIR != 'admin') {
@rename($mod_dir_full . "/root/admin", $mod_dir_full . "/root/" . ADMINDIR);
}
//THT version check
if ($THT_version != $mod_thtversion) {
$mod_thtversion_array = explode(" ", $mod_thtversion);
$mod_thtversion_vers = $mod_thtversion_array[0];
$standard_warn = "<br><br>The THT version installed is different from what this module was developed for. The installation will be further checked, but the installer cannot guarantee that the module will work properly on your installation of THT.<br><br><b>THT Version Installed: </b>" . $THT_version . "<br><b>THT Version Suggested: </b>" . $mod_thtversion;
$special_warning = "<br><br>The THT version installed may or may not be the same as the one this module is made for. The one this module was designed for is a special version of THT.<br><br><b>THT Version Installed: </b>" . $THT_version . "<br><b>THT Version Suggested: </b>" . $mod_thtversion;
if ($mod_thtversion_array[1]) {
$mod_thtversion_special = str_replace($mod_thtversion_vers . " ", "", $mod_thtversion);
if ($mod_thtversion_vers == $THT_version) {
if ($mod_thtversion != "Reworked") {
$warnings['version'] = $special_warning;
}
} else {
$warnings['version'] = $standard_warn;
}
} else {
$warnings['version'] = $standard_warn;
}
}
if (empty($latest_versions['THT_DL'])) {
$latest_versions['THT_DL'] = "Download temporarily unavailable";
}
if ($warnings['version'] && $mod_thtversion == "1.3 Reworked") {
//The mod was made for Reworked. Let's add a shameless plug. ;) If there's a newer release available, it'll show them the link to that one instead.
$warnings['version'] .= "<br><b>THT 1.3 Reworked can be downloaded at: </b><a href = '" . $latest_versions['THT_DL'] . "' target = '_blank'>" . $latest_versions['THT_DL'] . "</a>.";
}
//Are we using the latest THT?
if ($latest_versions['THT'] != $THT_version && !empty($latest_versions)) {
$recommendations = "<font color = '#FF7800'><b>RECOMMENDATION: </b></font>It's always a good idea to have the most up to date version of THT. The latest stable version of THT is THT " . $latest_versions['THT'] . " and can be downloaded at <a href = '" . $latest_versions['THT_DL'] . "' target = '_blank'>" . $latest_versions['THT_DL'] . "</a>.<br>";
} else {
$recommendations = "<font color = '#779500'>Everything is up to date!</font>";
}
//If we have SQL, do we also have Uninstall SQL?
if (!empty($mod_sql)) {
if (empty($mod_uninstallsql)) {
$warnings['uninstall_sql'] = "<br><br>This module runs the following queries when it installs, but it does not have a way to remove them automatically. Please make a note of these in case you decide to uninstall this module. You'll be shown these same installation queries when you uninstall the module if you decide to.<br><br><b>SQL:</b><br><textarea cols = '87' rows = '10'>" . $mod_sql . "</textarea>";
//The last part makes <PRE> show properly on the page.
}
}
//Now we need to check if the file modifications are possible on this installation of THT. Let's do a test run and see if we can find everything it says to find.
$file_errors = self::modify_files($mod_edits, true, false, $mod_dir);
$warnings['fileerrors'] = $file_errors['fileerrors'];
//The warnings are done now. Now we print the results and offer them the ability confirm or reject the installation.
//Let's see if any THT files will be overwritten by the installer so we can notify the user.
$any_replaced_files = self::RecursiveCopy($mod_dir_full . "/root", "..", true);
if (!empty($any_replaced_files)) {
$any_replaced_files = str_replace("../", "", $any_replaced_files);
$errors_list_array['ERRWARN'] = "WARNING";
$errors_list_array['ERRCOLOR'] = "FF7800";
$errors_list_array['TITLE'] = "Some THT files will be replaced";
$errors_list_array['DESCRIPTION'] = "<br><hr noshade color = '#000000'><br><font color = '#FF7800'><b>WARNING: </b></font> While this might be perfectly fine, you should be aware that the following files will be overwritten by this module. Please be sure to back up your website before you proceed with the installation. AutoMod will rename the old files to FILENAME_old.EXT for your convienience.<br><br><b>Files to be overwritten with new content:</b><br><br>" . nl2br($any_replaced_files) . "<br>";
$output .= style::replaceVar("tpl/automod/errors-list.tpl", $errors_list_array);
}
//Selection of errors that we collected while processing this mod
$err_version = $warnings['version'];
$err_uninstall_sql = $warnings['uninstall_sql'];
$err_fileerrors = $warnings['fileerrors'];
if ($err_version) {
$mod_thtversion_color = "<font color = '#FF0055'>" . $THT_version . "</font>";
//.........这里部分代码省略.........