phplist /public_html/lists/admin/checki18n.php

Language PHP Lines 94
MD5 Hash a30866213fb0730c6c43d4a77d05e0e0
Repository https://github.com/samtuke/phplist.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php

require_once dirname(__FILE__).'/accesscheck.php';

$_SESSION['show_translation_colours'] = 1;

print '<p class="button">'.PageLink2('checki18n&amp;changedonly=yes','Show changes only').'</p>';
# translation check. See that every token has a text in a file and vv

function getFileI18Ntags($file) {
  $res = array();
  if (!is_file($file))
    return $res;
  $fd = fopen ($file, "r");
  $contents = fread ($fd, filesize ($file));
  fclose ($fd);
  preg_match_all('/\$GLOBALS\[(["|\'])I18N\1\]->get\((["|\'])([^\2]+)\2\)/Uim', $contents, $globalsi18ntags);
  preg_match_all('/\$I18N->get\((["|\'])([^\1]+)\1\)/Uim', $contents, $i18ntags);
  for ($i=0; $i< count($globalsi18ntags[0]); $i++) {
    array_push($res,$globalsi18ntags[3][$i]);
  }
  for ($i=0; $i< count($i18ntags[0]); $i++) {
    array_push($res,$i18ntags[2][$i]);
  }
  return $res;
}

function checkI18NDir($rootdir) {
  $dir = opendir($rootdir);
  while ($file = readdir($dir)) {
    $fileoutput = '';
    $some = 0;
    if (is_file($rootdir.'/'.$file)) {
      $fileoutput .= '<hr/><h3>'.$file."</h3><br/>";
      $arr = getFileI18Ntags($rootdir.'/'.$file);
      $lan = array();
  #    include 'lan/en/'.$file;
      switch ($file) {
        case 'send_core.php':
          $_GET['page'] = 'send';break;
        case 'importcsv.php':
          $_GET['page'] = 'import2';break;
        default:
          $_GET['page'] = basename($file,'.php');
      }
  /*    $page = $_GET['page'];
      include_once dirname(__FILE__)."/lan/".$_SESSION['adminlanguage']['iso']."/pagetitles.php";
      if (!strtolower($page_title) === 'phplist') {
        print "No page title: $page<br/>";
      } else {
        print "Page title: $page, $page_title<br/>";
      }
  */  foreach ($arr as $tag) {
        $translation = $GLOBALS['I18N']->get(stripslashes($tag));
        if (!isset($_GET['changedonly']) || ($_GET['changedonly'] === 'yes' && preg_match('/ff1717/i',$translation))) {
          $fileoutput .= "'".$tag.'\' =&gt; \''.$translation.'\',<br/>';
          $some = 1;
        }
      }
      if ($some) {
        print $fileoutput;
      }
  #      print "RES: $tag<br/>";
  #    }
  #      if (!in_array($tag,$lan)) {
  #        print "Missing: $tag<br/>";
  #      } else {
  #        print "Exists: $tag<br/>";
  #      }
  #    }
    }
  }
}

/*
print '
<script language="Javascript" type="text/javascript">

function selectAll() {
  document.form.content.focus();document.form.content.select();
}

</script>

<a href="javascript:selectAll()">Select All</a><br/>';

#print '<form name="form">';
print '<textarea name="content" rows="50" cols="60">';
*/
checkI18NDir(dirname(__FILE__));
checkI18NDir(dirname(__FILE__).'/commonlib/pages/');
#print '</textarea>';
print '</form>';
Back to Top