]> git.mxchange.org Git - mailer.git/blobdiff - inc/revision-functions.php
Even more removals of deprecated revision-stuff (was used in SVN to show updates).
[mailer.git] / inc / revision-functions.php
index fe3ae41153494ca6dbe725f9b58fb0eb96f956a3..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,264 +1,3 @@
 <?php
-/************************************************************************
- * Mailer v0.2.1-FINAL                                Start: 12/15/2009 *
- * ===================                          Last change: 12/15/2009 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : revision-functions.php                           *
- * -------------------------------------------------------------------- *
- * Short description : Revison-info related functions                   *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Revsions-Info relevante Funktionen               *
- * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
- * For more information visit: http://mxchange.org                      *
- *                                                                      *
- * This program 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.                                  *
- *                                                                      *
- * This program 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 this program; if not, write to the Free Software          *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
- * MA  02110-1301  USA                                                  *
- ************************************************************************/
-
-// Some security stuff...
-if (!defined('__SECURITY')) {
-       die();
-} // END - if
-
-// Initializes repository data
-function initRepositoryData () {
-       // Default data values or array indexes if numerical
-       $GLOBALS['default_repository_data'] = array(
-               // Main author of this script
-               'Author'   => 'quix0r',
-               // No default value for current file name
-               'File'     => 11,
-               // No default value for revision number
-               'Revision' => 10,
-               // No default value for date
-               'Date'     => 9,
-               // Default branch
-               'Tag'      => 8
-       );
-
-       // Add Revision, Date, Tag and Author
-       $GLOBALS['repository_search_for'] = array(
-               'File',
-               'Revision',
-               'Date',
-               'Tag',
-               'Author'
-       );
-}
-
-// "Getter" for revision/version data
-function getRepositoryData ($type = 'Revision') {
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . '] - ENTERED!');
-       // Default is an invalid value to find bugs... :-)
-       $ret = 'INVALID';
-
-       // By default nothing is new... ;-)
-       $new = FALSE;
-
-       // Is the cache entry there?
-       if (isset($GLOBALS['cache_array']['revision'][$type][0])) {
-               // Found so increase cache hit
-               incrementStatsEntry('cache_hits');
-
-               // Return it
-               $ret = $GLOBALS['cache_array']['revision'][$type][0];
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret);
-       } else {
-               // FQFN of revision file
-               $FQFN = sprintf("%s/.revision", getCachePath());
-
-               // Check if 'check_revision_data' is setted (switch for manually rewrite the .revision-File)
-               if ((isGetRequestElementSet('check_revision_data')) && (getRequestElement('check_revision_data') == 'yes')) {
-                       // Forced rebuild of .revision file
-                       $new = TRUE;
-               } else {
-                       // Check for revision file
-                       if (!isFileReadable($FQFN)) {
-                               // Not found, so we need to create it
-                               $new = TRUE;
-                       } else {
-                               // Revision file found
-                               $ins_vers = explode(PHP_EOL, readFromFile($FQFN));
-
-                               // Get array for mapping information
-                               $mapper = array_flip($GLOBALS['repository_search_for']);
-                               //* DEBUG: */ debugOutput('<pre>mapper='.print_r($mapper, TRUE).'</pre>ins_vers=<pre>'.print_r($ins_vers, TRUE).'</pre>');
-
-                               // Is the content valid?
-                               if ((!is_array($ins_vers)) || (count($ins_vers) <= 0) || (!isset($ins_vers[$mapper[$type]])) || (trim($ins_vers[$mapper[$type]]) == '') || ($ins_vers[0]) == 'new') {
-                                       // File needs update!
-                                       $new = TRUE;
-                               } else {
-                                       // Generate fake cache entry
-                                       foreach ($mapper as $map => $idx) {
-                                               $GLOBALS['cache_array']['revision'][$map][0] = $ins_vers[$idx];
-                                       } // END - foreach
-
-                                       // Return found value
-                                       $ret = getRepositoryData($type);
-                                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret);
-                               }
-                       }
-               }
-
-               // Has it been updated?
-               if ($new === TRUE)  {
-                       // Write it
-                       writeToFile($FQFN, implode(PHP_EOL, getArrayFromRepositoryData()));
-
-                       // ... and call recursive
-                       $ret = getRepositoryData($type);
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret);
-               } // END - if
-       }
-
-       // Return the value
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret[' . $type . ']=' . $ret . ' - EXIT!');
-       return $ret;
-}
-
-// Extracts requested revision info from given file data
-function extractRevisionInfoFromData ($fileData, $search) {
-       // Default is to return empty string
-       $ret = '';
-
-       // Searches for "$search-tag:VALUE$" or "$search-tag::VALUE$"(the stylish keywordversion ;-)) in the lates modified file
-       $GLOBALS['revision_res'] += preg_match('@\$' . $search . '(:|::) (.*) \$@U', $fileData, $t);
-
-       // Make sure only valid and trimmed entries are used
-       if (isset($t[2])) {
-               $ret = trim($t[2]);
-       } // END - if
-
-       // Return the result
-       return $ret;
-}
-
-// Extracts requested revison info for given file name by reading it's content
-// and parsing it with extractRevisionInfoFromData().
-function extractRevisionInfoFromFile ($FQFN, $search) {
-       // Read the file
-       $fileData = readFromFile($FQFN);
-
-       // Call the extract function and return the result
-       return extractRevisionInfoFromData($fileData, $search);
-}
-
-// Gets an array back for current repository data.
-// @TODO This function does also set and get in 'cache_array'
-function getArrayFromRepositoryData () {
-       // Init array
-       $GLOBALS['cache_array']['revision'] = array();
-
-       // Init variables
-       $next_dir = '';
-
-       // Directory to start with search
-       $last_changed = array(
-               'path_name' => '',
-               'time'      => 0
-       );
-
-       // Init return array
-       $akt_vers = array();
-
-       // Init value for counting the founded keywords
-       $GLOBALS['revision_res'] = '0';
-
-       // Searches all Files and there date of the last modifikation and puts the newest File in $last_changed.
-       searchDirsRecursive($next_dir, $last_changed, 'Revision');
-
-       // Get file
-       $last_file = readFromFile($last_changed['path_name']);
-
-       // Save the last-changed filename for debugging
-       $GLOBALS['cache_array']['revision']['File'][0] = $last_changed['path_name'];
-
-       // This foreach loops the $searchFor-Tags (array('Revision', 'Date', 'Tag', 'Author') --> could easaly extended in the future)
-       foreach ($GLOBALS['repository_search_for'] as $search) {
-               // This extracts the requested data $search from file data $last_file
-               if ($search != 'File') {
-                       // Skip 'File' because we have set it some lines above
-                       $GLOBALS['cache_array']['revision'][$search][0] = extractRevisionInfoFromData($last_file, $search);
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',data=' . $GLOBALS['cache_array']['revision'][$search][0]);
-               } // END - if
-       } // END - foreach
-
-       // at least 3 keyword-Tags are needed for propper values
-       if ($GLOBALS['revision_res'] && $GLOBALS['revision_res'] >= 3
-       && isset($GLOBALS['cache_array']['revision']['Revision'][0]) && !empty($GLOBALS['cache_array']['revision']['Revision'][0])
-       && isset($GLOBALS['cache_array']['revision']['Date'][0]) && !empty($GLOBALS['cache_array']['revision']['Date'][0])
-       && isset($GLOBALS['cache_array']['revision']['Tag'][0]) && !empty($GLOBALS['cache_array']['revision']['Tag'][0])) {
-               // Prepare content witch need special treadment
-
-               // Prepare timestamp for date
-               preg_match('@(....)-(..)-(..) (..):(..):(..)@', $GLOBALS['cache_array']['revision']['Date'][0], $match_d);
-               $GLOBALS['cache_array']['revision']['Date'][0] = mktime($match_d[4], $match_d[5], $match_d[6], $match_d[2], $match_d[3], $match_d[1]);
-
-               // Add author to the Tag if the author is set and is not quix0r (lead coder)
-               if ((isset($GLOBALS['cache_array']['revision']['Author'][0])) && ($GLOBALS['cache_array']['revision']['Author'][0] != 'quix0r')) {
-                       $GLOBALS['cache_array']['revision']['Tag'][0] .= '-' . strtoupper($GLOBALS['cache_array']['revision']['Author'][0]);
-               } // END - if
-
-       } else {
-               // No valid Data from the last modificated file so read the Revision from the Server. Fallback-solution!! Should not be removed I think.
-               $version = sendHttpGetRequest('check-updates3.php');
-
-               // Invalid request reply?
-               if (!isset($version[11])) {
-                       // Cannot continue here
-                       reportBug(__FUNCTION__, __LINE__, 'Invalid response from check-updates3.php, count should be at least 11, is ' . count($version));
-               } // END - if
-
-               // Prepare content
-               // Only sets not setted or not proper values to the Online-Server-Fallback-Solution
-               foreach ($GLOBALS['repository_search_for'] as $entry) {
-                       // Is it not set or empty?
-                       if ((!isset($GLOBALS['cache_array']['revision'][$entry][0])) || (empty($GLOBALS['cache_array']['revision']['File'][0]))) {
-                               // Is default data entry nummerical?
-                               if (is_numeric($GLOBALS['default_repository_data'][$entry])) {
-                                       // Use entry from $version
-                                       $GLOBALS['cache_array']['revision'][$entry][0] = trim($version[$GLOBALS['default_repository_data'][$entry]]);
-                               } else {
-                                       // Non-numeric -> use it directly
-                                       $GLOBALS['cache_array']['revision'][$entry][0] = $GLOBALS['default_repository_data'][$entry];
-                               }
-                       } // END - if
-               } // END - if
-       }
-
-       // Temporary remove [0] from array
-       $array = $GLOBALS['cache_array']['revision'];
-       foreach ($array as $key => $value) {
-               if ((is_array($value)) && (isset($value[0]))) {
-                       unset($array[$key][0]);
-                       $array[$key] = $value[0];
-               } // END - if
-       } // END - if
-
-       // Return prepared array
-       return $array;
-}
-
-// [EOF]
+// @DEPRECATED
 ?>