public static function loadAllTitles() { $rows = db_getArrayOfRows("select section, title from WikiArticle left join WikiSection using (pageId) order by section, title"); $result = array(); foreach ($rows as $row) { $result[$row['section']][] = array($row['title'], WikiArticle::wikiTitleToUrlTitle($row['title'])); } return $result; }
<?php require_once "../phplib/util.php"; $type = util_getRequestParameter('t'); if ($type == 'rss') { $articles = WikiArticle::getRss(); $results = array(); foreach ($articles as $a) { $results[] = array('title' => $a->title, 'description' => $a->htmlContents, 'pubDate' => date('D, d M Y H:i:s', $a->modDate) . ' EEST', 'link' => sprintf("http://%s/articol/%s", $_SERVER['HTTP_HOST'], $a->getUrlTitle())); } header("Content-type: application/rss+xml"); SmartyWrap::assign('rss_title', 'Articole lingvistice - DEX online'); SmartyWrap::assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/rss/articole/'); SmartyWrap::assign('rss_description', 'Articole pe teme lingvistice de la DEX online'); SmartyWrap::assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST'); SmartyWrap::assign('results', $results); SmartyWrap::displayWithoutSkin('rss.ixml'); exit; } SmartyWrap::assign('page_title', 'Articole lingvistice'); SmartyWrap::assign('wikiTitles', WikiArticle::loadAllTitles()); SmartyWrap::display('articole.ihtml');
FlashMessage::add("Niciun rezultat relevant pentru „{$cuv}”."); } } } if (count($lexems) == 1 && $cuv != $lexems[0]->formNoAccent) { // Convenience redirect when there is only one correct form. We want all pages to be canonical $sourcePart = $source ? "-{$source->urlName}" : ''; session_setVariable('redirect', true); session_setVariable('init_word', $cuv); util_redirect(util_getWwwRoot() . "definitie{$sourcePart}/{$lexems[0]->formNoAccent}" . ($xml ? '/xml' : '')); } smarty_assign('lexems', $lexems); if ($searchType == SEARCH_INFLECTED) { // For successful searches, load the definitions, inflections and linguistic articles $definitions = Definition::loadForLexems($lexems, $sourceId, $cuv, $exclude_unofficial); smarty_assign('wikiArticles', WikiArticle::loadForLexems($lexems)); } if (isset($definitions)) { $searchResults = SearchResult::mapDefinitionArray($definitions); } } $conjugations = NULL; $declensions = NULL; if ($searchType == SEARCH_INFLECTED || $searchType == SEARCH_LEXEM_ID || $searchType == SEARCH_FULL_TEXT || $searchType == SEARCH_MULTIWORD) { smarty_assign('results', $searchResults); // Maps lexems to arrays of inflected forms (some lexems may lack inflections) // Also compute the text of the link to the paradigm div, // which can be 'conjugări', 'declinări' or both if (!empty($lexems)) { $ifMaps = array(); $conjugations = false;
} header("HTTP/1.0 404 Not Found"); } } if (count($lexems) == 1 && $cuv != $lexems[0]->formNoAccent) { // Convenience redirect when there is only one correct form. We want all pages to be canonical $sourcePart = $source ? "-{$source->urlName}" : ''; session_setVariable('redirect', true); session_setVariable('init_word', $cuv); util_redirect(util_getWwwRoot() . "definitie{$sourcePart}/{$lexems[0]->formNoAccent}" . ($xml ? '/xml' : '')); } SmartyWrap::assign('lexems', $lexems); if ($searchType == SEARCH_INFLECTED) { // For successful searches, load the definitions, inflections and linguistic articles $definitions = Definition::loadForLexems($lexems, $sourceId, $cuv, $exclude_unofficial); SmartyWrap::assign('wikiArticles', WikiArticle::loadForLexems($lexems)); } if (isset($definitions)) { $totalDefinitionsCount = count($definitions); if (!$all && $totalDefinitionsCount > PREVIEW_LIMIT) { $definitions = array_slice($definitions, 0, PREVIEW_LIMIT); SmartyWrap::assign('totalDefinitionsCount', $totalDefinitionsCount); } $searchResults = SearchResult::mapDefinitionArray($definitions); } } $conjugations = NULL; $declensions = NULL; if ($searchType == SEARCH_INFLECTED || $searchType == SEARCH_LEXEM_ID || $searchType == SEARCH_FULL_TEXT || $searchType == SEARCH_MULTIWORD) { // Filter out hidden definitions $hiddenSources = array();
<?php require_once "../phplib/util.php"; $type = util_getRequestParameter('t'); if ($type == 'rss') { $articles = WikiArticle::getRss(); $results = array(); foreach ($articles as $a) { $results[] = array('title' => $a->title, 'description' => $a->htmlContents, 'pubDate' => date('D, d M Y H:i:s', $a->modDate) . ' EEST', 'link' => sprintf("http://%s/articol/%s", $_SERVER['HTTP_HOST'], $a->getUrlTitle())); } header("Content-type: text/xml"); smarty_assign('rss_title', 'Articole lingvistice - DEX online'); smarty_assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/rss/articole/'); smarty_assign('rss_description', 'Articole pe teme lingvistice de la DEX online'); smarty_assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST'); smarty_assign('results', $results); smarty_displayWithoutSkin('common/rss.ixml'); exit; } smarty_assign('page_title', 'Articole lingvistice'); smarty_assign('wikiTitles', WikiArticle::loadAllTitles()); smarty_displayCommonPageWithSkin('articole.ihtml');
foreach ($keywords as $keyword) { $wk = Model::factory('WikiKeyword')->create(); $wk->wikiArticleId = $curPage->id; $wk->keyword = $keyword; $wk->save(); } log_scriptLog("Saved page #{$pageId} \"{$title}\""); } } // Now delete all the pages on our side that aren't category members because // (a) they have been deleted or // (b) they have been removed from the category $ourIds = db_getArray('select pageId from WikiArticle'); foreach ($ourIds as $ourId) { if (!array_key_exists($ourId, $pageIdHash)) { $curPage = WikiArticle::get_by_pageId($ourId); log_scriptLog("Deleting page #{$curPage->pageId} \"{$curPage->title}\""); $curPage->delete(); } } log_scriptLog('syncWikiArticles.php finished'); /*************************************************************************/ function parse($text) { // Preprocessing $text = "__NOEDITSECTION__\n" . $text; // Otherwise the returned HTML will contain section edit links $text = str_replace(array('ş', 'Ş', 'ţ', 'Ţ'), array('ș', 'Ș', 'ț', 'Ț'), $text); // Actual parsing $xmlString = util_makePostRequest(PARSER_URL, array('action' => 'parse', 'text' => $text, 'format' => 'xml', 'editsection' => false)); $xml = simplexml_load_string($xmlString);
/** * * 폴더 이름 변경 * * 실제 이름 변경 매소드이다. * 폴더 이름을 변경하고 폴더이름 변경의 영향을 받는 백링크들을 모두 업데이트한다. * 백링크 업데이트 후 문서 이력으로 남긴다. * * @param WikiArticle $wikiArticle {@link NarinArticle} 객체 * @param string $srcNS 변경전 이름 * @param string $toNS 변경후 이름 */ function _updateNamespace($wikiArticle, $srcNS, $toNS) { $wikiHistory =& wiki_class_load("History"); // $srcNS 에 포함된 documents 목록을 읽어온다. $list = $this->getList($srcNS, $withArticle = true); $escapedSrcNS = mysql_real_escape_string($srcNS); $escapedToNS = mysql_real_escape_string($toNS); // $srcNS / $document[] 에 대한 백 링크들을 업데이트한다. for($i=0; $i<count($list); $i++) { if($list[$i][type] == 'folder') continue; $wikiArticle->fromDoc = $fromDoc = $list[$i][path]; $wikiArticle->toDoc = preg_replace("/^(".preg_quote($srcNS, "/").")(.*?)/", $toNS, $fromDoc); // 백링크 업데이트 $backLinks = $wikiArticle->getBackLinks($fromDoc, $includeSelf=true); for($k=0; $k<count($backLinks); $k++) { $content = mysql_real_escape_string(preg_replace_callback('/(\[\[)(.*?)(\]\])/', array(&$wikiArticle, 'wikiLinkReplace'), $backLinks[$k]['wr_content'])); // 문서 이력에 백업 $wikiHistory->update($backLinks[$k]['wr_id'], stripcslashes($content), $this->member['mb_id'], "폴더명 변경에 따른 자동 업데이트"); $wikiArticle->shouldUpdateCache($backLinks[$k]['wr_id'], 1); sql_query("UPDATE ".$this->wiki['write_table']." SET wr_content = '$content' WHERE wr_id = ".$backLinks[$k]['wr_id'].""); } } sql_query("UPDATE ".$this->wiki['ns_table']." SET ns = '$escapedToNS' WHERE bo_table = '".$this->wiki['bo_table']."' AND ns = '$escapedSrcNS'", false); sql_query("UPDATE ".$this->wiki['nsboard_table']." SET ns = '$escapedToNS' WHERE bo_table = '".$this->wiki['bo_table']."' AND ns = '$escapedSrcNS'", false); $this->addNamespace($toNS); $this->checkAndRemove($srcNS); $wikiChanges =& wiki_class_load("Changes"); $wikiChanges->update("FOLDER", $srcNS, "폴더명변경 (이전)", $this->member['mb_id']); $wikiChanges->update("FOLDER", $toNS, "폴더명변경 (이후)", $this->member['mb_id']); }