WebOrbiton

Code

PriviMetrics 2

Modern, fast analytics for your websites.

Version history

Version 1.0.1 2026-09-26

Browse files
Files changed5
Lines added+12
Lines removed-47
settings.php Modified +3 -25
⋮ 1011 unchanged lines ⋮
  
                  <div class="panel">
                      <h2>System Version</h2>
-                     <p class="desc">Current application build and release details.</p>
- 
-                     <?php
-                     $versionInfo = include __DIR__ . '/version.php';
-                     ?>
+                     <p class="desc">Current application version.</p>
  
                      <div class="form-group">
                          <label><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:6px;">
⋮ 1 unchanged line ⋮
                                  <polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>
                                  <line x1="12" y1="22.08" x2="12" y2="12"></line>
                              </svg>Version</label>
-                         <input type="text" value="<?= sanitize($versionInfo['version'] . ' ' . $versionInfo['stage']) ?>" disabled style="opacity: 0.8; cursor: not-allowed;">
-                     </div>
- 
-                     <div class="row">
-                         <div class="form-group">
-                             <label><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:6px;">
-                                     <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
-                                     <line x1="16" y1="2" x2="16" y2="6"></line>
-                                     <line x1="8" y1="2" x2="8" y2="6"></line>
-                                     <line x1="3" y1="10" x2="21" y2="10"></line>
-                                 </svg>Release Date</label>
-                             <input type="text" value="<?= sanitize($versionInfo['release_date']) ?>" disabled style="opacity: 0.8; cursor: not-allowed;">
-                         </div>
-                         <div class="form-group">
-                             <label><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:6px;">
-                                     <path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path>
-                                 </svg>Stability Status</label>
-                             <input type="text" value="<?= $versionInfo['stable'] ? 'Stable' : 'Unstable / Testing' ?>" disabled style="opacity: 0.8; cursor: not-allowed;">
-                         </div>
+                         <input type="text" value="<?= sanitize($currentVersion) ?>" disabled style="opacity: 0.8; cursor: not-allowed;">
                      </div>
                  </div>
  
⋮ 221 unchanged lines ⋮
  
                  <div class="panel" id="updates">
                      <h2>Updates</h2>
-                     <p class="desc">Installed version <strong><?= sanitize($currentVersion['version'] ?? '?') ?></strong><?= !empty($currentVersion['stage']) ? ' (' . sanitize($currentVersion['stage']) . ')' : '' ?>. <?= env('AUTO_UPDATE', 'false') === 'true' ? '<strong>Automatic updates are enabled:</strong> new versions are installed by cron without review.' : 'The update server is contacted only when you open the updater and press a button.' ?></p>
+                     <p class="desc">Installed version <strong><?= sanitize($currentVersion) ?></strong>. <?= env('AUTO_UPDATE', 'false') === 'true' ? '<strong>Automatic updates are enabled:</strong> new versions are installed by cron without review.' : 'The update server is contacted only when you open the updater and press a button.' ?></p>
                      <a href="updater.php" class="btn" style="display:inline-block;">Check for updates</a>
                  </div>
  
⋮ 122 unchanged lines ⋮
updater-functions.php Modified +7 -8
⋮ 1 unchanged line ⋮
  
  declare(strict_types=1);
  
- const PM_UPDATE_URL = 'https://weborbiton.eu/updater/';
+ const PM_UPDATE_URL = 'https://weborbiton.eu/updater/privimetrics/';
  const PM_UPDATE_KEEP_BACKUPS = 5;
  const PM_UPDATE_BACKUP_MAX_AGE_DAYS = 30;
  const PM_UPDATE_TEXT_EXT = ['php', 'js', 'css', 'txt', 'svg', 'md', 'htaccess', 'json', 'html'];
⋮ 3 unchanged lines ⋮
  {
  }
  
- function pmUpdateCurrent(): array
+ function pmUpdateCurrent(): string
  {
-     $info = is_file(PM_ROOT . '/version.php') ? (require PM_ROOT . '/version.php') : [];
-     return is_array($info) ? $info : [];
+     return trim((string) @file_get_contents(PM_ROOT . '/version.txt')) ?: '0.0.0';
  }
  
  function pmUpdateHttp(string $url, ?string $saveTo = null, int $timeout = 20): string
⋮ 13 unchanged lines ⋮
              CURLOPT_CONNECTTIMEOUT => 10,
              CURLOPT_SSL_VERIFYPEER => true,
              CURLOPT_SSL_VERIFYHOST => 2,
-             CURLOPT_USERAGENT => 'PriviMetrics-Updater/' . (pmUpdateCurrent()['version'] ?? '0'),
+             CURLOPT_USERAGENT => 'PriviMetrics-Updater/' . pmUpdateCurrent(),
          ]);
          if ($fp) {
              curl_setopt($ch, CURLOPT_FILE, $fp);
⋮ 53 unchanged lines ⋮
      }
      $data['version'] = $m[0];
      $data['changelog'] = array_values(array_map('strval', (array) ($data['changelog'] ?? [])));
-     $data['is_newer'] = version_compare($data['version'], (string) (pmUpdateCurrent()['version'] ?? '0'), '>');
+     $data['is_newer'] = version_compare($data['version'], pmUpdateCurrent(), '>');
      return $data;
  }
  
⋮ 30 unchanged lines ⋮
      $best = null;
      for ($i = 0; $i < $zip->numFiles; $i++) {
          $name = (string) $zip->getNameIndex($i);
-         if (in_array(basename($name), ['version.php', 'version.txt'], true) && ($best === null || strlen($name) < strlen($best))) {
+         if (in_array(basename($name), ['version.txt'], true) && ($best === null || strlen($name) < strlen($best))) {
              $best = $name;
          }
      }
⋮ 257 unchanged lines ⋮
          if (!$manifest['is_newer']) {
              throw new PmUpdateException('You are already on the latest version.');
          }
-         $from = (string) (pmUpdateCurrent()['version'] ?? '?');
+         $from = pmUpdateCurrent();
  
          $zipPath = pmUpdateDownload($manifest);
          [$zip, $prefix] = pmUpdateOpenZip($zipPath);
⋮ 65 unchanged lines ⋮
updater.php Modified +1 -1
⋮ 803 unchanged lines ⋮
  
                  <div class="panel">
                      <h2>Updates</h2>
-                     <p class="desc">Installed version <strong><?= sanitize($currentVersion['version'] ?? '?') ?></strong><?= !empty($currentVersion['stage']) ? ' (' . sanitize($currentVersion['stage']) . ')' : '' ?>. The update server is contacted only when you press a button. Before installing, all program files are backed up to data/backups/. Your data and settings are never touched.</p>
+                     <p class="desc">Installed version <strong><?= sanitize($currentVersion) ?></strong>. The update server is contacted only when you press a button. Before installing, all program files are backed up to data/backups/. Your data and settings are never touched.</p>
  
                      <?php if ($updateInfo): $um = $updateInfo['manifest']; $up = $updateInfo['plan'] ?? null; ?>
                          <div class="flash success" style="margin-bottom:14px;">
⋮ 110 unchanged lines ⋮
version.php Removed +0 -12
- <?php
- return [
- 
-     'version'      => trim((string) @file_get_contents(__DIR__ . '/version.txt')) ?: '0.0.0',
- 
-     'stage'        => 'Stable',
- 
-     'release_date' => '2026-09-26',
- 
-     'stable'       => false,
- ];
- 
version.txt Modified +1 -1
- 1.0.0
+ 1.0.1