PageRenderTime 45ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/strawberry/1.1.2/plugins/eval.php

http://goodgirl.googlecode.com/
PHP | 41 lines | 19 code | 9 blank | 13 comment | 3 complexity | 3079a101c0cca2402267d9662a72bdc2 MD5 | raw file
  1. <?php
  2. /**
  3. * @package Plugins
  4. * @access private
  5. */
  6. /*
  7. Plugin Name: Eval
  8. Plugin URI: http://www.xs4all.nl/~cvdtak/phpintemplates_1.2.htm
  9. Description: ?????? ??????€?? ??? ??????€?? php ? ??????€? ? ????????. ?????? ????????? ? ????????!
  10. Application: Strawberry
  11. Author: cvdtak
  12. Author URI: http://www.xs4all.nl/~cvdtak/
  13. */
  14. add_filter('news-entry', 'php_in_template');
  15. function php_in_template($output){
  16. $output = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $output);
  17. return $output;
  18. }
  19. #-------------------------------------------------------------------------------
  20. function phpTemplateEval($match){
  21. global $tpl, $users, $usergroups;
  22. $match[1] = replace_news('admin', $match[1]);
  23. $match[1] = str_replace('<br />', '', $match[1]);
  24. ob_start();
  25. if ($usergroups[$users[$tpl['post']['_']['author']]['usergroup']]['access'] == 'full'){
  26. eval($match[1]);
  27. } else {
  28. echo htmlspecialchars($match[1]);
  29. }
  30. return ob_get_clean();
  31. }
  32. ?>