/** * 200: ok * 201: ok, new entry * 400: malformed * 401: authentication failed, no account, no token provided * 403: authenticated account may not have been paid or quota is full * 404: not found or could not be created * 405: api access forbidden for this (authenticated and existing) account */ function __construct() { parent::__construct(); if ($this->config->item('account_support')) { $this->load->add_package_path(APPPATH . 'third_party/account'); } $this->load->library('account'); $params = $this->_get_params(); $request_token = $this->_get_request_token(); $account_status = $this->_get_account_status($params); $trusted = $this->_is_trusted_request(); $this->load->library('api_ver1', array('props' => $params, 'account_status' => $account_status, 'request_token' => $request_token, 'trusted' => $trusted, 'http_method' => $_SERVER['REQUEST_METHOD'])); $this->load->helper(array('json', 'subdomain')); /*if ($_SERVER['SERVER_PORT'] != '443'){ $this->output ->set_status_header('405') ->set_output('API access only allowed through encrypted (https) connections'); exit(); } else {*/ //$this->_set_properties(); //} if (get_subdomain()) { show_error('API not accessible on subdomain', 404); } log_message('debug', 'API_v1 controller initialized'); }
function __construct() { parent::__construct(); $this->load->helper(array('subdomain', 'url', 'form')); $this->load->model('Survey_model', '', TRUE); $this->load->library(array('encrypt', 'meta')); $sub = get_subdomain(); $suf = $this->Survey_model->ONLINE_SUBDOMAIN_SUFFIX; $this->subdomain = $this->Survey_model->has_offline_launch_enabled() ? $sub : substr($sub, 0, strlen($sub) - strlen($suf)); if (!empty($this->subdomain)) { $form_props = $this->Survey_model->get_form_props(); $this->server_url = isset($form_props['server_url']) ? $form_props['server_url'] : NULL; $this->form_id = isset($form_props['form_id']) ? $form_props['form_id'] : NULL; $this->form_hash_prev = isset($form_props['hash']) ? $form_props['hash'] : NULL; $this->media_hash_prev = isset($form_props['media_hash']) ? $form_props['media_hash'] : NULL; $this->xsl_version_prev = isset($form_props['xsl_version']) ? $form_props['xsl_version'] : NULL; } $this->iframe = $this->input->get('iframe', TRUE) == 'true'; if ($this->config->item('auth_support')) { $this->load->add_package_path(APPPATH . 'third_party/form_auth'); } $this->load->library('form_auth'); if ($this->config->item('account_support')) { $this->load->add_package_path(APPPATH . 'third_party/account'); } $this->load->library('account'); log_message('debug', 'Webform Controller Initialized'); }
private function remove() { $v = _request(array('event' => 0)); if (_empty($v)) { return; } $sql = 'SELECT * FROM _events WHERE id = ?'; if (!$row = sql_fieldrow(sql_filter($sql, $event))) { _pre('El evento no existe.', true); } $e_artist = explode(nr(), $artist); foreach ($e_artist as $row) { $subdomain = get_subdomain($row); $sql = 'SELECT * FROM _artists WHERE subdomain = ?'; if ($a_row = sql_fieldrow(sql_filter($sql, $subdomain))) { $sql = 'DELETE FROM _artists_events WHERE a_artist = ? AND a_event = ?'; sql_query(sql_filter($sql, $a_row['ub'], $event)); } } return redirect(s_link('events', $row['event_alias'])); }
function __construct() { parent::__construct(); $this->load->helper(array('subdomain', 'url')); $this->load->database(); if (get_subdomain()) { log_message('debug', 'front controller loaded with subdomain -> sending 404'); show_404(); } }
function __construct() { parent::__construct(); $this->load->helper(array('subdomain', 'url', 'string', 'http')); //$this->load->model('Account_model'); $this->subdomain = get_subdomain(); $this->ONLINE_SUBDOMAIN_SUFFIX = '-0'; $this->db_subdomain = $this->_has_subdomain_suffix() ? substr($this->subdomain, 0, strlen($this->subdomain) - strlen($this->ONLINE_SUBDOMAIN_SUFFIX)) : $this->subdomain; log_message('debug', 'Survey model initalized'); }
public function index() { $this->load->helper(array('url', 'subdomain')); if (get_subdomain()) { show_404(); } $default_stylesheets = array(array('href' => '/build/css/forms.css', 'media' => 'screen')); $data = array('title_component' => 'forms', 'robots' => TRUE, 'stylesheets' => $default_stylesheets); $data['scripts'] = ENVIRONMENT === 'production' ? array(array('src' => '/build/js/formlist-combined.min.js')) : array(array('src' => '/lib/bower-components/requirejs/require.js', 'data-main' => '/src/js/main-formlist.js')); //$this->output->cache(10); $this->load->view('formlist_view', $data); }
public function __construct() { parent::__construct(); $this->load->helper(array('subdomain', 'url', 'json')); $this->subdomain = get_subdomain(); //from subdomain helper $this->load->model('Survey_model', '', TRUE); $this->load->model('Form_model'); if ($this->config->item('auth_support')) { $this->load->add_package_path(APPPATH . 'third_party/form_auth'); } $this->load->library('form_auth'); $this->credentials = $this->form_auth->get_credentials(); }
function get_active($page, $CONF) { $cur_page = ''; switch ($CONF['url_type']) { case 'sub': $cur_page = get_subdomain($CONF); break; case 'page': $cur_page = get_page(); break; } if ($cur_page == $page) { return 'active'; } return ""; }
public function index() { $this->load->helper('subdomain'); $this->load->helper('url'); $subdomain = get_subdomain(); //from subdomain helper if (isset($subdomain)) { show_404(); } else { $data = array('offline' => FALSE, 'title_component' => 'form-tester', 'robots' => TRUE); $default_stylesheets = array(array('href' => '/build/css/formtester.css', 'media' => 'all'), array('href' => 'build/css/webform_print_formhub.css', 'media' => 'print')); $data['scripts'] = ENVIRONMENT === 'production' ? array(array('src' => '/build/js/webform-tester-combined.min.js')) : array(array('src' => '/lib/bower-components/requirejs/require.js', 'data-main' => '/src/js/main-webform-tester.js')); $data['stylesheets'] = $default_stylesheets; //$this->output->cache(10); $this->load->view('formtester_view', $data); } }
// cmdline $p = $_SERVER['DOCUMENT_ROOT']; if (isset($_SERVER['PWD'])) { $p = $_SERVER['PWD']; } $a = explode('/', $p); // /home/pwnoogle/htdocs/emulive/htdocs // DEBUG // print_r ($a); if (isset($a[count($a) - 2])) { return $a[count($a) - 2]; } return ''; } $config_domain = get_hostname(); $config_subdomain = get_subdomain(); // DEBUG //echo '$config_domain=='.$config_domain."<br>\n"; //echo '$config_subdomain=='.$config_subdomain."<br>\n"; /* // HACK if (in_array ($config_subdomain, array ('', 'www'))) $config_subdomain = 'rsscache'; if (isset ($_SERVER['PWD'])) $pwd = $_SERVER['PWD'].'/../htdocs/'; else $pwd = $_SERVER['DOCUMENT_ROOT']; if (!file_exists ($pwd.'/'.$config_subdomain.'_config.php')) $config_subdomain = 'rsscache';
<div class="block first center"> <div class="block-header"><h2>Log In To <?php echo get_subdomain(); ?> 's Turnip</h2></div> <div class="block-content"> <?php $login = array('name' => 'login', 'id' => 'login', 'value' => set_value('login'), 'maxlength' => 80, 'size' => 30); $login_label = 'Email'; $password = array('name' => 'password', 'id' => 'password', 'size' => 30); $remember = array('name' => 'remember', 'id' => 'remember', 'value' => 1, 'checked' => set_value('remember'), 'style' => 'margin:0;padding:0'); $captcha = array('name' => 'captcha', 'id' => 'captcha', 'maxlength' => 8); $submit = array('name' => 'submit', 'type' => 'submit', 'content' => 'Come On In'); ?> <?php $valerrors = validation_errors(); ?> <?php if ($errors || $valerrors) { ?> <div class="status error"> <?php echo $valerrors; ?> <?php foreach ($errors as $error) { ?> <?php
public function _home() { global $config, $user, $cache, $upload; $error = w(); if (_button()) { $filepath = $config['events_path']; $filepath_1 = $filepath . 'future/'; $filepath_2 = $filepath_1 . 'thumbnails/'; $f = $upload->process($filepath_1, 'event_image', 'jpg'); if (!sizeof($upload->error) && $f !== false) { $img = sql_total('_events'); // Create vars $event_name = request_var('event_name', ''); $event_artists = request_var('event_artists', '', true); $event_year = request_var('event_year', 0); $event_month = request_var('event_month', 0); $event_day = request_var('event_day', 0); $event_hours = request_var('event_hours', 0); $event_minutes = request_var('event_minutes', 0); $event_current_topic = request_var('event_current_topic', 0); $v_date = gmmktime($event_hours, $event_minutes, 0, $event_month, $event_day, $event_year) - $user->timezone - $user->dst; foreach ($f as $row) { $xa = $upload->resize($row, $filepath_1, $filepath_1, $img, array(600, 400), false, false, true); if ($xa === false) { continue; } $xb = $upload->resize($row, $filepath_1, $filepath_2, $img, array(100, 75), false, false); $event_alias = friendly($event_name); $insert = array( 'event_alias' => $event_alias, 'title' => $event_name, 'archive' => '', 'date' => (int) $v_date, 'event_update' => time() ); $event_id = sql_insert('events', $insert); // $artists_ary = explode(nr(), $event_artists); foreach ($artists_ary as $row) { $subdomain = get_subdomain($row); $sql = 'SELECT * FROM _artists WHERE subdomain = ?'; if ($a_row = sql_fieldrow(sql_filter($sql, $subdomain))) { $sql = 'SELECT * FROM _artists_events WHERE a_artist = ? AND a_event = ?'; if (!sql_fieldrow(sql_filter($sql, $a_row['ub'], $event_id))) { $sql_insert = array( 'a_artist' => $a_row['ub'], 'a_event' => $event_id ); sql_insert('artists_events', $sql_insert); } } } // Alice: Create topic $event_url = $config['events_url'] . 'future/' . $img . '.jpg'; $post_message = 'Evento publicado'; $post_time = time(); $forum_id = 21; $poster_id = 1433; $sql = 'SELECT * FROM _forum_topics WHERE topic_id = ?'; if (!$row_current_topic = sql_fieldrow(sql_filter($sql, $event_current_topic))) { $insert = array( 'topic_title' => $event_name, 'topic_poster' => $poster_id, 'topic_time' => $post_time, 'forum_id' => $forum_id, 'topic_locked' => 0, 'topic_announce' => 0, 'topic_important' => 0, 'topic_vote' => 1, 'topic_featured' => 1, 'topic_points' => 1 ); $topic_id = sql_insert('forum_topics', $insert); $event_current_topic = 0; } else { $topic_id = $event_current_topic; $post_message .= ' en la sección de eventos'; $sql = 'UPDATE _forum_topics SET topic_title = ? WHERE topic_id = ?'; sql_query(sql_filter($sql, $event_name, $topic_id)); } $post_message .= '.'; $insert = array( 'topic_id' => (int) $topic_id, 'forum_id' => $forum_id, 'poster_id' => $poster_id, 'post_time' => $post_time, 'poster_ip' => $user->ip, 'post_text' => $post_message, 'post_np' => '' ); $post_id = sql_insert('forum_posts', $insert); $sql = 'UPDATE _events SET event_topic = ? WHERE id = ?'; sql_query(sql_filter($sql, $topic_id, $event_id)); $insert = array( 'topic_id' => (int) $topic_id, 'vote_text' => '¿Asistirás a ' . $event_name . '?', 'vote_start' => time(), 'vote_length' => (int) ($poll_length * 86400) ); $poll_id = sql_insert('poll_options', $insert); $poll_options = array(1 => 'Si asistiré'); foreach ($poll_options as $option_id => $option_text) { $sql_insert = array( 'vote_id' => (int) $poll_id, 'vote_option_id' => (int) $option_id, 'vote_option_text' => $option_text, 'vote_result' => 0 ); sql_insert('poll_results', $sql_insert); $poll_option_id++; } $sql = 'UPDATE _forums SET forum_posts = forum_posts + 1, forum_last_topic_id = ?' . ((!$event_current_topic) ? ', forum_topics = forum_topics + 1 ' : '') . ' WHERE forum_id = ?'; sql_query(sql_filter($sql, $topic_id, $forum_id)); $sql = 'UPDATE _forum_topics SET topic_first_post_id = ?, topic_last_post_id = ? WHERE topic_id = ?'; sql_query(sql_filter($sql, $post_id, $post_id, $topic_id)); $sql = 'UPDATE _members SET user_posts = user_posts + 1 WHERE user_id = ?'; sql_query(sql_filter($sql, $poster_id)); // Notify $user->save_unread(UH_T, $topic_id); redirect(s_link('events', $event_alias)); } } _style('error', array( 'MESSAGE' => parse_error($upload->error)) ); } $sql = 'SELECT topic_id, topic_title FROM _forum_topics t LEFT OUTER JOIN _events e ON t.topic_id = e.event_topic WHERE e.event_topic IS NULL AND forum_id = 21 ORDER BY topic_time DESC'; $topics = sql_rowset($sql); foreach ($topics as $i => $row) { if (!$i) _style('topics'); _style('topics.row', array( 'TOPIC_ID' => $row['topic_id'], 'TOPIC_TITLE' => $row['topic_title']) ); } return; }
public function _home() { global $config, $user, $cache; if (!_button()) { return false; } $request = _request(array('name' => '', 'local' => 0, 'location' => '', 'genre' => '', 'email' => '', 'www' => '', 'mods' => '')); $request->subdomain = get_subdomain($request->name); if (!$request->name) { _pre('Ingresa el nombre del artista.', true); } $sql_insert = array( 'a_active' => 1, 'subdomain' => $request->subdomain, 'name' => $request->name, 'local' => (int) $request->local, 'datetime' => time(), 'location' => $request->location, 'genre' => $requeset->genre, 'email' => $request->email, 'www' => str_replace('http://', '', $request->www) ); $artist_id = sql_insert('artists', $sql_insert); // Cache $cache->delete('ub_list a_records ai_records a_recent'); set_config('max_artists', $config['max_artists'] + 1); // Create directories artist_check($artist_id); artist_check($artist_id . ' gallery'); artist_check($artist_id . ' media'); artist_check($artist_id . ' thumbnails'); artist_check($artist_id . ' x1'); // Mods if (!empty($request->mods)) { $usernames = w(); $a_mods = explode(nr(), $request->mods); foreach ($a_mods as $each) { $username_base = get_username_base($each); $sql = 'SELECT * FROM _members WHERE username_base = ? AND user_type <> ? AND user_id <> ?'; if (!$userdata = sql_fieldrow(sql_filter($sql, $username_base, USER_INACTIVE, 1))) { continue; } $sql_insert = array( 'ub' => $artist_id, 'user_id' => $userdata['user_id'] ); sql_insert('artists_auth', $sql_insert); // $update = array('user_type' => USER_ARTIST, 'user_auth_control' => 1); if (!$userdata['user_rank']) { $update['user_rank'] = (int) $config['default_a_rank']; } $sql = 'UPDATE _members SET ?? WHERE user_id = ? AND user_type NOT IN (??, ??)'; sql_query(sql_filter($sql, sql_build('UPDATE', $update), $userdata['user_id'], USER_INACTIVE, USER_FOUNDER)); } redirect(s_link('a', $subdomain)); } }
public function __construct() { parent::__construct(); if (!file_exists(APPPATH . 'controllers/install/lock')) { header('Location: install'); exit; } $this->load->database(); if (!$this->db->initialize()) { echo "Oops! We can't establish a database connection!"; exit; } $this->config->load('dhoblog', TRUE); $this->dhoblog_config = $this->config->item('dhoblog'); $this->load->model(array('categories_model', 'posts_model', 'menus_model', 'pages_model', 'users_model', 'sites_model', 'tags_model', 'sidebar_model', 'links_model')); $this->load->library(array('themes', 'pagination', 'permalinks', 'form_validation', 'sites', 'access', 'session')); $this->load->helper(array('url', 'permissions', 'datetime', 'domain')); $this->output->set_header('X-XSS-Protection: 1; mode=block'); $this->output->set_header('X-Frame-Options: DENY'); $this->output->set_header('X-Content-Type-Options: nosniff'); $site = $this->sites->get_site(base_url()); if ($site) { $this->blog_id = $site['blog_id']; $this->site_id = $site['site_id']; $this->blog_domain = $site['blog_domain']; $this->blog_registered = $site['blog_registered']; $this->blog_last_updated = $site['blog_last_updated']; $this->blog_status = $site['blog_status']; if ($this->dhoblog_config['blog_id_current_site'] == $this->blog_id) { $this->table_categories = 'categories'; $this->table_category_relationships = 'category_relationships'; $this->table_comments = 'comments'; $this->table_links = 'links'; $this->table_menus = 'menus'; $this->table_pages = 'pages'; $this->table_posts = 'posts'; $this->table_sidebar = 'sidebar'; $this->table_settings = 'settings'; $this->table_tags = 'tags'; $this->table_tag_relationships = 'tags_relationships'; } else { $this->table_categories = $this->blog_id . '_categories'; $this->table_category_relationships = $this->blog_id . '_category_relationships'; $this->table_comments = $this->blog_id . '_comments'; $this->table_links = $this->blog_id . '_links'; $this->table_menus = $this->blog_id . '_menus'; $this->table_pages = $this->blog_id . '_pages'; $this->table_posts = $this->blog_id . '_posts'; $this->table_sidebar = $this->blog_id . '_sidebar'; $this->table_settings = $this->blog_id . '_settings'; $this->table_tags = $this->blog_id . '_tags'; $this->table_tag_relationships = $this->blog_id . '_tags_relationships'; } $this->sites->get_site_settings(); if ($this->blog_status == "spam") { $this->data['title'] = "Site Spammed!"; $this->data['status'] = "This site has marked as spam!"; $this->data['reason'] = "Reason: Un-natural posting!"; $this->data['container'] = "error/status"; $this->themes->load($this->data); exit; } elseif ($this->blog_status == "deleted") { $this->data['title'] = "Site Deleted!"; $this->data['status'] = "This site has been deleted!"; $this->data['reason'] = "Reason: TOS Violation!"; $this->data['container'] = "error/status"; $this->themes->load($this->data); exit; } date_default_timezone_set($this->timezone); $this->user_id = $this->session->userdata('user_id') ? $this->session->userdata('user_id') : NULL; $this->user_name = $this->session->userdata('user_name') ? $this->session->userdata('user_name') : NULL; $this->user_display_name = $this->session->userdata('user_display_name') ? $this->session->userdata('user_display_name') : NULL; } else { $new = get_subdomain(base_url()); redirect('http://' . $this->dhoblog_config['domain_current_site'] . '/user/register?new=' . $new); } }
<?php /** * 二级域名解析 * * @author Garbin */ /* 获取二级域名 */ $subdomain = get_subdomain(); /* 没有二级域名,不解析 */ if ($subdomain === false) { return; } /* 二级域名功能未开启,不解析 */ if (!ENABLED_SUBDOMAIN) { header('Location:' . SITE_URL); return; } /* 解析对应的二级域名到对应的店铺上 */ $store_id = get_subdomain_store_id($subdomain); if ($store_id === false) { /* 无效的二级域名 */ header('Location:' . SITE_URL); return; } /* 目前只支持店铺首页二级域名 */ define('SUBDOMAIN', $subdomain); $_GET['app'] = $_REQUEST['app'] = 'store'; $_GET['act'] = $_REQUEST['act'] = 'index'; $_GET['id'] = $_REQUEST['id'] = $store_id; /**
/** * Check if the current subdomain has been registered or not. * * @param string * @return bool */ function is_available_subdomain() { return $this->ci->users->is_subdomain_available(get_subdomain()); }
private function _set_data() { //if a subdomain is present, this manifest is meant for a survey and needs to be live, launched and offline-enabled if (get_subdomain() && $this->Survey_model->is_launched_live_and_offline() || !get_subdomain()) { $this->data['hashes'] = ''; $this->data['cache'] = $this->pages; foreach ($this->pages as $page) { //log_message('debug', 'checking resources on page: '.$this->_full_url($page)); $page_full_url = $this->_full_url($page . '?manifest=true&s=' . urlencode($this->session->userdata('session_id')) . '&token=' . urlencode($this->encrypt->encode('localrequest'))); $result = $this->_add_resources_to_cache($page_full_url); if (!$result) { //if the master page is null, cancel everything and return a 404 if ($page === $this->pages[0]) { $this->data['cache'] = array(); return; } //remove non-existing page from manifest $key = array_search($page, $this->data['cache']); unset($this->data['cache'][$key]); } } //remove Master page $key = array_search($this->master_page, $this->data['cache']); unset($this->data['cache'][$key]); $this->data['hashes'] = md5($this->data['hashes']) . '_' . $this->hash_manual_override; //hash of hashes $this->data['network'] = $this->network; $this->data['fallback'] = $this->offline; } }
/** * Check if username available for registering * * @param string * @return bool */ function is_username_available($username) { $this->db->select('1', FALSE); $this->db->where('LOWER(username)=', strtolower($username)); $this->db->where('LOWER(subdomain)=', strtolower(get_subdomain())); $query = $this->db->get($this->table_name); return $query->num_rows() == 0; }