Beispiel #1
0
 public function run($method, $para = array(), $return = "", $charset = "utf-8")
 {
     $result = "";
     if (isset($this->methods[$method])) {
         $result = call_user_func_array($this->methods[$method], $para);
     }
     if (empty($charset)) {
         $charset = "utf-8";
     }
     switch ($return) {
         case "j":
         case "json":
             $result = toJson($result, $charset);
             break;
         case "x":
         case "xml":
             $result = '<?xml version="1.0" encoding="' . $charset . '"?>' . "\n<mystep>\n" . toXML($result) . "</mystep>";
             header('Content-Type: application/xml; charset=' . $charset);
             break;
         case "s":
         case "string":
             $result = toString($result);
             break;
         default:
             break;
     }
     return $result;
 }
Beispiel #2
0
 function index()
 {
     $this->load->helper('xml');
     $order['date'] = 'desc';
     $configurationsResult = db_reads('configurations');
     $config = false;
     if ($configurationsResult) {
         foreach ($configurationsResult as $row) {
             $config[$row->name] = $row->value;
         }
     }
     $news = db_reads('page', array('type' => 'news', 'status' => 1), $order);
     $xml['channel'] = false;
     $xml['title'] = isset($config['websitename']) ? $config['websitename'] : false;
     $xml['link'] = base_url();
     $xml['item'] = false;
     if ($news) {
         $index = 0;
         foreach ($news as $newsrow) {
             if ($index < 5) {
                 $temp = false;
                 $temp['title'] = $newsrow->title;
                 $temp['link'] = base_url($newsrow->url);
                 $temp['description'] = $newsrow->content;
                 $xml['item'][] = $temp;
             }
             $index++;
         }
     }
     header("Content-Type: text/xml");
     echo toXML($xml, 'rss version="2.0"');
 }
/**
 * Sauvegarde la base de données
 * @param array $settings
 */
function saveSettings($settings = array())
{
    $filename = getSettingsName();
    $texte = toXML($settings);
    $file = fopen($filename, 'w+');
    fputs($file, $texte);
    fclose($file);
}
Beispiel #4
0
function import($f = null)
{
    if (!isset($f) || $f === null || !file_exists($f)) {
        throw new Exception("Character not found!");
    }
    global $file, $sheet, $xml;
    $file = $f;
    $sheet = load($f);
    $xml = toXML();
}
Beispiel #5
0
function toXML($data)
{
    foreach ($data as $node => $value) {
        if (is_numeric($node)) {
            $node = 'elem';
        }
        echo '<' . $node . '>';
        if (is_array($value) || is_object($value)) {
            toXML($value);
        } else {
            echo str_replace("&", "&amp;", $value);
        }
        echo '</' . $node . '>';
    }
}
Beispiel #6
0
include_once 'htmlDefault.php';
include_once 'scoreFunctions.php';
$action = $_GET["action"];
if (!isset($action)) {
    print $html_string;
    exit;
}
define("ACTION_FAILED", -1);
define("UNKNOWN_ACTION", -2);
$connection = mysql_connect("localhost", "cookbook", "cookbook") or die(mysql_error());
mysql_select_db('cookbook_highscores');
switch ($action) {
    case 'get':
        getPlayer();
        break;
    case 'set':
        setPlayer();
        break;
    case 'xml':
        toXML();
        break;
    case 'html':
        toHTML();
        break;
    case 'reset':
        resetDatabase();
        break;
    default:
        print UNKNOWN_ACTION;
}
mysql_close($connection);
Beispiel #7
0
function oldXML($ids)
{
    if (!is_array($ids)) {
        $ids = array($ids);
    }
    $feedData = array();
    foreach ($ids as $id) {
        $feedData[] = oldData($id);
    }
    return toXML($feedData);
}
Beispiel #8
0
    fwrite($fh, "    <prerun>" . toXML($hostoptions['prerun']) . "</prerun>" . PHP_EOL);
}
if (isset($hostoptions['postrun'])) {
    fwrite($fh, "    <postrun>" . toXML($hostoptions['postrun']) . "</postrun>" . PHP_EOL);
}
if (isset($hostoptions['qsub'])) {
    fwrite($fh, "    <qsub>" . toXML($hostoptions['qsub']) . "</qsub>" . PHP_EOL);
}
if (isset($hostoptions['jobid'])) {
    fwrite($fh, "    <qsub.jobid>" . toXML($hostoptions['jobid']) . "</qsub.jobid>" . PHP_EOL);
}
if (isset($hostoptions['qstat'])) {
    fwrite($fh, "    <qstat>" . toXML($hostoptions['qstat']) . "</qstat>" . PHP_EOL);
}
if (isset($hostoptions['job.sh'])) {
    fwrite($fh, "    <job.sh>" . toXML($hostoptions['job.sh']) . "</job.sh>" . PHP_EOL);
}
if ($hostname != $fqdn) {
    fwrite($fh, "    <tunnel>" . $tunnel_folder . DIRECTORY_SEPARATOR . "tunnel" . "</tunnel>" . PHP_EOL);
}
fwrite($fh, "  </host>" . PHP_EOL);
if ($email != "") {
    $url = isset($_SERVER['HTTPS']) ? "https://" : "http://";
    $url .= $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'];
    $url .= str_replace("04-runpecan.php", "08-finished.php", $_SERVER["SCRIPT_NAME"]);
    if ($offline) {
        $url .= "?workflowid={$workflowid}&offline=offline";
    } else {
        $url .= "?workflowid={$workflowid}";
    }
    fwrite($fh, "  <email>" . PHP_EOL);
Beispiel #9
0
function printInfo($siteinfo, $var, $text)
{
    if (isset($siteinfo[$var])) {
        $tmp = preg_replace('/\\s\\s+/', ' ', toXML($siteinfo[$var]));
        echo "    info+= \"{$text} : {$tmp}</br/>\";";
    }
}
Beispiel #10
0
<data>
<?
	toXML( $data );
?>
</data>