Api.class.php

gehe zur Dokumentation dieser Datei
00001 <?php
00002 // ---------------------------------------------------------------------------
00003 // $Id$
00004 // ---------------------------------------------------------------------------
00005 // DaCMS Content Management System
00006 // Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de
00007 //
00008 // This program is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU General Public License
00010 // as published by the Free Software Foundation; either version 2
00011 // of the License, or (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 // ---------------------------------------------------------------------------
00022 // $Log$
00023 // Revision 1.5  2004-11-10 22:50:10  dankert
00024 // Neue Methode execute()
00025 //
00026 // Revision 1.4  2004/10/06 09:53:39  dankert
00027 // Benutzung auch nicht-statisch
00028 //
00029 // Revision 1.3  2004/05/03 20:21:34  dankert
00030 // neu: setObjectId()
00031 //
00032 // Revision 1.2  2004/05/02 15:04:16  dankert
00033 // Einf?gen package-name (@package)
00034 //
00035 // Revision 1.1  2004/04/24 17:03:29  dankert
00036 // Initiale Version
00037 //
00038 // ---------------------------------------------------------------------------
00039 
00048 class Api
00049 {
00050      var $output   = '';
00051      var $objectid = 0;
00052      var $page;
00053      
00054      function db()
00055      {
00056           return db_connection();
00057      }
00058 
00059      function pageid()
00060      {
00061           echo 'WARNING: pageid() deprecated!<br>';
00062           global $SESS;
00063           return $SESS['objectid'];
00064      }
00065 
00066      function getObjectId()
00067      {
00068           return $this->objectid;
00069      }
00070 
00071      function setObjectId( $objectid )
00072      {
00073           $this->objectid = $objectid;
00074      }
00075 
00076      function getRootObjectId()
00077      {
00078           return Folder::getRootObjectId();
00079      }
00080 
00081      function folderid()
00082      {
00083           global $SESS;
00084           return $SESS['folderid'];
00085      }
00086 
00087 
00088      function execute( $code )
00089      {
00090           global $conf_tmpdir;
00091           $code = "<?php\n".$code."\n?>";
00092 
00093           $tmp  = $conf_tmpdir.'/'.md5(microtime()).'.tmp';
00094           $f = fopen( $tmp,'w' );
00095           fwrite( $f,$code );
00096           fclose( $f );
00097           
00098           require( $tmp ); // Ausfuehren des temporaeren PHP-Codes
00099 
00100           unlink( $tmp );
00101           $inhalt = Api::getOutput();
00102           $this->output( $inhalt );
00103      }    
00104      
00105      function delOutput()
00106      {
00107           $this->output = '';
00108      }
00109      
00110      function output( $text )
00111      {
00112           $this->output .= $text;
00113      }
00114 
00115 
00116      function getOutput()
00117      {
00118           return $this->output;
00119      }
00120 }

Erzeugt am Thu May 14 00:55:49 2009 für OpenRat von  doxygen 1.5.8