Exemple #1
0
 /**
  * @dataProvider provideGetWiki
  */
 public function testGetWiki($expected, $wikiId, $useWgConf = true)
 {
     if (!$useWgConf) {
         $this->setMwGlobals(['wgConf' => new SiteConfiguration()]);
     }
     $this->assertEquals($expected, WikiMap::getWiki($wikiId));
 }
Exemple #2
0
 /**
  * Convenience to get a url to a page on a foreign wiki
  *
  * @param $wikiID String: wiki'd id (generally database name)
  * @param $page String: page name (must be normalised before calling this function!)
  * @return String: URL or false if the wiki was not found
  */
 public static function getForeignURL($wikiID, $page)
 {
     $wiki = WikiMap::getWiki($wikiID);
     if ($wiki) {
         return $wiki->getUrl($page);
     }
     return false;
 }
 /**
  * Display form for approving/denying request or process form submission.
  *
  * @param GlobalRenameRequest $req Pending request
  */
 protected function doShowProcessForm(GlobalRenameRequest $req)
 {
     $this->commonPreamble('globalrenamequeue-request-title', array($req->getName()));
     $form = HTMLForm::factory('vform', array('rid' => array('default' => $req->getId(), 'name' => 'rid', 'type' => 'hidden'), 'comments' => array('default' => $this->getRequest()->getVal('comments'), 'id' => 'mw-renamequeue-comments', 'label-message' => 'globalrenamequeue-request-comments-label', 'name' => 'comments', 'type' => 'textarea', 'rows' => 5), 'reason' => array('id' => 'mw-renamequeue-reason', 'label-message' => 'globalrenamequeue-request-reason-label', 'name' => 'reason', 'type' => 'text'), 'movepages' => array('id' => 'mw-renamequeue-movepages', 'name' => 'movepages', 'label-message' => 'globalrenamequeue-request-movepages', 'type' => 'check', 'default' => 1), 'suppressredirects' => array('id' => 'mw-renamequeue-suppressredirects', 'name' => 'suppressredirects', 'label-message' => 'globalrenamequeue-request-suppressredirects', 'type' => 'check')), $this->getContext(), 'globalrenamequeue');
     $form->suppressDefaultSubmit();
     $form->addButton('approve', $this->msg('globalrenamequeue-request-approve-text')->text(), 'mw-renamequeue-approve', array('class' => 'mw-ui-constructive mw-ui-flush-right'));
     $form->addButton('deny', $this->msg('globalrenamequeue-request-deny-text')->text(), 'mw-renamequeue-deny', array('class' => 'mw-ui-destructive mw-ui-flush-right'));
     $form->addButton('cancel', $this->msg('globalrenamequeue-request-cancel-text')->text(), 'mw-renamequeue-cancel', array('class' => 'mw-ui-quiet mw-ui-flush-left'));
     $form->setId('mw-globalrenamequeue-request');
     if ($req->userIsGlobal()) {
         $globalUser = new CentralAuthUser($req->getName());
         $homeWiki = $globalUser->getHomeWiki();
         $infoMsgKey = 'globalrenamequeue-request-userinfo-global';
     } else {
         $homeWiki = $req->getWiki();
         $infoMsgKey = 'globalrenamequeue-request-userinfo-local';
     }
     $headerMsg = $this->msg('globalrenamequeue-request-header', WikiMap::getForeignURL($homeWiki, "User:{$req->getName()}"), $req->getName(), $req->getNewName());
     $form->addHeaderText('<span class="plainlinks">' . $headerMsg->parseAsBlock() . '</span>');
     $homeWikiWiki = WikiMap::getWiki($homeWiki);
     $infoMsg = $this->msg($infoMsgKey, $req->getName(), $homeWikiWiki ? $homeWikiWiki->getDisplayName() : $homeWiki, $req->getNewName());
     $form->addHeaderText($infoMsg->parseAsBlock());
     if (class_exists('CentralAuthSpoofUser')) {
         $spoofUser = new CentralAuthSpoofUser($req->getNewName());
         // @todo move this code somewhere else
         $specialGblRename = new SpecialGlobalRenameUser();
         $specialGblRename->setContext($this->getContext());
         $conflicts = $specialGblRename->processAntiSpoofConflicts($req->getName(), $spoofUser->getConflicts());
         if ($conflicts) {
             $form->addHeaderText($this->msg('globalrenamequeue-request-antispoof-conflicts', $this->getLanguage()->commaList($conflicts))->numParams(count($conflicts))->parse());
         }
     }
     // Show a log entry of previous renames under the requesting user's username
     $caTitle = Title::makeTitleSafe(NS_SPECIAL, 'CentralAuth/' . $req->getName());
     $extract = '';
     $extractCount = LogEventsList::showLogExtract($extract, 'gblrename', $caTitle, '', array('showIfEmpty' => false));
     if ($extractCount) {
         $form->addHeaderText(Xml::fieldset($this->msg('globalrenamequeue-request-previous-renames')->numParams($extractCount)->text(), $extract));
     }
     $reason = $req->getReason() ?: $this->msg('globalrenamequeue-request-reason-sul')->parseAsBlock();
     $form->addHeaderText($this->msg('globalrenamequeue-request-reason', $reason)->parseAsBlock());
     $form->setSubmitCallback(array($this, 'onProcessSubmit'));
     $out = $this->getOutput();
     $out->addModuleStyles(array('mediawiki.ui', 'mediawiki.ui.button', 'mediawiki.ui.input', 'ext.centralauth.globalrenamequeue.styles'));
     $out->addModules('ext.centralauth.globalrenamequeue');
     $status = $form->show();
     if ($status instanceof Status && $status->isOk()) {
         $this->getOutput()->redirect($this->getPageTitle(self::PAGE_PROCESS_REQUEST . "/{$req->getId()}/{$status->value}")->getFullURL());
     }
 }
Exemple #4
0
 /**
  * @dataProvider provideGetWiki
  */
 public function testGetWiki($expected, $wikiId)
 {
     $this->assertEquals($expected, WikiMap::getWiki($wikiId));
 }
 /**
  * @param $wikiID
  * @return string
  * @throws MWException
  */
 function foreignUserLink($wikiID)
 {
     $wiki = WikiMap::getWiki($wikiID);
     if (!$wiki) {
         throw new MWException("no wiki for {$wikiID}");
     }
     $hostname = $wiki->getDisplayName();
     $userPageName = 'User:'******'a', array('href' => $url, 'title' => wfMsg('centralauth-foreign-link', $this->mUserName, $hostname)), $hostname);
 }
Exemple #6
0
 /**
  * Convenience to get a url to a page on a foreign wiki
  *
  * @param string $wikiID Wiki'd id (generally database name)
  * @param string $page Page name (must be normalised before calling this function!)
  * @param string|null $fragmentId
  *
  * @return string|bool URL or false if the wiki was not found
  */
 public static function getForeignURL($wikiID, $page, $fragmentId = null)
 {
     $wiki = WikiMap::getWiki($wikiID);
     if ($wiki) {
         return $wiki->getFullUrl($page, $fragmentId);
     }
     return false;
 }
 public function formatVersionRow($arr)
 {
     $ts = $arr['timestamp'];
     $wikis = $arr['wikis'];
     $c = $arr['count'];
     $hasSelf = in_array($this->mWiki, $wikis);
     extract($this->formatConf);
     $lang = $this->getLang();
     $datime = $lang->timeanddate($ts);
     $date = $lang->date($ts);
     $time = $lang->time($ts);
     ## Make user link...
     $userLink = '';
     if (!$arr['user_wiki'] && !$arr['user_name']) {
         $userLink = '';
         # Nothing...
         $username = '';
     } elseif ($arr['user_wiki'] == wfWikiId()) {
         $userLink = Linker::link(Title::makeTitle(NS_USER, $arr['user_name']), htmlspecialchars($arr['user_name']));
         $username = $arr['user_name'];
     } elseif ($wiki = WikiMap::getWiki($arr['user_wiki'])) {
         $userLink = Linker::makeExternalLink($wiki->getUrl('User:'******'user_name']), htmlspecialchars($arr['user_name'] . '@' . $arr['user_wiki']));
         $username = '';
     } else {
         ## Last-ditch
         $userLink = htmlspecialchars($arr['user_name'] . '@' . $arr['user_wiki']);
         $username = '';
     }
     $actions = array();
     $view = '';
     if ($hasSelf) {
         $view .= Linker::linkKnown($self, $this->msg('configure-view')->escaped(), array(), array('version' => $ts));
     } elseif ($allowedAll) {
         $view .= $this->msg('configure-view')->escaped();
     }
     if ($allowedAll) {
         $viewWikis = array();
         foreach ($wikis as $wiki) {
             $viewWikis[] = Linker::linkKnown($self, htmlspecialchars($wiki), array(), array('version' => $ts, 'wiki' => $wiki));
         }
         $view .= ' (' . $lang->commaList($viewWikis) . ')';
     }
     if ($view) {
         $actions[] = $view;
     }
     $editDone = false;
     if ($allowedConfig) {
         if ($hasSelf) {
             $editCore = $editMsg . Linker::linkKnown($configTitle, $this->msg('configure-edit-core')->escaped(), array(), array('version' => $ts));
         } elseif ($allowedConfigAll) {
             $editCore = $editMsg . $this->msg('configure-edit-core')->escaped();
         } else {
             $editCore = $editMsg;
         }
         if ($allowedConfigAll) {
             $viewWikis = array();
             foreach ($wikis as $wiki) {
                 $viewWikis[] = Linker::linkKnown($configTitle, htmlspecialchars($wiki), array(), array('version' => $ts, 'wiki' => $wiki));
             }
             $editCore .= ' (' . $lang->commaList($viewWikis) . ')';
         }
         $actions[] = $editCore;
     }
     if ($allowedExtensions) {
         $editExt = '';
         if (!$allowedConfig) {
             $editExt .= $editMsg;
         }
         if ($hasSelf) {
             $editExt .= Linker::linkKnown($extTitle, $this->msg('configure-edit-ext')->escaped(), array(), array('version' => $ts));
         } elseif ($allowedExtensionsAll) {
             $editExt .= $this->msg('configure-edit-ext')->escaped();
         }
         if ($allowedExtensionsAll) {
             $viewWikis = array();
             foreach ($wikis as $wiki) {
                 $viewWikis[] = Linker::linkKnown($extTitle, htmlspecialchars($wiki), array(), array('version' => $ts, 'wiki' => $wiki));
             }
             $editExt .= ' (' . $lang->commaList($viewWikis) . ')';
         }
         $actions[] = $editExt;
     }
     if ($showDiff) {
         $diffCheck = $c == 2 ? array('checked' => 'checked') : array();
         $versionCheck = $c == 1 ? array('checked' => 'checked') : array();
         $buttons = Xml::element('input', array_merge(array('type' => 'radio', 'name' => 'diff', 'value' => $ts), $diffCheck)) . Xml::element('input', array_merge(array('type' => 'radio', 'name' => 'version', 'value' => $ts), $versionCheck));
         $actions[] = Linker::link($this->getTitle(), $this->msg('configure-viewconfig-default-diff')->escaped(), array(), array('version' => $ts, 'diff' => 'default'));
     } else {
         $buttons = '';
     }
     $comment = $arr['reason'] ? Linker::commentBlock($arr['reason']) : '';
     $action = $lang->commaList($actions);
     $msg = $this->msg('configure-viewconfig-line')->rawParams($buttons)->params($datime)->rawParams($userLink, $action, $comment)->params($date, $time, $username)->parse();
     return Xml::tags('li', null, $msg) . "\n";
 }
 /**
  * @param string $wikiID
  * @return string
  * @throws Exception
  */
 private function foreignUserLink($wikiID)
 {
     $wiki = WikiMap::getWiki($wikiID);
     if (!$wiki) {
         throw new Exception("Invalid wiki: {$wikiID}");
     }
     $wikiname = $wiki->getDisplayName();
     return self::foreignLink($wiki, MWNamespace::getCanonicalName(NS_USER) . ':' . $this->mUserName, $wikiname, $this->msg('centralauth-foreign-link', $this->mUserName, $wikiname)->text());
 }
 function onSubmit(array $data)
 {
     if (!isset($data['username'])) {
         $this->showCurrentRenames();
         return false;
     }
     $name = User::getCanonicalName($data['username'], 'usable');
     if (!$name) {
         $this->showCurrentRenames();
         return false;
     }
     $out = $this->getOutput();
     $this->renameuserStatus = new GlobalRenameUserStatus($name);
     $names = $this->renameuserStatus->getNames();
     if (!$names) {
         $this->checkCachePurge($name);
         $out->addWikiMsg('centralauth-rename-notinprogress', $name);
         $this->getForm()->displayForm(false);
         $this->showLogExtract($name);
         return true;
     }
     list($oldName, $newName) = $names;
     $statuses = $this->renameuserStatus->getStatuses();
     $this->getForm()->displayForm(false);
     // $newname will always be defined since we check
     // for 0 result rows above
     $caUser = new CentralAuthUser($newName);
     $attached = $caUser->listAttached();
     foreach ($attached as $wiki) {
         // If it's not in the db table, and there is
         // an attached acount, assume it's done.
         if (!isset($statuses[$wiki])) {
             $statuses[$wiki] = 'done';
         }
     }
     ksort($statuses);
     $table = Html::openElement('table', array('class' => 'wikitable sortable'));
     $table .= Html::openElement('tr');
     $table .= Html::element('th', array(), $this->msg('centralauth-rename-table-domain')->text());
     $table .= Html::element('th', array(), $this->msg('centralauth-rename-table-status')->text());
     $table .= Html::closeElement('tr');
     foreach ($statuses as $wiki => $status) {
         $table .= Html::openElement('tr');
         $table .= Html::element('td', array(), WikiMap::getWiki($wiki)->getDisplayName());
         // Messages used: centralauth-rename-table-status-inprogress
         // centralauth-rename-table-status-queued, centralauth-rename-table-status-done
         $table .= Html::rawElement('td', array(), $this->msg("centralauth-rename-table-status-{$status}")->parse());
         $table .= Html::closeElement('tr');
     }
     $table .= Html::closeElement('table');
     $fieldset = Xml::fieldset($this->msg('centralauth-rename-progress-fieldset')->text(), $table);
     $this->showLogExtract($newName);
     $out->addHTML($fieldset);
     return true;
 }
 /**
  * @param $auth
  * @param $user User
  * @param $params
  * @return bool
  */
 static function onSecurePoll_GetUserParams($auth, $user, &$params)
 {
     if ($user->isAnon()) {
         return true;
     }
     $centralUser = CentralAuthUser::getInstance($user);
     if (!($centralUser->exists() && $centralUser->isAttached())) {
         return true;
     }
     $wikiID = $centralUser->getHomeWiki();
     if (strval($wikiID) === '') {
         return true;
     }
     $wiki = WikiMap::getWiki($wikiID);
     $wikiUrl = $wiki->getUrl('');
     $parts = explode('/', $wikiUrl);
     if (isset($parts[2])) {
         $params['properties']['ca-local-domain'] = $params['domain'];
         $params['domain'] = $parts[2];
     }
     $params['properties']['ca-local-url'] = $params['url'];
     $params['url'] = $wiki->getUrl(MWNamespace::getCanonicalName(NS_USER) . ':' . $user->getTitleKey());
     return true;
 }
 /**
  * @param $wikiID
  * @return string
  * @throws MWException
  */
 function foreignUserLink($wikiID)
 {
     $wiki = WikiMap::getWiki($wikiID);
     if (!$wiki) {
         throw new MWException("Invalid wiki: {$wikiID}");
     }
     $wikiname = $wiki->getDisplayName();
     return $this->foreignLink($wiki, 'User:'******'centralauth-foreign-link', $this->mUserName, $wikiname));
 }
 /**
  * Unattach a list of local accounts from the global account
  * @param array $list List of wiki names
  * @return Status
  */
 public function adminUnattach($list)
 {
     if (!count($list)) {
         return Status::newFatal('centralauth-admin-none-selected');
     }
     $status = new Status();
     $valid = $this->validateList($list);
     $invalid = array_diff($list, $valid);
     foreach ($invalid as $wikiName) {
         $status->error('centralauth-invalid-wiki', $wikiName);
         $status->failCount++;
     }
     $dbcw = self::getCentralDB();
     $password = $this->getPassword();
     foreach ($valid as $wikiName) {
         # Delete the user from the central localuser table
         $dbcw->delete('localuser', array('lu_name' => $this->mName, 'lu_wiki' => $wikiName), __METHOD__);
         if (!$dbcw->affectedRows()) {
             $wiki = WikiMap::getWiki($wikiName);
             $status->error('centralauth-admin-already-unmerged', $wiki->getDisplayName());
             $status->failCount++;
             continue;
         }
         # Touch the local user row, update the password
         $lb = wfGetLB($wikiName);
         $dblw = $lb->getConnection(DB_MASTER, array(), $wikiName);
         $dblw->update('user', array('user_touched' => wfTimestampNow(), 'user_password' => $password), array('user_name' => $this->mName), __METHOD__);
         $id = $dblw->selectField('user', 'user_id', array('user_name' => $this->mName), __METHOD__);
         $this->clearLocalUserCache($wikiName, $id);
         $lb->reuseConnection($dblw);
         $status->successCount++;
     }
     if (in_array(wfWikiID(), $valid)) {
         $this->resetState();
     }
     $this->invalidateCache();
     return $status;
 }
 public function execute()
 {
     $params = $this->extractRequestParams();
     $prop = array_flip((array) $params['prop']);
     if (is_null($params['user'])) {
         $params['user'] = $this->getUser()->getName();
     }
     $user = new CentralAuthUser($params['user']);
     // Add basic info
     $result = $this->getResult();
     $data = array();
     $userExists = $user->exists();
     if ($userExists && ($user->getHiddenLevel() === CentralAuthUser::HIDDEN_NONE || $this->getUser()->isAllowed('centralauth-oversight'))) {
         // The global user exists and it's not hidden or the current user is allowed to see it
         $data['home'] = $user->getHomeWiki();
         $data['id'] = $user->getId();
         $data['registration'] = wfTimestamp(TS_ISO_8601, $user->getRegistration());
         $data['name'] = $user->getName();
         if ($user->isLocked()) {
             $data['locked'] = '';
         }
         if ($user->isHidden()) {
             $data['hidden'] = '';
         }
     } else {
         // The user doesn't exist or we pretend it doesn't if it's hidden
         $data['missing'] = '';
     }
     $result->addValue('query', $this->getModuleName(), $data);
     // Add requested info
     if ($userExists && isset($prop['groups'])) {
         $groups = $user->getGlobalGroups();
         $result->setIndexedTagName($groups, 'g');
         $result->addValue(array('query', $this->getModuleName()), 'groups', $groups);
     }
     if ($userExists && isset($prop['rights'])) {
         $rights = $user->getGlobalRights();
         $result->setIndexedTagName($rights, 'r');
         $result->addValue(array('query', $this->getModuleName()), 'rights', $rights);
     }
     $attachedAccounts = null;
     if ($userExists && (isset($prop['merged']) || isset($prop['editcount']))) {
         $attachedAccounts = $user->queryAttached();
     }
     if ($userExists && isset($prop['merged'])) {
         foreach ($attachedAccounts as $account) {
             $dbname = $account['wiki'];
             $wiki = WikiMap::getWiki($dbname);
             $a = array('wiki' => $dbname, 'url' => $wiki->getCanonicalServer(), 'timestamp' => wfTimestamp(TS_ISO_8601, $account['attachedTimestamp']), 'method' => $account['attachedMethod'], 'editcount' => $account['editCount']);
             if ($account['blocked']) {
                 $a['blocked'] = array('expiry' => $this->getLanguage()->formatExpiry($account['block-expiry'], TS_ISO_8601), 'reason' => $account['block-reason']);
             }
             $result->addValue(array('query', $this->getModuleName(), 'merged'), null, $a);
         }
         if (defined('ApiResult::META_CONTENT')) {
             $result->addIndexedTagName(array('query', $this->getModuleName(), 'merged'), 'account');
         } else {
             $result->setIndexedTagName_internal(array('query', $this->getModuleName(), 'merged'), 'account');
         }
     }
     if ($userExists && isset($prop['editcount'])) {
         $editcount = 0;
         foreach ($attachedAccounts as $account) {
             $editcount += $account['editCount'];
         }
         $result->addValue('query', $this->getModuleName(), array('editcount' => $editcount));
     }
     if (isset($prop['unattached'])) {
         $accounts = $user->queryUnattached();
         foreach ($accounts as $account) {
             $a = array('wiki' => $account['wiki'], 'editcount' => $account['editCount']);
             if ($account['blocked']) {
                 $a['blocked'] = array('expiry' => $this->getLanguage()->formatExpiry($account['block-expiry'], TS_ISO_8601), 'reason' => $account['block-reason']);
             }
             $result->addValue(array('query', $this->getModuleName(), 'unattached'), null, $a);
         }
         if (defined('ApiResult::META_CONTENT')) {
             $result->addIndexedTagName(array('query', $this->getModuleName(), 'unattached'), 'account');
         } else {
             $result->setIndexedTagName_internal(array('query', $this->getModuleName(), 'unattached'), 'account');
         }
     }
 }
 /**
  * Build links to old version of the configuration
  */
 protected function buildOldVersionSelect()
 {
     global $wgConf;
     $count = 0;
     $links = array();
     $versions = $wgConf->getArchiveVersions(array('wiki' => $this->mWiki, 'limit' => 11));
     $title = $this->getTitle();
     $lang = $this->getLang();
     $prev = null;
     ksort($versions);
     ## Put in ascending order for now.
     foreach ($versions as $data) {
         $ts = $data['timestamp'];
         $count++;
         $datetime = $this->msg('configure-old-summary-datetime', $lang->timeanddate($ts), $lang->date($ts), $lang->time($ts))->escaped();
         $link = Linker::linkKnown($title, $datetime, array(), array('version' => $ts));
         $diffLink = '';
         if ($prev) {
             $diffLink = '(' . Linker::linkKnown(SpecialPage::getTitleFor('ViewConfig'), $this->msg('configure-old-changes')->escaped(), array(), array('version' => $ts, 'diff' => $prev)) . ')';
         }
         ## Make user link...
         $userLink = '';
         if (!$data['userwiki'] || !$data['username']) {
             $userLink = '';
             $username = '';
         } elseif ($data['userwiki'] == wfWikiId()) {
             $userLink = Linker::link(Title::makeTitle(NS_USER, $data['username']), htmlspecialchars($data['username']));
             $username = $data['username'];
         } elseif ($wiki = WikiMap::getWiki($data['userwiki'])) {
             $userLink = Linker::makeExternalLink($wiki->getUrl('User:'******'username']), htmlspecialchars($data['username'] . '@' . $data['userwiki']));
             $username = '';
         } else {
             ## Last-ditch
             $userLink = htmlspecialchars($data['username'] . '@' . $data['userwiki']);
             $username = '';
         }
         $comment = $data['reason'] ? Linker::commentBlock($data['reason']) : '';
         $text = $this->msg('configure-old-summary')->rawParams($link, $userLink, $diffLink, $comment)->params($username)->parse();
         $prev = $ts;
         $links[] = $text;
     }
     ## Reset into descending order
     $links = array_reverse($links);
     ## Take out the first ten...
     $links = array_slice($links, 0, 10);
     $text = Html::element('legend', null, $this->msg('configure-old')->text());
     if (!count($links)) {
         $text .= $this->msg('configure-no-old')->parseAsBlock();
     } else {
         $text .= $this->msg('configure-old-versions')->parseAsBlock();
         $text .= "<ul>\n<li>";
         $text .= implode("</li>\n<li>", $links);
         $text .= "</li>\n</ul>\n";
     }
     $link = SpecialPage::getTitleFor('ViewConfig');
     $text .= Html::rawElement('p', null, Linker::linkKnown($link, $this->msg('configure-view-all-versions')->escaped()));
     $text .= Html::rawElement('p', null, Linker::linkKnown($link, $this->msg('configure-view-default')->escaped(), array(), array('version' => 'default')));
     return Html::rawElement('fieldset', null, $text);
 }
 static function maybeLinkUserpage($wiki_id, $user)
 {
     if (class_exists('WikiMap')) {
         $wiki = WikiMap::getWiki($wiki_id);
         if ($wiki) {
             return "[" . $wiki->getUrl("User:{$user}") . " {$user}]";
         }
     }
     return $user;
 }
 private function checkIsCentralWiki(&$wikiId)
 {
     if (wfWikiID() !== $this->loginWiki) {
         $this->doFinalOutput(false, 'Not central wiki');
         return false;
     }
     $wikiId = $this->getRequest()->getVal('wikiid');
     if ($wikiId === $this->loginWiki) {
         $this->doFinalOutput(false, 'Specified local wiki is the central wiki');
         return false;
     }
     $wiki = WikiMap::getWiki($wikiId);
     if (!$wiki) {
         $this->doFinalOutput(false, 'Specified local wiki not found');
         return false;
     }
     return true;
 }