X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=02d70573b5b9732b5cf362ac2a7861e78713a5a8;hp=1f261f4f3b656668aa1804431fe3b54eabfc798b;hb=1dddfaaf4153c2df63288c2d1e4b39f9196afb59;hpb=22a33b87f9894a94efb71de7630f12129e34f83b
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 1f261f4f3b..02d70573b5 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -105,7 +105,7 @@ function CHECK_MODULE ($mod) {
// Check if cache is latest version
$locked = "Y"; $hidden = "N"; $admin = "N"; $mem = "N"; $found = false;
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheArray['modules']['module'])) && (is_array($cacheArray['modules']['module']))) {
+ if (GET_EXT_VERSION("cache") >= "0.1.2") {
// Is the module cached?
if (isset($cacheArray['modules']['locked'][$mod_chk])) {
// Check cache
@@ -132,37 +132,40 @@ function CHECK_MODULE ($mod) {
}
}
- // Check returned values against current access permissions
- //
- // Admin access ----- Guest access ----- --- Guest or member? ---
- if ((IS_ADMIN()) || (($locked == "N") && ($admin == "N") && (($mem == "N") || (IS_MEMBER())))) {
- // If you are admin you are welcome for everything!
- $ret = "done";
- } elseif ($locked == "Y") {
- // Module is locked
- $ret = "locked";
- } elseif (($mem == "Y") && (!IS_MEMBER())) {
- // You have to login first!
- $ret = "mem_only";
- } elseif (($admin == "Y") && (!IS_ADMIN())) {
- // Only the Admin is allowed to enter this module!
- $ret = "admin_only";
- }
+ // Is the module found?
+ if ($found) {
+ // Check returned values against current access permissions
+ //
+ // Admin access ----- Guest access ----- --- Guest or member? ---
+ if ((IS_ADMIN()) || (($locked == "N") && ($admin == "N") && (($mem == "N") || (IS_MEMBER())))) {
+ // If you are admin you are welcome for everything!
+ $ret = "done";
+ } elseif ($locked == "Y") {
+ // Module is locked
+ $ret = "locked";
+ } elseif (($mem == "Y") && (!IS_MEMBER())) {
+ // You have to login first!
+ $ret = "mem_only";
+ } elseif (($admin == "Y") && (!IS_ADMIN())) {
+ // Only the Admin is allowed to enter this module!
+ $ret = "admin_only";
+ }
+ } // END - if
// Still no luck or not found?
- if (($ret == "major") || ($ret == "cache_miss") || (!$found)) {
+ if (($ret == "cache_miss") || (!$found)) {
// ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name ---
if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s.php", PATH, $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", PATH, $extension, $mod)))) {
// Data is missing so we add it
if (GET_EXT_VERSION("sql_patches") >= "0.3.6") {
// Since 0.3.6 we have a has_menu column, this took me a half hour
// to find a loop here... *sigh*
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_mod_reg
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_mod_reg
(module, locked, hidden, mem_only, admin_only, has_menu) VALUES
('%s','Y','N','N','N','N')", array($mod_chk), __FILE__, __LINE__);
} else {
// Wrong/missing sql_patches!
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_mod_reg
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_mod_reg
(module, locked, hidden, mem_only, admin_only) VALUES
('%s','Y','N','N','N')", array($mod_chk), __FILE__, __LINE__);
}
@@ -182,7 +185,17 @@ function CHECK_MODULE ($mod) {
// Module not found we don't add it to the database
$ret = "404";
}
- } // END - if
+ } elseif (!$found) {
+ // Problem with module detected
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s, locked=%s, hidden=%s, mem=%s, admin=%s",
+ $mod,
+ $ret,
+ $locked,
+ $hidden,
+ $mem,
+ $admin
+ ));
+ }
// Return the value
return $ret;
@@ -662,36 +675,27 @@ function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false)
$ADD = "";
if ((!IS_ADMIN()) && ($MODE != "admin")) $ADD = " AND locked='N'";
//* DEBUG: */ echo __LINE__.":".$MODE."/".$act."/".$wht."*
\n";
- if (($MODE != "admin") && ($UPDATE))
- {
+ if (($MODE != "admin") && ($UPDATE)) {
// Update guest or member menu
$SQL = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_%s_menu SET counter=counter+1 WHERE action='%s' AND what='%s'".$ADD." LIMIT 1",
- array($MODE, $act, $wht), __FILE__, __LINE__, false);
- }
- elseif ($wht != "overview")
- {
+ array($MODE, $act, $wht), __FILE__, __LINE__, false);
+ } elseif ($wht != "overview") {
// Other actions
$SQL = SQL_QUERY_ESC("SELECT id, what FROM "._MYSQL_PREFIX."_%s_menu WHERE action='%s'".$ADD." ORDER BY action DESC LIMIT 1",
- array($MODE, $act), __FILE__, __LINE__, false);
- }
- else
- {
+ array($MODE, $act), __FILE__, __LINE__, false);
+ } else {
// Admin login overview
$SQL = SQL_QUERY_ESC("SELECT id, what FROM "._MYSQL_PREFIX."_%s_menu WHERE action='%s' AND (what='' OR what IS NULL)".$ADD." ORDER BY action DESC LIMIT 1",
- array($MODE, $act), __FILE__, __LINE__, false);
+ array($MODE, $act), __FILE__, __LINE__, false);
}
// Run SQL command
$result = SQL_QUERY($SQL, __FILE__, __LINE__);
- if ($UPDATE)
- {
+ if ($UPDATE) {
if (SQL_AFFECTEDROWS() == 1) $ret = true;
//* DEBUG: */ debug_print_backtrace();
- }
- else
- {
+ } else {
if (SQL_NUMROWS($result) == 1) {
- list($id, $wht2) = SQL_FETCHROW($result);
//* DEBUG: */ echo __LINE__."+".$SQL."+
\n";
//* DEBUG: */ echo __LINE__."*".$id."/".$wht."/".$wht2."*
\n";
$ret = true;
@@ -858,7 +862,7 @@ function SEND_MODE_MAILS($mod, $modes)
function COUNT_MODULE($mod) {
if ($mod != "css") {
// Do count all other modules but not accesses on CSS file css.php!
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_mod_reg SET clicks=clicks+1 WHERE module='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_mod_reg SET clicks=clicks+1 WHERE module='%s' LIMIT 1",
array($mod), __FILE__, __LINE__);
} // END - if
}
@@ -1004,7 +1008,7 @@ function REMOVE_RECEIVER (&$ARRAY, $key, $uid, $pool_id, $stats_id="", $bonus=fa
if (SQL_NUMROWS($result) == 0)
{
// No, so we add one!
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_links (%s, userid, link_type) VALUES ('%s','%s','%s')",
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_links (%s, userid, link_type) VALUES ('%s','%s','%s')",
array($rowName, $stats_id, bigintval($uid), $type), __FILE__, __LINE__);
$ret = "done";
}
@@ -1106,7 +1110,7 @@ function GET_REF_LEVEL_PERCENTS ($level) {
* for default value will cause no referal will get points ever!!!)
*/
function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
- /* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ------------------------
- \n";
+ //* DEBUG: */ print "----------------------- ".__FUNCTION__." - ENTRY ------------------------
- \n";
global $_CONFIG, $DATA, $cacheArray;
// Convert mode to lower-case
@@ -1128,12 +1132,12 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
// Count up referal depth
if (!isset($GLOBALS['ref_level'])) {
// Initialialize referal system
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."): Referal system initialized!
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."): Referal system initialized!
\n";
$GLOBALS['ref_level'] = 0;
} else {
// Increase referal level
$GLOBALS['ref_level']++;
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."): Referal level increased. DEPTH={$GLOBALS['ref_level']}
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."): Referal level increased. DEPTH={$GLOBALS['ref_level']}
\n";
}
// Default is "normal" points
@@ -1144,9 +1148,9 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
// Check user account
$result_user = SQL_QUERY_ESC("SELECT refid, email FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s AND status='CONFIRMED' LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
+ array(bigintval($uid)), __FILE__, __LINE__);
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},numRows=".SQL_NUMROWS($result_user).",points={$points}
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},numRows=".SQL_NUMROWS($result_user).",points={$points}
\n";
if (SQL_NUMROWS($result_user) == 1) {
// This is the user and his ref
list($ref, $email) = SQL_FETCHROW($result_user);
@@ -1154,31 +1158,32 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
// Get percents
$per = GET_REF_LEVEL_PERCENTS($GLOBALS['ref_level']);
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}
\n";
// Some percents found?
if ($per > 0) {
// Calculate new points
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},points={$points},per={$per},depth={$GLOBALS['ref_level']}
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},points={$points},per={$per},depth={$GLOBALS['ref_level']}
\n";
$ref_points = $points * $per / 100;
// Pay refback here if level > 0 and in ref-mode
if ((EXT_IS_ACTIVE("refback")) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == "ref") && (isset($cacheArray['add_uid'][$uid]))) {
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!
\n";
$ref_points = ADD_REFBACK_POINTS($cacheArray['add_uid'][$uid], $uid, $points, $ref_points);
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},data={$cacheArray['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!
\n";
} // END - if
// Update points...
SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth='%s' LIMIT 1",
- array($data, $data, $ref_points, bigintval($uid), bigintval($GLOBALS['ref_level'])), __FILE__, __LINE__);
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."):data={$data},ref_points={$ref_points},uid={$uid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")
\n";
+ array($data, $data, $ref_points, bigintval($uid), bigintval($GLOBALS['ref_level'])), __FILE__, __LINE__);
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):data={$data},ref_points={$ref_points},uid={$uid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")
\n";
// No entry updated?
if (SQL_AFFECTEDROWS() < 1) {
// First ref in this level! :-)
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid,ref_depth,%s) VALUES (%s,%s,%s)",
- array($data, bigintval($uid), bigintval($GLOBALS['ref_level']), $ref_points), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid,ref_depth,%s) VALUES (%s,'%s',%s)",
+ array($data, bigintval($uid), bigintval($GLOBALS['ref_level']), $ref_points), __FILE__, __LINE__);
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):data={$data},ref_points={$ref_points},uid={$uid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")
\n";
} // END - if
// Update mediadata as well
@@ -1222,7 +1227,7 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
// Maybe there's another ref?
if (($ref > 0) && ($points > 0) && ($ref != $uid) && ($add_mode == "ref")) {
// Then let's credit him here...
- /* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},ref={$ref},points={$points} - ADVANCE!
\n";
+ //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},ref={$ref},points={$points} - ADVANCE!
\n";
ADD_POINTS_REFSYSTEM(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), $ref, $points, $send_notify, $ref, $locked);
} // END - if
} // END - if
@@ -1230,7 +1235,7 @@ function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid
// Free result
SQL_FREERESULT($result_user);
- /* DEBUG: */ print "
----------------------- ".__FUNCTION__." - EXIT ------------------------
\n";
+ //* DEBUG: */ print "
----------------------- ".__FUNCTION__." - EXIT ------------------------
\n";
}
//
function UPDATE_REF_COUNTER ($uid) {
@@ -1241,14 +1246,14 @@ function UPDATE_REF_COUNTER ($uid) {
//* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},level={$cacheArray['ref_level'][$uid]}
\n";
// Update counter
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refsystem SET counter=counter+1 WHERE userid=%s AND level='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refsystem SET counter=counter+1 WHERE userid=%s AND level='%s' LIMIT 1",
array(bigintval($uid), $cacheArray['ref_level'][$uid]), __FILE__, __LINE__);
// When no entry was updated then we have to create it here
//* DEBUG: */ print __FUNCTION__."(".__LINE__."):updated=".SQL_AFFECTEDROWS()."
\n";
if (SQL_AFFECTEDROWS() < 1) {
// First count!
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_refsystem (userid, level, counter) VALUES (%s,%s,1)",
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_refsystem (userid, level, counter) VALUES (%s,%s,1)",
array(bigintval($uid), $cacheArray['ref_level'][$uid]), __FILE__, __LINE__);
//* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid}
\n";
} // END - if
@@ -1494,13 +1499,10 @@ function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="")
}
// Activate exchange (DEPERECATED???)
function activateExchange() {
- global $_CONFIG;
- $result = SQL_QUERY("SELECT userid FROM `"._MYSQL_PREFIX."_user_data` WHERE status='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) >= getConfig('activate_xchange'))
- {
- // Free memory
- SQL_FREERESULT($result);
+ // Check total amount of users
+ $totalUsers = GET_TOTAL_DATA("CONFIRMED", "use_data", "userid", "status", true, " AND max_mails > 0");
+ if ($totalUsers >= getConfig('activate_xchange')) {
// Activate System
$SQLs = array(
"UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='N', mem_only='Y' WHERE module='order' LIMIT 1",
@@ -1509,12 +1511,11 @@ function activateExchange() {
);
// Run SQLs
- foreach ($SQLs as $sql) {
- $result = SQL_QUERY($sql, __FILE__, __LINE__);
- }
+ RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
- // @TODO Destroy cache
- }
+ // Rebuild cache
+ REBUILD_CACHE("config", "config");
+ } // END - if
}
//
function DELETE_USER_ACCOUNT($uid, $reason)
@@ -1531,7 +1532,7 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
SQL_FREERESULT($result);
// Delete points entries as well
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
// Update mediadata as well
if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
@@ -1544,12 +1545,12 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
}
// Delete category selections as well...
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%s",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%s",
array(bigintval($uid)), __FILE__, __LINE__);
// Remove from rallye if found
if (EXT_IS_ACTIVE("rallye")) {
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_users WHERE userid=%s",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_users WHERE userid=%s",
array(bigintval($uid)), __FILE__, __LINE__);
}
@@ -1558,7 +1559,7 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
SEND_EMAIL($uid, ADMIN_DEL_ACCOUNT, $msg);
// Ok, delete the account!
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
}
//
function META_DESCRIPTION ($mod, $wht) {
@@ -1581,13 +1582,13 @@ function ADD_JACKPOT($points) {
$result = SQL_QUERY("SELECT points FROM "._MYSQL_PREFIX."_jackpot WHERE ok='ok' LIMIT 1", __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
// Create line
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_jackpot (ok, points) VALUES ('ok','%s')", array($points), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_jackpot (ok, points) VALUES ('ok','%s')", array($points), __FILE__, __LINE__);
} else {
// Free memory
SQL_FREERESULT($result);
// Update points
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points+%s WHERE ok='ok' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points+%s WHERE ok='ok' LIMIT 1",
array($points), __FILE__, __LINE__);
}
}
@@ -1684,7 +1685,7 @@ function GET_WHAT($modCheck) {
// Subtract points from database and mediadata cache
function SUB_POINTS ($subject, $uid, $points) {
// Add points to used points
- $result = SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET `used_points`=`used_points`+%s WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET `used_points`=`used_points`+%s WHERE userid=%s LIMIT 1",
array($points, bigintval($uid)), __FILE__, __LINE__);
// Insert booking record
@@ -1881,7 +1882,7 @@ function ADD_BONUS_MAIL_TO_QUEUE ($subject, $text, $receiverList, $points, $seco
if ($mode == "html") $HTML = "Y";
// Add HTML mail
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus
(subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, mails_sent, html_msg)
VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s','%s')",
array(
@@ -1898,7 +1899,7 @@ VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s','%s
), __FILE__, __LINE__);
} else {
// Add regular mail
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus
(subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, mails_sent)
VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s')",
array(