X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Fmediadata_functions.php;h=820ecc1e5d74f45f13362766d9a018c3989443ad;hb=985561270461045c64719266ca6b3a795f6cd76a;hp=03d9d534a539a80af773460eac1c6243bbaea896;hpb=2e715eb7f3f8ca8d259aacb4cbbddde7d9d18e01;p=mailer.git
diff --git a/inc/libs/mediadata_functions.php b/inc/libs/mediadata_functions.php
index 03d9d534a5..820ecc1e5d 100644
--- a/inc/libs/mediadata_functions.php
+++ b/inc/libs/mediadata_functions.php
@@ -17,7 +17,7 @@
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * 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 *
@@ -38,12 +38,13 @@
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
// Update an entry
function updateMediadataEntry ($keys_array, $mode, $value) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keys_array[]=' . gettype($keys_array) . ',mode=' . $mode . ',value=' . $value . ' - ENTERED!');
// Default is nothing added/updated
- $added = null;
+ $added = false;
// Do we have entries?
if (is_array($keys_array) && ($value > 0)) {
@@ -55,11 +56,12 @@ function updateMediadataEntry ($keys_array, $mode, $value) {
FROM
`{?_MYSQL_PREFIX?}_mediadata`
WHERE
- `media_key` = '%s'
+ `media_key`='%s'
LIMIT 1", array($key), __FUNCTION__, __LINE__);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',SQL_NUMROWS()=' . SQL_NUMROWS($result_media));
if (SQL_NUMROWS($result_media) == 0) {
// Not found so we create it (mode will be ignored here!)
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (`media_key`, `media_value`) VALUES ('%s', '%s')",
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (`media_key`,`media_value`) VALUES ('%s', '%s')",
array($key, $value), __FUNCTION__, __LINE__);
} else {
// Update entry
@@ -79,16 +81,9 @@ LIMIT 1", array($key), __FUNCTION__, __LINE__);
}
}
- // Check affected rows
- if (is_null($added)) {
- //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):added='.intval($added));
- $added = (!SQL_HASZEROAFFECTED());
- //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):added='.intval($added));
- } else {
- //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):added='.intval($added));
- $added = ($added && (!SQL_HASZEROAFFECTED()));
- //* DEBUG: */ debugOutput(__FUNCTION__ . '(' . __LINE__ . '):added='.intval($added));
- }
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'added=' . intval($added));
+ $added = (!SQL_HASZEROAFFECTED());
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'added=' . intval($added));
} // END - foreach
} // END - if
@@ -99,6 +94,7 @@ LIMIT 1", array($key), __FUNCTION__, __LINE__);
} // END - if
// Return result
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keys_array[]=' . gettype($keys_array) . ',mode=' . $mode . ',value=' . $value . ',added=' . intval($added) . ' - EXIT!');
return $added;
}
@@ -108,8 +104,10 @@ function getMediadataEntry ($key) {
$value = '';
// Check for entry
- $result = SQL_QUERY_ESC("SELECT media_value FROM `{?_MYSQL_PREFIX?}_mediadata` WHERE media_key='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `media_value` FROM `{?_MYSQL_PREFIX?}_mediadata` WHERE `media_key`='%s' LIMIT 1",
array($key), __FUNCTION__, __LINE__);
+
+ // Do we have one?
if (SQL_NUMROWS($result) == 1) {
// Load data
list($value) = SQL_FETCHROW($result);
@@ -119,14 +117,5 @@ function getMediadataEntry ($key) {
return $value;
}
-// Filter for updating media data
-function FILTER_UPDATE_MEDIADATA_ENTRY ($data) {
- // Execute the filter function
- $data['added'] = ($data['added'] && updateMediadataEntry(array('total_points'), $data['mode'], $data['points']));
-
- // Return data
- return $data;
-}
-
-//
+// [EOF]
?>