svn: /web/doc-editor/trunk/php/ class.php controller.php

From: Date: Mon, 01 Mar 2010 17:53:50 +0000
Subject: svn: /web/doc-editor/trunk/php/ class.php controller.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-1563@lists.php.net to get a copy of this message
yannick Mon, 01 Mar 2010 17:53:50 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295668 Log: Remove unecessary file Changed paths: D web/doc-editor/trunk/php/class.php U web/doc-editor/trunk/php/controller.php Deleted: web/doc-editor/trunk/php/class.php =================================================================== --- web/doc-editor/trunk/php/class.php 2010-03-01 17:45:20 UTC (rev 295667) +++ web/doc-editor/trunk/php/class.php 2010-03-01 17:53:50 UTC (rev 295668) @@ -1,164 +0,0 @@ -<?php -/** - * PHPDocumentation Online Editor - * - * This class is used to manage PhpDocumentation Online Editor. - * - * @author Yannick Torres <yannick@php.net> - * @license LGPL - */ - -set_time_limit(0); - -require_once dirname(__FILE__) . '/conf.inc.php'; -require_once dirname(__FILE__) . '/LockFile.php'; -require_once dirname(__FILE__) . '/ToolsError.php'; -require_once dirname(__FILE__) . '/ToolsCheckDoc.php'; - -class phpDoc -{ - - public $availableLanguage; - - /** - * Hold the user's Cvs login. - */ - public $cvsLogin; - - /** - * Hold the user's Cvs lang. - */ - public $cvsLang; - - /** - * Hold the user's configuration. - */ - public $userConf; - - /** - * Hold the DB connection. - */ - public $db; - - /** - * Hold the user's Cvs password. - */ - protected $cvsPasswd; - - - function __construct() { - - // Connection MySqli - try { - $this->db = new mysqli(DOC_EDITOR_SQL_HOST, DOC_EDITOR_SQL_USER, DOC_EDITOR_SQL_PASS, DOC_EDITOR_SQL_BASE); - if (mysqli_connect_errno()) { - throw new Exception('connect databases faild!'); - } - } - catch (Exception $e) { - echo $e->getMessage(); - exit; - } - - $this->availableLanguage = array('ar','pt_BR','bg','zh','hk','tw','cs','da','nl','fi','fr','de','el','he','hu','it','ja','kr','no','fa','pl','pt','ro','ru', 'se','sk','sl','es','sv','tr'); - - } - - /** - * Get the content of a file. - * - * @param $FilePath The path of the file. - * @param $FileName The name of the file. - * @return An associated array (content=> content of the file, charset=>the charset of the file). - */ - function getFileContent($FilePath, $FileName) { - - // Security - $FilePath = str_replace('..', '', $FilePath); - $FilePath = str_replace('//', '/', $FilePath); - - $file = $FilePath.$FileName; - - // Is this file modified ? - $ModifiedFiles = $this->getModifiedFiles(); - - if (isset($ModifiedFiles[$file])) { $extension = '.new'; } - else { $extension = ''; } - - $file = DOC_EDITOR_CVS_PATH.$file.$extension; - - $charset = $this->getFileEncoding($file, 'file'); - - $return['charset'] = $charset; - $return['content'] = file_get_contents($file); - - return $return; - } - - /** - * Save a file after modification. - * - * @param $FilePath The path for the file we want to save. - * @param $content The new content. - * @param $lang The lang of the file we want to save. Either 'en' or current LANG. - * @param $type Can be 'file' or 'patch'. - * @param $uniqID If type=patch, this is an uniqID to identify this patch. - * @return The path to the new file ($FilePath with .new extension) successfully created. - */ - function saveFile($FilePath, $content, $lang, $type, $uniqID='') { - - if ($type == 'file' ) { $ext = '.new'; } - else { $ext = '.'.$uniqID.'.patch'; } - - // Security - $FilePath = str_replace('..', '', $FilePath); - - // Open in w+ mode - $h = fopen(DOC_EDITOR_CVS_PATH.$lang.$FilePath.$ext, 'w+'); - fwrite($h, $content); - fclose($h); - - return DOC_EDITOR_CVS_PATH.$lang.$FilePath.$ext; - } - - /** - * Same as getInfoFromContent() but with a file instead of a content of a file. - * - * @param $FilePath The path of the file. - * @see getInfoFromContent - * @return An associated array of informations. - */ - function getInfoFromFile($FilePath) { - $content = file_get_contents($FilePath); - return $this->getInfoFromContent($content); - } - - /** - * Highlights the given commit log - * - * @param $message The commit log - * @return The output message, more beautiful than before! - */ - function highlightCommitLog($message) { - - $reg = array("/(COMMITINFO)/", "/(LOGINFO)/", "/(Checking in)/", "/(done)/", "/(bailing)/", "/(Mailing the commit email to)/", "/(Logging in to)/","(new revision)"); - return preg_replace($reg, "<span style=\"color: #15428B; font-weight: bold;\">\\1</span>", $message); - - } - - /** - * Print debug information into a file (.debug) into data folder. - * - * @param $mess The debug message. - */ - function debug($mess) { - - $mess = '['.date("d/m:Y H:i:s").'] by '.$this->cvsLogin.' : '.$mess."\n"; - - $fp = fopen(DOC_EDITOR_CVS_PATH.'../.debug', 'a+'); - fwrite($fp, $mess); - fclose($fp); - - } - -} // End of class Modified: web/doc-editor/trunk/php/controller.php =================================================================== --- web/doc-editor/trunk/php/controller.php 2010-03-01 17:45:20 UTC (rev 295667) +++ web/doc-editor/trunk/php/controller.php 2010-03-01 17:53:50 UTC (rev 295668) @@ -7,7 +7,6 @@ error_reporting(E_ALL); set_time_limit(0); -require_once "./class.php"; require_once "./ExtJsController.php"; require_once "./JsonResponseBuilder.php";

« previous php.doc.web (#1563) next »