当前位置: 首页>>代码示例>>PHP>>正文


PHP TikiLib::genPass方法代码示例

本文整理汇总了PHP中TikiLib::genPass方法的典型用法代码示例。如果您正苦于以下问题:PHP TikiLib::genPass方法的具体用法?PHP TikiLib::genPass怎么用?PHP TikiLib::genPass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TikiLib的用法示例。


在下文中一共展示了TikiLib::genPass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plugins_remove

 /**
  * Replace plugins with guid keys and store them in an array
  *
  * @param $data	string		data to be cleaned of plugins
  * @param $noparsed array	output array
  */
 function plugins_remove(&$data, &$noparsed)
 {
     $matches = WikiParser_PluginMatcher::match($data);
     // find the plugins
     foreach ($matches as $match) {
         // each plugin
         $plugin = (string) $match;
         $key = '§' . md5(TikiLib::genPass()) . '§';
         // by replace whole plugin with a guid
         $noparsed['key'][] = $key;
         $noparsed['data'][] = $plugin;
     }
     $data = str_replace($noparsed['data'], $noparsed['key'], $data);
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:20,代码来源:parserlib.php

示例2: convertData

 public function convertData($data)
 {
     //we store the original matches because we are about to change and update them, we need to get their fingerprint
     $oldMatches = WikiParser_PluginMatcher::match($data);
     // HTML-decode pages
     $data = htmlspecialchars_decode($data);
     // find the plugins
     $matches = WikiParser_PluginMatcher::match($data);
     $replaced = array();
     $fingerPrintsOld = array();
     foreach ($oldMatches as $match) {
         $name = $match->getName();
         $meta = $this->parserlib->plugin_info($name);
         // only check fingerprints of plugins requiring validation
         if (!empty($meta['validate'])) {
             $args = $this->argumentParser->parse($match->getArguments());
             //RobertPlummer - pre 9, latest findings from v8 is that the < and > chars are THE ONLY ones converted to &lt; and &gt; everything else seems to be decoded
             $body = $match->getBody();
             // jonnyb - pre 9.0, Tiki 6 (?) fingerprints are calculated with the undecoded body
             $fingerPrint = $this->parserlib->plugin_fingerprint($name, $meta, $body, $args);
             // so check the db for previously recorded plugins
             if (!$this->parserlib->getOne('SELECT COUNT(*) FROM tiki_plugin_security WHERE fingerprint = ?', array($fingerPrint))) {
                 // jb but v 7 & 8 fingerprints may be calculated differently, so check both fully decoded and partially
                 $body = htmlspecialchars_decode($body);
                 $fingerPrint = $this->parserlib->plugin_fingerprint($name, $meta, $body, $args);
                 if (!$this->parserlib->getOne('SELECT COUNT(*) FROM tiki_plugin_security WHERE fingerprint = ?', array($fingerPrint))) {
                     $body = str_replace(array('<', '>'), array('&lt;', '&gt;'), $body);
                     $fingerPrint = $this->parserlib->plugin_fingerprint($name, $meta, $body, $args);
                     if (!$this->parserlib->getOne('SELECT COUNT(*) FROM tiki_plugin_security WHERE fingerprint = ?', array($fingerPrint))) {
                         // old fingerprint not found - what to do? Might be worth trying &quot; chars too...
                         $fingerPrint = '';
                     }
                 }
             }
             $fingerPrintsOld[] = $fingerPrint;
         }
     }
     $fingerPrintsNew = array();
     // each plugin
     foreach ($matches as $match) {
         $name = $match->getName();
         $meta = $this->parserlib->plugin_info($name);
         $argsRaw = $match->getArguments();
         //Here we detect if a plugin was double encoded and this is the second decode
         //try to detect double encoding
         if (preg_match("/&amp;&/i", $argsRaw) || preg_match("/&quot;/i", $argsRaw) || preg_match("/&gt;/i", $argsRaw)) {
             $argsRaw = htmlspecialchars_decode($argsRaw);
             // decode entities in the plugin args (usually &quot;)
         }
         $args = $this->argumentParser->parse($argsRaw);
         $plugin = (string) $match;
         $key = '§' . md5(TikiLib::genPass()) . '§';
         // by replace whole plugin with a guid
         $data = str_replace($plugin, $key, $data);
         $body = $match->getBody();
         // leave the bodies alone
         $key2 = '§' . md5(TikiLib::genPass()) . '§';
         // by replacing it with a guid
         $plugin = str_replace($body, $key2, $plugin);
         //Here we detect if a plugin was double encoded and this is the second decode
         //try to detect double encoding
         if (preg_match("/&amp;&/i", $plugin) || preg_match("/&quot;/i", $plugin) || preg_match("/&gt;/i", $plugin)) {
             $plugin = htmlspecialchars_decode($plugin);
             // decode entities in the plugin args (usually &quot;)
         }
         $plugin = str_replace($key2, $body, $plugin);
         // finally put the body back
         $replaced['key'][] = $key;
         $replaced['data'][] = $plugin;
         // store the decoded-args plugin for replacement later
         // only check fingerprints of plugins requiring validation
         if (!empty($meta['validate'])) {
             $fingerPrintsNew[] = $this->parserlib->plugin_fingerprint($name, $meta, $body, $args);
         }
     }
     $this->parserlib->plugins_replace($data, $replaced);
     // put the plugins back into the page
     return array("data" => $data, "fingerPrintsOld" => $fingerPrintsOld, "fingerPrintsNew" => $fingerPrintsNew);
 }
开发者ID:ameoba32,项目名称:tiki,代码行数:79,代码来源:wikilib.php


注:本文中的TikiLib::genPass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。