';
+ echo '
'.$Language->p('Enable more features at').''.$Language->p('settings-advanced-writting-settings').'
';
+ echo '
-
Publish now
-
Draft
+
p('Publish now') ?>
+
p('Draft') ?>
@@ -58,18 +58,18 @@
$(document).ready(function()
{
- $("#jsTitle").keyup(function() {
+ $("#jstitle").keyup(function() {
var slug = $(this).val();
- checkSlugPost(slug, "", $("#jsSlug"));
+ checkSlugPost(slug, "", $("#jsslug"));
});
- $("#jsSlug").keyup(function() {
- var slug = $("#jsSlug").val();
+ $("#jsslug").keyup(function() {
+ var slug = $("#jsslug").val();
- checkSlugPost(slug, "", $("#jsSlug"));
+ checkSlugPost(slug, "", $("#jsslug"));
});
});
-
+
\ No newline at end of file
diff --git a/admin/views/plugins.php b/admin/views/plugins.php
index 7b0a5f47..5d29d6a5 100644
--- a/admin/views/plugins.php
+++ b/admin/views/plugins.php
@@ -5,7 +5,7 @@
{
echo '
';
- echo '
'.$Plugin->title().'
';
+ echo '
'.$Plugin->name().'
';
echo '
'.$Plugin->description().'
';
if($Plugin->installed()) {
@@ -17,4 +17,4 @@
echo '
';
}
-?>
\ No newline at end of file
+?>
diff --git a/admin/views/settings.php b/admin/views/settings.php
index cacdaa14..5f8af6f5 100644
--- a/admin/views/settings.php
+++ b/admin/views/settings.php
@@ -109,9 +109,9 @@
+
diff --git a/admin/views/users.php b/admin/views/users.php
index ee9a20c8..ec95f00f 100644
--- a/admin/views/users.php
+++ b/admin/views/users.php
@@ -29,4 +29,4 @@
}
?>
-
\ No newline at end of file
+
diff --git a/features.txt b/features.txt
index e15bf8c9..36f8da9c 100644
--- a/features.txt
+++ b/features.txt
@@ -2,37 +2,30 @@ Diego Najar
—————————
-Implementar
-- Links a Google+, Facebook y Twitter
-- Plugins
-- Plugins SEO, description, opengraph, etc..
-- Comentarios
-- Notificaciones
-- iPhone app
+ToDO
+- Social links: Google+, Facebook y Twitter
+- Plugins: Edit databases from Dashboard
+- Plugins: SEO, Tinymce,
+- Comments system
+- Notifications system
- Cloud
+- Users: delete user
+- Implement User class
+- Themes
+- Plugins multilangueage
+
+Check:
- ver casos de errores, filtros url iguales, con una /
-- No permitir en filtros url iguales, agregar / al comienzo y final
+- No permitir en filtros url iguales
- Usuarios de lectura ?, no vale la pena, y hay que hacer mas controles a nivel de administracion.
- Implementar algun limpiador**
—————————
**LIMPIADOR
- Recorrer directorios content/posts/, Si el post no tiene el archivo index.txt quiere decir que ese directorio no debe existir y debe ser eliminado
-
—————————
-
-Habilitar rewriterules en el server, httpd.conf
-
-
-AllowOverride All
-
-————
-
-find . -type f -name "*.php" -print0 | xargs -0 sed -i 's/Text/helperText/g'
-find . -type f -name "*.php" -print0 | xargs -0 sed -i 's/Url/helperUrl/g'
-
find . -type f -name '*.php' -exec sed -i '' s/helperText/Text/ {} +
-————
+—————————
Editar una pagina
1- Usuario logueado
diff --git a/kernel/abstract/dbjson.class.php b/kernel/abstract/dbjson.class.php
index c6fdba19..75a46206 100644
--- a/kernel/abstract/dbjson.class.php
+++ b/kernel/abstract/dbjson.class.php
@@ -6,6 +6,7 @@ class dbJSON
public $file;
public $firstLine;
+ // $firstLine, TRUE if you want to remove the first line.
function __construct($file, $firstLine=true)
{
$this->file = $file;
@@ -75,6 +76,11 @@ class dbJSON
return $this->save();
}
+ public function getDb()
+ {
+ return $this->db;
+ }
+
// DEBUG, se puede borrar
public function show()
{
diff --git a/kernel/abstract/plugin.class.php b/kernel/abstract/plugin.class.php
index 9743c91a..7496c02e 100644
--- a/kernel/abstract/plugin.class.php
+++ b/kernel/abstract/plugin.class.php
@@ -16,12 +16,22 @@ class Plugin {
public $className;
+ public $data;
+
function __construct()
{
$reflector = new ReflectionClass(get_class($this));
+ $this->data = array(
+ 'name'=>'',
+ 'description'=>'',
+ 'author'=>'',
+ 'email'=>'',
+ 'website'=>''
+ );
+
// Directory name
- $this->directoryName = basename(dirname($reflector->getFileName()));
+ $this->directoryName = basename(dirname($reflector->getFileName())).DS;
// Class Name
$this->className = $reflector->getName();
@@ -32,7 +42,7 @@ class Plugin {
// Init empty database
$this->db = $this->dbFields;
- $this->fileDb = PATH_PLUGINS_DATABASES.$this->directoryName.'/db.php';
+ $this->fileDb = PATH_PLUGINS_DATABASES.$this->directoryName.'db.php';
// If the plugin installed then get the database.
if($this->installed())
@@ -42,22 +52,43 @@ class Plugin {
}
}
- public function title()
+ public function getData($key)
{
- if(isset($this->db['title'])) {
- return $this->db['title'];
+ if(isset($this->data[$key])) {
+ return $this->data[$key];
}
- return '';
+ return '';
+ }
+
+ public function setData($array)
+ {
+ $this->data = $array;
+ }
+
+ public function name()
+ {
+ return $this->getData('name');
}
public function description()
{
- if(isset($this->db['description'])) {
- return $this->db['description'];
- }
+ return $this->getData('description');
+ }
- return '';
+ public function author()
+ {
+ return $this->getData('author');
+ }
+
+ public function email()
+ {
+ return $this->getData('email');
+ }
+
+ public function website()
+ {
+ return $this->getData('website');
}
public function className()
@@ -65,6 +96,11 @@ class Plugin {
return $this->className;
}
+ public function directoryName()
+ {
+ return $this->directoryName;
+ }
+
// Return TRUE if the installation success, otherwise FALSE.
public function install()
{
diff --git a/kernel/boot/admin.php b/kernel/boot/admin.php
index 243217a4..ca65f8fb 100644
--- a/kernel/boot/admin.php
+++ b/kernel/boot/admin.php
@@ -37,9 +37,9 @@ if( $Login->isLogged() && ($layout['slug']==='ajax') )
else
{
// Boot rules
- include(PATH_RULES.'60.plugins.php');
include(PATH_RULES.'70.build_posts.php');
include(PATH_RULES.'70.build_pages.php');
+ include(PATH_RULES.'80.plugins.php');
include(PATH_RULES.'99.header.php');
if($Url->notFound() || !$Login->isLogged() || ($Url->slug()==='login') )
diff --git a/kernel/boot/rules/70.build_pages.php b/kernel/boot/rules/70.build_pages.php
index 273552ba..15ce24e2 100644
--- a/kernel/boot/rules/70.build_pages.php
+++ b/kernel/boot/rules/70.build_pages.php
@@ -142,9 +142,6 @@ function build_all_pages()
// Main
// ============================================================================
-// Plugins before load pages
-Theme::plugins('beforePagesLoad');
-
// Filter by page, then build it
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
{
@@ -186,6 +183,3 @@ if($Url->notFound())
// Build all pages
build_all_pages();
-
-// Plugins after load pages
-Theme::plugins('afterPagesLoad');
\ No newline at end of file
diff --git a/kernel/boot/rules/70.build_posts.php b/kernel/boot/rules/70.build_posts.php
index b57e99b9..2072a47a 100644
--- a/kernel/boot/rules/70.build_posts.php
+++ b/kernel/boot/rules/70.build_posts.php
@@ -92,9 +92,6 @@ function build_posts_per_page($pageNumber=0, $amount=5, $draftPosts=false)
// Main
// ============================================================================
-// Plugins before load posts
-Theme::plugins('beforePostsLoad');
-
// Filter by post, then build it
if( ($Url->whereAmI()==='post') && ($Url->notFound()===false) )
{
@@ -129,6 +126,3 @@ else
build_posts_per_page($Url->pageNumber(), $Site->postsPerPage(), false);
}
}
-
-// Plugins after load posts
-Theme::plugins('afterPostsLoad');
\ No newline at end of file
diff --git a/kernel/boot/rules/60.plugins.php b/kernel/boot/rules/80.plugins.php
similarity index 72%
rename from kernel/boot/rules/60.plugins.php
rename to kernel/boot/rules/80.plugins.php
index f15cff1f..196fa1ca 100644
--- a/kernel/boot/rules/60.plugins.php
+++ b/kernel/boot/rules/80.plugins.php
@@ -29,6 +29,8 @@ function build_plugins()
{
global $plugins;
global $pluginsEvents;
+ global $Language;
+ global $Site;
// List plugins directories
$list = Filesystem::listDirectories(PATH_PLUGINS);
@@ -38,7 +40,7 @@ function build_plugins()
// Load each plugin clasess
foreach($list as $pluginPath) {
- include($pluginPath.'/plugin.php');
+ include($pluginPath.DS.'plugin.php');
}
// Get plugins clasess loaded
@@ -48,10 +50,28 @@ function build_plugins()
{
$Plugin = new $pluginClass;
- // All plugins installed and not installed.
+ // Set Plugin data
+ $languageFilename = PATH_PLUGINS.$Plugin->directoryName().'language'.DS.$Site->locale().'.json';
+ if( Sanitize::pathFile($languageFilename) )
+ {
+ $data = new dbJSON($languageFilename, false);
+ }
+ else
+ {
+ $languageFilename = PATH_PLUGINS.$Plugin->directoryName().'language'.DS.'en_US.json';
+ $data = new dbJSON($languageFilename, false);
+ }
+ $data = $data->getDb();
+ $Plugin->setData( $data['plugin-data'] );
+
+ // Add words to language dictionary.
+ unset($data['plugin-data']);
+ $Language->add($data);
+
+ // Push Plugin to array all plugins installed and not installed.
array_push($plugins['all'], $Plugin);
- // If the plugin installed, then add the plugin on the arrays.
+ // If the plugin installed
if($Plugin->installed())
{
foreach($pluginsEvents as $event=>$value)
diff --git a/kernel/boot/site.php b/kernel/boot/site.php
index 6373b374..d4d18c12 100644
--- a/kernel/boot/site.php
+++ b/kernel/boot/site.php
@@ -1,9 +1,9 @@
data = $this->db['language-data'];
}
+
+ unset($this->db['language-data']);
}
public function getLanguageList()
@@ -62,4 +64,9 @@ class dbLanguage extends dbJSON
echo $this->get($text);
}
+ public function add($array)
+ {
+ $this->db[] = $array;
+ }
+
}
diff --git a/kernel/helpers/sanitize.class.php b/kernel/helpers/sanitize.class.php
index 410cc180..47c17938 100644
--- a/kernel/helpers/sanitize.class.php
+++ b/kernel/helpers/sanitize.class.php
@@ -28,12 +28,19 @@ class Sanitize {
return htmlspecialchars_decode($text, $flags);
}
- public static function pathFile($path, $file)
+ public static function pathFile($path, $file=false)
{
- // Fix for Windows on paths. eg: $path = c:\diego/page/subpage convert to c:\diego\page\subpages
- $path = str_replace('/', DS, $path);
+ if($file!==false){
+ $fullPath = $path.$file;
+ }
+ else {
+ $fullPath = $path;
+ }
- $real = realpath($path.$file);
+ // Fix for Windows on paths. eg: $path = c:\diego/page/subpage convert to c:\diego\page\subpages
+ $fullPath = str_replace('/', DS, $fullPath);
+
+ $real = realpath($fullPath);
// If $real is FALSE the file does not exist.
if($real===false) {
@@ -41,7 +48,7 @@ class Sanitize {
}
// If the $real path does not start with the systemPath then this is Path Traversal.
- if(strpos($path.$file, $real)!==0) {
+ if(strpos($fullPath, $real)!==0) {
return false;
}
diff --git a/languages/en_US.json b/languages/en_US.json
index ef7506e0..ce936f9a 100644
--- a/languages/en_US.json
+++ b/languages/en_US.json
@@ -9,7 +9,43 @@
"website": ""
},
- "name": "Name",
- "first-name": "First Name",
- "posted-by": "Posted by"
+ "username": "Username",
+ "password": "Password",
+ "confirm-password": "Confirm Password",
+ "editor": "Editor",
+ "dashboard": "Dashboard",
+ "role": "Role",
+ "posts": "Posts",
+ "Users": "Users",
+ "administrator": "Administrator",
+ "add": "Add",
+ "cancel": "Cancel",
+ "content": "Content",
+ "title": "Title",
+ "no-parent": "No parent",
+ "edit-page": "Edit page",
+ "edit-post": "Edit post",
+ "you-can-choose-the-users-privilege": "You can choose the user's privilege. The editor role only can write pages and posts.",
+ "email-will-not-be-publicly-displayed": "Email will not be publicly displayed. Recommended for recovery password and notifications.",
+ "add-a-new-user": "Add a new user",
+ "html-markdown-code-supported": "HTML and Markdown code supported.",
+ "parent": "Parent",
+ "friendly-url": "Friendly URL",
+ "description": "Description",
+ "tags": "Tags",
+ "position": "Position",
+ "save": "Save",
+ "draft": "Draft",
+ "delete": "Delete",
+ "advanced-options": "Advanced options",
+ "enable-more-features-at": "Enable more features at",
+ "settings-advanced-writting-settings": "Settings->Advanced->Writting Settings",
+ "publish-now": "Publish now",
+ "delete": "Delete",
+ "delete": "Delete",
+ "delete": "Delete",
+ "delete": "Delete",
+ "delete": "Delete",
+ "delete": "Delete"
+
}
\ No newline at end of file
diff --git a/languages/es_ES.json b/languages/es_ES.json
index 5ca49d05..1f5a45ee 100644
--- a/languages/es_ES.json
+++ b/languages/es_ES.json
@@ -1,7 +1,7 @@
{
"language-data":
{
- "native": "Español (Argentina)",
+ "native": "Español (España)",
"english-name": "Spanish",
"last-update": "2015-06-28",
"author": "Diego",
@@ -9,7 +9,5 @@
"website": ""
},
- "name": "Name",
- "first-name": "First Name",
- "posted-by": "Posted by"
+ "test":"test"
}
\ No newline at end of file
diff --git a/plugins/opengaph/language/en_US.json b/plugins/opengaph/language/en_US.json
new file mode 100644
index 00000000..8245ff08
--- /dev/null
+++ b/plugins/opengaph/language/en_US.json
@@ -0,0 +1,13 @@
+{
+ "plugin-data":
+ {
+ "name": "Open Graph",
+ "description": "The Open Graph protocol enables any web page to become a rich object in a social graph.",
+ "author": "Diego",
+ "email": "",
+ "website": ""
+ },
+
+ "name": "Name",
+ "first-name": "First Name"
+}
\ No newline at end of file
diff --git a/plugins/opengaph/plugin.php b/plugins/opengaph/plugin.php
index f74d6ea4..b909b905 100644
--- a/plugins/opengaph/plugin.php
+++ b/plugins/opengaph/plugin.php
@@ -5,16 +5,15 @@ class pluginOpenGraph extends Plugin {
public function init()
{
$this->dbFields = array(
- 'title'=>'Open Graph',
- 'description'=>'The Open Graph protocol enables any web page to become a rich object in a social graph.'
- );
+ 'test'=>''
+ );
}
public function onSiteHead()
{
global $Url, $Site;
global $Post, $Page;
-
+
$og = array(
'locale' =>$Site->locale(),
'type' =>'website',
@@ -22,7 +21,7 @@ class pluginOpenGraph extends Plugin {
'description' =>$Site->description(),
'url' =>$Site->url(),
'image' =>'',
- 'site_name' =>$Site->title()
+ 'siteName' =>$Site->title()
);
switch($Url->whereAmI())
@@ -48,7 +47,7 @@ class pluginOpenGraph extends Plugin {
$html .= ' '.PHP_EOL;
$html .= ' '.PHP_EOL;
$html .= ' '.PHP_EOL;
- $html .= ' '.PHP_EOL;
+ $html .= ' '.PHP_EOL;
return $html;
}