/** * Module Uninstaller * * @access public * @return bool */ function uninstall() { $mod_id = ee()->db->select('module_id')->get_where('modules', array('module_name' => 'Filepicker'))->row('module_id'); ee()->db->where('module_id', $mod_id)->delete('module_member_groups'); ee()->db->where('module_name', 'Filepicker')->delete('modules'); return TRUE; }
/** * Countcommentreviews * * This function returns a list of members * * @access public * @return string */ public function __construct() { $type_review = '+'; $entryid = '1'; $type_review = ee()->TMPL->fetch_param('type_review'); $entryid = ee()->TMPL->fetch_param('entryid'); $query = ee()->db->select('COUNT(field_id_1) AS countr')->where(array('entry_id' => $entryid, 'field_id_1' => $type_review))->limit(1)->get('comment_data'); if ($query->num_rows() > 0) { foreach ($query->result_array() as $row) { $this->return_data .= $row['countr']; } } /* $group_id = "6"; $group_id = ee()->TMPL->fetch_param('group_id'); $query = ee()->db->select('email') ->where('group_id =', $group_id) ->get('members', 1000); $count=1; foreach($query->result_array() as $row) { $this->return_data .= $row['email']; if ( $count < $query->num_rows() ){ $this->return_data .= ","; } $count++; } */ }
function do_update() { $query = ee()->db->query("SHOW tables LIKE 'exp_mailing_list'"); if ($query->num_rows() > 0) { $Q[] = "ALTER TABLE `exp_mailing_list` ADD `ip_address` VARCHAR(16) NOT NULL AFTER `list_id`"; } // Change default weblog preferences for trackbacks $Q[] = "ALTER TABLE `exp_weblogs` CHANGE `enable_trackbacks` `enable_trackbacks` CHAR(1) NOT NULL DEFAULT 'n'"; $Q[] = "ALTER TABLE `exp_weblogs` CHANGE `trackback_system_enabled` `trackback_system_enabled` CHAR(1) NOT NULL DEFAULT 'n'"; // fix version number for Member module, which may be out of sync for old installations $Q[] = "UPDATE `exp_modules` SET `module_version` = '1.3' WHERE `module_name` = 'Member'"; // Text formatting for emails from the Communicate page $Q[] = "ALTER TABLE `exp_email_cache` ADD `text_fmt` VARCHAR(40) NOT NULL AFTER `mailtype`"; // Member Group setting for showing in Author List $Q[] = "ALTER TABLE `exp_member_groups` ADD `include_in_authorlist` CHAR(1) NOT NULL DEFAULT 'n' AFTER `can_send_bulletins`"; // Show All Tab in the Publish Area $Q[] = "ALTER TABLE `exp_weblogs` ADD `show_show_all_cluster` CHAR( 1 ) NOT NULL DEFAULT 'y' AFTER `show_pages_cluster`;"; // "live" preview modifications $Q[] = "ALTER TABLE `exp_weblogs` ADD `live_look_template` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `url_title_prefix`"; /** --------------------------------------- /** Run Queries /** ---------------------------------------*/ foreach ($Q as $sql) { ee()->db->query($sql); } /** --------------------------------------- /** Update the Config File /** ---------------------------------------*/ return TRUE; }
/** * {@inheritdoc} */ protected function fire() { ee()->load->add_package_path(PATH_THIRD . 'sync_snippets/'); ee()->load->library('sync_snippets'); ee()->sync_snippets->sync_snippets(); $this->info('Snippets synced.'); }
/** * Sets three columns to allow NULL and to default to NULL. This matches * the schema we install. */ private function _update_member_field_schema() { ee()->smartforge->modify_column('member_fields', array('m_field_maxl' => array('type' => 'smallint(3)', 'null' => TRUE), 'm_field_width' => array('type' => 'varchar(6)', 'null' => TRUE), 'm_field_order' => array('type' => 'int(3)', 'null' => TRUE))); foreach (array('m_field_maxl', 'm_field_width', 'm_field_order') as $col) { ee()->db->query("ALTER TABLE exp_member_fields ALTER COLUMN " . $col . " SET DEFAULT NULL"); } }
/** * Replace all of the default date fields. * * @param String The tagdata to be parsed * @param Object The channel parser object * @param Mixed The results from the preparse method * * @return String The processed tagdata */ public function replace($tagdata, EE_Channel_data_parser $obj, $date_vars) { $prefix = $obj->prefix(); $tag = $obj->tag(); $data = $obj->row(); $dates = array($prefix . 'entry_date' => $data['entry_date'], $prefix . 'edit_date' => $data['edit_date'], $prefix . 'recent_comment_date' => $data['recent_comment_date'] != 0 ? $data['recent_comment_date'] : '', $prefix . 'expiration_date' => $data['expiration_date'] != 0 ? $data['expiration_date'] : '', $prefix . 'comment_expiration_date' => $data['comment_expiration_date'] != 0 ? $data['comment_expiration_date'] : ''); // "week_date" // Subtract the number of days the entry is "into" the week to get zero (Sunday) // If the entry date is for Sunday, and Monday is being used as the week's start day, // then we must back things up by six days $offset = 0; if (strtolower(ee()->TMPL->fetch_param('start_day')) == 'monday') { $day_of_week = ee()->localize->format_date('%w', $data['entry_date']); if ($day_of_week == '0') { $offset = -518400; // back six days } else { $offset = 86400; // plus one day } } $dates['week_date'] = $data['entry_date'] - ee()->localize->format_date('%w', $data['entry_date'], TRUE) * 60 * 60 * 24 + $offset; $tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates); $dates = array($prefix . 'gmt_date' => $data['entry_date'], $prefix . 'gmt_entry_date' => $data['entry_date'], $prefix . 'gmt_edit_date' => $data['edit_date']); $tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates, FALSE); return $tagdata; }
function form_open($action = '', $attributes = array(), $hidden = array()) { $CI =& get_instance(); if (strpos($action, '://') === FALSE && strpos($action, BASE) !== 0) { $action = BASE . AMP . $action; } $action = ee()->uri->reformat($action); $form = '<form action="' . $action . '"'; if (is_array($attributes)) { if (!isset($attributes['method'])) { $form .= ' method="post"'; } foreach ($attributes as $key => $val) { $form .= ' ' . $key . '="' . $val . '"'; } } else { $form .= ' method="post" ' . $attributes; } $form .= ">\n"; if (!bool_config_item('disable_csrf_protection')) { if (!is_array($hidden)) { $hidden = array(); } $hidden['csrf_token'] = CSRF_TOKEN; } if (is_array($hidden) and count($hidden > 0)) { $form .= form_hidden($hidden) . "\n"; } return $form; }
/** * {@inheritdoc} */ protected function fire() { $templates = $this->argument('template'); $this->getApplication()->newControllerInstance('\\eecli\\CodeIgniter\\Controller\\DesignController'); ee()->load->model('template_model'); ee()->template = ee()->TMPL; if (!$this->option('force') && !$this->confirm('Are you sure you want to delete? [Yn]', true)) { $this->error('Did not delete template(s): ' . implode(' ', $templates)); return; } foreach ($templates as $template) { if (!preg_match('#^[a-zA-Z0-9_\\-]+/[a-zA-Z0-9_\\-]+$#', $template)) { $this->error('Template ' . $template . ' must be in <template_group>/<template_name> format.'); continue; } list($groupName, $templateName) = explode('/', $template); $query = ee()->db->select('template_id')->join('template_groups', 'template_groups.group_id = templates.group_id')->where('group_name', $groupName)->where('template_name', $templateName)->get('templates'); if ($query->num_rows() === 0) { $this->error('Template ' . $template . ' not found.'); } else { $_POST = array('template_id' => $query->row('template_id')); ee()->template_delete(); $this->info('Template ' . $template . ' deleted.'); } $query->free_result(); } }
/** * {@inheritdoc} */ protected function fire() { if (ee()->config->item('save_tmpl_files') !== 'y' || !ee()->config->item('tmpl_file_basepath')) { $this->error('The "Save Templates as Files" system configuration must be turned on to use this command.'); return; } $this->getApplication()->newControllerInstance('\\eecli\\CodeIgniter\\Controller\\DesignController'); ee()->sync_templates(); $vars = ee()->cp->getVariables(); $toggle = array(); foreach ($vars['templates'] as $groupName => $templates) { foreach ($templates as $templateName => $templateData) { if (isset($templateData['toggle']) && preg_match('#name="toggle\\[\\]" value="(.*?)"#', $templateData['toggle'], $match)) { $toggle[] = $match[1]; } } } if (empty($toggle)) { $this->error('There are no templates to sync.'); return; } $_POST = array('confirm' => 'confirm', 'toggle' => $toggle); ee()->sync_run(); if (ee()->functions->getErrorMessage()) { $this->error(ee()->functions->getErrorMessage()); return; } if (ee()->functions->getSuccessMessage()) { $this->info(ee()->functions->getSuccessMessage()); } }
public function index() { $vars['sections'] = array(array(array('title' => 'cp_session_type', 'desc' => '', 'fields' => array('cp_session_type' => array('type' => 'select', 'choices' => array('cs' => lang('cs_session'), 'c' => lang('c_session'), 's' => lang('s_session'))))), array('title' => 'website_session_type', 'desc' => '', 'fields' => array('website_session_type' => array('type' => 'select', 'choices' => array('cs' => lang('cs_session'), 'c' => lang('c_session'), 's' => lang('s_session')))))), 'cookie_settings' => array(array('title' => 'cookie_domain', 'desc' => 'cookie_domain_desc', 'fields' => array('cookie_domain' => array('type' => 'text'))), array('title' => 'cookie_path', 'desc' => sprintf(lang('cookie_path_desc'), ee()->cp->masked_url('https://ellislab.com/expressionengine/user-guide/cp/admin/cookie_settings.html#cookie-path')), 'fields' => array('cookie_path' => array('type' => 'text'))), array('title' => 'cookie_prefix', 'desc' => lang('cookie_prefix_desc'), 'fields' => array('cookie_prefix' => array('type' => 'text'))), array('title' => 'cookie_httponly', 'desc' => 'cookie_httponly_desc', 'security' => TRUE, 'fields' => array('cookie_httponly' => array('type' => 'yes_no'))), array('title' => 'cookie_secure', 'desc' => 'cookie_secure_desc', 'security' => TRUE, 'fields' => array('cookie_secure' => array('type' => 'yes_no')))), 'member_security_settings' => array(array('title' => 'allow_username_change', 'desc' => 'allow_username_change_desc', 'fields' => array('allow_username_change' => array('type' => 'yes_no'))), array('title' => 'un_min_len', 'desc' => lang('un_min_len_desc'), 'fields' => array('un_min_len' => array('type' => 'text'))), array('title' => 'allow_multi_logins', 'desc' => 'allow_multi_logins_desc', 'fields' => array('allow_multi_logins' => array('type' => 'yes_no'))), array('title' => 'require_ip_for_login', 'desc' => 'require_ip_for_login_desc', 'fields' => array('require_ip_for_login' => array('type' => 'yes_no'))), array('title' => 'password_lockout', 'desc' => 'password_lockout_desc', 'fields' => array('password_lockout' => array('type' => 'inline_radio', 'choices' => array('y' => lang('enable'), 'n' => lang('disable'))))), array('title' => 'password_lockout_interval', 'desc' => lang('password_lockout_interval_desc'), 'fields' => array('password_lockout_interval' => array('type' => 'text'))), array('title' => 'require_secure_passwords', 'desc' => 'require_secure_passwords_desc', 'fields' => array('require_secure_passwords' => array('type' => 'yes_no'))), array('title' => 'pw_min_len', 'desc' => 'pw_min_len_desc', 'fields' => array('pw_min_len' => array('type' => 'text'))), array('title' => 'allow_dictionary_pw', 'desc' => 'allow_dictionary_pw_desc', 'fields' => array('allow_dictionary_pw' => array('type' => 'yes_no'))), array('title' => 'name_of_dictionary_file', 'desc' => 'name_of_dictionary_file_desc', 'fields' => array('name_of_dictionary_file' => array('type' => 'text')))), 'form_security_settings' => array(array('title' => 'deny_duplicate_data', 'desc' => 'deny_duplicate_data_desc', 'fields' => array('deny_duplicate_data' => array('type' => 'yes_no'))), array('title' => 'require_ip_for_posting', 'desc' => 'require_ip_for_posting_desc', 'fields' => array('require_ip_for_posting' => array('type' => 'yes_no'))), array('title' => 'xss_clean_uploads', 'desc' => 'xss_clean_uploads_desc', 'fields' => array('xss_clean_uploads' => array('type' => 'yes_no'))))); ee()->form_validation->set_rules(array(array('field' => 'un_min_len', 'label' => 'lang:un_min_len', 'rules' => 'integer'), array('field' => 'password_lockout_interval', 'label' => 'lang:password_lockout_interval', 'rules' => 'integer'), array('field' => 'pw_min_len', 'label' => 'lang:pw_min_len', 'rules' => 'integer'))); ee()->form_validation->validateNonTextInputs($vars['sections']); $base_url = ee('CP/URL')->make('settings/security-privacy'); ee('CP/Alert')->makeInline('security-tip')->asWarning()->cannotClose()->addToBody(lang('security_tip'))->addToBody(lang('security_tip_desc'), 'enhance')->now(); ee()->view->extra_alerts = array('security-tip'); if (AJAX_REQUEST) { ee()->form_validation->run_ajax(); exit; } elseif (ee()->form_validation->run() !== FALSE) { if ($this->saveSettings($vars['sections'])) { ee()->view->set_message('success', lang('preferences_updated'), lang('preferences_updated_desc'), TRUE); } ee()->functions->redirect($base_url); } elseif (ee()->form_validation->errors_exist()) { ee()->view->set_message('issue', lang('settings_save_error'), lang('settings_save_error_desc')); } ee()->view->ajax_validate = TRUE; ee()->view->base_url = $base_url; ee()->view->cp_page_title = lang('security_privacy'); ee()->view->save_btn_text = 'btn_save_settings'; ee()->view->save_btn_text_working = 'btn_saving'; ee()->cp->render('settings/form', $vars); }
public function index() { $vars['sections'] = array(array(array('title' => 'require_captcha', 'desc' => 'require_captcha_desc', 'fields' => array('require_captcha' => array('type' => 'yes_no'))), array('title' => 'captcha_font', 'desc' => 'captcha_font_desc', 'fields' => array('captcha_font' => array('type' => 'yes_no'))), array('title' => 'captcha_rand', 'desc' => 'captcha_rand_desc', 'fields' => array('captcha_rand' => array('type' => 'yes_no'))), array('title' => 'captcha_require_members', 'desc' => 'captcha_require_members_desc', 'fields' => array('captcha_require_members' => array('type' => 'yes_no')))), 'url_path_settings_title' => array(array('title' => 'captcha_url', 'desc' => 'captcha_url_desc', 'fields' => array('captcha_url' => array('type' => 'text'))), array('title' => 'captcha_path', 'desc' => 'captcha_path_desc', 'fields' => array('captcha_path' => array('type' => 'text'))))); ee()->form_validation->set_rules(array(array('field' => 'captcha_url', 'label' => 'lang:captcha_url', 'rules' => 'strip_tags|valid_xss_check'), array('field' => 'captcha_path', 'label' => 'lang:captcha_path', 'rules' => 'strip_tags|valid_xss_check|file_exists|writable'))); ee()->form_validation->validateNonTextInputs($vars['sections']); $base_url = ee('CP/URL')->make('settings/captcha'); if (AJAX_REQUEST) { ee()->form_validation->run_ajax(); exit; } elseif (ee()->form_validation->run() !== FALSE) { if ($this->saveSettings($vars['sections'])) { ee()->view->set_message('success', lang('preferences_updated'), lang('preferences_updated_desc'), TRUE); } ee()->functions->redirect($base_url); } elseif (ee()->form_validation->errors_exist()) { ee()->view->set_message('issue', lang('settings_save_error'), lang('settings_save_error_desc')); } ee()->view->ajax_validate = TRUE; ee()->view->base_url = $base_url; ee()->view->cp_page_title = lang('captcha_settings'); ee()->view->cp_page_title_alt = lang('captcha_settings_title'); ee()->view->save_btn_text = 'btn_save_settings'; ee()->view->save_btn_text_working = 'btn_saving'; ee()->cp->render('settings/form', $vars); }
/** * {@inheritdoc} */ protected function fire() { if ($this->argument('action_id')) { ee()->db->where('action_id', $this->argument('action_id')); } $classes = $this->option('class') ?: []; if ($modules = $this->option('module')) { foreach ($modules as $module) { $classes[] = ucfirst($module); $classes[] = ucfirst($module) . '_mcp'; } } if ($classes) { ee()->db->where_in('class', $classes); } if ($methods = $this->option('method')) { ee()->db->where_in('method', $methods); } $query = ee()->db->order_by('action_id')->get('actions'); if ($query->num_rows() === 0) { if ($actionId) { $this->warning('There was no action found with the specified action_id.'); } else { $this->warning('There were no actions found.'); } } else { $results = $query->result_array(); $headers = array('ID', 'Class', 'Method'); if (array_key_exists('csrf_exempt', $results[0])) { $headers[] = 'CSRF Exempt'; } $this->table($headers, $results); } $query->free_result(); }
/** * General Settings */ public function index() { $vars['sections'] = array(array(array('title' => 'site_index', 'desc' => 'site_index_desc', 'fields' => array('site_index' => array('type' => 'text'))), array('title' => 'site_url', 'desc' => 'site_url_desc', 'fields' => array('site_url' => array('type' => 'text', 'required' => TRUE))), array('title' => 'cp_url', 'desc' => 'cp_url_desc', 'fields' => array('cp_url' => array('type' => 'text', 'required' => TRUE))), array('title' => 'themes_url', 'desc' => 'themes_url_desc', 'fields' => array('theme_folder_url' => array('type' => 'text', 'required' => TRUE))), array('title' => 'themes_path', 'desc' => 'themes_path_desc', 'fields' => array('theme_folder_path' => array('type' => 'text', 'required' => TRUE))), array('title' => 'docs_url', 'desc' => 'docs_url_desc', 'fields' => array('doc_url' => array('type' => 'text'))), array('title' => 'member_segment_trigger', 'desc' => 'member_segment_trigger_desc', 'fields' => array('profile_trigger' => array('type' => 'text'))), array('title' => 'category_segment_trigger', 'desc' => 'category_segment_trigger_desc', 'fields' => array('reserved_category_word' => array('type' => 'text'))), array('title' => 'category_url', 'desc' => 'category_url_desc', 'fields' => array('use_category_name' => array('type' => 'inline_radio', 'choices' => array('y' => lang('category_url_opt_titles'), 'n' => lang('category_url_opt_ids'))))), array('title' => 'url_title_separator', 'desc' => 'url_title_separator_desc', 'fields' => array('word_separator' => array('type' => 'select', 'choices' => array('dash' => lang('url_title_separator_opt_hyphen'), 'underscore' => lang('url_title_separator_opt_under'))))))); ee()->form_validation->set_rules(array(array('field' => 'site_index', 'label' => 'lang:site_index', 'rules' => 'strip_tags|valid_xss_check'), array('field' => 'site_url', 'label' => 'lang:site_url', 'rules' => 'required|strip_tags|valid_xss_check'), array('field' => 'cp_url', 'label' => 'lang:cp_url', 'rules' => 'required|strip_tags|valid_xss_check'), array('field' => 'theme_folder_url', 'label' => 'lang:themes_url', 'rules' => 'required|strip_tags|valid_xss_check'), array('field' => 'theme_folder_path', 'label' => 'lang:themes_path', 'rules' => 'required|strip_tags|valid_xss_check|file_exists'), array('field' => 'profile_trigger', 'label' => 'lang:member_segment_trigger', 'rules' => 'alpha_dash'), array('field' => 'doc_url', 'label' => 'lang:docs_url', 'rules' => 'strip_tags|valid_xss_check'))); ee()->form_validation->validateNonTextInputs($vars['sections']); $base_url = ee('CP/URL')->make('settings/urls'); if (AJAX_REQUEST) { ee()->form_validation->run_ajax(); exit; } elseif (ee()->form_validation->run() !== FALSE) { if ($this->saveSettings($vars['sections'])) { ee()->view->set_message('success', lang('preferences_updated'), lang('preferences_updated_desc'), TRUE); } ee()->functions->redirect($base_url); } elseif (ee()->form_validation->errors_exist()) { ee()->view->set_message('issue', lang('settings_save_error'), lang('settings_save_error_desc')); } ee()->view->base_url = $base_url; ee()->view->ajax_validate = TRUE; ee()->view->cp_page_title = lang('url_path_settings'); ee()->view->cp_page_title_alt = lang('url_path_settings_title'); ee()->view->save_btn_text = 'btn_save_settings'; ee()->view->save_btn_text_working = 'btn_saving'; ee()->cp->render('settings/form', $vars); }
function report_run() { // Get the report data $report = ee()->db->query("SELECT * FROM exp_reports WHERE report_id=" . ee()->input->get('report_id') . " LIMIT 1"); $report = $report->row_array(); if (empty($report['query'])) { show_error(lang('error_no_query')); } // Run the query $query = ee()->db->query($report['query']); if ($query->num_rows() > 0) { // do any post processing which is required if (!empty($report['post_processing'])) { $report['data'] = eval($report['post_processing']); if (!$report['data']) { show_error(lang('error_post_processing')); exit; } } else { $report['data'] = $query->result_array(); } $this->export($report); } else { show_error(lang('error_no_results')); } }
function force_download($filename = '', $data = '') { if ($filename == '' or $data == '') { return FALSE; } ee()->load->library('mime_type'); $mime = ee()->mime_type->ofBuffer($data); $len = function_exists('mb_strlen') ? mb_strlen($data, '8bit') : strlen($data); // Generate the server headers if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== FALSE) { header('Content-Type: "' . $mime . '"'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header("Content-Transfer-Encoding: binary"); header('Pragma: public'); header("Content-Length: " . $len); } else { header('Content-Type: "' . $mime . '"'); header('Content-Disposition: attachment; filename="' . $filename . '"'); header("Content-Transfer-Encoding: binary"); header('Expires: 0'); header('Pragma: no-cache'); header("Content-Length: " . $len); } exit($data); }
function __construct() { // Make a local reference to the ExpressionEngine super object $this->EE =& get_instance(); // Load the XML Helper ee()->load->helper('xml'); }
public function __construct($timestamp, $reference = NULL) { $this->_timestamp = (int) $timestamp; $this->_reference = is_numeric($reference) ? $reference : ee()->localize->now; // Initializing to NULL so as not to break the magic __get() method $this->_units = array('years' => NULL, 'months' => NULL, 'fortnights' => NULL, 'weeks' => NULL, 'days' => NULL, 'hours' => NULL, 'minutes' => NULL, 'seconds' => NULL); }
public function replace_tag($tagdata = '', $params = '') { if ($tagdata == '') { return $tagdata; } $raw_content = parent::replace_tag($tagdata, $params); $content_obj = json_decode($raw_content); if (isset($content_obj->title_text)) { $tagdata = str_replace('{title_text}', $content_obj->title_text, $tagdata); } if (isset($content_obj->assets_file_id)) { ee()->load->add_package_path(PATH_THIRD . 'assets/'); require_once PATH_THIRD . 'assets/sources/ee/file.ee.php'; require_once PATH_THIRD . 'assets/helper.php'; ee()->load->library('Assets_lib'); $assets_file = ee()->assets_lib->get_file_by_id($content_obj->assets_file_id); $assets_helper = new Assets_helper(); $tagdata = $assets_helper->parse_file_tag(array($assets_file), $tagdata); } else { if (isset($content_obj->file_id)) { require_once APPPATH . 'fieldtypes/file/ft.file.php'; $ee_file = new File_ft(); $file_info = ee()->file_field->parse_field($content_obj->file_id); if ($file_info) { $tagdata = $ee_file->replace_tag($file_info, $params, $tagdata); } } } return $tagdata; }
/** * Constructor * * @access public * @return void */ public function __construct() { // include parent filter class if (!class_exists('Low_search_filter')) { require_once PATH_THIRD . 'low_search/filter.low_search.php'; } // Set filter path $this->_filter_path = PATH_THIRD . LOW_SEARCH_PACKAGE . '/filters/'; // Load directory helper ee()->load->helper('directory'); // Read filters directory and load up the filters foreach (directory_map($this->_filter_path, 1) as $item) { // Compose directory $dir = $this->_filter_path . $item; // Skip if not a dir if (!is_dir($dir)) { continue; } // Compose file name $file = $dir . "/lsf.{$item}.php"; // Skip if not a file if (!file_exists($file)) { continue; } // Compose class name $class = 'Low_search_filter_' . $item; if (!class_exists($class)) { require_once $file; } $this->_filters[] = new $class(); } // Sort by priority usort($this->_filters, array($this, '_by_priority')); }
/** * Performs the license check * * Yes, if you wanted to disable license checks in Backup Pro 2, you'd mess with this. * But.. c'mon... I've worked hard and it's just me... * * @param unknown $license * @param string $force */ public function validate($license, $force = false) { $valid = false; if ($license && $this->validLicense($license)) { $license_check = $license; $next_notified = mktime(date('G', $license_check) + 24, date('i', $license_check), 0, date('n', $license_check), date('j', $license_check), date('Y', $license_check)); if (time() > $next_notified || $force) { //license_check $get = array('ip' => ee()->input->ip_address(), 'key' => $this->settings['license_number'], 'site_url' => ee()->config->config['site_url'], 'webmaster_email' => ee()->config->config['webmaster_email'], 'add_on' => 'backup-pro', 'version' => '2.0.1'); $url = 'https://mithra62.com/license-check/' . base64_encode(json_encode($get)); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1"); $response = urldecode(curl_exec($ch)); $json = json_decode($response, true); if ($json && isset($json['valid'])) { return true; //ee()->backup_pro_settings->update_setting('license_status', $json['valid']); } else { //ee()->backup_pro_settings->update_setting('license_status', '0'); } return false; //ee()->backup_pro_settings->update_setting('license_check', time()); } } }
function do_update() { $Q[] = "ALTER TABLE `exp_search` CHANGE `query` `query` MEDIUMTEXT NULL DEFAULT NULL"; $Q[] = "ALTER TABLE `exp_search` CHANGE `custom_fields` `custom_fields` MEDIUMTEXT NULL DEFAULT NULL"; $Q[] = "ALTER TABLE `exp_templates` ADD `last_author_id` INT(10) UNSIGNED NOT NULL AFTER `edit_date`"; $Q[] = "ALTER TABLE `exp_revision_tracker` ADD `item_author_id` INT(10) UNSIGNED NOT NULL AFTER `item_date`"; $query = ee()->db->query('SHOW FIELDS FROM exp_weblog_data'); foreach ($query->result_array() as $row) { if (strncmp($row['Field'], 'field_ft', 8) == 0) { $Q[] = "ALTER TABLE `exp_weblog_data` CHANGE `{$row['Field']}` `{$row['Field']}` TINYTEXT NULL"; } } // run our queries foreach ($Q as $sql) { ee()->db->query($sql); } ee()->load->helper('string'); // We need to add a new template preference, so we'll fetch the existing site template prefs $query = ee()->db->query("SELECT site_id, site_template_preferences FROM exp_sites"); foreach ($query->result_array() as $row) { $prefs = strip_slashes(unserialize($row['site_template_preferences'])); // Add our new pref to the array $prefs['strict_urls'] = $prefs['site_404'] == FALSE ? 'n' : 'y'; // Update the DB ee()->db->query(ee()->db->update_string('exp_sites', array('site_template_preferences' => serialize($prefs)), "site_id = '" . $row['site_id'] . "'")); } return TRUE; }
/** * PHP Info * * @access public * @return void */ public function index() { if (!ee()->cp->allowed_group('can_access_utilities')) { show_error(lang('unauthorized_access')); } exit(phpinfo()); }
/** * Output Javascript * * Outputs Javascript files, triggered most commonly by an action request, * but also available as a tag if desired. * * @access public * @return string */ function load_site_pages() { $sites = ee()->TMPL->fetch_param('site', ''); $current_site = ee()->config->item('site_short_name'); // Always include the current site $site_names = explode('|', $sites); if (!in_array($current_site, $site_names)) { $site_names[] = $current_site; } // Fetch all pages ee()->db->select('site_pages, site_name, site_id'); ee()->db->where_in('site_name', $site_names); $query = ee()->db->get('sites'); $new_pages = array(); if ($query->num_rows() > 0) { foreach ($query->result_array() as $row) { $site_pages = unserialize(base64_decode($row['site_pages'])); if (is_array($site_pages)) { $new_pages += $site_pages; } } } // Update config ee()->config->set_item('site_pages', $new_pages); return ''; }
/** * Change email columns to varchar(75) * @return void */ private function _update_email_db_columns() { $changes = array('members' => 'email', 'email_cache' => 'from_email', 'email_console_cache' => 'recipient'); foreach ($changes as $table => $column) { ee()->smartforge->modify_column($table, array($column => array('name' => $column, 'type' => 'VARCHAR', 'constraint' => 75, 'null' => FALSE))); } }
/** * {@inheritdoc} */ protected function fire() { $names = $this->argument('name'); $siteId = ee()->config->item('site_id'); $siteName = ee()->config->item('site_short_name'); $query = ee()->db->select('variable_id, variable_name, variable_data')->where('site_id', $siteId)->where_in('variable_name', $names)->get('global_variables'); $globalVariables = array(); foreach ($query->result() as $row) { $globalVariables[$row->variable_name] = $row; } $query->free_result(); $hasLowVariables = array_key_exists('Low_variables_ext', ee()->extensions->version_numbers); foreach ($names as $name) { if (!isset($globalVariables[$name])) { $this->error('Global variable ' . $name . ' not found.'); continue; } $globalVariable = $globalVariables[$name]; if ($hasLowVariables && ee()->db->where('variable_id', $globalVariable->variable_id)->count_all_results('low_variables') > 0) { $this->error('Could not delete Low Variable ' . $name . '.'); continue; } ee()->db->delete('global_variables', array('variable_id' => $globalVariable->variable_id)); ee()->extensions->call('eecli_delete_global_variable', $globalVariable->variable_id, $globalVariable->variable_name, $globalVariable->variable_data, $siteId, $siteName); $this->info('Global variable ' . $name . ' deleted.'); } }
/** * Replace all of the simple conditionals * * @param String The tagdata to be parsed * @param Object The channel parser object * @param Mixed The results from the preparse method * * @return String The processed tagdata */ public function replace($tagdata, EE_Channel_data_parser $obj, $pre) { $tag = $obj->tag(); $tag_options = $obj->tag_options(); $data = $obj->row(); $prefix = $obj->prefix(); // @todo $key = $tag; $val = $tag_options; $cfields = $obj->channel()->cfields; if (strpos($key, '|') !== FALSE && is_array($val)) { foreach ($val as $item) { // Basic fields if (isset($data[$item]) and $data[$item] != "") { $tagdata = str_replace(LD . $prefix . $key . RD, $data[$item], $tagdata); continue; } // Custom channel fields if (isset($this->cfields[$data['site_id']][$item]) and isset($data['field_id_' . $cfields[$data['site_id']][$item]]) and $data['field_id_' . $cfields[$data['site_id']][$item]] != "") { $entry = ee()->typography->parse_type($data['field_id_' . $cfields[$data['site_id']][$item]], array('text_format' => $data['field_ft_' . $cfields[$data['site_id']][$item]], 'html_format' => $data['channel_html_formatting'], 'auto_links' => $data['channel_auto_link_urls'], 'allow_img_url' => $data['channel_allow_img_urls'])); $tagdata = str_replace(LD . $prefix . $key . RD, $entry, $tagdata); continue; } } // Garbage collection $val = ''; $tagdata = str_replace(LD . $prefix . $key . RD, "", $tagdata); } return $tagdata; }
/** * 登入方法 * @param null $input * @return array */ public function login($input = null) { $input = $input ? $input : rq(); if (!empty($input['user_type']) && $input['user_type'] == 'doctor' && !empty($input['cust_id'])) { $d = M('doctor'); $d = $d->where('cust_id', $input['cust_id'])->first(); if ($d) { log_him_in(['uid' => $d->id]); add_chara($input['user_type']); return ss(); } return $d ? ss($d) : ee(2); } if (!empty($input['user_type']) && !empty($input['username']) && !empty($input['password'])) { $input['password'] = hash_password($input['password']); $user = $this->user_exists($input['user_type'], array_only($input, ['username', 'password'])); if ($user) { log_him_in(['username' => $user->username, 'uid' => $user->id]); add_chara($input['user_type']); return ss(); } } else { return ee(2); } return ee(2); }
/** * SC_Session * * @access public * @param mixed $config * @return void */ public function __construct($config) { $this->EE =& get_instance(); $this->session_object = isset($config['session_object']) ? $config['session_object'] : NULL; $this->logged_out_member_id = isset($config['logged_out_member_id']) ? $config['logged_out_member_id'] : NULL; $this->logged_out_group_id = isset($config['logged_out_group_id']) ? $config['logged_out_group_id'] : NULL; if (is_object($this->session_object)) { foreach (get_object_vars($this->session_object) as $key => $value) { $this->{$key} = $value; } } if ($this->logged_out_member_id) { $this->userdata['member_id'] = $this->logged_out_member_id; } if ($this->logged_out_group_id) { $this->userdata['group_id'] = $this->logged_out_group_id; } $this->userdata['assigned_channels'] = array(); ee()->db->select('exp_channels.channel_id, exp_channels.channel_title'); ee()->db->where('exp_channels.site_id', ee()->config->item('site_id')); ee()->db->order_by('exp_channels.channel_title'); if ($this->userdata('group_id') != 1) { ee()->db->join('exp_channel_member_groups', 'exp_channel_member_groups.channel_id = exp_channels.channel_id'); ee()->db->where('exp_channel_member_groups.group_id', $this->userdata('group_id')); } $query = ee()->db->get('exp_channels'); foreach ($query->result() as $row) { $this->userdata['assigned_channels'][$row->channel_id] = $row->channel_title; } }
function __construct() { // Extract the query from the tag chunk if (($sql = ee()->TMPL->fetch_param('sql')) === FALSE) { return FALSE; } // Rudimentary check to see if it's a SELECT query, most definitely not // bulletproof if (substr(strtolower(trim($sql)), 0, 6) != 'select') { return FALSE; } $query = ee()->db->query($sql); $results = $query->result_array(); if ($query->num_rows() == 0) { return $this->return_data = ee()->TMPL->no_results(); } // Start up pagination ee()->load->library('pagination'); $pagination = ee()->pagination->create(); ee()->TMPL->tagdata = $pagination->prepare(ee()->TMPL->tagdata); $per_page = ee()->TMPL->fetch_param('limit', 0); // Disable pagination if the limit parameter isn't set if (empty($per_page)) { $pagination->paginate = FALSE; } if ($pagination->paginate) { $pagination->build($query->num_rows(), $per_page); $results = array_slice($results, $pagination->offset, $pagination->per_page); } $this->return_data = ee()->TMPL->parse_variables(ee()->TMPL->tagdata, array_values($results)); if ($pagination->paginate === TRUE) { $this->return_data = $pagination->render($this->return_data); } }
/** * Constructor */ public function __construct() { $table = "exp_relationships"; $child = ee()->TMPL->fetch_param('child_id'); $result = ee()->db->from($table)->where(array('child_id' => $child))->order_by("relationship_id", "asc")->get(); if ($result->num_rows() > 0) { foreach ($result->result() as $num => $row) { $name = $row->parent_id; $channel_search = ee()->db->from('exp_channel_titles')->where(array('entry_id' => $name))->order_by("entry_id", "asc")->get(); if ($channel_search->num_rows() > 0) { foreach ($channel_search->result() as $number => $data) { $vars[$num]['parent_count'] = $num; $vars[$num]['parent_entry_id'] = $data->entry_id; $vars[$num]['parent_title'] = $data->title; $vars[$num]['parent_url_title'] = $data->url_title; } } else { $vars[$num]['parent_count'] = ""; $vars[$num]['parent_entry_id'] = ""; $vars[$num]['parent_title'] = ""; $vars[$num]['parent_url_title'] = ""; } } } else { $vars[0]['parent_count'] = ""; $vars[0]['parent_entry_id'] = ""; $vars[0]['parent_title'] = ""; $vars[0]['parent_url_title'] = ""; } $this->return_data = ee()->TMPL->parse_variables(ee()->TMPL->tagdata, $vars); }