New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opporational? #111
Closed
Closed
opporational? #111
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
18dfc4c
Useless temp file
5bfdb63
Fix wrong language id from ru_KG to ru_RU
a5b261f
Misprints, mistypes, language errors and mistakes, new vars are fixed
25be0b8
Fix mistake in a language files headers
e7fe936
Merge remote branch 'upstream/master'
cff505e
Missed translated files
a00e2c6
Missed translated files
3d665c4
Forgot about UTF8
410247b
Function rawurlencode() must not be used for cyrillic, since it broke…
e58e22e
Function file_get_contents() must not be used, but curl only. / Fixed…
7a8ad28
tjena bilabena
057992d
tjena bilabena
aff7258
operational
6716cf7
http://
226fecf
mistyped ')'
49e67f5
rawurlencode got back. encode changed to decodeURIComponent as it doe…
d88fc68
complete with russian
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php defined('SYSPATH') or die('No direct script access.'); | ||
/** | ||
* Addon Manager | ||
* Install new Plugins & Themes | ||
* | ||
* PHP version 5 | ||
* LICENSE: This source file is subject to LGPL license | ||
* that is available through the world-wide-web at the following URI: | ||
* http://www.gnu.org/copyleft/lesser.html | ||
* @author Ushahidi Team <team@ushahidi.com> | ||
* @package Ushahidi - http://source.ushahididev.com | ||
* @module Addon Manager Controller | ||
* @copyright Ushahidi - http://www.ushahidi.com | ||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) | ||
*/ | ||
|
||
class Addons_Controller extends Admin_Controller { | ||
|
||
function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->template->this_page = 'addons'; | ||
|
||
// If this is not a super-user account, redirect to dashboard | ||
if(!$this->auth->logged_in('admin') && !$this->auth->logged_in('superadmin')) | ||
{ | ||
url::redirect('admin/dashboard'); | ||
} | ||
} | ||
|
||
public function index() | ||
{ | ||
url::redirect(url::base().'admin/addons/plugins/'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
<?php defined('SYSPATH') or die('No direct script access.'); | ||
/** | ||
* Addon Manager | ||
* Install new Plugins & Themes | ||
* Credits To Jeremy Bush at Zombor.net (http://www.zombor.net/) | ||
* | ||
* Portions of this code: | ||
* Copyright (c) 2008-2009, Argentum Team | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
* | ||
* PHP version 5 | ||
* LICENSE: This source file is subject to LGPL license | ||
* that is available through the world-wide-web at the following URI: | ||
* http://www.gnu.org/copyleft/lesser.html | ||
* @author Ushahidi Team <team@ushahidi.com> | ||
* @package Ushahidi - http://source.ushahididev.com | ||
* @module Addon Manager Controller | ||
* @copyright Ushahidi - http://www.ushahidi.com | ||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) | ||
*/ | ||
|
||
class Plugins_Controller extends Admin_Controller { | ||
|
||
function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->template->this_page = 'addons'; | ||
|
||
// If this is not a super-user account, redirect to dashboard | ||
if(!$this->auth->logged_in('admin') && !$this->auth->logged_in('superadmin')) | ||
{ | ||
url::redirect('admin/dashboard'); | ||
} | ||
} | ||
|
||
public function index() | ||
{ | ||
$this->template->content = new View('admin/plugins'); | ||
$this->template->content->title = 'Addons'; | ||
|
||
if (isset($_GET['status']) && ! empty($_GET['status'])) | ||
{ | ||
$status = $_GET['status']; | ||
|
||
if (strtolower($status) == 'a') | ||
{ | ||
$filter = 'plugin_active = 1'; | ||
} | ||
elseif (strtolower($status) == 'i') | ||
{ | ||
$filter = 'plugin_active = 0'; | ||
} | ||
else | ||
{ | ||
$status = "0"; | ||
$filter = '1=1'; | ||
} | ||
} | ||
else | ||
{ | ||
$status = "0"; | ||
$filter = '1=1'; | ||
} | ||
|
||
$db = new Database(); | ||
|
||
// Update the plugin list in the database | ||
$d = dir(PLUGINPATH); | ||
$directories = array(); | ||
while (($entry = $d->read()) !== FALSE) | ||
{ | ||
// Set the plugin to not enabled by default | ||
// Don't include hidden folders | ||
if ($entry[0] != '.') $directories[$entry] = FALSE; | ||
} | ||
|
||
// Sync the folder with the database | ||
foreach ($directories as $dir => $found) | ||
{ | ||
if ( ! count($db->from('plugin')->where('plugin_name', $dir)->limit(1)->get())) | ||
{ | ||
$plugin = ORM::factory('plugin'); | ||
$plugin->plugin_name = $dir; | ||
$plugin->save(); | ||
} | ||
} | ||
|
||
// Remove Any Plugins not found in the plugins folder from the database | ||
foreach (ORM::factory('plugin')->find_all() as $plugin) | ||
{ | ||
if ( ! array_key_exists($plugin->plugin_name, $directories)) | ||
{ | ||
$plugin->delete(); | ||
} | ||
} | ||
|
||
// check, has the form been submitted? | ||
$form_error = FALSE; | ||
$form_saved = FALSE; | ||
$form_action = ""; | ||
if ($_POST) | ||
{ | ||
$post = Validation::factory($_POST); | ||
|
||
// Add some filters | ||
$post->pre_filter('trim', TRUE); | ||
|
||
// Add some rules, the input field, followed by a list of checks, carried out in order | ||
$post->add_rules('action','required', 'alpha', 'length[1,1]'); | ||
$post->add_rules('comment_id.*','required','numeric'); | ||
|
||
if ($post->validate()) | ||
{ | ||
if ($post->action == 'a') | ||
{ // Activate Action | ||
foreach($post->plugin_id as $item) | ||
{ | ||
$plugin = ORM::factory('plugin', $item); | ||
// Make sure we run the installer if it hasnt been installed yet. | ||
// Then mark it as installed | ||
if ($plugin->loaded AND $plugin->plugin_name) | ||
{ | ||
Kohana::config_set('core.modules', array_merge(Kohana::config('core.modules'), array(PLUGINPATH.$plugin->plugin_name))); | ||
$class = ucfirst($plugin->plugin_name).'_Install'; | ||
if ($path = Kohana::find_file('libraries', $plugin->plugin_name.'_install')) | ||
{ | ||
include $path; | ||
|
||
// Run the installer | ||
$install = new $class; | ||
$install->run_install(); | ||
} | ||
|
||
// Mark as Active and Mark as Installed | ||
$plugin->plugin_active = 1; | ||
$plugin->plugin_installed = 1; | ||
$plugin->save(); | ||
} | ||
} | ||
} | ||
elseif ($post->action == 'i') | ||
{ // Deactivate Action | ||
foreach($post->plugin_id as $item) | ||
{ | ||
$plugin = ORM::factory('plugin', $item); | ||
if ($plugin->loaded) | ||
{ | ||
$plugin->plugin_active = 0; | ||
$plugin->save(); | ||
} | ||
} | ||
} | ||
elseif ($post->action == 'd') | ||
{ // Delete Action | ||
foreach($post->plugin_id as $item) | ||
{ | ||
$plugin = ORM::factory('plugin', $item); | ||
if ($plugin->loaded AND $plugin->plugin_name) | ||
{ | ||
Kohana::config_set('core.modules', array_merge(Kohana::config('core.modules'), array(MODPATH.'argentum/'.$module))); | ||
if ($path = Kohana::find_file('libraries', $plugin->plugin_name.'_install')) | ||
{ | ||
include $path; | ||
|
||
// Run the uninstaller | ||
$class = ucfirst($module).'_Install'; | ||
$install = new $class; | ||
$install->uninstall(); | ||
} | ||
|
||
// Mark as InActive and Mark as UnInstalled | ||
$plugin->plugin_active = 0; | ||
$plugin->plugin_installed = 0; | ||
$plugin->save(); | ||
} | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
$form_error = TRUE; | ||
} | ||
|
||
} | ||
|
||
$plugins = ORM::factory('plugin') | ||
->where($filter) | ||
->orderby('plugin_name', 'ASC') | ||
->find_all(); | ||
$this->template->content->plugins = $plugins; | ||
$this->template->content->total_items = $plugins->count(); | ||
|
||
$this->template->content->form_error = $form_error; | ||
$this->template->content->form_saved = $form_saved; | ||
$this->template->content->form_action = $form_action; | ||
|
||
// Status Tab | ||
$this->template->content->status = $status; | ||
|
||
// Javascript Header | ||
$this->template->js = new View('admin/plugins_js'); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to PHP.net ctype, hash, json and hash are all part of php core - no extensions needed.
Filter and Ctype can be disabled but are enabled by default.
I think listing these as requirement will just add confusion. Maybe you could list it as 'these are need but usually enabled by default'