function move_to_yaml() { $sql = SQL::current(); if (!($attrs = $sql->select("post_attributes", "*", array("name" => array("unclean_tags", "clean_tags"))))) { return; } function parseTags($tags, $clean) { $tags = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $tags)); $clean = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $clean)); return array_combine($tags, $clean); } $tags = array(); foreach ($attrs->fetchAll() as $attr) { if ($attr["name"] == "unclean_tags") { $tags[$attr["post_id"]]["unclean"] = $attr["value"]; } else { $tags[$attr["post_id"]]["clean"] = $attr["value"]; } } if (empty($tags)) { return; } foreach ($tags as $post_id => $tags) { $yaml = YAML::dump(parseTags($tags["unclean"], $tags["clean"])); echo _f("Relocating tags for post #%d...", array($post_id), "tags"); echo test($insert = $sql->replace("post_attributes", array("name" => "tags", "value" => $yaml, "post_id" => $post_id)), _f("Backup written to %s.", array("./_tags.bak.txt"))); if (!$insert) { return file_put_contents("./_tags.bak.txt", var_export($tags, true)); } } echo __("Removing old post attributes...", "tags") . test($sql->delete("post_attributes", array("name" => array("unclean_tags", "clean_tags")))); }
/** * Delete file * @param $sFile - file identificator * @return $bResult - result of operation (true/false) */ function deleteFile($sFile) { global $sFilesPath; getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID`='" . $sFile . "'"); getResult("DELETE FROM `" . MODULE_DB_PREFIX . "PlayLists` WHERE `FileId`='" . $sFile . "'"); parseTags($sFile); $sFileName = $sFilesPath . $sFile . MP3_EXTENSION; $bResult = @unlink($sFileName); return $bResult; }
?> " class="btn btn-default" role="button">지식 업데이트하기</a> </div> <hr/> </div> <?php if (isset($_GET["update"])) { echo "<div class=\"alert alert-dismissible alert-success\" role=\"alert\">지식을 새로 업데이트했습니다"; echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'; echo '</div>'; } else { if (!empty($_GET["from"])) { echo "<div class=\"alert alert-info\" role=\"alert\"><b><a style='color:#FFFFFF' href='" . $_GET["from"] . "&no-redirect=1'>" . $_GET["from"] . "</a></b> 에서 넘어왔습니다"; echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'; echo '</div>'; } } ?> <?php echo $page_response['article']['content']; ?> <br/> <div class="well well-sm"><?php echo !empty($page_response['article']['tags']) ? parseTags($page_response['article']['tags']) : "<em>이 지식에는 아직 분류가 없습니다. 분류를 추가해 주세요!</em>"; ?> </div> </div> <?php include 'frame.footer.php';
function parseTemplate($template, $vars, $listing) { global $ignore, $vars; if (!is_file($template)) { print 'No template file found (' . $template . ')'; exit; } $handle = fopen($template, 'r'); $inListing = false; $ignore = false; $listLines = array(); while (!feof($handle)) { $line = fgets($handle); // Check for the end of the file list if ($inListing) { if (strcmp(trim($line), '[websvn-endlisting]') == 0) { $inListing = false; // For each item in the list foreach ($listing as $listvars) { // Copy the value for this list item into the $vars array foreach ($listvars as $id => $value) { $vars[$id] = $value; } // Output the list item foreach ($listLines as $line) { if (!parseCommand($line, $vars, $handle)) { if (!$ignore) { print parseTags($line, $vars); } } } } } else { if ($ignore == false) { $listLines[] = $line; } } } else { if (parseCommand($line, $vars, $handle)) { continue; } else { // Check for the start of the file list if (strncmp(trim($line), '[websvn-startlisting]', 21) == 0) { $inListing = true; } else { if ($ignore == false) { print parseTags($line, $vars); } } } } } fclose($handle); }
getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID`='" . $sFileId . "' LIMIT 1"); break; } $sNewFileName = $sFileId . MP3_EXTENSION; deleteTempFiles($sId, true); parseTags($sFileId); if ($sId != "0") { getResult("UPDATE `" . MODULE_DB_PREFIX . "PlayLists` SET `Order`=`Order`+1 WHERE `Owner` = '" . $sId . "'"); getResult("INSERT INTO `" . MODULE_DB_PREFIX . "PlayLists` VALUES('" . $sFileId . "', '" . $sId . "', '1')"); } $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL); $sContents .= parseXml($aXmlTemplates['file'], $sFileId, $sNewFileName); break; case 'updateFile': getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Title`='" . $sTitle . "', `Tags`='" . $sTags . "', `Description`='" . $sDesc . "' WHERE `ID`='" . $sFile . "' LIMIT 1"); parseTags($sFile); break; case 'approveFile': $aFiles = empty($sFile) ? array() : explode(",", $sFile); $sIn = count($aFiles > 0) ? " IN('" . implode("','", $aFiles) . "')" : " IN('0')"; getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Approved`='" . TRUE_VAL . "' WHERE `ID` " . $sIn); break; /** * set user's uploaded file time */ /** * set user's uploaded file time */ case 'updateFileTime': getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Time`='" . $sTime . "' WHERE `ID`='" . $sFile . "'"); $sContents = parseXml($aXmlTemplates['result'], TRUE_VAL);
echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'; echo '</div>'; } else { echo '<div class="well well-sm">'; echo '<b>' . implode(' ', $page_response['keywords']) . '</b>에 대해 ' . $page_response['total_results'] . '항목을 찾았습니다. (' . $page_response['elapsed_time'] . '초)'; echo '</div>'; } ?> <div class="row"> <?php if ($page_response['result']) { foreach ($page_response['search_result'] as $result) { echo '<div class="col-md-12">'; echo '<h4><a href="' . HREF_READ . '/' . $result["title"] . '">' . $result["title"] . '</a> <span class="badge">+' . $result["hits"] . '</span></h4>'; echo '<p>' . highlight(truncate(strip_tags($result["content"]), CONTENT_PREVIEW_LENGTH), $page_response['keywords']) . '</p>'; echo '<h5>' . parseTags($result["tags"]) . '</h5><br/>'; echo '</div>'; } } ?> </div> <?php if ($page_response['result']) { if ($page_response['total_results'] > MAX_ARTICLES) { $total_pages = ceil($page_response['total_results'] / MAX_ARTICLES); $firstPage = floor($page / MAX_PAGINATION) * MAX_PAGINATION; $lastPage = $firstPage + MAX_PAGINATION; echo '<div class="text-center"><ul class="pagination">'; if ($firstPage > 0) { echo '<li><a href="' . $page_location . '&p=' . ($firstPage - 1) . '" aria-label="Previous"><span aria-hidden="true">«</span></a></li>'; }
//********************* //显示目录描述 //********************* $des = ''; $query = "select des from dir_des where repository='{$repos}' and path='{$dir}'"; $result = mysql_query($query); if ($result and $row = mysql_fetch_array($result, MYSQL_BOTH)) { $des = $row['des']; } //********************* //显示出内容 //********************* $newtopf = array(); $handle = fopen("../template/showdir.htm", "r"); if (!$authz) { $repos = 'scmbbs.com'; $path = '/'; $sig = 'Power by lixuejiang'; $showbutton = 'display:none;'; $candidate = ''; $dexpire = ''; } $vars = array('dir' => $firstdir, 'dirprive' => $userright, 'candidate' => $candidate, 'diradmin' => $diradmin, 'repos' => $repos, 'path' => $dir, 'sig' => $sig, 'authz' => $showbutton, 'dexpire' => $dexpire, 'description' => $des); while (!feof($handle)) { $line = fgets($handle); echo parseTags($line, $vars); } fclose($handle); ?>
$error = false; foreach ($required as $field) { if (empty($_POST[$field])) { $error = true; } } if (!$error) { $db->query("INSERT INTO posts(title, image, content, urlslug, date, lastedit) VALUES (?, ?, ?, ?, now(), now())", array($_POST['title'], $_POST['image'], $_POST['content'], $_POST['slug'])); if ($db->error()) { $msg = "Error submitting new post."; } else { // actual post was saved. let's save those tags along with it. // Query up to get the ID we just saved $db->query("SELECT id FROM posts WHERE urlslug=?", array($_POST['slug'])); $thisPostID = $db->firstResult(); if (parseTags($thisPostID['id'], $_POST['tags'])) { $msg = "Successfully created post. <a href='" . $GLOBALS['config']['domain'] . $GLOBALS['config']['directory'] . $_POST['slug'] . "'>Click here</a> to see it."; } else { $msg = "Error submitting new post tags."; } } } else { $msg = "Missing required field."; // Set these vars so they dont get mad that their business is empty $formTitle = $_POST['title']; $formImage = $_POST['image']; $formBody = $_POST['content']; $formSlug = $_POST['slug']; $formTags = $_POST['tags']; } }
$link = HREF_REVISION . '?i=' . $page_response['revision']['id'] . '&j=0'; } echo '<a href="' . $link . '"><em>' . $page_response['revision']['article_title'] . ' (버전 ' . $page_response['revision']['revision'] . ')</em></a>와 비교한 결과입니다.'; ?> </div> <div id='content'></div> <br/> <div id='tags' class="well well-sm"></div> <script src="./js/diff.min.js"></script> <script> var original = <?php echo $page_response['original_json']; ?> ; var revision = <?php echo $page_response['revision_json']; ?> ; </script> <script src="./js/revision.js"></script> <?php } else { echo $page_response['original']['snapshot_content'] . '<br/><br/><div id="tags" class="well well-sm">'; echo !empty($page_response['original']['snapshot_tags']) ? parseTags($page_response['original']['snapshot_tags']) : "<em>이 지식에는 아직 분류가 없습니다. 분류를 추가해 주세요!</em>"; echo '</div>'; } ?> </div> <?php include 'frame.footer.php';
function parseTweet($s) { return parseTags(parseNames(parseLinks($s))); }