本文整理汇总了PHP中AdminSecBaseModel类的典型用法代码示例。如果您正苦于以下问题:PHP AdminSecBaseModel类的具体用法?PHP AdminSecBaseModel怎么用?PHP AdminSecBaseModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AdminSecBaseModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
}
示例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");
}
}
示例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");
}
}
示例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';
}
}
}
示例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');
}
}
示例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");
}
}
示例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;
}
}
示例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;
}
}
示例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");
}
}
示例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;
}
}
示例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;
}
}
示例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');
}
}
示例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');
}
//.........这里部分代码省略.........
示例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');
}
}
}
//.........这里部分代码省略.........
示例15:
function __construct()
{
parent::__construct();
}