private function generateArticlesHTML() { $articles = array(); $q = "action=fetch&object=article&max=5&order=article.id,desc"; try { $articles = orongo_query($q); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); getDisplay()->addObject($msgbox); } if (count($articles) < 1) { try { $article = Article::createArticle("Hello World!"); $article->setContent("<p>Thank you for installing OrongoCMS!</p><p>To edit this simply delete it and create a new article or change this article.</p><br /><p>The OrongoCMS team</p>"); $articles[0] = $article; } catch (Exception $e) { } } if (getStyle()->doArticleHTML()) { try { $this->articleHTML = getStyle()->getArticlesHTML($articles); } catch (Exception $e) { $msgbox = new MessageBox("The style didn't generate the HTML code for the articles, therefore the default generator was used. <br /><br />To hide this message open <br />" . $style->getStylePath() . "info.xml<br /> and set <strong>own_article_html</strong> to <strong>false</strong>."); $msgbox->bindException($e); getDisplay()->addObject($msgbox); foreach ($articles as $article) { $this->articleHTML .= $article->toShortHTML(); } } } else { foreach ($articles as $article) { $this->articleHTML .= $article->toShortHTML(); } } }
header("Location: " . orongoURL("orongo-admin/index.php?msg=0")); exit; } if (!isset($_SERVER['QUERY_STRING'])) { header("Location: " . orongoURL("orongo-admin/create.php")); exit; } $object = $_SERVER['QUERY_STRING']; switch ($object) { case "article": if (!isset($_POST['title']) || !isset($_POST['content']) || !isset($_POST['tags'])) { header("Location: " . orongoURL("orongo-admin/create.php?article")); exit; } try { $article = Article::createArticle($_POST['title'], getUser()); $article->setContent($_POST['content']); } catch (Exception $e) { header("Location: " . orongoURL("orongo-admin/create.php?msg=0&obj=article")); } header("Location: " . orongoURL("orongo-admin/create.php?msg=1&obj=article")); exit; break; case "page": if (!isset($_POST['title']) || !isset($_POST['content'])) { header("Location: " . orongoURL("orongo-admin/create.php?page")); exit; } try { $page = Page::createPage($_POST['title']); $page->setContent($_POST['content']);
function POST() { $P = new Password(); if(!$P->isValid($_POST['password'])) { $this->layout_vars = array( 'content' => "The password you entered is incorrect."); } else { $A = new Article(); if($A->createArticle($_POST)) { $this->layout_vars = array( 'content' => "Congratulations, you made a post. Everyone is so proud."); } else { $this->layout_vars = array( 'content' => "Couldn't write post. Fuuuuuu-"); } } }
include_once ROOT . '/components/islogin.php'; include_once ROOT . '/models/AuthModel.php'; include_once ROOT . '/models/ArticleModel.php'; if (CheckForLogIn::isLogin()) { $regId = base64_decode(base64_decode($_COOKIE['h3'])); $user_info_array = GetMainUserInfo::GetInfo($regId); if ($user_info_array['is_admin'] == 1) { $article_name = $_POST['article_name']; $article_short_contents = $_POST['article_short_contents']; $article_contents = $_POST['article_contents']; $article_author = $user_info_array['reg_name'] . ' ' . $user_info_array['reg_surname']; $article_picture_array = explode('/', $_FILES['article_picture']['type']); $article_picture_type = array_pop($article_picture_array); $last_article_id = Article::getLastArticleId(); $new_picture_name = $last_article_id['article_id'] + 1; copy($_FILES['article_picture']['tmp_name'], ROOT . '/uploads/articles/' . $new_picture_name . '.' . $article_picture_type); // копируем временный файл в аплоад папку (до окончания работы скрипта) $article_picture = '/uploads/articles/' . $new_picture_name . '.' . $article_picture_type; Article::createArticle($article_name, $article_short_contents, $article_contents, $article_picture, $article_author); unset($_POST['article_name'], $_POST['article_short_contents'], $_POST['article_contents']); $all_articles = Article::getList(); $articlesCount = count($all_articles); $get_id = ceil($articlesCount / 4); header('Location: /articles-navigation/1'); // перенаправление на страниу с только что добавленной статьей } else { header('Location: /articles-navigation/1'); } } else { header('Location: /articles-navigation/1'); }