Update of /cvsroot/phpcvsview/phpcvsview
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15782
Modified Files:
phpcvs.php utils.php
Log Message:
Added autodetection support for language, it will fall back to the users cookie setting, and at worst case back to the site administrators setting in the configuration file.
Index: utils.php
===================================================================
RCS file: /cvsroot/phpcvsview/phpcvsview/utils.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** utils.php 2 Feb 2005 06:24:41 -0000 1.5
--- utils.php 2 Feb 2005 07:14:49 -0000 1.6
***************
*** 147,150 ****
--- 147,164 ----
}
+ function SetDefaultLanguage()
+ {
+ global $env, $config, $_ENVIRON;
+ // en_AU:en_GB:en
+ $PreferredLangs = explode(":", $_ENVIRON['LANGUAGE']);
+ foreach ($PreferredLangs as $Lang) {
+ $FileToCheck = $env['language_path']."$Lang.php";
+ if (file_exists($FileToCheck)) {
+ return $Lang;
+ }
+ }
+ return $config['language'];
+ }
+
function InsertIntoArray(&$Array, $Value, $Position)
{
***************
*** 156,158 ****
?>
-
--- 170,171 ----
Index: phpcvs.php
===================================================================
RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** phpcvs.php 1 Feb 2005 07:22:30 -0000 1.21
--- phpcvs.php 2 Feb 2005 07:14:49 -0000 1.22
***************
*** 417,428 ****
// Return Value: boolean - Successfully sent.
// ***************************************************************************
! function processResponse()
{
$this->MESSAGE_CONTENT = "";
$this->STDERR = "";
$KeepGoing = true;
while($KeepGoing){
$ResponseLine = $this->SOCKET->readLine();
$Response = explode(" ", $ResponseLine);
if ($Response[0] != "") {
$Func = $this->ALLOWED_RESPONSES[$Response[0]];
--- 417,434 ----
// Return Value: boolean - Successfully sent.
// ***************************************************************************
! function processResponse($Debug = false)
{
$this->MESSAGE_CONTENT = "";
$this->STDERR = "";
$KeepGoing = true;
+ if ($Debug) {
+ echo "<pre>";
+ }
while($KeepGoing){
$ResponseLine = $this->SOCKET->readLine();
$Response = explode(" ", $ResponseLine);
+ if ($Debug) {
+ echo $ResponseLine."\n";
+ }
if ($Response[0] != "") {
$Func = $this->ALLOWED_RESPONSES[$Response[0]];
***************
*** 432,435 ****
--- 438,444 ----
}
}
+ if ($Debug) {
+ echo "</pre>";
+ }
}
***************
*** 704,707 ****
--- 713,748 ----
}
+ // ***************************************************************************
+ // Function: sendCO()
+ // Author: Brian A Cheeseman.
+ // Parameters: None.
+ // Return Value: boolean - Successfully sent.
+ // ***************************************************************************
+ function sendCO()
+ {
+ if ($this->ALLOWED_REQUESTS["co"] == true) {
+ if ($this->SOCKET->write("co\n") != true) {
+ return false;
+ }
+ }
+ $this->processResponse();
+
+ // Here the first line is the length, the remaining (upto the 'ok')
+ // is the content of the file.
+ if ($this->FINAL_RESPONSE) {
+ $ContentLength = $this->SOCKET->readLine();
+ $CharsToGo = $ContentLength;
+ while($CharsToGo > 0){
+ $Buffer = $this->SOCKET->read($CharsToGo);
+ $this->FILECONTENTS .= $Buffer;
+ $CharsToGo -= strlen($Buffer);
+ }
+ $ReadLine = $this->SOCKET->readLine();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
/**
* Helper Methods.
|