gforge/INSTALL.restricted -text
gforge/NEWS -text
gforge/backend/shell/apache.sh svneol=native#unset
+gforge/common/dao/CodendiDataAccess.class.php -text
+gforge/common/dao/include/DataAccess.class.php -text
+gforge/common/dao/include/DataAccessException.class.php -text
+gforge/common/dao/include/DataAccessObject.class.php -text
+gforge/common/dao/include/DataAccessResult.class.php -text
gforge/common/docman/Parsedata.class.php -text
gforge/common/docman/engine/parser_doc.php -text
gforge/common/docman/engine/parser_html.php -text
--- /dev/null
+<?php
+/*
+ * Copyright (c) Xerox, 2009. All Rights Reserved.
+ *
+ * Originally written by Nicolas Terray, 2005. Xerox Codendi Team.
+ *
+ * This file is a part of Codendi.
+ *
+ * Codendi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Codendi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require_once('include/DataAccess.class.php');
+
+class CodendiDataAccess extends DataAccess {
+
+ protected function __construct() {
+
+ $this->DataAccess();
+ }
+
+ protected static $_instance;
+ public static function instance() {
+ if (!isset(self::$_instance)) {
+ $c = __CLASS__;
+ self::$_instance = new $c;
+ }
+ return self::$_instance;
+ }
+
+
+}
+
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
+ *
+ * This file is a part of Codendi.
+ *
+ * Codendi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Codendi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+require_once('DataAccessResult.class.php');
+require_once('DataAccessException.class.php');
+
+
+class DataAccess {
+
+ /**
+ * Constucts a new DataAccess object
+ */
+ function DataAccess() {
+
+ }
+ function quoteSmart($value, $params = array()) {
+
+ return $value;
+ }
+
+
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
+ *
+ * This file is a part of Codendi.
+ *
+ * Codendi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Codendi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+class DataAccessException extends Exception {
+}
+?>
--- /dev/null
+<?php
+/**
+ * Base class for data access objects
+ */
+class DataAccessObject {
+ var $da;
+
+ //! A constructor
+ /**
+ * Constructs the Dao
+ * @param $da instance of the DataAccess class
+ */
+ function DataAccessObject( & $da ) {
+ $this->table_name = 'CLASSNAME_MUST_BE_DEFINE_FOR_EACH_CLASS';
+
+ $this->da=$da;
+ }
+
+
+ //! An accessor
+ /**
+ * For SELECT queries
+ * @param $sql the query string
+ * @return mixed either false if error or object DataAccessResult
+ */
+ function &retrieve($sql,$params) {
+ $result =& new DataAccessResult(db_query_params($sql,$params));
+
+ return $result;
+ }
+
+ //! An accessor
+ /**
+ * For INSERT, UPDATE and DELETE queries
+ * @param $sql the query string
+ * @return boolean true if success
+ */
+ function update($sql,$params) {
+ $result = db_query_params($sql,$params);
+ return $result;
+ }
+
+
+
+}
+?>
--- /dev/null
+<?php
+/**
+ * Fetches MySQL database rows as objects
+ */
+class DataAccessResult implements Iterator {
+ /**
+ * @access protected
+ * $da stores data access object
+ */
+ var $da;
+ /**
+ * @access protected
+ * $query stores a query resource
+ */
+ var $query;
+
+ var $_current;
+ var $_row;
+
+ function DataAccessResult($result) {
+ $this->result = $result;
+
+ $this->_current = -1;
+ $this->_row = false;
+ $this->rewind();
+
+ }
+
+ /**
+ * Returns an array from query row or false if no more rows
+ * @return mixed
+ */
+ function &getRow() {
+ $row = $this->current();
+ $this->next();
+ return $row;
+ }
+
+ /**
+ * Returns the number of rows affected
+ * @return int
+ */
+ function rowCount() {
+ return db_numrows($this->result);
+ }
+
+ /**
+ * Returns false if no errors or returns a MySQL error message
+ * @return mixed
+ */
+ function isError() {
+ $error=db_error();
+ if (!empty($error))
+ return $error;
+ else
+ return false;
+ }
+
+
+ // {{{ Iterator
+ function ¤t() {
+ return $this->_row;
+ }
+
+ function next() {
+ $this->_current++;
+ $this->_row = db_fetch_array($this->result);
+ }
+
+ function valid() {
+ return $this->_row !== false;
+ }
+
+ function rewind() {
+ if ($this->rowCount() > 0) {
+ db_reset_result($this->result, 0);
+ $this->next();
+ $this->_current = 0;
+ }
+ }
+
+ function key() {
+ return $this->_current;
+ }
+ // }}}
+}
+?>