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: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177:
<?php
function getPHPFiles($folder, $exclude) {
global $files;
$dir = opendir($folder);
while (($file = readdir($dir)) !== false) {
$file = str_replace('\\', '/', $file);
if ($file != '.' && $file != '..') {
if (is_dir($folder . '/' . $file) && !in_array($file, $exclude)) {
getPHPFiles($folder . '/' . $file, $exclude);
} else {
if (getSuffix($file) == 'php') {
$entry = $folder . '/' . $file;
$files[] = $entry;
}
}
}
}
closedir($dir);
return $files;
}
function formatList($title, $subject, $pattern) {
global $deprecated;
preg_match_all($pattern, $subject, $matches);
$started = false;
if ($matches && !empty($matches[0])) {
foreach (array_unique($matches[2]) as $key => $match) {
$details = $deprecated->unique_functions[strtolower($match)];
$found = $matches[1][$key];
switch ($details['class']) {
case 'static':
if ($found == '->' || $found == '::') {
$class = '*';
break;
} else {
continue 2;
}
case 'final static':
if ($found == '->' || $found == '::') {
$class = '*+';
break;
} else {
continue 2;
}
case 'public static':
if ($found == '->' || $found == '::') {
continue 2;
} else {
$class = '+';
break;
}
default:
if ($found == '->' || $found == '::') {
continue 2;
} else {
$class = '';
break;
}
}
if (!$started) {
$started = true;
echo '<li class="warningbox nobullet"> ' . $title;
echo '<ul>';
}
echo '<li>' . $match . $class . '</li>';
}
}
if ($started)
echo '</ul></li>';
return $started;
}
function listUses($files, $base, $pattern) {
if (is_array($files)) {
$open = $output = false;
$oldLocation = '';
foreach ($files as $file) {
if (basename($file) != 'deprecated-functions.php') {
@set_time_limit(120);
$subject = file_get_contents($file);
$location = str_replace($base . '/', '', dirname($file));
$folders = explode('/', $location);
if ($folders[0] != $oldLocation) {
$oldLocation = $folders[0];
echo '<br /><strong>' . $location . '</strong>';
}
if ($open) {
echo '</ul>';
}
$script_location = $base . '/' . $location . '/';
$script = str_replace($script_location, '', $file);
$open = $output = formatList($script, $subject, $pattern);
}
}
if ($open) {
echo '</ul>';
}
if ($output) {
?>
<p class="messagebox"><?php echo gettext('No calls on deprecated functions were found.'); ?></p>
<?php
}
return $output;
}
}
function listDBUses($pattern) {
$lookfor = array('images', 'albums', 'news', 'pages');
$found = array();
foreach ($lookfor as $table) {
echo '<br /><strong>' . sprintf(gettext('%s table'), $table) . '</strong>';
$output = false;
$sql = 'SELECT * FROM ' . prefix($table) . ' WHERE `codeblock` <> "" and `codeblock` IS NOT NULL and `codeblock`!="a:0:{}"';
$result = query($sql);
while ($row = db_fetch_assoc($result)) {
$codeblocks = getSerializedArray($row['codeblock']);
foreach ($codeblocks as $key => $codeblock) {
switch ($table) {
case 'news':
case 'pages':
$what = $row['titlelink'] . '::' . $key;
break;
case 'images':
$album = getItemByID('albums', $row['albumid']);
$what = $album->name . ':' . $row['filename'] . '::' . $key;
break;
case 'albums':
$what = $row['folder'] . '::' . $key;
break;
}
if (formatList($what, $codeblock, $pattern))
$output = true;
}
}
if ($output) {
echo '</ul>';
} else {
?>
<p class="messagebox"><?php echo gettext('No calls on deprecated functions were found.'); ?></p>
<?php
}
}
return $output;
}
?>