// Check returned values against current access permissions
//
// Admin access ----- Guest access ----- --- Guest or member? ---
- if ((IS_ADMIN()) || (($locked == "N") && ($admin == "N") && (($mem == "N") || (IS_LOGGED_IN())))) {
+ 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_LOGGED_IN())) {
+ } elseif (($mem == "Y") && (!IS_MEMBER())) {
// You have to login first!
$ret = "mem_only";
} elseif (($admin == "Y") && (!IS_ADMIN())) {
// Still no luck or not found?
if (($ret == "major") || ($ret == "cache_miss") || (!$found)) {
- // ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name ---
- if ((file_exists(PATH."inc/modules/".$mod.".php")) || (file_exists(PATH.$mod.".php")) || (file_exists(PATH.$extension."/".$mod.".php"))) {
+ // ----- 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
if (SQL_AFFECTEDROWS() == 0) {
// Something bad happend!
return "major";
- }
+ } // END - if
// Destroy cache here
if (GET_EXT_VERSION("cache") >= "0.1.2") {
if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy();
unset($cacheArray['modules']);
- }
+ } // END - if
// And reload data
$ret = CHECK_MODULE($mod_chk);
// Module not found we don't add it to the database
$ret = "404";
}
- }
+ } // END - if
// Return the value
return $ret;
$AND = "";
}
if ((!isset($DEPTH)) && (!$return)) {
- $DEPTH = "0";
+ $DEPTH = 0;
$prefix = "<DIV class=\"you_are_here\">".YOU_ARE_HERE." <STRONG><A class=\"you_are_here\" href=\"".URL."/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</A></STRONG>";
} else {
if (!$return) $DEPTH++;
// Full file name for checking menu
//* DEBUG: */ echo __LINE__.":!!!!".$sub_what."!!!<br />\n";
$test_inc = sprintf("%sinc/modules/%s/what-%s.php", PATH, $MODE, $sub_what);
- $test = (file_exists($test_inc) && is_readable($test_inc));
+ $test = (FILE_READABLE($test_inc));
if ($test) {
if ((!empty($wht)) && (($wht == $sub_what))) {
$content = "<STRONG>";
// This is a menu block... ;-)
$BLOCK_MODE = true;
$INC_BLOCK = sprintf("%sinc/modules/%s/action-%s.php", PATH, $MODE, $main_action);
- if ((file_exists($INC_BLOCK)) && (is_readable($INC_BLOCK))) {
+ if (FILE_READABLE($INC_BLOCK)) {
// Load include file
if ((!EXT_IS_ACTIVE($main_action)) || ($main_action == "online")) OUTPUT_HTML("<TR>
<TD class=\"".$MODE."_menu_whats\">");
}
}
//
-function IS_LOGGED_IN()
+function IS_MEMBER()
{
global $status, $LAST;
if (!is_array($LAST)) $LAST = array();
$newl = time() + bigintval(get_session('lifetime'));
// Recheck if logged in
- if (!IS_LOGGED_IN()) return false;
+ if (!IS_MEMBER()) return false;
// Load last module and last online time
$result = SQL_QUERY_ESC("SELECT last_module, last_online FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
//
function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false)
{
- global $link;
$ret = false;
$ADD = "";
if ((!IS_ADMIN()) && ($MODE != "admin")) $ADD = " AND locked='N'";
$result = SQL_QUERY($SQL, __FILE__, __LINE__);
if ($UPDATE)
{
- if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1) $ret = true;
+ if (SQL_AFFECTEDROWS() == 1) $ret = true;
//* DEBUG: */ debug_print_backtrace();
}
else
// Free memory
SQL_FREERESULT($result);
- //* DEBUG: */ var_dump($ret);
+
+ // Return result
return $ret;
}
//
//
function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false)
{
- $ret = "0";
+ $ret = 0;
if ($onlyRows) {
// Count rows
$result = SQL_QUERY_ESC("SELECT COUNT(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'",
SQL_FREERESULT($result);
if (empty($ret)) {
if (($lookFor == "counter") || ($lookFor == "id")) {
- $ret = "0";
+ $ret = 0;
} else {
$ret = "0.00000";
}
*/
function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref")
{
- global $DEPTH, $_CONFIG, $DATA, $link;
+ global $DEPTH, $_CONFIG, $DATA;
+
+ // Debug message
+ //DEBUG_LOG(__FUNCTION__.": uid={$uid},points={$points}");
// When $uid = 0 add points to jackpot
if ($uid == "0") {
// Count up referral depth
if (empty($DEPTH)) {
// Initialialize referral system
- $DEPTH = "0";
+ $DEPTH = 0;
} else {
// Increase referral level
$DEPTH++;
// Which points, locked or normal?
$data = "points"; if ($locked) $data = "locked_points";
+ // 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__);
+
//* DEBUG */ echo "+".SQL_NUMROWS($result_user).":".$points."+<br />\n";
if (SQL_NUMROWS($result_user) == 1) {
// This is the user and his ref
list ($ref, $email) = SQL_FETCHROW($result_user);
- SQL_FREERESULT($result_user);
- $result = SQL_QUERY_ESC("SELECT %s FROM "._MYSQL_PREFIX."_%s WHERE level='%s' LIMIT 1",
+ // Debug message
+ //DEBUG_LOG(__FUNCTION__.": ref={$ref},email={$email},DEPTH={$DEPTH}");
+
+ // Get referal data
+ $result_lvl = SQL_QUERY_ESC("SELECT %s FROM "._MYSQL_PREFIX."_%s WHERE level='%s' LIMIT 1",
array($percents, $table, bigintval($DEPTH)), __FILE__, __LINE__);
//* DEBUG */ echo "DEPTH:".$DEPTH."<br />\n";
- if (SQL_NUMROWS($result) == 1) {
- list($per) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $P = $points * $per / 100;
- //* DEBUG */ echo "ADD:".$P."<br />\n";
+ if (SQL_NUMROWS($result_lvl) == 1) {
+ // Get percents
+ list($per) = SQL_FETCHROW($result_lvl);
+
+ // Calculate new points
+ $ref_points = $points * $per / 100;
+
+ // Debug message
+ //DEBUG_LOG(__FUNCTION__.": percent={$per},ref_points={$ref_points}");
// Update points...
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth=%s LIMIT 1",
- array($data, $data, $P, bigintval($uid), bigintval($DEPTH)), __FILE__, __LINE__);
- if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 0) {
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_points SET %s=%s+%s WHERE userid=%s AND ref_depth=%d LIMIT 1",
+ array($data, $data, $ref_points, bigintval($uid), bigintval($DEPTH)), __FILE__, __LINE__);
+
+ // Debug log
+ //DEBUG_LOG(__FUNCTION__.": affectedRows=".SQL_AFFECTEDROWS().",DEPTH={$DEPTH}");
+
+ // No entry updated?
+ if (SQL_AFFECTEDROWS() == 0) {
// 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($DEPTH), $P), __FILE__, __LINE__);
- }
+ $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_user_points (userid, ref_depth, %s) VALUES (%s, %d, %s)",
+ array($data, bigintval($uid), bigintval($DEPTH), $ref_points), __FILE__, __LINE__);
+
+ // Debug log
+ //DEBUG_LOG(__FUNCTION__.": insertedRows=".SQL_AFFECTEDROWS()."");
+ } // END - if
// Update mediadata as well
if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
// Update database
- MEDIA_UPDATE_ENTRY(array("total_points"), "add", $P);
- }
+ MEDIA_UPDATE_ENTRY(array("total_points"), "add", $ref_points);
+ } // END - if
// Points updated, maybe I shall send him an email?
if (($send_notify) && ($ref > 0) && (!$locked)) {
// 0 1 2 3
- $DATA = array($per, bigintval($DEPTH), $P, bigintval($ref));
+ $DATA = array($per, bigintval($DEPTH), $ref_points, bigintval($ref));
$msg = LOAD_EMAIL_TEMPLATE("confirm-referral", "", bigintval($uid));
SEND_EMAIL($email, THANX_REFERRAL_ONE, $msg);
} elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == "direct") && (!defined('__POINTS_VALUE'))) {
// Direct payment shall be notified about
- define('__POINTS_VALUE', $P);
+ define('__POINTS_VALUE', $ref_points);
// Load message
$msg = LOAD_EMAIL_TEMPLATE("add-points", REASON_DIRECT_PAYMENT, $uid);
ADD_POINTS_REFSYSTEM($ref, $points, $send_notify, $ref, $locked);
}
}
+
+ // Free result
+ SQL_FREERESULT($result_lvl);
}
+
+ // Free result
+ SQL_FREERESULT($result_user);
}
//
function UPDATE_REF_COUNTER($uid)
{
- global $REF_LVL, $link, $cacheInstance;
+ global $REF_LVL, $cacheInstance;
+
// Make it sure referral level zero (member him-/herself) is at least selected
- if (empty($REF_LVL)) $REF_LVL = "0";
+ if (empty($REF_LVL)) $REF_LVL = 0;
// Update counter
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_refsystem SET counter=counter+1 WHERE userid=%s AND level='%s' LIMIT 1",
array(bigintval($uid), $REF_LVL), __FILE__, __LINE__);
// When no entry was updated then we have to create it here
- if (SQL_AFFECTEDROWS($link) == 0)
+ if (SQL_AFFECTEDROWS() == 0)
{
// First count!
$result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_refsystem (userid, level, counter) VALUES ('%s', '%s', '1')",
if ($cacheInstance->cache_file("refsystem", true)) $cacheInstance->cache_destroy();
}
}
-//
-function UPDATE_ONLINE_LIST($SID, $mod, $act, $wht)
-{
- global $link, $_CONFIG;
+// Updates/extends the online list
+function UPDATE_ONLINE_LIST($SID, $mod, $act, $wht) {
+ global $_CONFIG;
+
// Do not update online list when extension is deactivated
if (!EXT_IS_ACTIVE("online", true)) return;
+ // Empty session?
+ if (empty($SID)) {
+ // This is invalid here!
+ print "Invalid session. Backtrace:<pre>";
+ debug_print_backtrace();
+ die("</pre>");
+ } // END - if
+
// Initialize variables
- $uid = "0"; $rid = "0"; $MEM = "N"; $ADMIN = "N";
- if (!empty($GLOBALS['userid']))
- {
- // Update member status only when userid is valid
- if (($GLOBALS['userid'] > 0) && (IS_LOGGED_IN()))
- {
- // Is valid user
- $uid = $GLOBALS['userid'];
- $MEM = "Y";
- }
- }
- if (IS_ADMIN())
- {
+ $uid = 0; $rid = 0; $MEM = "N"; $ADMIN = "N";
+
+ // Valid userid?
+ if ((!empty($GLOBALS['userid'])) && ($GLOBALS['userid'] > 0) && (IS_MEMBER())) {
+ // Is valid user
+ $uid = bigintval($GLOBALS['userid']);
+ $MEM = "Y";
+ } // END - if
+
+ if (IS_ADMIN()) {
// Is administrator
$ADMIN = "Y";
- }
+ } // END - if
+
if (isSessionVariableSet('refid')) {
// Check cookie
- if (get_session('refid') > 0) $rid = $GLOBALS['refid'];
- }
+ if (get_session('refid') > 0) $rid = bigintval($GLOBALS['refid']);
+ } // END - if
- // Now Read data
+ // Now search for the user
$result = SQL_QUERY_ESC("SELECT timestamp FROM "._MYSQL_PREFIX."_online
WHERE sid='%s' LIMIT 1",
array($SID), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
- SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_online SET
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Then update it
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_online SET
module='%s',
action='%s',
what='%s',
is_admin='%s',
timestamp=UNIX_TIMESTAMP()
WHERE sid='%s' LIMIT 1",
- array(
- $mod,
- $act,
- $wht,
- bigintval($uid),
- bigintval($rid),
- $MEM,
- $ADMIN,
- $SID
-), __FILE__, __LINE__);
- }
- else
- {
+ array($mod, $act, $wht, $uid, $rid, $MEM, $ADMIN, $SID), __FILE__, __LINE__
+ );
+ } else {
// No entry does exists so we simply add it!
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_online (module, action, what, userid, refid, is_member, is_admin, timestamp, sid, ip) VALUES ('%s', '%s', '%s', %s, %s, '%s', '%s', UNIX_TIMESTAMP(), '%s', '%s')",
- array($mod, $act, $wht, bigintval($uid), bigintval($rid), $MEM, $ADMIN, $SID, getenv('REMOTE_ADDR')), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_online (module, action, what, userid, refid, is_member, is_admin, timestamp, sid, ip) VALUES ('%s', '%s', '%s', %s, %s, '%s', '%s', UNIX_TIMESTAMP(), '%s', '%s')",
+ array($mod, $act, $wht, $uid, $rid, $MEM, $ADMIN, $SID, getenv('REMOTE_ADDR')), __FILE__, __LINE__
+ );
}
+ // Free result
+ SQL_FREERESULT($result);
+
// Purge old entries
$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_online WHERE timestamp <= (UNIX_TIMESTAMP() - %s)",
array($_CONFIG['online_timeout']), __FILE__, __LINE__);
}
// OBSULETE: Sends out mail to all administrators
-function SEND_ADMIN_EMAILS($subj, $msg)
-{
- $result = SQL_QUERY("SELECT email FROM "._MYSQL_PREFIX."_admins ORDER BY id", __FILE__, __LINE__);
- while (list($email) = SQL_FETCHROW($result))
- {
+function SEND_ADMIN_EMAILS($subj, $msg) {
+ // Load all admin email addresses
+ $result = SQL_QUERY("SELECT email FROM "._MYSQL_PREFIX."_admins ORDER BY id ASC", __FILE__, __LINE__);
+ while (list($email) = SQL_FETCHROW($result)) {
+ // Send the email out
SEND_EMAIL($email, $subj, $msg);
- }
- // Really simple... ;-)
+ } // END - if
+
+ // Free result
SQL_FREERESULT($result);
+
+ // Really simple... ;-)
}
// Get ID number from administrator's login name
-function GET_ADMIN_ID($login)
-{
+function GET_ADMIN_ID($login) {
global $cacheArray;
$ret = "-1";
- if (!empty($cacheArray['admins']['aid'][$login]))
- {
+ if (!empty($cacheArray['admins']['aid'][$login])) {
// Check cache
$ret = $cacheArray['admins']['aid'][$login];
if (empty($ret)) $ret = "-1";
- }
- else
- {
+ } else {
// Load from database
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
array($login), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ if (SQL_NUMROWS($result) == 1) {
list($ret) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- }
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
}
return $ret;
}
return $ret;
}
//
-function GET_ADMIN_LOGIN($aid) {
+function GET_ADMIN_LOGIN ($aid) {
global $cacheArray;
$ret = "***";
- if (!empty($cacheArray['admins']['login']['aid'])) {
+ if (!empty($cacheArray['admins']['login'])) {
// Check cache
- if (!empty($cacheArray['admins']['login'][$aid])) $ret = $cacheArray['admins']['login'][$aid];
+ if (!empty($cacheArray['admins']['login'][$aid])) {
+ $ret = $cacheArray['admins']['login'][$aid];
+ } // END - if
if (empty($ret)) $ret = "***";
} else {
// Load from database
if (SQL_NUMROWS($result) == 1) {
// Fetch data
list($ret) = SQL_FETCHROW($result);
+
+ // Set cache
+ $cacheArray['admins']['login'][$aid] = $ret;
}
// Free memory
// Selection from array
if (is_array($id) && is_array($name) && sizeof($id) == sizeof($name)) {
// Both are arrays
- foreach ($id as $idx=>$value) {
+ foreach ($id as $idx => $value) {
$ret .= "<OPTION value=\"".$value."\"";
if ($default == $value) $ret .= " selected checked";
$ret .= ">".$name[$idx]."</OPTION>\n";
if ((is_array($cacheArray)) && (isset($cacheArray['config'][$no])) && (is_array($cacheArray['config'][$no]))) {
// Load config from cache
//* DEBUG: */ echo gettype($cacheArray['config'][$no])."<br />\n";
- foreach ($cacheArray['config'][$no] as $key=>$value) {
+ foreach ($cacheArray['config'][$no] as $key => $value) {
$CFG_DUMMY[$key] = $value;
} // END - foreach
return $wht;
}
//
-function MODULE_HAS_MENU($mod)
+function MODULE_HAS_MENU($mod, $forceDb = false)
{
global $cacheArray, $_CONFIG;
// All is false by default
$ret = false;
+ //* DEBUG: */ echo __FUNCTION__.":mod={$mod},cache=".GET_EXT_VERSION("cache")."<br />\n";
if (GET_EXT_VERSION("cache") >= "0.1.2") {
- if (isset($cacheArray['modules']['has_menu'][$mod]))
- {
+ // Cache version is okay, so let's check the cache!
+ if (isset($cacheArray['modules']['has_menu'][$mod])) {
// Check module cache and count hit
- if ($cacheArray['modules']['has_menu'][$mod] == "Y") $ret = true;
+ $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y");
$_CONFIG['cache_hits']++;
- }
- elseif (isset($cacheArray['extensions']['ext_menu'][$mod]))
- {
+ } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) {
// Check cache and count hit
- if ($cacheArray['extensions']['ext_menu'][$mod] == "Y") $ret = true;
+ $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
$_CONFIG['cache_hits']++;
}
- }
-
- if ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ($ret === false)) {
+ } elseif ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ((!EXT_IS_ACTIVE("cache")) || ($forceDb === true))) {
// Check database for entry
$result = SQL_QUERY_ESC("SELECT has_menu FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1",
array($mod), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($has_menu) = SQL_FETCHROW($result);
+
+ // Fake cache... ;-)
+ $cacheArray['extensions']['ext_menu'][$mod] = $has_menu;
+
+ // Does it have a menu?
$ret = ($has_menu == "Y");
- }
+ } // END - if
// Free memory
SQL_FREERESULT($result);
}
// Run database update
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__.":entries={$entries}");
+ //DEBUG_LOG(__FUNCTION__.":entries={$entries}");
SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET ".$entries." WHERE config=0 LIMIT 1", __FILE__, __LINE__);
- // Destroy cache
- if ((GET_EXT_VERSION("cache") >= "0.1.2") && (SQL_AFFECTEDROWS() == 1)) {
- global $cacheInstance;
+ // Get affected rows
+ $affectedRows = SQL_AFFECTEDROWS();
+ //* DEBUG: */ echo __FUNCTION__.":entries={$entries},affectedRows={$affectedRows}<br />\n";
+
+ // Destroy cache?
+ if ((GET_EXT_VERSION("cache") >= "0.1.2") && ($affectedRows == 1)) {
+ global $cacheInstance, $_CONFIG, $CSS;
if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
+
+ // Rebuid the cache
+ require(PATH."inc/load_cache-config.php");
} // END - if
}
+// Creates a new task for updated extension
+function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $subject, $notes) {
+ // Check if task is not there
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE subject='%s' LIMIT 1",
+ array($subject), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 0) {
+ // Task not created so it's a brand-new extension which we need to register and create a task for!
+ $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s', '0', 'NEW', 'EXTENSION_UPDATE', '%s', '%s', UNIX_TIMESTAMP())",
+ array($admin_id, $subject, $notes), __FILE__, __LINE__);
+ } // END - if
+
+ // Free memory
+ SQL_FREERESULT($result);
+}
+// Creates a new task for newly installed extension
+function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
+ // Not installed and do we have created a task for the admin?
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `"._MYSQL_PREFIX."_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1",
+ array($subject), __FILE__, __LINE__);
+ if ((SQL_NUMROWS($result) == 0) && (GET_EXT_VERSION($ext) == "")) {
+ // Template file
+ $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
+ PATH,
+ GET_LANGUAGE(),
+ $ext
+ );
+
+ // Load text for task
+ if (FILE_READABLE($tpl)) {
+ // Load extension's own text template (HTML!)
+ $msg = LOAD_TEMPLATE("ext_".$ext, true);
+ } else {
+ // Load default message
+ $msg = LOAD_EMAIL_TEMPLATE("admin_new_ext","", 0);
+ }
+
+ // Task not created so it's a brand-new extension which we need to register and create a task for!
+ $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
+VALUES (%s, 0, 'NEW', 'EXTENSION', '%s', '%s', UNIX_TIMESTAMP())",
+ array(
+ $admin_id,
+ $subject,
+ addslashes($msg),
+ ), __FILE__, __LINE__, true, false
+ );
+ } // END - if
+
+ // Free memory
+ SQL_FREERESULT($result);
+}
//
?>