本文整理汇总了PHP中module_config::can_i方法的典型用法代码示例。如果您正苦于以下问题:PHP module_config::can_i方法的具体用法?PHP module_config::can_i怎么用?PHP module_config::can_i使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module_config
的用法示例。
在下文中一共展示了module_config::can_i方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pre_menu
public function pre_menu()
{
if ($this->is_installed()) {
if (self::can_i('view', 'Backups') && module_config::can_i('view', 'Settings')) {
$this->links[] = array("name" => "Backups", "p" => "backup_settings", "args" => array('backup_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
}
}
}
示例2: init
public function init()
{
$this->links = array();
$this->help_types = array();
$this->module_name = "help";
$this->module_position = 16;
$this->version = 2.11;
//2.11 - 2014-04-05 - url help js
//2.1 - 2014-03-14 - initial release of new help system
if (module_help::is_plugin_enabled() && (module_config::c('help_only_for_admin', 1) && module_security::get_loggedin_id() == 1 || !module_config::c('help_only_for_admin', 1) && module_help::can_i('view', 'Help'))) {
// hook for help icon in top bar
hook_add('header_buttons', 'module_help::hook_filter_var_header_buttons');
hook_add('header_print_js', 'module_help::header_print_js');
module_config::register_js('help', 'help.js');
if (module_config::can_i('view', 'Settings')) {
$this->links[] = array("name" => "Help", "p" => "help_settings", 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
}
}
}
示例3: pre_menu
public function pre_menu()
{
if (module_config::can_i('view', 'Settings')) {
$this->links[] = array("name" => "Coinbase (bitcoin)", "p" => "coinbase_settings", 'holder_module' => 'config', 'holder_module_page' => 'config_payment', 'menu_include_parent' => 1);
}
}
示例4: foreach
<?php
/**
* Copyright: dtbaker 2012
* Licence: Please check CodeCanyon.net for licence details.
* More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
* Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
* Package Date: 2015-11-25 02:55:20
* IP Address: 67.79.165.254
*/
@set_time_limit(0);
if (!module_config::can_i('view', 'Upgrade System')) {
echo 'upgrade denied. ssorry';
exit;
}
module_config::register_css('config', 'upgrade.css', 11);
module_config::register_js('config', 'upgrade.js', 11);
require_once 'includes/plugin_config/class.upgrade.php';
$ucm_upgrade_manager = new ucm_upgrade_manager();
if (!isset($setup_upgrade_hack)) {
print_heading(array('title' => 'Upgrade System', 'type' => 'h2', 'main' => true));
}
if (isset($_REQUEST['save_license_codes']) && isset($_REQUEST['license_codes']) && is_array($_REQUEST['license_codes'])) {
$license_codes = '';
foreach ($_REQUEST['license_codes'] as $license_code) {
$license_code = trim($license_code);
if (strlen($license_code) > 5 || $license_code == 'free') {
$license_codes .= $license_code . '|';
}
}
示例5: process
public function process()
{
if ('save_template' == $_REQUEST['_process']) {
if (!module_config::can_i('edit', 'Settings')) {
die('No perms to edit Config > Settings');
}
$this->_handle_save_template();
}
}
示例6: process
public function process()
{
$errors = array();
if ('save_saved_response' == $_REQUEST['_process']) {
$data = array('value' => $_REQUEST['value']);
$saved_response_id = (int) $_REQUEST['saved_response_id'];
if ((string) $saved_response_id != (string) $_REQUEST['saved_response_id']) {
// we are saving a new response, not overwriting an old one.
$data['name'] = $_REQUEST['saved_response_id'];
$saved_response_id = 'new';
} else {
// overwriting an old one.
}
$this->save_saved_response($saved_response_id, $data);
// saved via ajax
exit;
} else {
if ('insert_saved_response' == $_REQUEST['_process']) {
$x = 1;
while ($x++ < 10 && ob_get_level()) {
ob_end_clean();
}
$response = $this->get_saved_response($_REQUEST['saved_response_id']);
echo json_encode($response);
exit;
} else {
if ('save_ticket_type' == $_REQUEST['_process']) {
if (!module_config::can_i('edit', 'Settings')) {
die('No perms to save ticket settings.');
}
$ticket_type_id = update_insert('ticket_type_id', $_REQUEST['ticket_type_id'], 'ticket_type', $_POST);
if (isset($_REQUEST['butt_del'])) {
// deleting ticket type all together
delete_from_db('ticket_type', 'ticket_type_id', $_REQUEST['ticket_type_id']);
set_message('Ticket type deleted successfully.');
redirect_browser($this->link_open_type(false));
}
set_message('Ticket type saved successfully');
redirect_browser($this->link_open_type($ticket_type_id));
} else {
if ('save_ticket_data_key' == $_REQUEST['_process']) {
if (!module_config::can_i('edit', 'Settings')) {
die('No perms to save ticket settings.');
}
$data = $_POST;
if (isset($data['options'])) {
$options = array();
foreach (explode("\n", $data['options']) as $line) {
$line = trim($line);
if (strlen($line) > 0) {
$bits = explode('|', $line);
$key = $bits[0];
if (count($bits) == 2) {
$val = $bits[1];
} else {
$val = $bits[0];
}
$options[$key] = $val;
}
}
$data['options'] = serialize($options);
}
$ticket_data_key_id = update_insert('ticket_data_key_id', $_REQUEST['ticket_data_key_id'], 'ticket_data_key', $data);
if (isset($_REQUEST['butt_del'])) {
// deleting ticket data_key all together
delete_from_db('ticket_data_key', 'ticket_data_key_id', $_REQUEST['ticket_data_key_id']);
set_message('Ticket field deleted successfully.');
redirect_browser($this->link_open_field(false));
}
set_message('Ticket field saved successfully');
redirect_browser($this->link_open_field($ticket_data_key_id));
} else {
if ('save_ticket_account' == $_REQUEST['_process']) {
if (!module_config::can_i('edit', 'Settings')) {
die('No perms to save ticket settings.');
}
$ticket_account_id = update_insert('ticket_account_id', $_REQUEST['ticket_account_id'], 'ticket_account', $_POST);
if (isset($_REQUEST['butt_save_test'])) {
?>
<a href="<?php
echo $this->link_open_account($ticket_account_id);
?>
">Return to account settings</a><br><br> <?php
self::import_email($ticket_account_id, false, true);
exit;
} else {
if (isset($_REQUEST['butt_del'])) {
// deleting ticket account all together
delete_from_db('ticket_account', 'ticket_account_id', $_REQUEST['ticket_account_id']);
set_message('Ticket account deleted successfully.');
redirect_browser($this->link_open_account(false));
}
}
set_message('Ticket account saved successfully');
redirect_browser($this->link_open_account($ticket_account_id));
} else {
if (isset($_REQUEST['butt_del']) && $_REQUEST['butt_del'] && $_REQUEST['ticket_id']) {
$data = self::get_ticket($_REQUEST['ticket_id']);
if (module_form::confirm_delete('ticket_id', "Really delete ticket: " . $this->ticket_number($data['ticket_id']), self::link_open($_REQUEST['ticket_id']))) {
$this->delete_ticket($_REQUEST['ticket_id']);
//.........这里部分代码省略.........
示例7: isset
<?php
/**
* Copyright: dtbaker 2012
* Licence: Please check CodeCanyon.net for licence details.
* More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
* Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
* Package Date: 2015-11-25 02:55:20
* IP Address: 67.79.165.254
*/
if (!module_config::can_i('edit', 'Settings')) {
redirect_browser(_BASE_HREF);
}
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : array();
$subscriptions = module_subscription::get_subscriptions($search);
$pagination = process_pagination($subscriptions);
$heading = array('title' => 'Subscriptions', 'type' => 'h2', 'main' => true);
if (module_subscription::can_i('create', 'Subscriptions')) {
$heading['button'] = array('title' => "Create New Subscription", 'type' => 'add', 'url' => module_subscription::link_open('new'));
}
print_heading($heading);
?>
<form action="" method="post">
<?php
示例8: pre_menu
public function pre_menu()
{
// the link within Admin > Settings > Emails.
if ($this->can_i('edit', 'Invoice Settings', 'Config')) {
$this->links[] = array("name" => "Invoices", "p" => "invoice_settings", 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
}
if ($this->can_i('view', 'Invoices')) {
// only display if a customer has been created.
if (isset($_REQUEST['customer_id']) && $_REQUEST['customer_id'] && $_REQUEST['customer_id'] != 'new') {
// how many invoices?
$invoices = $this->get_invoices(array('customer_id' => $_REQUEST['customer_id']));
$name = _l('Invoices');
if (count($invoices)) {
$name .= " <span class='menu_label'>" . count($invoices) . "</span> ";
}
$this->links[] = array("name" => $name, "p" => "invoice_admin", 'args' => array('invoice_id' => false), 'holder_module' => 'customer', 'holder_module_page' => 'customer_admin_open', 'menu_include_parent' => 0, 'icon_name' => 'dollar');
}
$this->links[] = array("name" => "Invoices", "p" => "invoice_admin", 'args' => array('invoice_id' => false), 'icon_name' => 'dollar');
if (module_config::can_i('view', 'Settings')) {
$this->links[] = array("name" => "Currency", "p" => "currency", 'args' => array('currency_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
}
}
/*else{
if(module_security::is_contact()){
// find out how many for this contact.
$customer_ids = module_security::get_customer_restrictions();
if($customer_ids){
$invoices = array();
foreach($customer_ids as $customer_id){
$invoices = $invoices + $this->get_invoices(array('customer_id'=>$customer_id));
}
$name = _l('Invoices');
if(count($invoices)){
$name .= " <span class='menu_label'>".count($invoices)."</span> ";
}
$this->links[] = array(
"name"=>$name,
"p"=>"invoice_admin",
'args'=>array('invoice_id'=>false),
);
}
}
}*/
}
示例9: array
<?php
/**
* Copyright: dtbaker 2012
* Licence: Please check CodeCanyon.net for licence details.
* More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
* Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
* Package Date: 2015-11-25 02:55:20
* IP Address: 67.79.165.254
*/
if (!module_config::can_i('view', 'Settings')) {
redirect_browser(_BASE_HREF);
}
$settings = array(array('key' => 'email_smtp', 'default' => '0', 'type' => 'checkbox', 'description' => 'Use SMTP when sending emails from this system'), array('key' => 'email_smtp_hostname', 'default' => '', 'type' => 'text', 'description' => 'SMTP hostname (eg: mail.yoursite.com)'), array('key' => 'email_smtp_auth', 'default' => '', 'type' => 'select', 'options' => array('' => _l('Nothing (default)'), 'ssl' => _l('SSL'), 'tls' => _l('TLS (use for Google SMTP)')), 'description' => 'SMTP Security', 'help' => 'If the Nothing (default) option does not work, try using SSL or TLS.'), array('key' => 'email_smtp_authentication', 'default' => '0', 'type' => 'checkbox', 'description' => 'Use SMTP authentication'), array('key' => 'email_smtp_username', 'default' => '', 'type' => 'text', 'description' => 'SMTP Username'), array('key' => 'email_smtp_password', 'default' => '', 'type' => 'text', 'description' => 'SMTP Password'), array('key' => 'email_limit_amount', 'default' => '0', 'type' => 'text', 'description' => 'Limit number of emails', 'help' => 'How many emails you can send per day, hour or minute. Set to 0 for unlimited emails.'), array('key' => 'email_limit_period', 'default' => 'day', 'type' => 'select', 'options' => array('day' => _l('Per Day'), 'hour' => _l('Per Hour'), 'minute' => _l('Per Minute')), 'description' => 'Limit per', 'help' => 'How many emails you can send per day, hour or minute'));
$demo_email = module_config::c('admin_email_address');
if (isset($_REQUEST['email'])) {
$demo_email = $_REQUEST['email'];
}
if (isset($_REQUEST['_email'])) {
// send a test email and report any errors.
$email = module_email::new_email();
$email->set_subject('Test Email from ' . module_config::c('admin_system_name'));
$email->set_to_manual($demo_email);
$email->set_html('This is a test email from the "' . module_config::c('admin_system_name') . '" setup wizard.');
if (!$email->send()) {
?>
<div class="warning">
Failed to send test email. Error message: <?php
echo $email->error_text;
?>
示例10: link_generate
public static function link_generate($faq_id = false, $options = array(), $link_options = array())
{
$key = 'faq_id';
if ($faq_id === false && $link_options) {
foreach ($link_options as $link_option) {
if (isset($link_option['data']) && isset($link_option['data'][$key])) {
${$key} = $link_option['data'][$key];
break;
}
}
if (!${$key} && isset($_REQUEST[$key])) {
${$key} = $_REQUEST[$key];
}
}
$bubble_to_module = false;
if (!isset($options['type'])) {
$options['type'] = 'faq';
}
if (!isset($options['page'])) {
$options['page'] = 'faq_settings';
}
if (!isset($options['arguments'])) {
$options['arguments'] = array();
}
$options['arguments']['faq_id'] = $faq_id;
$options['module'] = 'faq';
// what text should we display in this link?
if ($options['page'] == 'faq_products') {
if (isset($options['data']) && $options['data']) {
//$options['data'] = $options['data'];
} else {
$data = self::get_faq_product($faq_id);
$options['data'] = $data;
}
$options['text'] = isset($options['data']['name']) ? $options['data']['name'] : '';
if (!module_config::can_i('view', 'Settings') || !module_faq::can_i('edit', 'FAQ')) {
return htmlspecialchars($options['text']);
}
array_unshift($link_options, $options);
$options['page'] = 'faq_settings';
// bubble back onto ourselves for the link.
return self::link_generate($faq_id, $options, $link_options);
} else {
if ($options['page'] == 'faq_questions') {
if (isset($options['data']) && $options['data']) {
//$options['data'] = $options['data'];
} else {
$data = self::get_faq($faq_id);
$options['data'] = $data;
}
$options['text'] = isset($options['data']['question']) ? $options['data']['question'] : '';
array_unshift($link_options, $options);
$options['page'] = 'faq_settings';
// bubble back onto ourselves for the link.
return self::link_generate($faq_id, $options, $link_options);
} else {
if (isset($options['data']) && $options['data']) {
//$options['data'] = $options['data'];
} else {
$data = self::get_faq($faq_id);
$options['data'] = $data;
$options['class'] = 'error';
}
$options['text'] = isset($options['data']['question']) ? $options['data']['question'] : _l('N/A');
}
}
array_unshift($link_options, $options);
if ($options['page'] == 'faq_admin' && $options['data'] && isset($options['data']['status_id'])) {
// pick the class name for the error. or faq status
$link_options['class'] = 'faq_status_' . $options['data']['status_id'];
}
if (self::can_i('edit', 'FAQ')) {
if ($options['page'] == 'faq_settings') {
$bubble_to_module = array('module' => 'config');
}
}
if ($bubble_to_module) {
global $plugins;
return $plugins[$bubble_to_module['module']]->link_generate(false, array(), $link_options);
} else {
// return the link as-is, no more bubbling or anything.
// pass this off to the global link_generate() function
return link_generate($link_options);
}
}
示例11: date
<?php
/**
* Copyright: dtbaker 2012
* Licence: Please check CodeCanyon.net for licence details.
* More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
* Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
* Package Date: 2015-11-25 02:55:20
* IP Address: 67.79.165.254
*/
if (!module_config::can_i('view', 'Settings') || !module_backup::can_i('view', 'Backups')) {
redirect_browser(_BASE_HREF);
}
$module->page_title = 'Backups';
if (!extension_loaded('zip')) {
?>
<p>Warning: Full backups will not work correctly because this hosting account does not have the <strong>ZIP</strong> PHP extension enabled. Please contact the hosting provider and ask them to enable the PHP ZipArchive class.</p>
<?php
}
if (isset($_REQUEST['backup_id']) && $_REQUEST['backup_id']) {
$backup_id = (int) $_REQUEST['backup_id'];
if ($backup_id > 0) {
$backup = module_backup::get_backup($backup_id);
if (!$backup || $backup['backup_id'] != $backup_id) {
redirect_browser(_BASE_HREF);
}
if (!$backup['backup_file']) {
// start the ajax backup magic.
$backup_file_base = 'backup_' . date('Y-m-d') . '_' . md5(_UCM_SECRET . time()) . '';
update_insert('backup_id', $backup_id, 'backup', array('backup_file' => $backup_file_base));
示例12: init
public function init()
{
$this->links = array();
$this->newsletter_types = array();
$this->module_name = "newsletter";
$this->module_position = 22;
if ($this->can_i('view', 'Newsletters')) {
$this->links[] = array("name" => module_config::c('newsletter_tab_name', 'Newsletters'), "p" => "newsletter_admin", 'args' => array('newsletter_id' => false), 'icon_name' => 'envelope-o');
if (isset($_REQUEST['member_id']) && (int) $_REQUEST['member_id'] > 0) {
$this->links[] = array("name" => "Member Newsletters", "p" => "newsletter_member", 'args' => array('newsletter_id' => false, 'member_id' => (int) $_REQUEST['member_id']), 'holder_module' => 'member', 'holder_module_page' => 'member_admin', 'menu_include_parent' => 1, 'allow_nesting' => 1);
}
}
if (module_config::can_i('view', 'Settings')) {
$this->links[] = array("name" => module_config::c('newsletter_tab_name', 'Newsletters'), "p" => "newsletter_settings", "args" => array('user_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0, 'order' => 3);
}
module_config::register_css('newsletter', 'newsletter.css');
// todo - search the newsletter_send list for subjects as well..
/*$this->ajax_search_keys = array(
_DB_PREFIX.'newsletter' => array(
'plugin' => 'newsletter',
'search_fields' => array(
'subject',
),
'key' => 'newsletter_id',
'title' => _l('Newsletter: '),
),
);*/
if (class_exists('module_template', false)) {
module_template::init_template('newsletter_unsubscribe_done', '<h2>Unsubscribe Successful</h2>
<p>Email Address: <strong>{EMAIL}</strong> </p>
<p>You have been successfully unsubscribed from the newsletter system.</p>
', 'Displayed when unsubscription is complete.', 'code', array('EMAIL' => 'The users email address'));
module_template::init_template('newsletter_unsubscribe', '<h2>Unsubscribe</h2>
<form action="" method="post">
<p>Please Enter Your Email Address: <input type="text" name="email" value="{EMAIL}"> </p>
<p><input type="submit" name="confirm" value="Unsubscribe"></p>
</form>
', 'Used when a user wishes to unsubscribe.', 'code', array('EMAIL' => 'The users email address', 'UNSUB_CONFIRM' => 'The URL to confirm unsubscription'));
module_template::init_template('member_subscription_double_optin', '<h2>Confirm Subscription</h2>
<p>Thank you for subscribing to our newsletter system. Please click the link below to confirm your subscription.</p>
<p><a href="{LINK}">{LINK}</a></p>
', 'Sent to a user when they subscribe via your website.', 'code', array('EMAIL' => 'The users email address', 'LINK' => 'The URL to confirm subscription'));
module_template::init_template('member_subscription_confirmed', '<h2>Subscription Confirmed</h2>
<p>Thank you for confirming your newsletter subscription.</p>
', 'Displayed after use clicks their double opt-in link.', 'code', array());
}
}
示例13: pre_menu
public function pre_menu()
{
if ($this->can_i('view', 'Products') && $this->can_i('edit', 'Products')) {
// how many products are there?
$link_name = _l('Products');
if (module_config::can_i('view', 'Settings')) {
$this->links['products'] = array("name" => $link_name, "p" => "product_settings", "args" => array('product_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
} else {
$this->links['products'] = array("name" => $link_name, "p" => "product_settings", "args" => array('product_id' => false));
}
}
}
示例14: process
public function process()
{
if ('language_reset' == $_REQUEST['_process'] && $_REQUEST['really'] == 'yes') {
if (!module_form::check_secure_key()) {
return;
}
// delete all language words and translations
$sql = "DELETE FROM `" . _DB_PREFIX . "language_word` WHERE 1";
query($sql);
$sql = "DELETE FROM `" . _DB_PREFIX . "language_translation` WHERE 1";
query($sql);
set_message('Translation reset successfully');
redirect_browser($_SERVER['REQUEST_URI']);
}
if ('remove_duplicates' == $_REQUEST['_process'] && isset($_REQUEST['duplicate_ids'])) {
if (!module_form::check_secure_key()) {
return;
}
$duplicate_ids = json_decode($_REQUEST['duplicate_ids'], true);
foreach ($duplicate_ids as $duplicate_id) {
$sql = "DELETE FROM `" . _DB_PREFIX . "language_word` WHERE language_word_id = '" . (int) $duplicate_id . "' LIMIT 1";
query($sql);
}
set_message('Translation errors removed successfully');
redirect_browser($_SERVER['REQUEST_URI']);
} else {
if ('language_duplicate_remove' == $_REQUEST['_process'] && $_REQUEST['really'] == 'yep') {
if (!module_form::check_secure_key()) {
return;
}
// delete all language words and translations
$sql = "SELECT `word`, COUNT(*) as cc FROM `" . _DB_PREFIX . "language_word` GROUP BY `word` HAVING cc > 1";
$res = qa($sql);
foreach ($res as $r) {
if ($r['word'] && $r['cc'] > 1) {
// remove duplicates.
$sql = "SELECT * FROM `" . _DB_PREFIX . "language_word` WHERE `word` = '" . mysql_real_escape_string($r['word']) . "' ";
$duplicates = qa($sql);
// doing this due to incorrect collate in earlier version of UCM
$words_casesensitive = array();
foreach ($duplicates as $duplicate) {
$words_casesensitive[$duplicate['word']][$duplicate['language_word_id']] = $duplicate['language_word_id'];
}
//print_r($words_casesensitive);exit;
foreach ($words_casesensitive as $word => $duplicate_ids) {
if (count($duplicate_ids) > 1) {
$first = false;
foreach ($duplicate_ids as $language_word_id) {
if ($first === false) {
$first = $language_word_id;
} else {
if ($first) {
// remove this one and replace any translations with the first one.
$sql = "DELETE FROM `" . _DB_PREFIX . "language_word` WHERE language_word_id = '" . (int) $language_word_id . "' LIMIT 1";
query($sql);
$sql = "UPDATE `" . _DB_PREFIX . "language_translation` SET language_word_id = '" . (int) $first . "' WHERE language_word_id = '" . (int) $language_word_id . "'";
query($sql);
}
}
}
}
}
}
}
$sql = "DELETE FROM `" . _DB_PREFIX . "language_word` WHERE `word` LIKE 'SQL Error%'";
query($sql);
// merge languages - error if case of language changes, keeps creating new language entries - eg FR fr
$sql = "SELECT `language_id`, `language_code`, COUNT(*) as cc FROM `" . _DB_PREFIX . "language` GROUP BY `language_code`";
$res = query($sql);
while ($row = mysql_fetch_assoc($res)) {
if ($row['cc'] > 1) {
// merge these!
$sql = "SELECT language_id FROM `" . _DB_PREFIX . "language` WHERE `language_code` = '" . mysql_real_escape_string($row['language_code']) . "' AND language_id != " . (int) $row['language_id'] . "";
$to_merge = query($sql);
while ($merge = mysql_fetch_assoc($to_merge)) {
$sql = "UPDATE `" . _DB_PREFIX . "language_translation` SET language_id = " . (int) $row['language_id'] . " WHERE language_id = " . (int) $merge['language_id'] . "";
query($sql);
// remove any that didn't update correctly (duplicate entries)
$sql = "DELETE FROM `" . _DB_PREFIX . "language_translation` WHERE language_id = " . (int) $merge['language_id'] . "";
query($sql);
$sql = "DELETE FROM `" . _DB_PREFIX . "language` WHERE language_id = " . (int) $merge['language_id'] . " LIMIT 1";
query($sql);
}
}
}
set_message('Translation duplicates removed successfully');
redirect_browser($_SERVER['REQUEST_URI']);
}
}
if ('save_language_translation' == $_REQUEST['_process']) {
if (!module_form::check_secure_key()) {
return;
}
if (!module_config::can_i('view', 'Settings')) {
redirect_browser(_BASE_HREF);
}
if (!module_config::can_i('edit', 'Settings')) {
redirect_browser(_BASE_HREF);
}
if (!module_language::can_i('edit', 'Language')) {
//.........这里部分代码省略.........
示例15: isset
<?php
/**
* Copyright: dtbaker 2012
* Licence: Please check CodeCanyon.net for licence details.
* More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
* Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
* Package Date: 2015-11-25 02:55:20
* IP Address: 67.79.165.254
*/
if (!module_config::can_i('view', 'Settings') || !module_security::can_i('view', 'Security Roles', 'Security')) {
redirect_browser(_BASE_HREF);
}
$search = isset($_REQUEST['search']) && is_array($_REQUEST['search']) ? $_REQUEST['search'] : array();
$roles = $module->get_roles($search);
$header = array('type' => 'h2', 'title' => _l('Security Roles'), 'main' => true, 'button' => array('title' => 'Add New Role', 'type' => 'add', 'url' => module_security::link_open_role('new')));
print_heading($header);
?>
<form action="" method="post">
<?php
/** START TABLE LAYOUT **/
$table_manager = module_theme::new_table_manager();
$columns = array();
$columns['name'] = array('title' => 'Name', 'callback' => function ($role) use(&$module) {
echo $module->link_open_role($role['security_role_id'], true);