예제 #1
0
function addElemToStorage()
{
    require_once "textstorageconnection.php";
    $mas = getArrayFromFile("buyers");
    $buyer = new buyer();
    $buyer->id = uniqid();
    $buyer->name = $_POST["addName"];
    $buyer->adress = $_POST["addAdress"];
    $buyer->phone = $_POST["addPhone"];
    $mas[count($mas)] = $buyer;
    writeArrayToFile("buyers", $mas);
}
예제 #2
0
function addElemToStorage()
{
    require_once "textstorageconnection.php";
    $mas = getArrayFromFile("cars");
    $car = new Car();
    $car->id = uniqid();
    $car->brand = $_POST["addBrand"];
    $colors = "";
    foreach ($_POST["addColor"] as $currentColor) {
        $colors .= $currentColor;
        $colors .= ", ";
    }
    $colors = substr($colors, 0, -2);
    $car->color = $colors;
    $car->date = $_POST["addDate"]["month"] . "." . $_POST["addDate"]["year"];
    $car->price = $_POST["addPrice"];
    $car->percent = $_POST["addPercent"];
    $mas[count($mas)] = $car;
    writeArrayToFile("cars", $mas);
}
예제 #3
0
        $target = "cars";
        break;
    case "Owner":
        $target = "owners";
        break;
    case "Buyer":
        $target = "buyers";
        break;
}
$mas = getArrayFromFile($target);
foreach ($mas as $k => $v) {
    if ($v->id == $id) {
        $isDeleted = true;
        unset($mas[$k]);
    }
}
$mas = array_values($mas);
writeArrayToFile($target, $mas);
if ($isDeleted) {
    echo "<h4>Запись успешно удалена</h4>";
} else {
    echo "Запись не найдена";
}
?>
<form action=start.php method=POST role=form>
    <div class="form-group">
        <button class="btn btn-primary" type="submit">Назад</button>
    </div>
</form>
</body>
</html>
예제 #4
0
파일: save.php 프로젝트: joomux/jTips
 *
 * Description: Saves the edited language key definition
 * to the jLang array and writes the array to
 * the language file.
 *
 * Allows complete language customisation
 */
global $mainframe, $jLang, $mosConfig_lang, $mosConfig_absolute_path;
//Make sure this is not a hack job
jTipsSpoofCheck();
//set the edited field
$key = jTipsGetParam($_REQUEST, 'languageKey', '');
$val = jTipsHTML::cleanText(jTipsGetParam($_REQUEST, 'languageVar', ''));
$jLang[$key] = trim($val);
ksort($jLang);
if (writeArrayToFile('jLang', $jLang, 'components/com_jtips/i18n/' . $mosConfig_lang . '.php')) {
    //BUG 265 - delete the existing js language file if it exists
    // BUG 320 - Fixed typo in path to js language file
    $jsLangFile = $mosConfig_absolute_path . '/components/com_jtips/js/language.js';
    if (jTipsFileExists($jsLangFile)) {
        if (isJoomla15()) {
            jimport('joomla.filesystem.file');
            JFile::delete($jsLangFile);
        } else {
            unlink($jsLangFile);
        }
    }
    $message = $jLang['_ADMIN_LANGUAGE_UPDATED'];
} else {
    $message = $jLang['_ADMIN_LANGUAGE_UPDATE_FAILED'];
}
예제 #5
0
                        writeArrayToFile($files, $manifest);
                    } else {
                        echo "Manifest file is not writable.   Dumping output\n\n";
                        print_r($files);
                    }
                } else {
                    if ($vars['action'] == "remove") {
                        if (count($vars['files']) == 0) {
                            exit("No files given.\n");
                        }
                        foreach ($vars['files'] as $file) {
                            echo "Removing file {$file}\n";
                            unset($files[$file]);
                        }
                        if (is_really_writable(dirname($manifest))) {
                            writeArrayToFile($files, $manifest);
                        } else {
                            echo "Manifest file is not writable.   Dumping output\n\n";
                            print_r($files);
                        }
                    }
                }
            }
        }
    }
}
function processArguments($args, $validator_callback = "")
{
    $vars = array("action" => "", "type" => "module", "name" => "", "files" => array());
    for ($i = 1; $i < count($args); $i++) {
        switch ($args[$i]) {
예제 #6
0
파일: save.php 프로젝트: joomux/jTips
 * @since 2.1 - 09/10/2008
 * @version 2.1
 * @package jTips
 * 
 * Description: 
 */
jTipsSpoofCheck();
global $jTips, $jLang, $task;
// include('components/com_jtips/configuration.jtips.php');
if (empty($_POST)) {
    mosRedirect('index2.php?option=com_jtips&module=Dashboard', 'Restricted Access');
}
ksort($_POST);
$new_config = array();
foreach ($_POST as $key => $val) {
    if (preg_match('/^[A-Z]/', $key)) {
        $new_config[$key] = $val;
    }
}
$filename = 'components/com_jtips/config.jtips.php';
if (writeArrayToFile('jTips', $new_config, $filename)) {
    $message = $jLang['_ADMIN_CONFIG_SAVE_SUCCESS'];
} else {
    $message = $jLang['_ADMIN_CONFIG_SAVE_FAILURE'];
    //"Error: The file $filename is not writable";
}
if ($task == 'apply') {
    mosRedirect('index2.php?option=com_jtips&hidemainmenu=1&module=Configuration', $message);
} else {
    mosRedirect('index2.php?option=com_jtips&module=Dashboard', $message);
}