コード例 #1
0
ファイル: public_user.php プロジェクト: Gerold103/lgmis
    $content .= '<br><div class="row" align="center">';
    $content .= '<div class="' . ColAllTypes(6) . '" align="right"><font color="grey">' . Language::Word('position') . ':</font></div>';
    $content .= '<div class="' . ColAllTypes(6) . '" align="left">' . $user->GetPosition() . '</div>';
    $content .= '</div>';
    $articles = Article::FetchCountOf(['where' => 'author_id = ' . $user->GetID()]);
    $content .= '<div class="row" align="center">';
    $content .= '<div class="' . ColAllTypes(6) . '" align="right"><font color="grey">' . Language::Word('news published') . ':</font></div>';
    $content .= '<div class="' . ColAllTypes(6) . '" align="left">' . $articles . '</div>';
    $content .= '</div>';
    $content .= '<hr>';
    $content .= ToPageHeader(Language::PublicMenu('contacts'), 'h4', 'grey');
    $content .= '<div class="row" align="center">';
    $content .= '<div class="' . ColAllTypes(6) . '" align="right"><font color="grey">' . Language::Word('mail') . ':</font></div>';
    $content .= '<div class="' . ColAllTypes(6) . '" align="left"><a href="mailto:' . $user->GetEmail() . '">' . $user->GetEmail() . '</a></div>';
    $content .= '</div>';
    $content .= '</div>';
    $content .= '</div>';
    $content .= '<hr>';
    $blocks = UserBlock::FetchAllByAuthorID($user->GetID());
    $size = count($blocks);
    if ($size) {
        require $link_to_pagination_init_template;
        for ($i = $from; $i <= $to; ++$i) {
            $content .= $blocks[$i]->ToHTMLAutoFull(GetUserPrivileges()) . '<hr>';
        }
        require $link_to_pagination_show_template;
        $content .= $pagination;
    }
    $no_content_center = true;
}
include $link_to_public_template;
コード例 #2
0
 /**
  * Retrieves and shows the gathered info to the user
  * @param $target Mixed: user whose info we're looking up
  */
 function showInfo($target, $emailUser = "")
 {
     global $wgOut, $wgLang, $wgScript, $wgEnableWallExt, $wgEnableUserLoginExt;
     //Small Stuff Week - adding table from Special:LookupContribs --nAndy
     global $wgExtensionsPath, $wgJsMimeType, $wgResourceBasePath, $wgEnableLookupContribsExt;
     /**
      * look for @ in username
      */
     $count = 0;
     $aUsers = array();
     $userTarget = "";
     if (strpos($target, '@') !== false) {
         /**
          * find username by email
          */
         $emailUser = htmlspecialchars($emailUser);
         $dbr = wfGetDB(DB_SLAVE);
         $oRes = $dbr->select("user", "user_name", array("user_email" => $target), __METHOD__);
         $loop = 0;
         while ($oRow = $dbr->fetchObject($oRes)) {
             if ($loop === 0) {
                 $userTarget = $oRow->user_name;
             }
             if (!empty($emailUser) && $emailUser == $oRow->user_name) {
                 $userTarget = $emailUser;
             }
             $aUsers[] = $oRow->user_name;
             $loop++;
         }
         $count = $loop;
     }
     $user = User::newFromName(!empty($userTarget) ? $userTarget : $target);
     $tempUser = false;
     if ($user == null || $user->getId() == 0) {
         // Check if a temporary user is at this name
         if (!empty($wgEnableUserLoginExt)) {
             $tempUser = TempUser::getTempUserFromName(!empty($userTarget) ? $userTarget : $target);
         }
         if ($tempUser) {
             $user = $tempUser->mapTempUserToUser(false);
         } else {
             $wgOut->addWikiText('<span class="error">' . wfMsg('lookupuser-nonexistent', $target) . '</span>');
             return;
         }
     }
     if ($count > 1) {
         $options = array();
         if (!empty($aUsers) && is_array($aUsers)) {
             foreach ($aUsers as $id => $userName) {
                 $options[] = XML::option($userName, $userName, $userName == $userTarget);
             }
         }
         $selectForm = Xml::openElement('select', array('id' => 'email_user', 'name' => "email_user"));
         $selectForm .= "\n" . implode("\n", $options) . "\n";
         $selectForm .= Xml::closeElement('select');
         $selectForm .= "({$count})";
         $wgOut->addHTML(Xml::openElement('fieldset') . "\n" . Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . "\n" . Html::hidden('title', $this->getTitle()->getPrefixedText()) . "\n" . Html::hidden('target', $target) . "\n" . Xml::openElement('table', array('border' => '0')) . "\n" . Xml::openElement('tr') . "\n" . Xml::openElement('td', array('align' => 'right')) . wfMsgHtml('lookupuser-foundmoreusers') . Xml::closeElement('td') . "\n" . Xml::openElement('td', array('align' => 'left')) . "\n" . $selectForm . Xml::closeElement('td') . "\n" . Xml::openElement('td', array('colspan' => '2', 'align' => 'center')) . Xml::submitButton(wfMsgHtml('go')) . Xml::closeElement('td') . "\n" . Xml::closeElement('tr') . "\n" . Xml::closeElement('table') . "\n" . Xml::closeElement('form') . "\n" . Xml::closeElement('fieldset'));
     }
     $authTs = $user->getEmailAuthenticationTimestamp();
     if ($authTs) {
         $authenticated = wfMsg('lookupuser-authenticated', $wgLang->timeanddate($authTs));
     } else {
         $authenticated = wfMsg('lookupuser-not-authenticated');
     }
     $optionsString = '';
     foreach ($user->getOptions() as $name => $value) {
         $optionsString .= "{$name} = {$value} <br />";
     }
     $name = $user->getName();
     if ($user->getEmail()) {
         $email = $user->getEmail();
         $email_output = wfMsg('lookupuser-email', $email, $name);
     } else {
         $email_output = wfMsg('lookupuser-no-email');
     }
     if ($user->getRegistration()) {
         $registration = $wgLang->timeanddate($user->getRegistration());
     } else {
         $registration = wfMsg('lookupuser-no-registration');
     }
     $wgOut->addWikiText('*' . wfMsg('username') . ' [[User:'******'|' . $name . ']] (' . $wgLang->pipeList(array('<span id="lu-tools">[[' . (!empty($wgEnableWallExt) ? 'Message Wall:' . $name . '|' . wfMsg('wall-message-wall-shorten') : 'User talk:' . $name . '|' . wfMsg('talkpagelinktext')) . ']]', '[[Special:Contributions/' . $name . '|' . wfMsg('contribslink') . ']]</span>)')));
     $wgOut->addWikiText('*' . wfMsgForContent('lookupuser-toollinks', $name, urlencode($name)));
     $wgOut->addWikiText('*' . wfMsg('lookupuser-id', $user->getId()));
     if (!empty($tempUser)) {
         $userStatus = wfMsg('lookupuser-account-status-tempuser');
     } else {
         $userStatus = wfMsg('lookupuser-account-status-realuser');
     }
     $wgOut->addWikiText('*' . wfMsg('lookupuser-account-status') . $userStatus);
     $wgOut->addWikiText('*' . $email_output);
     $wgOut->addWikiText('*' . wfMsg('lookupuser-realname', $user->getRealName()));
     $wgOut->addWikiText('*' . wfMsg('lookupuser-registration', $registration));
     $wgOut->addWikiText('*' . wfMsg('lookupuser-touched', $wgLang->timeanddate($user->mTouched)));
     $wgOut->addWikiText('*' . wfMsg('lookupuser-info-authenticated', $authenticated));
     //Begin: Small Stuff Week - adding table from Special:LookupContribs --nAndy
     if (!empty($wgEnableLookupContribsExt)) {
         $wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/LookupContribs/css/table.css");
         $wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/LookupUser/css/lookupuser.css");
         $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgResourceBasePath}/resources/wikia/libraries/jquery/datatables/jquery.dataTables.min.js\"></script>\n");
         //checking and setting User::mBlockedGlobally if needed
         //only for this instance of class User
         if (class_exists('UserBlock')) {
             UserBlock::blockCheck($user);
         }
         $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
         $oTmpl->set_vars(array('username' => $name, 'isUsernameGloballyBlocked' => $user->isBlockedGlobally()));
         $wgOut->addHTML($oTmpl->render('contribution.table'));
     } else {
         $wgOut->addWikiText('*' . wfMsg('lookupuser-table-cannot-be-displayed'));
     }
     //End: Small Stuff Week
     $wgOut->addWikiText('*' . wfMsg('lookupuser-useroptions') . '<br />' . $optionsString);
 }
コード例 #3
0
ファイル: admin_user_block.php プロジェクト: Gerold103/lgmis
                $content .= 'filebrowserImageBrowseUrl : "' . $link_to_img_browse . '?' . http_build_query($assoc) . '",';
                $content .= 'contentsCss: [CKEDITOR.basePath + "contents.css", "css/styles.css", "css/bootstrap.min.css"],';
                $content .= 'allowedContent: true, });';
                $content .= 'CKEDITOR.config.height = 400;';
                $content .= '</script>';
                $content .= '<div class="row">';
                $content .= '<input type="submit" class="btn btn-primary btn-lg" name="add" value="' . Language::Word('save') . '">';
                $content .= '</div>';
                $content .= '</form>';
            }
        } else {
            if (!isset($_REQUEST['full'])) {
                echo 'action_type is unset. Must be "full"';
                exit;
            }
            if (!isset($_REQUEST['type'])) {
                echo 'object type is unset. Must be "user"';
                exit;
            }
            if (!isset($_REQUEST['id'])) {
                echo 'user id is unset';
                exit;
            }
            $user_block = UserBlock::FetchByID($_REQUEST['id']);
            $title = Language::Word('user block');
            $header = htmlspecialchars($user_block->name);
            $content = $user_block->ToHTMLAutoFull(GetUserPrivileges());
        }
    }
}
include_once $link_to_admin_template;
コード例 #4
0
 public function match_email_old()
 {
     /* problem with Phalanx service? - use previous version of Phalanx extension - tested */
     $abortError = '';
     return UserBlock::onAbortNewAccount($this->user, $abortError, $this->block);
 }
コード例 #5
0
ファイル: userblock.php プロジェクト: Gerold103/lgmis
 public static function Delete($id)
 {
     global $db_connection;
     global $link_to_users_images;
     $usr_blck = UserBlock::FetchByID($id);
     $langs = $usr_blck->FetchLanguages();
     $from_table = UserBlock::$table;
     if ($usr_blck->language !== 'rus') {
         $from_table .= '_' . $usr_blck->language;
     }
     $author_id = $usr_blck->author_id;
     if (!$db_connection->query("DELETE FROM `" . $from_table . "` WHERE `id` = " . $id)) {
         echo $db_connection->error;
         return 0;
     } else {
         if (count($langs) < 2) {
             removeDirectory($link_to_users_images . $author_id . '/blocks/' . $id);
         }
         return 1;
     }
 }
コード例 #6
0
         } else {
             $content = AlertMessage('alert-success', Language::Word('request is accepted'));
             RequestOnRegister::Delete($_POST['id']);
         }
     }
     break;
 case UserBlock::$type:
     $usr_block = UserBlock::FetchFromAssoc($_POST);
     if ($usr_block === NULL) {
         $content = AlertMessage('alert-danger', Language::Word('error while user block adding'));
     } else {
         $glob_id = 0;
         if (isset($_POST['glob_id'])) {
             $glob_id = $_POST['glob_id'];
         }
         if (UserBlock::InsertToDB($usr_block, $_POST['language'], $glob_id)) {
             $content = AlertMessage('alert-success', Language::Word('user block is successfully added'));
         } else {
             $content = AlertMessage('alert-danger', Language::Word('error during user block inserting'));
         }
     }
     break;
 case Article::$type:
     $assoc = $_POST;
     $assoc['author_id'] = $_POST['id'];
     unset($assoc['id']);
     $article = Article::FetchFromAssoc($assoc);
     if ($article === NULL) {
         $content = AlertMessage('alert-danger', Language::Word('error while article adding'));
     } else {
         $glob_id = 0;
コード例 #7
0
ファイル: user.php プロジェクト: Gerold103/lgmis
 public function ToHTMLPrivateFull()
 {
     global $user_blocks_in_db;
     global $link_to_admin_user_block;
     global $link_to_admin_bookkeeping;
     global $positions;
     $res = '';
     $res .= '<div class="row">';
     $res .= '<div class="' . ColAllTypes(1) . '"></div>';
     $res .= '<div class="' . ColAllTypes(5) . ' vcenter" align="right">';
     $res .= '<img src="' . $this->path_to_photo . '" class="img-rounded img-avatar">';
     $res .= '</div>';
     $res .= '<div class="' . ColAllTypes(5) . ' vcenter" align="left">';
     $res .= PairLabelAndPanel(2, 10, Language::Word('full name'), Language::Translit(htmlspecialchars($this->surname . ' ' . $this->name . ' ' . $this->fathername)));
     $res .= PairLabelAndPanel(2, 10, Language::Word('position'), htmlspecialchars(Language::Position($this->position)));
     $res .= PairLabelAndPanel(2, 10, Language::Word('mail'), htmlspecialchars($this->email));
     $res .= PairLabelAndPanel(2, 10, Language::Word('telephone'), htmlspecialchars($this->telephone));
     $res .= PairLabelAndPanel(2, 10, Language::Word('birthday'), htmlspecialchars($this->GetBirthday()));
     if (GetUserLogin() === $this->login || GetUserLogin() === 'admin') {
         $actions = '<div class="row">';
         $actions .= '<div class="' . ColAllTypes(6) . '">' . $this->ToHTMLDel() . '</div>';
         $actions .= '<div class="' . ColAllTypes(6) . '">' . $this->ToHTMLEdit() . '</div>';
         $actions .= '</div>';
         $res .= PairLabelAndPanel(2, 10, Language::Word('actions'), $actions);
     }
     $res .= '</div>';
     $res .= '</div>';
     if (GetUserLogin() === $this->login || GetUserLogin() === 'admin') {
         $res .= '<div class="row" align="center">';
         $res .= '<div class="' . ColAllTypes(1) . '"></div>';
         $res .= '<div class="' . ColAllTypes(10) . '">';
         $args = array('action_link' => $link_to_admin_user_block, 'action_type' => 'add', 'obj_type' => UserBlock::$type, 'id' => $this->id, 'btn_text' => Language::Word('add block'), 'btn_size' => 'btn-lg');
         $res .= '<span style="margin: 3px;">' . ActionButton($args) . '</span>';
         $res .= '</div>';
         $res .= '</div>';
     }
     $my_blocks = UserBlock::FetchAllByAuthorID($this->id);
     $size = count($my_blocks);
     if ($size === 0) {
         return $res;
     }
     $from = -1;
     $to = -1;
     global $link_to_pagination_init_template;
     require $link_to_pagination_init_template;
     for ($i = $from; $i <= $to; ++$i) {
         $res .= $my_blocks[$i]->ToHTMLAutoShortForTable(GetUserPrivileges());
     }
     $pagination = '';
     global $link_to_pagination_show_template;
     require $link_to_pagination_show_template;
     $res .= $pagination;
     return $res;
 }