* -------------------------------------------------------------------- *
* Kurzbeschreibung : Funktionen fuer die verbesserten Mediendaten *
* -------------------------------------------------------------------- *
- * *
+ * $Revision:: $ *
+ * $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 *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// Some security stuff...
if (!defined('__SECURITY')) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
+ die();
}
-//
-function MEDIA_UPDATE_ENTRY($keys_array, $mode, $value)
-{
- if (is_array($keys_array) && ($value > 0))
- {
+// Update an entry
+function updateMediadataEntry ($keys_array, $mode, $value) {
+ if (is_array($keys_array) && ($value > 0)) {
// Is an array so we can run it through
- foreach ($keys_array as $key)
- {
+ foreach ($keys_array as $key) {
// First check if it does exist
- $result_media = SQL_QUERY_ESC("SELECT media_key FROM "._MYSQL_PREFIX."_mediadata
-WHERE media_key = '%s' LIMIT 1", array($key), __FILE__, __LINE__);
- if (SQL_NUMROWS($result_media) == 0)
- {
+ $result_media = SQL_QUERY_ESC("SELECT media_key FROM `{?_MYSQL_PREFIX?}_mediadata`
+WHERE media_key = '%s' LIMIT 1", array($key), __FUNCTION__, __LINE__);
+ 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')",
- array($key, $value), __FILE__, __LINE__);
- }
- else
- {
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mediadata` (media_key, media_value) VALUES ('%s', '%s')",
+ array($key, $value), __FUNCTION__, __LINE__);
+ } else {
// Update entry
- switch ($mode)
- {
- case "add": $mode = "+"; break;
- case "sub": $mode = "-"; break;
+ switch ($mode) {
+ case 'add': $mode = '+'; break;
+ case 'sub': $mode = '-'; break;
}
- if ($mode == "init")
- {
+
+ if ($mode == 'init') {
// Initialize entry
- SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_mediadata SET media_value=%s WHERE media_key='%s' LIMIT 1",
- array($value, $key), __FILE__, __LINE__);
- }
- else
- {
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET media_value=%s WHERE media_key='%s' LIMIT 1",
+ array($value, $key), __FUNCTION__, __LINE__);
+ } else {
// Update entry
- SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_mediadata SET media_value=media_value".$mode."%s WHERE media_key='%s' LIMIT 1",
- array($value, $key), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mediadata` SET media_value=media_value".$mode."%s WHERE media_key='%s' LIMIT 1",
+ array($value, $key), __FUNCTION__, __LINE__);
}
}
}
}
}
-//
-function MEDIA_GET_ENTRY($key)
-{
+
+// Getter for entry
+function getMediadataEntry ($key) {
// Return nothing by default
- $value = "";
+ $value = '';
// Check for entry
- $result = SQL_QUERY_ESC("SELECT media_value FROM "._MYSQL_PREFIX."_mediadata WHERE media_key='%s' LIMIT 1",
- array($key), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT media_value FROM `{?_MYSQL_PREFIX?}_mediadata` WHERE media_key='%s' LIMIT 1",
+ array($key), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data
list($value) = SQL_FETCHROW($result);
- }
+ } // END - if
// Return data
return $value;
}
+
+// Filter for updating media data
+function FILTER_UPDATE_MEDIADATA_ENTRY ($data) {
+ // Execute the filter function
+ updateMediadataEntry(array('total_points'), $data['mode'], $data['points']);
+}
+
//
?>