fork download
  1. <?php
  2.  
  3.  
  4. define('_JEXEC', 1);
  5.  
  6. if (file_exists(__DIR__ . '/defines.php'))
  7. {
  8. include_once __DIR__ . '/defines.php';
  9. }
  10.  
  11. if (!defined('_JDEFINES'))
  12. {
  13. define('JPATH_BASE', __DIR__);
  14. require_once JPATH_BASE . '/includes/defines.php';
  15. }
  16.  
  17. require_once JPATH_BASE . '/includes/framework.php';
  18.  
  19. require_once JPATH_BASE . '/libraries/joomla/factory.php';
  20.  
  21. $db = JFactory::getDbo();
  22.  
  23. $query = $db->getQuery(true);
  24.  
  25. $qr_result = $db->setQuery('SELECT * FROM ' . $db->quoteName('#__content') . ' WHERE 1');
  26.  
  27. $list = $db->loadObjectList();
  28.  
  29. for ($i = 0; $i < count($list); $i++) {
  30.  
  31. $title = $list[$i]->title;
  32. $fulltext = $list[$i]->fulltext;
  33.  
  34. $dom = new DOMDocument('1.0','UTF-8');
  35. $doc->preserveWhiteSpace = false;
  36.  
  37.  
  38. if ($fulltext != "") {
  39. $dom->loadHTML(mb_convert_encoding($fulltext, 'HTML-ENTITIES', 'UTF-8'));
  40. }
  41.  
  42. $items = $dom->getElementsByTagName("img");
  43.  
  44. foreach ($items as $img) {
  45. if ($img->getAttribute('alt') == "") {
  46. $img->setAttribute('alt', $title);
  47. }
  48. if ($img->getAttribute('title') == "") {
  49. $img->setAttribute('title', $title);
  50. }
  51. }
  52.  
  53. $res = $dom->saveHTML($dom->documentElement);
  54.  
  55. $res = preg_replace('~<(?:!DOCTYPE|/?(?:html|head|meta|body))[^>]*>\s*~i', '', $res);
  56.  
  57. $qr_result = $db->setQuery(
  58. 'UPDATE ' . $db->quoteName('#__content') .
  59. ' SET ' . $db->quoteName('fulltext') . ' = ' . $db->quote($res) .
  60. ' WHERE ' . $db->quoteName('title') . ' = ' . $db->quote($title));
  61. $result = $db->query();
  62. }
Runtime error #stdin #stdout #stderr 0.02s 20568KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  require_once(/home/6YiCP7/includes/defines.php): failed to open stream: No such file or directory in /home/6YiCP7/prog.php on line 15
PHP Fatal error:  require_once(): Failed opening required '/home/6YiCP7/includes/defines.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/6YiCP7/prog.php on line 15