Example #1
0
function account()
{
    $fields = array('name' => ['Username', false], 'pass1' => ['Enter Password', true], 'pass2' => ['Confirm Password', true]);
    if (CLISetup::readInput($fields)) {
        CLISetup::log();
        if (!User::isValidName($fields['name'], $e)) {
            CLISetup::log(Lang::account($e == 1 ? 'errNameLength' : 'errNameChars'), CLISetup::LOG_ERROR);
        } else {
            if (!User::isValidPass($fields['pass1'], $e)) {
                CLISetup::log(Lang::account($e == 1 ? 'errPassLength' : 'errPassChars'), CLISetup::LOG_ERROR);
            } else {
                if ($fields['pass1'] != $fields['pass2']) {
                    CLISetup::log(Lang::account('passMismatch'), CLISetup::LOG_ERROR);
                } else {
                    if ($_ = DB::Aowow()->SelectCell('SELECT 1 FROM ?_account WHERE user = ? AND (status <> ?d OR (status = ?d AND statusTimer > UNIX_TIMESTAMP()))', $fields['name'], ACC_STATUS_NEW, ACC_STATUS_NEW)) {
                        CLISetup::log(Lang::account('nameInUse'), CLISetup::LOG_ERROR);
                    } else {
                        // write to db
                        $ok = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, joindate, email, allowExpire, userGroups, userPerms) VALUES (?, ?, ?, UNIX_TIMESTAMP(), ?, 0, ?d, 1)', $fields['name'], User::hashCrypt($fields['pass1']), Util::ucFirst($fields['name']), CFG_CONTACT_EMAIL, U_GROUP_ADMIN);
                        if ($ok) {
                            $newId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE user = ?', $fields['name']);
                            Util::gainSiteReputation($newId, SITEREP_ACTION_REGISTER);
                            CLISetup::log("account " . $fields['name'] . " created successfully", CLISetup::LOG_OK);
                        } else {
                            // something went wrong
                            CLISetup::log(Lang::main('intError'), CLISetup::LOG_ERROR);
                        }
                    }
                }
            }
        }
    } else {
        CLISetup::log();
        CLISetup::log("account creation aborted", CLISetup::LOG_WARN);
    }
}
Example #2
0
 protected function generateContent()
 {
     /***********/
     /* Infobox */
     /***********/
     $infobox = $contrib = $groups = [];
     foreach (Lang::account('groups') as $idx => $key) {
         if ($idx >= 0 && $this->user['userGroups'] & 1 << $idx) {
             $groups[] = (!fMod(count($groups) + 1, 3) ? '[br]' : null) . Lang::account('groups', $idx);
         }
     }
     $infobox[] = Lang::user('joinDate') . Lang::main('colon') . '[tooltip name=joinDate]' . date('l, G:i:s', $this->user['joinDate']) . '[/tooltip][span class=tip tooltip=joinDate]' . date(Lang::main('dateFmtShort'), $this->user['joinDate']) . '[/span]';
     $infobox[] = Lang::user('lastLogin') . Lang::main('colon') . '[tooltip name=lastLogin]' . date('l, G:i:s', $this->user['prevLogin']) . '[/tooltip][span class=tip tooltip=lastLogin]' . date(Lang::main('dateFmtShort'), $this->user['prevLogin']) . '[/span]';
     $infobox[] = Lang::user('userGroups') . Lang::main('colon') . ($groups ? implode(', ', $groups) : Lang::account('groups', -1));
     $infobox[] = Lang::user('consecVisits') . Lang::main('colon') . $this->user['consecutiveVisits'];
     $infobox[] = Util::ucFirst(Lang::main('siteRep')) . Lang::main('colon') . Lang::nf($this->user['sumRep']);
     // contrib -> [url=http://www.wowhead.com/client]Data uploads: n [small]([tooltip=tooltip_totaldatauploads]xx.y MB[/tooltip])[/small][/url]
     $co = DB::Aowow()->selectRow('SELECT COUNT(DISTINCT c.id) AS sum, SUM(IFNULL(cr.value, 0)) AS nRates FROM ?_comments c LEFT JOIN ?_comments_rates cr ON cr.commentId = c.id AND cr.userId <> 0 WHERE c.replyTo = 0 AND c.userId = ?d', $this->user['id']);
     if ($co['sum']) {
         $contrib[] = Lang::user('comments') . Lang::main('colon') . $co['sum'] . ($co['nRates'] ? ' [small]([tooltip=tooltip_totalratings]' . $co['nRates'] . '[/tooltip])[/small]' : null);
     }
     $ss = DB::Aowow()->selectRow('SELECT COUNT(*) AS sum, SUM(IF(status & ?d, 1, 0)) AS nSticky, SUM(IF(status & ?d, 0, 1)) AS nPending FROM ?_screenshots WHERE userIdOwner = ?d AND (status & ?d) = 0', CC_FLAG_STICKY, CC_FLAG_APPROVED, $this->user['id'], CC_FLAG_DELETED);
     if ($ss['sum']) {
         $buff = [];
         if ($ss['nSticky'] || $ss['nPending']) {
             if ($normal = $ss['sum'] - $ss['nSticky'] - $ss['nPending']) {
                 $buff[] = '[tooltip=tooltip_normal]' . $normal . '[/tooltip]';
             }
             if ($ss['nSticky']) {
                 $buff[] = '[tooltip=tooltip_sticky]' . $ss['nSticky'] . '[/tooltip]';
             }
             if ($ss['nPending']) {
                 $buff[] = '[tooltip=tooltip_pending]' . $ss['nPending'] . '[/tooltip]';
             }
         }
         $contrib[] = Lang::user('screenshots') . Lang::main('colon') . $ss['sum'] . ($buff ? ' [small](' . implode($buff, ' + ') . ')[/small]' : null);
     }
     $vi = DB::Aowow()->selectRow('SELECT COUNT(id) AS sum, SUM(IF(status & ?d, 1, 0)) AS nSticky, SUM(IF(status & ?d, 0, 1)) AS nPending FROM ?_videos WHERE userIdOwner = ?d AND (status & ?d) = 0', CC_FLAG_STICKY, CC_FLAG_APPROVED, $this->user['id'], CC_FLAG_DELETED);
     if ($vi['sum']) {
         $buff = [];
         if ($vi['nSticky'] || $vi['nPending']) {
             if ($normal = $vi['sum'] - $vi['nSticky'] - $vi['nPending']) {
                 $buff[] = '[tooltip=tooltip_normal]' . $normal . '[/tooltip]';
             }
             if ($vi['nSticky']) {
                 $buff[] = '[tooltip=tooltip_sticky]' . $vi['nSticky'] . '[/tooltip]';
             }
             if ($vi['nPending']) {
                 $buff[] = '[tooltip=tooltip_pending]' . $vi['nPending'] . '[/tooltip]';
             }
         }
         $contrib[] = Lang::user('videos') . Lang::main('colon') . $vi['sum'] . ($buff ? ' [small](' . implode($buff, ' + ') . ')[/small]' : null);
     }
     // contrib -> Forum posts: 5769 [small]([tooltip=topics]579[/tooltip] + [tooltip=replies]5190[/tooltip])[/small]
     $this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]';
     if ($contrib) {
         $this->contributions = '[ul][li]' . implode('[/li][li]', $contrib) . '[/li][/ul]';
     }
     /****************/
     /* Main Content */
     /****************/
     $this->name = $this->user['title'] ? $this->user['displayName'] . '&nbsp;&lt;' . $this->user['title'] . '&gt;' : sprintf(Lang::user('profileTitle'), $this->user['displayName']);
     /**************/
     /* Extra Tabs */
     /**************/
     $this->lvTabs = [];
     $this->forceTabs = true;
     // [unused] Site Achievements
     // Reputation changelog (params only for comment-events)
     if ($repData = DB::Aowow()->select('SELECT action, amount, date AS \'when\', IF(action IN (3, 4, 5), sourceA, 0) AS param FROM ?_account_reputation WHERE userId = ?d', $this->user['id'])) {
         foreach ($repData as &$r) {
             $r['when'] = date(Util::$dateFormatInternal, $r['when']);
         }
         $this->lvTabs[] = ['reputationhistory', ['data' => $repData]];
     }
     // Comments
     if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => false], $nFound)) {
         $tabData = array('data' => $_, 'hiddenCols' => ['author'], 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', '_totalCount' => $nFound);
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $tabData['name'] = '$LANG.tab_latestcomments';
             $tabData['note'] = '$$WH.sprintf(LANG.lvnote_usercomments, ' . $nFound . ')';
         }
         $this->lvTabs[] = ['commentpreview', $tabData];
     }
     // Comment Replies
     if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => true], $nFound)) {
         $tabData = array('data' => $_, 'hiddenCols' => ['author'], 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', '_totalCount' => $nFound);
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $tabData['name'] = '$LANG.tab_latestreplies';
             $tabData['note'] = '$$WH.sprintf(LANG.lvnote_userreplies, ' . $nFound . ')';
         }
         $this->lvTabs[] = ['replypreview', $tabData];
     }
     // Screenshots
     if ($_ = CommunityContent::getScreenshots(-$this->user['id'], 0, $nFound)) {
         $tabData = array('data' => $_, '_totalCount' => $nFound);
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $tabData['name'] = '$LANG.tab_latestscreenshots';
             $tabData['note'] = '$$WH.sprintf(LANG.lvnote_userscreenshots, ' . $nFound . ')';
         }
         $this->lvTabs[] = ['screenshot', $tabData];
     }
     // Videos
     if ($_ = CommunityContent::getVideos(-$this->user['id'], 0, $nFound)) {
         $tabData = array('data' => $_, '_totalCount' => $nFound);
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $tabData['name'] = '$LANG.tab_latestvideos';
             $tabData['note'] = '$$WH.sprintf(LANG.lvnote_uservideos, ' . $nFound . ')';
         }
         $this->lvTabs[] = ['video', $tabData];
     }
     // forum -> latest topics  [unused]
     // forum -> latest replies [unused]
     // Characters [todo]
     $this->user['characterData'] = [];
     /*
         us_addCharactersTab([
             {
                 id:763,
                 "name":"Lilywhite",
                 "achievementpoints":"0",
                 "guild":"whatever",
                 "guildrank":"0",
                 "realm":"draenor",
                 "realmname":"Draenor",
                 "battlegroup":"cyclone",
                 "battlegroupname":"Cyclone",
                 "region":"us",
                 "level":"10",
                 "race":"7",
                 "gender":"0",
                 "classs":"1",
                 "faction":"0",
                 "gearscore":"0",
                 "talenttree1":"0",
                 "talenttree2":"0",
                 "talenttree3":"0",
                 "talentspec":0,
                 "published":1,
                 "pinned":0
             }
         ]);
     */
     // Profiles [todo]
     $this->user['profileData'] = [];
 }
Example #3
0
                            </td>
                        </tr>
                    </table>

                    <br>
                    <div style="position: absolute; right: 5px; bottom: 5px;"><?php 
echo Lang::account('forgot') . Lang::main('colon');
?>
<a href="?account=forgotusername"><?php 
echo Lang::account('forgotUser');
?>
</a> | <a href="?account=forgotpassword"><?php 
echo Lang::account('forgotPass');
?>
</a></div>
                </div>
            </form>

            <div class="pad3"></div>
<?php 
if (CFG_ACC_ALLOW_REGISTER) {
    echo '            <div style="text-align: center; line-height: 1.5em; font-size: 125%">' . Lang::account('accCreate') . "</div>\n";
}
?>
            <script type="text/javascript">$WH.ge('username-generic').focus()</script>
            <div class="clear"></div>
        </div><!-- main-contents -->
    </div><!-- main -->

<?php 
$this->brick('footer');
Example #4
0
                <div style="max-width:300px;" class="minibox">
                    <h1 class="q10"><?php 
    echo Lang::account('accBanned');
    ?>
</h1>
                    <ul style="text-align:left">
                        <li><div><?php 
    echo '<b>' . Lang::account('bannedBy') . '</b>' . Lang::main('colon') . '<a href="?user='******'by'][0] . '">' . $b['by'][1] . '</a>';
    ?>
</div></li>
                        <li><div><?php 
    echo '<b>' . Lang::account('ends') . '</b>' . Lang::main('colon') . ($b['end'] ? date(Lang::main('dateFmtLong'), $b['end']) : Lang::account('permanent'));
    ?>
</div></li>
                        <li><div><?php 
    echo '<b>' . Lang::account('reason') . '</b>' . Lang::main('colon') . '<span class="msg-failure">' . ($b['reason'] ?: Lang::account('noReason')) . '</span>';
    ?>
</div></li>
                    </ul>
                </div>
<?php 
    /* todo (sometime else)
    else:
    
    // profile editing
    echo '                    '.Lang::account('editAccount')."\n";
     ?>
    
                        <ul class="last">
                            <li><div><a href="#community">{$lang.publicDesc}</a></div></li>
                            <li><div><a href="#claim-characters">{$lang.claimChars}</a></div></li>
Example #5
0
 private function initRecovery($type, $delay, &$token)
 {
     if (!$type) {
         return Lang::main('intError');
     }
     // check if already processing
     if ($_ = DB::Aowow()->selectCell('SELECT statusTimer - UNIX_TIMESTAMP() FROM ?_account WHERE email = ? AND status <> ?d AND statusTimer > UNIX_TIMESTAMP()', $this->_post['email'], ACC_STATUS_OK)) {
         return sprintf(Lang::account('isRecovering'), Util::formatTime($_ * 1000));
     }
     // create new token and write to db
     $token = Util::createHash();
     if (!DB::Aowow()->query('UPDATE ?_account SET token = ?, status = ?d, statusTimer =  UNIX_TIMESTAMP() + ?d WHERE email = ?', $token, $type, $delay, $this->_post['email'])) {
         return Lang::main('intError');
     }
 }
Example #6
0
 protected function generateContent()
 {
     /***********/
     /* Infobox */
     /***********/
     $infobox = $contrib = $groups = [];
     foreach (Lang::account('groups') as $idx => $key) {
         if ($idx >= 0 && $this->user['userGroups'] & 1 << $idx) {
             $groups[] = (!fMod(count($groups) + 1, 3) ? '[br]' : null) . Lang::account('groups', $idx);
         }
     }
     $infobox[] = Lang::user('joinDate') . Lang::main('colon') . '[tooltip name=joinDate]' . date('l, G:i:s', $this->user['joinDate']) . '[/tooltip][span class=tip tooltip=joinDate]' . date(Lang::main('dateFmtShort'), $this->user['joinDate']) . '[/span]';
     $infobox[] = Lang::user('lastLogin') . Lang::main('colon') . '[tooltip name=lastLogin]' . date('l, G:i:s', $this->user['prevLogin']) . '[/tooltip][span class=tip tooltip=lastLogin]' . date(Lang::main('dateFmtShort'), $this->user['prevLogin']) . '[/span]';
     $infobox[] = Lang::user('userGroups') . Lang::main('colon') . ($groups ? implode(', ', $groups) : Lang::account('groups', -1));
     $infobox[] = Lang::user('consecVisits') . Lang::main('colon') . $this->user['consecutiveVisits'];
     $infobox[] = Util::ucFirst(Lang::main('siteRep')) . Lang::main('colon') . number_format($this->user['sumRep']);
     // contrib -> [url=http://www.wowhead.com/client]Data uploads: n [small]([tooltip=tooltip_totaldatauploads]xx.y MB[/tooltip])[/small][/url]
     $co = DB::Aowow()->selectRow('SELECT COUNT(DISTINCT c.id) AS sum, COUNT(cr.commentId) AS nRates FROM ?_comments c LEFT JOIN ?_comments_rates cr ON cr.commentId = c.id WHERE c.replyTo = 0 AND c.userId = ?d', $this->user['id']);
     if ($co['sum']) {
         $contrib[] = Lang::user('comments') . Lang::main('colon') . $co['sum'] . ' [small]([tooltip=tooltip_totalratings]' . $co['nRates'] . '[/tooltip])[/small]';
     }
     $ss = DB::Aowow()->selectRow('SELECT COUNT(id) AS sum, SUM(IF(status & ?d, 1, 0)) as nSticky FROM ?_screenshots WHERE userIdOwner = ?d AND status & ?d AND (status & ?d) = 0', CC_FLAG_STICKY, $this->user['id'], CC_FLAG_APPROVED, CC_FLAG_DELETED);
     if ($ss['sum']) {
         $contrib[] = Lang::user('screenshots') . Lang::main('colon') . $ss['sum'] . ' [small]([tooltip=tooltip_normal]' . ($ss['sum'] - $ss['nSticky']) . '[/tooltip] + [tooltip=tooltip_sticky]' . $ss['nSticky'] . '[/tooltip])[/small]';
     }
     $vi = DB::Aowow()->selectRow('SELECT COUNT(id) AS sum, SUM(IF(status & ?d, 1, 0)) as nSticky FROM ?_videos WHERE userIdOwner = ?d AND status & ?d AND (status & ?d) = 0', CC_FLAG_STICKY, $this->user['id'], CC_FLAG_APPROVED, CC_FLAG_DELETED);
     if ($vi['sum']) {
         $contrib[] = Lang::user('videos') . Lang::main('colon') . $vi['sum'] . ' [small]([tooltip=tooltip_normal]' . ($vi['sum'] - $vi['nSticky']) . '[/tooltip] + [tooltip=tooltip_sticky]' . $vi['nSticky'] . '[/tooltip])[/small]';
     }
     // contrib -> Forum posts: 5769 [small]([tooltip=topics]579[/tooltip] + [tooltip=replies]5190[/tooltip])[/small]
     $this->infobox = '[ul][li]' . implode('[/li][li]', $infobox) . '[/li][/ul]';
     if ($contrib) {
         $this->contributions = '[ul][li]' . implode('[/li][li]', $contrib) . '[/li][/ul]';
     }
     /****************/
     /* Main Content */
     /****************/
     $this->name = $this->user['title'] ? $this->user['displayName'] . '&nbsp;&lt;' . $this->user['title'] . '&gt;' : sprintf(Lang::user('profileTitle'), $this->user['displayName']);
     /**************/
     /* Extra Tabs */
     /**************/
     $this->lvTabs = [];
     $this->forceTabs = true;
     // [unused] Site Achievements
     // Reputation changelog (params only for comment-events)
     if ($repData = DB::Aowow()->select('SELECT action, amount, date AS \'when\', IF(action IN (3, 4, 5), sourceA, 0) AS param FROM ?_account_reputation WHERE userId = ?d', $this->user['id'])) {
         foreach ($repData as &$r) {
             $r['when'] = date(Util::$dateFormatInternal, $r['when']);
         }
         $this->lvTabs[] = array('file' => 'reputationhistory', 'data' => $repData, 'params' => []);
     }
     // Comments
     if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => false], $nFound)) {
         $lvData = array('file' => 'commentpreview', 'data' => $_, 'params' => array('hiddenCols' => "\$['author']", 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', '_totalCount' => $nFound));
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $lvData['params']['name'] = '$LANG.tab_latestcomments';
             $lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_usercomments, ' . $nFound . ')';
         }
         $this->lvTabs[] = $lvData;
     }
     // Comment Replies
     if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => true], $nFound)) {
         $lvData = array('file' => 'replypreview', 'data' => $_, 'params' => array('hiddenCols' => "\$['author']", 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', '_totalCount' => $nFound));
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $lvData['params']['name'] = '$LANG.tab_latestreplies';
             $lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_userreplies, ' . $nFound . ')';
         }
         $this->lvTabs[] = $lvData;
     }
     // Screenshots
     if ($_ = CommunityContent::getScreenshots(-$this->user['id'], 0, $nFound)) {
         $lvData = array('file' => 'screenshot', 'data' => $_, 'params' => array('_totalCount' => $nFound));
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $lvData['params']['name'] = '$LANG.tab_latestscreenshots';
             $lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_userscreenshots, ' . $nFound . ')';
         }
         $this->lvTabs[] = $lvData;
     }
     // Videos
     if ($_ = CommunityContent::getVideos(-$this->user['id'], 0, $nFound)) {
         $lvData = array('file' => 'video', 'data' => $_, 'params' => array('_totalCount' => $nFound));
         if ($nFound > CFG_SQL_LIMIT_DEFAULT) {
             $lvData['params']['name'] = '$LANG.tab_latestvideos';
             $lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_uservideos, ' . $nFound . ')';
         }
         $this->lvTabs[] = $lvData;
     }
     // forum -> latest topics  [unused]
     // forum -> latest replies [unused]
     // Characters [todo]
     $this->user['characterData'] = [];
     // Profiles [todo]
     $this->user['profileData'] = [];
 }
Example #7
0
    ?>
</h1>
                    <div id="inputbox-error"><?php 
    echo $this->error;
    ?>
</div>

                    <div style="text-align: center">
                        <?php 
    echo Lang::account('email') . Lang::main('colon');
    ?>
<input type="text" name="email" value="" id="email-generic" style="width: 12em" />
                        <div class="pad2"></div>

                        <input type="submit" value="<?php 
    echo Lang::account('continue');
    ?>
" />
                    </div>

                </div>
            </form>
            <script type="text/javascript">$WH.ge('email-generic').focus()</script>
<?php 
}
?>
            <div class="clear"></div>
        </div><!-- main-contents -->
    </div><!-- main -->

<?php