Example #1
0
function da_var_export($input, $f = 1, $t = null)
{
    $output = '';
    if (is_array($input)) {
        $output .= "array(\r\n";
        foreach ($input as $key => $value) {
            $output .= $t . "\t" . da_var_export($key, $f, $t . "\t") . ' => ' . da_var_export($value, $f, $t . "\t");
            $output .= ",\r\n";
        }
        $output .= $t . ')';
    } elseif (is_string($input)) {
        $output .= $f ? "'" . str_replace(array("\\", "'"), array("\\\\", "\\'"), $input) . "'" : "'{$input}'";
    } elseif (is_int($input) || is_double($input)) {
        $output .= "'" . (string) $input . "'";
    } elseif (is_bool($input)) {
        $output .= $input ? 'true' : 'false';
    } else {
        $output .= 'NULL';
    }
    return $output;
}
Example #2
0
<?php

/**
 * @package iCMS V3.1
 * @copyright 2007-2009, iDreamSoft
 * @license http://www.idreamsoft.cn iDreamSoft
 * @author coolmoo <*****@*****.**>
 */
!defined('iPATH') && exit('What are you doing?');
switch ($operation) {
    case 'post':
        if ($action == 'edit') {
            $sources = explode("\r\n", dhtmlspecialchars($_POST['source']));
            $authors = explode("\r\n", dhtmlspecialchars($_POST['author']));
            $editors = explode("\r\n", dhtmlspecialchars($_POST['author']));
            writefile(iPATH . 'include/default.value.php', "<?php\n\$sources=" . da_var_export($sources) . ";\n\$authors=" . da_var_export($authors) . ";\n\$editors=" . da_var_export($editors) . ";\n?>");
            _Header(__SELF__ . '?do=default');
        }
        break;
    default:
        $Admin->MP("menu_article_default");
        include_once iPATH . 'include/default.value.php';
        include iCMS_admincp_tpl('default');
}