Exemplo n.º 1
0
function VersionDetail()
{
    global $forum_version, $txt, $sourcedir, $context;
    isAllowedTo('admin_forum');
    // Call the function that'll get all the version info we need.
    require_once $sourcedir . '/Subs-Admin.php';
    $versionOptions = array('include_ssi' => true, 'include_subscriptions' => true, 'sort_results' => true);
    $version_info = getFileVersions($versionOptions);
    // Add the new info to the template context.
    $context += array('file_versions' => $version_info['file_versions'], 'default_template_versions' => $version_info['default_template_versions'], 'template_versions' => $version_info['template_versions'], 'default_language_versions' => $version_info['default_language_versions'], 'default_known_languages' => array_keys($version_info['default_language_versions']));
    // Make it easier to manage for the template.
    $context['forum_version'] = $forum_version;
    $context['sub_template'] = 'view_versions';
    $context['page_title'] = $txt['admin_version_check'];
}
Exemplo n.º 2
0
function get_file_versions($core = false)
{
    global $context;
    // Change index.php below to whatever you've changed yours to...
    $fp = fopen(BOARDDIR . '/index.php', 'rb');
    $header = fread($fp, 3072);
    fclose($fp);
    // The version looks rougly like... that.
    if (preg_match('~\\$forum_version\\s=\\s\'ElkArte (.+)\'~i', $header, $match) == 1) {
        $context['forum_version'] = $match[1];
    } else {
        $context['forum_version'] = '??';
    }
    if ($core) {
        return $context['forum_version'];
    }
    require_once SUBSDIR . '/Admin.subs.php';
    $versionOptions = array('include_ssi' => true, 'include_subscriptions' => true, 'sort_results' => true);
    $version_info = getFileVersions($versionOptions);
    // Add the new info to the template context.
    $context += array('file_versions' => $version_info['file_versions'], 'file_versions_admin' => $version_info['file_versions_admin'], 'file_versions_controllers' => $version_info['file_versions_controllers'], 'file_versions_database' => $version_info['file_versions_database'], 'file_versions_subs' => $version_info['file_versions_subs'], 'default_template_versions' => $version_info['default_template_versions'], 'template_versions' => $version_info['template_versions'], 'default_language_versions' => $version_info['default_language_versions'], 'default_known_languages' => array_keys($version_info['default_language_versions']));
}
DEFINE('ELK', '1');
DEFINE('BOARDDIR', dirname(__FILE__));
DEFINE('LANGUAGEDIR', BOARDDIR . '/themes/default/languages');
DEFINE('SOURCEDIR', BOARDDIR . '/sources');
DEFINE('ADMINDIR', SOURCEDIR . '/admin');
DEFINE('EXTDIR', SOURCEDIR . '/ext');
DEFINE('CONTROLLERDIR', SOURCEDIR . '/controllers');
DEFINE('SUBSDIR', SOURCEDIR . '/subs');
global $settings;
$settings['default_theme_dir'] = BOARDDIR . '/themes/default';
$settings['theme_dir'] = BOARDDIR . '/themes/default';
$settings['theme_id'] = 1;
// Call the function that'll get all the version info we need.
require_once SUBSDIR . '/Admin.subs.php';
$versionOptions = array('include_ssi' => true, 'include_subscriptions' => true, 'sort_results' => true);
$version_info = getFileVersions($versionOptions);
// Now we need to grab the current version of the script from index.php
$index = file_get_contents(BOARDDIR . '/index.php');
$index_lines = explode("\n", $index);
foreach ($index_lines as $line) {
    if (strpos($line, '$forum_version') !== false) {
        preg_match('~\'(ElkArte .*)\';$~', $line, $matches);
        $forum_version = $matches[1];
        break;
    }
}
$handle = fopen($output_file_name, 'w');
// Start with the common thing
fwrite($handle, 'window.ourVersions = {');
fwrite($handle, "\n\t'Version': '{$forum_version}',\n");
foreach (array('admin', 'controllers', 'database', 'subs') as $type) {
Exemplo n.º 4
0
 /**
  * Perform a detailed version check.  A very good thing ;).
  *
  * What it does
  * - The function parses the comment headers in all files for their version information,
  * and outputs that for some javascript to check with simplemachines.org.
  * - It does not connect directly with elkarte.net, but rather expects the client to.
  * - It requires the admin_forum permission.
  * - Uses the view_versions admin area.
  * - Accessed through ?action=admin;area=maintain;sa=routine;activity=version.
  *
  * @uses Admin template, view_versions sub-template.
  */
 public function action_version_display()
 {
     global $forum_version, $txt, $context, $modSettings;
     isAllowedTo('admin_forum');
     // Call the function that'll get all the version info we need.
     require_once SUBSDIR . '/Admin.subs.php';
     $versionOptions = array('include_ssi' => true, 'include_subscriptions' => true, 'sort_results' => true);
     $version_info = getFileVersions($versionOptions);
     // Add the new info to the template context.
     $context += array('file_versions' => $version_info['file_versions'], 'file_versions_admin' => $version_info['file_versions_admin'], 'file_versions_controllers' => $version_info['file_versions_controllers'], 'file_versions_database' => $version_info['file_versions_database'], 'file_versions_subs' => $version_info['file_versions_subs'], 'default_template_versions' => $version_info['default_template_versions'], 'template_versions' => $version_info['template_versions'], 'default_language_versions' => $version_info['default_language_versions'], 'default_known_languages' => array_keys($version_info['default_language_versions']));
     // Make it easier to manage for the template.
     $context['forum_version'] = $forum_version;
     $context['sub_template'] = 'view_versions';
     $context['page_title'] = $txt['admin_version_check'];
     // @deprecated since 1.0 - remember to remove from 1.1 this is here just to avoid errors from not using upgrade.php
     $context['detailed_version_url'] = !empty($modSettings['detailed-version.js']) ? $modSettings['detailed-version.js'] : 'https://elkarte.github.io/Elkarte/site/detailed-version.js';
 }