function AddPictureToUser($username, $source) { $loc = "members_bulkpics.php->AddPIctureToUser"; $userid = GetUserIDFromName($username); $userinfo = GetUserInfo($userid); if ($userinfo === false) { DieWithMsg($loc, 'User with ID=' . $userid . ' not found, but should be there.'); } // Copy the file into our website. $target = GetTempDir() . "temppic.jpg"; $result = @copy($source, $target); if ($result == false) { log_msg($loc, array('Picture not added. Unable to copy file.', 'External File=' . $source, 'Internal Target=' . $target)); return false; } $id = StoreUserPic($target, $userid); return true; }
function FMDebug($s_mesg) { static $fDebug = NULL; if (!isset($fDebug)) { $fDebug = false; // only initialize once $s_dir = GetTempDir(); // look for the debug log file in the temp directory $s_db_file = "{$s_dir}/fmdebug.log"; // // we only open an existing file - we don't create one // if (file_exists($s_db_file)) { if (($fDebug = fopen($s_db_file, "a")) === false) { return; } } } if ($fDebug !== false) { fwrite($fDebug, date('r') . ": " . $s_mesg . "\n"); fflush($fDebug); } }
function OnExit() { FMDebug("OnExit"); // // Check the www.tectite.com website for a new version, but only // do this check once every CHECK_DAYS days (or on server reboot). // if (Settings::get('CHECK_FOR_NEW_VERSION')) { global $SERVER; $a_targets = Settings::get('TARGET_EMAIL'); if (isset($a_targets[0])) { // // use the first few characters of the MD5 of first email // address pattern from $TARGET_EMAIL to get a unique file // for the server // $s_id = ""; if (isset($SERVER) && !empty($SERVER)) { $s_id = $SERVER; } $s_dir = GetTempDir(); $s_md5 = md5($a_targets[0]); $s_uniq = substr($s_md5, 0, 6); $s_chk_file = "fm" . "{$s_uniq}" . ".txt"; Check4Update($s_dir . "/" . $s_chk_file, $s_id); } } }