Exemplo n.º 1
0
    Header("Content-Type: text/xml; charset=UTF-8");
    ob_end_clean();

    print "<?xml version='1.0' encoding='UTF-8' ?".">\n";
    print "<result>\n";
    foreach($list as $k=>$v) {
      if(!$v->get("hide")) { // put better filters here
	print "  <category id='$k'>".strtr($v->get_lang("name"), $make_valid)."</category>\n";
      }
    }
    print "</result>\n";

    break;
  case "load":
    $content=category_load($id, $_GET);

    Header("Content-Type: text/xml; charset=UTF-8");
    ob_end_clean();

    print $content;

    break;
  case "delete":
    $status=category_delete($id);

    Header("Content-Type: text/xml; charset=UTF-8");
    ob_end_clean();

    print "<?xml version='1.0' encoding='UTF-8' ?".">\n";
    print "<result>\n";
Exemplo n.º 2
0
  function compile() {
    global $lists_dir;
    global $db_central;

    // Load content
    $this->text=category_load($this->id);
    $this->dom=new DOMDocument();
    $this->dom->loadXML($this->text);

    $this->tags=new tags();
    $this->tags->readDOM($this->dom->firstChild);

    // First, create all file content
    $cur=$this->dom->firstChild;

    while($cur) {
      if($cur->nodeName=="category") {
	$cat=new process_category($this, $cur);
	$data=$cat->process();
      }
      $cur=$cur->nextSibling;
    }

    if(!$data['_'])
      $data['_']=array();
    $data['_']=array_merge($data['_'], array(
      "id"=>$this->id,
      "tags"=>$this->tags,
      "version"=>$this->get_newest_version(),
    ));

    $mapnik=build_mapnik_style($this->id, $data, $this->tags);
    $renderd=build_renderd_config($this->id, $data, $this->tags);

    // ... then write all files at once
    foreach($data['_']['classify_fun'] as $table=>$fun)
      sql_query($fun, $db_central);

    $f1=fopen("$this->file.save", "w");
    fwrite($f1, serialize($data));
    fclose($f1);

    $f2=fopen("$this->file.mapnik", "w");
    fwrite($f2, $mapnik);
    fclose($f2);

    $f3=fopen("$this->file.renderd", "w");
    fwrite($f3, $renderd);
    fclose($f3);

    return $data;
  }