diff --git a/admin/controllers/configure-plugin.php b/admin/controllers/configure-plugin.php index 4f6b4ea8..5a58ba75 100644 --- a/admin/controllers/configure-plugin.php +++ b/admin/controllers/configure-plugin.php @@ -1,5 +1,14 @@ role()!=='admin') { + Alert::set('You do not have sufficient permissions to access this page, contact the administrator.'); + Redirect::page('admin', 'dashboard'); +} + // ============================================================================ // Functions // ============================================================================ @@ -21,14 +30,19 @@ if($_Plugin===false) { Redirect::page('admin', 'plugins'); } +// Check if the plugin has the method form. +if($_Plugin->form()===false) { + Redirect::page('admin', 'plugins'); +} + // ============================================================================ // POST Method // ============================================================================ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) { - Alert::set('Configuration saved successfuly'); $_Plugin->setDb($_POST); + Alert::set('Configuration has been saved successfully'); } // ============================================================================ diff --git a/admin/controllers/edit-user.php b/admin/controllers/edit-user.php index a3c500ac..a035e315 100644 --- a/admin/controllers/edit-user.php +++ b/admin/controllers/edit-user.php @@ -22,7 +22,6 @@ function editUser($args) { return $dbUsers->set($args); } - } // ============================================================================ diff --git a/admin/controllers/login.php b/admin/controllers/login.php index 4dc23ea9..bbde272e 100644 --- a/admin/controllers/login.php +++ b/admin/controllers/login.php @@ -11,6 +11,6 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) } else { - Alert::set('Login failed'); + Alert::set('Username or password incorrect'); } -} +} \ No newline at end of file diff --git a/admin/controllers/new-page.php b/admin/controllers/new-page.php index 7f1084b6..ad9ec932 100644 --- a/admin/controllers/new-page.php +++ b/admin/controllers/new-page.php @@ -1,5 +1,9 @@
- +
\ No newline at end of file diff --git a/admin/views/edit-page.php b/admin/views/edit-page.php index fe4a5e53..94996b96 100644 --- a/admin/views/edit-page.php +++ b/admin/views/edit-page.php @@ -78,11 +78,11 @@ - + children())===0) { ?> - - + + diff --git a/admin/views/edit-post.php b/admin/views/edit-post.php index e6cf70d9..cb5562b2 100644 --- a/admin/views/edit-post.php +++ b/admin/views/edit-post.php @@ -49,9 +49,9 @@ - - - + + + diff --git a/admin/views/new-page.php b/admin/views/new-page.php index ab05b513..9122148e 100644 --- a/admin/views/new-page.php +++ b/admin/views/new-page.php @@ -67,8 +67,8 @@ - - + + diff --git a/admin/views/new-post.php b/admin/views/new-post.php index 82b2b1d4..d29098f9 100644 --- a/admin/views/new-post.php +++ b/admin/views/new-post.php @@ -48,8 +48,8 @@ - - + + diff --git a/admin/views/plugins.php b/admin/views/plugins.php index d151884b..b6f2b1a0 100644 --- a/admin/views/plugins.php +++ b/admin/views/plugins.php @@ -10,7 +10,9 @@ if($Plugin->installed()) { echo ''.$Language->g('Uninstall plugin').''; - echo ''.$Language->g('Configure plugin').''; + if($Plugin->form()) { + echo ''.$Language->g('Configure plugin').''; + } } else { echo ''.$Language->g('Install plugin').''; diff --git a/admin/views/settings.php b/admin/views/settings.php index 20eb534f..c1f048cb 100644 --- a/admin/views/settings.php +++ b/admin/views/settings.php @@ -39,7 +39,7 @@
p('you-can-add-a-small-text-on-the-bottom') ?>
- + @@ -99,7 +99,7 @@ - + @@ -142,7 +142,7 @@
p('you-can-use-this-field-to-define-a-set-of') ?>
- + diff --git a/kernel/abstract/plugin.class.php b/kernel/abstract/plugin.class.php index 13700fad..b60ccd5f 100644 --- a/kernel/abstract/plugin.class.php +++ b/kernel/abstract/plugin.class.php @@ -30,6 +30,8 @@ class Plugin { 'website'=>'' ); + $this->dbFields = array(); + $reflector = new ReflectionClass(get_class($this)); // Directory name @@ -140,12 +142,9 @@ class Plugin { // Create plugin directory for databases and others files. mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, 0755, true); - if( !empty($this->dbFields) ) - { - // DEBUG: NO ME GUSTA LLAMAR A UNA CLASE - $Tmp = new dbJSON($this->filenameDb); - $Tmp->set($this->dbFields); - } + // Create database + $Tmp = new dbJSON($this->filenameDb); + $Tmp->set($this->dbFields); return true; } diff --git a/kernel/dblanguage.class.php b/kernel/dblanguage.class.php index 22e87fbc..c1cdeeea 100644 --- a/kernel/dblanguage.class.php +++ b/kernel/dblanguage.class.php @@ -2,32 +2,75 @@ class dbLanguage extends dbJSON { - public $en_US; - private $data; + public $data; + public $db; function __construct($language) { $this->data = array(); + $this->db = array(); // Default language en_US $filename = PATH_LANGUAGES.'en_US.json'; if(file_exists($filename)) { - parent::__construct($filename, false); - $this->en_US = $this->db; + $Tmp = new dbJSON($filename, false); + $this->db += $Tmp->db; } // User language $filename = PATH_LANGUAGES.$language.'.json'; if(file_exists($filename)) { - parent::__construct($filename, false); - $this->data = $this->db['language-data']; + $Tmp = new dbJSON($filename, false); + $this->db += $Tmp->db; } + $this->data = $this->db['language-data']; unset($this->db['language-data']); } + // Return the translation, if the translation does'n exist then return the English translation. + public function get($string) + { + $key = Text::lowercase($string); + $key = Text::replace(' ', '-', $key); + + if(isset($this->db[$key])) { + return $this->db[$key]; + } + + return ''; + } + + // Returns translation. + public function g($string) + { + return $this->get($string); + } + + // Print translation. + public function p($string) + { + echo $this->get($string); + } + + public function add($array) + { + $this->db += $array; + } + + // Returns the item from plugin-data. + public function getData($key) + { + if(isset($this->data[$key])) { + return $this->data[$key]; + } + + return ''; + } + + // Returns an array with all dictionaries. public function getLanguageList() { $files = glob(PATH_LANGUAGES.'*.json'); @@ -45,33 +88,4 @@ class dbLanguage extends dbJSON return $tmp; } - // Return the translation, if the translation does'n exist then return the English translation. - public function get($string) - { - $key = Text::lowercase($string); - $key = Text::replace(' ', '-', $key); - - if(isset($this->db[$key])) - return $this->db[$key]; - - // If the key is not translated then return the English translation. - return $this->en_US[$key]; - } - - public function g($string) - { - return $this->get($string); - } - - // Print the translation. - public function p($string) - { - echo $this->get($string); - } - - public function add($array) - { - $this->db += $array; - } - } \ No newline at end of file diff --git a/languages/es_ES.json b/languages/es_AR.json similarity index 80% rename from languages/es_ES.json rename to languages/es_AR.json index 1f5a45ee..623f8e76 100644 --- a/languages/es_ES.json +++ b/languages/es_AR.json @@ -1,7 +1,7 @@ { "language-data": { - "native": "Español (España)", + "native": "Español (Argentina)", "english-name": "Spanish", "last-update": "2015-06-28", "author": "Diego", diff --git a/plugins/opengraph/plugin.php b/plugins/opengraph/plugin.php index b909b905..158c0ed8 100644 --- a/plugins/opengraph/plugin.php +++ b/plugins/opengraph/plugin.php @@ -2,13 +2,6 @@ class pluginOpenGraph extends Plugin { - public function init() - { - $this->dbFields = array( - 'test'=>'' - ); - } - public function onSiteHead() { global $Url, $Site;