Example #1
0
<?php

session_start();
require __DIR__ . '/../function/news-plus.php';
$article['image'] = $_POST['image'];
if (isset($_POST)) {
    $article = [];
    if (!empty($_POST['header'])) {
        $article['header'] = $_POST['header'];
        if (!empty($_POST['padding'])) {
            $article['padding'] = $_POST['padding'];
            if (headers($article)) {
                if (padding($article)) {
                    if (!empty($_FILES)) {
                        $res = image($_FILES);
                        if (false !== $res) {
                            $article['image'] = $res;
                            if (isset($article['header']) && isset($article['padding']) && isset($article['image'])) {
                                News::article_put($article);
                                header('Location:http://new/index.php?cntr=Newsed&act=All');
                                exit;
                            }
                        } else {
                            if (isset($article['header']) && isset($article['padding'])) {
                                News::article_two_put($article);
                                header('Location:http://new/index.php?cntr=Newsed&act=All');
                                exit;
                            }
                        }
                    } else {
                        $_SESSION['error'] = 'Статья не написана!';
Example #2
0
    //<![CDATA[
    scroll_active = true;
    function empty_field_and_submit(){
        document.fdummy.arsc_message.value=document.f.arsc_message.value;
        document.fdummy.submit();
        document.f.arsc_message.focus();
        document.f.arsc_message.select();
        return false;
    }
    //]]>
    </script>
    </head><body OnLoad="document.f.arsc_message.focus();document.f.arsc_message.select();">;
EOD;
// Dummy data that gets output to the browser as needed, in order to make it show output
global $CHAT_DUMMY_DATA;
$CHAT_DUMMY_DATA = padding(200);
/**
 * @param int $n
 * @return string
 */
function padding($n)
{
    $str = '';
    for ($i = 0; $i < $n; $i++) {
        $str .= "<!-- nix -->\n";
    }
    return $str;
}
/**
 * Given an object containing all the necessary data,
 * (defined by the form in mod_form.php) this function
Example #3
0
$column->setAttribute('type', '');
$table->appendChild($column);
$dom->appendChild($table);
/*
 * The default indentation of DOMDocument is 2 spaces, replace them with 4 
 * spaces instead 
 */
$content = preg_replace_callback('@^( +)<@m', function ($matches) {
    return str_repeat(' ', (int) strlen($matches[1] / 2) * 4) . '<';
}, $dom->saveXML());
/*
 * Guratee that both schema file is saved and the db_migration is updated 
 * atomically
 */
if (fwrite($schemaFile, $content) === false) {
    throw new CLIException('Unable to save ' . $schemaFilePath);
} else {
    fclose($schemaFile);
    if (!($migrationFile = fopen($migrationFilePath, 'wb'))) {
        throw new CLIException('Unable to open and truncate' . $migrationFilePath);
    }
    if (fwrite($migrationFile, $schemaContent) === false) {
        throw new CLIException("Unable to save `{$migrationFilePath}`");
        unlink($schemaFilePath);
    } else {
        fclose($migrationFile);
    }
}
$output = '===== Created schema file: ' . $schemaFilePath . ' ';
echo padding($output);
$return = array('file' => $schemaFileName, 'path' => $schemaFilePath);