Example #1
0
if ($user->perm->checkRight($user->getUserId(), 'editinstances')) {
    $instance = new PMF_Instance($faqConfig);
    $instanceId = PMF_Filter::filterInput(INPUT_POST, 'instance_id', FILTER_VALIDATE_INT);
    // Check, if /multisite is writeable
    if (!is_writable(PMF_ROOT_DIR . DIRECTORY_SEPARATOR . 'multisite')) {
        printf('<p class="alert alert-danger">%s</p>', $PMF_LANG["ad_instance_error_notwritable"]);
    }
    // Update client instance
    if ('updateinstance' === $action && is_integer($instanceId)) {
        $system = new PMF_System();
        $clientInstance = new PMF_Instance_Client($faqConfig);
        // Collect data for database
        $data = [];
        $data['instance'] = PMF_Filter::filterInput(INPUT_POST, 'instance', FILTER_SANITIZE_STRING);
        $data['comment'] = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRING);
        if ($clientInstance->updateInstance($instanceId, $data)) {
            printf('<p class="alert alert-success">%s%s</p>', '<a class="close" data-dismiss="alert" href="#">&times;</a>', $PMF_LANG['ad_config_saved']);
        } else {
            printf('<p class="alert alert-danger">%s%s<br/>%s</p>', '<a class="close" data-dismiss="alert" href="#">&times;</a>', $PMF_LANG['ad_entryins_fail'], $faqConfig->getDb()->error());
        }
    }
    ?>
    <table class="table">
        <thead>
        <tr>
            <th>#</th>
            <th><?php 
    echo $PMF_LANG["ad_instance_url"];
    ?>
</th>
            <th><?php