com web/doc: Victory is near: include/docweb_template.class .php include/lib_general.inc.php include/lib_proj _lang.inc.php include/lib_revcheck.inc.php scri pts/gen_doc_activity_email.php templates/emails/email -template-doc-activity.txt www/revcheck.php

[email protected]
Newsgroups php.doc.web
Message-ID <[email protected]>
Commit:    118f28b50f65b12a49465c908a2b733c7ea2cf02
Author:    Sobak <[email protected]>         Wed, 19 Mar 2014 07:50:55 +0100
Parents:   dd349b519bdea16f89467dcdd8ab30663b83a547
Branches:  master

Link:       http://git.php.net/?p=web/doc.git;a=commitdiff;h=118f28b50f65b12a49465c908a2b733c7ea2cf02

Log:
Victory is near

Changed paths:
  M  include/docweb_template.class.php
  M  include/lib_general.inc.php
  M  include/lib_proj_lang.inc.php
  M  include/lib_revcheck.inc.php
  M  scripts/gen_doc_activity_email.php
  D  templates/emails/email-template-doc-activity.txt
  M  www/revcheck.php
diff_118f28b50f65b12a49465c908a2b733c7ea2cf02.txt (text/plain, 14.7 KB)
diff --git a/include/docweb_template.class.php b/include/docweb_template.class.php
index 412c019..b87ba44 100644
--- a/include/docweb_template.class.php
+++ b/include/docweb_template.class.php
@@ -74,7 +74,7 @@ class DocWeb_Template
     function factory($template)
     {
         // vars (become onject properties after instanciation)
-        $language        = LANGC;
+        $language        = 'all';
         $project         = SITE;
         $defaultLanguage = $GLOBALS['defaultLanguage'];
         $defaultProject  = $GLOBALS['defaultProject'];
diff --git a/include/lib_general.inc.php b/include/lib_general.inc.php
index 99e5116..0e48ffd 100644
--- a/include/lib_general.inc.php
+++ b/include/lib_general.inc.php
@@ -1,9 +1,9 @@
 <?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/*
 +----------------------------------------------------------------------+
 | PHP Documentation Tools Site Source Code                             |
 +----------------------------------------------------------------------+
-| Copyright (c) 1997-2011 The PHP Group                                |
+| Copyright (c) 1997-2014 The PHP Group                                |
 +----------------------------------------------------------------------+
 | This source file is subject to version 3.0 of the PHP license,       |
 | that is bundled with this package in the file LICENSE, and is        |
@@ -17,20 +17,10 @@
 |                   Mehdi Achour <[email protected]>                       |
 |                   Gabor Hojtsy <[email protected]>                        |
 |                   Sean Coates <[email protected]>                         |
+|                   Maciej Sobaczewski <[email protected]>                 |
 +----------------------------------------------------------------------+
-$Id$
 */
 
-function is_translation($project, $language)
-{
-    return is_dir(SVN_DIR . $GLOBALS['PROJECTS'][$project] . '/' . $language);
-}
-
-function is_project($project)
-{
-    return isset($GLOBALS['PROJECTS'][$project]);
-}
-
 function get_svn_dir($project)
 {
     // @@@ make this return something until the function is found
@@ -59,106 +49,6 @@ function site_header($full_screen = false)
 
 function site_footer($SECONDSCREEN = false)
 {
-	echo '</section>';
+    echo '</section>';
     require __DIR__ . '/../shared/templates/footer.inc';
-}
-
-// Format email address for spam protection
-function format_email($email)
-{
-    return str_replace(array('@', '.'), array(' at ', ' dot '), $email);
-}
-
-
-/**
-* @return string
-* @param string $text
-* @desc Turn URLs into links
-*/
-function extract_links($text)
-{
-    $text = eregi_replace(
-        "([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])",
-        "<a href=\"\\1://\\2\\3\">\\1://\\2\\3</A>",
-        $text
-    );
-    $text = eregi_replace(
-        "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)",
-        "<a href=\"mailto:\\1\">\\1</a>",
-        $text
-    );
-    return $text;
-}
-
-
-// Returns an insite address for a specified project, language and path (with fallback)
-function get_insite_address($project = NULL, $lang = NULL, $path = NULL)
-{
-    if (!isset($project))      { $project = SITE;  }
-    if (!isset($lang))         { $lang    = LANGC; }
-    if (!isset($path))         { $path    = URI;   }
-    if ($path == '/index.php') { $path    = '/';   }
-
-    if ($project != SITE && 
-       ($path != '/revcheck.php' && !strstr($path, '/rfc/') && $path != '/checkent.php')) {
-        $path = '/';
-    }
-
-    $ret = '/';
-    if ($project != $GLOBALS['defaultProject']) {
-        $ret .= "$project/";
-    }
-    if ($lang != $GLOBALS['defaultLanguage']) {
-        $ret .= "$lang/";
-    }
-    return $ret . ltrim($path, '/');
-}
-
-function get_resource_url($url = '')
-{
-    return "/$url";
-}
-
-function get_bug_count ($project=SITE) {
-    
-    $localFile = FILES_DIR . "bugs_{$project}.count";
-
-    // $package is rawurlencode()'ed
-    switch ($project)
-    {
-        case 'php':
-            $package = 'Documentation+problem';
-            break;
-        
-        case 'phd':
-            $package = 'Doc+Build+problem';
-            break;
-
-        case 'gtk':
-            $package = 'PHP-GTK+related';
-            break;
-            
-        default:
-            return false;
-    }
-
-    $link = 'https://bugs.php.net/search.php?cmd=display&bug_type=All&status=Open&by=Any' . 
-            '&package_name[]=' . $package;
-
-    // Cached (CACHE_BUGS_COUNT defined in init.inc.php)
-    if (!(is_readable($localFile) && (filemtime($localFile) > (time() - CACHE_BUGS_COUNT)))) {
-        if (!$count = file_get_contents($link . '&count_only=1')) {
-            return false;
-        }
-        file_put_contents($localFile, $count);        
-    } else {
-        $count = file_get_contents($localFile);
-    }
-
-    if (strlen($count) > 0) {
-        return array ('count' => (int) $count,
-                      'link'  => $link,
-                     );
-    }
-    return false;
-}
+}
\ No newline at end of file
diff --git a/include/lib_proj_lang.inc.php b/include/lib_proj_lang.inc.php
index ed97b89..d9c6f77 100644
--- a/include/lib_proj_lang.inc.php
+++ b/include/lib_proj_lang.inc.php
@@ -34,7 +34,7 @@ $PROJECTS = array(
 
 // Supported languages
 $LANGUAGES = array(
-    'all'   => 'All',
+    'en'    => 'English',
     'ar'    => 'Arabic',
     'pt_BR' => 'Brazilian Portuguese',
     'bg'    => 'Bulgarian',
@@ -65,5 +65,4 @@ $LANGUAGES = array(
     'es'    => 'Spanish',
     'sv'    => 'Swedish',
     'tr'    => 'Turkish',
-    'en'    => 'English',
 );
\ No newline at end of file
diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index c69d0ed..8e00965 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -1,5 +1,5 @@
 <?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+/*
 +----------------------------------------------------------------------+
 | PHP Documentation Tools Site Source Code                             |
 +----------------------------------------------------------------------+
@@ -180,23 +180,6 @@ function get_outdated_translator_files($idx, $lang, $user)
 
 }
 
-// Return an array with the revchecked documentation types
-function revcheck_available_types()
-{
-    $buff = '';
-    $a = glob(SQLITE_DIR . 'rev.*.sqlite');
-    $buff .= "The revision tracking is actually available for the following documentation types : <ul>";
-    foreach($a as $b) {
-        $b = str_replace(SQLITE_DIR . 'rev.', '', $b);
-        $b = str_replace('.sqlite', '', $b);
-        if (!file_exists('./images/icons/' . $b . '.png'))
-            continue;
-        $buff .= "<li><a href=\"/".$b."/revcheck.php\"><img src=\"/images/icons/".$b.".png\" alt=\"".$b."\" /></a></li>";
-    }
-    $buff .= "</ul>";
-    return $buff;
-}
-
 // Return an array of available languages for a revchecked documentation $type
 function revcheck_available_languages($idx)
 {
@@ -715,6 +698,4 @@ function get_stats_notag($idx, $lang)
     $r = sqlite_fetch_array($result, SQLITE_ASSOC);
     $result = array($r['total'], $r['size']);
     return $result;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/scripts/gen_doc_activity_email.php b/scripts/gen_doc_activity_email.php
index 53adef7..a1b7dbc 100644
--- a/scripts/gen_doc_activity_email.php
+++ b/scripts/gen_doc_activity_email.php
@@ -34,7 +34,6 @@ require '../build-ops.php';
 date_default_timezone_set('UTC');
 
 define('DEBUG_MODE', FALSE); // Enable to not send emails.
-define('EMAIL_TEMPLATE_FILENAME', '../templates/emails/email-template-doc-activity.txt');
 define('DAYS_LOOKUP', 7); // Number of days, in the past, to search/use for the report
 
 $svn_modules = array('phpdoc', 'phd', 'web/doc-editor');
@@ -51,12 +50,36 @@ if (!function_exists('simplexml_load_string')) {
 	exit;
 }	
 
-if (!is_readable(EMAIL_TEMPLATE_FILENAME)) {
-	echo 'Fail. No email template', PHP_EOL;
-	exit;
-}
+$email_text = <<<TEMPLATE
+
+Hello!
+
+This lists some of the activity found within the PHP documentation over at php.net. Of course numbers mean nothing alone, but they do show general activity around the PHP documentation. Dates of activity include: DATES_ACTIVITY
+
+Those who made SVN commits:
+-----------------------------------------------
+  (php.net svn modules: SVN_MODULES_LIST)
+
+SVN_COMMIT_COUNTS
+
+Those who closed documentation bugs:
+-----------------------------------------------
+  (bug categories: problem, translation, phd, editor)
+
+BUGS_CLOSED
+
+Those who handled user notes:
+-----------------------------------------------
+  (actions: delete, reject, edit)
+
+NOTES_HANDLED
+
+---
+See also: 
+ - Edit the documentation online: https://edit.php.net/
+ - Documentation HOWTO: https://doc.php.net/dochowto/
 
-$email_text = file_get_contents(EMAIL_TEMPLATE_FILENAME);
+TEMPLATE;
 
 /****************************************************************************/
 /**** Weekly commits ********************************************************/
diff --git a/templates/emails/email-template-doc-activity.txt b/templates/emails/email-template-doc-activity.txt
deleted file mode 100644
index b8793c9..0000000
--- a/templates/emails/email-template-doc-activity.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-
-Hello!
-
-This lists some of the activity found within the PHP documentation over at php.net. Of course numbers mean nothing alone, but they do show general activity around the PHP documentation. Dates of activity include: DATES_ACTIVITY
-
-Those who made SVN commits:
------------------------------------------------
-  (php.net svn modules: SVN_MODULES_LIST)
-
-SVN_COMMIT_COUNTS
-
-Those who closed documentation bugs:
------------------------------------------------
-  (bug categories: problem, translation, phd, editor)
-
-BUGS_CLOSED
-
-Those who handled user notes:
------------------------------------------------
-  (actions: delete, reject, edit)
-
-NOTES_HANDLED
-
----
-See also: 
- - Edit the documentation online: https://edit.php.net/
- - Documentation HOWTO: https://doc.php.net/dochowto/
diff --git a/www/revcheck.php b/www/revcheck.php
index 3d414e2..833533d 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -1,53 +1,47 @@
 <?php
-/* $Id$ */
-
 include '../include/init.inc.php';
 include '../include/lib_revcheck.inc.php';
 
 $LANG = LANGC;
+$language = $_GET['lang'];
+if (in_array($language, array_keys($LANGUAGES))) {
+    $language = 'en';
+}
 
-if (SITE == 'www') {
-    echo site_header('docweb.common.header.revcheck');
-    echo revcheck_available_types();
-    echo site_footer();
-    die;
-} else {
-    $DBLANG = SQLITE_DIR . 'rev.' . SITE . '.sqlite';
-    if (LANGC == 'en' ||LANGC == 'all') {
-        if ($dbhandle = @sqlite_open($DBLANG)) {
-            $type = SITE;
-            $langs = revcheck_available_languages($dbhandle);
-            if(!$langs) {
-                echo site_header('docweb.common.header.revcheck');
-              ?>
-                <div class="ColoredDiv">
-                <h2 class="c">Status of the translated <?php echo strtoupper(SITE); ?> Manual</h2>
-                <p class="c" style="font-size:12px;"><span class="Flag">
-                <?php 
-                if (LANGC != 'all') {
-                    echo '<img src="/images/flags/' . LANGC .'.png" alt="'. LANGD . '" title="' . LANGD . '" />';
-                } ?></span> Language: <?php echo LANGD; ?> : This documentation don't exist yet.<br />
-                </p>
-              </div>
-              <?php
-              echo site_footer();
-              die();
-            } else {
-                echo site_header('docweb.common.header.revcheck');
-                echo "
-                <p class=\"c\">
-                <img src=\"/images/revcheck/info_revcheck_" . SITE . "_all_lang.png\" alt=\"Info\" />
-                </p>";
-                echo site_footer();
-                die();
-            }
-        } else {
-            echo site_header('docweb.common.header.revcheck');
-            echo "Couldn't connect to the revcheck database";
-            echo site_footer();
-            die();
-        }
-    }
+$DBLANG = SQLITE_DIR . 'rev.php.sqlite';
+if (LANGC == 'en' ||LANGC == 'all') {
+	if ($dbhandle = @sqlite_open($DBLANG)) {
+		$langs = revcheck_available_languages($dbhandle);
+		if(!$langs) {
+			echo site_header('docweb.common.header.revcheck');
+		  ?>
+			<div class="ColoredDiv">
+			<h2 class="c">Status of the translated PHP Manual</h2>
+			<p class="c" style="font-size:12px;"><span class="Flag">
+			<?php 
+			if (LANGC != 'all') {
+				echo '<img src="/images/flags/' . LANGC .'.png" alt="'. LANGD . '" title="' . LANGD . '" />';
+			} ?></span> Language: <?php echo LANGD; ?> : This documentation don't exist yet.<br />
+			</p>
+		  </div>
+		  <?php
+		  echo site_footer();
+		  die();
+		} else {
+			echo site_header('docweb.common.header.revcheck');
+			echo "
+			<p class=\"c\">
+			<img src=\"/images/revcheck/info_revcheck_php_all_lang.png\" alt=\"Info\" />
+			</p>";
+			echo site_footer();
+			die();
+		}
+	} else {
+		echo site_header('docweb.common.header.revcheck');
+		echo "Couldn't connect to the revcheck database";
+		echo site_footer();
+		die();
+	}
 }
 $sql = "SELECT charset FROM description WHERE lang='" . LANGC . "';";
 if (!($dbhandle = @sqlite_open($DBLANG)) || !($res = @sqlite_query($dbhandle, $sql)) || !sqlite_num_rows($res))
@@ -56,7 +50,7 @@ if (!($dbhandle = @sqlite_open($DBLANG)) || !($res = @sqlite_query($dbhandle, $s
     echo site_header('docweb.common.header.revcheck');
 ?>
   <div class="ColoredDiv">
-  <h2 class="c">Status of the translated <?php echo strtoupper(SITE); ?> Manual</h2>
+  <h2 class="c">Status of the translated PHP Manual</h2>
   <p class="c" style="font-size:12px;"><span class="Flag">
   <?php 
   if (LANGC != 'all') {
@@ -108,7 +102,7 @@ array (REV_NOTRANS,  "Files available for translation")
 ?>
 
 <div class="ColoredDiv">
-  <h2 class="c">Status of the translated <?php echo strtoupper(SITE); ?> Manual</h2>
+  <h2 class="c">Status of the translated PHP Manual</h2>
   <p class="c" style="font-size:12px;">
    Generated: <?php echo date("r", filemtime($DBLANG)); ?> &nbsp; / <span class="Flag"><img src="/images/flags/<?php echo LANGC; ?>.png" alt="<?php echo LANGD; ?>" title="<?php echo LANGD; ?>" /></span> Language: <?php echo LANGD; ?><br />
   </p>
@@ -511,9 +505,9 @@ END_OF_MULTILINE;
 break;
 
 case "graph" :
-if (is_readable("images/revcheck/info_revcheck_" . SITE . "_" . LANGC . ".png")) {
+if (is_readable("images/revcheck/info_revcheck_php_" . LANGC . ".png")) {
     echo "<p class=\"c\">
-                <img src=\"/images/revcheck/info_revcheck_" . SITE . "_" . LANGC . ".png\" alt=\"Info\" />
+                <img src=\"/images/revcheck/info_revcheck_php_" . LANGC . ".png\" alt=\"Info\" />
                 </p>";
 } else {
     echo 'Can\'t find graph';
@@ -526,6 +520,4 @@ break;
     }
 }
 
-echo site_footer();
-
-?>
+echo site_footer();
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.