fork download
  1. <?php
  2.  
  3. define('_JEXEC', 1);
  4.  
  5. if (file_exists(__DIR__ . '/defines.php'))
  6. {
  7. include_once __DIR__ . '/defines.php';
  8. }
  9.  
  10. if (!defined('_JDEFINES'))
  11. {
  12. define('JPATH_BASE', __DIR__);
  13. require_once JPATH_BASE . '/includes/defines.php';
  14. }
  15.  
  16. require_once JPATH_BASE . '/includes/framework.php';
  17.  
  18. require_once JPATH_BASE . '/libraries/joomla/factory.php';
  19.  
  20. //ARTICLE'S INPUTS
  21.  
  22.  
  23.  
  24. $title = 'test';
  25.  
  26. $category = 'Сайты';
  27.  
  28. $fulltext = <<<EOD
  29.  
  30. EOD;
  31.  
  32. $state = 1;
  33.  
  34. $access = 1;
  35.  
  36. //END ARTICLE'S INPUTS
  37.  
  38. $db = JFactory::getDbo();
  39.  
  40. $date =& JFactory::getDate();
  41.  
  42. $query = $db->getQuery(true);
  43.  
  44. $query
  45. ->select($db->quoteName('id'))
  46. ->from($db->quoteName('#__users'))
  47. ->where($db->quoteName('name').' = '.$db->quote('Super User'));
  48.  
  49. $db->setQuery($query);
  50. $userId = $db->loadResult();
  51.  
  52. $query = $db->getQuery(true);
  53.  
  54. $query
  55. ->select($db->quoteName('id'))
  56. ->from($db->quoteName('#__categories'))
  57. ->where($db->quoteName('title').' = '.$db->quote($category));
  58.  
  59. $db->setQuery($query);
  60. $catId = $db->loadResult();
  61.  
  62. $query = $db->getQuery(true);
  63.  
  64. $columns = array('title', 'alias', 'fulltext', 'state', 'catid', 'created', 'created_by', 'access', 'language');
  65.  
  66. $values = array(
  67. $db->quote($title),
  68. $db->quote(JFilterOutput::stringURLSafe($title)),
  69. $db->quote($fulltext),
  70. $state,
  71. $db->quote($catId),
  72. $db->quote(JFactory::getDate()->toSQL()),
  73. $db->quote($userId),
  74. $access,
  75. $db->quote('*')
  76. );
  77.  
  78. $query
  79. ->insert($db->quoteName('#__content'))
  80. ->columns($db->quoteName($columns))
  81. ->values(implode(',', $values));
  82.  
  83. $db->setQuery($query);
  84. $result = $db->query();
  85.  
Runtime error #stdin #stdout #stderr 0.01s 20520KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  require_once(/home/cV8Rvf/includes/defines.php): failed to open stream: No such file or directory in /home/cV8Rvf/prog.php on line 13
PHP Fatal error:  require_once(): Failed opening required '/home/cV8Rvf/includes/defines.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/cV8Rvf/prog.php on line 13