Changeset 379 for trunk/admin/admin.php


Ignore:
Timestamp:
Oct 16, 2022, 10:39:05 PM (19 months ago)
Author:
roby
Message:

ADMIN seconda rev sperimentale per l'implementazione della funzione di aggiornamento.

  • Eliminate le voci di menu: Gestione tipi e Segnala l'installazione a Eleonline
  • Aggiunta la voce di menu: Aggiornamento
  • Modificata la funzione di aggiornamento
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/admin.php

    r378 r379  
    207207        $multicomune=$row['multicomune'];
    208208}
    209 if(!isset($_SESSION['aggiornamento']) and isset($_SESSION['aid']) and ChiSei(0)==256)
    210 {
    211         $sql="SELECT COLUMN_NAME
    212         FROM INFORMATION_SCHEMA.COLUMNS
    213         WHERE TABLE_SCHEMA = '$dbname'
    214         AND TABLE_NAME = '".$prefix."_config'
    215         AND COLUMN_NAME = 'aggiornamento'";
    216         $sth = $dbi->prepare($sql);
    217         $sth->execute();
    218         if($sth->rowCount())
    219         {
    220                 $sth = $dbi->prepare("select aggiornamento from ".$prefix."_config");
    221                 $sth->execute();
    222                 list($agg)=$sth->fetch(PDO::FETCH_NUM);
    223                 $_SESSION['aggiornamento']=$agg;
    224                 if($agg) include('aggiornamento.php');
    225         }else{
    226                 $sql="ALTER TABLE `soraldo_config` ADD `aggiornamento` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '2' AFTER `ed_user`;";
    227                 $sth = $dbi->prepare($sql);
    228                 $sth->execute();
    229         }
    230 }
     209
    231210//fine
    232211        if (isset($param['tema'])) $_SESSION['tema']=$param['tema'];
     
    295274
    296275}
     276# si settano le variabili per il controllo degli aggiornamenti
     277if(!isset($_SESSION['localrev']) and isset($_SESSION['aid']) and ChiSei(0)==256)
     278{
     279        $sql="SELECT COLUMN_NAME
     280        FROM INFORMATION_SCHEMA.COLUMNS
     281        WHERE TABLE_SCHEMA = '$dbname'
     282        AND TABLE_NAME = '".$prefix."_config'
     283        AND COLUMN_NAME = 'aggiornamento'";
     284        $sth = $dbi->prepare($sql);
     285        $sth->execute();
     286        if(!$sth->rowCount())
     287        {               
     288                $sql="ALTER TABLE `soraldo_config` ADD `aggiornamento` ENUM('0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1' AFTER `ed_user`;";
     289                $sth = $dbi->prepare($sql);
     290                $sth->execute();
     291        }
     292        $sth = $dbi->prepare("select aggiornamento from ".$prefix."_config");
     293        $sth->execute();
     294        list($agg)=$sth->fetch(PDO::FETCH_NUM);
     295        $_SESSION['aggiornamento']=$agg;
     296###########
     297        $righe='';
     298        if(phpversion()<5.6) $host="http://80.211.143.127";
     299        else $host="https://trac.eleonline.it";
     300        if(false === $file = file("$host/ele3/changeset/")) {
     301                $newrev=0;
     302        }else{
     303                $cntFile = count($file);
     304                $fine=0;
     305                $currentLine=0;
     306
     307                foreach ($file as $line_num => $line) {
     308                        if(strpos($line,'<title>') ) {$fine=1; continue;}
     309                        if ($fine){
     310                                $newrev=(int) filter_var($line, FILTER_SANITIZE_NUMBER_INT);
     311                                break;
     312                        }
     313                }
     314        }
     315        include('versione.php');
     316        $myrev=intval(substr($versione,-4,4));
     317        $_SESSION['aggiornamento']=$agg;
     318        $_SESSION['localrev']=$myrev;
     319        $_SESSION['remoterev']=$newrev;         
     320        unset($file);           
     321#               if($agg) include('aggiornamento.php');
     322#die("local: ".$_SESSION['localrev'].$_SESSION['remoterev']);   
     323}
    297324if(!isset($_SESSION['BASE'])) $_SESSION['BASE']=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['REQUEST_URI'], "/")-16);
    298325if(!isset($language)) $language=$_SESSION['lang'];
     
    534561    include("modules/Elezioni/ele_tipi.php");
    535562        break;
     563    case "aggiorna":
     564    include("modules/Elezioni/aggiornamento.php");
     565        break;
    536566    case "constipi":
    537567    include("modules/Elezioni/ele_consultazionitipi.php");
    538         break;
    539     case "aggiorna":
    540     include("modules/Elezioni/aggiorna.php");
    541568        break;
    542569    case "parziali":
Note: See TracChangeset for help on using the changeset viewer.