function upd_profile($x) { $x['description'] = cleanText($x['description']); $query = "UPDATE user_member SET nickname='{$x['nickname']}', email='{$x['email']}', description='{$x['description']}', image_profile='{$x['image']}' WHERE id = {$_SESSION['admin']['id']}"; // pr($query); $result = $this->query($query); }
function cleanCode($data) { $data = cleanText($data); $data = str_replace("<!--?", "<?", $data); $data = str_replace("?-->", "?>", $data); return $data; }
function generateRSSItem() { global $settings; $item = "<item>\n"; //echo "<id>".$this->id."</id>"; $item .= "<title>" . $this->title . "</title>\n"; $item .= "<author>" . $this->author . "</author>\n"; $item .= "<link>" . $this->link . "</link>\n"; if (!empty($this->commentLink)) { $item .= "<comments>" . $this->commentLink . "</comments>\n"; } $item .= "<pubDate>" . date("r", $this->timestamp) . "</pubDate>\n"; for ($i = 0; $i < sizeof($this->categories); $i++) { if (empty($this->categories[$i])) { continue; } $item .= "<category>" . cleanText($this->categories[$i]) . "</category>\n"; } $item .= "<guid>" . $this->link . "</guid>\n"; $item .= "<description>" . $this->summary . "</description>\n"; if (!empty($this->text)) { $item .= "<content:encoded><![CDATA["; $item .= $this->text; $item .= "]]></content:encoded>\n"; } if (!empty($this->commentRSS)) { $item .= "<wfw:commentRss>" . $this->commentRSS . "</wfw:commentRss>\n"; } $item .= "</item>\n\n"; return $item; }
function cleanText($s) { $s = trim($s); if ($s == '|-') { return ''; } if (substr($s, 0, 2) == '| ') { $s = substr($s, 2); } $p1 = strpos($s, '<!--'); if ($p1 !== false) { $p2 = strpos($s, '-->'); if ($p2 !== false) { $s = substr($s, 0, $p1) . substr($s, $p2 + strlen('-->')); return cleanText($s); } return ''; } $p1 = strpos($s, '<ref>'); if ($p1 !== false) { $p2 = strpos($s, '</ref>'); if ($p2 !== false) { $s = substr($s, 0, $p1) . substr($s, $p2 + strlen('</ref>')); return cleanText($s); } return ''; } return $s; }
/** * handle user request */ function handle() { if ($_POST['redirdata']) { if (io_saveFile(dirname(__FILE__) . '/redirect.conf', cleanText($_POST['redirdata']))) { msg($this->getLang('saved'), 1); } } }
/** * Get or set the element's value * * This is the preferred way of setting the element's value * * @param null|string $value * @return string|$this */ public function val($value = null) { if ($value !== null) { $this->text = cleanText($value); return $this; } return $this->text; }
function test_win() { $unix = "one\ntwo\nthree"; $win = "one\r\ntwo\r\nthree"; $this->assertEquals(bin2hex($unix), '6f6e650a74776f0a7468726565'); $this->assertEquals(bin2hex($win), '6f6e650d0a74776f0d0a7468726565'); $this->assertNotEquals($unix, $win); $this->assertEquals($unix, cleanText($win)); }
/** * Start an oAuth login * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_start(Doku_Event &$event, $param) { global $INPUT, $RANGE, $DATE_AT, $REV; global $ID; global $_SESSION; if (isset($_SESSION[DOKU_COOKIE]['oauth-done']['do']) || !empty($_SESSION[DOKU_COOKIE]['oauth-done']['rev'])) { global $ACT, $TEXT, $PRE, $SUF, $SUM; $ACT = $_SESSION[DOKU_COOKIE]['oauth-done']['do']; if (isset($_SESSION[DOKU_COOKIE]['oauth-done']['wikitext'])) { $TEXT = cleanText($_SESSION[DOKU_COOKIE]['oauth-done']['wikitext']); $PRE = cleanText(substr($_SESSION[DOKU_COOKIE]['oauth-done']['prefix'], 0, -1)); $SUF = cleanText($_SESSION[DOKU_COOKIE]['oauth-done']['suffix']); $SUM = $_SESSION[DOKU_COOKIE]['oauth-done']['summary']; $INPUT->post->set('sectok', $_SESSION[DOKU_COOKIE]['oauth-done']['sectok']); } // resetting INPUT, ->post and ->get foreach ($_SESSION[DOKU_COOKIE]['oauth-done'] as $key => $value) { if ($key === 'post' || $key === 'get') { continue; } $INPUT->set($key, $value); if ($key === 'range') { $RANGE = $value; } } foreach ($_SESSION[DOKU_COOKIE]['oauth-done']['post'] as $key => $value) { $INPUT->post->set($key, $value); } foreach ($_SESSION[DOKU_COOKIE]['oauth-done']['get'] as $key => $value) { $INPUT->get->set($key, $value); if ($key === 'at') { $DATE_AT = $value; } if ($key === 'rev') { $REV = $value; } } unset($_SESSION[DOKU_COOKIE]['oauth-done']); return; } /** @var helper_plugin_oauth $hlp */ $hlp = plugin_load('helper', 'oauth'); $servicename = $INPUT->str('oauthlogin'); $service = $hlp->loadService($servicename); if (is_null($service)) { return; } // remember service in session session_start(); $_SESSION[DOKU_COOKIE]['oauth-inprogress']['service'] = $servicename; $_SESSION[DOKU_COOKIE]['oauth-inprogress']['id'] = $ID; session_write_close(); $service->login(); }
function test_win() { $unix = 'one two three'; $win = 'one two three'; $this->assertEqual(bin2hex($unix), '6f6e650a2020202020202020202020202020202074776f0a0a202020202020202020202020202020207468726565'); $this->assertEqual(bin2hex($win), '6f6e650d0a2020202020202020202020202020202074776f0d0a0d0a202020202020202020202020202020207468726565'); $this->assertNotEqual($unix, $win); $this->assertEqual($unix, cleanText($win)); }
/** * Handle the click on the new table button in the toolbar * * @param Doku_Event $event */ function handle_newtable($event) { global $INPUT; global $TEXT; global $ACT; if (!$INPUT->post->has('edittable__new')) { return; } /* * $fields['pre'] has all data before the selection when the "Insert table" button was clicked * $fields['text'] has all data inside the selection when the "Insert table" button was clicked * $fields['suf'] has all data after the selection when the "Insert table" button was clicked * $TEXT has the table created by the editor (from action_plugin_edittable_editor::handle_table_post()) */ $fields = $INPUT->post->arr('edittable__new'); // clean the fields (undos formText()) and update the post and request arrays $fields['pre'] = cleanText($fields['pre']); $fields['text'] = cleanText($fields['text']); $fields['suf'] = cleanText($fields['suf']); $INPUT->post->set('edittable__new', $fields); $ACT = act_clean($ACT); switch ($ACT) { case 'preview': // preview view of a table edit $INPUT->post->set('target', 'table'); break; case 'edit': // edit view of a table (first edit) $INPUT->post->set('target', 'table'); $TEXT = "^ ^ ^\n"; foreach (explode("\n", $fields['text']) as $line) { $TEXT .= "| {$line} | |\n"; } break; case 'draftdel': // not sure if/how this would happen, we restore all data and hand over to section edit $INPUT->post->set('target', 'section'); $TEXT = $fields['pre'] . $fields['text'] . $fields['suf']; $ACT = 'edit'; break; case 'save': // return to edit page $INPUT->post->set('target', 'section'); $TEXT = $fields['pre'] . $TEXT . $fields['suf']; $ACT = 'edit'; break; } }
function p_get_instructions($text) { $modes = p_get_parsermodes(); // Create the parser $Parser =& new Doku_Parser(); // Add the Handler $Parser->Handler =& new Doku_Handler(); //add modes to parser foreach ($modes as $mode) { $Parser->addMode($mode['mode'], $mode['obj']); } // Do the parsing $p = $Parser->parse(cleanText($text)); //dbg($p); return $p; }
private function restoreSessionEnvironment() { global $INPUT, $ACT, $TEXT, $PRE, $SUF, $SUM, $RANGE, $DATE_AT, $REV; $ACT = $_SESSION[DOKU_COOKIE]['oauth-done']['do']; $_REQUEST = $_SESSION[DOKU_COOKIE]['oauth-done']['$_REQUEST']; $REV = $INPUT->int('rev'); $DATE_AT = $INPUT->str('at'); $RANGE = $INPUT->str('range'); if ($INPUT->post->has('wikitext')) { $TEXT = cleanText($INPUT->post->str('wikitext')); } $PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1)); $SUF = cleanText($INPUT->post->str('suffix')); $SUM = $INPUT->post->str('summary'); unset($_SESSION[DOKU_COOKIE]['oauth-done']); }
function getCounts($cat) { $url = "http://www.livejournal.com/support/help.bml?sort=date&state=&cat=".$cat."&usescheme=lynx"; $content = HTTP::getResponse($url); // Extract <b> tags preg_match_all("/<b>.*?<\/b>/", $content, $b); if (count($b) < 1) { error(); } if (count($b[0]) < 4) { error(); } $result = array(); $result[0] = cleanText($b[0][0]); $result[1] = cleanText($b[0][1]); $result[2] = cleanText($b[0][2]); $result[3] = cleanText($b[0][3]); return $result; }
function page_inp($data) { $data['title'] = cleanText($data['title']); $data['brief'] = cleanText($data['brief']); $data['content'] = cleanText($data['content']); $date = date('Y-m-d H:i:s'); $datetime = array(); if (!empty($data['expiredate'])) { $data['expiredate'] = date("Y-m-d", strtotime($data['expiredate'])); } if ($data['action'] == 'insert') { $query = "INSERT INTO \n\t\t\t\t\t\tcdc_news_content (title,brief,content,image,thumbnailimage,categoryid,articletype,\n\t\t\t\t\t\t\t\t\t\t\ttags,createdate,postdate,expiredate,fromwho,authorid,n_status)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $data['title'] . "','" . $data['brief'] . "','" . $data['content'] . "','" . $data['image'] . "','" . $data['thumbnailimage'] . "','" . $data['categoryid'] . "','" . $data['articletype'] . "','" . $data['tags'] . "','" . $date . "','" . date("Y-m-d", strtotime($data['postdate'])) . "','" . $data['expiredate'] . "','" . $_SESSION['admin']['usertype'] . "','" . $_SESSION['admin']['id'] . "',{$data['status']})"; } else { $query = "UPDATE cdc_news_content\n\t\t\t\t\t\tSET \n\t\t\t\t\t\t\ttitle = '{$data['title']}',\n\t\t\t\t\t\t\tbrief = '{$data['brief']}',\n\t\t\t\t\t\t\tcontent = '{$data['content']}',\n\t\t\t\t\t\t\timage = '{$data['image']}',\n\t\t\t\t\t\t\tthumbnailimage = '{$data['thumbnailimage']}',\n\t\t\t\t\t\t\tcategoryid = '{$data['categoryid']}',\n\t\t\t\t\t\t\tarticletype = '{$data['articletype']}',\n\t\t\t\t\t\t\ttags = '{$data['tags']}',\n\t\t\t\t\t\t\tpostdate = '" . date("Y-m-d", strtotime($data['postdate'])) . "',\n\t\t\t\t\t\t\texpiredate = '" . $data['expiredate'] . "',\n\t\t\t\t\t\t\tfromwho = '{$_SESSION['admin']['usertype']}',\n\t\t\t\t\t\t\tauthorid = '{$_SESSION['admin']['id']}',\n\t\t\t\t\t\t\tn_status = {$data['status']}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tid = '{$data['id']}'"; } // pr($query); $result = $this->query($query); return $result; }
public function processText($text) { $text = $this->processDates($text); $this->_set('edit_text', $text); $planloves = array(); $html_text = cleanText($text, $planloves); $this->_set('plan', $html_text); Doctrine_Query::create()->delete('Planlove p')->where('p.lover_id = ?', $this->user_id)->execute(); // cleanText will return multiple copies of a username if different capitalizations are used // on a plan. Make sure we don't try to add a row twice. $done = array(); foreach ($planloves as $planlove) { $lovee = Doctrine_Query::create()->select('a.userid')->from('Accounts a')->where('a.username = ?', $planlove)->fetchOne(); if (!in_array($lovee->userid, $done)) { $love = new Planlove(); $love->Lover = $this->Account; $love->Lovee = $lovee; $love->save(); $done[] = $lovee->userid; } } }
function process_form() { // Connect to database require_once "_dbConfig.php"; // Save data from the submitted variables as shorter variables $firstname = cleanText($_POST['firstname']); $lastname = cleanText($_POST['lastname']); // Insert all the data from above into the table in the database $sql = "INSERT INTO users (firstname, lastname) VALUES ('{$firstname}', '{$lastname}')"; $result = mysql_query($sql); // If it worked, say so... if ($result) { $message = "Successfully inserted"; } else { $message = "There was an error"; } // If the form was submitted with a PDF, just show a clean confirmation page. Otherwise, show page with message if ($_POST['submitted'] == "pdf") { echo $message . "! Thanks!"; } else { show_form($message); } }
function generateRSSFeed() { $feed = "<?xml version=\"1.0\" encoding=\"utf-8\"?" . ">"; $feed .= "\n"; $feed .= "<!-- generator=\"CMIS/" . version . "\" -->"; $feed .= "<rss version=\"2.0\""; $feed .= " xmlns:atom=\"http://www.w3.org/2005/Atom\""; $feed .= " xmlns:content=\"http://purl.org/rss/1.0/modules/content/\""; $feed .= " xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\""; $feed .= ">\n"; $feed .= "<channel>\n"; $feed .= "<title>" . cleanText($this->title) . "</title>\n"; $feed .= "<link>" . cleanText($this->link) . "</link>\n"; $feed .= "<description>" . cleanText($this->description) . "</description>\n"; $feed .= "<atom:link href=\"" . $this->rssLink . "\" rel=\"self\" type=\"application/rss+xml\" />"; if (sizeof($this->items) != 0) { for ($i = 0; $i < sizeof($this->items); $i++) { $feed .= $this->items[$i]->generateRSSItem(); } } $feed .= "</channel>\n"; $feed .= "</rss>"; return $feed; }
/** * show diff * * @author Andreas Gohr <*****@*****.**> * @param string $text - compare with this text with most current version * @param bool $intr - display the intro text */ function html_diff($text = '', $intro = true, $type = null) { global $ID; global $REV; global $lang; global $conf; if (!$type) { $type = $_REQUEST['difftype']; } if ($type != 'inline') { $type = 'sidebyside'; } // we're trying to be clever here, revisions to compare can be either // given as rev and rev2 parameters, with rev2 being optional. Or in an // array in rev2. $rev1 = $REV; if (is_array($_REQUEST['rev2'])) { $rev1 = (int) $_REQUEST['rev2'][0]; $rev2 = (int) $_REQUEST['rev2'][1]; if (!$rev1) { $rev1 = $rev2; unset($rev2); } } else { $rev2 = (int) $_REQUEST['rev2']; } $r_minor = ''; $l_minor = ''; if ($text) { // compare text to the most current revision $l_rev = ''; $l_text = rawWiki($ID, ''); $l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current']; $r_rev = ''; $r_text = cleanText($text); $r_head = $lang['yours']; } else { if ($rev1 && $rev2) { // two specific revisions wanted // make sure order is correct (older on the left) if ($rev1 < $rev2) { $l_rev = $rev1; $r_rev = $rev2; } else { $l_rev = $rev2; $r_rev = $rev1; } } elseif ($rev1) { // single revision given, compare to current $r_rev = ''; $l_rev = $rev1; } else { // no revision was given, compare previous to current $r_rev = ''; $revs = getRevisions($ID, 0, 1); $l_rev = $revs[0]; $REV = $l_rev; // store revision back in $REV } // when both revisions are empty then the page was created just now if (!$l_rev && !$r_rev) { $l_text = ''; } else { $l_text = rawWiki($ID, $l_rev); } $r_text = rawWiki($ID, $r_rev); list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev); } $df = new Diff(explode("\n", htmlspecialchars($l_text)), explode("\n", htmlspecialchars($r_text))); if ($type == 'inline') { $tdf = new InlineDiffFormatter(); } else { $tdf = new TableDiffFormatter(); } if ($intro) { print p_locale_xhtml('diff'); } if (!$text) { ptln('<div class="diffoptions">'); $form = new Doku_Form(array('action' => wl())); $form->addHidden('id', $ID); $form->addHidden('rev2[0]', $l_rev); $form->addHidden('rev2[1]', $r_rev); $form->addHidden('do', 'diff'); $form->addElement(form_makeListboxField('difftype', array('sidebyside' => $lang['diff_side'], 'inline' => $lang['diff_inline']), $type, $lang['diff_type'], '', '', array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', 'diff', 'Go')); $form->printForm(); $diffurl = wl($ID, array('do' => 'diff', 'rev2[0]' => $l_rev, 'rev2[1]' => $r_rev, 'difftype' => $type)); ptln('<p><a class="wikilink1" href="' . $diffurl . '">' . $lang['difflink'] . '</a></p>'); ptln('</div>'); } ?> <table class="diff diff_<?php echo $type; ?> "> <tr> <th colspan="2" <?php echo $l_minor; ?> > <?php echo $l_head; ?> </th> <th colspan="2" <?php echo $r_minor; ?> > <?php echo $r_head; ?> </th> </tr> <?php echo $tdf->format($df); ?> </table> <?php }
$nama = !isset($nama) ? '' : $nama; $email = !isset($email) ? '' : $email; $subyek = !isset($subyek) ? '' : $subyek; $pesan = !isset($pesan) ? '' : $pesan; $op = !isset($_GET['op']) ? '' : $_GET['op']; $tengah .= "\n<form method=\"POST\" action=\"\">\n\n<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" align=\"center\">\n <tr>\n <td valign=\"top\">Your Name</td>\n <td valign=\"top\">:</td>\n <td valign=\"top\"><input type=\"text\" name=\"nama\" style=\"width:300px\" size=\"50\" value=\"" . $nama . "\"></td>\n </tr>\n <tr>\n <td valign=\"top\">Your Email</td>\n <td valign=\"top\">:</td>\n <td valign=\"top\"><input type=\"text\" name=\"email\" style=\"width:300px\" size=\"50\" value=\"" . $email . "\"></td>\n </tr>\n <tr>\n <td valign=\"top\">Subject</td>\n <td valign=\"top\">:</td>\n <td valign=\"top\"><input type=\"text\" name=\"subyek\" style=\"width:300px\" size=\"50\" value=\"" . $subyek . "\"></td>\n </tr>\n <tr>\n <td valign=\"top\">Message</td>\n <td valign=\"top\">:</td>\n <td valign=\"top\"><textarea name=\"pesan\" id=\"pesan\" cols=\"50\" rows=\"10\" >" . $pesan . "</textarea></td>\n </tr>"; if (extension_loaded("gd")) { $random_num = gen_pass(10); $tengah .= "\n <tr>\n <td valign=\"top\">Security Code</td>\n <td valign=\"top\">:</td>\n <td valign=\"top\"><img src=\"?code=gfx&random_num={$random_num}\" border=\"1\" alt=\"Security Code\"></td>\n </tr>\n <tr>\n <td valign=\"top\">Type Code</td>\n <td valign=\"top\">:</td>\n <td valign=\"top\"><input type=\"text\" name=\"gfx_check\" size=\"10\" maxlength=\"6\"><input type=\"hidden\" name=\"random_num\" value=\"{$random_num}\"></td>\n </tr>"; } $tengah .= "\n <tr>\n <td valign=\"top\"></td>\n <td valign=\"top\"></td>\n <td valign=\"top\"></td>\n </tr>\n <tr>\n <td valign=\"top\"></td>\n <td valign=\"top\"></td>\n <td valign=\"top\"><input type=\"hidden\" name=\"op\" value=\"{$op}\" /><input type=\"submit\" name=\"submit\" value=\"Submit\"></td>\n </tr>\n</table>\n</form>"; $tengah .= '</div>'; } if (@$_GET['aksi'] == "recommend") { $seftitle = text_filter(cleanText($_GET['seftitle'])); $id = text_filter(cleanText($_GET['id'])); $tengah .= '<div class="right_post">Kirim Artikel Ke Teman</div>'; $data = mysql_fetch_array(mysql_query("SELECT judul FROM artikel WHERE id='{$id}' AND publikasi=1")); $judul_artikel = $data['judul']; $tengah .= '<div class="left_message"><p>Anda ing memberitahu teman Anda tentang artikel ini yang berjudul : <b>' . $judul_artikel . '</b></p></div>'; if (isset($_POST['submit'])) { $yemail = text_filter($_POST['yemail']); $femail = text_filter($_POST['femail']); $pesan = text_filter($_POST['pesan']); $error = ''; if (!is_valid_email($yemail)) { $error .= "your email invalid, Please use the standard format (admin@domain.com)<br />"; } if (!is_valid_email($femail)) { $error .= "Friend email invalid, Please use the standard format (admin@domain.com)<br />"; }
//soft-hyphen $QUERY = trim($INPUT->str('id')); $ID = getID(); $REV = $INPUT->int('rev'); $IDX = $INPUT->str('idx'); $DATE = $INPUT->int('date'); $RANGE = $INPUT->str('range'); $HIGH = $INPUT->param('s'); if (empty($HIGH)) { $HIGH = getGoogleQuery(); } if ($INPUT->post->has('wikitext')) { $TEXT = cleanText($INPUT->post->str('wikitext')); } $PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1)); $SUF = cleanText($INPUT->post->str('suffix')); $SUM = $INPUT->post->str('summary'); //make infos about the selected page available $INFO = pageinfo(); //export minimal infos to JS, plugins can add more $JSINFO['id'] = $ID; $JSINFO['namespace'] = (string) $INFO['namespace']; // handle debugging if ($conf['allowdebug'] && $ACT == 'debug') { html_debug(); exit; } //send 404 for missing pages if configured or ID has special meaning to bots if (!$INFO['exists'] && ($conf['send404'] || preg_match('/^(robots\\.txt|sitemap\\.xml(\\.gz)?|favicon\\.ico|crossdomain\\.xml)$/', $ID)) && ($ACT == 'show' || !is_array($ACT) && substr($ACT, 0, 7) == 'export_')) { header('HTTP/1.0 404 Not Found'); }
/** * Show diff * between current page version and provided $text * or between the revisions provided via GET or POST * * @author Andreas Gohr <*****@*****.**> * @param string $text when non-empty: compare with this text with most current version * @param bool $intro display the intro text * @param string $type type of the diff (inline or sidebyside) */ function html_diff($text = '', $intro = true, $type = null) { global $ID; global $REV; global $lang; global $INPUT; global $INFO; $pagelog = new PageChangeLog($ID); /* * Determine diff type */ if (!$type) { $type = $INPUT->str('difftype'); if (empty($type)) { $type = get_doku_pref('difftype', $type); if (empty($type) && $INFO['ismobile']) { $type = 'inline'; } } } if ($type != 'inline') { $type = 'sidebyside'; } /* * Determine requested revision(s) */ // we're trying to be clever here, revisions to compare can be either // given as rev and rev2 parameters, with rev2 being optional. Or in an // array in rev2. $rev1 = $REV; $rev2 = $INPUT->ref('rev2'); if (is_array($rev2)) { $rev1 = (int) $rev2[0]; $rev2 = (int) $rev2[1]; if (!$rev1) { $rev1 = $rev2; unset($rev2); } } else { $rev2 = $INPUT->int('rev2'); } /* * Determine left and right revision, its texts and the header */ $r_minor = ''; $l_minor = ''; if ($text) { // compare text to the most current revision $l_rev = ''; $l_text = rawWiki($ID, ''); $l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current']; $r_rev = ''; $r_text = cleanText($text); $r_head = $lang['yours']; } else { if ($rev1 && isset($rev2) && $rev2) { // two specific revisions wanted // make sure order is correct (older on the left) if ($rev1 < $rev2) { $l_rev = $rev1; $r_rev = $rev2; } else { $l_rev = $rev2; $r_rev = $rev1; } } elseif ($rev1) { // single revision given, compare to current $r_rev = ''; $l_rev = $rev1; } else { // no revision was given, compare previous to current $r_rev = ''; $revs = $pagelog->getRevisions(0, 1); $l_rev = $revs[0]; $REV = $l_rev; // store revision back in $REV } // when both revisions are empty then the page was created just now if (!$l_rev && !$r_rev) { $l_text = ''; } else { $l_text = rawWiki($ID, $l_rev); } $r_text = rawWiki($ID, $r_rev); list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev, null, false, $type == 'inline'); } /* * Build navigation */ $l_nav = ''; $r_nav = ''; if (!$text) { list($l_nav, $r_nav) = html_diff_navigation($pagelog, $type, $l_rev, $r_rev); } /* * Create diff object and the formatter */ $diff = new Diff(explode("\n", $l_text), explode("\n", $r_text)); if ($type == 'inline') { $diffformatter = new InlineDiffFormatter(); } else { $diffformatter = new TableDiffFormatter(); } /* * Display intro */ if ($intro) { print p_locale_xhtml('diff'); } /* * Display type and exact reference */ if (!$text) { ptln('<div class="diffoptions group">'); $form = new Doku_Form(array('action' => wl())); $form->addHidden('id', $ID); $form->addHidden('rev2[0]', $l_rev); $form->addHidden('rev2[1]', $r_rev); $form->addHidden('do', 'diff'); $form->addElement(form_makeListboxField('difftype', array('sidebyside' => $lang['diff_side'], 'inline' => $lang['diff_inline']), $type, $lang['diff_type'], '', '', array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', 'diff', 'Go')); $form->printForm(); ptln('<p>'); // link to exactly this view FS#2835 echo html_diff_navigationlink($type, 'difflink', $l_rev, $r_rev ? $r_rev : $INFO['currentrev']); ptln('</p>'); ptln('</div>'); // .diffoptions } /* * Display diff view table */ ?> <div class="table"> <table class="diff diff_<?php echo $type; ?> "> <?php //navigation and header if ($type == 'inline') { if (!$text) { ?> <tr> <td class="diff-lineheader">-</td> <td class="diffnav"><?php echo $l_nav; ?> </td> </tr> <tr> <th class="diff-lineheader">-</th> <th <?php echo $l_minor; ?> > <?php echo $l_head; ?> </th> </tr> <?php } ?> <tr> <td class="diff-lineheader">+</td> <td class="diffnav"><?php echo $r_nav; ?> </td> </tr> <tr> <th class="diff-lineheader">+</th> <th <?php echo $r_minor; ?> > <?php echo $r_head; ?> </th> </tr> <?php } else { if (!$text) { ?> <tr> <td colspan="2" class="diffnav"><?php echo $l_nav; ?> </td> <td colspan="2" class="diffnav"><?php echo $r_nav; ?> </td> </tr> <?php } ?> <tr> <th colspan="2" <?php echo $l_minor; ?> > <?php echo $l_head; ?> </th> <th colspan="2" <?php echo $r_minor; ?> > <?php echo $r_head; ?> </th> </tr> <?php } //diff view echo html_insert_softbreaks($diffformatter->format($diff)); ?> </table> </div> <?php }
/** * Save a wiki page * * @author Michael Klier <*****@*****.**> */ function putPage($id, $text, $params) { global $TEXT; global $lang; $id = $this->resolvePageId($id); $TEXT = cleanText($text); $sum = $params['sum']; $minor = $params['minor']; if (empty($id)) { throw new RemoteException('Empty page ID', 131); } if (!page_exists($id) && trim($TEXT) == '') { throw new RemoteException('Refusing to write an empty new wiki page', 132); } if (auth_quickaclcheck($id) < AUTH_EDIT) { throw new RemoteAccessDeniedException('You are not allowed to edit this page', 112); } // Check, if page is locked if (checklock($id)) { throw new RemoteException('The page is currently locked', 133); } // SPAM check if (checkwordblock()) { throw new RemoteException('Positive wordblock check', 134); } // autoset summary on new pages if (!page_exists($id) && empty($sum)) { $sum = $lang['created']; } // autoset summary on deleted pages if (page_exists($id) && empty($TEXT) && empty($sum)) { $sum = $lang['deleted']; } lock($id); saveWikiText($id, $TEXT, $sum, $minor); unlock($id); // run the indexer if page wasn't indexed yet idx_addPage($id); return 0; }
/** * Returns content of $file as cleaned string. * * Uses gzip if extension is .gz * * If you want to use the returned value in unserialize * be sure to set $clean to false! * * @author Andreas Gohr <*****@*****.**> */ function io_readFile($file, $clean = true) { $ret = ''; if (@file_exists($file)) { if (substr($file, -3) == '.gz') { $ret = join('', gzfile($file)); } else { if (substr($file, -4) == '.bz2') { $ret = bzfile($file); } else { $ret = file_get_contents($file); } } } if ($clean) { return cleanText($ret); } else { return $ret; } }
/** * Returns the requested EXIF/IPTC tag from the current image * * If $tags is an array all given tags are tried until a * value is found. If no value is found $alt is returned. * * Which texts are known is defined in the functions _exifTagNames * and _iptcTagNames() in inc/jpeg.php (You need to prepend IPTC * to the names of the latter one) * * Only allowed in: detail.php * * @author Andreas Gohr <*****@*****.**> * * @param array|string $tags tag or array of tags to try * @param string $alt alternative output if no data was found * @param null|string $src the image src, uses global $SRC if not given * @return string */ function tpl_img_getTag($tags, $alt = '', $src = null) { // Init Exif Reader global $SRC; if (is_null($src)) { $src = $SRC; } static $meta = null; if (is_null($meta)) { $meta = new JpegMeta($src); } if ($meta === false) { return $alt; } $info = cleanText($meta->getField($tags)); if ($info == false) { return $alt; } return $info; }
/** * Escaping * * @param string $string * @return string */ protected function _escape($string) { $tr = array("\\" => '\\\\', "'" => '\\\''); return "'" . strtr(cleanText($string), $tr) . "'"; }
/** * Stores the current task log in the database updating the task_log_updated * field appropriately. Then updates total hours worked cache on task. * * @return void * * @access public */ public function store() { $this->_error = $this->check(); if (count($this->_error)) { return $this->_error; } $q = $this->_getQuery(); $this->task_log_updated = $q->dbfnNowWithTZ(); if ($this->task_log_date) { $date = new w2p_Utilities_Date($this->task_log_date); $this->task_log_date = $date->format(FMT_DATETIME_MYSQL); } $dot = strpos($this->task_log_hours, ':'); if ($dot > 0) { $log_duration_minutes = sprintf('%.3f', substr($this->task_log_hours, $dot + 1) / 60.0); $this->task_log_hours = floor($this->task_log_hours) + $log_duration_minutes; } $this->task_log_hours = $this->task_log_hours; $this->task_log_costcode = cleanText($this->task_log_costcode); if ($this->{$this->_tbl_key} && $this->_perms->checkModuleItem($this->_tbl_module, 'edit', $this->{$this->_tbl_key})) { if ($msg = parent::store()) { $this->_error['store-check'] = $msg; } else { $stored = true; $this->updateTaskSummary($this->_AppUI, $this->task_log_task); } } if (0 == $this->{$this->_tbl_key} && $this->_perms->checkModuleItem($this->_tbl_module, 'add')) { $this->task_log_created = $q->dbfnNowWithTZ(); if ($msg = parent::store()) { $this->_error['store-check'] = $msg; } else { $stored = true; $this->updateTaskSummary(null, $this->task_log_task); } } return $stored; }
if ($dot > 0) { $log_duration_minutes = sprintf('%.3f', mb_substr($obj->task_log_hours, $dot + 1) / 60.0); $obj->task_log_hours = floor($obj->task_log_hours) + $log_duration_minutes; } $obj->task_log_hours = round($obj->task_log_hours, 3); // prepare (and translate) the module name ready for the suffix $AppUI->setMsg('Task Log'); if ($del) { if ($msg = $obj->delete()) { $AppUI->setMsg($msg, UI_MSG_ERROR); } else { $AppUI->setMsg('deleted', UI_MSG_ALERT); } $AppUI->redirect(); } else { $obj->task_log_costcode = cleanText($obj->task_log_costcode); if ($msg = $obj->store()) { $AppUI->setMsg($msg, UI_MSG_ERROR); $AppUI->redirect(); } else { $AppUI->setMsg(@$_POST['task_log_id'] ? 'updated' : 'inserted', UI_MSG_OK, true); } } $task = new CTask(); $task->load($obj->task_log_task); $task->htmlDecode(); $task->check(); $task_end_date = new CDate($task->task_end_date); $task->task_percent_complete = dPgetParam($_POST, 'task_percent_complete', null); if (dPgetParam($_POST, 'task_end_date', '') != '') { $new_date = new CDate($_POST['task_end_date']);
require_once DOKU_INC . 'inc/actions.php'; //import variables $QUERY = trim($_REQUEST['id']); $ID = getID(); $NS = getNS($ID); $REV = $_REQUEST['rev']; $IDX = $_REQUEST['idx']; $DATE = $_REQUEST['date']; $RANGE = $_REQUEST['range']; $HIGH = $_REQUEST['s']; if (empty($HIGH)) { $HIGH = getGoogleQuery(); } $TEXT = cleanText($_POST['wikitext']); $PRE = cleanText($_POST['prefix']); $SUF = cleanText($_POST['suffix']); $SUM = $_REQUEST['summary']; //sanitize revision $REV = preg_replace('/[^0-9]/', '', $REV); //make infos about the selected page available $INFO = pageinfo(); //export minimal infos to JS, plugins can add more $JSINFO['id'] = $ID; $JSINFO['namespace'] = (string) $INFO['namespace']; // handle debugging if ($conf['allowdebug'] && $ACT == 'debug') { html_debug(); exit; } //send 404 for missing pages if configured or ID has special meaning to bots if (!$INFO['exists'] && ($conf['send404'] || preg_match('/^(robots\\.txt|sitemap\\.xml(\\.gz)?|favicon\\.ico|crossdomain\\.xml)$/', $ID)) && ($ACT == 'show' || substr($ACT, 0, 7) == 'export_')) {
/** * Save a wiki page * * @author Michael Klier <*****@*****.**> */ function putPage($id, $text, $params) { global $TEXT; global $lang; global $conf; $id = cleanID($id); $TEXT = cleanText($text); $sum = $params['sum']; $minor = $params['minor']; if (empty($id)) { return new IXR_Error(1, 'Empty page ID'); } if (!page_exists($id) && trim($TEXT) == '') { return new IXR_ERROR(1, 'Refusing to write an empty new wiki page'); } if (auth_quickaclcheck($id) < AUTH_EDIT) { return new IXR_Error(1, 'You are not allowed to edit this page'); } // Check, if page is locked if (checklock($id)) { return new IXR_Error(1, 'The page is currently locked'); } // SPAM check if (checkwordblock()) { return new IXR_Error(1, 'Positive wordblock check'); } // autoset summary on new pages if (!page_exists($id) && empty($sum)) { $sum = $lang['created']; } // autoset summary on deleted pages if (page_exists($id) && empty($TEXT) && empty($sum)) { $sum = $lang['deleted']; } lock($id); saveWikiText($id, $TEXT, $sum, $minor); unlock($id); // run the indexer if page wasn't indexed yet if (!@file_exists(metaFN($id, '.indexed'))) { // try to aquire a lock $lock = $conf['lockdir'] . '/_indexer.lock'; while (!@mkdir($lock, $conf['dmode'])) { usleep(50); if (time() - @filemtime($lock) > 60 * 5) { // looks like a stale lock - remove it @rmdir($lock); } else { return false; } } if ($conf['dperm']) { chmod($lock, $conf['dperm']); } // do the work idx_addPage($id); // we're finished - save and free lock io_saveFile(metaFN($id, '.indexed'), INDEXER_VERSION); @rmdir($lock); } return 0; }
//bugfix: http://framework.zend.com/issues/browse/ZF-33 // Rotate the coordinate system 90 degrees clockwise //$pdfPage->rotate(0, 0, deg2rad(90)); // Calculate the x and y offsets to "shift the origin." $xOffset = 0; $yOffset = $pdfPage->getHeight(); //$yOffset = 0; $textWidth2_20 = 36; $textWidth_28 = 20; $textWidth_20 = 36; $textWidth_16 = 36; //$pdf->drawText($pdfPage, "Felix Ongao",$textWidth_28, 46 , -60 ,96); //Felix Ongao $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); $pdfPage->setFont($font, 20) ->drawText2($pdfPage, $child["Id"] . ' ' . $child["Name"], 170 , 400 ,206, Zend_Pdf_Page::TEXT_ALIGN_CENTER) ->setFont($font, 16) ->drawText2($pdfPage, cleanText($giver["Id"]),270,740, 206, Zend_Pdf_Page::TEXT_ALIGN_LEFT) ->drawText2($pdfPage, cleanText($giver["Name"]),270,720, 206, Zend_Pdf_Page::TEXT_ALIGN_LEFT) ->drawText2($pdfPage, cleanText($giver["Address"]),270,700, 206, Zend_Pdf_Page::TEXT_ALIGN_LEFT) ->drawText2($pdfPage, cleanText($giver["ZipCode"] . ' ' . $giver["ZipTown"]),270,680, 206, Zend_Pdf_Page::TEXT_ALIGN_LEFT) ; //->drawText(centerText("96D Deaf Children (kom) Kenya", $textWidth2_20), 530, -190) header("Content-Disposition: inline; filename=barnrapportbrev.pdf"); header("Content-type: application/x-pdf"); echo $pdf->render();