Ejemplo n.º 1
0
 function destroy($id = false)
 {
     if ($id == false) {
         $id = $this->id;
     }
     jTipsLogger::_log("Delete " . $this->_tbl . " record with id = '{$id}'");
     return $this->delete($id);
 }
Ejemplo n.º 2
0
 function dbUpdate()
 {
     global $database;
     $results = array();
     foreach ($this->db_updates as $query) {
         $database->setQuery($query);
         if (!$database->query()) {
             array_push($results, $query);
             jTipsLogger::_log($query, 'FAILED UPDATE QUERY:');
         }
     }
     return $results;
 }
Ejemplo n.º 3
0
function getLatestVersion()
{
    jTipsLogger::_log('Checking for latest version', 'INFO');
    if (!extension_loaded('curl')) {
        jTipsLogger::_log('curl not loaded in php', 'ERROR');
        return 'N/A';
    }
    $release = str_replace('.', '', getFullVersion());
    $curl = new jTipsCurl("http://www.jtips.com.au/update.php?version=10&release={$release}");
    $curl->setopt(CURLOPT_CONNECTTIMEOUT, 10);
    $result = $curl->exec();
    if ($theError = $curl->hasError()) {
        return $theError;
        jTipsLogger::_log($result, 'ERROR');
    }
    $curl->close();
    $response = unserialize(base64_decode($result));
    return !empty($response) ? $response : "N/A";
}
Ejemplo n.º 4
0
function setLastUpdateCheckDate()
{
    global $mosConfig_absolute_path;
    jTipsLogger::_log('updating update check date');
    $auto = $mosConfig_absolute_path . '/administrator/components/com_jtips/auto';
    $buffer = gmdate('Y-m-d H:i:s');
    if (isJoomla15()) {
        jimport('joomla.filesystem.file');
        JFile::write($auto, $buffer);
    } else {
        file_put_contents($auto, $buffer);
    }
}
Ejemplo n.º 5
0
 * Author: Jeremy Roberts
 * Company: jTips
 * Website: www.jtips.com.au
 * Licence: Commercial. May not be copied, modified or redistributed
 */
defined('_JEXEC') or defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
require_once 'components/com_jtips/classes/jtip.class.php';
global $database, $jTips;
jTipsSpoofCheck();
//jTipsDebug($_REQUEST);
$game_ids = jTipsGetParam($_REQUEST, 'game_id', array());
//jTipsDebug($game_ids);
foreach ($game_ids as $index => $gid) {
    $jTip = new jTip($database);
    if (!empty($_REQUEST['id'][$index])) {
        $jTip->load($_REQUEST['id'][$index]);
    }
    $game_index = "g{$gid}";
    $jTip->tip_id = jTipsGetParam($_REQUEST[$game_index], 'tip_id');
    $jTip->home_score = jTipsGetParam($_REQUEST[$game_index], 'home_score');
    $jTip->away_score = jTipsGetParam($_REQUEST[$game_index], 'away_score');
    $jTip->margin = jTipsGetParam($_REQUEST[$game_index], 'margin');
    $jTip->bonus_id = jTipsGetParam($_REQUEST[$game_index], 'bonus_id');
    $jTip->game_id = $gid;
    $jTip->user_id = jTipsGetParam($_REQUEST, 'user_id');
    if (!empty($jTip->user_id)) {
        jTipsLogger::_log("ADMIN: saving tips. Tip_id = " . $jTip->tip_id);
        $jTip->save();
    }
}
mosRedirect('index2.php?option=com_jtips&task=list&module=Tips', 'Tips Saved');
Ejemplo n.º 6
0
 * Website: www.jtips.com.au
 * Created: 29/09/2008
 *
 * Description:
 *
 *
 */
global $mosConfig_absolute_path, $database, $mainframe, $jTips, $jLang, $mosConfig_live_site, $jTipsCurentUser, $Itemid;
//Extend the render class if it exists
if (jTipsFileExists($mosConfig_absolute_path . '/components/com_jtips/custom/views/Menu/tmpl/default.ext.php')) {
    require_once $mosConfig_absolute_path . '/components/com_jtips/custom/views/Menu/tmpl/default.ext.php';
} else {
    require_once $mosConfig_absolute_path . '/components/com_jtips/views/Menu/tmpl/default.php';
}
$render = new jTipsRenderMenu();
jTipsLogger::_log('MENU TASK: ' . $task);
//$Itemid = jTipsGetParam($_REQUEST, 'Itemid', $Itemid); //Itemid is a global!
if (!isJoomla15()) {
    $dateFormat = '%Y-%m-%d';
} else {
    $dateFormat = $jTips['DateFormat'];
}
$mainframe->addCustomHeadTag("<script type='text/javascript'>var jTipsLiveSite = '{$mosConfig_live_site}';var Offset = " . TimeDate::getOffset(false) . ";var DateFormat = '" . $dateFormat . "';</script>");
$jSeason = new jSeason($database);
$season_id = getSeasonID();
$jSeason->load($season_id);
$season_link = '';
//"&season=" .$jSeason->id;
$render->assign('jSeason', $jSeason);
$render->assign('season_link', $season_link);
$render->assign('adminUrl', "view=Administration&Itemid={$Itemid}&season=" . getSeasonID());
Ejemplo n.º 7
0
 /**
  * Updates the team points based on the round passed in
  */
 static function updateLadder($jRound, $jSeason)
 {
     jTipsLogger::_log('updating team ladder for round ' . $jRound->id);
     global $database;
     $params = array('round_id' => $jRound->id);
     $jGame = new jGame($database);
     $jGames = forceArray($jGame->loadByParams($params));
     $byeTeams = array();
     foreach ($jGames as $jGame) {
         $home = new jTeam($database);
         $away = new jTeam($database);
         $homeLoaded = $awayLoaded = false;
         if ($jGame->home_id) {
             $home->load($jGame->home_id);
             $homeLoaded = true;
         }
         if ($jGame->away_id) {
             $away->load($jGame->away_id);
             $awayLoaded = true;
         }
         if (!$homeLoaded and $awayLoaded) {
             $byeTeams[] = $away;
         }
         if ($homeLoaded and !$awayLoaded) {
             $byeTeams[] = $home;
         }
         if (!$homeLoaded or !$awayLoaded) {
             continue;
         }
         // nothing to process here
         $home->wins = $home->_getNumberOfWins();
         $home->losses = $home->_getNumberOfLosses();
         $home->draws = $home->_getNumberOfDraws();
         $home->points_for = $home->_getPointsFor();
         $home->points_against = $home->_getPointsAgainst();
         $home->points = $home->_getTotalPoints();
         $away->wins = $away->_getNumberOfWins();
         $away->losses = $away->_getNumberOfLosses();
         $away->draws = $away->_getNumberOfDraws();
         $away->points_for = $away->_getPointsFor();
         $away->points_against = $away->_getPointsAgainst();
         $away->points = $away->_getTotalPoints();
         $home->save();
         $away->save();
     }
     if (!empty($byeTeams)) {
         foreach ($byeTeams as $team) {
             $team->wins = $team->_getNumberOfWins();
             $team->losses = $team->_getNumberOfLosses();
             $team->draws = $team->_getNumberOfDraws();
             $team->points_for = $team->_getPointsFor();
             $team->points_against = $team->_getPointsAgainst();
             $team->points = $team->_getTotalPoints();
             $team->points += $jSeason->team_bye;
             $team->save();
         }
     }
 }
Ejemplo n.º 8
0
require_once 'components/com_jtips/classes/jseason.class.php';
$jSeason = new jSeason($database);
if ($id = jTipsGetParam($_REQUEST, 'id', FALSE)) {
    $jSeason->load($id);
}
$jSeason->bind($_REQUEST);
//BUG 263 - set the date fields if we are in J1.0
if (!isJoomla15()) {
    $jSeason->start_time = TimeDate::toDisplayDate($jSeason->start_time);
    $jSeason->end_time = TimeDate::toDisplayDate($jSeason->end_time);
}
if ($_FILES['image']['name'] and imageDirCheck()) {
    $logofile = 'images/jtips/' . $_FILES['image']['name'];
    if (isJoomla15()) {
        jimport('joomla.filesystem.file');
        jTipsLogger::_log('MOVING ' . $_FILES['image']['tmp_name'] . ' TO ' . $logofile, 'ERROR');
        //JFile::move($_FILES['image']['tmp_name'], $mosConfig_absolute_path.'/'.$logofile);
        //BUG 270 - to complete upload, use the upload function, not move
        JFile::upload($_FILES['image']['tmp_name'], $mosConfig_absolute_path . '/' . $logofile);
    } else {
        if (!is_dir($mosConfig_absolute_path . '/images/jtips') or !file_exists($mosConfig_absolute_path . '/images/jtips')) {
            mkdir($mosConfig_absolute_path . '/images/jtips');
        }
        move_uploaded_file($_FILES['image']['tmp_name'], $mosConfig_absolute_path . '/' . $logofile);
    }
    $jSeason->image = $logofile;
} else {
    if (jTipsGetParam($_REQUEST, 'remove_image', 0) == 1) {
        $jSeason->image = '';
    }
}
Ejemplo n.º 9
0
 function getDefaultPoints($user_id)
 {
     global $database, $jTips;
     if (!$this->default_points) {
         jTipsLogger::_log('no default points should be allocated. aborting');
         return;
     } else {
         if ($this->default_points == 'low') {
             $limit = "LIMIT 1";
         } else {
             $limit = "";
         }
         jTipsLogger::_log('setting default points for user ' . $user_id . ' using method -' . $this->default_points . '-');
         $round_id = $this->getLastRound();
         $query = "SELECT id FROM #__jtips_rounds WHERE season_id = '" . $this->id . "'";
         $database->setQuery($query);
         $rids = $database->loadResultArray();
         $query = "SELECT SUM(points) lpt, SUM(`precision`) lpr FROM #__jtips_history WHERE round_id IN ('" . implode("', '", $rids) . "') GROUP BY user_id ORDER BY lpt ASC {$limit}";
         jTipsLogger::_log("getDefaultPoints: ({$user_id}) " . $query);
         $database->setQuery($query);
         $database->query();
         //only create a jhistory record if at least 1 round is complete
         if ($database->getNumRows() > 0) {
             $jHistory = new jHistory($database);
             $jHistory->user_id = $user_id;
             $jHistory->round_id = $round_id;
             if ($limit) {
                 //BUG 279 - no such function as loadAssoc
                 $res = $database->loadAssocList();
                 $jHistory->points = $res[0]['lpt'];
                 $jHistory->precision = $res[0]['lpr'];
             } else {
                 $res = $database->loadAssocList();
                 //loop and get averages for each
                 $points = 0;
                 $precision = 0;
                 foreach ($res as $row) {
                     $points += $row['lpt'];
                     $precision += $row['lpr'];
                 }
                 $jHistory->points = $points / count($res);
                 $jHistory->precision = $precision / count($res);
                 //rank will be different for averages!
             }
             //rank query
             $query = "SELECT outof FROM #__jtips_history WHERE round_id = '{$round_id}'";
             $database->setQuery($query);
             $max = $database->loadResult();
             $jHistory->outof = $max + 1;
             $jHistory->rank = $max + 1;
             $jHistory->save();
             $jHistory->setRanks($round_id, true);
             //update outof
             /*$query = "UPDATE #__jtips_history SET outof = '" .($max+1). "', updated = CURRENT_TIMESTAMP WHERE round_id = '$round_id'";
             		jTipsLogger::_log('update ranks after adding user');
             		$database->setQuery($query);
             		$database->query();*/
         }
     }
     return 0;
 }
Ejemplo n.º 10
0
 * @copyright Copyright &copy; 2009, jTips
 * @license Commercial - See website for details
 * 
 * @since 2.1 - 16/10/2008
 * @version 2.1
 * @package jTips
 * 
 * Description: 
 */
global $database, $jTips, $mainframe;
require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/juser.class.php';
$my =& $mainframe->getUser();
$season_id = getSeasonID();
if (!$season_id or empty($my->id)) {
    jTipsRedirect('index.php?option=com_jtips&Itemid=' . jTipsGetParam($_REQUEST, 'Itemid'));
}
$jTipsUser = new jTipsUser($database);
$parameters = array('user_id' => $my->id, 'season_id' => $season_id);
$jTipsUser->loadByParams($parameters);
if ($jTipsUser->exists()) {
    jTipsLogger::_log('removing user ' . $jTipsUser->id . ' from competition ' . $jTipsUser->season_id);
    $jTipsUser->destroy();
}
$message = $jLang['_COM_UNSUBSCRIBE_SUCCESS'];
//do we need to stop any paypal subscriptions?
if ($jTips['Payments'] == 'paypal' and $jTips['PayPalIsSub'] and !empty($jTips['PayPalUnSub'])) {
    //Yes! redirect to paypal cancel page
    jTipsRedirect(stripslashes($jTips['PayPalUnSub']), $message);
} else {
    jTipsRedirect('index.php?option=com_jtips&Itemid=' . jTipsGetParam($_REQUEST, 'Itemid') . '&season=' . $season_id, $message);
}
Ejemplo n.º 11
0
 /**
  * Get the number of users allowed by the current licence
  *
  * @return int The number of users
  */
 function getLicensedUsers()
 {
     if (!is_array($this->licence)) {
         jTipsLogger::_log('Invalid license data!', 'ERROR');
         return 0;
     }
     return $this->licence['licensed_users'];
 }
Ejemplo n.º 12
0
 static function _log($item, $prepend = "")
 {
     global $jTips, $mosConfig_absolute_path;
     $file_path = $mosConfig_absolute_path . "/components/com_jtips/jtips.log";
     $level = empty($prepend) ? 'INFO' : strtoupper($prepend);
     if (isset($jTips['DebugLevel']) and !in_array($level, $jTips['DebugLevel'])) {
         return true;
     }
     if (isJoomla15()) {
         jimport('joomla.filesystem.file');
         if (JFile::exists($file_path)) {
             $size = filesize($file_path);
             $human = round($size / (1024 * 1024), 4);
             if ($human >= 10) {
                 if (JFile::exists($file_path . ".0")) {
                     JFile::delete($file_path . ".0");
                 }
                 JFile::move($file_path, $file_path . ".0");
             }
         }
     } else {
         if (file_exists($file_path)) {
             $size = filesize($file_path);
             $human = round($size / (1024 * 1024), 4);
             if ($human >= 10) {
                 if (file_exists($file_path . ".0")) {
                     @unlink($file_path . ".0");
                 }
                 @rename($file_path, $file_path . ".0");
             }
         }
     }
     if (!empty($prepend) and is_string($prepend)) {
         $prepend .= " ";
     }
     $log = "jLOG " . gmdate('Y-m-d H:i:s') . ": " . $prepend . stripslashes(print_r($item, true)) . "\n";
     if (isJoomla15()) {
         $data = '';
         if (JFile::exists($file_path)) {
             $data = JFile::read($file_path);
             $data .= $log;
         }
         return JFile::write($file_path, $data);
     } else {
         if (!($handle = fopen($file_path, 'a'))) {
             jTipsLogger::jTipsDebug("FAILED TO OPEN LOG FILE!", false);
         } else {
             if (fwrite($handle, $log) === false) {
                 jTipsLogger::jTipsDebug("FAILED TO WRITE TO LOG FILE!", false);
                 return false;
             }
             return fclose($handle);
         }
     }
 }
Ejemplo n.º 13
0
 /**
  * Build a link to jTips using the selected area
  * Only compatible with Joomla! 1.5
  * This can stay here since JomSocial is only available for J1.5
  *
  * @since 2.1.10
  * @param object The season object
  * @return string
  */
 function getDashboardLink($jSeason)
 {
     global $database, $jTips;
     static $menu_ids;
     // initialise the menu_ids variable
     if (!$menu_ids) {
         $menu_ids = array();
     }
     if (!isset($jTips['JomSocialCompetitionLinkTarget']) or empty($jTips['JomSocialCompetitionLinkTarget'])) {
         return $jSeason->name;
     }
     if (isset($menu_ids[$jSeason->id]) and !empty($menu_ids[$jSeason->id])) {
         $id = $menu_ids[$jSeason->id];
     } else {
         // find menu item for this competition... somehow
         $query = "SELECT id FROM #__menu WHERE link LIKE" . " '%com_jtips%" . $database->getEscaped($jTips['JomSocialCompetitionLinkTarget']) . "%'" . " AND params LIKE '%season_id=" . $jSeason->id . "\n%' AND published = 1";
         $database->setQuery($query);
         $id = $database->loadResult();
         $menu_ids[$jSeason->id] = $id;
     }
     jTipsLogger::_log('jomsocial jTips menu item id: ' . $id, 'INFO');
     if ($id) {
         // build a link
         jTipsLogger::_log("JOMSOCIAL: found menu id = {$id}");
         // Bug 361 - index.php missing from URL string
         $url = "index.php?option=com_jtips&view=" . $jTips['JomSocialCompetitionLinkTarget'] . "&Itemid=" . $id;
         $uri = jTipsGetSiteRoute($url);
         $link = "<a href='{$uri}' title='{$jTips['JomSocialCompetitionLinkTarget']}'>" . $jSeason->name . "</a>";
         return $link;
     } else {
         // something is wrong, default to season name
         jTipsLogger::_log('loading menu itemid: ' . $database->getErrorMsg(), 'ERROR');
         return $jSeason->name;
     }
 }
Ejemplo n.º 14
0
 * Website: www.jtips.com.au
 * @author Jeremy Roberts
 * @copyright Copyright &copy; 2009, jTips
 * @license Commercial - See website for details
 * 
 * @since 2.1.10 - 20/05/2009
 * @version 1.0.0
 * @package jTips
 * 
 * Description: Marks selected rounds as uncomplete
 * which then allows editing fully a round.
 * 
 * // BUG 351 - allow uncompleting a round
 */
jTipsSpoofCheck();
global $mosConfig_absolute_path, $database, $jLang;
require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jround.class.php';
$cid = jTipsGetParam($_REQUEST, 'cid', array());
if ($cid === false or is_array($cid) and count($cid) == 0) {
    //should never get here
    mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $jLang['_ADMIN_ROUNDS_NONE_TO_PROCESS']);
}
jTipsLogger::_log('uncompleting rounds');
foreach ($cid as $id) {
    $jRound = new jRound($database);
    $jRound->load($id);
    $jRound->scored = 0;
    $jRound->save();
}
$msg = count($cid) . ' ' . $jLang['_ADMIN_ROUNDS_UNCOMPLETED'];
mosRedirect('index2.php?option=com_jtips&module=Rounds&task=list', $msg);
Ejemplo n.º 15
0
//BUG 284 - class jtipsuser has no matching file
$file = $class;
if (strtolower($file) == 'jtipsuser') {
    $file = 'juser';
}
$classFile = 'components/com_jtips/classes/' . strtolower($file) . '.class.php';
if (!file_exists($classFile)) {
    jTipsLogger::_log('Failed to export object of type ' . $file . ' - class file not found!', 'ERROR');
    mosRedirect('index2.php?option=com_jtips&task=list&module=Export', 'Export Failed');
} else {
    require_once $classFile;
}
$jObj = new $class($database);
$report = $jObj->export();
$filename = "components/com_jtips/exports/{$class}_" . TimeDate::getMySQLDate() . ".csv";
jTipsLogger::_log('exporting file for ' . $class . ' to target file: ' . $filename);
//jTipsDebug($report);
//die();
if (writeFile($filename, $report)) {
    ob_end_clean();
    header("Pragma: public");
    // required
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private", false);
    // required for certain browsers
    header('Content-Description: File Transfer');
    header('Content-Type: application/vnd.ms-excel');
    header("Content-Disposition: inline; filename=\"" . basename($filename) . "\";");
    header("Content-Transfer-Encoding: binary");
    header('Content-Length: ' . filesize($filename));
Ejemplo n.º 16
0
}
$include_file = $mosConfig_absolute_path . "/components/com_jtips/views/" . $view . "/" . jTipsGetParam($_REQUEST, 'action', 'build') . ".php";
jTipsLogger::_log("looking for module file at: " . $include_file, 'INFO');
//BUG 289 - check if we are running the MailMan
if (basename($_SERVER['SCRIPT_FILENAME']) == 'index2.php' and (jTipsGetParam($_REQUEST, 'action', '') == 'MailMan' or jTipsGetParam($_REQUEST, 'rid', false))) {
    $bypassSeasonCheck = true;
} else {
    $bypassSeasonCheck = false;
}
if (jTipsFileExists($include_file) and (getSeasonID() or $bypassSeasonCheck)) {
    jTipsLogger::_log('Executing script ' . jTipsGetParam($_REQUEST, 'action', 'build'), 'INFO');
    include $include_file;
} else {
    switch ($task) {
        default:
            jTipsLogger::_log('fell through all possible cases in jtips.php for view = ' . $view . '; action=' . jTipsGetParam($_REQUEST, 'action') . '; task=' . $task . ' and season_id=' . getSeasonID(), 'ERROR');
            echo "<span class='error'>View or Competition not found! Aborting routine.</span>";
            break;
    }
}
////////////////////////////////
///	BUG 77 - IE Incompatibility
///	Moved the moodalbox script after DOM has loaded
if (!isJoomla15()) {
    echo "<script src='" . $mosConfig_live_site . "/components/com_jtips/js/moodalbox.js' type='text/javascript'></script>";
}
///	END BUG 77
///////////////////////////////
//lets show the logo at all times!
if (jTipsGetParam($_REQUEST, 'menu', 1)) {
    jtips_HTML::licence();
Ejemplo n.º 17
0
<?php

/**
 * Author: Jeremy Roberts
 * Company: jTips
 * Website: www.jtips.com.au
 * Licence: Commercial. May not be copied, modified or redistributed
 */
defined('_JEXEC') or defined('_VALID_MOS') or die('Restricted access');
//require_once( $mainframe->getPath( 'toolbar_html' ));
$include_file = "components/com_jtips/modules/" . jTipsGetParam($_REQUEST, 'module', '') . "/toolbar.php";
jTipsLogger::_log("looking for toolbar file: {$include_file}", 'INFO');
if (jTipsFileExists($include_file)) {
    jTipsLogger::_log("found {$include_file}... running script");
    include $include_file;
} else {
    jTipsLogger::_log('failed to find toolbar file!', 'ERROR');
}
Ejemplo n.º 18
0
/**
 * Website: www.jtips.com.au
 * @author Jeremy Roberts
 * @copyright Copyright &copy; 2009, jTips
 * @license Commercial - See website for details
 * 
 * @since 2.1.14 - 31/08/2009
 * @version 1.0.0
 * @package jTips
 * 
 * Description: apply the changes and reload the configuration page 
 */
global $database;
jTipsSpoofCheck();
require_once 'components/com_jtips/classes/juser.class.php';
jTipsLogger::_log('Cleaning users', 'info');
// find out which users are not in the #__users table
$query = "SELECT j.id FROM #__jtips_users j LEFT JOIN #__users u ON j.user_id = u.id WHERE u.id IS NULL";
$database->setQuery($query);
$database->query();
$total = $database->getNumRows();
jTipsLogger::_log('Found ' . $total . ' users to be removed');
if ($total > 1) {
    $ids = (array) $database->loadResultArray();
    foreach ($ids as $id) {
        $jTipsUser = new jTipsUser($database);
        $jTipsUser->destroy($id);
    }
}
$message = sprintf($jLang['_COM_ADMIN_USERS_CLEANED_MESSAGE'], $total);
mosRedirect('index2.php?option=com_jtips&module=Users&task=list', $message);
Ejemplo n.º 19
0
require_once 'components/com_jtips/classes/jgame.class.php';
require_once 'components/com_jtips/classes/jround.class.php';
global $database, $jLang;
$id = jTipsGetParam($_REQUEST, 'id', false);
if (!$id or !is_numeric($id)) {
    // BUG 373 - Round fails to copy
    jTipsLogger::_log('No round id specified to copy!', 'ERROR');
    mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $jLang['_ADMIN_ROUND_COPY_FAIL']);
}
$focus = new jRound($database);
$focus->load($id);
$focus->id = null;
$focus->round = jTipsGetParam($_REQUEST, 'round', '');
$focus->scored = 0;
if (!$focus->round) {
    jTipsLogger::_log('No Round number entered when copying round, determine next one.', 'ERROR');
    $query = "SELECT MAX(round)+1 AS nextround FROM #__jtips_rounds WHERE season_id = '" . $focus->season_id . "'";
    $database->setQuery($query);
    $focus->round = $database->loadResult();
}
$focus->save();
$query = "SELECT id FROM #__jtips_games WHERE round_id = '" . $database->getEscaped($id) . "'";
$database->setQuery($query);
$game_ids = $database->loadResultArray();
if (!empty($game_ids)) {
    foreach ($game_ids as $gid) {
        $jGame = new jGame($database);
        $jGame->load($gid);
        $jGame->round_id = $focus->id;
        $jGame->id = null;
        $jGame->save();
Ejemplo n.º 20
0
 function debugMsg($level, $string)
 {
     jTipsLogger::_log('UNZIP: ' . $string);
     if ($this->debug) {
         if ($level == 1) {
             echo "<b style='color: #777'>dUnzip2:</b> {$string}<br>";
         }
     }
     if ($level == 2) {
         echo "<b style='color: #F00'>dUnzip2:</b> {$string}<br>";
     }
 }
Ejemplo n.º 21
0
<?php

defined('_JEXEC') or defined('_VALID_MOS') or die('Restricted Access');
/**
 * Website: www.jtips.com.au
 * @author Jeremy Roberts
 * @copyright Copyright &copy; 2009, jTips
 * @license Commercial - See website for details
 * 
 * @since 2.1 - 08/10/2008
 * @version 2.1
 * @package jTips
 * 
 * Description: Delete the selected rounds and their related games
 */
jTipsSpoofCheck();
global $mainframe, $database;
require_once 'components/com_jtips/classes/jgame.class.php';
require_once 'components/com_jtips/classes/jround.class.php';
$cids = jTipsGetParam($_REQUEST, 'cid', array());
$jRound = new jRound($database);
$success = 0;
foreach ($cids as $rid) {
    if ($jRound->destroy($rid)) {
        $success++;
    } else {
        jTipsLogger::_log("Failed to delete round with id: {$rid} - " . $jRound->_error);
    }
}
$message = "{$success} / " . count($cids) . " " . $jLang['_ADMIN_ROUND_DELETED'];
mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $message);
Ejemplo n.º 22
0
function filesWritable($getArray = false)
{
    global $mosConfig_absolute_path;
    if (isJoomla15()) {
        //files should be accessable from apache or FTP
        return true;
    }
    $directories = array('/administrator/components/com_jtips', '/components/com_jtips');
    clearstatcache();
    //Load all the files first
    $files = array();
    foreach ($directories as $dir) {
        $dirfiles = findAllFiles($mosConfig_absolute_path . $dir, $files, true);
        $files = array_merge($files, $dirfiles);
    }
    jTipsLogger::_log("CHECKING IF WRITABLE!!!");
    //jTipsLogger::_log($files);
    //No check if each is writable
    if (empty($files)) {
        //Should NEVER get in here
        jTipsLogger::_log("Something is very wrong with the system. No jTips files found!!!");
        return false;
    }
    $files = array_unique($files);
    $displayArray = array();
    foreach ($files as $file) {
        if (!is_writable($file) and !preg_match('/\\/updates\\/.+\\.zip/', $file)) {
            $displayArray[] = str_replace($mosConfig_absolute_path . '/', '', $file);
        }
    }
    jTipsLogger::_log($displayArray);
    if (!empty($displayArray)) {
        if ($getArray) {
            return $displayArray;
        }
        return false;
    }
    return true;
}
Ejemplo n.º 23
0
}
$comment = trim(strip_tags(stripslashes(jTipsGetParam($_REQUEST, 'comment', ''))));
$comment = cleanComment(str_replace('\\', '', $comment));
if ($jTips['EnableComments'] == 1 && !empty($comment)) {
    jTipsLogger::_log('saving comment');
    $jComment = new jComment($database);
    $jCommentParams = array('user_id' => $jTipsCurrentUser->id, 'round_id' => $jRound->id);
    $jComment->loadByParams($jCommentParams);
    $jComment->user_id = $jTipsCurrentUser->id;
    $jComment->round_id = $jRound->id;
    $jComment->comment = $comment;
    $jComment->save();
    jTipsLogger::_log('comment saved');
}
$emailResult = '';
if ($jTips['TipsNotifyEnable'] and $jTipsCurrentUser->getPreference('tips_notifications')) {
    if (sendTipsConfirmation($jTipsCurrentUser, $myTips)) {
        $emailResult = '. ' . $jLang['_COM_TIPS_EMAIL_SUCCESS'];
    } else {
        $emailResult = '. ' . $jLang['_COM_TIPS_EMAIL_FAILURE'];
    }
}
// BUG 312 - more JomSocial Integration
if ($jTips['JomSocialActivities'] and $jTips['JomSocialOnSaveTips']) {
    require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/utils/jTipsJomSocial.php';
    jTipsJomSocial::writeOnSaveTips($jTipsCurrentUser->user_id, $isUpdate, $jSeason, $jRound);
}
jTipsLogger::_log('done saving tips, redirecting...');
//die('save done');
$message = $jLang['_COM_TIPS_SAVED_MESSAGE'] . $emailResult;
jTipsRedirect('index.php?option=com_jtips&view=Tips&Itemid=' . jTipsGetParam($_REQUEST, 'Itemid', '') . '&season=' . $jSeason->id, $message);
Ejemplo n.º 24
0
 function process()
 {
     global $database, $jTips, $mosConfig_absolute_path;
     $this->clearHistory();
     $params = array('round_id' => $this->id);
     $jSeason = new jSeason($database);
     $jSeason->load($this->season_id);
     $jGame = new jGame($database);
     $jGames = forceArray($jGame->loadByParams($params));
     $params = array('season_id' => $this->season_id);
     $jTipsUser = new jTipsUser($database);
     $jTipsUsers = forceArray($jTipsUser->loadByParams($params));
     $noTips = $scores = $worst_precision = array();
     $played = count($jGames);
     foreach ($jTipsUsers as $jTipsUser) {
         jTipsLogger::_log("Processing scores for user " . $jTipsUser->id);
         $score = $matching = $precision = $allAwayScore = 0;
         if ($jTipsUser->hasTipped($this->id)) {
             jTipsLogger::_log($jTipsUser->id . " has tipped in round " . $this->id);
             foreach ($jGames as $jGame) {
                 jTipsLogger::_log("Processing game " . $jGame->id);
                 $params = array('user_id' => $jTipsUser->id, 'game_id' => $jGame->id);
                 $jTip = new jTip($database);
                 $jTip->loadByParams($params);
                 // make sure this is not a bye game
                 if (!$jGame->home_id or !$jGame->away_id or !$jGame->winner_id) {
                     jTipsLogger::_log('attempting to process tips on a bye game, skipping', 'INFO');
                     continue;
                 }
                 /*
                  * Feature Request 101 - Team Starts
                  * Determine the winner when we take the starts into account
                  * We only care about the starts for picking the winner/draw
                  * For picking the margins and scores, use the actual winner
                  */
                 if ($jSeason->team_starts) {
                     jTipsLogger::_log('processing team starts');
                     $homeScore = $awayScore = 0;
                     $homeScore = $jGame->home_score + ($jGame->home_start + 0);
                     $awayScore = $jGame->away_score + ($jGame->away_start + 0);
                     if ($homeScore > $awayScore) {
                         $winnerID = $jGame->home_id;
                     } else {
                         if ($homeScore < $awayScore) {
                             $winnerID = $jGame->away_id;
                         } else {
                             if ($homeScore == $awayScore) {
                                 $winnerID = -1;
                             }
                         }
                     }
                     jTipsLogger::_log('feature 101: With starts, the winner is ' . $winnerID . ', otherwise the winner is ' . $jGame->winner_id . " HOME {$homeScore} v AWAY {$awayScore}");
                 } else {
                     $winnerID = $jGame->winner_id;
                 }
                 if ($jTip->tip_id == $winnerID) {
                     //User tipped right!
                     jTipsLogger::_log("CORRECT TIP by " . $jTipsUser->id . " in round_id " . $this->id . " in game_id " . $jGame->id);
                     //BUG 248 - Add ToughScore if enabled
                     if ($jSeason->tough_score and $jGame->tough_score) {
                         $score += $jGame->tough_score;
                     }
                     if ($winnerID == -1) {
                         $score += isset($jSeason->user_draw) ? $jSeason->user_draw : 0;
                         jTipsLogger::_log("Draw correctly picked!");
                     } else {
                         $score += isset($jSeason->user_correct) ? $jSeason->user_correct : 0;
                     }
                     $matching++;
                 }
                 if ($winnerID == $jGame->away_id) {
                     $allAwayScore += $jSeason->user_correct;
                 }
                 //Check for correct margins and handle precision score gathering
                 if ($jSeason->pick_margin == 1 and $jGame->has_margin == 1) {
                     $margin = abs($jGame->home_score - $jGame->away_score);
                     if ($jTip->margin == $margin) {
                         $score += isset($jSeason->user_pick_margin) ? $jSeason->user_pick_margin : 0;
                         jTipsLogger::_log("correct margin picked!");
                     }
                     if ($jSeason->precision_score == 1) {
                         if ($jGame->winner_id == $jTip->tip_id) {
                             $margin_offset = abs($margin - $jTip->margin);
                         } else {
                             $margin_offset = abs($margin + $jTip->margin);
                         }
                         if (isset($worst_precision[$jGame->id]) && $margin_offset > $worst_precision[$jGame->id] || empty($worst_precision[$jGame->id])) {
                             $worst_precision[$jGame->id] = $margin_offset;
                         }
                         $precision += $margin_offset;
                         jTipsLogger::_log("PICK_MARGIN: Adding {$margin_offset} to precision of {$precision}");
                     }
                 }
                 //Check for correct scores and handle precision score gathering
                 if ($jSeason->pick_score == 1 and $jGame->has_score == 1) {
                     $margin = abs($jGame->home_score - $jGame->away_score);
                     if ($jTip->home_score == $jGame->home_score and $jTip->away_score == $jGame->away_score) {
                         $score += isset($jSeason->user_pick_score) ? $jSeason->user_pick_score : 0;
                         jTipsLogger::_log("Correct scores picked!");
                     }
                     if ($jSeason->precision_score == 1) {
                         $pickedScoreMargin = abs($jTip->home_score - $jTips->away_score);
                         if ($jGame->winner_id == $jTip->tip_id) {
                             $score_offset = abs($margin - $pickedScoreMargin);
                         } else {
                             $score_offset = abs($margin + $pickedScoreMargin);
                         }
                         if (isset($worst_precision[$jGame->id]) and $score_offset > $worst_precision[$jGame->id] or empty($worst_precision[$jGame->id])) {
                             $worst_precision[$jGame->id] = $score_offset;
                         }
                         $precision += $score_offset;
                         jTipsLogger::_log("PICK_SCORE: Adding {$score_offset} to precision of {$precision}");
                         jTipsLogger::_log("PREC DEBUG: {$jTipsUser->id}-{$jTipsUser->user_id} Picked Margin: {$pickedScoreMargin}. Actual Margin: {$margin}. Applied Precision: {$score_offset}. Running Precision: {$precision}", 'INFO');
                     }
                 }
                 //Check for a bonus team selection
                 if ($jSeason->pick_bonus >= 1 and $jGame->has_bonus == 1) {
                     if ($jTip->bonus_id == $jGame->bonus_id && $jGame->bonus_id != -1) {
                         $score += isset($jSeason->user_pick_bonus) ? $jSeason->user_pick_bonus : 0;
                     }
                 }
             }
             //was a perfect round picked?
             if ($matching == $played) {
                 $score += isset($jSeason->user_bonus) ? $jSeason->user_bonus : 0;
             }
             //did the user use their 'doubleup'
             if ($jTipsUser->doubleup == $this->id and $jTips['DoubleUp'] == 1) {
                 $score = $score * 2;
             }
             $scores[] = $score;
             //Save the data to the history object
             $jHistory = new jHistory($database);
             $jHistory->user_id = $jTipsUser->id;
             $jHistory->round_id = $this->id;
             jTipsLogger::_log("Score for user_id " . $jTipsUser->id . " in round_id " . $this->id . " is {$score}");
             $jHistory->points = $score;
             //Update rank after all users have been saved
             $jHistory->outof = count($jTipsUsers);
             //$jHistory->comment	= $jTipsUser->comment;
             if ($jSeason->precision_score == 1) {
                 jTipsLogger::_log("setting precision to {$precision} for user_id " . $jTipsUser->id . " in round_id " . $this->id);
                 $jHistory->precision = $precision;
             } else {
                 $jHistory->precision = 0;
             }
             if ($jHistory->save() !== false) {
                 $results[] = 1;
             } else {
                 jTipsLogger::_log("Error saving history: " . $jHistory->_error);
                 $results[] = 0;
             }
             //remove the current comment
             $jTipsUser->comment = null;
             $jTipsUser->save();
             // Check if the AlphaUserPoints config option is set
             if (isJoomla15()) {
                 $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             } else {
                 $api_AUP = $mosConfig_absolute_path . 'components/com_alphauserpoints/helper.php';
             }
             if (!$this->scored and $jTips['AlphaUserPoints'] and jTipsFileExists($api_AUP)) {
                 require_once $api_AUP;
                 jTipsLogger::_log('sending ' . $score . ' points for user ' . $jTipsUser->user_id, 'INFO');
                 $refID = AlphaUserPointsHelper::getAnyUserReferreID($jTipsUser->user_id);
                 AlphaUserPointsHelper::newpoints('plgaup_jtips_total_points', $refID, '', '', $score);
             }
             if (!$this->scored and $jTips['JomSocialActivities'] and $jTips['JomSocialUserResults']) {
                 global $mosConfig_absolute_path;
                 require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/utils/jTipsJomSocial.php';
                 jTipsJomSocial::writeRoundResult($jSeason, $this, $jTipsUser->user_id, $score);
             }
         } else {
             $noTips[] = $jTipsUser;
         }
     }
     if (count($noTips) > 0) {
         /////////////////////////////////////////////////
         // Feature Request 71
         // Allow users that did not to be assigned
         // all the away teams
         //
         /*if ($jSeason->user_none != -1) {
         		$thisRound = $jSeason->user_none;
         		} else if (is_array($scores) && count($scores) > 0) {
         		$thisRound = min($scores);
         		} else {
         		$thisRound = 0;
         		}*/
         if ($jSeason->user_none == -2) {
             //handle all away teams
             $thisRound = $allAwayScore;
             jTipsLogger::_log("didn't tip? You'll be stuck with the away teams. You got {$thisRound}");
         } else {
             if ($jSeason->user_none == -1) {
                 //handle lowest possible score
                 if (is_array($scores) and count($scores) > 0) {
                     $thisRound = min($scores);
                     jTipsLogger::_log("didn't tip? You'll be stuck with the lowest score this round, {$thisRound}");
                 } else {
                     $thisRound = 0;
                     jTipsLogger::_log("didn't tip? You'll be stuck {$thisRound}");
                 }
             } else {
                 //handle allocated score
                 $thisRound = $jSeason->user_none;
                 jTipsLogger::_log("didn't tip? You're getting {$thisRound}");
             }
         }
         //
         // END Feature Request 71
         ////////////////////////////////////////////////////
         foreach ($noTips as $jTipsUser) {
             $jHistory = new jHistory($database);
             $jHistory->user_id = $jTipsUser->id;
             $jHistory->round_id = $this->id;
             $jHistory->points = $thisRound;
             $jHistory->precision = array_sum($worst_precision);
             //$jHistory->outof		= count($jTipsUsers);
             //$jHistory->comment	= $jTipsUser->comment;
             if ($jHistory->save() !== false) {
                 $results[] = 1;
             } else {
                 $results[] = 0;
             }
             $jTipsUser->save();
             // Check if the AlphaUserPoints config option is set
             if (isJoomla15()) {
                 $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             } else {
                 $api_AUP = $mosConfig_absolute_path . 'components/com_alphauserpoints/helper.php';
             }
             if (!$this->scored and $jTips['AlphaUserPoints'] and jTipsFileExists($api_AUP)) {
                 require_once $api_AUP;
                 jTipsLogger::_log('sending ' . $score . ' points for user ' . $jTipsUser->user_id, 'INFO');
                 $refID = AlphaUserPointsHelper::getAnyUserReferreID($jTipsUser->user_id);
                 AlphaUserPointsHelper::newpoints('plgaup_jtips_total_points', $refID, '', '', $thisRound);
             }
             if (!$this->scored and $jTips['JomSocialActivities']) {
                 global $mosConfig_absolute_path;
                 require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/utils/jTipsJomSocial.php';
                 if ($jTips['JomSocialUserResults']) {
                     jTipsJomSocial::writeRoundResult($jSeason, $this, $jTipsUser->user_id, $score);
                 }
                 if ($jTips['JomSocialOnNoTips']) {
                     jTipsJomSocial::writeOnNoTips($jTipsUser->user_id, $jSeason, $this);
                 }
             }
         }
     }
     $jHistory = new jHistory($database);
     $jHistory->setRanks($this->id, true);
     if (!$this->scored and $jTips['JomSocialActivities']) {
         // find out who won the round and write it to the JomSocial stream
         $winners = $this->getRoundWinners();
         jTipsJomSocial::writeRoundWinners($winners, $this, $jSeason);
     }
     $this->scored = 1;
     $result = $this->save();
     //if ($this->scored != 1) {
     jTeam::updateLadder($this, $jSeason);
     //}
     //$this->scored = 1;
     //return $this->save();
     return $result;
 }
Ejemplo n.º 25
0
global $database, $jTips;
//jTipsDebug($_REQUEST);
//die();
require_once 'components/com_jtips/classes/jgame.class.php';
require_once 'components/com_jtips/classes/jround.class.php';
require_once 'components/com_jtips/classes/jseason.class.php';
$jRound = new jRound($database);
$jSeason = new jSeason($database);
if ($round_id = jTipsGetParam($_REQUEST, 'id', false)) {
    $jRound->load($round_id);
}
$season_id = jTipsGetParam($_REQUEST, 'season_id', false);
$jSeason->load($season_id);
$results = $games_to_keep = array();
//jTipsLogger::_log($_REQUEST);
jTipsLogger::_log('about to save round and games');
//first, save the round info
$start_time_date = jTipsGetParam($_REQUEST, 'date_start_date', strftime($jTips['DateFormat'])) . " ";
$start_minute = jTipsGetParam($_REQUEST, 'date_start_time_minute', '');
$start_time_time = jTipsGetParam($_REQUEST, 'date_start_time_hour', '') . ":" . str_pad($start_minute, 2, '0', STR_PAD_LEFT) . jTipsGetParam($_REQUEST, 'date_start_time_meridiem', '');
if (!preg_match('/\\d/', $start_time_time)) {
    $start_time_time = strftime($jTips['TimeFormat']);
}
$start_time = $start_time_date . " " . $start_time_time;
//BUG 263 - set the date fields if we are in J1.0
if (!isJoomla15()) {
    $jRound->start_time = TimeDate::toDisplayDate($jRound->start_time);
}
$jRound->start_time = TimeDate::toDatabaseDateTime($start_time);
$end_time_date = jTipsGetParam($_REQUEST, 'date_end_date', strftime($jTips['DateFormat'])) . " ";
$end_minute = jTipsGetParam($_REQUEST, 'date_end_time_minute', '');
Ejemplo n.º 26
0
                }
            }
            jTipsLogger::_log('deleting rounds from season');
            foreach ($jRounds as $jRound) {
                array_push($destroyed, $jRound->destroy());
            }
            $jTipsUser = new jTipsUser($database);
            $jTipsUsers = $jTipsUser->loadByParams($params);
            if (!is_array($jTipsUsers)) {
                if ($jTipsUser->exists()) {
                    $jTipsUsers = array($jTipsUser);
                } else {
                    $jTipsUsers = array();
                }
            }
            jTipsLogger::_log('deleting users from season');
            foreach ($jTipsUsers as $jTipsUser) {
                array_push($destroyed, $jTipsUser->destroy());
            }
            array_push($destroyed, $jSeason->destroy());
            if (in_array(FALSE, $destroyed)) {
                $message = 'Season(s) not cleanly removed!';
            } else {
                $message = 'Season(s) deleted!';
            }
        }
    }
} else {
    $message = 'Failed to delete season';
}
mosRedirect('index2.php?option=com_jtips&task=list&module=Seasons', $message);
Ejemplo n.º 27
0
        $jTipsUser = new jTipsUser($database);
        $jTipsUser->load($user['id']);
        //jTipsLogger::_log($jTipsUser);
        if ($jTipsUser->getPreference('email_reminder')) {
            $recipient = $user['email'];
            $user['round'] = $round[0]['round'];
            $user['competition'] = $round[0]['season'];
            $user['season'] = $round[0]['season'];
            $body = parseTemplate($body, $variables, $user);
            $record = array('round_id' => $round[0]['id'], 'user_id' => $user['id'], 'notified' => 0);
            $attempted++;
            if (jTipsMail($from, $fromname, $recipient, $subject, $body)) {
                $record['notified'] = 1;
                jTipsLogger::_log('sent reminder email to ' . $recipient . ' subject: ' . $subject . ' from: ' . $fromname . ' <' . $from . '>', 'info');
                $sent++;
            } else {
                jTipsLogger::_log('failed to send reminder email to ' . $recipient, 'error');
            }
            $jRemind = new jRemind($database);
            $jRemindParams = array('round_id' => $record['round_id'], 'user_id' => $record['user_id']);
            $jRemind->loadByParams($jRemindParams);
            $jRemind->attempts++;
            $jRemind->bind($record);
            $jRemind->save();
        }
    }
}
$result = 'Sent ' . $sent . ' out of ' . $attempted . ' jTips reminder emails for ' . count($season_ids) . ' seasons';
jTipsLogger::_log($result, 'INFO');
echo $result;
exit;
Ejemplo n.º 28
0
 /**
  * 31 July 2007
  * This function should now be deprecated
  */
 function getOverallLadder($num_to_show, $round_id, $page = 0, $field = 'points', $dir = 'desc')
 {
     global $database;
     if ($field == 'pointst') {
         $field = 'points';
     } else {
         if ($field == 'prect') {
             $field = 'precision';
         }
     }
     $offset = $page * $num_to_show;
     //$query = "SELECT user_id, SUM(`$field`) AS total FROM #__jtips_history GROUP BY user_id ORDER BY total $dir";
     $query = "SELECT #__jtips_history.user_id, SUM(`{$field}`) AS total" . " FROM #__jtips_history JOIN #__jtips_users ON #__jtips_history.user_id = #__jtips_users.id" . " JOIN #__users ON #__jtips_users.user_id = #__users.id" . " GROUP BY #__jtips_history.user_id ORDER BY total {$dir}";
     if ($num_to_show) {
         $query .= " LIMIT {$num_to_show} OFFSET {$offset}";
     }
     // BUG 368 - Call to undefined function jTipsDebug - not called as part of static class
     jTipsLogger::jTipsDebug($query, "jHistory::getOverallLadder");
     $database->setQuery($query);
     $row = $database->loadResultArray();
     $users = array();
     foreach ($row as $user_id) {
         $jTipsUser = new jTipsUser($database);
         $jTipsUser->load($user_id);
         array_push($users, $jTipsUser);
     }
     return $users;
 }
Ejemplo n.º 29
0
 function sendNotificationEmail($type)
 {
     jTipsLogger::_log('preparing to send ' . $type . ' notification email', 'INFO');
     global $jTips, $database;
     $subject = stripslashes($jTips["UserNotify" . $type . "Subject"]);
     $message = stripslashes($jTips["UserNotify" . $type . "Message"]);
     $from_name = $jTips['UserNotifyFromName'];
     $from_email = $jTips['UserNotifyFromEmail'];
     $variables = array();
     $values = array();
     foreach (get_object_vars($this) as $key => $val) {
         if (is_string($key)) {
             array_push($variables, $key);
             $values[$key] = $val;
         }
     }
     if (isJoomla15()) {
         $user = new JUser();
     } else {
         $user = new mosUser($database);
     }
     $user->load($this->user_id);
     foreach (get_object_vars($user) as $key => $val) {
         if (is_string($key)) {
             array_push($variables, $key);
             $values[$key] = $val;
         }
     }
     // find out which season this is for an add it to the avaialble variables
     $query = "SELECT name FROM #__jtips_seasons WHERE id = '" . $this->season_id . "'";
     $database->setQuery($query);
     $season = $database->loadResult();
     $values['competition'] = $season;
     $values['season'] = $season;
     $body = parseTemplate($message, $variables, $values);
     jTipsLogger::_log('sending email: ' . $body, 'INFO');
     if (jTipsMail($from_email, $from_name, $this->getUserField('email'), $subject, $body)) {
         jTipsLogger::_log('notification email sent successfully', 'INFO');
         return TRUE;
     } else {
         jTipsLogger::_log('sending notification email failed', 'ERROR');
         return FALSE;
     }
 }
Ejemplo n.º 30
0
    	 *
    	 * LICENSE CHECKING DISABLED - NOW OPEN SOURCE
    	 *
    	if (!$jLicence->checkValidation()) {
    		$jLicence->revalidate();
    	}
    	if (!$jLicence->checkValidation()) {
    		$error = $jLicence->getValidationError();
    		if ($error !== false) {
    			if (isJoomla15()) {
    				$mainframe->enqueueMessage($error, 'error');
    			} else {
    				echo "<div class='message'>$error</div>";
    			}
    		}
    	}
    	*
    	***************************************/
    /*
     * End Licence check
     */
}
$include_file = "components/com_jtips/modules/" . jTipsGetParam($_REQUEST, 'module', 'Dashboard') . "/" . jTipsGetParam($_REQUEST, 'task', 'list') . ".php";
jTipsLogger::_log("looking for include file: {$include_file}");
if (jTipsFileExists($include_file)) {
    jTipsLogger::_log("found {$include_file}... running script");
    include $include_file;
} else {
    jTipsLogger::_log('failed to find include file! returning to dashboard', 'ERROR');
    mosRedirect('index2.php?option=com_jtips');
}