/** * Called by ArticleFromTitle hook * Calls UserProfilePage instead of standard article * * @param &$title Title object * @param &$article Article object * @return true */ function wfUserProfileFromTitle( &$title, &$article ) { global $wgRequest, $wgOut, $wgHooks, $wgUserPageChoice, $wgUserProfileScripts; if ( strpos( $title->getText(), '/' ) === false && ( NS_USER == $title->getNamespace() || NS_USER_PROFILE == $title->getNamespace() ) ) { $show_user_page = false; if ( $wgUserPageChoice ) { $profile = new UserProfile( $title->getText() ); $profile_data = $profile->getProfile(); // If they want regular page, ignore this hook if ( isset( $profile_data['user_id'] ) && $profile_data['user_id'] && $profile_data['user_page_type'] == 0 ) { $show_user_page = true; } } if ( !$show_user_page ) { // Prevents editing of userpage if ( $wgRequest->getVal( 'action' ) == 'edit' ) { $wgOut->redirect( $title->getFullURL() ); } } else { $wgOut->enableClientCache( false ); $wgHooks['ParserLimitReport'][] = 'wfUserProfileMarkUncacheable'; } $wgOut->addExtensionStyle( $wgUserProfileScripts . '/UserProfile.css' ); $article = new UserProfilePage( $title ); } return true; }
public function syncWithDB() { //check if socprof is installed if (class_exists('UserProfile')) { $socprof = new UserProfile($this->User); $info = $socprof->getProfile(); $this->setName($info['real_name']); $this->setEmail($info['email']); $this->setCity($info['location_city']); $this->setState($info['location_state']); $this->setCountry($info['location_country']); $this->setHomeCity($info['hometown_city']); $this->setHomeState($info['hometown_state']); $this->setHomeCountry($info['hometown_country']); $this->setBirthday($info['birthday']); $this->setAboutMe($info['about']); $this->setOccupation($info['occupation']); $this->setSchools($info['schools']); $this->setPlaces($info['places_lived']); $this->setWebsites($info['websites']); $this->updateAvatar(); //setting interests $interests = array(); if (!empty($info['companies'])) { $interests[] = $info['companies']; } if (!empty($info['movies'])) { $interests[] = $info['movies']; } if (!empty($info['music'])) { $interests[] = $info['music']; } if (!empty($info['tv'])) { $interests[] = $info['tv']; } if (!empty($info['books'])) { $interests[] = $info['books']; } if (!empty($info['magazines'])) { $interests[] = $info['magazines']; } if (!empty($info['video_games'])) { $interests[] = $info['video_games']; } if (!empty($info['snacks'])) { $interests[] = $info['snacks']; } if (!empty($info['drinks'])) { $interests[] = $info['drinks']; } $this->setInterests($interests); } else { throw new SocProfException(); } }
public function display() { $i02fcabda2448d40bdb76bd10f9e95950039649ee = parent::display(); $i8095598e75aa0d17622b51f9b7beb10357fca949 = new UserProfile($this->getDb()); $i82b0989d971c0abe32c9c0bdb380130c4cb90af2 = $i8095598e75aa0d17622b51f9b7beb10357fca949->getProfile(); $i02fcabda2448d40bdb76bd10f9e95950039649ee .= '<h2>' . v_paypal_credit . '</h2>'; $i6f22d8e7415523653f4ab7e8aea177f3aa168425 = array("Czech Republic", "Slovakia", "Slovenia", "Bulgaria", "Romania", "Spain", "Sweden", "United Kingdom", "Austria", "Belgium", "Cyprus", "Denmark", "France", "Germany", "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg", "Netherlands", "Poland", "Portugal", "Estonia", "Malta", "Finland", "Croatia"); $i8d8dd00a3e8afebc7c40263e5a4efa3b353b5c90 = $_SERVER['SERVER_NAME']; $i4cfaa132e787f1824f59093b2651e99b3608580b = in_array($i82b0989d971c0abe32c9c0bdb380130c4cb90af2["country0"], $i6f22d8e7415523653f4ab7e8aea177f3aa168425) && strlen($i82b0989d971c0abe32c9c0bdb380130c4cb90af2["companyvat"]) < 4 ? 1 : 0; $i02fcabda2448d40bdb76bd10f9e95950039649ee .= ' <p> ' . v_paypal_clickhereif . ' <a style="text-decoration:underline;" href="http://pay.topefekt.com/pay.php?user='******'&passwd=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["passwd"] . '&vat=' . $i4cfaa132e787f1824f59093b2651e99b3608580b . '&country=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["country0"] . '" onclick="window.open(this.href);return false;">' . v_paypal_credit . '</a> </p> <br /> <iframe frameborder="no" style="margin:0px;padding:0px;width:100%;height:460px" src="https://pay.topefekt.com/pay.php?parentUrl=' . $i8d8dd00a3e8afebc7c40263e5a4efa3b353b5c90 . '&user='******'&passwd=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["passwd"] . '&vat=' . $i4cfaa132e787f1824f59093b2651e99b3608580b . '&country=' . $i82b0989d971c0abe32c9c0bdb380130c4cb90af2["country0"] . '"></iframe> '; return $i02fcabda2448d40bdb76bd10f9e95950039649ee; }
public function display() { $iae8c74e5273dec25096dbae362493a9f609ecfc8 = parent::display(); $i15f0440429ef770fbaf8bd58ae6bab5bcc2e123c = new UserProfile($this->getDb()); $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e = $i15f0440429ef770fbaf8bd58ae6bab5bcc2e123c->getProfile(); $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= '<h2>' . v_paypal_credit . '</h2>'; $i30c1f0035204897cb8aff2b0300f928f53458359 = array("Czech Republic", "Slovakia", "Slovenia", "Bulgaria", "Romania", "Spain", "Sweden", "United Kingdom", "Austria", "Belgium", "Cyprus", "Denmark", "France", "Germany", "Greece", "Hungary", "Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg", "Netherlands", "Poland", "Portugal", "Estonia", "Malta", "Finland", "Croatia"); $ic89f6ee1fce286859ae8d93f4093a075a9f3f428 = $_SERVER['SERVER_NAME']; $i77b7f2e63af91d5f4a4311347172cb7e855e0b3f = in_array($iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["country0"], $i30c1f0035204897cb8aff2b0300f928f53458359) && strlen($iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["companyvat"]) < 4 ? 1 : 0; $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= ' <p> ' . v_paypal_clickhereif . ' <a style="text-decoration:underline;" href="http://pay.topefekt.com/pay.php?user='******'&passwd=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["passwd"] . '&vat=' . $i77b7f2e63af91d5f4a4311347172cb7e855e0b3f . '&country=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["country0"] . '" onclick="window.open(this.href);return false;">' . v_paypal_credit . '</a> </p> <br /> <iframe frameborder="no" style="margin:0px;padding:0px;width:100%;height:460px" src="https://pay.topefekt.com/pay.php?parentUrl=' . $ic89f6ee1fce286859ae8d93f4093a075a9f3f428 . '&user='******'&passwd=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["passwd"] . '&vat=' . $i77b7f2e63af91d5f4a4311347172cb7e855e0b3f . '&country=' . $iedb9ad4d1c2a4ca104ff16e718edd851ea39d17e["country0"] . '"></iframe> '; return $iae8c74e5273dec25096dbae362493a9f609ecfc8; }
public function display() { $iae8c74e5273dec25096dbae362493a9f609ecfc8 = parent::display(); $i1238ed0a93a32faf9485892fe4a454435972b1cc = new UserProfile($this->getDb()); $i761d4d405845a382ce9ea0af0705de3e4856e9d9 = $i1238ed0a93a32faf9485892fe4a454435972b1cc->getProfile(); if (is_array($i761d4d405845a382ce9ea0af0705de3e4856e9d9) && count($i761d4d405845a382ce9ea0af0705de3e4856e9d9) > 2) { $this->username = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["user"]; $this->password = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["passwd"]; $this->simulate = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["simulatesms"]; $this->deleteDb = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["deletedb"]; $this->pocetkredit = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["pocetkredit"]; $this->deliveryemail = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["deliveryemail"]; $this->URLreports = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["URLreports"]; $this->pref_billing = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["pref_billing"]; $this->delivery_reports_error_only = $i761d4d405845a382ce9ea0af0705de3e4856e9d9["delivery_reports_error_only"]; } $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= '<script type="text/javascript" src="' . DIR_SMS_JS . 'sms.js"></script>'; if (!$this->fcade530f4a16debaf9c8b3aacfd7e7e557ee8292($i761d4d405845a382ce9ea0af0705de3e4856e9d9)) { $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= ' <h2>' . v_adminsmsprofile_profilenotactive . '</h2> <div> <div class="left half"> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_newaccount . '</legend> ' . $this->f54b8d242a128f32cc160d8be566e3a54e851d614() . ' </fieldset> </div> <div class="half right"> <fieldset> <legend><img alt="' . v_adminsmsprofile_sign . '" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_sign . '</legend> ' . $this->f26a88040808849cb2ea942bec2e313c01a3a7cd3() . ' </fieldset> </div> </div> '; } else { $i4367816f1ae76ddc44b3953c9ce6460e181a0a3a = new SmsModel($this->getDb()); $i3964ab17d4e3c76c12a1b84b29be7bf6f6484dc3 = date("Y-m-d"); $ic6e936002fe51b97bc1b95f337c09606ceb011de = $this->Execute("SELECT * FROM " . DB_PREFIX . "sp_settings where name like 'lastversion'"); if ($ic6e936002fe51b97bc1b95f337c09606ceb011de->num_rows) { foreach ($ic6e936002fe51b97bc1b95f337c09606ceb011de->rows as $i43ef5aef4168652439ef5de195405ced9f0f7952) { $i87395dcafb6eb7221410dbcd87e9e8ce0007214abfcabb3c146796c60c6a7ae4e3408160f3ac0ae = $i43ef5aef4168652439ef5de195405ced9f0f7952["value"]; } } else { $i87395dcafb6eb7221410dbcd87e9e8ce0007214abfcabb3c146796c60c6a7ae4e3408160f3ac0ae = 0; } if (!strlen($i87395dcafb6eb7221410dbcd87e9e8ce0007214abfcabb3c146796c60c6a7ae4e3408160f3ac0ae) > 0 || !isset($_SESSION["SMS_VERSION_ACTUAL"])) { $_SESSION["SMS_VERSION_ACTUAL"] = $i4367816f1ae76ddc44b3953c9ce6460e181a0a3a->refreshVersion(); $this->Execute("DELETE FROM " . DB_PREFIX . "sp_settings WHERE name = 'lastversion'"); $this->Execute("INSERT INTO `" . DB_PREFIX . "sp_settings` (`name`, `value`) VALUES ('lastversion','" . $this->escape($i3964ab17d4e3c76c12a1b84b29be7bf6f6484dc3) . "')"); $i4367816f1ae76ddc44b3953c9ce6460e181a0a3a->getExceptions(); } elseif ($i87395dcafb6eb7221410dbcd87e9e8ce0007214abfcabb3c146796c60c6a7ae4e3408160f3ac0ae != $i3964ab17d4e3c76c12a1b84b29be7bf6f6484dc3) { $_SESSION["SMS_VERSION_ACTUAL"] = $i4367816f1ae76ddc44b3953c9ce6460e181a0a3a->refreshVersion(); $this->Execute("UPDATE " . DB_PREFIX . "sp_settings SET value = '" . $this->escape($i3964ab17d4e3c76c12a1b84b29be7bf6f6484dc3) . "' WHERE name LIKE 'lastversion'"); $i4367816f1ae76ddc44b3953c9ce6460e181a0a3a->getExceptions(); } if ($_SESSION["SMS_VERSION_ACTUAL"] > SMS_VERSION) { $ie07972b4d7e69eb13cc2273c5cceb4c18a7f59df = '<span class="right"><a href="http://' . v_about_website_name_oc . '/download.html"><b>' . v_smsprestashop_newversion . " " . $_SESSION["SMS_VERSION_ACTUAL"] . '</b></a></span>'; } else { $ie07972b4d7e69eb13cc2273c5cceb4c18a7f59df = ""; } $ic6e936002fe51b97bc1b95f337c09606ceb011de = $this->Execute("SELECT * FROM " . DB_PREFIX . "sp_smsuser where ID=1"); $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= $ie07972b4d7e69eb13cc2273c5cceb4c18a7f59df . ' <h2>' . v_adminsmsprofile_profileactive . '</h2> <div> <div class="half left"> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_editaccount . '</legend> ' . $this->f16baed92b40c0611e279718e39c1f6f458b1b01a($ic6e936002fe51b97bc1b95f337c09606ceb011de, $i761d4d405845a382ce9ea0af0705de3e4856e9d9) . ' </fieldset> </div> <div class="right half"> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_accountinfo . '</legend> <table class="formTable profile"> <tbody> <tr> <td>' . self::getLabel(v_adminsmsprofile_username, 'class="bold"') . '</td> <td>' . $i761d4d405845a382ce9ea0af0705de3e4856e9d9["user"] . '</td> </tr> <tr> <td>' . self::getLabel(v_adminsmsprofile_password, 'class="bold"') . '</td> <td>' . $i761d4d405845a382ce9ea0af0705de3e4856e9d9["passwd"] . '</td> </tr> <tr> <td>' . self::getLabel(v_adminsmsprofile_credit, 'class="bold"') . '</td> <td>' . (isset($this->credit) ? $this->credit : "0.000") . '</td> </tr> </tbody> </table> </fieldset> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_addadmin . '</legend> <div id="snippet-admins">' . $this->fd4075c16d1a89b72662dd64f15f63dfa32583938() . '</div> </fieldset> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_settings . '</legend> ' . $this->f30de648edea18d0c5d3ce961826e1a20259c1f78() . ' </fieldset> </div> '; } $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= ' <script type="text/javascript"> jQuery(".bussinessButton").click(function(){ jQuery(".bussiness").removeClass("hidden"); }); jQuery(".personButton").click(function(){ jQuery(".bussiness").addClass("hidden"); }); </script> '; return $iae8c74e5273dec25096dbae362493a9f609ecfc8; }
public function display() { $i02fcabda2448d40bdb76bd10f9e95950039649ee = parent::display(); $i5071ce49aa74dec77b6a05acd8c726411c9543d8 = new UserProfile($this->getDb()); $i986f0e400c2b3a0307f9712307da35ce2ee9676d = $i5071ce49aa74dec77b6a05acd8c726411c9543d8->getProfile(); if (is_array($i986f0e400c2b3a0307f9712307da35ce2ee9676d) && count($i986f0e400c2b3a0307f9712307da35ce2ee9676d) > 2) { $this->username = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["user"]; $this->password = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["passwd"]; $this->simulate = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["simulatesms"]; $this->deleteDb = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["deletedb"]; $this->pocetkredit = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["pocetkredit"]; $this->deliveryemail = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["deliveryemail"]; $this->URLreports = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["URLreports"]; $this->pref_billing = $i986f0e400c2b3a0307f9712307da35ce2ee9676d["pref_billing"]; } $i02fcabda2448d40bdb76bd10f9e95950039649ee .= '<script type="text/javascript" src="' . DIR_SMS_JS . 'sms.js"></script>'; if (!$this->f2cabfeb0961627616624db11d0e24035e8011907($i986f0e400c2b3a0307f9712307da35ce2ee9676d)) { $i02fcabda2448d40bdb76bd10f9e95950039649ee .= ' <h2>' . v_adminsmsprofile_profilenotactive . '</h2> <div> <div class="left half"> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_newaccount . '</legend> ' . $this->f9fa65df97b8de00106ecf05e8e274673250fe19a() . ' </fieldset> </div> <div class="half right"> <fieldset> <legend><img alt="' . v_adminsmsprofile_sign . '" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_sign . '</legend> ' . $this->ffebe43f1766af3ed1ee846e89c66dee951e51062() . ' </fieldset> </div> </div> '; } else { $i9ec854a302fbdb72d043506b55d5bf395184517b = new SmsModel($this->getDb()); $ie5b0dc673ae7185f8cfea133baf9fef6a88b3281 = date("Y-m-d"); $i83d1339527a9dc91b02fa99420eb13b0cd47adfe = $this->Execute("SELECT * FROM " . DB_PREFIX . "sp_settings where name like 'lastversion'"); if ($i83d1339527a9dc91b02fa99420eb13b0cd47adfe->num_rows) { foreach ($i83d1339527a9dc91b02fa99420eb13b0cd47adfe->rows as $i2e93e61d67c274d891066238c74ba6322d527b6d) { $i88671923b16408bdf890533cf2d9063aefd56601 = $i2e93e61d67c274d891066238c74ba6322d527b6d["value"]; } } else { $i88671923b16408bdf890533cf2d9063aefd56601 = 0; } if (!strlen($i88671923b16408bdf890533cf2d9063aefd56601) > 0 || !isset($_SESSION["SMS_VERSION_ACTUAL"])) { $_SESSION["SMS_VERSION_ACTUAL"] = $i9ec854a302fbdb72d043506b55d5bf395184517b->refreshVersion(); $this->Execute("DELETE FROM " . DB_PREFIX . "sp_settings WHERE name = 'lastversion'"); $this->Execute("INSERT INTO `" . DB_PREFIX . "sp_settings` (`name`, `value`) VALUES ('lastversion','" . $this->escape($ie5b0dc673ae7185f8cfea133baf9fef6a88b3281) . "')"); $i9ec854a302fbdb72d043506b55d5bf395184517b->getExceptions(); } elseif ($i88671923b16408bdf890533cf2d9063aefd56601 != $ie5b0dc673ae7185f8cfea133baf9fef6a88b3281) { $_SESSION["SMS_VERSION_ACTUAL"] = $i9ec854a302fbdb72d043506b55d5bf395184517b->refreshVersion(); $this->Execute("UPDATE " . DB_PREFIX . "sp_settings SET value = '" . $this->escape($ie5b0dc673ae7185f8cfea133baf9fef6a88b3281) . "' WHERE name LIKE 'lastversion'"); $i9ec854a302fbdb72d043506b55d5bf395184517b->getExceptions(); } if ($_SESSION["SMS_VERSION_ACTUAL"] > SMS_VERSION) { $i88652dd482a8d77a2f80831b5c46f2f9101ac700 = '<span class="right"><a href="http://' . v_about_website_name_oc . '/download.html"><b>' . v_smsprestashop_newversion . " " . $_SESSION["SMS_VERSION_ACTUAL"] . '</b></a></span>'; } else { $i88652dd482a8d77a2f80831b5c46f2f9101ac700 = ""; } $i83d1339527a9dc91b02fa99420eb13b0cd47adfe = $this->Execute("SELECT * FROM " . DB_PREFIX . "sp_smsuser where ID=1"); $i02fcabda2448d40bdb76bd10f9e95950039649ee .= $i88652dd482a8d77a2f80831b5c46f2f9101ac700 . ' <h2>' . v_adminsmsprofile_profileactive . '</h2> <div> <div class="half left"> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_editaccount . '</legend> ' . $this->f917321b4b0c70b1606d7416e040dd2ed3a905ceb($i83d1339527a9dc91b02fa99420eb13b0cd47adfe, $i986f0e400c2b3a0307f9712307da35ce2ee9676d) . ' </fieldset> </div> <div class="right half"> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_accountinfo . '</legend> <table class="formTable profile"> <tbody> <tr> <td>' . self::getLabel(v_adminsmsprofile_username, 'class="bold"') . '</td> <td>' . $i986f0e400c2b3a0307f9712307da35ce2ee9676d["user"] . '</td> </tr> <tr> <td>' . self::getLabel(v_adminsmsprofile_password, 'class="bold"') . '</td> <td>' . $i986f0e400c2b3a0307f9712307da35ce2ee9676d["passwd"] . '</td> </tr> <tr> <td>' . self::getLabel(v_adminsmsprofile_credit, 'class="bold"') . '</td> <td>' . (isset($this->credit) ? $this->credit : "0.000") . '</td> </tr> </tbody> </table> </fieldset> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_addadmin . '</legend> <div id="snippet-admins">' . $this->fbf9b3101836799ebd580f8b6a6a2637ec8417539() . '</div> </fieldset> <fieldset> <legend><img alt="" src="' . self::$adminEmployeesImg . '" /> ' . v_adminsmsprofile_settings . '</legend> ' . $this->fb78d17953dd422cb85e244bdc187737b0839d1e1() . ' </fieldset> </div> '; } $i02fcabda2448d40bdb76bd10f9e95950039649ee .= ' <script type="text/javascript"> jQuery(".bussinessButton").click(function(){ jQuery(".bussiness").removeClass("hidden"); }); jQuery(".personButton").click(function(){ jQuery(".bussiness").addClass("hidden"); }); </script> '; return $i02fcabda2448d40bdb76bd10f9e95950039649ee; }
/** * Show the special page * * @param $params Mixed: parameter(s) passed to the page or null */ public function execute($params) { global $wgOut, $wgUser, $wgMemc; // This feature is only available to logged-in users. if (!$wgUser->isLoggedIn()) { throw new ErrorPageError('error', 'badaccess'); } // Show a message if the database is in read-only mode if (wfReadOnly()) { $wgOut->readOnlyPage(); return; } $dbr = wfGetDB(DB_MASTER); $s = $dbr->selectRow('user_profile', array('up_user_id'), array('up_user_id' => $wgUser->getID()), __METHOD__); if ($s === false) { $dbw = wfGetDB(DB_MASTER); $dbw->insert('user_profile', array('up_user_id' => $wgUser->getID()), __METHOD__); } $profile = new UserProfile($wgUser->getName()); $profile_data = $profile->getProfile(); $user_page_type = $profile_data['user_page_type'] == 1 ? 0 : 1; $dbw = wfGetDB(DB_MASTER); $dbw->update('user_profile', array('up_type' => $user_page_type), array('up_user_id' => $wgUser->getID()), __METHOD__); $key = wfMemcKey('user', 'profile', 'info', $wgUser->getID()); $wgMemc->delete($key); if ($user_page_type == 1 && !$wgUser->isBlocked()) { $user_page = Title::makeTitle(NS_USER, $wgUser->getName()); $article = new Article($user_page); $user_page_content = $article->getContent(); $user_wiki_title = Title::makeTitle(NS_USER_WIKI, $wgUser->getName()); $user_wiki = new Article($user_wiki_title); if (!$user_wiki->exists()) { $user_wiki->doEdit($user_page_content, 'import user wiki'); } } $title = Title::makeTitle(NS_USER, $wgUser->getName()); $wgOut->redirect($title->getFullURL()); }
/** * Get the header for the social profile page, which includes the user's * points and user level (if enabled in the site configuration) and lots * more. * * @param $user_id Integer: user ID * @param $user_name String: user name */ function getProfileTop($user_id, $user_name) { global $wgTitle, $wgUser, $wgUploadPath, $wgLang; global $wgUserLevels; $stats = new UserStats($user_id, $user_name); $stats_data = $stats->getUserStats(); $user_level = new UserLevel($stats_data['points']); $level_link = Title::makeTitle(NS_HELP, wfMsgForContent('user-profile-userlevels-link')); if (!$this->profile_data) { $profile = new UserProfile($user_name); $this->profile_data = $profile->getProfile(); } $profile_data = $this->profile_data; // Variables and other crap $page_title = $wgTitle->getText(); $title_parts = explode('/', $page_title); $user = $title_parts[0]; $id = User::idFromName($user); $user_safe = urlencode($user); // Safe urls $add_relationship = SpecialPage::getTitleFor('AddRelationship'); $remove_relationship = SpecialPage::getTitleFor('RemoveRelationship'); $give_gift = SpecialPage::getTitleFor('GiveGift'); $send_board_blast = SpecialPage::getTitleFor('SendBoardBlast'); $update_profile = SpecialPage::getTitleFor('UpdateProfile'); $watchlist = SpecialPage::getTitleFor('Watchlist'); $contributions = SpecialPage::getTitleFor('Contributions', $user); $send_message = SpecialPage::getTitleFor('UserBoard'); $upload_avatar = SpecialPage::getTitleFor('UploadAvatar'); $user_page = Title::makeTitle(NS_USER, $user); $user_social_profile = Title::makeTitle(NS_USER_PROFILE, $user); $user_wiki = Title::makeTitle(NS_USER_WIKI, $user); if ($id != 0) { $relationship = UserRelationship::getUserRelationshipByID($id, $wgUser->getID()); } $avatar = new wAvatar($this->user_id, 'l'); wfDebug('profile type: ' . $profile_data['user_page_type'] . "\n"); $output = ''; if ($this->isOwner()) { $toggle_title = SpecialPage::getTitleFor('ToggleUserPage'); if ($this->profile_data['user_page_type'] == 1) { $toggleMessage = wfMsg('user-type-toggle-old'); } else { $toggleMessage = wfMsg('user-type-toggle-new'); } $output .= '<div id="profile-toggle-button"> <a href="' . $toggle_title->escapeFullURL() . '" rel="nofollow">' . $toggleMessage . '</a> </div>'; } $output .= '<div id="profile-image"> <img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0" /> </div>'; $output .= '<div id="profile-right">'; $output .= '<div id="profile-title-container"> <div id="profile-title">' . $user_name . '</div>'; if ($wgUserLevels) { $output .= '<div id="points-level"> <a href="' . $level_link->escapeFullURL() . '">' . wfMsgExt('user-profile-points', 'parsemag', $stats_data['points']) . '</a> </div> <div id="honorific-level"> <a href="' . $level_link->escapeFullURL() . '" rel="nofollow">(' . $user_level->getLevelName() . ')</a> </div>'; } $output .= '<div class="cleared"></div> </div> <div class="profile-actions">'; if ($this->isOwner()) { $output .= $wgLang->pipeList(array('<a href="' . $update_profile->escapeFullURL() . '">' . wfMsg('user-edit-profile') . '</a>', '<a href="' . $upload_avatar->escapeFullURL() . '">' . wfMsg('user-upload-avatar') . '</a>', '<a href="' . $watchlist->escapeFullURL() . '">' . wfMsg('user-watchlist') . '</a>', '')); } elseif ($wgUser->isLoggedIn()) { if ($relationship == false) { $output .= $wgLang->pipeList(array('<a href="' . $add_relationship->escapeFullURL('user='******'&rel_type=1') . '" rel="nofollow">' . wfMsg('user-add-friend') . '</a>', '<a href="' . $add_relationship->escapeFullURL('user='******'&rel_type=2') . '" rel="nofollow">' . wfMsg('user-add-foe') . '</a>', '')); } else { if ($relationship == 1) { $output .= $wgLang->pipeList(array('<a href="' . $remove_relationship->escapeFullURL('user='******'">' . wfMsg('user-remove-friend') . '</a>', '')); } if ($relationship == 2) { $output .= $wgLang->pipeList(array('<a href="' . $remove_relationship->escapeFullURL('user='******'">' . wfMsg('user-remove-foe') . '</a>', '')); } } global $wgUserBoard; if ($wgUserBoard) { $output .= '<a href="' . $send_message->escapeFullURL('user='******'&conv=' . $user_safe) . '" rel="nofollow">' . wfMsg('user-send-message') . '</a>'; $output .= wfMsgExt('pipe-separator', 'escapenoentities'); } $output .= '<a href="' . $give_gift->escapeFullURL('user='******'" rel="nofollow">' . wfMsg('user-send-gift') . '</a>'; $output .= wfMsgExt('pipe-separator', 'escapenoentities'); } $output .= '<a href="' . $contributions->escapeFullURL() . '" rel="nofollow">' . wfMsg('user-contributions') . '</a> '; // Links to User:user_name from User_profile: if ($wgTitle->getNamespace() == NS_USER_PROFILE && $this->profile_data['user_id'] && $this->profile_data['user_page_type'] == 0) { $output .= '| <a href="' . $user_page->escapeFullURL() . '" rel="nofollow">' . wfMsg('user-page-link') . '</a> '; } // Links to User:user_name from User_profile: if ($wgTitle->getNamespace() == NS_USER && $this->profile_data['user_id'] && $this->profile_data['user_page_type'] == 0) { $output .= '| <a href="' . $user_social_profile->escapeFullURL() . '" rel="nofollow">' . wfMsg('user-social-profile-link') . '</a> '; } if ($wgTitle->getNamespace() == NS_USER && (!$this->profile_data['user_id'] || $this->profile_data['user_page_type'] == 1)) { $output .= '| <a href="' . $user_wiki->escapeFullURL() . '" rel="nofollow">' . wfMsg('user-wiki-link') . '</a>'; } $output .= '</div> </div>'; return $output; }
/** * Initialize UserProfile data for the given user if that hasn't been done * already. * * @param $username String: name of the user whose profile data to initialize */ private function initializeProfileData($username) { if (!$this->profile_data) { $profile = new UserProfile($username); $this->profile_data = $profile->getProfile(); } }
/** * this function manage the entire profile, identify the action to perform and do the right sequence of action * @return string the html to display */ function performAction($viewer = false, $start_action = false) { $this->setViewer($viewer); if ($start_action === false) { $start_action = 'profileview'; } $ap = Get::req($this->_varname_action, DOTY_MIXED, $start_action); if (isset($_POST['undo'])) { $ap = 'profileview'; } switch ($ap) { case "goprofile": $ext_prof = new UserProfile(Get::req('id_user', DOTY_INT, 0), false); $ext_prof->init($this->_module_name, $this->_platform, $this->_std_query, $this->_varname_action); return $ext_prof->getProfile(); break; // display the mod info gui ------------------------------- // display the mod info gui ------------------------------- case "mod_profile": return $this->getModUser(); break; case "mod_password": return $this->_up_viewer->getUserPwdModUi(); break; case "mod_policy": return $this->_up_viewer->modUserPolicyGui(); break; // save modified info of the user ------------------------- // save modified info of the user ------------------------- case "save_policy": if ($this->_up_data_man->setFieldAccessList($this->_id_user, $this->_up_viewer->getFilledPolicy())) { // all ok -------------------------------------- $this->_up_viewer->unloadUserData(); if ($this->_end_url !== false) { Util::jump_to($this->_end_url); } return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPOLICY')) . $this->getProfile(); } else { // some error saving --------------------------- return getErrorUi($this->_lang->def('_FAILSAVEPOLICY')) . $this->_up_viewer->modUserPolicyGui(); } break; // save modified info of the user ------------------------- // save modified info of the user ------------------------- case "saveinfo": if (!$this->checkUserInfo()) { // some error in data filling ------------------ return getErrorUi($this->_last_error) . $this->getModUser(); } if ($this->saveUserInfo()) { // all ok -------------------------------------- $this->_up_viewer->unloadUserData(); if ($this->_end_url !== false) { Util::jump_to($this->_end_url); } if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') { require_once $GLOBALS['where_lms'] . '/lib/lib.reservation.php'; $id_event = Get::req('id_event', DOTY_INT, 0); $man_res = new Man_Reservation(); $result = $man_res->addSubscription(getLogUserId(), $id_event); Util::jump_to('index.php?modname=reservation&op=reservation'); } else { return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPROFILE')) . $this->getProfile(); } } else { // some error saving --------------------------- return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->getModUser(); } break; // save password ----------------------------------------- // save password ----------------------------------------- case "savepwd": $re = $this->_up_viewer->checkUserPwd(); if ($re !== true) { // some error in data filling -------------------- return getErrorUi($re) . $this->_up_viewer->getUserPwdModUi(); } if ($this->saveUserPwd()) { // all ok ---------------------------------------- $this->_up_viewer->unloadUserData(); if ($this->_end_url !== false) { Util::jump_to($this->_end_url); } $out = getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPWD')); if (Get::sett('profile_only_pwd') == 'on') { // maybe is better if we display only the confirmation message if all is ok, but if you // want something else add the code here } else { $out .= $this->getProfile(); } return $out; } else { // some error saving ---------------------------- return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->getUserPwdModUi(); } break; case "uploadavatar": return $this->_up_viewer->modAvatarGui(); break; case "saveavatar": if ($this->saveUserAvatar()) { // all ok -------------------------------------- $this->_up_viewer->unloadUserData(); if ($this->_end_url !== false) { Util::jump_to($this->_end_url); } return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULAVATAR')) . $this->getProfile(); } else { // some error saving --------------------------- return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modAvatarGui(); } break; // teacher curriculum // teacher curriculum case "del_teach_curric": return $this->_up_viewer->delTeacherCurriculumGui(); break; case "mod_teach_curric": return $this->_up_viewer->modTeacherCurriculumGui(); break; case "save_teach_curric": if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, $this->_up_viewer->getFilledCurriculum(), false)) { // all ok -------------------------------------- $this->_up_viewer->unloadUserData(); if ($this->_end_url !== false) { Util::jump_to($this->_end_url); } return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULCURRICULUM')) . $this->getProfile(); } else { // some error saving --------------------------- return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modTeacherCurriculumGui(); } break; case "mod_teach_publ": return $this->_up_viewer->modTeacherPublicationsGui(); break; case "save_teach_publ": if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, false, $this->_up_viewer->getFilledPublications())) { // all ok -------------------------------------- $this->_up_viewer->unloadUserData(); if ($this->_end_url !== false) { Util::jump_to($this->_end_url); } return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPUBLICATIONS')) . $this->getProfile(); } else { // some error saving --------------------------- return getErrorUi($this->_lang->def('_FAILSAVEPUBLICATIONS')) . $this->_up_viewer->modTeacherPublicationsGui(); } break; // display the profile ------------------------------------ // display the profile ------------------------------------ case "view_files": $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId()); return $this->_up_viewer->getViewUserFiles(); break; case "file_details": $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId()); return $this->_up_viewer->getViewUserFileDetail(); break; case "profileview": default: return $this->getProfile(); break; } }
function displayAuthorBox($author_index) { global $wgOut, $wgBlogPageDisplay; if ($wgBlogPageDisplay['author'] == false) { return ''; } $author_user_name = $author_user_id = ''; if (isset($this->authors[$author_index]) && isset($this->authors[$author_index]['user_name'])) { $author_user_name = $this->authors[$author_index]['user_name']; } if (isset($this->authors[$author_index]) && isset($this->authors[$author_index]['user_id'])) { $author_user_id = $this->authors[$author_index]['user_id']; } if (empty($author_user_id)) { return ''; } $authorTitle = Title::makeTitle(NS_USER, $author_user_name); $profile = new UserProfile($author_user_name); $profileData = $profile->getProfile(); $avatar = new wAvatar($author_user_id, 'm'); $articles = $this->getAuthorArticles($author_index); $cssFix = ''; if (!$articles) { $cssFix = ' author-container-fix'; } $output = "\t\t\t\t\t<div class=\"author-container{$cssFix}\">\n\t\t\t\t\t\t<div class=\"author-info\">\n\t\t\t\t\t\t\t<a href=\"" . $authorTitle->escapeFullURL() . "\" rel=\"nofollow\">\n\t\t\t\t\t\t\t\t{$avatar->getAvatarURL()}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t<div class=\"author-title\">\n\t\t\t\t\t\t\t\t<a href=\"" . $authorTitle->escapeFullURL() . '" rel="nofollow">' . wordwrap($author_user_name, 12, "<br />\n", true) . '</a> </div>'; // If the user has supplied some information about themselves on their // social profile, show that data here. if ($profileData['about']) { $output .= $wgOut->parse($profileData['about'], false); } $output .= "\n\t\t\t\t\t\t</div><!-- .author-info -->\n\t\t\t\t\t\t<div class=\"cleared\"></div>\n\t\t\t\t\t</div><!-- .author-container -->\n\t\t{$this->getAuthorArticles($author_index)}"; return $output; }
private function f370de043219675cfa1a3e3237bacbc14e5206631() { $i05355412b857f5174e9a2f71b1e936a86ad60cd215f0440429ef770fbaf8bd58ae6bab5bcc2e123c = new UserProfile($this->getDb()); $i05355412b857f5174e9a2f71b1e936a86ad60cd21238ed0a93a32faf9485892fe4a454435972b1cc = $i05355412b857f5174e9a2f71b1e936a86ad60cd215f0440429ef770fbaf8bd58ae6bab5bcc2e123c->getProfile(); $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = ""; $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = 0; if (isset($i05355412b857f5174e9a2f71b1e936a86ad60cd21238ed0a93a32faf9485892fe4a454435972b1cc["pref_billing"]) && $i05355412b857f5174e9a2f71b1e936a86ad60cd21238ed0a93a32faf9485892fe4a454435972b1cc["pref_billing"] == 1) { if ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_mobile")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_mobile"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_city"); } elseif ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_mobile")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_mobile"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_city"); } elseif ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_phone")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_phone"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_city"); } elseif ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_phone")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_phone"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_city"); } } else { if ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_mobile")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_mobile"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_city"); } elseif ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_mobile")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_mobile"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_city"); } elseif ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_phone")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_phone"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_city"); } elseif ($this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_phone")) { $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_phone"); $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_country_id"); $i4cf9f0116783b87bde6ffc257619ea23247bbc7b = $this->f84f10e7b1c2263abf3b869fc8ac81f4ab3ea37db("customer_invoice_city"); } } return array("mobile" => $i05355412b857f5174e9a2f71b1e936a86ad60cd29110e9381bd52d5eb5c5fe59bf358843f431b8ee, "country_id" => $iab6a314decb74f5c532ecb082cfeb1655b9e98bb, "city" => $i4cf9f0116783b87bde6ffc257619ea23247bbc7b); }
/** * Displays the box which displays information about the person who * submitted this link if this feature is enabled in $wgLinkPageDisplay. * * @return HTML */ function displaySubmitterBox() { global $wgOut, $wgLinkPageDisplay; if (!$wgLinkPageDisplay['author']) { return ''; } $authorUserName = $this->link['user_name']; $authorUserId = $this->link['user_id']; if (!$authorUserId) { return ''; } $authorTitle = Title::makeTitle(NS_USER, $authorUserName); $profile = new UserProfile($authorUserName); $profileData = $profile->getProfile(); $avatar = new wAvatar($authorUserId, 'm'); $css_fix = 'author-container-fix'; $output = '<h2>' . wfMsg('linkfilter-about-submitter') . '</h2>'; $output .= "<div class=\"author-container {$css_fix}\">\n\t\t\t<div class=\"author-info\">\n\t\t\t\t<a href=\"" . $authorTitle->escapeFullURL() . "\" rel=\"nofollow\">\n\t\t\t\t\t{$avatar->getAvatarURL()}\n\t\t\t\t</a>\n\t\t\t\t<div class=\"author-title\">\n\t\t\t\t\t<a href=\"" . $authorTitle->escapeFullURL() . "\" rel=\"nofollow\">{$authorUserName}</a>\n\t\t\t\t</div>"; if ($profileData['about']) { $output .= $wgOut->parse($profileData['about'], false); } $output .= '</div> <div class="cleared"></div> </div>'; return $output; }
public function getProfile($userId) { $profile = new UserProfile(); return $profile->getProfile($userId); }
function getRandomUser( $input, $args, $parser ) { global $wgMemc, $wgRandomFeaturedUser; wfProfileIn( __METHOD__ ); $parser->disableCache(); $period = ( isset( $args['period'] ) ) ? $args['period'] : ''; if( $period != 'weekly' && $period != 'monthly' ) { return ''; } $user_list = array(); $count = 20; $realCount = 10; // Try cache $key = wfMemcKey( 'user_stats', 'top', 'points', 'weekly', $realCount ); $data = $wgMemc->get( $key ); if( $data != '' ) { wfDebug( "Got top $period users by points ({$count}) from cache\n" ); $user_list = $data; } else { wfDebug( "Got top $period users by points ({$count}) from DB\n" ); $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'user_points_' . $period, array( 'up_user_id', 'up_user_name', 'up_points' ), array( 'up_user_id <> 0' ), __METHOD__, array( 'ORDER BY' => 'up_points DESC', 'LIMIT' => $count ) ); $loop = 0; foreach( $res as $row ) { // Prevent blocked users from appearing $user = User::newFromId( $row->up_user_id ); if( !$user->isBlocked() ) { $user_list[] = array( 'user_id' => $row->up_user_id, 'user_name' => $row->up_user_name, 'points' => $row->up_points ); $loop++; } if( $loop >= 10 ) { break; } } if( count( $user_list ) > 0 ) { $wgMemc->set( $key, $user_list, 60 * 60 ); } } // Make sure we have some data if( !is_array( $user_list ) || count( $user_list ) == 0 ) { return ''; } $random_user = $user_list[array_rand( $user_list, 1 )]; // Make sure we have a user if( !$random_user['user_id'] ) { return ''; } $output = '<div class="random-featured-user">'; if( $wgRandomFeaturedUser['points'] == true ) { $stats = new UserStats( $random_user['user_id'], $random_user['user_name'] ); $stats_data = $stats->getUserStats(); $points = $stats_data['points']; } if( $wgRandomFeaturedUser['avatar'] == true ) { $user_title = Title::makeTitle( NS_USER, $random_user['user_name'] ); $avatar = new wAvatar( $random_user['user_id'], 'ml' ); $avatarImage = $avatar->getAvatarURL(); $output .= "<a href=\"{$user_title->escapeFullURL()}\">{$avatarImage}</a>\n"; } $output .= "<div class=\"random-featured-user-title\"> <a href=\"{$user_title->escapeFullURL()}\">" . wordwrap( $random_user['user_name'], 12, "<br />\n", true ) . "</a><br /> $points " . wfMsg( "random-user-points-{$period}" ) . "</div>\n\n"; if( $wgRandomFeaturedUser['about'] == true ) { $p = new Parser(); $profile = new UserProfile( $random_user['user_name'] ); $profile_data = $profile->getProfile(); $about = ( isset( $profile_data['about'] ) ) ? $profile_data['about'] : ''; // Remove templates $about = preg_replace( '@{{.*?}}@si', '', $about ); if( !empty( $about ) ) { global $wgTitle, $wgOut; $output .= '<div class="random-featured-user-about-title">' . wfMsg( 'random-user-about-me' ) . '</div>' . $p->parse( $about, $wgTitle, $wgOut->parserOptions(), false )->getText(); } } $output .= '</div><div class="cleared"></div>'; wfProfileOut( __METHOD__ ); return $output; }