コード例 #1
0
<?php

class module_updates_global
{
}
global $mod;
$mod->modules[$MODULE_NAME] = new module_updates_global();
if (defined('IN_UPDATES_GLOBAL') && IN_UPDATES_GLOBAL) {
    if (isset($_GET['function'])) {
        switch ($_GET['function']) {
            case 'check_for_updates':
                if (isset($_POST['XML'])) {
                    include './app/lib/simplexmlextended.class.php';
                    $xml = new SimpleXMLElementExtended(html_entity_decode(stripslashes($_POST['XML'])));
                    $modules = $xml->xpath('//module');
                    $count = count($modules);
                    if ($count > 0) {
                        $sql = new MySQLObject();
                        $query = "\r\nSELECT `code`,`type`,`date`,`name`,`modules`\r\nFROM " . $sql->table('updates_global') . "\r\nWHERE\r\n(";
                        $i = 0;
                        foreach ($modules as $module) {
                            $query .= "\r\n\t`modules` LIKE '%" . $module . "%'";
                            if ($i < $count - 1) {
                                $query .= " OR ";
                            }
                            $i++;
                        }
                        $query .= "\r\n)\r\nORDER BY `date` ASC";
                        if (!$sql->query($query)) {
                            echo 'ERROR';
                        } else {