Skip to content

Commit

Permalink
cleaning code
Browse files Browse the repository at this point in the history
  • Loading branch information
cotaoctavian committed Jun 12, 2019
1 parent 2d94a40 commit 4ee10c2
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 517 deletions.
480 changes: 0 additions & 480 deletions bacovia-plumb.html

This file was deleted.

9 changes: 6 additions & 3 deletions controllers/AboutUsController.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

class AboutUs extends Controller{
class AboutUs extends Controller
{

function __construct(){
function __construct()
{
$this->view = new View();
}

function index(){
function index()
{
$this->view->render('about/index');
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function __construct()
}
function index()
{
$this->view->rssData=$this->model->rssTable();
$this->model->rssTable();
$this->view->render('dashboard/index');
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function __construct(){
}

function index(){
$this->view->rssData=$this->model->rssTable();
$this->model->rssTable();
$this->view->render('index/index');
}

Expand Down
55 changes: 30 additions & 25 deletions controllers/PoemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function poezie($author_id, $title, $language)
$this->view->language = $language;
Session::init();
$logged = Session::get('loggedIn');
if($logged) {
if ($logged) {
$this->view->userInfo = $this->model->userInfo(Session::get('id'));
$this->view->rateData = $this->model->rateInfo(Session::get('id'));
}
Expand All @@ -44,71 +44,76 @@ function poezie($author_id, $title, $language)
$this->view->render('poem/index');
}

function verseAnnotation($author_id, $title, $language, $verse_id){
function verseAnnotation($author_id, $title, $language, $verse_id)
{
Session::init();
$logged = Session::get('loggedIn');
if(isset($_POST['annotation']) && !empty($_POST['annotation']) && !ctype_space($_POST['annotation'])){
if($logged){
if (isset($_POST['annotation']) && !empty($_POST['annotation']) && !ctype_space($_POST['annotation'])) {
if ($logged) {
$this->model->addAnnotation($_POST['annotation'], Session::get('id'), $author_id, $title, $language, $verse_id);
}
else {
} else {
return 0;
}
}else return 0;
} else return 0;
}

function verseComments($author_id, $title, $language, $verse_id){
function verseComments($author_id, $title, $language, $verse_id)
{
Session::init();
$logged = Session::get('loggedIn');
if(isset($_POST['comm']) && !empty($_POST['comm']) && !ctype_space($_POST['comm'])){
if($logged){
if (isset($_POST['comm']) && !empty($_POST['comm']) && !ctype_space($_POST['comm'])) {
if ($logged) {
$this->model->addComment($_POST['comm'], Session::get('id'), $author_id, $title, $language, $verse_id);
}
else {
} else {
return 0;
}
}else return 0;
} else return 0;
}

function verseRating($author_id, $title, $language, $verse_id){
function verseRating($author_id, $title, $language, $verse_id)
{
Session::init();
$logged = Session::get('loggedIn');
if(isset($_POST['rating'])){
if($logged){
if (isset($_POST['rating'])) {
if ($logged) {
$this->model->addRating($_POST['rating'], $author_id, $title, $language, $verse_id, Session::get('id'));
}
else{
} else {
return 0;
}
} else return 0;
}

function addTranslation($author_id, $title, $language, $poem_id, $no_verse){
function addTranslation($author_id, $title, $language, $poem_id, $no_verse)
{
Session::init();
if(isset($_POST['translate']) && !empty($_POST['translate']) && !ctype_space($_POST['translate']) ){
if (isset($_POST['translate']) && !empty($_POST['translate']) && !ctype_space($_POST['translate'])) {
$this->model->addTranslation($author_id, $title, $language, $poem_id, $no_verse, Session::get('id'), $_POST['translate']);
}
}

function deleteTranslation($author_id, $title, $language, $poem_id){
function deleteTranslation($author_id, $title, $language, $poem_id)
{
$this->model->deleteTranslation($author_id, $title, $language, $poem_id);
}

function deleteVerseComment($author_id, $title, $language, $comm_id){
function deleteVerseComment($author_id, $title, $language, $comm_id)
{
$this->model->deleteVerseComment($author_id, $title, $language, $comm_id);
}

function deleteVerseAnnotation($author_id, $title, $language, $adn_id){
function deleteVerseAnnotation($author_id, $title, $language, $adn_id)
{
$this->model->deleteVerseAnnotation($author_id, $title, $language, $adn_id);
}

function deleteComm($author_id, $title, $language, $comm_id){
function deleteComm($author_id, $title, $language, $comm_id)
{
$this->model->deleteComment($author_id, $title, $language, $comm_id);
}

function share($author_id, $title, $language, $verse_id)
{
$this->model->share($author_id, $title, $language, $verse_id);
$this->model->share($author_id, $title, $language, $verse_id);
}
}

1 change: 1 addition & 0 deletions controllers/ScholarlyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function __construct()
{
$this->view = new View();
}

function index()
{
$this->view->render('scholarly/index');
Expand Down
1 change: 0 additions & 1 deletion libs/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class View {
public $commentaries;
public $poemInfo;
public $rateData;
public $rssData;

public function render($name){
require 'views/' . $name . '.php';
Expand Down
11 changes: 5 additions & 6 deletions models/index_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public function rssTable(){
$row = $dom->createElement('row');
$row = $root->appendChild($row);
$element = $dom->createElement('titlu', $data['titlu']);
$element = $row->appendChild($element);
$row->appendChild($element);
$element4 = $dom->createElement('utilizator', $data['utiliz']);
$element4 = $row->appendChild($element4);
$row->appendChild($element4);
$element2 = $dom->createElement('nume', $data['nume']);
$element2 = $row->appendChild($element2);
$row->appendChild($element2);
$timestamp = time();
$date_a = strtotime($data['data_adaugarii']);
$date_b = strtotime(date("F d Y h:i:s", $timestamp));
Expand All @@ -39,11 +39,10 @@ public function rssTable(){
$hours = floor(($result - ($days * 86400)) / 3600);
$hrs= floor(abs($result / 3600) / 60);
$minutes = floor(($result - ($days * 86400) - ($hours * 3600))/60);
$seconds = floor(($result - ($days * 86400) - ($hours * 3600) - ($minutes*60)));
$element3 = $dom->createElement('data', $days . ' days ' . $hrs . ' hours ' . $minutes . ' minutes ');
$element3 = $row->appendChild($element3);
$row->appendChild($element3);
$element1 = $dom->createElement('vizualizari', $data['vizualizari']);
$element1 = $row->appendChild($element1);
$row->appendChild($element1);
$cnt++;
}
else break;
Expand Down

0 comments on commit 4ee10c2

Please sign in to comment.