コード例 #1
0
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @param  ?ID_TEXT	Catalogue we'll be using (NULL: unknown).
  * @return ?array		Map of award content-type info (NULL: disabled).
  */
 function info($catalogue_name = NULL)
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'catalogue_entries';
     $info['date_field'] = 'ce_add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues') ? build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue_name), get_module_zone('cms_catalogues')) : new ocp_tempcode();
     $info['category_field'] = array('c_name', 'cc_id');
     $info['category_type'] = array('catalogues_catalogue', 'catalogues_category');
     $info['parent_spec__table_name'] = 'catalogue_categories';
     $info['parent_spec__parent_name'] = 'cc_parent_id';
     $info['parent_spec__field_name'] = 'id';
     $info['parent_field_name'] = 'cc_id';
     $info['submitter_field'] = 'ce_submitter';
     $info['id_is_string'] = false;
     require_lang('catalogues');
     $info['title'] = do_lang_tempcode('CATALOGUE_ENTRIES');
     $info['validated_field'] = 'ce_validated';
     $info['category_is_string'] = array(true, false);
     $info['archive_url'] = build_url(array('page' => 'catalogues'), get_module_zone('catalogues'));
     $info['cms_page'] = 'cms_catalogues';
     $info['views_field'] = 'ce_views';
     return $info;
 }
コード例 #2
0
ファイル: download.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'download_downloads';
     $info['date_field'] = 'add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads') ? build_url(array('page' => 'cms_downloads', 'type' => 'ad'), get_module_zone('cms_downloads')) : new ocp_tempcode();
     $info['category_field'] = 'category_id';
     $info['category_type'] = 'downloads';
     $info['parent_spec__table_name'] = 'download_categories';
     $info['parent_spec__parent_name'] = 'parent_id';
     $info['parent_spec__field_name'] = 'id';
     $info['parent_field_name'] = 'id';
     $info['submitter_field'] = 'submitter';
     $info['id_is_string'] = false;
     require_lang('downloads');
     $info['title'] = do_lang_tempcode('SECTION_DOWNLOADS');
     $info['validated_field'] = 'validated';
     $info['category_is_string'] = false;
     $info['archive_url'] = build_url(array('page' => 'downloads'), get_module_zone('downloads'));
     $info['cms_page'] = 'cms_downloads';
     $info['views_field'] = 'download_views';
     $info['supports_custom_fields'] = true;
     return $info;
 }
コード例 #3
0
ファイル: seedy_post.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'seedy_posts';
     $info['date_field'] = 'date_and_time';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('low', get_member(), get_ip_address(), 'cedi') ? build_url(array('page' => 'cedi', 'type' => 'add_post'), get_module_zone('cedi')) : new ocp_tempcode();
     $info['category_field'] = 'page_id';
     $info['category_type'] = 'seedy_page';
     $info['parent_spec__table_name'] = 'seedy_children';
     $info['parent_spec__parent_name'] = 'parent_id';
     $info['parent_spec__field_name'] = 'child_id';
     $info['parent_field_name'] = 'page_id';
     $info['submitter_field'] = 'the_user';
     $info['id_is_string'] = false;
     require_lang('cedi');
     $info['title'] = do_lang_tempcode('CEDI_POSTS');
     $info['validated_field'] = 'validated';
     $info['category_is_string'] = false;
     $info['archive_url'] = build_url(array('page' => 'cedi'), get_module_zone('cedi'));
     $info['cms_page'] = 'cedi';
     $info['supports_custom_fields'] = true;
     return $info;
 }
コード例 #4
0
ファイル: reports.php プロジェクト: nwtug/academia
 function add_report()
 {
     access_control($this);
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'i'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     #Get the report details if the user is editing
     if (!empty($data['i'])) {
         $editid = decryptValue($data['i']);
         $data['formdata'] = $this->Query_reader->get_row_as_array('get_report_by_id', array('id' => $editid));
     }
     #Save the report details
     if ($this->input->post('savereport')) {
         $required_fields = array('reportname');
         $_POST = clean_form_data($_POST);
         $validation_results = validate_form('', $_POST, $required_fields);
         #Only proceed if the validation for required fields passes
         if ($validation_results['bool']) {
             $save_result = false;
             #Save/Update an existing report's details
             if (!empty($data['formdata']) && !empty($data['i'])) {
                 $updateStr = '';
                 #check if report has changed
                 if (!empty($_FILES['fileurl']['tmp_name'])) {
                     $new_file_url = 'ny_' . strtotime('now') . generate_random_letter() . "." . end(explode('.', $_FILES['fileurl']['name']));
                     if (copy(str_replace("/kunden/", "/", $_FILES['fileurl']['tmp_name']), UPLOAD_DIRECTORY . "reports/" . $new_file_url)) {
                         #Delete the previous report from the server if it exists
                         if (!empty($data['formdata']['fileurl'])) {
                             @unlink(UPLOAD_DIRECTORY . "reports/" . $data['formdata']['fileurl']);
                         }
                         $save_result = $this->db->query($this->Query_reader->get_query_by_code('update_report', array('updatestring' => ', fileurl = \'' . $new_file_url . '\' , uploadip = \'' . get_ip_address() . '\'', 'reportname' => $_POST['reportname'], 'id' => $editid)));
                     }
                 } else {
                     $save_result = $this->db->query($this->Query_reader->get_query_by_code('update_report', array_merge($_POST, array('id' => $editid, 'updatestring' => ''))));
                 }
             } else {
                 $new_file_url = 'ny_' . strtotime('now') . generate_random_letter() . "." . end(explode('.', $_FILES['fileurl']['name']));
                 #First move the report to the correct folder and then add the report
                 if (copy(str_replace("/kunden/", "/", $_FILES['fileurl']['tmp_name']), UPLOAD_DIRECTORY . "reports/" . $new_file_url)) {
                     $save_result = $this->db->query($this->Query_reader->get_query_by_code('add_report', array('fileurl' => $new_file_url, 'reportname' => $_POST['reportname'], 'uploadip' => get_ip_address())));
                 }
             }
             if ($save_result) {
                 $data['msg'] = "The report has been saved.";
                 $this->session->set_userdata('sres', $data['msg']);
                 redirect(base_url() . "reports/manage_reports/m/sres");
             } else {
                 $data['msg'] = "ERROR: The report was not saved. Please contact your administrator.";
             }
         }
         #VALIDATION end
         if ((empty($validation_results['bool']) || !empty($validation_results['bool']) && !$validation_results['bool']) && empty($data['msg'])) {
             $data['msg'] = "WARNING: The highlighted fields are required.";
         }
         $data['requiredfields'] = $validation_results['requiredfields'];
         $data['formdata'] = $_POST;
     }
     $this->load->view('reports/add_report_view', $data);
 }
コード例 #5
0
ファイル: catalogues.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
  *
  * @param  boolean		Whether to look deep into the database (or whatever else might be time-intensive) for links
  * @return array			Array of links and where to show
  */
 function run($exhaustive = false)
 {
     if (!addon_installed('catalogues')) {
         return array();
     }
     $ret = array();
     if (has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_catalogues')) {
         $ret[] = array('cms', 'catalogues', array('cms_catalogues', array('type' => 'misc'), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('CATALOGUES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'COUNT(*)', NULL, '', true))))), 'DOC_CATALOGUES');
     }
     if ($exhaustive) {
         $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_name', 'c_title', 'c_description', 'c_ecommerce'), NULL, '', 10, NULL, true);
         if (!is_null($catalogues)) {
             $ret2 = array();
             foreach ($catalogues as $row) {
                 if (substr($row['c_name'], 0, 1) == '_') {
                     continue;
                 }
                 if ($row['c_ecommerce'] == 0 || addon_installed('shopping')) {
                     if (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues', array('catalogues_catalogue', $row['c_name']))) {
                         $ret2[] = array('cms', 'of_catalogues', array('cms_catalogues', array('type' => 'misc', 'catalogue_name' => $row['c_name']), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', escape_html(get_translated_text($row['c_title'])), escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogue_entries', 'COUNT(*)', array('c_name' => $row['c_name']), '', true)))), get_translated_text($row['c_description']));
                     }
                 }
             }
             if (count($ret2) < 10) {
                 $ret = array_merge($ret, $ret2);
             }
         }
     }
     return $ret;
 }
コード例 #6
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('catalogues');
     require_lang('catalogues');
     require_css('catalogues');
     $number = array_key_exists('param', $map) ? intval($map['param']) : 10;
     $catalogue = array_key_exists('catalogue', $map) ? $map['catalogue'] : 'faqs';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('catalogues');
     $root = array_key_exists('root', $map) && $map['root'] != '' ? intval($map['root']) : NULL;
     $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue), '', 1);
     if (!array_key_exists(0, $catalogues)) {
         return do_lang_tempcode('MISSING_RESOURCE', escape_html($catalogue));
     }
     $catalogue_row = $catalogues[0];
     $entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('c_name' => $catalogue, 'ce_validated' => 1), 'ORDER BY ce_add_date DESC', $number);
     $tpl_set = $catalogue;
     $display_type = array_key_exists('display_type', $map) ? intval($map['display_type']) : NULL;
     list($content, , ) = get_catalogue_category_entry_buildup(db_get_first_id(), $catalogue, $catalogue_row, 'SEARCH', $tpl_set, $number, 0, NULL, $root, $display_type, false, $entries);
     $catalogue_title = get_translated_text($catalogue_row['c_title']);
     if ($content->is_empty()) {
         if (has_actual_page_access(NULL, 'cms_catalogues', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues')) {
             $submit_url = build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue, 'redirect' => SELF_REDIRECT), get_module_zone('cms_catalogues'));
         } else {
             $submit_url = new ocp_tempcode();
         }
         return do_template('BLOCK_NO_ENTRIES', array('HIGH' => false, 'TITLE' => do_lang_tempcode('RECENT', escape_html(integer_format($number)), escape_html($catalogue_title)), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('CATALOGUE_GENERIC_ADD', escape_html($catalogue_title)), 'SUBMIT_URL' => $submit_url));
     }
     return do_template('BLOCK_MAIN_RECENT_CC_ENTRIES', array('_GUID' => 'a57fa1b83d1b6fe3acbceb2b618e6d7f', 'CATALOGUE_TITLE' => $catalogue_title, 'CATALOGUE' => $catalogue, 'CONTENT' => $content, 'NUMBER' => integer_format($number)));
 }
コード例 #7
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('downloads');
     require_css('downloads');
     require_lang('downloads');
     require_code('ocfiltering');
     $number = array_key_exists('param', $map) ? intval($map['param']) : 10;
     $filter = array_key_exists('filter', $map) ? $map['filter'] : '*';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
     $sql_filter = ocfilter_to_sqlfragment($filter, 'p.category_id', 'download_categories', 'parent_id', 'p.category_id', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'download_downloads p WHERE validated=1 AND (' . $sql_filter . ') ORDER BY add_date DESC', $number);
     $title = do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('SECTION_DOWNLOADS'));
     if (array_key_exists('title', $map) && $map['title'] != '') {
         $title = protect_from_escaping(escape_html($map['title']));
     }
     $out = new ocp_tempcode();
     foreach ($rows as $i => $row) {
         if ($i != 0) {
             $out->attach(do_template('BLOCK_SEPARATOR'));
         }
         $out->attach(get_download_html($row, true, true, $zone));
     }
     if ($out->is_empty()) {
         if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads')) {
             $submit_url = build_url(array('page' => 'cms_downloads', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_downloads'));
         } else {
             $submit_url = new ocp_tempcode();
         }
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '74399763a51102bdd6e6d92c2c11354f', 'HIGH' => false, 'TITLE' => $title, 'MESSAGE' => do_lang_tempcode('NO_DOWNLOADS_YET'), 'ADD_NAME' => do_lang_tempcode('ADD_DOWNLOAD'), 'SUBMIT_URL' => $submit_url));
     }
     return do_template('BLOCK_MAIN_RECENT_DOWNLOADS', array('_GUID' => '257fa1b83d1b6fe3acbceb2b618e6d7f', 'TITLE' => $title, 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
 }
コード例 #8
0
ファイル: auth.php プロジェクト: cruide/wasp
 public function signin($id, $password, $type = UserContact::TYPE_EMAIL)
 {
     if (!is_scalar($id)) {
         return false;
     }
     $auth = UserContact::where('type', '=', $type)->where('value', '=', $id)->first();
     if (empty($auth)) {
         return false;
     }
     $obj = User::where('id', '=', $auth->user_id)->where('password', '=', password_crypt($password))->with('session')->first();
     if (!empty($obj->id)) {
         $session = $obj->session;
         if (empty($session->id)) {
             $session = new UserSession();
         }
         $session->session_id = $this->session->id(true);
         $session->user_id = $obj->id;
         $session->ip_address = get_ip_address();
         $session->stamp = time();
         $session->save();
         $this->autorization = true;
         $this->user = $session->user;
         $smarty = new \Smarty();
         $smarty->assignGlobal('auth_user', $this->user);
         $smarty->assignGlobal('auth', $this);
         return true;
     }
     return false;
 }
コード例 #9
0
ファイル: video.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'videos';
     $info['date_field'] = 'add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_galleries') ? build_url(array('page' => 'cms_galleries', 'type' => 'av'), get_module_zone('cms_galleries')) : new ocp_tempcode();
     $info['category_field'] = 'cat';
     $info['category_type'] = 'galleries';
     $info['parent_spec__table_name'] = 'galleries';
     $info['parent_spec__parent_name'] = 'parent_id';
     $info['parent_spec__field_name'] = 'name';
     $info['parent_field_name'] = 'cat';
     $info['submitter_field'] = 'submitter';
     $info['id_is_string'] = false;
     require_lang('galleries');
     $info['title'] = do_lang_tempcode('VIDEOS');
     $info['validated_field'] = 'validated';
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'galleries'), get_module_zone('galleries'));
     $info['cms_page'] = 'cms_galleries';
     $info['where'] = 'cat NOT LIKE \'' . db_encode_like('download\\_%') . '\'';
     $info['views_field'] = 'video_views';
     $info['supports_custom_fields'] = true;
     return $info;
 }
コード例 #10
0
 protected function _initialize()
 {
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE')) {
         $this->error('站点已经关闭,请稍后访问~');
     }
     /**垂直菜单**/
     $category = D('Category')->getCategory();
     $this->assign('category', $category);
     /**购物车**/
     $cart = D('shopcart')->getcart();
     $this->assign('usercart', $cart);
     /* 热门搜索 */
     $str = M('config')->where('id="40"')->getField("value");
     $hotsearch = explode(",", $str);
     $this->assign('hotsearch', $hotsearch);
     /* 广告位 */
     $adData = D('ad')->getlist();
     $this->assign('adData', $adData);
     /**底部菜单**/
     $footer = D('Category')->getfooter();
     $this->assign('footer', $footer);
     /**所在地**/
     if (!session("user_area")) {
         $arr = get_ip_address();
         $area = $arr->city;
     } else {
         $area = session("user_area");
     }
     $this->assign("user_area", $area);
 }
コード例 #11
0
 function settings($data)
 {
     # a) save the main record
     $result = $this->_query_reader->run('update_organization_settings', array('logo_url' => $data['logo_url'], 'name' => htmlentities($data['name'], ENT_QUOTES), 'description' => htmlentities($data['description'], ENT_QUOTES), 'contact_address' => $data['address'], 'contact_city' => $data['city'], 'contact_region' => $data['region'], 'contact_zipcode' => $data['zipcode'], 'contact_country_id' => $data['contact__countries'], 'date_established' => !empty($data['registrationdate']) ? $data['registrationdate'] : '', 'registration_number' => $data['registrationno'], 'registration_country_id' => !empty($data['registration__countries']) ? $data['registration__countries'] : '', 'user_id' => $this->native_session->get('__user_id'), 'organization_id' => $this->native_session->get('__organization_id')));
     # d) log action
     $this->_logger->add_event(array('user_id' => $this->native_session->get('__user_id'), 'activity_code' => 'updated_organization_settings', 'result' => $result ? 'SUCCESS' : 'FAIL', 'log_details' => "organization_id=" . $this->native_session->get('__organization_id') . "|device=" . get_user_device() . "|browser=" . $this->agent->browser(), 'uri' => uri_string(), 'ip_address' => get_ip_address()));
     return array('boolean' => $result, 'reason' => '');
 }
コード例 #12
0
ファイル: currency.php プロジェクト: erico-deh/ocPortal
/**
 * Convert an IP address to a currency code.
 *
 * @param  ?IP			IP address (NULL: that of current member).
 * @return ID_TEXT	The currency code.
 */
function ip_to_currency($ip = NULL)
{
    if (is_null($ip)) {
        $ip = get_ip_address();
    }
    $country = geolocate_ip($ip);
    return country_to_currency($country);
}
コード例 #13
0
ファイル: post.inc.php プロジェクト: richstokoe/BeehiveForum
function post_create($fid, $tid, $reply_pid, $fuid, $tuid, $content, $hide_ipaddress = false)
{
    if (!($db = db::get())) {
        return -1;
    }
    $post_content = $db->escape($content);
    $ipaddress = $hide_ipaddress == false ? get_ip_address() : '';
    if (!is_numeric($tid)) {
        return -1;
    }
    if (!is_numeric($reply_pid)) {
        return -1;
    }
    if (!is_numeric($fuid)) {
        return -1;
    }
    if (!is_numeric($tuid)) {
        return -1;
    }
    $current_datetime = date(MYSQL_DATETIME, time());
    if (!($table_prefix = get_table_prefix())) {
        return -1;
    }
    // Check that the post needs approval. If the user is a moderator their posts are self-approved.
    if (perm_check_folder_permissions($fid, USER_PERM_POST_APPROVAL, $fuid) && !perm_is_moderator($fuid, $fid)) {
        $sql = "INSERT INTO `{$table_prefix}POST` (TID, REPLY_TO_PID, FROM_UID, ";
        $sql .= "TO_UID, CREATED, APPROVED, IPADDRESS) VALUES ({$tid}, {$reply_pid}, {$fuid}, ";
        $sql .= "{$tuid}, CAST('{$current_datetime}' AS DATETIME), NULL, '{$ipaddress}')";
    } else {
        $sql = "INSERT INTO `{$table_prefix}POST` (TID, REPLY_TO_PID, FROM_UID, ";
        $sql .= "TO_UID, CREATED, APPROVED, APPROVED_BY, IPADDRESS) VALUES ({$tid}, {$reply_pid}, ";
        $sql .= "{$fuid}, {$tuid}, CAST('{$current_datetime}' AS DATETIME), ";
        $sql .= "CAST('{$current_datetime}' AS DATETIME), {$fuid}, '{$ipaddress}')";
    }
    if (!$db->query($sql)) {
        return -1;
    }
    $new_pid = $db->insert_id;
    $sql = "INSERT INTO `{$table_prefix}POST_CONTENT` (TID, PID, CONTENT) ";
    $sql .= "VALUES ('{$tid}', '{$new_pid}', '{$post_content}')";
    if (!$db->query($sql)) {
        return -1;
    }
    $sql = "INSERT INTO `{$table_prefix}POST_SEARCH_ID` (TID, PID) ";
    $sql .= "VALUES('{$tid}', '{$new_pid}')";
    if (!$db->query($sql)) {
        return -1;
    }
    post_update_thread_length($tid, $new_pid);
    user_increment_post_count($fuid);
    if (perm_check_folder_permissions($fid, USER_PERM_POST_APPROVAL, $fuid) && !perm_is_moderator($fuid, $fid)) {
        admin_send_post_approval_notification($fid);
    }
    return $new_pid;
}
コード例 #14
0
ファイル: give_process.php プロジェクト: Galaxy421/WOWMeter
function IsProxy()
{
    $proxyAPI = file_get_contents('http://winmxunlimited.net/api/proxydetection/v1/query/?ip=' . get_ip_address());
    if ($proxyAPI === false) {
        return false;
    }
    if ($proxyAPI != "0" || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errstr, $errno, 1)) {
        return true;
    } else {
        return false;
    }
}
コード例 #15
0
/**
 * Получение IP-адреса проскси.
 * Возвращает IP-адрес прокси или пустую строку
 *
 * @return string
 */
function get_proxy_ip_address()
{
    $obj =& get_instance();
    $ip_address = $obj->input->storage_server('REMOTE_ADDR');
    // Проверяем на валидность
    if (!$obj->input->valid_ip($ip_address)) {
        $ip_address = '';
    }
    if ($ip_address == get_ip_address()) {
        $ip_address = '';
    }
    return $ip_address;
}
コード例 #16
0
ファイル: ip_geocode_lookup.php プロジェクト: joeymetal/v1
 private function retrieve_location_from_cookie_or_service()
 {
     if (isset($_COOKIE['geo_location'])) {
         $yaml_to_array = new AkYamlToArray();
         $yaml_to_array->source = $_COOKIE['geo_location'];
         return new GeoLoc($yaml_to_array->convert());
     }
     $location = IpGeocoder::geocode(get_ip_address());
     if ($location->success) {
         return $location;
     }
     return null;
 }
コード例 #17
0
ファイル: rating.php プロジェクト: erico-deh/ocPortal
 function setUp()
 {
     parent::setUp();
     require_code('calendar2');
     require_code('feedback');
     $this->event_id = add_calendar_event(8, '1', NULL, 0, 'test_event', '', 3, 1, 2010, 1, 10, 10, 15, 2010, NULL, 1, 1, 19, NULL, 1, 1, 1, 1, 1, '', NULL, 0, NULL, NULL, NULL);
     if ('test_event' == get_translated_text($GLOBALS['SITE_DB']->query_value('calendar_events', 'e_title ', array('id' => $this->event_id)))) {
         $GLOBALS['SITE_DB']->query_insert('rating', array('rating_for_type' => 'events', 'rating_for_id' => $this->event_id, 'rating_member' => get_member(), 'rating_ip' => get_ip_address(), 'rating_time' => time(), 'rating' => 4));
     }
     $data = $GLOBALS['SITE_DB']->query_select('rating', array('rating '), array('rating_for_id' => $this->event_id, 'rating_member' => get_member()));
     $rating = $data[0]['rating'];
     // Test the forum was actually created
     $this->assertTrue(4 == $rating);
 }
コード例 #18
0
ファイル: _link.php プロジェクト: nwtug/pss-version-1.0
 function update_status($newStatus, $linkIds)
 {
     $msg = '';
     $links = implode("','", $linkIds);
     $status = array('archive' => 'inactive', 'reactivate' => 'active');
     # Remove the link record completely
     if ($newStatus == 'delete') {
         $result = $this->_query_reader->run('delete_link_record', array('link_ids' => $links));
     } else {
         $result = $this->_query_reader->run('update_link_status', array('new_status' => $status[$newStatus], 'link_ids' => $links, 'user_id' => $this->native_session->get('__user_id')));
     }
     # log action
     $this->_logger->add_event(array('user_id' => $this->native_session->get('__user_id'), 'activity_code' => 'link_status_change', 'result' => $result ? 'SUCCESS' : 'FAIL', 'log_details' => "newstatus=" . $newStatus . "|device=" . get_user_device() . "|browser=" . $this->agent->browser(), 'uri' => uri_string(), 'ip_address' => get_ip_address()));
     return array('boolean' => $result, 'reason' => $msg);
 }
コード例 #19
0
ファイル: ocf_topics.php プロジェクト: erico-deh/ocPortal
/**
 * Get an SQL 'WHERE' clause for the posts in a topic.
 *
 * @param  AUTO_LINK		The ID of the topic we are getting details of.
 * @param  ?MEMBER		The member doing the lookup (NULL: current member).
 * @return string			The WHERE clause.
 */
function ocf_get_topic_where($topic_id, $member_id = NULL)
{
    if (is_null($member_id)) {
        $member_id = get_member();
    }
    $where = 'p_topic_id=' . strval((int) $topic_id);
    if (is_guest()) {
        $where .= ' AND p_intended_solely_for IS NULL';
    } elseif (!has_specific_permission($member_id, 'view_other_pt')) {
        $where .= ' AND (p_intended_solely_for=' . strval((int) $member_id) . ' OR p_poster=' . strval((int) $member_id) . ' OR p_intended_solely_for IS NULL)';
    }
    if (!has_specific_permission($member_id, 'see_unvalidated')) {
        $where .= ' AND (p_validated=1 OR ((p_poster<>' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ' OR ' . db_string_equal_to('p_ip_address', get_ip_address()) . ') AND p_poster=' . strval((int) $member_id) . '))';
    }
    return $where;
}
コード例 #20
0
ファイル: _permission.php プロジェクト: nwtug/pss-version-1.0
 function update_status($newStatus, $groupIds)
 {
     $msg = '';
     $result = FALSE;
     $groups = implode("','", $groupIds);
     # Remove the document record completely
     if ($newStatus == 'delete') {
         $result = $this->_query_reader->run('delete_group_mapping', array('group_ids' => $groups));
         if ($result) {
             $result = $this->_query_reader->run('delete_permission_group', array('group_ids' => $groups));
         }
     }
     # log action
     $this->_logger->add_event(array('user_id' => $this->native_session->get('__user_id'), 'activity_code' => 'permission_group_status_change', 'result' => $result ? 'SUCCESS' : 'FAIL', 'log_details' => "newstatus=" . $newStatus . "|device=" . get_user_device() . "|browser=" . $this->agent->browser(), 'uri' => uri_string(), 'ip_address' => get_ip_address()));
     return array('boolean' => $result, 'reason' => $msg);
 }
コード例 #21
0
ファイル: main_iotd.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('iotds');
     require_css('iotds');
     $mode = array_key_exists('param', $map) ? $map['param'] : 'current';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('iotds');
     if (has_actual_page_access(NULL, 'cms_iotds', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_iotds')) {
         $submit_url = build_url(array('page' => 'cms_iotds', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_iotds'));
     } else {
         $submit_url = new ocp_tempcode();
     }
     if ($mode == 'current') {
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('is_current' => 1), 'ORDER BY id DESC', 1);
     } elseif (is_numeric($mode)) {
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('id' => intval($mode)), '', 1);
         if (!array_key_exists(0, $iotd)) {
             return do_template('BLOCK_NO_ENTRIES', array('HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
         }
     } else {
         $cnt = $GLOBALS['SITE_DB']->query_value('iotd', 'COUNT(*)', array('used' => 1));
         if ($cnt == 0) {
             return do_template('BLOCK_NO_ENTRIES', array('HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
         }
         $at = mt_rand(0, $cnt - 1);
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('used' => 1), '', 1, $at);
     }
     if (!array_key_exists(0, $iotd)) {
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '62baa388e068d4334f7a6c6093ead56a', 'HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
     }
     $myrow = $iotd[0];
     $image_url = $myrow['url'];
     if (url_is_local($image_url)) {
         $image_url = get_custom_base_url() . '/' . $image_url;
     }
     $view_url = build_url(array('page' => 'iotds', 'wide' => 1, 'type' => 'view', 'id' => $myrow['id']), $zone);
     require_code('images');
     $thumb_url = ensure_thumbnail($myrow['url'], $myrow['thumb_url'], 'iotds', 'iotd', $myrow['id']);
     $caption = get_translated_tempcode($myrow['i_title']);
     $image = do_image_thumb($thumb_url, do_lang('IOTD'));
     $archive_url = build_url(array('page' => 'iotds', 'type' => 'misc'), $zone);
     $tpl = do_template('IOTD', array('_GUID' => 'ca9c4b4941c12c15f7bdfe4cb57cd266', 'ID' => strval($myrow['id']), 'IMAGE_URL' => $image_url, 'SUBMITTER' => strval($myrow['submitter']), 'VIEW_URL' => $view_url, 'CAPTION' => $caption, 'IMAGE' => $image));
     $map2 = array('_GUID' => 'd710da3675a1775867168ae37db02ad4', 'CURRENT' => $mode == 'current', 'FULL_URL' => $view_url, 'ID' => strval($myrow['id']), 'CONTENT' => $tpl, 'ARCHIVE_URL' => $archive_url, 'SUBMIT_URL' => $submit_url);
     if (get_option('is_on_comments') == '1' && get_forum_type() != 'none' && $myrow['allow_comments'] >= 1) {
         $map2['COMMENT_COUNT'] = '1';
     }
     return do_template('BLOCK_MAIN_IOTD', $map2);
 }
コード例 #22
0
ファイル: catalogue.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'catalogues';
     $info['date_field'] = 'c_add_date';
     $info['id_field'] = 'c_name';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues') ? build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => '!'), get_module_zone('cms_catalogues')) : new ocp_tempcode();
     $info['category_field'] = 'c_name';
     $info['category_type'] = 'catalogues_catalogue';
     $info['id_is_string'] = true;
     require_lang('catalogues');
     $info['title'] = do_lang_tempcode('CATALOGUES');
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'catalogues'), get_module_zone('catalogues'));
     $info['cms_page'] = 'cms_catalogues';
     return $info;
 }
コード例 #23
0
ファイル: author.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'authors';
     $info['date_field'] = NULL;
     $info['id_field'] = 'author';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_authors') ? build_url(array('page' => 'cms_authors', 'type' => '_ad'), get_module_zone('cms_authors')) : new ocp_tempcode();
     $info['category_field'] = NULL;
     $info['submitter_field'] = 'forum_handle';
     $info['id_is_string'] = true;
     require_lang('authors');
     $info['title'] = do_lang_tempcode('AUTHORS');
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'authors'), get_module_zone('authors'));
     $info['cms_page'] = 'cms_authors';
     $info['supports_custom_fields'] = true;
     return $info;
 }
コード例 #24
0
ファイル: _provider.php プロジェクト: nwtug/pss-version-1.0
 function update_status($newStatus, $idList)
 {
     $result = FALSE;
     # use appropriate DB status
     $organizationStatus = array('activate' => 'active', 'deactivate' => 'inactive', 'suspend' => 'suspended');
     $userStatus = array('activate' => 'active', 'deactivate' => 'inactive', 'suspend' => 'inactive');
     if (!empty($organizationStatus[$newStatus])) {
         $result = $this->_query_reader->run('update_organization_status', array('new_status' => $organizationStatus[$newStatus], 'id_list' => implode("','", $idList), 'user_id' => $this->native_session->get('__user_id')));
         if ($result) {
             $result = $this->record_registration_track(array('status' => $organizationStatus[$newStatus], 'idlist' => implode(",", $idList), 'reason' => ''));
         }
     }
     if (!empty($userStatus[$newStatus]) && $result) {
         $result = $this->_query_reader->run('update_user_status_by_organization_ids', array('new_status' => $userStatus[$newStatus], 'id_list' => implode("','", $idList), 'user_id' => $this->native_session->get('__user_id')));
     }
     # log action
     $this->_logger->add_event(array('user_id' => $this->native_session->get('__user_id'), 'activity_code' => 'update_provider_status', 'result' => $result ? 'SUCCESS' : 'FAIL', 'log_details' => "device=" . get_user_device() . "|browser=" . $this->agent->browser(), 'uri' => uri_string(), 'ip_address' => get_ip_address()));
     return array('boolean' => $result);
 }
コード例 #25
0
ファイル: geoip.php プロジェクト: rtoi/WebFramework
/**
 * Modul to localize ip-adresses.
 * 
 * Uses the [free version of GeoIP](http://www.maxmind.com/app/geolitecity) from maxmind.
 * In the majority of cases maxmind publishes updates for the GeoLiteCity.dat on the first day each month.
 * @return void
*/
function geoip_init()
{
    global $CONFIG;
    if (!function_exists('geoip_country_code_by_name')) {
        require_once __DIR__ . "/geoip/geoip.inc";
        require_once __DIR__ . "/geoip/geoipcity.inc";
    }
    if (!system_is_module_loaded('curlwrapper')) {
        WdfException::Raise("Missing module: curlwrapper!");
    }
    if (!isset($GLOBALS['current_ip_addr'])) {
        $GLOBALS['current_ip_addr'] = get_ip_address();
    }
    if (!isset($CONFIG['geoip']['city_dat_file'])) {
        $CONFIG['geoip']['city_dat_file'] = __DIR__ . "/geoip/GeoLiteCity.dat";
    }
    if (!file_exists($CONFIG['geoip']['city_dat_file'])) {
        WdfException::Raise("GeoIP module: missing GeoLiteCity.dat! Get it from http://dev.maxmind.com/geoip/legacy/geolite/");
    }
}
コード例 #26
0
ファイル: comcode_page.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'comcode_pages';
     $info['date_field'] = 'p_add_date';
     $info['id_field'] = array('the_zone', 'the_page');
     $info['add_url'] = has_submit_permission('high', get_member(), get_ip_address(), 'cms_comcode_pages') ? build_url(array('page' => 'cms_comcode_pages', 'type' => 'ed'), get_module_zone('cms_comcode_pages')) : new ocp_tempcode();
     $info['category_field'] = array('the_zone', 'the_page');
     $info['category_type'] = '!';
     $info['submitter_field'] = 'p_submitter';
     $info['id_is_string'] = true;
     require_lang('zones');
     $info['title'] = do_lang_tempcode('COMCODE_PAGES');
     $info['validated_field'] = 'p_validated';
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'sitemap'), get_page_zone('sitemap'));
     $info['cms_page'] = 'cms_comcode_pages';
     return $info;
 }
コード例 #27
0
 /**
  * @implements <SessionBase::Sanitize>
  */
 function Sanitize()
 {
     global $CONFIG;
     $lt = $CONFIG['session']['lifetime'];
     $prefix = $CONFIG['session']['prefix'];
     if (isset($_SESSION[$prefix . "session_lastaccess"]) && $_SESSION[$prefix . "session_lastaccess"] < time() - $lt * 60) {
         // session timed out
         // Implementations in system/modules/authorization.php and
         // common/modules/fax_authorization.php
         if (function_exists('logoutUser')) {
             logoutUser();
         }
     }
     if ($CONFIG['session']['iplock']) {
         $ip_address = get_ip_address();
         if (isset($_SESSION[$prefix . 'ip_address']) && function_exists('logoutUser') && $_SESSION[$prefix . 'ip_address'] != $ip_address) {
             logoutUser();
         }
         $_SESSION[$prefix . 'ip_address'] = $ip_address;
     }
 }
コード例 #28
0
ファイル: _document.php プロジェクト: nwtug/pss-version-1.0
 function update_status($newStatus, $documentIds)
 {
     $msg = '';
     $documents = implode("','", $documentIds);
     $status = array('archive' => 'inactive', 'reactivate' => 'active');
     # Remove the document record completely
     if ($newStatus == 'delete') {
         foreach ($documentIds as $id) {
             $document = $this->details($id);
             if (!empty($document['url'])) {
                 @unlink(UPLOAD_DIRECTORY . $document['url']);
             }
         }
         $result = $this->_query_reader->run('delete_document_record', array('document_ids' => $documents));
     } else {
         $result = $this->_query_reader->run('update_document_status', array('new_status' => $status[$newStatus], 'document_ids' => $documents, 'user_id' => $this->native_session->get('__user_id')));
     }
     # log action
     $this->_logger->add_event(array('user_id' => $this->native_session->get('__user_id'), 'activity_code' => 'document_status_change', 'result' => $result ? 'SUCCESS' : 'FAIL', 'log_details' => "newstatus=" . $newStatus . "|device=" . get_user_device() . "|browser=" . $this->agent->browser(), 'uri' => uri_string(), 'ip_address' => get_ip_address()));
     return array('boolean' => $result, 'reason' => $msg);
 }
コード例 #29
0
ファイル: galleries.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular render function for profile tab hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return array			A triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     require_lang('galleries');
     $title = do_lang_tempcode('GALLERIES');
     $order = 30;
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     $galleries = new ocp_tempcode();
     require_code('galleries');
     require_css('galleries');
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'galleries WHERE name LIKE \'' . db_encode_like('member\\_' . strval($member_id_of) . '\\_%') . '\'');
     foreach ($rows as $i => $row) {
         $galleries->attach(do_template('GALLERY_SUBGALLERY_WRAP', array('CONTENT' => show_gallery_box($row, 'root', false, get_module_zone('galleries')))));
         $this->attach_gallery_subgalleries($row['name'], $galleries);
     }
     $add_gallery_url = new ocp_tempcode();
     $add_image_url = new ocp_tempcode();
     $add_video_url = new ocp_tempcode();
     if ($member_id_of == $member_id_viewing) {
         if (count($rows) == 0) {
             $test = $GLOBALS['SITE_DB']->query_select('galleries', array('accept_images', 'accept_videos', 'name'), array('is_member_synched' => 1));
             if (array_key_exists(0, $test)) {
                 if ($test[0]['accept_images'] == 1) {
                     $add_image_url = build_url(array('page' => 'cms_galleries', 'type' => 'ad', 'cat' => 'member_' . strval($member_id_of) . '_' . $test[0]['name']), get_module_zone('cms_galleries'));
                 }
                 if ($test[0]['accept_videos'] == 1) {
                     $add_video_url = build_url(array('page' => 'cms_galleries', 'type' => 'av', 'cat' => 'member_' . strval($member_id_of) . '_' . $test[0]['name']), get_module_zone('cms_galleries'));
                 }
             }
         } else {
             if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_submit_permission('cat_mid', get_member(), get_ip_address(), 'cms_galleries')) {
                 $add_gallery_url = build_url(array('page' => 'cms_galleries', 'type' => 'ac', 'cat' => $rows[0]['name']), get_module_zone('cms_galleries'));
             }
         }
     }
     $content = do_template('OCF_MEMBER_PROFILE_GALLERIES', array('MEMBER_ID' => strval($member_id_of), 'GALLERIES' => $galleries, 'ADD_GALLERY_URL' => $add_gallery_url, 'ADD_IMAGE_URL' => $add_image_url, 'ADD_VIDEO_URL' => $add_video_url));
     return array($title, $content, $order);
 }
コード例 #30
0
ファイル: realtime_rain.php プロジェクト: erico-deh/ocPortal
/**
 * AJAX script for returning realtime-rain data.
 */
function realtime_rain_script()
{
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    @ini_set('ocproducts.xss_detect', '0');
    header('Content-Type: text/xml');
    echo '<?xml version="1.0" encoding="' . get_charset() . '"?' . '>';
    echo '<request><result>';
    require_code('realtime_rain');
    require_lang('realtime_rain');
    $time_now = time();
    $from = get_param_integer('from', $time_now - 10);
    $to = get_param_integer('to', $time_now);
    if (get_param_integer('keep_realtime_test', 0) == 1) {
        $types = array('post', 'news', 'recommend', 'polls', 'ecommerce', 'actionlog', 'security', 'chat', 'stats', 'join', 'calendar', 'search', 'point_charges', 'banners', 'point_gifts');
        shuffle($types);
        $events = array();
        $cnt = count($types);
        for ($i = 0; $i < max($cnt, 5); $i++) {
            $timestamp = mt_rand($from, $to);
            $type = array_pop($types);
            $event = rain_get_special_icons(get_ip_address(), $timestamp) + array('TYPE' => $type, 'FROM_MEMBER_ID' => NULL, 'TO_MEMBER_ID' => NULL, 'TITLE' => 'Test', 'IMAGE' => rain_get_country_image(get_ip_address()), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => NULL, 'IS_POSITIVE' => $type == 'ecommerce' || $type == 'join', 'IS_NEGATIVE' => $type == 'security' || $type == 'point_charges', 'FROM_ID' => NULL, 'TO_ID' => NULL, 'GROUP_ID' => 'example_' . strval(mt_rand(0, 4)));
            $event['SPECIAL_ICON'] = 'email-icon';
            $event['MULTIPLICITY'] = '10';
            $events[] = $event;
        }
    } else {
        $events = get_realtime_events($from, $to);
    }
    shuffle($events);
    $out = new ocp_tempcode();
    foreach ($events as $event) {
        $out->attach(do_template('REALTIME_RAIN_BUBBLE', $event));
    }
    $out->evaluate_echo();
    echo '</result></request>';
}