Skip to content

Commit 541e005

Browse files
OpenSOurce_Blog
1 parent 8bc3895 commit 541e005

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+11858
-0
lines changed

Blog-COS-V.0.0/How to run.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--------------------------
2+
| Script Code@OpenSource |
3+
--------------------------
4+
5+
Technology used :
6+
____________________________
7+
8+
HTML + CSS + MATERIALIZE.CSS
9+
JQUEY MATERIALIZE.JS
10+
PHP + MYSQL
11+
____________________________
12+
13+
14+
1.having a mysql and php server installed
15+
2.copy the files and import the database
16+
3.changing the name of the databse at this page functions/main-functions.php line7 $dbname = 'CodeOpenSource';
17+
4.this website use online icons Materialize.
18+
19+
Admin panel
20+
21+
1.admin/ eg:http://127.0.0.1:8080/Code@open%20Source/admin/
22+
2. default user => email : code@opensource and password : opensource boom !! you have logged in
23+
3.when creating a new moderator we are sending an email which as the unique code(token) to the email provided
24+
the email contain : his/her email + token + the link for activating his/her accounts.
25+
4.All new moderator must use use those informations for the first login in order to secure their account by creating a password for it.
26+
5.make sure you have an email service on your server
27+
6 this part can be modify at this page admin/functions/settings.func.php
28+
29+
Any question ? ask on our facebook group Code@OpenSource !
30+
31+
Code@OpenSource!

Blog-COS-V.0.0/LICENCE 2.txt

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* The Code@OpenSource licenses
3+
*
4+
* Copyright (c) 2018 Code@OpenSource authors
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/

Blog-COS-V.0.0/admin/.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Blog-COS-V.0.0/admin/.idea/admin.iml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Blog-COS-V.0.0/admin/.idea/encodings.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Blog-COS-V.0.0/admin/.idea/misc.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Blog-COS-V.0.0/admin/.idea/modules.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Blog-COS-V.0.0/admin/.idea/scopes/scope_settings.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Blog-COS-V.0.0/admin/.idea/vcs.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Blog-COS-V.0.0/admin/.idea/workspace.xml

+638
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
require "../../functions/main-functions.php";
3+
$db->exec("DELETE FROM comments WHERE id = {$_POST['id']}");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
require "../../functions/main-functions.php";
4+
5+
$db->exec("UPDATE comments SET seen='1' WHERE id='{$_POST['id']}'");

Blog-COS-V.0.0/admin/body/topbar.php

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<nav class="black">
2+
<div class="container">
3+
<div class="nav-wrapper">
4+
<a href="index.php?page=home" class="brand-logo">Code@Open Source</a>
5+
<?php
6+
if($page != 'login' && $page != 'new' && $page != 'password'){
7+
?>
8+
<a href="#" data-activates="mobile-menu" class="button-collapse">Menu</a>
9+
10+
<ul class="right hide-on-med-and-down">
11+
<li class="<?php echo ($page=="dashboard")?"active" : ""; ?>"><a href="index.php?page=dashboard"><i class="material-icons">home</i></a></li>
12+
<?php
13+
14+
if(admin()==1){
15+
?>
16+
<li class="<?php echo ($page=="write")?"active" : ""; ?>"><a href="index.php?page=write"><i class="material-icons">mode_edit</i></a></li>
17+
<li class="<?php echo ($page=="list")?"active" : ""; ?>"><a href="index.php?page=list"><i class="material-icons">list</i></a></li>
18+
<li class="<?php echo ($page=="settings")?"active" : ""; ?>"><a href="index.php?page=settings"><i class="material-icons">settings</i></a></li>
19+
20+
<?php
21+
}
22+
23+
?>
24+
<li><a href="../index.php?page=home"><i class="material-icons">public</i></a></li>
25+
<li><a href="index.php?page=logout"><i class="material-icons">settings_power</i></a></li>
26+
</ul>
27+
28+
<ul class="side-nav" id="mobile-menu">
29+
<li class="<?php echo ($page=="dashboard")?"active" : ""; ?>"><a href="index.php?page=dashboard">Tableau de bord</a></li>
30+
<?php
31+
if(admin()==1){
32+
?>
33+
<li class="<?php echo ($page=="write")?"active" : ""; ?>"><a href="index.php?page=write">Publier un article</a></li>
34+
<li class="<?php echo ($page=="list")?"active" : ""; ?>"><a href="index.php?page=list">Listing des articles</a></li>
35+
<li class="<?php echo ($page=="settings")?"active" : ""; ?>"><a href="index.php?page=settings">Paramètres</a></li>
36+
<?php
37+
}
38+
39+
?>
40+
<li><a href="../index.php?page=home">Home</a></li>
41+
<li><a href="index.php?page=logout">Log out</a></li>
42+
43+
</ul>
44+
<?php
45+
}
46+
?>
47+
</div>
48+
</div>
49+
</nav>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
function inTable($table){
4+
global $db;
5+
$query = $db->query("SELECT COUNT(id) FROM $table");
6+
return $nombre = $query->fetch();
7+
}
8+
9+
function getColor($table,$colors){
10+
if(isset($colors[$table])){
11+
return $colors[$table];
12+
}else{
13+
return "orange";
14+
}
15+
}
16+
17+
function get_comments(){
18+
global $db;
19+
20+
$req = $db->query(
21+
"SELECT comments.id,
22+
comments.name,
23+
comments.email,
24+
comments.date,
25+
comments.post_id,
26+
comments.comment,
27+
posts.title
28+
FROM comments
29+
JOIN posts
30+
ON comments.post_id = posts.id
31+
WHERE comments.seen = '0'
32+
ORDER BY comments.date ASC
33+
");
34+
35+
$results = array();
36+
while($rows = $req->fetchObject()){
37+
$results[] = $rows;
38+
}
39+
return $results;
40+
}
41+
42+
function get_user(){
43+
global $db;
44+
45+
$req = $db->query("
46+
SELECT * FROM admins WHERE email='{$_SESSION['admin']}';
47+
");
48+
49+
$result = $req->fetchObject();
50+
return $result;
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
function get_posts(){
4+
5+
global $db;
6+
7+
$req = $db->query("SELECT * FROM posts ORDER BY date DESC");
8+
9+
$results = array();
10+
while($rows = $req->fetchObject()){
11+
$results[] = $rows;
12+
}
13+
14+
return $results;
15+
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
4+
function is_admin($email,$password)
5+
{
6+
global $db;
7+
$a = array(
8+
'email' => $email,
9+
'password' => sha1($password)
10+
);
11+
$sql = "SELECT * FROM admins WHERE email = :email AND password = :password";
12+
$req = $db->prepare($sql);
13+
$req->execute($a);
14+
$exist = $req->rowCount($sql);
15+
return $exist;
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
function is_modo($email,$token){
4+
global $db;
5+
6+
$a = array(
7+
'email' => $email,
8+
'token' => $token
9+
);
10+
$sql = "SELECT * FROM admins WHERE email=:email AND token=:token";
11+
$req= $db->prepare($sql);
12+
$req->execute($a);
13+
return $req->rowCount($sql);
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
function update_password($password){
4+
global $db;
5+
$p = array(
6+
'password' => sha1($password),
7+
'session' => $_SESSION['admin']
8+
);
9+
10+
$sql = "UPDATE admins SET password = :password WHERE email=:session";
11+
$req = $db->prepare($sql);
12+
$req->execute($p);
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
function get_post(){
4+
5+
global $db;
6+
7+
$req = $db->query(
8+
" SELECT posts.id,
9+
posts.title,
10+
posts.image,
11+
posts.date,
12+
posts.content,
13+
posts.posted,
14+
admins.name
15+
FROM posts
16+
JOIN admins
17+
ON posts.writer = admins.email
18+
WHERE posts.id = '{$_GET['id']}'
19+
");
20+
21+
$result = $req->fetchObject();
22+
return $result;
23+
}
24+
25+
function edit($title,$content,$posted,$id){
26+
27+
global $db;
28+
29+
$e = array(
30+
'title' => $title,
31+
'content' => $content,
32+
'posted' => $posted,
33+
'id' => $id
34+
);
35+
36+
$sql = "UPDATE posts SET title=:title, content=:content, date=NOW(), posted=:posted WHERE id=:id";
37+
$req = $db->prepare($sql);
38+
$req->execute($e);
39+
40+
}

0 commit comments

Comments
 (0)