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); } } }
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); } } }
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); } }
<?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 . '|'; } }
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(); } }
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']); set_message("Ticket deleted successfully"); $url = $this->link_open(false); $url .= (strpos('?', $url) !== false ? '?' : '&') . 'do_last_search'; redirect_browser($url); } } else { if ("save_ticket" == $_REQUEST['_process']) { $this->_handle_save_ticket(); } } } } } } } if (!count($errors)) { redirect_browser($_REQUEST['_redirect']); exit; } print_error($errors, true); }
<?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
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), ); } } }*/ }
<?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; ?>
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); } }
public function pre_menu() { if (module_config::can_i('view', 'Settings')) { $this->links[] = array("name" => "Google Checkout", "p" => "google_settings", 'holder_module' => 'config', 'holder_module_page' => 'config_payment', 'menu_include_parent' => 1); } }
<?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));
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()); } }
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)); } } }
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')) { redirect_browser(_BASE_HREF); } $language_id = (int) $_REQUEST['language_id']; $language = module_language::get_language($language_id); if (!$language_id || !$language || $language['language_id'] != $language_id) { $language_id = false; $language = array(); } $language_id = update_insert('language_id', $language_id, 'language', $_POST); if (isset($_POST['translation']) && is_array($_POST['translation'])) { // save these values to the translation table for this particular langauge. foreach ($_POST['translation'] as $language_word_id => $translation) { if (_DEMO_MODE) { if (!isset($_SESSION['temp_translation'])) { $_SESSION['temp_translation'] = array(); } if (!isset($_SESSION['temp_translation'][$language_id])) { $_SESSION['temp_translation'][$language_id] = array(); } $_SESSION['temp_translation'][$language_id][$language_word_id] = $translation; } else { if (strlen($translation)) { $sql = "REPLACE INTO `" . _DB_PREFIX . "language_translation` SET `language_id` = " . (int) $language_id . ", "; $sql .= "`language_word_id` = " . (int) $language_word_id . ", `translation` = '" . mysql_real_escape_string($translation) . "'"; query($sql); } else { $sql = "DELETE FROM `" . _DB_PREFIX . "language_translation` WHERE `language_id` = " . (int) $language_id . " AND "; $sql .= "`language_word_id` = " . (int) $language_word_id . ""; query($sql); } } } } if (isset($_REQUEST['check_duplicates'])) { // redirect to duplicate check page. redirect_browser($_SERVER['REQUEST_URI'] . '&check_duplicates'); } else { set_message('Translation saved successfully'); redirect_browser(str_replace('language_id', 'done', $_SERVER['REQUEST_URI'])); } } }
<?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);
<?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_faq::can_i('edit', 'FAQ')) { redirect_browser(_BASE_HREF); } $module->page_title = 'FAQ Settings'; $links = array(array("name" => 'FAQ Products', 'm' => 'faq', 'p' => 'faq_products', 'force_current_check' => true, 'order' => 1, 'menu_include_parent' => 1, 'allow_nesting' => 1, 'args' => array('faq_id' => false, 'faq_product_id' => false)), array("name" => 'Questions & Answers', 'm' => 'faq', 'p' => 'faq_questions', 'force_current_check' => true, 'order' => 2, 'menu_include_parent' => 1, 'allow_nesting' => 1, 'args' => array('faq_id' => false, 'faq_product_id' => false)), array("name" => 'Settings', 'm' => 'faq', 'p' => 'faq_settings_basic', 'force_current_check' => true, 'order' => 3, 'menu_include_parent' => 1, 'allow_nesting' => 1, 'args' => array('faq_id' => false, 'faq_product_id' => false)));
public static function display_extras($options) { $owner_id = isset($options['owner_id']) && $options['owner_id'] ? (int) $options['owner_id'] : false; $owner_table = isset($options['owner_table']) && $options['owner_table'] ? $options['owner_table'] : false; $layout = isset($options['layout']) && $options['layout'] ? $options['layout'] : false; $allow_new = true; if (isset($options['allow_new']) && !$options['allow_new']) { $allow_new = false; } $allow_edit = !isset($options['allow_edit']) || isset($options['allow_edit']) && $options['allow_edit']; if (!module_security::is_page_editable()) { $allow_edit = false; } // todo ^^ flow this permission check through to the "save" section. $html = ''; if ($owner_table) { $default_fields = self::get_defaults($owner_table); // we have all that we need to display some extras!! yey!! if ($owner_id) { $extra_items = self::get_extras(array('owner_table' => $owner_table, 'owner_id' => $owner_id)); $extra_items = self::sort_extras($extra_items, $default_fields); } else { $extra_items = array(); } foreach ($extra_items as $extra_item) { $extra_id = $extra_item['extra_id']; $id = 'extra_' . preg_replace('#\\W+#', '_', $extra_item['extra_key']); ob_start(); ?> <tr id="extra_<?php echo $extra_id; ?> "> <th <?php if (module_config::can_i('edit', 'Settings') && self::can_i('edit', 'Extra Fields') && isset($default_fields[$extra_item['extra_key']]['field_type'])) { echo ' data-settings-url="' . module_extra::link_open_extra_default($default_fields[$extra_item['extra_key']]['extra_default_id'], false) . '"'; } ?> > <?php if ($allow_edit) { ?> <span class="extra_field_key" onclick="$(this).hide(); $(this).parent().find('input').show();"><?php echo htmlspecialchars($extra_item['extra_key']); ?> </span> <input type="text" name="extra_<?php echo $owner_table; ?> _field[<?php echo $extra_id; ?> ][key]" value="<?php echo htmlspecialchars($extra_item['extra_key']); ?> " class="extra_field" style="display:none;"> <?php } else { echo htmlspecialchars($extra_item['extra_key']); ?> <input type="hidden" name="extra_<?php echo $owner_table; ?> _field[<?php echo $extra_id; ?> ][key]" value="<?php echo htmlspecialchars($extra_item['extra_key']); ?> "> <?php } ?> </th> <td> <?php if ($allow_edit) { $field_type = 'text'; if (isset($default_fields[$extra_item['extra_key']]['field_type'])) { $field_type = $default_fields[$extra_item['extra_key']]['field_type']; } if (!$field_type) { $field_type = 'text'; } $form_element = array('type' => $field_type, 'name' => 'extra_' . $owner_table . '_field[' . $extra_id . '][val]', 'value' => $extra_item['extra'], 'class' => 'extra_value_input', 'id' => $id); if ($field_type == 'select') { $form_element['options'] = array(); if (isset($default_fields[$extra_item['extra_key']]['options']) && is_array($default_fields[$extra_item['extra_key']]['options']) && isset($default_fields[$extra_item['extra_key']]['options']['select'])) { foreach (explode("\n", $default_fields[$extra_item['extra_key']]['options']['select']) as $val) { $val = trim($val); if ($val === '') { continue; } $form_element['options'][$val] = $val; } } } module_form::generate_form_element($form_element); } else { echo nl2br($extra_item['extra']); } /* <input type="text" name="extra_<?php echo $owner_table;?>_field[<?php echo $extra_id;?>][val]" id="<?php echo $id;?>" class="extra_value_input" value="<?php echo htmlspecialchars($extra_item['extra']);?>"> */ ?> </td> </tr> <?php $html .= ob_get_clean(); } if (module_security::is_page_editable() && $allow_new) { $extra_id = 'new'; ob_start(); // check if there are any "more" fields to add $more_fields_available = $allow_new; //if(!$more_fields_available){ foreach ($default_fields as $default_id => $default) { // check this key islany already existing. foreach ($extra_items as $extra_item) { if ($extra_item['extra_key'] == $default['key']) { unset($default_fields[$default_id]); continue 2; } } $more_fields_available = true; } //} if ($more_fields_available) { ?> <tr id="extra_<?php echo $owner_table; ?> _options_<?php echo $extra_id; ?> " <?php if (!module_config::c('hide_extra', 1)) { ?> style="display:none;"<?php } ?> > <th> </th> <td> <a href="#" onclick="$('#extra_<?php echo $owner_table; ?> _options_<?php echo $extra_id; ?> ').hide();$('#extra_<?php echo $owner_table; ?> _holder_<?php echo $extra_id; ?> ').show(); return false;"><?php _e('more fields »'); ?> </a> </td> </tr> <?php } // more fields available ?> <?php if (count($default_fields) || $allow_new) { ?> <tbody id="extra_<?php echo $owner_table; ?> _holder_<?php echo $extra_id; ?> " <?php if (module_config::c('hide_extra', 1)) { ?> style="display:none;"<?php } ?> > <!-- show all other options here from this $owner_table --> <?php $defaultid = 0; foreach ($default_fields as $default) { $defaultid++; $id = 'extra_' . preg_replace('#\\W+#', '_', $default['key']); ?> <tr> <th> <?php if ($allow_edit) { ?> <span class="extra_field_key" onclick="$(this).hide(); $(this).parent().find('input').show();"><?php echo htmlspecialchars($default['key']); ?> </span> <input type="text" name="extra_<?php echo $owner_table; ?> _field[new<?php echo $defaultid; ?> ][key]" value="<?php echo htmlspecialchars($default['key']); ?> " class="extra_field" style="display:none;"> <?php } else { echo htmlspecialchars($default['key']); ?> <input type="hidden" name="extra_<?php echo $owner_table; ?> _field[new<?php echo $defaultid; ?> ][key]" value="<?php echo htmlspecialchars($default['key']); ?> "> <?php } ?> </th> <td> <?php $field_type = $default['field_type']; if (!$field_type) { $field_type = 'text'; } $form_element = array('type' => $field_type, 'name' => 'extra_' . $owner_table . '_field[new' . $defaultid . '][val]', 'value' => '', 'class' => 'extra_value_input', 'id' => $id); if ($field_type == 'select') { $form_element['options'] = array(); if (isset($default['options']) && is_array($default['options']) && isset($default['options']['select'])) { foreach (explode("\n", $default['options']['select']) as $val) { $val = trim($val); if ($val === '') { continue; } $form_element['options'][$val] = $val; } } } module_form::generate_form_element($form_element); /*<input type="text" name="extra_<?php echo $owner_table;?>_field[new<?php echo $defaultid;?>][val]" id="<?php echo $id;?>" value="<?php ?>">*/ ?> </td> </tr> <?php } ?> <?php if ($allow_new) { ?> <tr id="extra_<?php echo $extra_id; ?> "> <th> <input type="text" name="extra_<?php echo $owner_table; ?> _field[<?php echo $extra_id; ?> ][key]" value="<?php ?> " class="extra_field"> </th> <td> <input type="text" name="extra_<?php echo $owner_table; ?> _field[<?php echo $extra_id; ?> ][val]" value="<?php ?> "> <?php _h('Enter anything you like in this blank field. eg: Passwords, Links, Notes, etc..'); ?> </td> </tr> <?php } ?> </tbody> <?php } // defaults / allow new $html .= ob_get_clean(); } // is page editable } // pass it out for a hook // this is really only used in the security module. if (function_exists('hook_filter_var')) { $html = hook_filter_var('extra_fields_output', $html, $owner_table, $owner_id); } else { $result = hook_handle_callback('extra_fields_output', $html, $owner_table, $owner_id); if ($result && count($result)) { foreach ($result as $r) { $html = $r; // bad. handle multiple hooks. } } } print $html; }
public function pre_menu() { if ($this->can_i('view', 'Subscriptions') && $this->can_i('edit', 'Subscriptions') && module_config::can_i('view', 'Settings')) { // how many subscriptions are there? $link_name = _l('Subscriptions'); $this->links['subscriptions'] = array("name" => $link_name, "p" => "subscription_admin", "args" => array('subscription_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0); } }
private function _handle_save_settings_hook() { if (!module_config::can_i('edit', 'Settings')) { die("Permission denied to Edit 'Config » Settings'. Please ask Administrator to adjust settings."); } $config = isset($_REQUEST['config']) && is_array($_REQUEST['config']) ? $_REQUEST['config'] : array(); $config_defaults = isset($_REQUEST['default_config']) && is_array($_REQUEST['default_config']) ? $_REQUEST['default_config'] : array(); foreach ($config_defaults as $key => $val) { if (!isset($config[$key])) { $config[$key] = ''; // the checkbox has been unticked, save a blank option. } } foreach ($config as $key => $val) { $this->save_config($key, $val); } set_message('Configuration saved successfully'); redirect_browser($_SERVER['REQUEST_URI']); }
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(); foreach (self::$available_permissions as $permission) { if (isset($permissions[$permission]) && $permissions[$permission]) { $actions[$permission] = 1; } } $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); } } if (isset($_REQUEST['permission_drop_down']) && is_array($_REQUEST['permission_drop_down'])) { // update permissions for this role. $permission = 'view'; foreach ($_REQUEST['permission_drop_down'] as $security_permission_ids => $selected_security_permission_id) { $ids_to_clear = explode('|', $security_permission_ids); foreach ($ids_to_clear as $id_to_clear) { $id_to_clear = (int) $id_to_clear; if (!$id_to_clear) { continue; } $sql = "DELETE FROM `" . _DB_PREFIX . "security_role_perm` WHERE security_role_id = '" . (int) $security_role_id . "' AND security_permission_id = '" . (int) $id_to_clear . "' "; query($sql); } if ((int) $selected_security_permission_id > 0) { $sql = "REPLACE INTO `" . _DB_PREFIX . "security_role_perm` SET security_role_id = '" . (int) $security_role_id . "', security_permission_id = '" . (int) $selected_security_permission_id . "' "; $sql .= ", `" . mysql_real_escape_string($permission) . "` = 1"; } query($sql); } } set_message('Role saved successfully.'); } redirect_browser($this->link_open_role($security_role_id)); } } }
<?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_template::can_i('edit', 'Templates')) { redirect_browser(_BASE_HREF); } $template_id = $_REQUEST['template_id']; $template = array(); if ((int) $template_id && $template_id != 'new') { $template = module_template::get_template($template_id); } if (!$template) { $template_id = 'new'; $template = array('template_id' => 'new', 'template_key' => '', 'description' => '', 'content' => '', 'name' => '', 'default_text' => '', 'wysiwyg' => 1); module_security::sanatise_data('template', $template); } ?> <form action="<?php echo module_template::link_open(false); ?> " method="post" id="template_form">
public function pre_menu() { if (module_config::can_i('view', 'Settings')) { $this->links[] = array("name" => "MultiSafepay", "p" => "multisafepay_settings", 'holder_module' => 'config', 'holder_module_page' => 'config_payment', 'menu_include_parent' => 1); } }