Example #1
0
 static function initThisObjectRule($parent, $class, $name = null)
 {
     global $gbl, $sgbl, $login, $ghtml;
     /*
     	if (!$parent->isLocalhost('nname')) {
     		throw new lxException("slave_is_automatically_updated", $parent->nname);
     	}
     */
     $thisversion = $sgbl->__ver_major_minor_release;
     $upversion = getLatestVersion();
     return $upversion;
 }
Example #2
0
 public function version_check_action($version)
 {
     $latest_version = getLatestVersion($this->keyword, $this->range_id);
     if (!$latest_version && $version > 1) {
         $this->response->add_header('X-Studip-Error', _('Diese Wiki-Seite existiert nicht mehr!'));
         $this->render_json(false);
     } elseif ($latest_version && $version != $latest_version['version']) {
         $error = _('Die von Ihnen bearbeitete Seite ist nicht mehr aktuell.') . ' ';
         $error .= _('Falls Sie dennoch speichern, überschreiben Sie die getätigte Änderung und es wird unter Umständen zu Datenverlusten kommen.');
         $this->response->add_header('X-Studip-Error', $error);
         $this->response->add_header('X-Studip-Confirm', _('Möchten Sie Ihre Version dennoch speichern?'));
         $this->render_json(null);
     } else {
         $this->render_json(true);
     }
 }
Example #3
0
<?php

defined('INTRANET_DIRECTORY') or exit('No direct script access allowed');
// Actualizaciones de la aplicación.
// Comprueba la última release de la aplicación
if (isset($_SESSION['user_admin']) && $_SESSION['user_admin']) {
    function getLatestVersion($repository, $default = INTRANET_VERSION)
    {
        $context = array('http' => array('header' => "User-Agent: " . $_SERVER['HTTP_USER_AGENT'] . "\r\n"));
        $file = @json_decode(@file_get_contents("https://api.github.com/repos/{$repository}/tags", false, stream_context_create($context)));
        return sprintf("%s", $file ? reset($file)->name : $default);
    }
    $ultima_version = ltrim(getLatestVersion('IESMonterroso/intranet'), 'v');
}
?>

<?php 
if (isset($_SESSION['user_admin']) && $ultima_version > INTRANET_VERSION) {
    ?>
<div  class="alert alert-info" >
	<h4>Nueva actualización de la Intranet</h4>
	<div class="row">
		<div class="col-sm-8">Disponible para su descarga la versión <?php 
    echo $ultima_version;
    ?>
 de la aplicación.</div>
		<div class="col-sm-4">
			<a href="https://github.com/IESMonterroso/intranet/releases/tag/v<?php 
    echo $ultima_version;
    ?>
" target="_blank" class="btn btn-primary pull-right"><span class="fa fa-download"></span> Descargar</a>
Example #4
0
    /**
     * @todo document this
     */
    function pagehead($extrahead = '')
    {
        global $member, $nucleus, $CONF, $manager;
        $manager->notify('AdminPrePageHead', array('extrahead' => &$extrahead, 'action' => $this->action));
        $baseUrl = htmlspecialchars($CONF['AdminURL']);
        if (!array_key_exists('AdminCSS', $CONF)) {
            sql_query("INSERT INTO " . sql_table('config') . " VALUES ('AdminCSS', 'contemporary_jp')");
            $CONF['AdminCSS'] = 'contemporary_jp';
        }
        ?>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
		<html <?php 
        echo _HTML_XML_NAME_SPACE_AND_LANG_CODE;
        ?>
>
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        echo _CHARSET;
        ?>
" />
			<title><?php 
        echo htmlspecialchars($CONF['SiteName']);
        ?>
 - Admin</title>
			<link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<?php 
        echo $baseUrl;
        ?>
styles/admin_<?php 
        echo $CONF["AdminCSS"];
        ?>
.css" />
			<link rel="stylesheet" title="Nucleus Admin Default" type="text/css"
			href="<?php 
        echo $baseUrl;
        ?>
styles/addedit.css" />

			<script type="text/javascript" src="<?php 
        echo $baseUrl;
        ?>
javascript/edit.js"></script>
			<script type="text/javascript" src="<?php 
        echo $baseUrl;
        ?>
javascript/admin.js"></script>
			<script type="text/javascript" src="<?php 
        echo $baseUrl;
        ?>
javascript/compatibility.js"></script>

	  <meta http-equiv='Pragma' content='no-cache' />
	  <meta http-equiv='Cache-Control' content='no-cache, must-revalidate' />
	  <meta http-equiv='Expires' content='-1' />

			<?php 
        echo $extrahead;
        ?>
		</head>
		<body>
		<div id="adminwrapper">
		<div class="header">
		<h1><?php 
        echo htmlspecialchars($CONF['SiteName']);
        ?>
</h1>
		</div>
		<div id="container">
		<div id="content">
		<div class="loginname">
		<?php 
        if ($member->isLoggedIn()) {
            echo _LOGGEDINAS . ' ' . $member->getDisplayName() . " - <a href='index.php?action=logout'>" . _LOGOUT . "</a>" . "<br /><a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
        } else {
            echo '<a href="index.php?action=showlogin" title="Log in">', _NOTLOGGEDIN, '</a> <br />';
        }
        echo "<a href='" . $CONF['IndexURL'] . "'>" . _YOURSITE . "</a>";
        echo '<br />(';
        $codenamestring = $nucleus['codename'] != '' ? ' &quot;' . $nucleus['codename'] . '&quot;' : '';
        if ($member->isLoggedIn() && $member->isAdmin()) {
            $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
            echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">Nucleus CMS ' . $nucleus['version'] . $codenamestring . '</a>';
            $newestVersion = getLatestVersion();
            $newestCompare = str_replace('/', '.', $newestVersion);
            $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
            $currentVersion = floatval($currentVersion);
            if ($newestVersion && version_compare($newestCompare, $currentVersion) > 0) {
                echo '<br /><a style="color:red" href="' . _ADMINPAGEFOOT_OFFICIALURL . 'upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
            }
        } else {
            echo 'Nucleus CMS ' . $nucleus['version'] . $codenamestring;
        }
        echo ')';
        echo '</div>';
    }
Example #5
0
function checkIfLatest()
{
    global $gbl, $sgbl, $login, $ghtml;
    $latest = getLatestVersion();
    return $latest === $sgbl->__ver_major_minor_release;
}
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
    if (file_exists($certs)) {
        curl_setopt($curl, CURLOPT_CAINFO, $certs);
    }
    $rawout = curl_exec($curl);
    if ($rawout === false) {
        echo 'Curl error: ' . curl_error($curl) . "\n";
    }
    curl_close($curl);
    return $rawout;
}
//main
$version = getLatestVersion();
$currentversion = getCurrentVersion($target_folder);
echo "<pre>\n";
//for readable browser output
print_r(array('new_version' => $version->version, 'date' => $version->date, 'current' => $currentversion, 'update' => $version->version != $currentversion ? true : false));
if (!empty($version->version) && $version->version != $currentversion) {
    echo "New version detected - starting Update\n";
    $newpmaname = 'phpMyAdmin-' . $version->version . '-all-languages';
    //multilingual version
    $newpmazipfilename = $newpmaname . '.zip';
    //only ZIP version supported
    $newpmazipurl = 'https://files.phpmyadmin.net/phpMyAdmin/' . $version->version . '/' . $newpmazipfilename;
    //URL since 2015-07
    //download start
    $dl_file = download_pma($newpmazipurl, $ca_certs);
    if ($dl_file === false) {
Example #7
0
/**
 * Automatically check for the latest version and if it is newer, upgrade
 *
 * @return bool True on success, false otherwise
 */
function autoUpgrade()
{
    global $jTips;
    $returnVal = false;
    if ($jTips['AutoUpgrade'] == 1) {
        if (getLastUpdateCheckDate() < gmdate('Y-m-d H:i:s', strtotime("-2 weeks"))) {
            $latestVersion = getLatestVersion();
            $latestVersionArray = explode('.', $latestVersion);
            $thisVersion = getFullVersion();
            $thisVersionArray = explode('.', $thisVersion);
            if (count($thisVersionArray) != count($latestVersionArray)) {
                jTipsLogger::_log('incompatible versions!', 'ERROR');
                $returnVal = false;
            } else {
                $doUpgrade = false;
                jTipsLogger::_log('comparing this version against latest version');
                for ($i = 0; $i < count($thisVersionArray); $i++) {
                    if ($latestVersionArray[$i] > $thisVersionArray[$i]) {
                        $doUpgrade = true;
                    }
                }
                if ($doUpgrade) {
                    jTipsLogger::_log('about to do auto upgrade');
                    $result = updatejTipsFiles();
                    if (is_bool($result)) {
                        //BUG 262 - AutoUpgrade to version message corrected
                        $_SESSION['jtips_upgraded_version'] = $latestVersion;
                        $returnVal = intval($result);
                    } else {
                        $returnVal = $result;
                    }
                }
            }
        }
        setLastUpdateCheckDate();
        return $returnVal;
    }
    return false;
}
Example #8
0
function showComboDiff($keyword, $db=NULL) {

    global $SessSemName;

    $version2=getLatestVersion($keyword, $SessSemName[1]);
    $version1=getFirstVersion($keyword, $SessSemName[1]);
    $version2=$version2["version"];
    $version1=$version1["version"];

    showPageFrameStart();
    wikiSinglePageHeader($wikiData, $keyword);

    echo "\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";

    // create combodiff

    $wd1 = getWikiPage($keyword, $version1);
    $diffarray1 = toDiffLineArray($wd1['body'], $wd1['user_id']);
    $current_version = $version1 + 1;
    $differ = new line_diff();
    while ($current_version <= $version2) {
        $wd2 = getWikiPage($keyword, $current_version);
        if ($wd2) {
            $diffarray2 = toDiffLineArray($wd2['body'], $wd2['user_id']);
            $newarray = $differ->arr_compare("diff", $diffarray1, $diffarray2);
            $diffarray1=array();
            foreach ($newarray as $i) {
                if ($i->status["diff"] != "-") {
                    $diffarray1[]=$i;
                }
            }
        }
        $current_version++;
    }
    $content="<table>";
    $count=0;
    $authors=array();
    foreach ($diffarray1 as $i) {
        if ($i && !in_array($i->who, $authors)) {
            $authors[]=$i->who;
            if ($count % 4 == 0) {
                $content.= "<tr width=\"100%\">";
            }
            $content.= "<td bgcolor=".create_color($count)." width=14>&nbsp;</td><td><font size=-1>".get_fullname($i->who,'full',1)."</font></td><td>&nbsp;</td>";
            if ($count % 4 == 3) {
                $content .= "</tr>";
            }
            $count++;
        }
    }
    echo "<tr><td class=\"table_row_even\" colspan=2>";
    echo "<p><font size=-1>&nbsp;<br>";
    echo _("Legende der Autor/-innenfarben:");
    echo "<table cellpadding=6 cellspacing=6>$content</table>\n";
    echo "</p>";
    echo "<table cellpadding=0 cellspacing=0 width=\"100%\">";
    $last_author=None;
    $collect="";
    $diffarray1[]=NULL;
    foreach ($diffarray1 as $i) {
        if (!$i || $last_author != $i->who) {
            if (trim($collect)!="") {
                $idx=array_search($last_author, $authors);
                $col=create_color($idx);
                echo "<tr bgcolor=$col>";
                echo "<td width=30 align=center valign=top>";
                echo Icon::create('info-circle', 'inactive', ['title' => _("Änderung von").' ' . get_fullname($last_author)])->asImg();
                echo "</td>";
                echo "<td><font size=-1>";
                echo wikiReady($collect);
                echo "</font></td>";
                echo "</tr>";
            }
            $collect="";
        }
        if ($i) {
            $last_author = $i->who;
            $collect .= $i->text;
        }
    }
    echo "</table></td></tr>";
    echo "</table>     ";
    getDiffPageInfobox($keyword);
    showPageFrameEnd();
}