private function getSeo() { $ReadSeo = new WsPosts(); switch ($this->File) { case 'artigo': $Admin = isset($_SESSION['userlogin']['user_level']) && $_SESSION['userlogin']['user_level'] == 3 ? true : false; $Check = $Admin ? '' : 'post_status = 1 AND '; $ReadSeo->setPost_name($this->Link); $ReadSeo->Query("WHERE {$Check} #post_name#"); if (!$ReadSeo->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->getResult()[0]); $this->seoData = (array) $ReadSeo->getResult()[0]; $this->Data = [$post_title . ' - ' . SITENAME, $post_content, HOME . "/artigo/{$post_name}", HOME . "/uploads/{$post_cover}"]; //post:: post_views $ReadSeo->setPost_id($post_id); $ReadSeo->setPost_views($post_views + 1); $ReadSeo->setPost_last_views(date('Y-m-d H:i:s')); $ReadSeo->update(); } break; case 'index': $this->Data = [SITENAME . ' - Seu Guia de empresas, eventos e baladas!', SITEDESC, HOME, INCLUDE_PATH . '/images/site.png']; break; default: $this->Data = ['404 Oppss, Nada encontrado!', SITEDESC, HOME . '/404', INCLUDE_PATH . '/images/site.png']; break; } if ($this->Data) { $this->setTags(); } }
$post['post_status'] = $post['SendPostForm'] == 'Atualizar' ? '0' : '1'; $post['post_cover'] = $_FILES['post_cover']['tmp_name'] ? $_FILES['post_cover'] : 'null'; unset($post['SendPostForm']); require_once '_models/AdminPost.class.php'; $cadastra = new AdminPost(); $cadastra->ExeUpdate($postid, $post); WSErro($cadastra->getError()[0], $cadastra->getError()[1]); if (!empty($_FILES['gallery_covers']['tmp_name'])) { $sendGallery = new AdminPost(); $sendGallery->gbSend($_FILES['gallery_covers'], $postid); } } else { $WsPosts = new WsPosts(); $WsPosts->setPost_id($postid); $WsPosts->find(); if (!$WsPosts->getResult()) { header('Location: painel.php?exe=post/index&empty=true'); } else { $post = (array) $WsPosts->getResult(); $post['post_date'] = date('d/m/Y H:i:s', strtotime($post['post_date'])); } } if (!empty($_SESSION['errCapa'])) { WSErro($_SESSION['errCapa'], E_USER_WARNING); unset($_SESSION['errCapa']); } $checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN); if ($checkCreate && empty($cadastra)) { WSErro("O post <b>{$post['post_title']}</b> foi cadastrado com sucesso no sistema!", WS_ACCEPT); } ?>
private function checkPosts() { $readPosts = new WsPosts(); $readPosts->setPost_category($this->CatId); $readPosts->Query("WHERE #post_category#"); if (isset($readPosts->getResult()[0])) { return false; } else { return true; } }
private function setName() { $Where = isset($this->Post) ? "post_id != {$this->Post} AND " : ""; $WsPosts = new WsPosts(); $WsPosts->setPost_title($this->Data['post_title']); $WsPosts->Query("WHERE {$Where} #post_title#"); if ($WsPosts->getResult()) { $this->Data['post_name'] = $this->Data['post_name'] . '-' . $WsPosts->getRowCount(); } }