本文整理汇总了PHP中module_form::confirm_delete方法的典型用法代码示例。如果您正苦于以下问题:PHP module_form::confirm_delete方法的具体用法?PHP module_form::confirm_delete怎么用?PHP module_form::confirm_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module_form
的用法示例。
在下文中一共展示了module_form::confirm_delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
if ('save_extra_default' == $_REQUEST['_process']) {
if (!module_config::can_i('edit', 'Settings')) {
die('No perms to save extra field settings.');
}
if (isset($_REQUEST['butt_del'])) {
if (module_form::confirm_delete('extra_default_id', _l("Really delete this extra field and ALL extra data linked to this field?"), $_SERVER['REQUEST_URI'])) {
$extra_default = module_extra::get_extra_default($_REQUEST['extra_default_id']);
if ($extra_default && $extra_default['extra_default_id'] == $_REQUEST['extra_default_id'] && $extra_default['owner_table'] && $extra_default['extra_key']) {
$extra_values = get_multiple('extra', array('owner_table' => $extra_default['owner_table'], 'extra_key' => $extra_default['extra_key']), 'extra_id', 'exact', 'owner_id');
if ($extra_values) {
foreach ($extra_values as $extra_value) {
if ($extra_value['owner_table'] == $extra_default['owner_table'] && $extra_value['extra_key'] == $extra_default['extra_key']) {
delete_from_db('extra', 'extra_id', $extra_value['extra_id']);
}
}
}
}
delete_from_db('extra_default', 'extra_default_id', $_REQUEST['extra_default_id']);
set_message('Extra field deleted successfully.');
redirect_browser(str_replace('extra_default_id', 'extra_default_id_deleted', $_SERVER['REQUEST_URI']));
}
}
if ((int) $_REQUEST['extra_default_id'] > 0) {
$extra_default = module_extra::get_extra_default($_REQUEST['extra_default_id']);
if ($extra_default && $extra_default['extra_default_id'] == $_REQUEST['extra_default_id'] && $extra_default['owner_table'] && $extra_default['extra_key']) {
if (isset($_POST['extra_key']) && !empty($_POST['extra_key']) && $_POST['extra_key'] != $extra_default['extra_key']) {
// they have renamed the key, rename all the existing ones in the system.
$extra_values = get_multiple('extra', array('owner_table' => $extra_default['owner_table'], 'extra_key' => $extra_default['extra_key']), 'extra_id', 'exact', 'owner_id');
if ($extra_values) {
foreach ($extra_values as $extra_value) {
if ($extra_value['owner_table'] == $extra_default['owner_table'] && $extra_value['extra_key'] == $extra_default['extra_key']) {
update_insert('extra_id', $extra_value['extra_id'], 'extra', array('extra_key' => $_POST['extra_key']));
}
}
}
}
}
}
$data = $_POST;
if (isset($data['options']) && is_array($data['options'])) {
$data['options'] = json_encode($data['options']);
}
update_insert('extra_default_id', $_REQUEST['extra_default_id'], 'extra_default', $data);
set_message('Extra field saved successfully');
redirect_browser($_SERVER['REQUEST_URI']);
}
}
示例2: process
public function process()
{
/*if('save_data_access_popup' == $_REQUEST['_process']){
// saving data access for specieid user id.
// get user id from post.
// todo - make this secure, check current user has permissions to access security :)
// dodgy dave.
$user_id = (int)$_REQUEST['user_id'];
if($user_id && $_REQUEST['access_level']){
$sql = "UPDATE `"._DB_PREFIX."security_access` SET `access_level` = '".(int)$_REQUEST['access_level']."' WHERE user_id = '".$user_id."' LIMIT 1";
query($sql);
}
if($user_id && is_array($_REQUEST['data_access'])){
$sql = "UPDATE `"._DB_PREFIX."security_access` SET `data_access` = '".mysql_real_escape_string(serialize($_REQUEST['data_access']))."' WHERE user_id = '".$user_id."' LIMIT 1";
query($sql);
}
}else */
if ('save_security_role' == $_REQUEST['_process']) {
if (!module_config::can_i('edit', 'Settings')) {
redirect_browser(_BASE_HREF);
}
if (!module_security::can_i('edit', 'Security Roles', 'Security')) {
redirect_browser('/');
}
if (isset($_REQUEST['butt_del']) && module_security::can_i('delete', 'Security Roles', 'Security')) {
$security_role_id = (int) $_REQUEST['security_role_id'];
$role = self::get_security_role($security_role_id);
if ($role && $security_role_id == $role['security_role_id']) {
if (module_form::confirm_delete('security_role_id', "Really delete security role: " . $role['name'], self::link_open_role($security_role_id))) {
$sql = "DELETE FROM `" . _DB_PREFIX . "security_role_perm` WHERE security_role_id = '" . (int) $security_role_id . "'";
query($sql);
$sql = "DELETE FROM `" . _DB_PREFIX . "user_role` WHERE security_role_id = '" . (int) $security_role_id . "'";
query($sql);
$sql = "DELETE FROM `" . _DB_PREFIX . "security_role` WHERE security_role_id = '" . (int) $security_role_id . "'";
query($sql);
}
}
set_message('Role deleted successfully.');
redirect_browser($this->link_open_role(false));
}
$security_role_id = update_insert('security_role_id', $_REQUEST['security_role_id'], 'security_role', $_POST);
// todo - deleting.
if ($security_role_id) {
$sql = "DELETE FROM `" . _DB_PREFIX . "security_role_perm` WHERE security_role_id = '" . (int) $security_role_id . "'";
query($sql);
if (isset($_REQUEST['load_defaults']) && strlen($_REQUEST['load_defaults']) > 0 && ($defaults = json_decode($_REQUEST['load_defaults'], true))) {
//$export_json[$available_permission['category'].'|'.$available_permission['module'].'|'.$available_permission['name'].'|'.$available_permission['description']][] = $permission;
foreach ($defaults as $key => $permissions) {
list($category, $module, $name, $description) = explode('|', $key);
$existing = get_single('security_permission', array('name', 'category', 'description', 'module'), array($name, $category, $description, $module));
$security_permission_id = false;
$available_perms = array();
if ($existing) {
$security_permission_id = $existing['security_permission_id'];
$available_perms = @unserialize($existing['available_perms']);
if (!is_array($available_perms)) {
$available_perms = array();
}
}
if (!$security_permission_id) {
$security_permission_id = update_insert('security_permission_id', 'new', 'security_permission', array('name' => $name, 'category' => $category, 'module' => $module, 'description' => $description));
}
$save_perms = false;
foreach (self::$available_permissions as $permission) {
if (in_array($permission, $permissions)) {
// the script is asking for this available permission.
// check if it exists in the db as an option
if (!isset($available_perms[$permission])) {
// time to add it to the db so we can configure this in the future.
$available_perms[$permission] = true;
$save_perms = true;
}
}
}
if ($save_perms && $security_permission_id) {
update_insert('security_permission_id', $security_permission_id, 'security_permission', array('available_perms' => serialize($available_perms)));
}
if ($security_permission_id) {
$actions = array();
foreach (self::$available_permissions as $permission) {
if (in_array($permission, $permissions)) {
$actions[$permission] = 1;
}
}
if (count($actions)) {
$sql = "REPLACE INTO `" . _DB_PREFIX . "security_role_perm` SET security_role_id = '" . (int) $security_role_id . "', security_permission_id = '" . (int) $security_permission_id . "' ";
foreach ($actions as $permission => $tf) {
$sql .= ", `" . mysql_real_escape_string($permission) . "` = 1";
}
query($sql);
}
}
}
set_message('Defaults loaded successfully.');
} else {
if (isset($_REQUEST['permission']) && is_array($_REQUEST['permission'])) {
// update permissions for this role.
foreach ($_REQUEST['permission'] as $security_permission_id => $permissions) {
$actions = array();
//.........这里部分代码省略.........
示例3: process
public function process()
{
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && $_REQUEST['subscription_id']) {
$data = self::get_subscription($_REQUEST['subscription_id']);
if (module_form::confirm_delete('subscription_id', "Really delete subscription: " . $data['name'], self::link_open($_REQUEST['subscription_id']))) {
$this->delete_subscription($_REQUEST['subscription_id']);
set_message("Subscription deleted successfully");
redirect_browser(self::link_open(false));
}
} else {
if ("save_subscription" == $_REQUEST['_process']) {
$subscription_id = $this->save_subscription($_REQUEST['subscription_id'], $_POST);
set_message("Subscription saved successfully");
redirect_browser(self::link_open($subscription_id));
}
}
}
示例4: process
public function process()
{
if ('save_backup' == $_REQUEST['_process']) {
if (!module_backup::can_i('edit', 'Backups')) {
die('No perms to save backup.');
}
if (!module_form::check_secure_key()) {
die('Invalid auth');
}
if (_DEMO_MODE) {
die('Sorry, cannot make backups in demo mode.cd ');
}
$backup_id = update_insert('backup_id', $_REQUEST['backup_id'], 'backup', $_POST);
if (isset($_REQUEST['butt_del']) && self::can_i('delete', 'Backups')) {
// and the file.
$backup = $this->get_backup($backup_id);
if ($backup && $backup['backup_id'] == $backup_id && module_form::confirm_delete('backup_id', _l('Really delete this backup?'), self::link_open($backup_id))) {
if (isset($backup['backup_file']) && strlen($backup['backup_file'])) {
if (file_exists(_BACKUP_BASE_DIR . basename($backup['backup_file']) . '.sql')) {
@unlink(_BACKUP_BASE_DIR . basename($backup['backup_file']) . '.sql');
}
if (file_exists(_BACKUP_BASE_DIR . basename($backup['backup_file']) . '.sql.gz')) {
@unlink(_BACKUP_BASE_DIR . basename($backup['backup_file']) . '.sql.gz');
}
if (file_exists(_BACKUP_BASE_DIR . basename($backup['backup_file']) . '.zip')) {
@unlink(_BACKUP_BASE_DIR . basename($backup['backup_file']) . '.zip');
}
}
delete_from_db('backup', 'backup_id', $backup['backup_id']);
set_message('Backup deleted successfully.');
redirect_browser($this->link_open(false));
}
}
set_message('Backup saved successfully');
redirect_browser($this->link_open($backup_id));
}
}
示例5: process
public function process()
{
$errors = array();
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && $_REQUEST['report_id']) {
$data = self::get_report($_REQUEST['report_id']);
if (module_form::confirm_delete('report_id', "Really delete " . _l('Report') . ": " . $data['name'], self::link_open($_REQUEST['report_id']))) {
$this->delete_report($_REQUEST['report_id']);
set_message(_l('Report') . " deleted successfully");
redirect_browser(self::link_open(false));
}
} else {
if ("save_report" == $_REQUEST['_process']) {
$report_id = $this->save_report($_REQUEST['report_id'], $_POST);
$_REQUEST['_redirect'] = $this->link_open($report_id);
set_message(_l('Report') . " saved successfully");
}
}
if (!count($errors)) {
redirect_browser($_REQUEST['_redirect']);
exit;
}
print_error($errors, true);
}
示例6: bulk_handle_delete
public static function bulk_handle_delete()
{
if (isset($_REQUEST['bulk_action']) && isset($_REQUEST['bulk_action']['delete']) && $_REQUEST['bulk_action']['delete'] == 'yes' && module_form::check_secure_key() && module_invoice::can_i('delete', 'Invoices')) {
// confirm deletion of these tickets:
$invoice_ids = isset($_REQUEST['invoice_bulk_operation']) && is_array($_REQUEST['invoice_bulk_operation']) ? $_REQUEST['invoice_bulk_operation'] : array();
foreach ($invoice_ids as $invoice_id => $k) {
if ($k != 'yes') {
unset($invoice_ids[$invoice_id]);
} else {
$invoice_ids[$invoice_id] = module_invoice::link_open($invoice_id, true);
}
}
if (count($invoice_ids) > 0) {
if (module_form::confirm_delete('invoice_id', _l("Really delete invoices: %s", implode(', ', $invoice_ids)), self::link_open(false))) {
foreach ($invoice_ids as $invoice_id => $invoice_number) {
self::delete_invoice($invoice_id);
}
set_message(_l("%s invoices deleted successfully", count($invoice_ids)));
redirect_browser(self::link_open(false));
}
}
}
}
示例7: save_data_record
function save_data_record()
{
$data = $_POST;
$data_record_id = isset($data['data_record_id']) ? $data['data_record_id'] : false;
$data_type_id = (int) $data['data_type_id'];
if (!$data_type_id) {
set_error(_l('Sorry no data type set'));
return false;
}
$data_type = $this->get_data_type($data_type_id);
if ((!$data_record_id || $data_record_id == 'new') && !$this->can_i('create', $data_type['data_type_name'])) {
set_error('No permissions to create data');
return false;
} else {
if ((int) $data_record_id > 0 && !$this->can_i('edit', $data_type['data_type_name'])) {
set_error('No permissions to edit data');
return false;
} else {
if ((int) $data_record_id > 0 && !$this->can_i('delete', $data_type['data_type_name']) && isset($_POST['butt_del'])) {
set_error('No permissions to delete data');
return false;
} else {
if ((int) $data_record_id > 0 && $this->can_i('delete', $data_type['data_type_name']) && isset($_POST['butt_del'])) {
if (module_form::confirm_delete('data_record_id', "Really delete this entire data record?", $this->link('', array("data_record_id" => $data_record_id)))) {
$this->delete_data_record($data_record_id);
set_error(_l("Data deleted successfully"));
redirect_browser($this->link());
}
}
}
}
}
if (!isset($data['save_data_group']) || !is_array($data['save_data_group'])) {
// no information to save?? error
set_error(_l('Sorry no group found to save'));
return false;
}
if ((!isset($data['data_field']) || !is_array($data['data_field']) || !count($data['data_field'])) && !isset($_FILES['data_field']['tmp_name'])) {
set_error(_l('Sorry, no data found to save'));
return false;
}
if (isset($_REQUEST['form_id']) && $_REQUEST['form_id']) {
$form_id = $_REQUEST['form_id'];
} else {
$form_id = 'default';
}
$_SESSION['_form_highlight'][$form_id] = array();
//unset($data['data_type_id']);
// first we check for required fields missing in the data field array.
// return false on error, and set the error fields in session so they can be highligted on re-render
$data_field_groups = $this->get_data_field_groups($data_type_id);
$allowed_to_save = array();
// an array of fields we are allowed to save in this save call.
$missing_required_fields = array();
$missing_required_fields_names = array();
$all_data_fields = array();
// for history cache.
foreach ($data_field_groups as $data_field_group) {
// check if the user is posting data for this field.
$data_field_group_id = $data_field_group['data_field_group_id'];
if (isset($data['save_data_group'][$data_field_group_id]) && $data['save_data_group'][$data_field_group_id]) {
$data_fields = $this->get_data_fields($data_field_group_id);
$all_data_fields[$data_field_group_id] = $data_fields;
// loop over all fields, and ensure the ones that are required are present.
foreach ($data_fields as $data_field) {
$data_field_id = $data_field['data_field_id'];
if ($data_field['required']) {
// depending on the type of field, there are different ways to
// check if the required field has been inserted.
switch ($data_field['field_type']) {
case 'radio':
case 'checkbox_list':
if (isset($data['data_field'][$data_field_id]) && strtolower($data['data_field'][$data_field_id]) == 'other' && (!isset($data['other_data_field'][$data_field_id]) || !$data['other_data_field'][$data_field_id])) {
$missing_required_fields[$data_field_id] = 'other';
$missing_required_fields_names[$data_field_id] = $data_field['title'];
} else {
if (!isset($data['data_field'][$data_field_id]) || !$data['data_field'][$data_field_id]) {
$missing_required_fields[$data_field_id] = true;
}
}
break;
case 'file':
if (!is_uploaded_file($_FILES['data_field']['tmp_name'][$data_field_id])) {
$missing_required_fields[$data_field_id] = true;
$missing_required_fields_names[$data_field_id] = $data_field['title'];
}
break;
case 'created_date_time':
case 'created_date':
case 'created_time':
case 'updated_date_time':
case 'updated_date':
case 'updated_time':
case 'created_by':
case 'updated_by':
break;
default:
// normal text field etc..
if (!isset($data['data_field'][$data_field_id]) || !$data['data_field'][$data_field_id]) {
$missing_required_fields[$data_field_id] = true;
//.........这里部分代码省略.........
示例8: _handle_save_template
private function _handle_save_template()
{
// handle post back for save template template.
$template_id = (int) $_REQUEST['template_id'];
// delete.
if (isset($_REQUEST['butt_del']) && self::can_i('delete', 'Templates')) {
$template_data = self::get_template($template_id);
if (module_form::confirm_delete('template_id', _l("Really delete template: %s", $template_data['template_key']), self::link_open($template_id))) {
$this->delete($template_id);
// todo: delete company template as well if exists.
set_message("Template deleted successfully");
redirect_browser(self::link_open(false));
}
}
$data = $_POST;
$already_saved = false;
if ((int) $template_id > 0 && class_exists('module_company', false)) {
module_company::template_handle_save($template_id, $data);
// we have to redirect to a company specific version of this template
// each company template must have a matching parent template id/key. cannot change keys in company unique config.
}
// write header/footer html based on uploaded images.
// pass uploaded images to the file manager plugin.
$template_id = update_insert('template_id', $template_id, 'template', $data);
// redirect upon save.
set_message('Template saved successfully!');
if (isset($_REQUEST['return']) && $_REQUEST['return']) {
redirect_browser($_REQUEST['return']);
}
redirect_browser($this->link_open($template_id));
exit;
}
示例9: handle_bulk_delete_double_optin
public static function handle_bulk_delete_double_optin($rows)
{
$delete = array();
foreach ($rows as $member_to_delete) {
$newsletter_member_id = module_newsletter::member_from_email($member_to_delete, false);
if ($newsletter_member_id) {
if ($res = module_newsletter::is_member_unsubscribed($newsletter_member_id, $member_to_delete)) {
if (class_exists('module_subscription', false)) {
// check this isn't a member from a subscription or something.
$sub = module_subscription::get_subscriptions_by('member', $member_to_delete['member_id']);
if (count($sub)) {
continue;
}
}
if (isset($res['reason']) && $res['reason'] == 'doubleoptin') {
//delete this onee!
$delete[] = array('member_id' => $member_to_delete['member_id']);
}
}
}
}
if (module_form::confirm_delete('bulk_optin_array', "Really delete all " . count($delete) . " failed double-opt-in members?", $_SERVER['REQUEST_URI'])) {
foreach ($delete as $member_to_delete) {
self::delete_member($member_to_delete['member_id']);
}
set_message("Selected members deleted successfully");
redirect_browser(self::link_open(false));
}
}
示例10: process
/** methods */
public function process()
{
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && !empty($_REQUEST['customer_id']) && module_customer::can_i('delete', 'Customers')) {
if (module_form::check_secure_key()) {
$data = self::get_customer($_REQUEST['customer_id']);
if ($data['customer_id'] && ($data['customer_id'] = $_REQUEST['customer_id'])) {
if (module_form::confirm_delete('customer_id', _l("Really delete customer: %s", $data['customer_name']), self::link_open($_REQUEST['customer_id']), array('options' => array(array('label' => _l('Also delete all Customer %s, Jobs, Invoices, Tickets and Files', module_config::c('project_name_plural')), 'name' => 'delete_others', 'type' => 'checkbox', 'value' => 1, 'checked' => true))))) {
$this->delete_customer($_REQUEST['customer_id'], isset($_REQUEST['delete_others']) && $_REQUEST['delete_others']);
set_message("Customer deleted successfully");
redirect_browser(self::link_open(false));
}
}
}
} else {
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && !empty($_REQUEST['customer_type_id'])) {
if (module_form::check_secure_key()) {
$data = self::get_customer_type($_REQUEST['customer_type_id']);
if ($data['customer_type_id'] && ($data['customer_type_id'] = $_REQUEST['customer_type_id'])) {
if (module_form::confirm_delete('customer_type_id', _l("Really delete customer type: %s", $data['type_name']), self::link_open_customer_type($_REQUEST['customer_type_id']))) {
delete_from_db('customer_type', 'customer_type_id', $data['customer_type_id']);
$sql = "UPDATE `" . _DB_PREFIX . "customer` SET `customer_type_id` = 0 WHERE `customer_type_id` = " . (int) $data['customer_type_id'];
query($sql);
set_message("Customer type deleted successfully");
redirect_browser(self::link_open_customer_type(false));
}
}
}
} else {
if ("ajax_contact_list" == $_REQUEST['_process']) {
$customer_id = isset($_REQUEST['customer_id']) ? (int) $_REQUEST['customer_id'] : 0;
$res = module_user::get_contacts(array('customer_id' => $customer_id));
$options = array();
foreach ($res as $row) {
$options[$row['user_id']] = $row['name'] . ' ' . $row['last_name'];
}
echo json_encode($options);
exit;
} else {
if ("save_customer" == $_REQUEST['_process']) {
$customer_id = $this->save_customer($_REQUEST['customer_id'], $_POST);
hook_handle_callback('customer_save', $customer_id);
if (isset($_REQUEST['butt_send_email'])) {
redirect_browser(self::link_open($customer_id) . '&email=1');
} else {
set_message("Customer saved successfully");
redirect_browser(isset($_REQUEST['_redirect']) && !empty($_REQUEST['_redirect']) ? $_REQUEST['_redirect'] : self::link_open($customer_id));
}
} else {
if ("save_customer_type" == $_REQUEST['_process']) {
$customer_type_id = $this->save_customer_type($_REQUEST['customer_type_id'], $_POST);
hook_handle_callback('customer_save_type', $customer_type_id);
set_message("Customer saved successfully");
redirect_browser(isset($_REQUEST['_redirect']) && !empty($_REQUEST['_redirect']) ? $_REQUEST['_redirect'] : self::link_open_customer_type($customer_type_id));
}
}
}
}
}
}
示例11: process
public function process()
{
if (_DEMO_MODE && isset($_REQUEST['user_id']) && (int) $_REQUEST['user_id'] > 0 && (int) $_REQUEST['user_id'] <= 4) {
set_error('Sorry no changes to demo users. Please create a new user.');
redirect_browser($this->link_open($_REQUEST['user_id']));
}
$errors = array();
if (isset($_REQUEST['butt_del_contact']) && $_REQUEST['butt_del_contact'] && $_REQUEST['user_id'] && $_REQUEST['user_id'] != 1 && self::can_i('delete', 'Contacts', 'Customer')) {
$data = self::get_user($_REQUEST['user_id']);
if (module_form::confirm_delete('user_id', "Really delete contact: " . $data['name'], self::link_open_contact($_REQUEST['user_id']))) {
$this->delete_user($_REQUEST['user_id']);
set_message("Contact deleted successfully");
redirect_browser(module_customer::link_open($data['customer_id']));
}
} else {
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && $_REQUEST['user_id'] && self::can_i('delete', 'Users', 'Config')) {
$data = self::get_user($_REQUEST['user_id']);
if (module_form::confirm_delete('user_id', "Really delete user: " . $data['name'], self::link_open($_REQUEST['user_id']))) {
$this->delete_user($_REQUEST['user_id']);
set_message("User deleted successfully");
redirect_browser(self::link_open(false));
}
} else {
if ("save_user" == $_REQUEST['_process']) {
$user_id = (int) $_REQUEST['user_id'];
if ($user_id == 1 && module_security::get_loggedin_id() != 1) {
set_error('Sorry, only the Administrator can access this page.');
redirect_browser(_UCM_HOST . _BASE_HREF);
}
// check create permissions.
$use_master_key = $this->get_contact_master_key();
// are we creating or editing a user?
if (!$user_id) {
$method = 'create';
} else {
$method = 'edit';
$existing_user = module_user::get_user($user_id, true, false);
if (!$existing_user || $existing_user['user_id'] != $user_id) {
$user_id = false;
$method = 'create';
}
}
if (isset($_POST[$use_master_key]) && $_POST[$use_master_key]) {
if (!module_user::can_i($method, 'Contacts', 'Customer')) {
set_error('No permissions to ' . $method . ' contacts');
redirect_browser(module_customer::link_open($_POST['customer_id']));
}
} else {
if (!module_user::can_i($method, 'Users', 'Config')) {
set_error('No permissions to ' . $method . ' users');
redirect_browser(module_user::link_open(false));
}
}
$user_id = $this->save_user($user_id, $_POST);
if ($use_master_key && isset($_REQUEST[$use_master_key]) && $_REQUEST[$use_master_key]) {
set_message("Customer contact saved successfully");
redirect_browser($this->link_open_contact($user_id));
} else {
set_message("User saved successfully");
redirect_browser($this->link_open($user_id));
}
}
}
}
/*else if("save_contact" == $_REQUEST['_process']){
$user_id = $this->save_contact($_POST['user_id'],$_POST);
$_REQUEST['_redirect'] = $this->link_open_contact(false);
if($user_id){
set_message("Contact saved successfully");
}else{
// todo error creating contact
}
}*/
if (!count($errors)) {
redirect_browser($_REQUEST['_redirect']);
exit;
}
print_error($errors, true);
}
示例12: process
public function process()
{
if ("save_twitter" == $_REQUEST['_process']) {
$social_twitter_id = isset($_REQUEST['social_twitter_id']) ? (int) $_REQUEST['social_twitter_id'] : 0;
$twitter = new ucm_twitter_account($social_twitter_id);
if (isset($_POST['butt_del']) && module_social::can_i('delete', 'Twitter', 'Social', 'social')) {
if (module_form::confirm_delete('social_twitter_id', "Really delete this Twitter account from the system? All messages will be lost.", self::link_open($_REQUEST['social_twitter_id']))) {
$twitter->delete();
set_message("Twitter account deleted successfully");
redirect_browser(self::link_open(false));
}
}
$twitter->save_data($_POST);
$social_twitter_id = $twitter->get('social_twitter_id');
if (isset($_POST['butt_save_connect'])) {
$redirect = $this->link_open($social_twitter_id, false, false, 'twitter_account_connect');
} else {
set_message('Twitter account saved successfully');
$redirect = $this->link_open($social_twitter_id);
}
redirect_browser($redirect);
exit;
} else {
if ("send_twitter_message" == $_REQUEST['_process']) {
if (module_form::check_secure_key()) {
// queue the message into the twitter_message table
// if there's a scheduled date in the past we send it in the past, no date we send straight away, date in the future we leave it in the db table for the cron job to pick up.
//print_r($_POST);exit;
$send_time = false;
// default: now
if (isset($_POST['schedule_date']) && isset($_POST['schedule_time']) && !empty($_POST['schedule_date']) && !empty($_POST['schedule_time'])) {
$date = $_POST['schedule_date'];
$time_hack = $_POST['schedule_time'];
$time_hack = str_ireplace('am', '', $time_hack);
$time_hack = str_ireplace('pm', '', $time_hack);
$bits = explode(':', $time_hack);
if (strpos($_POST['schedule_time'], 'pm')) {
$bits[0] += 12;
}
// add the time if it exists
$date .= ' ' . implode(':', $bits) . ':00';
$send_time = strtotime(input_date($date, true));
} else {
if (isset($_POST['schedule_date']) && !empty($_POST['schedule_date'])) {
$send_time = strtotime(input_date($_POST['schedule_date'], true));
}
}
//echo print_date($send_time,true);
//echo '<br>';
//echo date('c',$send_time);
//exit;
$send_accounts = isset($_POST['compose_account_id']) && is_array($_POST['compose_account_id']) ? $_POST['compose_account_id'] : array();
$page_count = 0;
$last_twitter_account_id = false;
if ($send_accounts) {
foreach ($send_accounts as $twitter_account_id => $tf) {
if (!$tf) {
continue;
}
// see if this is an available account.
$twitter_account = new ucm_twitter_account($twitter_account_id);
//todo: check permissiont o access thi saccount
if ($twitter_account->get('social_twitter_id') == $twitter_account_id) {
// push to db! then send.
$last_twitter_account_id = $twitter_account_id;
$twitter_message = new ucm_twitter_message($twitter_account, false);
$twitter_message->create_new();
$twitter_message->update('social_twitter_id', $twitter_account->get('social_twitter_id'));
$twitter_message->update('summary', isset($_POST['message']) ? $_POST['message'] : '');
$twitter_message->update('type', 'pending');
$twitter_message->update('data', json_encode($_POST));
$twitter_message->update('user_id', module_security::get_loggedin_id());
// do we send this one now? or schedule it later.
$twitter_message->update('status', _SOCIAL_MESSAGE_STATUS_PENDINGSEND);
if ($send_time) {
// schedule for sending at a different time (now or in the past)
$twitter_message->update('message_time', $send_time);
} else {
// send it now.
$twitter_message->update('message_time', 0);
}
if (isset($_FILES['picture']['tmp_name']) && is_uploaded_file($_FILES['picture']['tmp_name'])) {
$twitter_message->add_attachment($_FILES['picture']['tmp_name']);
}
$twitter_message->send_queued(isset($_POST['debug']) && $_POST['debug']);
$page_count++;
} else {
// log error?
}
}
}
set_message(_l('Message delivered successfully to %s Twitter accounts', $page_count));
$redirect = $this->link_open_message_view($last_twitter_account_id);
redirect_browser($redirect);
}
exit;
} else {
if ("ajax_social_twitter" == $_REQUEST['_process']) {
// ajax functions from wdsocial. copied from the datafeed.php sample files.
header('Content-type: text/javascript');
//.........这里部分代码省略.........
示例13: process
/** methods */
public function process()
{
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && $_REQUEST['vendor_id'] && module_vendor::can_i('delete', 'Companies')) {
$data = self::get_vendor($_REQUEST['vendor_id']);
if ($data['vendor_id'] && ($data['vendor_id'] = $_REQUEST['vendor_id'])) {
if (module_form::confirm_delete('vendor_id', _l("Really delete vendor: %s", $data['vendor_name']), self::link_open($_REQUEST['vendor_id']), array('options' => array(array('label' => _l('Also delete all Vendor %s, Jobs, Invoices, Tickets and Files', module_config::c('project_name_plural')), 'name' => 'delete_others', 'type' => 'checkbox', 'value' => 1, 'checked' => true))))) {
$this->delete_vendor($_REQUEST['vendor_id'], isset($_REQUEST['delete_others']) && $_REQUEST['delete_others']);
set_message("Vendor deleted successfully");
redirect_browser(self::link_open(false));
}
}
} else {
if ("ajax_contact_list" == $_REQUEST['_process']) {
$vendor_id = isset($_REQUEST['vendor_id']) ? (int) $_REQUEST['vendor_id'] : 0;
$res = module_user::get_contacts(array('vendor_id' => $vendor_id));
$options = array();
foreach ($res as $row) {
$options[$row['user_id']] = $row['name'] . ' ' . $row['last_name'];
}
echo json_encode($options);
exit;
} else {
if ("save_vendor" == $_REQUEST['_process']) {
$vendor_id = $this->save_vendor($_REQUEST['vendor_id'], $_POST);
hook_handle_callback('vendor_save', $vendor_id);
set_message("Vendor saved successfully");
redirect_browser(isset($_REQUEST['_redirect']) && !empty($_REQUEST['_redirect']) ? $_REQUEST['_redirect'] : self::link_open($vendor_id));
}
}
}
}
示例14: process
public function process()
{
$errors = array();
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && $_REQUEST['website_id']) {
$data = self::get_website($_REQUEST['website_id']);
if (module_form::confirm_delete('website_id', "Really delete " . module_config::c('project_name_single', 'Website') . ": " . $data['name'], self::link_open($_REQUEST['website_id']))) {
$this->delete_website($_REQUEST['website_id']);
set_message(module_config::c('project_name_single', 'Website') . " deleted successfully");
redirect_browser(self::link_open(false));
}
} else {
if ("save_website" == $_REQUEST['_process']) {
$website_id = $this->save_website($_REQUEST['website_id'], $_POST);
hook_handle_callback('website_save', $website_id);
$_REQUEST['_redirect'] = $this->link_open($website_id);
set_message(module_config::c('project_name_single', 'Website') . " saved successfully");
}
}
if (!count($errors)) {
redirect_browser($_REQUEST['_redirect']);
exit;
}
print_error($errors, true);
}
示例15: process
public function process()
{
$errors = array();
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && $_REQUEST['newsletter_id']) {
$data = self::get_newsletter($_REQUEST['newsletter_id']);
if (module_form::confirm_delete('newsletter_id', "Really delete newsletter: " . $data['subject'], self::link_open($_REQUEST['newsletter_id']))) {
$this->delete_newsletter($_REQUEST['newsletter_id']);
set_message("Newsletter deleted successfully");
redirect_browser(self::link_list(false));
}
} else {
if ("save_newsletter" == $_REQUEST['_process']) {
$newsletter_id = isset($_REQUEST['newsletter_id']) ? (int) $_REQUEST['newsletter_id'] : false;
$newsletter_id = $this->save_newsletter($newsletter_id, $_POST);
if (isset($_REQUEST['butt_send'])) {
redirect_browser($this->link_send($newsletter_id));
}
if (isset($_REQUEST['butt_duplicate'])) {
$newsletter_id = $this->duplicate_newsetter($newsletter_id);
set_message('Newsletter duplicated successfully');
redirect_browser($this->link_open($newsletter_id));
}
if (isset($_REQUEST['butt_preview_email'])) {
if ($this->send_preview($newsletter_id, $_REQUEST['quick_email'])) {
//set_message("Newsletter preview sent successfully.");
redirect_browser($this->link_open($newsletter_id));
}
/*else{
echo "<br><br>Failed to send preview. <br><br>";
echo '<a href="'.$this->link_open($newsletter_id).'">try again</a> ';
exit;
}*/
}
if (isset($_REQUEST['butt_preview'])) {
redirect_browser($this->link_preview($newsletter_id));
}
set_message("Newsletter saved successfully");
redirect_browser($this->link_open($newsletter_id));
} else {
if ("send_send" == $_REQUEST['_process']) {
$newsletter_id = (int) $_REQUEST['newsletter_id'];
$send_id = (int) $_REQUEST['send_id'];
if ($newsletter_id && $send_id) {
$sql = "UPDATE `" . _DB_PREFIX . "newsletter_send` SET `status` = " . _NEWSLETTER_STATUS_PENDING . " WHERE send_id = {$send_id} AND newsletter_id = {$newsletter_id}";
query($sql);
self::update_member_data_for_send($send_id);
self::remove_unsubscribed_members_from_send($send_id);
//ready to send
redirect_browser($this->link_queue_watch($newsletter_id, $send_id));
}
} else {
if ("modify_send" == $_REQUEST['_process']) {
$send_id = (int) $_REQUEST['send_id'];
$newsletter_id = (int) $_REQUEST['newsletter_id'];
$send = get_single('newsletter_send', array('send_id', 'newsletter_id'), array($send_id, $newsletter_id));
if (isset($_POST['status']) && $_POST['status'] == 'delete') {
if (module_form::confirm_delete('newsletter_id', "Really delete this send?", self::link_queue_watch($newsletter_id, $send_id))) {
if ($send && $send['send_id'] == $send_id) {
set_message("Newsletter send deleted successfully");
update_insert('send_id', $send_id, 'newsletter_send', array('status' => _NEWSLETTER_STATUS_DELETED));
}
redirect_browser(self::link_list(false));
}
unset($_POST['status']);
}
if (!$send['start_time']) {
$_POST['start_time'] = time();
}
// hack cos sometimes it doesn't save start time? i think i fixed this bug though.
if ($send && $send['send_id'] == $send_id) {
update_insert('send_id', $send_id, 'newsletter_send', $_POST);
redirect_browser($this->link_queue_watch($newsletter_id, $send_id));
}
} else {
if ("enque_send" == $_REQUEST['_process']) {
$newsletter_id = (int) $_REQUEST['newsletter_id'];
$send_id = (int) $_REQUEST['send_id'];
$newsletter_data = self::get_newsletter($newsletter_id);
if ($newsletter_data['newsletter_id'] != $newsletter_id) {
die('failed to enqueue send');
}
// are we adding members to an existing send? or overwriting them to an existing draft / or creating a new blank send.
if ($send_id > 0) {
$adding_members = true;
} else {
$adding_members = false;
}
$members = array();
//todo: pass this off as a hook.
// so we could have another module (eg: module_drupal or module_wordpress) that
// checks which members were selected on the previous screen, and return a standard member array
if (class_exists('module_group', false)) {
// find the groups we are sending to.
$send_groups = array();
$groups = module_group::get_groups();
foreach ($groups as $group) {
if (isset($_REQUEST['group']) && isset($_REQUEST['group'][$group['group_id']]) && $_REQUEST['group'][$group['group_id']] == 'yes') {
// we are sending to this group
// get a list of members in this group and add them to a send table ready to go.
$send_groups[$group['group_id']] = true;
//.........这里部分代码省略.........