本文整理汇总了PHP中AdminSecBaseModel类的典型用法代码示例。如果您正苦于以下问题:PHP AdminSecBaseModel类的具体用法?PHP AdminSecBaseModel怎么用?PHP AdminSecBaseModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AdminSecBaseModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'delete':
$ids = Params::getParam("id");
if ($ids != '') {
foreach ($ids as $id) {
osc_deleteResource($id);
}
$this->resourcesManager->delete(array(DB_CUSTOM_COND => 'pk_i_id IN (' . implode(', ', $ids) . ')'));
}
osc_add_flash_message(_m('Resource deleted'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=media");
break;
default:
$resourceId = Params::getParam("id");
if ($resourceId != '') {
$resources = $this->resourcesManager->getAllResources($resourceId);
} else {
$resources = $this->resourcesManager->getAllResources(NULL);
}
//calling the view...
$this->_exportVariableToView("resources", $resources);
$this->_exportVariableToView("resourceId", $resourceId);
$this->doView('media/index.php');
}
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:29,代码来源:media.php
示例2: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add_post':
if (Params::getParam('field_name') != '') {
$field = $this->fieldManager->findByName(Params::getParam('field_name'));
if (!isset($field['pk_i_id'])) {
$slug = preg_replace('|([-]+)|', '-', preg_replace('|[^a-z0-9_-]|', '-', strtolower(Params::getParam("field_slug"))));
$this->fieldManager->insertField(Params::getParam("field_name"), Params::getParam("field_type_new"), $slug, Params::getParam("field_required") == "1" ? 1 : 0, Params::getParam('field_options'), Params::getParam('categories'));
osc_add_flash_ok_message(_m("New custom field added"), "admin");
} else {
osc_add_flash_error_message(_m("Sorry, you already have one field with that name"), "admin");
}
} else {
osc_add_flash_error_message(_m("Name can not be empty"), "admin");
}
$this->redirectTo(osc_admin_base_url(true) . "?page=cfields");
break;
default:
$categories = Category::newInstance()->toTreeAll();
$selected = array();
foreach ($categories as $c) {
$selected[] = $c['pk_i_id'];
foreach ($c['categories'] as $cc) {
$selected[] = $cc['pk_i_id'];
}
}
$this->_exportVariableToView("categories", $categories);
$this->_exportVariableToView("default_selected", $selected);
$this->_exportVariableToView("fields", $this->fieldManager->listAll());
$this->doView("fields/index.php");
}
}
开发者ID:acharei,项目名称:OSClass,代码行数:35,代码来源:custom_fields.php
示例3: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add_post_default':
// add default category and reorder parent categories
$fields['fk_i_parent_id'] = NULL;
$fields['i_expiration_days'] = 0;
$fields['i_position'] = 0;
$fields['b_enabled'] = 1;
$default_locale = osc_language();
$aFieldsDescription[$default_locale]['s_name'] = "NEW CATEGORY, EDIT ME!";
$categoryId = $this->categoryManager->insert($fields, $aFieldsDescription);
// reorder parent categories. NEW category first
$rootCategories = $this->categoryManager->findRootCategories();
foreach ($rootCategories as $cat) {
$order = $cat['i_position'];
$order++;
$this->categoryManager->updateOrder($cat['pk_i_id'], $order);
}
$this->categoryManager->updateOrder($categoryId, '0');
$this->redirectTo(osc_admin_base_url(true) . '?page=categories');
break;
default:
//
$this->_exportVariableToView("categories", $this->categoryManager->toTreeAll());
$this->doView("categories/index.php");
}
}
开发者ID:michaelxizhou,项目名称:myeden69,代码行数:30,代码来源:functions.php
示例4:
function __construct()
{
parent::__construct();
$this->ajax = true;
if ($this->isModerator()) {
if (!in_array($this->action, array('items', 'media', 'comments', 'custom'))) {
$this->action = 'error_permissions';
}
}
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:10,代码来源:ajax.php
示例5: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'upgrade-funcs':
require LIB_PATH . 'osclass/upgrade-funcs.php';
break;
default:
$this->doView('upgrade/index.php');
}
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:12,代码来源:upgrade.php
示例6: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'edit':
if (Params::getParam("id") == '') {
$this->redirectTo(osc_admin_base_url(true) . "?page=emails");
}
$this->_exportVariableToView("email", $this->emailManager->findByPrimaryKey(Params::getParam("id")));
$this->doView("emails/frm.php");
break;
case 'edit_post':
$id = Params::getParam("id");
$s_internal_name = Params::getParam("s_internal_name");
$aFieldsDescription = array();
$postParams = Params::getParamsAsArray('', false);
$not_empty = false;
foreach ($postParams as $k => $v) {
if (preg_match('|(.+?)#(.+)|', $k, $m)) {
if ($m[2] == 's_title' && $v != '') {
$not_empty = true;
}
$aFieldsDescription[$m[1]][$m[2]] = $v;
}
}
if ($not_empty) {
foreach ($aFieldsDescription as $k => $_data) {
$this->emailManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']);
}
if (!$this->emailManager->internalNameExists($id, $s_internal_name)) {
if (!$this->emailManager->isIndelible($id)) {
$this->emailManager->updateInternalName($id, $s_internal_name);
}
osc_add_flash_ok_message(_m('The email/alert has been updated'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=emails");
}
osc_add_flash_error_message(_m('You can\'t repeat internal name'), 'admin');
} else {
osc_add_flash_error_message(_m('The email couldn\'t be updated, at least one title should not be empty'), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . "?page=emails?action=edit&id=" . $id);
break;
default:
$this->_exportVariableToView("prefLocale", osc_current_admin_locale());
$this->_exportVariableToView("emails", $this->emailManager->listAll(1));
$this->doView("emails/index.php");
}
}
开发者ID:randomecho,项目名称:OSClass,代码行数:49,代码来源:emails.php
示例7: doModel
public function doModel()
{
parent::doModel();
switch (Params::getParam("route")) {
case mdh_current_plugin_name() . '_init':
$this->init();
break;
case mdh_current_plugin_name() . '_do':
$this->update();
break;
default:
$this->show();
break;
}
}
开发者ID:bomvendador,项目名称:soroka_r,代码行数:15,代码来源:Admin.php
示例8: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'plugins':
$this->doView("market/plugins.php");
break;
case 'themes':
$this->doView("market/themes.php");
break;
default:
$this->doView("market/plugins.php");
break;
}
}
开发者ID:semul,项目名称:Osclass,代码行数:16,代码来源:market.php
示例9: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add_post_default':
// add default category and reorder parent categories
$fields['fk_i_parent_id'] = NULL;
$fields['i_expiration_days'] = 0;
$fields['i_position'] = 0;
$fields['b_enabled'] = 1;
$default_locale = osc_language();
$aFieldsDescription[$default_locale]['s_name'] = "NEW CATEGORY, EDIT ME!";
$categoryId = $this->categoryManager->insert($fields, $aFieldsDescription);
// reorder parent categories. NEW category first
$rootCategories = $this->categoryManager->findRootCategories();
foreach ($rootCategories as $cat) {
$order = $cat['i_position'];
$order++;
$this->categoryManager->updateOrder($cat['pk_i_id'], $order);
}
$this->categoryManager->updateOrder($categoryId, '0');
$this->redirectTo(osc_admin_base_url(true) . '?page=categories');
break;
case 'settings':
// calling the categories settings view
$this->doView('categories/settings.php');
break;
case 'settings_post':
// updating categories option
$selectableParent = Params::getParam('selectable_parent_categories');
$updated = Preference::newInstance()->update(array('s_value' => $selectableParent), array('s_name' => 'selectable_parent_categories'));
if ($updated > 0) {
osc_add_flash_ok_message(_m("Categories' settings have been updated"), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=categories&action=settings');
break;
default:
//
$this->_exportVariableToView("categories", $this->categoryManager->toTreeAll());
$this->doView("categories/index.php");
}
}
开发者ID:randomecho,项目名称:OSClass,代码行数:43,代码来源:categories.php
示例10: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'bulk_actions':
switch (Params::getParam('bulk_actions')) {
case 'delete_all':
$ids = Params::getParam("id");
if (is_array($ids)) {
foreach ($ids as $id) {
osc_deleteResource($id, true);
}
$log_ids = substr(implode(",", $ids), 0, 250);
Log::newInstance()->insertLog('media', 'delete bulk', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
$this->resourcesManager->deleteResourcesIds($ids);
}
osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
break;
default:
break;
}
$this->redirectTo(osc_admin_base_url(true) . '?page=media');
break;
case 'delete':
$ids = Params::getParam('id');
if (is_array($ids)) {
foreach ($ids as $id) {
osc_deleteResource($id, true);
}
$log_ids = substr(implode(",", $ids), 0, 250);
Log::newInstance()->insertLog('media', 'delete', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
$this->resourcesManager->deleteResourcesIds($ids);
}
osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=media');
break;
default:
$this->doView('media/index.php');
break;
}
}
开发者ID:randomecho,项目名称:OSClass,代码行数:42,代码来源:media.php
示例11: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
default:
$categories = Category::newInstance()->toTreeAll();
$selected = array();
foreach ($categories as $c) {
$selected[] = $c['pk_i_id'];
foreach ($c['categories'] as $cc) {
$selected[] = $cc['pk_i_id'];
}
}
$this->_exportVariableToView('categories', $categories);
$this->_exportVariableToView('default_selected', $selected);
$this->_exportVariableToView('fields', $this->fieldManager->listAll());
$this->doView("fields/index.php");
break;
}
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:21,代码来源:custom_fields.php
示例12: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'bulk_actions':
switch (Params::getParam('bulk_actions')) {
case 'delete_all':
$ids = Params::getParam("id");
if ($ids != '') {
foreach ($ids as $id) {
osc_deleteResource($id);
}
$this->resourcesManager->deleteResourcesIds($ids);
}
osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
break;
default:
break;
}
$this->redirectTo(osc_admin_base_url(true) . "?page=media");
break;
case 'delete':
$ids = Params::getParam("id");
if ($ids != '') {
foreach ($ids as $id) {
osc_deleteResource($id);
}
$this->resourcesManager->deleteResourcesIds($ids);
}
osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=media");
break;
default:
$this->doView('media/index.php');
}
}
开发者ID:acharei,项目名称:OSClass,代码行数:37,代码来源:media.php
示例13: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add':
$this->doView("plugins/add.php");
break;
case 'add_post':
if (defined('DEMO')) {
osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
}
$package = Params::getFiles("package");
if (isset($package['size']) && $package['size'] != 0) {
$path = osc_plugins_path();
(int) ($status = osc_unzip_file($package['tmp_name'], $path));
} else {
$status = 3;
}
switch ($status) {
case 0:
$msg = _m('The plugin folder is not writable');
osc_add_flash_error_message($msg, 'admin');
break;
case 1:
$msg = _m('The plugin has been uploaded correctly');
osc_add_flash_ok_message($msg, 'admin');
break;
case 2:
$msg = _m('The zip file is not valid');
osc_add_flash_error_message($msg, 'admin');
break;
case 3:
$msg = _m('No file was uploaded');
osc_add_flash_error_message($msg, 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins&action=add");
break;
case -1:
default:
$msg = _m('There was a problem adding the plugin');
osc_add_flash_error_message($msg, 'admin');
break;
}
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'install':
if (defined('DEMO')) {
osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
}
$pn = Params::getParam('plugin');
// set header just in case it's triggered some fatal error
header("Location: " . osc_admin_base_url(true) . "?page=plugins&error=" . $pn, true, '302');
$installed = Plugins::install($pn);
if (is_array($installed)) {
switch ($installed['error_code']) {
case 'error_output':
osc_add_flash_error_message(sprintf(_m('The plugin generated %d characters of <strong>unexpected output</strong> during the installation'), strlen($installed['output'])), 'admin');
break;
case 'error_installed':
osc_add_flash_error_message(_m('Plugin is already installed'), 'admin');
break;
case 'error_file':
osc_add_flash_error_message(_m("Plugin couldn't be installed because their files are missing"), 'admin');
break;
case 'custom_error':
osc_add_flash_error_message(sprintf(_m("Plugin couldn't be installed because of: %s"), $installed['msg']), 'admin');
break;
default:
osc_add_flash_error_message(_m("Plugin couldn't be installed"), 'admin');
break;
}
} else {
osc_add_flash_ok_message(_m('Plugin installed'), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
break;
case 'uninstall':
if (defined('DEMO')) {
osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
}
if (Plugins::uninstall(Params::getParam("plugin"))) {
osc_add_flash_ok_message(_m('Plugin uninstalled'), 'admin');
} else {
osc_add_flash_error_message(_m("Plugin couldn't be uninstalled"), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
break;
case 'enable':
if (defined('DEMO')) {
osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
}
if (Plugins::activate(Params::getParam('plugin'))) {
osc_add_flash_ok_message(_m('Plugin enabled'), 'admin');
} else {
osc_add_flash_error_message(_m('Plugin is already enabled'), 'admin');
}
//.........这里部分代码省略.........
开发者ID:randomecho,项目名称:OSClass,代码行数:101,代码来源:plugins.php
示例14: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'bulk_actions':
osc_csrf_check();
$id = Params::getParam('id');
if ($id) {
switch (Params::getParam('bulk_actions')) {
case 'delete_all':
$this->itemCommentManager->delete(array(DB_CUSTOM_COND => 'pk_i_id IN (' . implode(', ', $id) . ')'));
foreach ($id as $_id) {
$iUpdated = $this->itemCommentManager->delete(array('pk_i_id' => $_id));
osc_add_hook("delete_comment", $_id);
}
osc_add_flash_ok_message(_m('The comments have been deleted'), 'admin');
break;
case 'activate_all':
foreach ($id as $_id) {
$iUpdated = $this->itemCommentManager->update(array('b_active' => 1), array('pk_i_id' => $_id));
if ($iUpdated) {
$this->sendCommentActivated($_id);
}
osc_add_hook("activate_comment", $_id);
}
osc_add_flash_ok_message(_m('The comments have been approved'), 'admin');
break;
case 'deactivate_all':
foreach ($id as $_id) {
$this->itemCommentManager->update(array('b_active' => 0), array('pk_i_id' => $_id));
osc_add_hook("deactivate_comment", $_id);
}
osc_add_flash_ok_message(_m('The comments have been disapproved'), 'admin');
break;
case 'enable_all':
foreach ($id as $_id) {
$iUpdated = $this->itemCommentManager->update(array('b_enabled' => 1), array('pk_i_id' => $_id));
if ($iUpdated) {
$this->sendCommentActivated($_id);
}
osc_add_hook("enable_comment", $_id);
}
osc_add_flash_ok_message(_m('The comments have been unblocked'), 'admin');
break;
case 'disable_all':
foreach ($id as $_id) {
$this->itemCommentManager->update(array('b_enabled' => 0), array('pk_i_id' => $_id));
osc_add_hook("disable_comment", $_id);
}
osc_add_flash_ok_message(_m('The comments have been blocked'), 'admin');
break;
default:
if (Params::getParam("bulk_actions") != "") {
osc_run_hook("item_bulk_" . Params::getParam("bulk_actions"), Params::getParam('id'));
}
break;
}
}
$this->redirectTo(osc_admin_base_url(true) . "?page=comments");
break;
case 'status':
osc_csrf_check();
$id = Params::getParam('id');
$value = Params::getParam('value');
if (!$id) {
return false;
}
$id = (int) $id;
if (!is_numeric($id)) {
return false;
}
if (!in_array($value, array('ACTIVE', 'INACTIVE', 'ENABLE', 'DISABLE'))) {
return false;
}
if ($value == 'ACTIVE') {
$iUpdated = $this->itemCommentManager->update(array('b_active' => 1), array('pk_i_id' => $id));
if ($iUpdated) {
$this->sendCommentActivated($id);
}
osc_add_hook("activate_comment", $id);
osc_add_flash_ok_message(_m('The comment has been approved'), 'admin');
} else {
if ($value == 'INACTIVE') {
$iUpdated = $this->itemCommentManager->update(array('b_active' => 0), array('pk_i_id' => $id));
osc_add_hook("deactivate_comment", $id);
osc_add_flash_ok_message(_m('The comment has been disapproved'), 'admin');
} else {
if ($value == 'ENABLE') {
$iUpdated = $this->itemCommentManager->update(array('b_enabled' => 1), array('pk_i_id' => $id));
osc_add_hook("enable_comment", $id);
osc_add_flash_ok_message(_m('The comment has been enabled'), 'admin');
} else {
if ($value == 'DISABLE') {
$iUpdated = $this->itemCommentManager->update(array('b_enabled' => 0), array('pk_i_id' => $id));
osc_add_hook("disable_comment", $id);
osc_add_flash_ok_message(_m('The comment has been disabled'), 'admin');
}
}
}
//.........这里部分代码省略.........
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:comments.php
示例15:
function __construct()
{
parent::__construct();
}
开发者ID:randomecho,项目名称:OSClass,代码行数:4,代码来源:main.php
示例16: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'bulk_actions':
switch (Params::getParam('bulk_actions')) {
case 'delete_all':
$ids = Params::getParam("id");
if (is_array($ids)) {
foreach ($ids as $id) {
osc_deleteResource($id, true);
}
$log_ids = substr(implode(",", $ids), 0, 250);
Log::newInstance()->insertLog('media', 'delete bulk', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
$this->resourcesManager->deleteResourcesIds($ids);
}
osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
break;
default:
break;
}
$this->redirectTo(osc_admin_base_url(true) . '?page=media');
break;
case 'delete':
$ids = Params::getParam('id');
if (is_array($ids)) {
foreach ($ids as $id) {
osc_deleteResource($id, true);
}
$log_ids = substr(implode(",", $ids), 0, 250);
Log::newInstance()->insertLog('media', 'delete', $log_ids, $log_ids, 'admin', osc_logged_admin_id());
$this->resourcesManager->deleteResourcesIds($ids);
}
osc_add_flash_ok_message(_m('Resource deleted'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=media');
break;
default:
if (Params::getParam('iDisplayLength') == '') {
Params::setParam('iDisplayLength', 10);
}
$this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
require_once osc_admin_base_path() . 'ajax/media_processing.php';
$params = Params::getParamsAsArray("get");
$media_processing = new MediaProcessingAjax($params);
$aData = $media_processing->result($params);
$page = (int) Params::getParam('iPage');
if (count($aData['aaData']) == 0 && $page != 1) {
$total = (int) $aData['iTotalDisplayRecords'];
$maxPage = ceil($total / (int) $aData['iDisplayLength']);
$url = osc_admin_base_url(true) . '?' . $_SERVER['QUERY_STRING'];
if ($maxPage == 0) {
$url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url);
$this->redirectTo($url);
}
if ($page > 1) {
$url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url);
$this->redirectTo($url);
}
}
$this->_exportVariableToView('aMedia', $aData);
$this->doView('media/index.php');
break;
}
}
开发者ID:semul,项目名称:Osclass,代码行数:65,代码来源:media.php
示例17:
function __construct()
{
parent::__construct();
//specific things for this class
$this->localeManager = OSCLocale::newInstance();
}
开发者ID:naneri,项目名称:Osclass,代码行数:6,代码来源:languages.php
示例18: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add':
$this->doView("plugins/add.php");
break;
case 'add_post':
$package = Params::getFiles("package");
$path = osc_plugins_path();
(int) ($status = osc_unzip_file($package['tmp_name'], $path));
switch ($status) {
case 0:
$msg = _m('The plugin folder is not writable');
break;
case 1:
$msg = _m('The plugin has been uploaded correctly');
break;
case 2:
$msg = _m('The zip file is not valid');
break;
case -1:
default:
$msg = _m('There was a problem adding the plugin');
break;
}
osc_add_flash_message($msg, 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'install':
$pn = Params::getParam("plugin");
Plugins::activate($pn);
//run this after installing the plugin
Plugins::runHook('install_' . $pn);
osc_add_flash_message(_m('Plugin installed'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'uninstall':
$pn = Params::getParam("plugin");
Plugins::runHook($pn . '_uninstall');
Plugins::deactivate($pn);
osc_add_flash_message(_m('Plugin uninstalled'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'admin':
global $active_plugins;
$plugin = Params::getParam("plugin");
if ($plugin != "") {
Plugins::runHook($plugin . '_configure');
}
break;
case 'admin_post':
Plugins::runHook('admin_post');
case 'renderplugin':
global $active_plugins;
$file = Params::getParam("file");
if ($file != "") {
// We pass the GET variables (in case we have somes)
if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
$file = $match[1];
if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
//$_GET[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
//$_REQUEST[$get_vars[1][$var_k]] = $get_vars[2][$var_k];
Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
}
}
} else {
$file = $_REQUEST['file'];
}
$this->_exportVariableToView("file", osc_plugins_path() . $file);
//osc_renderPluginView($file);
$this->doView("plugins/view.php");
}
break;
case 'configure':
$plugin = Params::getParam("plugin");
if ($plugin != '') {
$plugin_data = Plugins::getInfo($plugin);
$this->_exportVariableToView("categories", Category::newInstance()->toTreeAll());
$this->_exportVariableToView("selected", PluginCategory::newInstance()->listSelected($plugin_data['short_name']));
$this->_exportVariableToView("plugin_data", $plugin_data);
$this->doView("plugins/configuration.php");
} else {
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
}
break;
case 'configure_post':
$plugin_short_name = Params::getParam("plugin_short_name");
$categories = Params::getParam("categories");
if ($plugin_short_name != "") {
Plugins::cleanCategoryFromPlugin($plugin_short_name);
if (isset($categories)) {
Plugins::addToCategoryPlugin($categories, $plugin_short_name);
}
} else {
osc_add_flash_message(_m('No plugin selected'), 'admin');
$this->doView("plugins/index.php");
}
//.........这里部分代码省略.........
开发者ID:hashemgamal,项目名称:OSClass,代码行数:101,代码来源:plugins.php
示例19: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add':
$this->doView("plugins/add.php");
break;
case 'add_post':
if (defined('DEMO')) {
osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
}
$package = Params::getFiles("package");
if (isset($package['size']) && $package['size'] != 0) {
$path = osc_plugins_path();
(int) ($status = osc_unzip_file($package['tmp_name'], $path));
} else {
$status = 3;
}
switch ($status) {
case 0:
$msg = _m('The plugin folder is not writable');
osc_add_flash_error_message($msg, 'admin');
break;
case 1:
$msg = _m('The plugin has been uploaded correctly');
osc_add_flash_ok_message($msg, 'admin');
break;
case 2:
$msg = _m('The zip file is not valid');
osc_add_flash_error_message($msg, 'admin');
break;
case 3:
$msg = _m('No file was uploaded');
osc_add_flash_error_message($msg, 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins&action=add");
break;
case -1:
default:
$msg = _m('There was a problem adding the plugin');
osc_add_flash_error_message($msg, 'admin');
break;
}
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'install':
$pn = Params::getParam("plugin");
// CATCH FATAL ERRORS
$old_value = error_reporting(0);
register_shutdown_function(array($this, 'errorHandler'), $pn);
$installed = Plugins::install($pn);
if ($installed) {
//run this after installing the plugin
Plugins::runHook('install_' . $pn);
osc_add_flash_ok_message(_m('Plugin installed'), 'admin');
} else {
osc_add_flash_error_message(_m('Error: Plugin already installed'), 'admin');
}
error_reporting($old_value);
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'uninstall':
$pn = Params::getParam("plugin");
Plugins::runHook($pn . '_uninstall');
Plugins::uninstall($pn);
osc_add_flash_ok_message(_m('Plugin uninstalled'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'enable':
$pn = Params::getParam("plugin");
// CATCH FATAL ERRORS
$old_value = error_reporting(0);
register_shutdown_function(array($this, 'errorHandler'), $pn);
$enabled = Plugins::activate($pn);
if ($enabled) {
Plugins::runHook($pn . '_enable');
osc_add_flash_ok_message(_m('Plugin enabled'), 'admin');
} else {
osc_add_flash_error_message(_m('Error: Plugin already enabled'), 'admin');
}
error_reporting($old_value);
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'disable':
$pn = Params::getParam("plugin");
Plugins::runHook($pn . '_disable');
Plugins::deactivate($pn);
osc_add_flash_ok_message(_m('Plugin disabled'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
break;
case 'admin':
global $active_plugins;
$plugin = Params::getParam
|
请发表评论