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('4.0','UTF-8');
  35. $dom->substituteEntities = false;
  36. $dom->encoding = "UTF-8";
  37.  
  38.  
  39. if ($fulltext != "") {
  40. $dom->loadHTML($fulltext);
  41. }
  42. $nodeHead=$dom->createElement("head");
  43. $nodeMeta=$dom->createElement('meta');
  44. $dom->insertBefore($nodeHead, $dom->firstChild);
  45. $nodeMeta->setAttribute ("http-equiv","Character");
  46. $nodeMeta->setAttribute ("content","ISO-8859-1");
  47. $nodeHead->appendChild($nodeMeta);
  48. $nodeMeta=$dom->createElement('meta');
  49. $nodeMeta->setAttribute ("http-equiv","Content-Type");
  50. $nodeMeta->setAttribute ("content","text/html; charset=ISO-8859-1");
  51. $nodeHead->appendChild($nodeMeta);
  52.  
  53. $items = $dom->getElementsByTagName("img");
  54.  
  55. foreach ($items as $img) {
  56. if ($img->getAttribute('alt') == "") {
  57. $img->setAttribute('alt', $title);
  58. }
  59. if ($img->getAttribute('title') == "") {
  60. $img->setAttribute('title', $title);
  61. }
  62. }
  63.  
  64. $res = $dom->saveHTML();
  65.  
  66. $res = preg_replace('~<(?:!DOCTYPE|/?(?:html|head|meta|body))[^>]*>\s*~i', '', $res);
  67.  
  68. $qr_result = $db->setQuery(
  69. 'UPDATE ' . $db->quoteName('#__content') .
  70. ' SET ' . $db->quoteName('fulltext') . ' = ' . $db->quote($res) .
  71. ' WHERE ' . $db->quoteName('title') . ' = ' . $db->quote($title));
  72. $result = $db->query();
  73. }
Runtime error #stdin #stdout #stderr 0.02s 20568KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  require_once(/home/5rMDFD/includes/defines.php): failed to open stream: No such file or directory in /home/5rMDFD/prog.php on line 15
PHP Fatal error:  require_once(): Failed opening required '/home/5rMDFD/includes/defines.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/5rMDFD/prog.php on line 15