Browse Source

Use a namespace

master
Léo Serre 1 year ago
parent
commit
2733e99c7f
10 changed files with 34 additions and 26 deletions
  1. +13
    -13
      controllers/d.blog.php
  2. +7
    -7
      controllers/d.users.php
  3. +3
    -3
      controllers/d.wiki.php
  4. +1
    -1
      includes/config.example.php
  5. +1
    -1
      includes/routes.php
  6. +1
    -1
      includes/session.php
  7. +2
    -0
      models/d.blog.php
  8. +2
    -0
      models/d.locales.php
  9. +2
    -0
      models/d.users.php
  10. +2
    -0
      models/d.wiki.php

+ 13
- 13
controllers/d.blog.php View File

@@ -5,7 +5,7 @@ require_once($config['models_folder']."d.users.php");

$head['css'] = "d.index.css;d.blog.css";

$blogArticle = new BlogArticle();
$blogArticle = new Kabano\BlogArticle();

// In case we are in the list of articles, we set url to switch with according parameters
if (!isset($controller->splitted_url[1]) OR $controller->splitted_url[1]=="" OR is_numeric($controller->splitted_url[1])) {
@@ -29,7 +29,7 @@ switch ($controller->splitted_url[1]) {
$list = "rss";
$articles_per_pages = 20;
case "list":
$blogArticles = new BlogArticles();
$blogArticles = new Kabano\BlogArticles();

$blogArticles->number(($user->role >= 600));

@@ -42,11 +42,11 @@ switch ($controller->splitted_url[1]) {
$i = 0;
$blogArticles_list = array();
foreach ($blogArticles->ids as $row) {
$blogArticles_list[$i] = new BlogArticle();
$blogArticles_list[$i] = new Kabano\BlogArticle();
$blogArticles_list[$i]->id = $row;
$blogArticles_list[$i]->populate();
$blogArticles_list[$i]->md2txt();
$tempUser = new User();
$tempUser = new Kabano\User();
$tempUser->id = $blogArticles_list[$i]->author;
$tempUser->populate();
$blogArticles_list[$i]->author_name = $tempUser->name;
@@ -115,12 +115,12 @@ switch ($controller->splitted_url[1]) {
else {
// Manage history of an article
if($user->role >= 600) {
$blogArticles_history = new BlogArticles();
$blogArticles_history = new Kabano\BlogArticles();
$blogArticles_history->getHistory($controller->splitted_url[1]);

$i = 0;
foreach ($blogArticles_history->ids as $row) {
$blogArticles_history_list[$i] = new BlogArticle();
$blogArticles_history_list[$i] = new Kabano\BlogArticle();
$blogArticles_history_list[$i]->id = $row;
$blogArticles_history_list[$i]->populate();
$i++;
@@ -132,7 +132,7 @@ switch ($controller->splitted_url[1]) {
// Manage comment creation
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="new_comment") {
if (isset($_POST['submit']) && $user->role > 0) {
$blogComment = new BlogComment();
$blogComment = new Kabano\BlogComment();
$blogComment->locale = $user->locale;
$blogComment->author = $user->id;
$blogComment->article = $blogArticle->id;
@@ -144,7 +144,7 @@ switch ($controller->splitted_url[1]) {
// Manage comment deletion
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="delete_comment") {
if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
$blogComment = new BlogComment();
$blogComment = new Kabano\BlogComment();
$blogComment->id = $controller->splitted_url[3];
$blogComment->populate();
if ($user->role >= 800 || $user->id == $blogComment->author)
@@ -155,7 +155,7 @@ switch ($controller->splitted_url[1]) {
// Manage comment undeletion
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="undelete_comment") {
if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
$blogComment = new BlogComment();
$blogComment = new Kabano\BlogComment();
$blogComment->id = $controller->splitted_url[3];
$blogComment->populate();
if ($user->role >= 800 || $user->id == $blogComment->author)
@@ -168,16 +168,16 @@ switch ($controller->splitted_url[1]) {

// Manage comments
if ($blogArticle->comments == "t") {
$blogArticles_comments = new BlogComments();
$blogArticles_comments = new Kabano\BlogComments();
$blogArticles_comments->listComments($blogArticle->id, ($user->role>400));

$i = 0;
foreach ($blogArticles_comments->ids as $row) {
$blogArticles_comments_list[$i] = new BlogComment();
$blogArticles_comments_list[$i] = new Kabano\BlogComment();
$blogArticles_comments_list[$i]->id = $row;
$blogArticles_comments_list[$i]->populate();
$blogArticles_comments_list[$i]->md2html();
$blogArticles_comments_list[$i]->author_obj = new User();
$blogArticles_comments_list[$i]->author_obj = new Kabano\User();
$blogArticles_comments_list[$i]->author_obj->id = $blogArticles_comments_list[$i]->author;
$blogArticles_comments_list[$i]->author_obj->populate();
$i++;
@@ -185,7 +185,7 @@ switch ($controller->splitted_url[1]) {
}


$tempUser = new User();
$tempUser = new Kabano\User();
$tempUser->id = $blogArticle->author;
$tempUser->populate();
$blogArticle->author_name = $tempUser->name;

+ 7
- 7
controllers/d.users.php View File

@@ -11,7 +11,7 @@ if(isset($controller->splitted_url[1])) {
if ($user->rank == "visitor") {
if (isset($_POST['submit'])) {
// PROCESS DATA FROM FORM
$user = new User();
$user = new Kabano\User();

if($user->login($_POST['login'], $_POST['password'])) {
// SUCESSFULL LOGIN
@@ -37,7 +37,7 @@ if(isset($controller->splitted_url[1])) {
if ($user->rank == "visitor") {
if (isset($_POST['submit'])) {
// PROCESS DATA FROM FORM
$user = new User();
$user = new Kabano\User();
$user->name = $_POST['login'];
$user->email = strtolower($_POST['email']);
$user->rank = "registered";
@@ -75,7 +75,7 @@ if(isset($controller->splitted_url[1])) {
if ($user->rank == "visitor") {
if (isset($_POST['submit'])) {
// PROCESS DATA FROM FORM
$user = new User();
$user = new Kabano\User();
$user->email = strtolower($_POST['email']);

if($user->availableMail()) {
@@ -93,7 +93,7 @@ if(isset($controller->splitted_url[1])) {
break;
case 'p':
if ($user->rankIsHigher("registered")) {
$userProfile = new User();
$userProfile = new Kabano\User();
if (!isset($controller->splitted_url[2]) OR $controller->splitted_url[2]=="") {
// WE DISPLAY THE CONNECTED USER PROFILE
$userProfile = $user;
@@ -108,11 +108,11 @@ if(isset($controller->splitted_url[1])) {

// If we are editing the profile
if(isset($controller->splitted_url[3]) && $controller->splitted_url[3]=="edit" && ($user->rankIsHigher("moderator") || $user->id == $userProfile->id)) {
$locales = new Locales;
$locales = new Kabano\Locales();
$locales->getAll();
$head['js'] = "d.avatar.js";
if (isset($_POST['submit'])) {
$receivedUser = new User();
$receivedUser = new Kabano\User();
$receivedUser->name = $_POST['name'];
if($receivedUser->name != $userProfile->name && $receivedUser->availableName())
$userProfile->name = $receivedUser->name;
@@ -187,7 +187,7 @@ if(isset($controller->splitted_url[1])) {
}
$head['title'] = "Liste des membres";

$users = new Users();
$users = new Kabano\Users();
$users->number();

// In case the wanted page is too big

+ 3
- 3
controllers/d.wiki.php View File

@@ -4,7 +4,7 @@ require_once($config['models_folder']."d.wiki.php");

$head['css'] = "d.index.css;d.wiki.css";

$wikiPage = new WikiPage();
$wikiPage = new Kabano\WikiPage();
// Page doesn't exists
if(isset($controller->splitted_url[1]) && !$wikiPage->checkUrl($controller->splitted_url[1],$user->rankIsHigher('premium')) && $controller->splitted_url[1]!="") {
if($user->rankIsHigher('moderator')) {
@@ -50,12 +50,12 @@ else if(isset($controller->splitted_url[1]) && $wikiPage->checkUrl($controller->
} else {
// Display page
if($user->rankIsHigher('premium')) {
$wikiHistory = new WikiPages();
$wikiHistory = new Kabano\WikiPages();
$wikiHistory->getHistory($controller->splitted_url[1]);

$i = 0;
foreach ($wikiHistory->ids as $row) {
$wikiHistory_list[$i] = new WikiPage();
$wikiHistory_list[$i] = new Kabano\WikiPage();
$wikiHistory_list[$i]->id = $row;
$wikiHistory_list[$i]->populate();
$i++;

+ 1
- 1
includes/config.example.php View File

@@ -1,4 +1,4 @@
<?
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

+ 1
- 1
includes/routes.php View File

@@ -59,7 +59,7 @@ if($view->name != "") {
if($notfound) {
require_once('session.php');
require_once($config['models_folder']."d.wiki.php");
$wikiPage = new WikiPage();
$wikiPage = new Kabano\WikiPage();
$wikiPage->checkUrl('404');
$wikiPage->md2html();
$head['css'] = "d.index.css;d.wiki.css";

+ 1
- 1
includes/session.php View File

@@ -5,7 +5,7 @@ require_once($config['models_folder']."d.users.php");
ini_set("session.cookie_lifetime",60*60*24*30);
session_start();

$user = new User();
$user = new Kabano\User();
$user->rank = "visitor"; // All users are visitors

if(isset($_SESSION['userid'])) {

+ 2
- 0
models/d.blog.php View File

@@ -1,5 +1,7 @@
<?

namespace Kabano;

/**********************************************************
***********************************************************
**

+ 2
- 0
models/d.locales.php View File

@@ -1,5 +1,7 @@
<?

namespace Kabano;

/**********************************************************
***********************************************************
**

+ 2
- 0
models/d.users.php View File

@@ -1,5 +1,7 @@
<?

namespace Kabano;

/**********************************************************
***********************************************************
**

+ 2
- 0
models/d.wiki.php View File

@@ -1,5 +1,7 @@
<?

namespace Kabano;

/**********************************************************
***********************************************************
**

Loading…
Cancel
Save