Ejemplo n.º 1
0
function run_update($pre_version)
{
    global $modx;
    $pre_version = strtolower($pre_version);
    $pre_version = str_replace(array('j', 'rc', '-r'), array('', 'RC', '-'), $pre_version);
    if (version_compare($pre_version, '1.0.5') < 0) {
        update_tbl_system_settings();
        $msg = 'Update before 1.0.5';
        $modx->logEvent(0, 1, $msg, $msg);
    }
    if (version_compare($pre_version, '1.0.6') < 0) {
        update_config_custom_contenttype();
        update_config_default_template_method();
        $msg = 'Update before 1.0.6';
        $modx->logEvent(0, 1, $msg, $msg);
    }
    if (version_compare($pre_version, '1.0.7') < 0) {
        disableLegacyPlugins();
        $msg = 'Update before 1.0.7';
        $modx->logEvent(0, 1, $msg, $msg);
    }
    if (0 < version_compare($pre_version, '1.0.4') && version_compare($pre_version, '1.0.7') < 0) {
        delete_actionphp();
        $msg = 'Delete action.php is success';
        $modx->logEvent(0, 1, $msg, $msg);
    }
    if (0 <= version_compare($pre_version, '1.0.8')) {
        updateMenus();
        $msg = 'Update menu';
        $modx->logEvent(0, 1, $msg, $msg);
    }
    update_tbl_user_roles();
    disableOldFckEditor();
}
Ejemplo n.º 2
0
    $price = $_GET['q'];
    $quantity = $_GET['r'];
    $menuid = $_GET['u'];
    date_default_timezone_set('America/Chicago');
    $date = date('m/d/Y h:i:s a', time());
    $query = "UPDATE menu_items SET name='" . $menuitem . "', price='" . $price . "' , description='" . $description . "' , quantity='" . $quantity . "' , menu_category_id='" . $category . "' WHERE id='" . $menuid . "'";
    $data = $mysqli->query($query);
    if ($data) {
        echo "Menu Item Updated";
        exit;
    } else {
        echo "Failed to save" . "\n";
        exit;
    }
}
function updateMenus($mysqli)
{
    if (!empty($_GET['p'])) {
        $query = $mysqli->query("SELECT id FROM menu_items WHERE name = '" . $_GET['p'] . "'");
        $row = $query->fetch_array(MYSQLI_BOTH);
        if (!$row || $row['id'] == $_GET['u']) {
            UpdateMenuItems($mysqli);
        } else {
            echo "Menu Item Name already exists.Please enter a different name";
        }
    } else {
        echo "Please Enter All the Details";
    }
}
updateMenus($mysqli);