function EditToolbar() { global $WikiTheme; $this->tokens = array(); //FIXME: enable Undo button for all other buttons also, not only the search/replace button if (JS_SEARCHREPLACE) { $this->tokens['JS_SEARCHREPLACE'] = 1; $undo_btn = $WikiTheme->getImageURL("ed_undo.png"); $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.png"); // JS_SEARCHREPLACE from walterzorn.de $js = Javascript("\nuri_undo_btn = '" . $undo_btn . "'\nmsg_undo_alt = '" . _("Undo") . "'\nuri_undo_d_btn = '" . $undo_d_btn . "'\nmsg_undo_d_alt = '" . _("Undo disabled") . "'\nmsg_do_undo = '" . _("Operation undone") . "'\nmsg_replfound = '" . _("Substring \"\\1\" found \\2 times. Replace with \"\\3\"?") . "'\nmsg_replnot = '" . _("String \"%s\" not found.") . "'\nmsg_repl_title = '" . _("Search & Replace") . "'\nmsg_repl_search = '" . _("Search for") . "'\nmsg_repl_replace_with = '" . _("Replace with") . "'\nmsg_repl_ok = '" . _("OK") . "'\nmsg_repl_close = '" . _("Close") . "'\n"); if (empty($WikiTheme->_headers_printed)) { $WikiTheme->addMoreHeaders($js); $WikiTheme->addMoreAttr('body', "SearchReplace", " onload='define_f()'"); } else { // from an actionpage: WikiBlog, AddComment, WikiForum printXML($js); } } else { $WikiTheme->addMoreAttr('body', "editfocus", "document.getElementById('edit-content]').editarea.focus()"); } if (ENABLE_EDIT_TOOLBAR) { $js = JavaScript('', array('src' => $WikiTheme->_findData("toolbar.js"))); if (empty($WikiTheme->_headers_printed)) { $WikiTheme->addMoreHeaders($js); } else { // from an actionpage: WikiBlog, AddComment, WikiForum printXML($js); printXML(JavaScript('define_f()')); } } require_once "lib/WikiPluginCached.php"; $cache = WikiPluginCached::newCache(); $dbi = $GLOBALS['request']->getDbh(); // regenerate if number of pages changes (categories, pages, templates) $key = $dbi->numPages(); $key .= '+categories+plugin' . (isBrowserSafari() ? '+safari' : ''); if (TOOLBAR_PAGELINK_PULLDOWN) { $key .= "+pages"; } if (TOOLBAR_TEMPLATE_PULLDOWN) { $key .= "+templates_" . $dbi->getTimestamp(); } $id = $cache->generateId($key); $content = $cache->get($id, 'toolbarcache'); if (!empty($content)) { $this->tokens['EDIT_TOOLBAR'] =& $content; } else { $content = $this->_generate(); // regenerate buttons every 1 hr/6 hrs $cache->save($id, $content, DEBUG ? '+3600' : '+21600', 'toolbarcache'); $this->tokens['EDIT_TOOLBAR'] =& $content; } }
function printXML($name, $xml) { $opentag = "<" . $name; $closetag = "</" . $name . ">"; $children = ""; foreach ($xml as $key => $val) { if (is_array($val)) { foreach ($val as $child) { $children .= printXML($key, $child); } } else { $opentag .= " " . $key . "='" . $val . "'"; } } $opentag .= ">"; return $opentag . $children . $closetag; }
function _debug($tab, $msg) { //return ; $where = $this->where(); $tab = str_repeat('____', $this->getDepth()) . $tab; printXML(HTML::div("{$tab} {$msg}: at: '", HTML::tt($where), "'")); flush(); }
function printXML($arr) { foreach ($arr as $key => $val) { if (is_array($val)) { $folder_title = substr($key, $omit_folder_chars); ksort($val); printXML($val); } else { $file = $val; if (substr($file, -3) == 'mp3' || substr($file, -3) == 'MP3') { $file_title = substr($file, 0, strlen($file) - 4); // ID3v1 and ID3v2 tags parser $nome_arq = $file; $myId3 = new ID3($nome_arq); if ($myId3->getInfo()) { $f_title = $myId3->getTitle(); $f_artist = $myId3->getArtist(); } if (!$myId3->getArtist()) { $id3 = new MP3_Id(); $result = $id3->read($file); $f_title = $id3->getTag('name'); $f_artist = $id3->getTag('artists'); } if ($f_artist == '0' && $f_title == '0') { $arr_names = explode('/', strrev($nome_arq)); $substr = substr($arr_names[0], 4, strlen($arr_names[0])); $arr_names_last = explode('_', strrev($substr)); $f_artist = ''; $f_title = strrev($substr); } if ($f_artist == '0') { $f_artist = ''; } $f_id = str_replace("/", "", $file_title); $f_id = str_replace(".", "", $f_id); $f_id = str_replace(">", "", $f_id); $f_id = str_replace("<", "", $f_id); $f_id = str_replace("=", "", $f_id); $f_id = str_replace("(", "", $f_id); $f_id = str_replace(")", "", $f_id); $f_id = str_replace("\"", "", $f_id); if ($sEncoding = mb_detect_encoding($f_title, 'auto', true) != 'UTF-8') { $f_title = mb_convert_encoding($f_title, 'UTF-8', $sEncoding); } if ($sEncoding = mb_detect_encoding($f_artist, 'auto', true) != 'UTF-8') { $f_artist = mb_convert_encoding($f_artist, 'UTF-8', $sEncoding); } $f_title = conv($f_title); $f_artist = conv($f_artist); if (substr($f_title, 0, 4) == 'ÿþ') { $f_title = substr($f_title, 4); } if (substr($f_artist, 0, 4) == 'ÿþ') { $f_artist = substr($f_artist, 4); } $f_title = str_replace(">", "", $f_title); $f_title = str_replace("<", "", $f_title); $f_artist = str_replace(">", "", $f_artist); $f_artist = str_replace("<", "", $f_artist); $f_id = encoding($f_id); $path = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $path = dirname($path); $defaul_dir = substr($val, 0, strrpos($val, '/')); $file_name_ = substr(strrchr($val, '/'), 1); $url_dec = rawurlencode($file_name_); $val = $defaul_dir . '/' . $url_dec; $file = $val; $file = 'http://' . $path . '/' . $file; // Writing in XML print ' <song id="' . $f_id . '" title="' . $f_title . '" artist="' . $f_artist . '" src="' . $file . '" />'; } } } }
/** * Make and expand the top-level template. * * * @param $content mixed html content to put into the page * @param $title string page title * @param $page_revision object A WikiDB_PageRevision object * @param $args hash Extract args for top-level template * * @return string HTML expansion of template. */ function GeneratePage($content, $title, $page_revision = false, $args = false) { global $request; if (!is_array($args)) { $args = array(); } $args['CONTENT'] = $content; $args['TITLE'] = $title; $args['revision'] = $page_revision; if (!isset($args['HEADER'])) { $args['HEADER'] = $title; } printXML(new Template('html', $request, $args)); }
/** * @param string $errorString * @param XmlDocument $xmlObj * @param int $code */ function printErrorAndExit($errorString, &$xmlObj, $code = null) { $errorNote = new XmlDomNode('error', $errorString, true); if ($code !== null) { $errorNote->AppendAttribute('code', (int) $code); } $xmlObj->XmlRoot->AppendChild($errorNote); printXML($xmlObj); }
function getMoreAttr($tag) { if (empty($this->_MoreAttr[$tag])) { return ''; } $out = ''; foreach ($this->_MoreAttr[$tag] as $name => $element) { if (is_object($element)) { $out .= printXML($element); } else { $out .= "{$element}"; } } return $out; }
function newFilterThroughCmd($input, $commandLine) { $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")); $process = proc_open("{$commandLine}", $descriptorspec, $pipes); if (is_resource($process)) { // $pipes now looks like this: // 0 => writeable handle connected to child stdin // 1 => readable handle connected to child stdout // 2 => readable handle connected to child stderr fwrite($pipes[0], $input); fclose($pipes[0]); $buf = ""; while (!feof($pipes[1])) { $buf .= fgets($pipes[1], 1024); } fclose($pipes[1]); $stderr = ''; while (!feof($pipes[2])) { $stderr .= fgets($pipes[2], 1024); } fclose($pipes[2]); // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock $return_value = proc_close($process); if (empty($buf)) { printXML($this->error($stderr)); } return $buf; } }
function printUserLocation($activeUser, $fileId, $delete) { $userLocationResult = dbUtil::SELECT("SELECT clmnFileLine, clmnLineMode, clmnLineText, clmnLinePos FROM tblFileModif WHERE clmnFileId=:fileid AND clmnUserId=:userid", array(':userid' => $activeUser, ':fileid' => $fileId)); foreach ($userLocationResult as $row) { printXML("userloc"); printXML("line"); echo $row['clmnFileLine']; printXML("/line"); printXML("mode"); echo $row['clmnLineMode']; printXML("/mode"); printXML("ltext"); echo str_replace(array('\\n', '\\r'), "", $row['clmnLineText']); printXML("/ltext"); printXML("pos"); echo $row['clmnLinePos']; printXML("/pos"); printXML("/userloc"); } if ($delete) { $deleteLogsResult = dbUtil::DELETE("DELETE FROM tblFileModif WHERE clmnFileId=:fileid AND clmnUserId=:userid", array(':userid' => $activeUser, ':fileid' => $fileId)); } }
} else { if (is_file(@$getid3libPath)) { require @$getid3libPath; $getID3 = new getID3(); } else { $getMyid3info = "no"; } } } } $setDir = @$_REQUEST['dir']; //if(!$setDir || substr ($setDir, 0, 2 ) == ".." || $setDir.substr(0,1) == "/" || $setDir.substr(0,1) == "\\"){ if (!$setDir || substr($setDir, 0, 2) == ".." || substr($setDir, 0, 1) == "/" || substr($setDir, 0, 1) == "\\") { $setDir = ""; } printXML(makeXMLplaylist(url2filepath($setDir))); } else { if ($action == "getmysql") { require "wimpy.sql.php"; } else { if ($action == "podcast") { $method = "mysql"; $getMyid3info = "yes"; if (is_file('getid3.php')) { require 'getid3.php'; $getID3 = new getID3(); } else { if (is_file('getid3' . slash . 'getid3.php')) { require 'getid3' . slash . 'getid3.php'; $getID3 = new getID3(); } else {