Example #1
0
    } else {
        ?>
Download
<?php 
        if (isValidID($user->data['user_type'])) {
            ?>
<p class="backBtn">|&nbsp;<a href="?managekeys=1">Manage Server Keys</a></p>
<?php 
        }
        ?>
<hr class="hr1" />
<br />
<center>
<?php 
        echo "Welcome " . $user->data['username'] . "!";
        if (true || isGroup($userID)) {
            ?>
<br /><br />
<div id='errorBox'>Notice: this is a beta release. It's unstable and support is limited.
<hr class="hr1">
<div id='keycont'>
<a class='ltitle'>Your server keys:</a>
<?php 
            if (!$canHaveServers) {
                echo "You can't have any servers.<br/>";
            } elseif (count($keys) == 0) {
                echo "You don't have any keys yet.<br/>";
            } else {
                $keytypes = array('', 'Unranked', 'Ranked', 'Unranked', 'Official');
                echo "<table id='keytable'>";
                echo "<tr><th>sv_licensenum</th><th>Server Type</th><th>Key</th><th>Description</th></tr>";
    $password = $_GET['password'];    
}*/
// perform login from $auth. we don't want autologon, viewonline nor admin access for the session
$result = $auth->login($username, $password, false, false, false);
if ($result['status'] == LOGIN_SUCCESS) {
    $userID = $user->data['user_id'];
    $user_id = array($userID);
    $canhave = get_profile_fields($user_id);
    if ($canhave[$userID]['can_play_expire']['value'] <= time()) {
        $canhave[$userID]['can_play']['value'] = 1;
    }
    if ($canhave[$userID]['can_play']['value'] == 1 || $canhave[$userID]['can_play']['value'] == 0 || $canhave[$userID]['can_play']['value'] == "") {
        $canPlay = true;
        $regDate = $user->data['user_regdate'];
        $sixMonthsAgo = strtotime('-' . $monthsNeeded . ' months');
        if (true || isGroup($user->data['user_id'])) {
            $canPlay = true;
            $keysql = "UPDATE phpbb_sessions SET session_onlineplay = 1, session_realip = '" . htmlspecialchars(get_ip_address(), ENT_QUOTES) . "' WHERE session_id = '" . $user->session_id . "';";
            $keyresult = $db->sql_query($keysql);
            $db->sql_freeresult($keyresult);
        } else {
            $result['status'] = 'nope';
            $result['error_msg'] = 'interOps is currently down for maintenance.';
        }
    } else {
        $result['status'] = 'nope';
        //$result['error_msg'] = 'User is not allowed to play';
        $result['error_msg'] = 'Online playing privileges revoked';
        if ($canhave[$userID]['can_play_reason']['value']) {
            $result['error_msg'] .= ' - ' . str_replace('#', '@', $canhave[$userID]['can_play_reason']['value']);
        }
 /**
  * Overriden store function to send mails 
  * @param none
  */
 function store()
 {
     global $cfg, $encoding, $lang;
     $sMailhost = getSystemProperty('system', 'mail_host');
     if ($sMailhost == '') {
         $sMailhost = 'localhost';
     }
     //modified : 2008-06-25 - use php mailer class instead of mail()
     $oMail = new PHPMailer();
     $oMail->CharSet = isset($encoding[$lang]) ? $encoding[$lang] : 'UTF-8';
     $oMail->Host = $sMailhost;
     $oMail->IsHTML(0);
     $oMail->WordWrap = 1000;
     $oMail->IsMail();
     if (array_key_exists("idusersequence", $this->modifiedValues)) {
         $usersequence = new WorkflowUserSequence();
         $usersequence->loadByPrimaryKey($this->values["idusersequence"]);
         $email = $usersequence->get("emailnoti");
         $escal = $usersequence->get("escalationnoti");
         if ($email == 1 || $escal == 1) {
             /* Grab the required informations */
             $curEditor = getGroupOrUserName($usersequence->get("iduser"));
             $idartlang = $this->get("idartlang");
             $timeunit = $usersequence->get("timeunit");
             $timelimit = $usersequence->get("timelimit");
             $db = new DB_Contenido();
             $sql = "SELECT author, title, idart FROM " . $cfg["tab"]["art_lang"] . " WHERE idartlang = '" . Contenido_Security::escapeDB($idartlang, $db) . "'";
             $db->query($sql);
             if ($db->next_record()) {
                 $idart = $db->f("idart");
                 $title = $db->f("title");
                 $author = $db->f("author");
             }
             /* Extract category */
             $sql = "SELECT idcat FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::escapeDB($idart, $db) . "'";
             $db->query($sql);
             if ($db->next_record()) {
                 $idcat = $db->f("idcat");
             }
             $sql = "SELECT name FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat = '" . Contenido_Security::escapeDB($idcat, $db) . "'";
             $db->query($sql);
             if ($db->next_record()) {
                 $catname = $db->f("name");
             }
             $starttime = $this->get("starttime");
             $starttime = strtotime(substr_replace(substr(substr($starttime, 0, 2) . chunk_split(substr($starttime, 2, 6), 2, "-") . chunk_split(substr($starttime, 8), 2, ":"), 0, 19), " ", 10, 1));
             switch ($timeunit) {
                 case "Seconds":
                     $maxtime = $starttime + $timelimit;
                     break;
                 case "Minutes":
                     $maxtime = $starttime + $timelimit * 60;
                     break;
                 case "Hours":
                     $maxtime = $starttime + $timelimit * 3600;
                     break;
                 case "Days":
                     $maxtime = $starttime + $timelimit * 86400;
                     break;
                 case "Weeks":
                     $maxtime = $starttime + $timelimit * 604800;
                     break;
                 case "Months":
                     $maxtime = $starttime + $timelimit * 2678400;
                     break;
                 case "Years":
                     $maxtime = $starttime + $timelimit * 31536000;
                     break;
                 default:
                     $maxtime = $starttime + $timelimit;
             }
             if ($email == 1) {
                 $email = i18n("Hello %s,\n\n" . "you are assigned as the next editor for the Article %s.\n\n" . "More informations:\n" . "Article: %s\n" . "Category: %s\n" . "Editor: %s\n" . "Author: %s\n" . "Editable from: %s\n" . "Editable to: %s\n");
                 $filledMail = sprintf($email, $curEditor, $title, $title, $catname, $curEditor, $author, date("Y-m-d H:i:s", $starttime), date("Y-m-d H:i:s", $maxtime));
                 $user = new User();
                 if (isGroup($usersequence->get("iduser"))) {
                     $sql = "select idgroupuser, user_id FROM " . $cfg["tab"]["groupmembers"] . " WHERE\n            \t\t\t\t\t\tgroup_id = '" . Contenido_Security::escapeDB($usersequence->get("iduser"), $db) . "'";
                     $db->query($sql);
                     while ($db->next_record()) {
                         $user->loadUserByUserID($db->f("user_id"));
                         //modified : 2008-06-25 - use php mailer class instead of mail()
                         $oMail->AddAddress($user->getField("email"), "");
                         $oMail->Subject = stripslashes(i18n('Workflow notification', "workflow"));
                         $oMail->Body = $filledMail;
                         $oMail->Send();
                     }
                 } else {
                     $user->loadUserByUserID($usersequence->get("iduser"));
                     //modified : 2008-06-25 - use php mailer class instead of mail()
                     $oMail->AddAddress($user->getField("email"), "");
                     $oMail->Subject = stripslashes(i18n('Workflow notification', "workflow"));
                     $oMail->Body = $filledMail;
                     $oMail->Send();
                 }
             } else {
                 $email = "Hello %s,\n\n" . "you are assigned as the escalator for the Article %s.\n\n" . "More informations:\n" . "Article: %s\n" . "Category: %s\n" . "Editor: %s\n" . "Author: %s\n" . "Editable from: %s\n" . "Editable to: %s\n";
                 $filledMail = sprintf($email, $curEditor, $title, $title, $catname, $curEditor, $author, date("Y-m-d H:i:s", $starttime), date("Y-m-d H:i:s", $maxtime));
                 $user = new User();
                 if (isGroup($usersequence->get("iduser"))) {
                     $sql = "select idgroupuser, user_id FROM " . $cfg["tab"]["groupmembers"] . " WHERE\n            \t\t\t\t\t\tgroup_id = '" . Contenido_Security::escapeDB($usersequence->get("iduser"), $db) . "'";
                     $db->query($sql);
                     while ($db->next_record()) {
                         $user->loadUserByUserID($db->f("user_id"));
                         echo "mail to " . $user->getField("email") . "<br>";
                         //modified : 2008-06-25 - use php mailer class instead of mail()
                         $oMail->AddAddress($user->getField("email"), "");
                         $oMail->Subject = stripslashes(i18n('Workflow escalation', "workflow"));
                         $oMail->Body = $filledMail;
                         $oMail->Send();
                     }
                 } else {
                     $user->loadUserByUserID($usersequence->get("iduser"));
                     echo "mail to " . $user->getField("email") . "<br>";
                     //modified : 2008-06-25 - use php mailer class instead of mail()
                     $oMail->AddAddress($user->getField("email"), "");
                     $oMail->Subject = stripslashes(i18n('Workflow escalation', "workflow"));
                     $oMail->Body = $filledMail;
                     $oMail->Send();
                 }
             }
         }
     }
     return parent::store();
 }