mirror of
https://github.com/GuduleLapointe/opensim-helpers.git
synced 2026-08-14 00:47:54 +00:00
Merge branch 'master' of git.magiiic.com:opensimulator/flexible_helper_scripts
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: GuduleLapointe
|
||||
buy_me_a_coffee: speculoos.world
|
||||
open_collective: speculoosworld
|
||||
patreon: # Replace with a single Patreon username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
thanks_dev: # Replace with a single thanks.dev username
|
||||
custom: https://magiiic.com/donate/project/?project=opensim-helpers
|
||||
@@ -7,6 +7,3 @@ sources/
|
||||
tmp/
|
||||
includes/config.php
|
||||
/vendor/
|
||||
wp-load.php
|
||||
*.temp
|
||||
*.tmp
|
||||
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
# OpenSim Helpers Installation
|
||||
|
||||
If you only need in-world search (places, land for sale, events), do not install the helpers, follow "Option 1" instructions in README.md to use 2do.directory service instead.
|
||||
|
||||
If you use w4os WordPress plugin, you do not need to install helpers, they are already provided by the plugin.
|
||||
|
||||
Proceed to full installation if you have at least one of these requirements
|
||||
- you need to implement in-world currency
|
||||
- you need to implement classifieds
|
||||
- you prefer to implement your own search engine
|
||||
|
||||
Even in one of these cases, it's a good idea to first use 2do directory service only, to make sure the basic requirements are met before proceeding to the full helpers install.
|
||||
|
||||
## Get OpenSimulator up and running
|
||||
|
||||
Download the latest OpenSimulator release from http://opensimulator.org/wiki/Download
|
||||
|
||||
Extract the archive in a location outside your web root directory, e.g. `/opt/opensim/` or `/usr/local/share/opensim`. Standard OpenSimulator installation contains configuration files with db credentials and other sensitive data, they cannot be accessible directly from your website.
|
||||
|
||||
Follow instructions in Robust(.HG).ini to get the grid up and running.
|
||||
|
||||
**Keep it simple and stupid**: for a new installation, first only change the basic settings: BaseURL, Public and Private ports, ConnectionString. The other settings will be changed later according to helpers configuration.
|
||||
|
||||
OpenSim Helpers should be compatible with any OpenSimulator 0.9.x release. Earlier versions are not supported anymore.
|
||||
|
||||
## Add helpers/ on your website
|
||||
|
||||
Copy the opensim helpers directory as helpers/ in your website document root.
|
||||
|
||||
E.g. if your document root is `/var/www/html`, this directory should be in `/var/www/html/helpers/` and should be reachable by calling https://example.org/helpers/
|
||||
|
||||
Copy `includes/config.example.php` as `includes/config.php` and adjust values according to your Robust settings.
|
||||
|
||||
Required:
|
||||
- OPENSIM_GRID_NAME ("Your Grid")
|
||||
- OPENSIM_LOGIN_URI ("yourgrid.org:8002")
|
||||
- ROBUST_DB credentials (also used for standalone simulators)
|
||||
|
||||
Optional:
|
||||
- search settings
|
||||
- currency settings
|
||||
|
||||
### Database Configuration
|
||||
|
||||
The helpers need access to various databases. You can use the same database as your Robust installation for everything, but for better security and organization, you might want to use separate databases:
|
||||
|
||||
- **Robust DB**: Main OpenSimulator database (required)
|
||||
- **Search DB**: For search functionality (required if using local search)
|
||||
- **Currency DB**: For Podex/MoneyServer (required if using this currency system)
|
||||
|
||||
Each database configuration in `config.php` needs host, database name, username and password.
|
||||
|
||||
At this stage, the helpers should be accessible and working. Most of them would only display a blank page if called directly.
|
||||
|
||||
Use cron or crontab to trigger the database update on a regular basis
|
||||
```cron
|
||||
0 * * * * curl -s http://example.org/helpers/parser.php
|
||||
30 */2 * * * curl -s http://example.org/helpers/eventsparser.php
|
||||
```
|
||||
|
||||
## Install required OpenSim modules (dll)
|
||||
|
||||
According to your needs, copy modules provided in addons/bin in your opensim bin/ directory (alongside Robust.exe) or download them from their original authors.
|
||||
|
||||
**Only copy the modules you actually need**: some of them might crash your simulator if not configured.
|
||||
|
||||
To enable **in-world search**, you need:
|
||||
- `OpenSimSearch.Modules.dll`
|
||||
|
||||
To enable **Gloebit currency**
|
||||
- `Gloebit.dll`
|
||||
|
||||
To enable **Podex currency** (or fake currency)
|
||||
- Install and run an instance of MoneyServer (this is an executable, not a DLL)
|
||||
- Follow MoneyServer instruction to configure, create a certificate and a Banker avatar
|
||||
|
||||
## Configure Robust grid-wide settings (or standalone simulator)
|
||||
|
||||
According to your setup, you need to adjust some settings in one of these files:
|
||||
- `Robust.HG.ini` (grid with hypergrid enabled)
|
||||
- `Robust.ini` (private grid, hypergrid not enabled)
|
||||
- `config-include/StandaloneCommon.ini` (standalone simulator, no grid)
|
||||
|
||||
```ini
|
||||
;; Robust.HG.ini
|
||||
[LoginService]
|
||||
; Currency = YC$ ;; Your Currency symbol, optional
|
||||
|
||||
;; V3 viewer search, not implemented yet in helpers
|
||||
;; This is not same as SearchURL value in OpenSim.ini
|
||||
; SearchURL = https://example.org/helpers/search.php
|
||||
|
||||
[GridInfoService]
|
||||
economy = https://example.org/helpers/
|
||||
|
||||
;; V3 viewer search, not implemented yet in helpers
|
||||
;; This is not same as SearchURL value in OpenSim.ini
|
||||
; search = https://example.org/helpers/search.php
|
||||
```
|
||||
|
||||
## Configure simulators (for grids only)
|
||||
|
||||
Each simulator also needs specific settings. They are usually set in
|
||||
- `OpenSim.ini`
|
||||
- or `config-include/StandaloneCommon.ini`
|
||||
|
||||
### Search Configuration
|
||||
|
||||
To enable in-world search, add the following configuration to each simulator:
|
||||
|
||||
```ini
|
||||
;; OpenSim.ini
|
||||
[Search]
|
||||
Module = OpenSimSearch
|
||||
SearchURL = "http://example.org/helpers/query.php?gk=http://yourgrid.org:8002"
|
||||
|
||||
[DataSnapshot]
|
||||
index_sims = true
|
||||
gridname = "Your Grid"
|
||||
;; Multiple data servers can be enabled to register on multiple engines
|
||||
DATA_SRV_YourGrid = "https://example.org/helpers/register.php"
|
||||
DATA_SRV_2do = "http://2do.directory/helpers/register.php"
|
||||
; DATA_SRV_OtherEngine = "http://example.org/register.php"
|
||||
```
|
||||
|
||||
The search system works in two parts:
|
||||
1. The `[DataSnapshot]` section tells the simulator to send parcel and region data to the specified helper URLs
|
||||
2. The `[Search]` section tells the simulator where users' search queries should be sent
|
||||
|
||||
Make sure both sections are properly configured for search to work correctly.
|
||||
|
||||
### Currency Configuration
|
||||
|
||||
#### For Gloebit currency:
|
||||
|
||||
Gloebit is a third-party currency provider that works across multiple grids. It requires registering on the [Gloebit website](https://www.gloebit.com/) to get API keys.
|
||||
|
||||
```ini
|
||||
;; OpenSim.ini
|
||||
[Economy]
|
||||
economymodule = Gloebit
|
||||
economy = https://example.org/helpers/
|
||||
SellEnabled = true
|
||||
; PriceUpload = 0
|
||||
; PriceGroupCreate = 0
|
||||
[Gloebit]
|
||||
Enabled = true
|
||||
GLBEnvironment = production
|
||||
GLBKey = (your Gloebit app key)
|
||||
GLBSecret = (your Gloebit app secret)
|
||||
GLBOwnerName = Banker Name
|
||||
GLBOwnerEmail = banker@example.org
|
||||
; GLBSpecificConnectionString = "Data Source=localhost;Database=gloebit;User ID=opensim;Password=your_password;Old Guids=true;"
|
||||
```
|
||||
|
||||
If you have issues with Gloebit showing "TrustFailure" or "CERTIFICATE_VERIFY_FAILED" errors, please see the TROUBLESHOOTING.md file for specific instructions on fixing certificate issues on Linux.
|
||||
|
||||
#### For Podex or fake currency:
|
||||
|
||||
This method requires running a separate MoneyServer instance that handles the currency transactions.
|
||||
|
||||
Step 1: Install and configure MoneyServer
|
||||
- Download MoneyServer (not included in the helpers - you'll need to get it from the original source)
|
||||
- **Important note**: MoneyServer is a standalone executable (.exe), not a DLL. Don't look for "MoneyServer.dll" as it doesn't exist
|
||||
- Run MoneyServer.exe as a separate process on a different port than Robust (e.g., port 8004)
|
||||
- Your processes should include:
|
||||
- Robust.exe (grid services)
|
||||
- MoneyServer.exe (currency services)
|
||||
- OpenSim.exe (region simulators)
|
||||
|
||||
Step 2: Configure OpenSim to use MoneyServer
|
||||
```ini
|
||||
;; OpenSim.ini
|
||||
[Economy]
|
||||
economymodule = DTLMoneyModule
|
||||
; economymodule = DTLNSLMoneyModule ;; for some MoneyServer versions
|
||||
|
||||
economy = https://example.org/helpers/
|
||||
SellEnabled = true
|
||||
; PriceUpload = 0
|
||||
; PriceGroupCreate = 0
|
||||
```
|
||||
|
||||
Step 3: Configure MoneyServer settings
|
||||
```ini
|
||||
;; MoneyServer.ini
|
||||
|
||||
;; See additional parameters in MoneyServer.ini.example
|
||||
[MoneyServer]
|
||||
EnableScriptSendMoney = true
|
||||
MoneyScriptAccessKey = 1234567890 ; CHANGE THIS VALUE, copy it in includes/config.php
|
||||
[MySql]
|
||||
hostname = localhost
|
||||
database = moneyserver ; Create this database separately
|
||||
username = opensim
|
||||
password = (your password)
|
||||
```
|
||||
|
||||
Make sure the MoneyScriptAccessKey value in MoneyServer.ini matches the one in your config.php file.
|
||||
|
||||
## Load new configuration
|
||||
|
||||
- Restart Robust instance
|
||||
- Restart MoneyServer (if using Podex/DTL currency)
|
||||
- Restart all simulator instances
|
||||
- Enable search for at least one parcel
|
||||
- Set at least one parcel for sale
|
||||
- Test in-world search, land sale, object sales...
|
||||
|
||||
**Note:** the search database is refreshed by a cron task. Some data might not be available immediately. In the testing phase, it might be useful to restart region after a test change to ensure search data is immediately updated.
|
||||
|
||||
See TROUBLESHOOTING.md if you encounter issues.
|
||||
@@ -1,22 +0,0 @@
|
||||
# Gloebit TrustFailure CERTIFICATE_VERIFY_FAILED
|
||||
|
||||
In some Linux distributions, mono doesn't handle LetsEncrypt certificates, which happen to be the ones used by Gloebit and many website.
|
||||
|
||||
If Gloebit doesn't work and you have messages like "TrustFailure (...) CERTIFICATE_VERIFY_FAILED" in your logs, don't worry, the fix is easy:
|
||||
|
||||
1. Make sure package ca-certificates-mono is installed, or install it with the command
|
||||
|
||||
```bash
|
||||
sudo apt install ca-certificates-mono
|
||||
```
|
||||
|
||||
2. Download Letsencrypt root certificate from [their website](https://letsencrypt.org/certificates/). You can pick the first one, ISRG Root X1, in pem format
|
||||
|
||||
3. Make mono trust this root certificate
|
||||
|
||||
```bash
|
||||
sudo cert-sync isrgrootx1.pem
|
||||
# replace the name of the file if needed
|
||||
```
|
||||
|
||||
It should work immediately, you shoudln't need to restart the sim.
|
||||
@@ -1,7 +1,7 @@
|
||||
# OpenSimulator Helpers
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
@@ -42,68 +42,39 @@ Formerly known as Flexible Helper Scripts.
|
||||
|
||||
## Installation
|
||||
|
||||
### Option 1: Just enable in-world search (don't install this)
|
||||
For detailed installation instructions, please see [INSTALLATION.md](INSTALLATION.md).
|
||||
|
||||
Yes, my first suggestion is not to install this, funny, isn't it? Relying on an external search engine may have advantages:
|
||||
If you encounter issues during installation or usage, please refer to [TROUBLESHOOTING.md](TROUBLESHOOTING.md).
|
||||
|
||||
- For small grids and standalone, it can be confusing to install the whole package, while it's easy to benefit of its main advantage.
|
||||
- An external engine can collect and distribute data from several grids, which is good for an hypergrid-enabled installation.
|
||||
### Quick Start Options
|
||||
|
||||
[2do directory](http://2do.directory/) provides a cross-grid search engine. This is the easiest solution if you don't have specific needs (and you don't need classifieds, which require access to both Robust and search databases).
|
||||
#### Option 1: Just enable in-world search (no helpers installation)
|
||||
|
||||
1. Download [OpenSimSearch.Module.dll](https://github.com/GuduleLapointe/flexible_helper_scripts/tree/master/bin) and put it inside your OpenSim bin/ folder.
|
||||
If you only need basic in-world search, you can use an external service like [2do directory](http://2do.directory/) without installing the helpers.
|
||||
|
||||
2. Add the following settings to each simulator OpenSim.ini file. Replace "Your Grid" and "yourgrid.org:8002" with your own values.
|
||||
1. Download [OpenSimSearch.Module.dll](https://github.com/magicoli/opensim-helpers/tree/master/bin) and put it inside your OpenSim bin/ folder.
|
||||
|
||||
2. Add search settings to OpenSim.ini:
|
||||
```
|
||||
[Search]
|
||||
SearchURL = "http://2do.directory/helpers/query.php?gk=http://yourgrid.org:8002"
|
||||
SearchURL = "https://2do.directory/helpers/query.php?gk=${Const|BaseURL}:${Const|PublicPort}"
|
||||
|
||||
[DataSnapshot]
|
||||
index_sims = true
|
||||
gridname = "Your Grid"
|
||||
snapshot_cache_directory = "./DataSnapshot"
|
||||
DATA_SRV_2do = http://2do.directory/helpers/register.php
|
||||
;DATA_SRV_OtherEngine = http://example.org/helpers/register.py
|
||||
```
|
||||
|
||||
3. Restart the simulators.
|
||||
|
||||
### Option 2: WordPress website
|
||||
#### Option 2: WordPress website
|
||||
|
||||
If you have a WordPress website, we suggest you to install [W4OS Plugin](https://w4os.org/) instead. It includes these helpers and a lot of other cool features like avatar registration, web profiles, web assets server, grid info (...), along with documented admin pages.
|
||||
If you have a WordPress website, we recommend installing [W4OS Plugin](https://w4os.org/) which includes these helpers along with many other features like avatar registration and web profiles.
|
||||
|
||||
### Option 3: The real stuff
|
||||
#### Option 3: Full helpers installation
|
||||
|
||||
If you want to keep the control, or combine with a wider range of services, here is how to setup your search engine.
|
||||
|
||||
1. Copy the needed modules, according to your OpenSim version from this bin/ directory to your OpenSim bin/ directory. Copy only the ones you need, as OpenSim loads them all and will trigger errors if they are not properly configured. (e.g. do not copy MoneyServer if you use Gloebit and vice-versa, do not copy any of those if you don't plan to use currency.)
|
||||
2. Copy the content of this directory on your web server, in a folder named "helpers" (or anything you want, adjust your settings accordingly). It should be reachable as something like <http://yourgrid.org/helpers/>
|
||||
3. Rename includes/config.example.php as includes/config.php and edit with your grid and database settings
|
||||
4. Edit your OpenSim config file for search (adjust your grid name, server url and login uri). Edit MoneyServer.ini or Gloebit.ini according to their instructions.
|
||||
|
||||
```
|
||||
[Search]
|
||||
SearchURL = "http://yourgrid.org/helpers/query.php?gk=http://yourgrid.org:8002"
|
||||
|
||||
[DataSnapshot]
|
||||
index_sims = true
|
||||
gridname = "Your Grid"
|
||||
snapshot_cache_directory = "./DataSnapshot"
|
||||
DATA_SRV_YourGrid = http://yourgrid.org/helpers/register.php
|
||||
;DATA_SRV_2do = http://2do.directory/helpers/register.php
|
||||
```
|
||||
|
||||
(you can add several DATA_SRV_* lines if you want to register on multiple search engines)
|
||||
|
||||
If you have trust issues with Gloebit (I mean seriously, if your console shows errors about Trust Failures), see README-Gloebit.md for instructions.
|
||||
|
||||
Use a task scheduler to parse data regularly. It's useless to parse data too often, as they don't change that fast, it's better to keep both search and opensim servers load low and avoid triggering spam reject. With cron, it could be something like this.
|
||||
|
||||
```
|
||||
0 * * * * curl -s http://yourgrid.org/parser.php
|
||||
30 */2 * * * curl -s http://yourgrid.org/eventsparser.php
|
||||
```
|
||||
For a complete installation with all features (search, currency, events, etc.), see the detailed instructions in [INSTALLATION.md](INSTALLATION.md).
|
||||
|
||||
## Credits
|
||||
|
||||
@@ -118,6 +89,6 @@ While most of the code is new or rewritten from scratch, portions of code may re
|
||||
- [Offline Messaging](http://opensimulator.org/wiki/Offline_Messaging)
|
||||
- [w4os OpenSim Web Interface](https://w4os.org/)
|
||||
- [2do HYPEvents](https://2do.directory)
|
||||
- [Speculoos' Flexible helper scripts](https://github.com/GuduleLapointe/flexible_helper_scripts)
|
||||
- [Speculoos' Flexible helper scripts](https://github.com/magicoli/opensim-helpers)
|
||||
|
||||
Unless otherwise specified, code is distributed as part of Flexible Helper Scripts package, under Affero GPL v3 license.
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
# Troubleshooting
|
||||
|
||||
Before troubleshooting a specific issue, make sure the basics are met:
|
||||
- The grid is up and running, you can log in-world properly
|
||||
- The website is up and running
|
||||
- You can reach your helpers subfolder (e.g. https://example.org/helpers/). It should display the opensim-helpers version.
|
||||
|
||||
## Search Not Working
|
||||
|
||||
1. **Verify Module Installation**
|
||||
- Make sure `OpenSimSearch.Modules.dll` is in your OpenSim bin/ directory
|
||||
|
||||
2. **Check Configuration**
|
||||
- Ensure both the `[Search]` and `[DataSnapshot]` sections are properly configured in OpenSim.ini
|
||||
- Double check the URLs in your configuration (they should point to your helpers installation)
|
||||
|
||||
3. **Verify Data Collection**
|
||||
- Make sure cron jobs are running (parser.php and eventsparser.php)
|
||||
- Check your search database tables to see if they contain data:
|
||||
```sql
|
||||
SELECT * FROM regions LIMIT 10;
|
||||
SELECT * FROM parcels LIMIT 10;
|
||||
```
|
||||
|
||||
4. **Force Data Update**
|
||||
- Try restarting the affected region after making configuration changes
|
||||
- Manually run `parser.php` to force an update of search data
|
||||
|
||||
5. **Viewer Settings**
|
||||
- Make sure you're using the right search server in your viewer
|
||||
- Some features like places search require clicking "All" or "Anywhere" to display results
|
||||
|
||||
### How to Use Search in Viewer
|
||||
|
||||
Many users are confused about how to actually use search once it's configured. Here's how:
|
||||
|
||||
1. **Places Search**:
|
||||
- Click the Search button in the bottom taskbar of the viewer
|
||||
- Select "Places" tab
|
||||
- Choose "All" or "Anywhere" in the dropdown
|
||||
- Type your search term and press Enter
|
||||
|
||||
2. **Land Sales**:
|
||||
- Click the Search button
|
||||
- Select "Land Sales" tab
|
||||
- Set your criteria and press Search
|
||||
- Make sure some parcels are actually for sale on your grid
|
||||
|
||||
3. **Events**:
|
||||
- Click the Search button
|
||||
- Select "Events" tab
|
||||
- Choose the category or "All" and press Search
|
||||
- Note: Events need to be added to the database before they appear
|
||||
|
||||
4. **Classifieds**:
|
||||
- Click the Search button
|
||||
- Select "Classifieds" tab
|
||||
- Type a search term and press Enter
|
||||
|
||||
If search is properly configured but no results appear, it's likely that either:
|
||||
- The search data hasn't been collected yet (wait for cron job or run parser.php manually)
|
||||
- There are no matching items in your grid
|
||||
- You need to use "All" or "Anywhere" instead of limiting to a specific region
|
||||
|
||||
### Classic Search vs. Web Search in Modern Viewers
|
||||
|
||||
It's important to understand that there are two different search systems in modern viewers:
|
||||
|
||||
1. **Classic Search Tabs** (implemented by this project):
|
||||
- Places, Land Sales, Events, and Classifieds tabs
|
||||
- These use the OpenSimSearch module and the helpers in this project
|
||||
- They are accessed through the individual tabs in the search panel
|
||||
- These work with the OpenSimSearch.Modules.dll and the search databases
|
||||
- **Configuration**: These use the `SearchURL` parameter in `[Search]` section of OpenSim.ini (simulator config)
|
||||
```ini
|
||||
[Search]
|
||||
Module = OpenSimSearch
|
||||
SearchURL = "http://example.org/helpers/query.php?gk=http://yourgrid.org:8002"
|
||||
```
|
||||
|
||||
2. **Global/Web Search** (not implemented in this project yet):
|
||||
- In modern viewers like Firestorm, there's also a "Web" or "All" tab
|
||||
- This is meant to load a web page with more advanced search capabilities
|
||||
- This feature is **not yet implemented** in the helpers
|
||||
- This tab will display the page provided by a different search URL setting
|
||||
- **Configuration**: This uses the `SearchURL` parameter in `[LoginService]` section of Robust.ini (grid config)
|
||||
```ini
|
||||
[LoginService]
|
||||
SearchURL = "http://example.org/search.php"
|
||||
```
|
||||
|
||||
**What to put at this URL while waiting for implementation:**
|
||||
- You can create a simple HTML page explaining search functionality
|
||||
- You can redirect to your grid's website or a custom search page
|
||||
- You can set it to a third-party search engine like opensimworld.com
|
||||
- Note: Always set this to a valid URL to avoid errors in server logs
|
||||
|
||||
When troubleshooting search, make sure you're testing the right type of search and that you've configured the correct URL in the appropriate configuration file:
|
||||
- Use the specific tabs (Places, Land Sales, Events, Classifieds) to test the functionality provided by these helpers
|
||||
- The "Web" or "All" tab requires a separate web interface that is not part of this package yet
|
||||
|
||||
## Currency Issues
|
||||
|
||||
### Gloebit Issues
|
||||
|
||||
1. **Certificate/SSL Problems**
|
||||
If you're seeing errors like "TrustFailure" or "CERTIFICATE_VERIFY_FAILED":
|
||||
|
||||
```bash
|
||||
sudo apt install ca-certificates-mono
|
||||
sudo cert-sync /etc/ssl/certs/ca-certificates.crt
|
||||
```
|
||||
|
||||
For LetsEncrypt certificates specifically:
|
||||
```bash
|
||||
# Download ISRG Root X1 certificate
|
||||
wget https://letsencrypt.org/certs/isrgrootx1.pem
|
||||
sudo cert-sync isrgrootx1.pem
|
||||
```
|
||||
|
||||
2. **Configuration Issues**
|
||||
- Verify that `Gloebit.dll` is correctly copied to the bin/ directory
|
||||
- Ensure your API keys are correct in OpenSim.ini
|
||||
- Check that the `economy` URL in OpenSim.ini points to your helpers installation
|
||||
|
||||
### Podex/MoneyServer Issues
|
||||
|
||||
1. **MoneyServer Confusion**
|
||||
- **Important**: MoneyServer is a standalone executable program, not a DLL
|
||||
- You need to download and run MoneyServer.exe separately from OpenSim
|
||||
- The simulator module that connects to MoneyServer is called DTLMoneyModule.dll
|
||||
- Do not look for a file named "MoneyServer.dll" as it doesn't exist
|
||||
|
||||
2. **Running MoneyServer**
|
||||
- MoneyServer should run as a separate process like Robust
|
||||
- It typically uses a different port (e.g., 8004) than Robust (8002/8003)
|
||||
- The process hierarchy should be:
|
||||
- Robust.exe (grid services)
|
||||
- MoneyServer.exe (currency services)
|
||||
- OpenSim.exe (one or more region simulators)
|
||||
|
||||
3. **MySQL SSL Issues**
|
||||
If you're having connection issues with MySQL, try disabling SSL for the connection:
|
||||
|
||||
```
|
||||
[mysqld]
|
||||
ssl=0
|
||||
skip-ssl
|
||||
disable-ssl
|
||||
```
|
||||
|
||||
4. **Configuration Mismatch**
|
||||
- Make sure MoneyScriptAccessKey in MoneyServer.ini matches the one in config.php
|
||||
- Verify database settings in MoneyServer.ini
|
||||
- Check that `DTLMoneyModule` (or `DTLNSLMoneyModule`) is properly configured in OpenSim.ini
|
||||
|
||||
## Database Issues
|
||||
|
||||
### Database Configuration
|
||||
|
||||
1. **Multiple Databases**
|
||||
- OpenSim helpers can use multiple databases for different functions:
|
||||
- Robust database (grid data)
|
||||
- Search database (can be the same as Robust)
|
||||
- MoneyServer database (separate for Podex/DTL)
|
||||
- In config.php, make sure each database section has correct credentials
|
||||
|
||||
2. **Database Creation**
|
||||
- The Robust database is created during OpenSim installation
|
||||
- The Search database tables are created automatically by the helpers
|
||||
- For MoneyServer, you may need to create a new database:
|
||||
```sql
|
||||
CREATE DATABASE moneyserver;
|
||||
GRANT ALL PRIVILEGES ON moneyserver.* TO 'opensim'@'localhost';
|
||||
```
|
||||
|
||||
3. **Connection Failures**
|
||||
- Verify database credentials in config.php
|
||||
- Check that the database server is running and accessible
|
||||
- Ensure the user has appropriate permissions
|
||||
|
||||
4. **Missing Tables**
|
||||
- Tables will be created automatically by the modules, but they need proper permissions
|
||||
- If tables are missing, you might need to manually create them
|
||||
|
||||
5. **Separate Databases**
|
||||
- If using separate databases for different functions (search, currency), make sure each is properly configured
|
||||
- For MoneyServer, a separate database is typically used and needs to be created beforehand
|
||||
|
||||
## HTTPS/SSL Issues
|
||||
|
||||
1. **Connection Failed**
|
||||
- If using HTTPS URLs and experiencing connection issues, try switching to HTTP for testing
|
||||
- Ensure your web server has a valid SSL certificate
|
||||
|
||||
2. **Mono Certificate Issues**
|
||||
- Mono has its own certificate store that needs to be updated
|
||||
- Use cert-sync to update the mono certificate store (see Gloebit troubleshooting above)
|
||||
|
||||
## Configuration Hierarchy
|
||||
|
||||
Understanding which configuration goes where can be confusing:
|
||||
|
||||
1. **Robust.ini / Robust.HG.ini (Grid-wide settings)**
|
||||
- Contains grid-wide settings that affect all regions
|
||||
- Set currency symbol and economy URL here
|
||||
- Example:
|
||||
```
|
||||
[GridInfoService]
|
||||
economy = https://example.org/helpers/
|
||||
[LoginService]
|
||||
Currency = YC$
|
||||
```
|
||||
|
||||
2. **OpenSim.ini (Simulator-specific)**
|
||||
- Contains settings for regions run by this simulator
|
||||
- Each simulator needs its own search and economy configuration
|
||||
- You can test changes on one simulator before updating all
|
||||
- Example:
|
||||
```
|
||||
[Economy]
|
||||
economymodule = DTLMoneyModule
|
||||
economy = https://example.org/helpers/
|
||||
```
|
||||
|
||||
3. **MoneyServer.ini**
|
||||
- Completely separate configuration file
|
||||
- Only needed if using Podex/DTL currency
|
||||
- Must match access key with config.php
|
||||
|
||||
## General Troubleshooting
|
||||
|
||||
1. **Check Log Files**
|
||||
- OpenSim log files (typically in bin/OpenSim.log)
|
||||
- Web server error logs
|
||||
- MoneyServer logs (if using Podex)
|
||||
|
||||
2. **PHP Errors**
|
||||
- Enable PHP error reporting in config.php or .htaccess:
|
||||
```php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
```
|
||||
|
||||
3. **Permissions**
|
||||
- Ensure web server has write access to any directories requiring it
|
||||
- Check file permissions on configuration files
|
||||
|
||||
4. **Version Compatibility**
|
||||
- These helpers are designed for OpenSimulator 0.9.x
|
||||
- Some features might not work with older or newer versions
|
||||
+37
-14
@@ -6,6 +6,8 @@ if( ! defined( 'OSHELPERS' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once( dirname(__DIR__) . '/includes/functions.php' );
|
||||
|
||||
class OpenSim_Grid {
|
||||
private static $grid_stats;
|
||||
private $grid_info;
|
||||
@@ -35,29 +37,39 @@ class OpenSim_Grid {
|
||||
}
|
||||
|
||||
public static function get_grid_info( $grid_uri = false, $args = array() ) {
|
||||
$info = array();
|
||||
// global $oshelpers_cache;
|
||||
|
||||
$key = __METHOD__ . md5( serialize( func_get_args() ) );
|
||||
$grids_info = os_cache_get( 'grids_info', array() );
|
||||
if( isset( $grids_info[$key] ) ) {
|
||||
$info = $grids_info[$key];
|
||||
if( ! empty( $info['gridname'] ) ) {
|
||||
return $grids_info[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$HomeURI = OpenSim::get_option( 'Hypergrid.HomeURI' );
|
||||
if( ! $grid_uri || $grid_uri === $HomeURI ) {
|
||||
$is_local_grid = true;
|
||||
// Default, get login_uri from config, query grid for live grid_info
|
||||
$grid_uri = OpenSim::get_option( 'Hypergrid.HomeURI' );
|
||||
$is_local_grid = ( ! $grid_uri || $grid_uri === $HomeURI );
|
||||
if( $is_local_grid ) {
|
||||
$grid_uri = $HomeURI;
|
||||
if( empty( $grid_uri ) ) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$is_local_grid = false;
|
||||
// External grid lookup, not yet implemented
|
||||
$info = array(
|
||||
'Grid Name' => 'External Grid, not implemented.',
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// If gridname not found, only try once to fetch grid info again
|
||||
$info = os_cache_get( 'grid_info_' . $key, false );
|
||||
if( $info ) {
|
||||
return $info;
|
||||
}
|
||||
|
||||
$info = array();
|
||||
|
||||
// Fetch live info from grid using $login_uri/get_grid_info and parse xml result in array
|
||||
// Example xml result:
|
||||
$xml_url = $grid_uri . '/get_grid_info';
|
||||
try {
|
||||
$xml = simplexml_load_file( $xml_url );
|
||||
$xml = @simplexml_load_file( $xml_url );
|
||||
} catch( Exception $e ) {
|
||||
$xml = false;
|
||||
}
|
||||
@@ -86,6 +98,17 @@ class OpenSim_Grid {
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($info)) {
|
||||
$info = false;
|
||||
}
|
||||
|
||||
// $oshelpers_cache[$key] = $info;
|
||||
$grids_info[$key] = $info;
|
||||
os_cache_set( 'grids_info', $grids_info );
|
||||
if( is_array( $info ) && empty( $info['gridname'] ) ) {
|
||||
$info['gridname'] = opensim_format_tp( $grid_uri, TPLINK_TXT );
|
||||
}
|
||||
os_cache_set( 'grid_info_' . $key, $info );
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@ class OpenSim_Page {
|
||||
protected $page_title;
|
||||
protected $content;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
public function __construct( $page_title = null, $content = null, $args = array() ) {
|
||||
$this->page_title = $page_title;
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
|
||||
+13
-4
@@ -52,6 +52,15 @@ class OpenSim {
|
||||
require_once( OSHELPERS_DIR . 'classes/class-exception.php' );
|
||||
require_once( OSHELPERS_DIR . 'includes/databases.php' );
|
||||
require_once( OSHELPERS_DIR . 'includes/functions.php' );
|
||||
|
||||
if ( file_exists( OSHELPERS_DIR . 'includes/config.php' ) ) {
|
||||
try {
|
||||
include_once( OSHELPERS_DIR . 'includes/config.php' );
|
||||
} catch ( Error $e ) {
|
||||
self::notify_error( $e );
|
||||
}
|
||||
}
|
||||
|
||||
$this->db_connect();
|
||||
|
||||
require_once( OSHELPERS_DIR . 'classes/class-locale.php' );
|
||||
@@ -485,12 +494,12 @@ class OpenSim {
|
||||
|
||||
$id = $string;
|
||||
try {
|
||||
$id = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $id );
|
||||
$id = preg_replace('/[-\s]+/', '-', $id );
|
||||
} catch ( Exception $e ) {
|
||||
error_log( 'Error sanitizing slug: ' . $e->getMessage() );
|
||||
$id = @transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $id );
|
||||
} catch ( Error $e ) {
|
||||
error_log( 'Warning (php-intl missing) ' . $e->getMessage() );
|
||||
$id = $string;
|
||||
}
|
||||
$id = preg_replace('/[-\s]+/', '-', $id );
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
Generated
+203
-213
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenSimulator Helpers installationn script
|
||||
*
|
||||
* This script will scan Robust configuration file to get your grid settings and generate the helpers configuration file.
|
||||
*
|
||||
* It is only needed to run this tool once, after that you delete this install.php file.
|
||||
*
|
||||
* @package magicoli/opensim-helpers
|
||||
**/
|
||||
|
||||
if ( __FILE__ !== $_SERVER['SCRIPT_FILENAME'] ) {
|
||||
// The file must only be called directly.
|
||||
http_response_code(403);
|
||||
exit( "I'm not that kind of girl, I don't want to be included." );
|
||||
}
|
||||
|
||||
require_once( __DIR__ . '/classes/init.php' ); // Common to all main scripts
|
||||
require_once( __DIR__ . '/classes/class-page.php' ); // Specific, because we generate a page
|
||||
// require_once( __DIR__ . '/classes/class-form.php' ); // Specific, because we use forms
|
||||
require_once( __DIR__ . '/includes/search.php' );
|
||||
|
||||
$site_title = "2do directory";
|
||||
$page = new OpenSim_Page( 'Directory Info' );
|
||||
$content = "";
|
||||
|
||||
$query = $SearchDB->prepareAndExecute(
|
||||
'SELECT * FROM parcels
|
||||
INNER JOIN ' . SEARCH_REGION_TABLE . ' AS r ON parcels.regionUUID = r.regionUUID',
|
||||
);
|
||||
$registered_parcels = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
$grids_info = osdb_cache_get( 'grids_info', array() );
|
||||
|
||||
// Calculate stats per gatekeeperURL
|
||||
$stats = [];
|
||||
foreach ($registered_parcels as $host) {
|
||||
$gatekeeperURL = $host['gatekeeperURL'];
|
||||
$grids_info[$gatekeeperURL] = $grids_info[$gatekeeperURL] ?? OpenSim_Grid::get_grid_info($gatekeeperURL);
|
||||
if (!isset($stats[$gatekeeperURL])) {
|
||||
$stats[$gatekeeperURL] = [
|
||||
'regions' => [],
|
||||
'parcels' => 0,
|
||||
];
|
||||
}
|
||||
$stats[$gatekeeperURL]['parcels']++;
|
||||
$region = $host['regionUUID'];
|
||||
$stats[$gatekeeperURL]['regions'][$region] = true;
|
||||
}
|
||||
|
||||
osdb_cache_set( 'grids_info', $grids_info, 86400 );
|
||||
|
||||
$grid_count = count($stats);
|
||||
$allregionscount = 0;
|
||||
$allparcelscount = 0;
|
||||
foreach ($stats as $gatekeeperURL => $data) {
|
||||
$regionCount = count($data['regions']);
|
||||
$allregionscount += $regionCount;
|
||||
$parcelCount = $data['parcels'];
|
||||
$allparcelscount += $parcelCount;
|
||||
$gridname = $grids_info[$gatekeeperURL]['gridname'] ?? $gatekeeperURL;
|
||||
$stats_display .= sprintf(
|
||||
'<a href="?gatekeeperURL=%s">%s</a> (%d regions, %d parcels) ',
|
||||
$gatekeeperURL,
|
||||
$gridname,
|
||||
$regionCount,
|
||||
$parcelCount
|
||||
);
|
||||
|
||||
// "$gatekeeperURL ($regionCount regions, $parcelCount parcels) ";
|
||||
}
|
||||
|
||||
$content = sprintf(
|
||||
'<strong>%d grids</strong>, %d regions, %d parcels ',
|
||||
$grid_count,
|
||||
$allregionscount,
|
||||
$allparcelscount
|
||||
);
|
||||
$content .= $stats_display;
|
||||
// $content .= "<p>Grid info cache: <pre>" . print_r($grids_info, true) . "</pre></p>";
|
||||
|
||||
if(! empty($debug)) {
|
||||
$content .= '<div class=debug> <p><strong>Debug data:</strong></p> <pre>' . print_r( $debug, true ) . '</pre></div>';
|
||||
}
|
||||
|
||||
$sidebar_right= "Right";
|
||||
$sidebar_left = "Left";
|
||||
|
||||
// $content = $page->get_content();
|
||||
|
||||
// Last step is to load template to display the page.
|
||||
require( 'templates/templates.php' );
|
||||
@@ -57,13 +57,32 @@ define( 'ROBUST_DB', array (
|
||||
'pass' => '',
|
||||
) );
|
||||
|
||||
define( 'OPENSIM_DB', true ); // Set to false for search only, see above
|
||||
/**
|
||||
* Robust console settings.
|
||||
*
|
||||
* It will allow more interactions with the Robust server in the future.
|
||||
* e.g. access to some region information without requiring a direct connection
|
||||
* to each simulator.
|
||||
*/
|
||||
define( 'ROBUST_CONSOLE', array(
|
||||
// 'ConsoleUser' => 'user',
|
||||
// 'ConsolePass' => 'password',
|
||||
// 'ConsolePort' => 8004,
|
||||
) );
|
||||
|
||||
/**
|
||||
* OpenSim DB refers here to the main database, i.e. Robust DB in the case
|
||||
* of a grid, or OpenSim db for a standalone simulator. It is only the historical
|
||||
* name of the settings and can be left as aliases of Robust DB credentials.
|
||||
* Transition is in progress to better differentiate the Robust/Standalone
|
||||
* main database from potential simulators/regions specific databases.
|
||||
*/
|
||||
define( 'OPENSIM_DB', true ); // Set to false for search only, see below
|
||||
define( 'OPENSIM_DB_HOST', ROBUST_DB['host'] );
|
||||
define( 'OPENSIM_DB_PORT', ROBUST_DB['port'] );
|
||||
define( 'OPENSIM_DB_NAME', ROBUST_DB['name'] );
|
||||
define( 'OPENSIM_DB_USER', ROBUST_DB['user'] );
|
||||
define( 'OPENSIM_DB_PASS', ROBUST_DB['pass'] );
|
||||
define( 'SEARCH_TABLE_EVENTS', 'events' );
|
||||
|
||||
/**
|
||||
* Search database credentials and settings.
|
||||
@@ -73,7 +92,8 @@ define( 'SEARCH_TABLE_EVENTS', 'events' );
|
||||
* - strongly recommended if the search engine is shared by several grids
|
||||
* - recommended and more efficient for large and/or hypergrid-enabled grids
|
||||
* - optional for closed grids and standalone simulators
|
||||
* These are recommendations, the Robust database can safely be used instead.
|
||||
* These are recommendations, the Robust/Main database can safely be used
|
||||
* in all cases.
|
||||
*/
|
||||
|
||||
define( 'SEARCH_DB', array(
|
||||
@@ -89,6 +109,8 @@ define( 'SEARCH_DB_NAME', SEARCH_DB['name'] );
|
||||
define( 'SEARCH_DB_USER', SEARCH_DB['user'] );
|
||||
define( 'SEARCH_DB_PASS', SEARCH_DB['pass'] );
|
||||
|
||||
define( 'SEARCH_TABLE_EVENTS', 'events' );
|
||||
|
||||
/**
|
||||
* Other registrars to forward hosts registrations (deprecated)
|
||||
*
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php if ( ! defined( 'W4OS_PLUGIN' ) ) {
|
||||
die();}
|
||||
/*
|
||||
* config.php
|
||||
*
|
||||
* Helpers configuration for W4OS plugin.
|
||||
* Not for use with standalone helpers.
|
||||
*
|
||||
* Part of "flexible_helpers_scripts" collection
|
||||
* https://github.com/GuduleLapointe/flexible_helper_scripts
|
||||
* by Gudule Lapointe <gudule@speculoos.world>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Grid info
|
||||
*/
|
||||
define( 'OPENSIM_GRID_NAME', get_option( 'w4os_grid_name', 'OpenSimulator' ) );
|
||||
define( 'OPENSIM_LOGIN_URI', W4OS_GRID_LOGIN_URI );
|
||||
define( 'OPENSIM_MAIL_SENDER', get_option( 'w4os_offline_sender', 'no-reply@' . $_SERVER['SERVER_NAME'] ) );
|
||||
// define('OPENSIM_GRID_LOGO_URL', (get_theme_mod( 'custom_logo' )) ? wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ) , 'full' )[0] : '');
|
||||
|
||||
define( 'HYPEVENTS_URL', preg_replace( ':/$:', '', get_option( 'w4os_hypevents_url', 'https://2do.pm/events' ) ) );
|
||||
|
||||
/**
|
||||
* Main database.
|
||||
* For grids, use Robust database credentials.
|
||||
* For standalone simulators, use OpenSim database credentials.
|
||||
*
|
||||
* Access to OpenSim database is required
|
||||
* - for search including classifieds
|
||||
* - for offline messages processing
|
||||
* - for economy
|
||||
* It is not required if only search is needed, without classifieds (e.g. to for
|
||||
* a multi-grid search engine). In this case search will only provide results
|
||||
* for places, land for sale and events.
|
||||
*/
|
||||
define( 'OPENSIM_DB_HOST', get_option( 'w4os_db_host' ) );
|
||||
define( 'OPENSIM_DB_NAME', get_option( 'w4os_db_database' ) );
|
||||
define( 'OPENSIM_DB_USER', get_option( 'w4os_db_user' ) );
|
||||
define( 'OPENSIM_DB_PASS', get_option( 'w4os_db_pass' ) );
|
||||
define( 'OPENSIM_DB', ( ! empty( OPENSIM_DB_HOST ) & ! empty( OPENSIM_DB_NAME ) & ! empty( OPENSIM_DB_USER ) & ! empty( OPENSIM_DB_PASS ) ) ? true : false );
|
||||
|
||||
/**
|
||||
* Search database credentials and settings.
|
||||
* Needed if you enable search in OpenSim server.
|
||||
*
|
||||
* A dedicated database is:
|
||||
* - strongly recommended if the search engine is shared by several grids
|
||||
* - recommended and more efficient for large and/or hypergrid-enabled grids
|
||||
* - optional for closed grids and standalone simulators
|
||||
* These are recommendations, the Robust database can safely be used instead.
|
||||
*/
|
||||
define( 'SEARCH_DB_HOST', get_option( 'w4os_search_db_host', OPENSIM_DB_HOST ) );
|
||||
define( 'SEARCH_DB_NAME', get_option( 'w4os_search_db_database', OPENSIM_DB_NAME ) );
|
||||
define( 'SEARCH_DB_USER', get_option( 'w4os_search_db_user', OPENSIM_DB_USER ) );
|
||||
define( 'SEARCH_DB_PASS', get_option( 'w4os_search_db_pass', OPENSIM_DB_PASS ) );
|
||||
|
||||
/**
|
||||
* Other registrars to forward hosts registrations.
|
||||
*
|
||||
* This method is not needed as with current OpenSim server (0.9.x) which allow
|
||||
* specifying multiple registrars, but could be used in the future to implement
|
||||
* peer to peer information sharing.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
define(
|
||||
'SEARCH_REGISTRARS',
|
||||
array(
|
||||
// 'http://2do.directory/helpers/register.php',
|
||||
// 'http://metaverseink.com/cgi-bin/register.py',
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Currency database credentials and settings.
|
||||
* Needed if currency is enabled on OpenSim server.
|
||||
* A dedicated database is recommended, but not mandatory.
|
||||
*/
|
||||
define( 'CURRENCY_DB_HOST', get_option( 'w4os_economy_db_host' ) );
|
||||
define( 'CURRENCY_DB_NAME', get_option( 'w4os_economy_db_database' ) );
|
||||
define( 'CURRENCY_DB_USER', get_option( 'w4os_economy_db_user' ) );
|
||||
define( 'CURRENCY_DB_PASS', get_option( 'w4os_economy_db_pass' ) );
|
||||
define( 'CURRENCY_MONEY_TBL', 'balances' );
|
||||
define( 'CURRENCY_TRANSACTION_TBL', 'transactions' );
|
||||
|
||||
/**
|
||||
* Money Server settings.
|
||||
*/
|
||||
define( 'CURRENCY_USE_MONEYSERVER', true );
|
||||
define( 'CURRENCY_SCRIPT_KEY', get_option( 'w4os_money_script_access_key', '123456789' ) );
|
||||
$currency_rate = (float) get_option( 'w4os_currency_rate', 10 );
|
||||
define( 'CURRENCY_RATE', ( $currency_rate <= 0 ? 10 : $currency_rate ) ); // amount in dollar...
|
||||
$currency_per = (int) get_option( 'w4os_currency_rate_per', 1000 );
|
||||
define( 'CURRENCY_RATE_PER', ( $currency_per <= 0 ? 1000 : $currency_per ) ); // ... for this amount in virtuall currency
|
||||
define( 'CURRENCY_PROVIDER', get_option( 'w4os_currency_provider' ) );
|
||||
if ( ! defined( 'CURRENCY_HELPER_URL' ) ) {
|
||||
define( 'CURRENCY_HELPER_URL', ( ! empty( W4OS_GRID_INFO['economy'] ) ) ? W4OS_GRID_INFO['economy'] : get_home_url( null, '/economy/' ) );
|
||||
}
|
||||
switch ( CURRENCY_PROVIDER ) {
|
||||
case 'podex':
|
||||
if ( ! empty( get_option( 'w4os_podex_error_message' ) ) ) {
|
||||
define( 'PODEX_ERROR_MESSAGE', get_option( 'w4os_podex_error_message' ) );
|
||||
}
|
||||
if ( ! empty( get_option( 'w4os_podex_redirect_url' ) ) ) {
|
||||
define( 'PODEX_REDIRECT_URL', get_option( 'w4os_podex_redirect_url' ) );
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// if (!defined('CURRENCY_HELPER_PATH')) define('CURRENCY_HELPER_PATH', dirname(__DIR__));
|
||||
|
||||
/**
|
||||
* Timezone settings. Leave commented if included in a larger project. You
|
||||
* dont want to mess up with timezone randomly in the middle of a process!
|
||||
*/
|
||||
// define('OPENSIM_USE_UTC_TIME', false);
|
||||
// if (OPENSIM_USE_UTC_TIME) date_default_timezone_set('UTC');
|
||||
|
||||
/**
|
||||
* OffLine messages DB credentials.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
define( 'OFFLINE_DB_HOST', OPENSIM_DB_HOST );
|
||||
define( 'OFFLINE_DB_NAME', OPENSIM_DB_NAME );
|
||||
define( 'OFFLINE_DB_USER', OPENSIM_DB_USER );
|
||||
define( 'OFFLINE_DB_PASS', OPENSIM_DB_PASS );
|
||||
define( 'OFFLINE_MESSAGE_TBL', 'im_offline' ); // Same DB as Offline Module V2?
|
||||
|
||||
/**
|
||||
* Mute list database.
|
||||
* mute is now handled by OpenSim server (0.9.x), so we shouldn't need this
|
||||
*/
|
||||
// define('MUTE_DB_HOST', OPENSIM_DB_HOST);
|
||||
// define('MUTE_DB_NAME', OPENSIM_DB_NAME);
|
||||
// define('MUTE_DB_USER', OPENSIM_DB_USER);
|
||||
// define('MUTE_DB_PASS', OPENSIM_DB_PASS);
|
||||
// define('MUTE_LIST_TBL', 'mute_list');
|
||||
|
||||
|
||||
/**
|
||||
* Additional custom config
|
||||
* (e.g. define custom values for addons here)
|
||||
*/
|
||||
// define('MY_CONSTANT_NAME', 'my value');
|
||||
|
||||
/**
|
||||
* DO NOT MAKE CHANGES BELOW THIS
|
||||
* Add your custom values above.
|
||||
*/
|
||||
require_once 'databases.php';
|
||||
require_once 'functions.php';
|
||||
|
||||
$currency_addon = dirname( __DIR__ ) . '/addons/' . CURRENCY_PROVIDER . '.php';
|
||||
if ( file_exists( $currency_addon ) ) {
|
||||
require_once $currency_addon;
|
||||
}
|
||||
@@ -33,8 +33,15 @@ class OSPDO extends PDO {
|
||||
$trace = debug_backtrace()[0];
|
||||
$trace = $trace['file'] . ':' . $trace['line'];
|
||||
|
||||
$statement = $this->prepare( $query, $options );
|
||||
$result = $statement->execute( $params );
|
||||
try {
|
||||
$statement = $this->prepare( $query, $options );
|
||||
$result = $statement->execute( $params );
|
||||
} catch ( PDOException $e ) {
|
||||
error_log( 'Error ' . $e->getCode() . ' ' . $e->getMessage() . ' query ' . print_r( $query, true ) . ' params ' . print_r( $params, true ) . ' ' . $trace );
|
||||
return false;
|
||||
}
|
||||
// $statement = $this->prepare( $query, $options );
|
||||
// $result = $statement->execute( $params );
|
||||
|
||||
if ( $result ) {
|
||||
return $statement;
|
||||
|
||||
+64
-14
@@ -378,19 +378,41 @@ function oxXmlRequest( $gatekeeper, $method, $request ) {
|
||||
}
|
||||
|
||||
function osXmlResponse( $success = true, $errorMessage = false, $data = false ) {
|
||||
global $request_key;
|
||||
|
||||
// Data given, output as xmlrpc
|
||||
if ( is_array( $data ) ) {
|
||||
if( ! $success && ! empty( $errorMessage ) ) {
|
||||
# Avoid duplicate error messages
|
||||
# TODO: improve to make sure we don't cache error messages for different requests
|
||||
# (currently $request_key only identifies search arguments, client IP and gateway url,
|
||||
# but client IP is the simulator, not the actual user, so in theory, the key could
|
||||
# be identical for two simultaneous requests by different users in the same region,
|
||||
# although this is unlikely to happen)
|
||||
|
||||
$tmp_dir = get_writable_tmp_dir();
|
||||
$cache = $tmp_dir . '/cache-' . $request_key;
|
||||
# Check if file exists and is not older than 5 seconds
|
||||
if ( file_exists( $cache ) && ( time() - filemtime( $cache ) < 1.5 ) ) {
|
||||
$errorMessage = '';
|
||||
} else {
|
||||
file_put_contents( $cache, $errorMessage );
|
||||
}
|
||||
}
|
||||
|
||||
$array = array(
|
||||
'success' => $success,
|
||||
'errorMessage' => $errorMessage,
|
||||
'data' => $data,
|
||||
);
|
||||
if ( ! empty( $data ) ) {
|
||||
$array['data'] = $data;
|
||||
}
|
||||
array_filter( $array );
|
||||
|
||||
$response_xml = xmlrpc_encode( $array );
|
||||
|
||||
echo $response_xml;
|
||||
return;
|
||||
}
|
||||
|
||||
// No data given, output simple boolean or error message, no change here
|
||||
if ( $success ) {
|
||||
$answer = new SimpleXMLElement( '<boolean>true</boolean>' );
|
||||
} else {
|
||||
@@ -517,19 +539,47 @@ function set_helpers_locale( $locale = null, $domain = 'messages' ) {
|
||||
textdomain( $domain );
|
||||
}
|
||||
|
||||
define( 'NULL_KEY', '00000000-0000-0000-0000-000000000000' );
|
||||
define( 'TPLINK_LOCAL', 1 ); // seconlife://Region/x/y/z
|
||||
define( 'TPLINK_HG', 2 ); // seconlife://yourgrid.org:8002 Region/x/y/z
|
||||
define( 'TPLINK_V3HG', 4 ); // the overcomplicated stuff!
|
||||
define( 'TPLINK_HOP', 8 ); // hop://yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK_TXT', 16 ); // yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK_APPTP', 32 ); // secondlife:///app/teleport/yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK_MAP', 64 ); // secondlife:///app/map/yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK', pow( 2, 8 ) - 1 ); // all formats
|
||||
define( 'TPLINK_DEFAULT', TPLINK_HOP ); // default
|
||||
function get_writable_tmp_dir() {
|
||||
if(isset($_GLOBALS['tmp_dir'])) {
|
||||
return $_GLOBALS['tmp_dir'];
|
||||
}
|
||||
$dirs = array( sys_get_temp_dir(), ini_get('upload_tmp_dir'), '/tmp', '/var/tmp', '/usr/tmp', '.' );
|
||||
foreach ( $dirs as $dir ) {
|
||||
if ( @is_writable( $dir ) ) {
|
||||
$_GLOBALS['tmp_dir'] = $dir;
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
error_log( __FILE__ . ':' . __LINE__ . ' ERROR - could not find a writable temporary directory, check web server and PHP config' );
|
||||
return false;
|
||||
// return '/tmp';
|
||||
}
|
||||
|
||||
if( ! defined( 'NULL_KEY') ) define( 'NULL_KEY', '00000000-0000-0000-0000-000000000000' );
|
||||
if( ! defined( 'TPLINK_LOCAL') ) {
|
||||
define( 'TPLINK_LOCAL', 1 ); // seconlife://Region/x/y/z
|
||||
define( 'TPLINK_HG', 2 ); // seconlife://yourgrid.org:8002 Region/x/y/z
|
||||
define( 'TPLINK_V3HG', 4 ); // the overcomplicated stuff!
|
||||
define( 'TPLINK_HOP', 8 ); // hop://yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK_TXT', 16 ); // yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK_APPTP', 32 ); // secondlife:///app/teleport/yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK_MAP', 64 ); // secondlife:///app/map/yourgrid.org:8002:Region/x/y/z
|
||||
define( 'TPLINK', pow( 2, 8 ) - 1 ); // all formats
|
||||
define( 'TPLINK_DEFAULT', TPLINK_HOP ); // default
|
||||
}
|
||||
|
||||
define( 'HELPERS_LOCALE_DIR', dirname( __DIR__ ) . '/languages' );
|
||||
|
||||
function os_cache_get( $key, $default = null ) {
|
||||
global $oshelpers_cache;
|
||||
return isset( $oshelpers_cache[$key] ) ? $oshelpers_cache[$key] : $default;
|
||||
}
|
||||
|
||||
function os_cache_set( $key, $value, $expire = 0 ) {
|
||||
global $oshelpers_cache;
|
||||
$oshelpers_cache[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenSim source to help further attempts to allow Hypergrid search results.
|
||||
* Infouuid is a fake parcelid resolving to region handle and (region-level?)
|
||||
|
||||
+79
-5
@@ -24,7 +24,9 @@ function ossearch_db_tables( $db ) {
|
||||
if ( ! $db->connected ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$SEARCH_TABLE_EVENTS = SEARCH_TABLE_EVENTS;
|
||||
$SEARCH_REGION_TABLE = SEARCH_REGION_TABLE;
|
||||
|
||||
$query = $db->prepare(
|
||||
"CREATE TABLE IF NOT EXISTS `allparcels` (
|
||||
`regionUUID` char(36) NOT NULL,
|
||||
@@ -59,7 +61,7 @@ function ossearch_db_tables( $db ) {
|
||||
PRIMARY KEY (`classifieduuid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `" . SEARCH_TABLE_EVENTS . "` (
|
||||
CREATE TABLE IF NOT EXISTS `$SEARCH_TABLE_EVENTS` (
|
||||
`owneruuid` char(36) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`eventid` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
@@ -151,7 +153,7 @@ function ossearch_db_tables( $db ) {
|
||||
PRIMARY KEY (`parcelUUID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `" . SEARCH_REGION_TABLE . '` (
|
||||
CREATE TABLE IF NOT EXISTS `$SEARCH_REGION_TABLE` (
|
||||
`regionname` varchar(255) NOT NULL,
|
||||
`regionUUID` char(36) NOT NULL,
|
||||
`regionhandle` varchar(255) NOT NULL,
|
||||
@@ -161,7 +163,14 @@ function ossearch_db_tables( $db ) {
|
||||
`gatekeeperURL` varchar(255),
|
||||
PRIMARY KEY (`regionUUID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
'
|
||||
|
||||
CREATE TABLE IF NOT EXISTS oshelpers_cache (
|
||||
`cache_key` VARCHAR(255) NOT NULL,
|
||||
`cache_value` LONGBLOB,
|
||||
`cache_expires` int(10) default 0,
|
||||
PRIMARY KEY (`cache_key`)
|
||||
) ENGINE=InnoDB;
|
||||
"
|
||||
);
|
||||
|
||||
$result = $query->execute();
|
||||
@@ -243,6 +252,71 @@ function ossearch_hostUnregister( $hostname, $port ) {
|
||||
}
|
||||
}
|
||||
|
||||
function osdb_cache_get( $key, $default = null ) {
|
||||
global $SearchDB;
|
||||
if ( ! $SearchDB ) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$query = $SearchDB->prepareAndExecute(
|
||||
'SELECT cache_value FROM oshelpers_cache WHERE cache_key = :key AND (cache_expires IS NULL OR cache_expires = 0 OR cache_expires > :now)',
|
||||
array(
|
||||
'key' => $key,
|
||||
'now' => $now,
|
||||
),
|
||||
);
|
||||
|
||||
if ( $query ) {
|
||||
$result = $query->fetchAll( PDO::FETCH_ASSOC );
|
||||
if( is_array( $result ) && isset( $result[0] ) ) {
|
||||
$raw = $result[0]['cache_value'];
|
||||
|
||||
if ( $raw ) {
|
||||
$value = json_decode( $raw, true );
|
||||
if( ! $value ) {
|
||||
$value = $raw;
|
||||
}
|
||||
return $value;
|
||||
} else if( $result ) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
function osdb_cache_set( $key, $value, $expire_delay = 0 ) {
|
||||
global $SearchDB;
|
||||
if ( ! $SearchDB ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$now = time();
|
||||
if( $expire_delay > $now ) {
|
||||
$expires = $expire_delay;
|
||||
} else if( ! empty( $expire_delay ) ) {
|
||||
$expires = $now + $expire_delay;
|
||||
} else {
|
||||
$expires = 0;
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO oshelpers_cache (`cache_key`, `cache_value`, `cache_expires`)
|
||||
VALUES (:key, :value, :expires)
|
||||
ON DUPLICATE KEY UPDATE `cache_value` = :value, `cache_expires` = :expires';
|
||||
|
||||
$query = $SearchDB->prepareAndExecute(
|
||||
$sql,
|
||||
array(
|
||||
'key' => $key,
|
||||
'value' => json_encode( $value ),
|
||||
'expires' => $expires,
|
||||
),
|
||||
);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
try {
|
||||
$SearchDB = new OSPDO( 'mysql:host=' . SEARCH_DB_HOST . ';dbname=' . SEARCH_DB_NAME, SEARCH_DB_USER, SEARCH_DB_PASS );
|
||||
} catch ( PDOException $e ) {
|
||||
@@ -266,7 +340,7 @@ if ( $SearchDB && $SearchDB->connected ) {
|
||||
}
|
||||
define( 'SEARCH_REGION_TABLE', $regions_table );
|
||||
|
||||
if ( ! tableExists( $SearchDB, array( SEARCH_REGION_TABLE, 'parcels', 'parcelsales', 'allparcels', 'objects', 'popularplaces', SEARCH_TABLE_EVENTS, 'classifieds', 'hostsregister' ) ) ) {
|
||||
if ( ! tableExists( $SearchDB, array( 'oshelpers_cache', SEARCH_REGION_TABLE, 'parcels', 'parcelsales', 'allparcels', 'objects', 'popularplaces', SEARCH_TABLE_EVENTS, 'classifieds', 'hostsregister' ) ) ) {
|
||||
error_log( 'Creating missing OpenSimSearch tables in ' . SEARCH_DB_NAME );
|
||||
ossearch_db_tables( $SearchDB );
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ function dir_places_query( $method_name, $params, $app_data ) {
|
||||
}
|
||||
|
||||
if ( empty( $data ) ) {
|
||||
// osXmlDie( 'Nothing found' );
|
||||
osXmlResponse( true, 'No results', $data );
|
||||
osXmlResponse( false, 'No results', $data );
|
||||
// osXmlResponse( false );
|
||||
} else {
|
||||
osXmlResponse( true, '', $data );
|
||||
}
|
||||
@@ -629,10 +629,35 @@ function classifieds_info_query( $method_name, $params, $app_data ) {
|
||||
osXmlResponse( true, '', $data );
|
||||
}
|
||||
|
||||
$tmp_dir = get_writable_tmp_dir();
|
||||
|
||||
//
|
||||
// Process the request
|
||||
//
|
||||
$request_xml = file_get_contents( 'php://input' );
|
||||
|
||||
// error_log( __FILE__ . ':' . __LINE__ . ' request xml ' . $request_xml );
|
||||
|
||||
if( ! $request_xml ) {
|
||||
// Wrong request, probably called directly instead of by sending xml request,
|
||||
// or no data sent, issue proper http response and error message, then die
|
||||
header( 'HTTP/1.1 400 Bad Request' );
|
||||
header( 'Content-Type: text/plain' );
|
||||
die( '400 Bad Request' . PHP_EOL );
|
||||
}
|
||||
|
||||
$request_array = array(
|
||||
$_SERVER['REMOTE_ADDR'],
|
||||
$_SERVER['REQUEST_URI'],
|
||||
$request_xml
|
||||
);
|
||||
$request_key = md5( serialize( $request_array ) );
|
||||
|
||||
// error_log( __FILE__ . ':' . __LINE__
|
||||
// . PHP_EOL . 'request xml ' . $request_xml
|
||||
// . PHP_EOL . 'client ip ' . $_SERVER['REMOTE_ADDR']
|
||||
// . PHP_EOL . 'request uri ' . $_SERVER['REQUEST_URI'] );
|
||||
|
||||
xmlrpc_server_call_method( $xmlrpc_server, $request_xml, '' );
|
||||
|
||||
xmlrpc_server_destroy( $xmlrpc_server );
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
$site_title = $site_title ?? 'OpenSimulator Helpers';
|
||||
$page_title = $page_title ?? 'Unknown page';
|
||||
$content = $content ?? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris.';
|
||||
|
||||
$sidebar_left = $sidebar_left ?? '';
|
||||
$sidebar_right = $sidebar_right ?? '';
|
||||
$page_title = $page_title ?? $page->get_page_title() ?? 'Unknown page';
|
||||
$content = $content ?? $page->get_content() ?? 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris.';
|
||||
$sidebar_left = $sidebar_left ?? $page->get_sidebar('left');
|
||||
$sidebar_right = $sidebar_right ?? $page->get_sidebar('right');
|
||||
|
||||
$version = OpenSim::get_version();
|
||||
$footer = $footer ?? sprintf( _('OpenSimulator Helpers %s'), $version );
|
||||
|
||||
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
|
||||
SearchURL="https://2do.directory/helpers/query.php"
|
||||
GatekeeperURL="http://speculoos.world:8002"
|
||||
|
||||
PGM=$(basename $0)
|
||||
searchstring="$@"
|
||||
|
||||
|
||||
echo "Searching for: $searchstring" > /dev/stderr
|
||||
|
||||
url=$SearchURL?gk=$GatekeeperURL
|
||||
echo "SearchURL: $url" > /dev/stderr
|
||||
|
||||
xml="<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
||||
<methodCall>
|
||||
<methodName>dir_places_query</methodName>
|
||||
<params>
|
||||
<param>
|
||||
<value>
|
||||
<struct>
|
||||
<member>
|
||||
<name>category</name>
|
||||
<value><string>-1</string></value>
|
||||
</member>
|
||||
<member>
|
||||
<name>text</name>
|
||||
<value><string>$searchstring</string></value>
|
||||
</member>
|
||||
<member>
|
||||
<name>flags</name>
|
||||
<value><string>117441536</string></value>
|
||||
</member>
|
||||
<member>
|
||||
<name>query_start</name>
|
||||
<value><string>0</string></value>
|
||||
</member>
|
||||
<member>
|
||||
<name>sim_name</name>
|
||||
<value><string/></value>
|
||||
</member>
|
||||
</struct>
|
||||
</value>
|
||||
</param>
|
||||
</params>
|
||||
</methodCall>"
|
||||
|
||||
# Sample responses:
|
||||
# Search with no results:
|
||||
# <?xml version="1.0" encoding="utf-8"?>
|
||||
# <params><param><value><struct>
|
||||
# <member>
|
||||
# <name>success</name>
|
||||
# <value>
|
||||
# <boolean>0</boolean>
|
||||
# </value>
|
||||
# </member>
|
||||
# <member>
|
||||
# <name>errorMessage</name>
|
||||
# <value>
|
||||
# <string>No results</string>
|
||||
# </value>
|
||||
# </member>
|
||||
# </struct></value></param></params>
|
||||
#
|
||||
# Search with results:
|
||||
# <?xml version="1.0" encoding="utf-8"?>
|
||||
# <params><param><value><struct>
|
||||
# <member>
|
||||
# <name>success</name>
|
||||
# <value>
|
||||
# <boolean>1</boolean>
|
||||
# </value>
|
||||
# </member>
|
||||
# <member>
|
||||
# <name>errorMessage</name>
|
||||
# <value>
|
||||
# <string/>
|
||||
# </value>
|
||||
# </member>
|
||||
# <member>
|
||||
# <name>data</name>
|
||||
# (etc)
|
||||
# </struct></value></param></params>
|
||||
|
||||
|
||||
# Send POST request with the XML content so that query.php receives it via php://input
|
||||
response=$(curl -s -X POST -H "Content-Type: text/xml" --data "$xml" "$url")
|
||||
|
||||
# Remove extra spaces between tags without eliminating newlines entirely
|
||||
response_oneline="$(echo "$response" | sed ':a;N;$!ba;s/>\s\+</></g')"
|
||||
|
||||
# Extract success and errorMessage using sed
|
||||
success=$(echo "$response_oneline" | sed -n 's/.*<name>success<\/name>.*<boolean>\([01]\)<\/boolean>.*/\1/p')
|
||||
errorMessage=$(echo "$response_oneline" | sed -n 's/.*<name>errorMessage<\/name>.*<string>\(.*\)<\/string>.*/\1/p')
|
||||
|
||||
# If errorMessage is "False", change it to empty string.
|
||||
if [ "$errorMessage" = "False" ]; then
|
||||
errorMessage=""
|
||||
fi
|
||||
|
||||
echo "$PGM: Success=$success, Error Message='$errorMessage'"
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<?php namespace OpenSimulator\Helpers;
|
||||
|
||||
/*
|
||||
* wp-load.php
|
||||
*
|
||||
* Loader for helpers implmentation in W4OS WordPress plugin.
|
||||
* Not needed in standalone implementations.
|
||||
*
|
||||
* Part of w4os - WordPress interface For OpenSimulator
|
||||
* https://github.com/GuduleLapointe/w4os/
|
||||
* by Gudule Lapointe <gudule@speculoos.world>
|
||||
*/
|
||||
|
||||
if ( ! defined( 'W4OS_PLUGIN' ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
$url = parse_url( getenv( 'REQUEST_URI' ), PHP_URL_PATH );
|
||||
|
||||
if ( get_option( 'w4os_provide_economy_helpers' ) == true & ! empty( W4OS_GRID_INFO['economy'] ) ) {
|
||||
$economy = parse_url( W4OS_GRID_INFO['economy'] )['path'];
|
||||
if ( preg_match( ":^$economy(currency.php|landtool.php):", $url ) ) {
|
||||
$helper = preg_replace( ":^$economy:", '', $url );
|
||||
require $helper;
|
||||
die();
|
||||
} elseif ( $url == $economy ) {
|
||||
// Probably the url check, just accept it
|
||||
// TODO: redirect to support page if set
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
if ( get_option( 'w4os_provide_offline_messages' ) == true & ! empty( W4OS_GRID_INFO['OfflineMessageURL'] ) ) {
|
||||
$message = parse_url( W4OS_GRID_INFO['OfflineMessageURL'] )['path'];
|
||||
if ( preg_match( ":^$message/(SaveMessage|RetrieveMessages|offlineim)/:", "$url/" ) ) {
|
||||
require 'offline.php';
|
||||
} elseif ( $message == $url ) {
|
||||
die(); // ignore but don't trigger an error
|
||||
}
|
||||
}
|
||||
|
||||
if ( get_option( 'w4os_provide_search' ) == true ) {
|
||||
if ( ! empty( get_option( 'w4os_search_url' ) ) ) {
|
||||
$search = parse_url( get_option( 'w4os_search_url' ) )['path'];
|
||||
if ( preg_match( ":^$search/:", "$url/" ) ) {
|
||||
// error_log("search $search");
|
||||
require 'query.php';
|
||||
die();
|
||||
}
|
||||
$parser = preg_replace( ':^//:', '/', dirname( $search ) . '/parser.php' );
|
||||
if ( preg_match( ":^$parser/:", "$url/" ) ) {
|
||||
require 'parser.php';
|
||||
die();
|
||||
}
|
||||
|
||||
if ( ! empty( get_option( 'w4os_hypevents_url' ) ) ) {
|
||||
$hypevents = preg_replace( ':^//:', '/', dirname( $search ) . '/eventsparser.php' );
|
||||
if ( preg_match( ":^$hypevents:", "$url/" ) ) {
|
||||
require 'eventsparser.php';
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( get_option( 'w4os_search_register' ) ) ) {
|
||||
$register = parse_url( get_option( 'w4os_search_register' ) )['path'];
|
||||
if ( preg_match( ":^$register:", "$url/" ) ) {
|
||||
require 'register.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user