fork download
  1. <?php
  2.  
  3. include 'simple_html_dom.php';
  4.  
  5. header('Content-Type: text/html; charset=utf-8');
  6. define('_JEXEC', 1);
  7.  
  8. if (file_exists(__DIR__ . '/defines.php')) {
  9. include_once __DIR__ . '/defines.php';
  10. }
  11.  
  12. if (!defined('_JDEFINES')) {
  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') . '');
  26.  
  27. $list = $db->loadObjectList();
  28.  
  29. for ($i = 0; $i < count($list); $i++) {
  30.  
  31. setlocale(LC_ALL, 'ru-RU.cp1251');
  32. echo $i . ' ';
  33. $title = $list[$i]->title;
  34. $introtext = $list[$i]->introtext;
  35. $id = $list[$i]->id;
  36. if ($introtext == "") {
  37.  
  38.  
  39. } else {
  40.  
  41. $dom = str_get_html($introtext);
  42.  
  43. if ($dom->find("img")) {
  44. $items = $dom->find("img");
  45.  
  46. foreach ($items as $img) {
  47.  
  48. $img->alt = $title;
  49.  
  50.  
  51. $img->title = $title;
  52.  
  53. }
  54. }
  55.  
  56. $res = $dom->innertext;
  57.  
  58. $qr_result = $db->setQuery('UPDATE ' . $db->quoteName('#__content') . ' SET ' . $db->quoteName('introtext') . ' = ' . $db->quote($res) . ' WHERE ' . $db->quoteName('id') . ' = ' . $db->quote($id));
  59. $result = $db->query();
  60.  
  61. }
  62. }
Runtime error #stdin #stdout #stderr 0.02s 20568KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  include(simple_html_dom.php): failed to open stream: No such file or directory in /home/zWGbbA/prog.php on line 3
PHP Warning:  include(): Failed opening 'simple_html_dom.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/zWGbbA/prog.php on line 3
PHP Warning:  require_once(/home/zWGbbA/includes/defines.php): failed to open stream: No such file or directory in /home/zWGbbA/prog.php on line 14
PHP Fatal error:  require_once(): Failed opening required '/home/zWGbbA/includes/defines.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/zWGbbA/prog.php on line 14