X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=815e6f72dd98e4dcc7f44929ebad98b02e167bdd;hp=58eeca9c43ae353e1da93d122ac1407a0a713b27;hb=2b388c21a07e07317ccb065d42ef7304cfca7718;hpb=0ee25da287821512e09137a752465f09b6e1a799 diff --git a/inc/functions.php b/inc/functions.php index 58eeca9c43..815e6f72dd 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -10,7 +10,12 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Viele Nicht-MySQL-Funktionen (auch Dateizugriff) * * -------------------------------------------------------------------- * - * * + * $Revision:: 856 $ * + * $Date:: $ * + * $Tag:: 0.2.1-FINAL $ * + * $Author:: $ * + * Needs to be in all Files and every File needs "svn propset * + * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2008 by Roland Haeder * * For more information visit: http://www.mxchange.org * @@ -30,7 +35,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * * MA 02110-1301 USA * ************************************************************************/ - // Some security stuff... if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php"; @@ -38,25 +42,17 @@ if (!defined('__SECURITY')) { } // Check if our config file is writeable or not -function IS_INC_WRITEABLE($inc) { +function IS_INC_WRITEABLE ($inc) { // Generate FQFN - $fqfn = sprintf("%sinc/%s.php", constant('PATH'), $inc); + $FQFN = sprintf("%sinc/%s.php", constant('PATH'), $inc); // Abort by simple test - if ((FILE_READABLE($fqfn)) && (!is_writeable($fqfn))) { + if ((FILE_READABLE($FQFN)) && (!is_writeable($FQFN))) { return false; } // END - if - // Test if we can append data - $fp = fopen($fqfn, 'a'); - if ($inc == "dummy") { - // Remove dummy file - fclose($fp); - return unlink($fqfn); - } else { - // Close all other files - return fclose($fp); - } + // Test write-access on directory + return is_writeable(dirname($FQFN)); } // Output HTML code directly or "render" it. You addionally switch the new-line character off @@ -249,7 +245,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { if ($template == "member_support_form") { // Support request of a member $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FUNCTION__, __LINE__); + array(getUserId()), __FUNCTION__, __LINE__); // Is content an array? if (is_array($content)) { @@ -375,7 +371,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { // Do we have some content to output or return? if (!empty($ret)) { // Not empty so let's put it out! ;) - if ($return) { + if ($return === true) { // Return the HTML code return $ret; } else { @@ -540,7 +536,7 @@ function GEN_PASS ($LEN = 0) { // Start creating password $PASS = ""; for ($i = 0; $i < $LEN; $i++) { - $PASS .= $ABC[mt_rand(0, sizeof($ABC) -1)]; + $PASS .= $ABC[mt_rand(0, count($ABC) -1)]; } // END - for // When the size is below 40 we can also add additional security by scrambling it @@ -954,7 +950,7 @@ function LOAD_URL ($URL, $addUrlData=true) { LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL)); LOAD_INC("inc/footer.php"); } - exit(); + shutdown(); } // Wrapper for LOAD_URL but URL comes from a configuration entry @@ -1108,7 +1104,6 @@ function array_pk_sort (&$array, $a_sort, $primary_key = 0, $order = -1, $nums = // function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") { - global $MONTH_DESCR; $OUT = ""; if ($type == "yn") { @@ -1133,7 +1128,7 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") { break; case "month": // Month - foreach ($MONTH_DESCR as $month => $descr) { + foreach ($GLOBALS['month_descr'] as $month => $descr) { $OUT .= "